1 {-# LANGUAGE DeriveGeneric #-}
2 module Distribution
.Types
.AbiDependency
where
4 import Distribution
.Compat
.Prelude
7 import Distribution
.Parsec
.Class
8 import Distribution
.Pretty
9 import Distribution
.Text
11 import qualified Distribution
.Compat
.CharParsing
as P
12 import qualified Distribution
.Compat
.ReadP
as Parse
13 import qualified Distribution
.Package
as Package
14 import qualified Text
.PrettyPrint
as Disp
16 -- | An ABI dependency is a dependency on a library which also
17 -- records the ABI hash ('abiHash') of the library it depends
20 -- The primary utility of this is to enable an extra sanity when
21 -- GHC loads libraries: it can check if the dependency has a matching
22 -- ABI and if not, refuse to load this library. This information
23 -- is critical if we are shadowing libraries; differences in the
24 -- ABI hash let us know what packages get shadowed by the new version
26 data AbiDependency
= AbiDependency
{
27 depUnitId
:: Package
.UnitId
,
28 depAbiHash
:: Package
.AbiHash
30 deriving (Eq
, Generic
, Read, Show)
32 instance Pretty AbiDependency
where
33 pretty
(AbiDependency uid abi
) =
34 disp uid
<<>> Disp
.char
'=' <<>> disp abi
36 instance Parsec AbiDependency
where
41 return (AbiDependency uid abi
)
43 instance Text AbiDependency
where
48 return (AbiDependency uid abi
)
50 instance Binary AbiDependency
52 instance NFData AbiDependency
where rnf
= genericRnf