1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE DeriveGeneric #-}
4 module Distribution
.Types
.AbiDependency
where
6 import Distribution
.Compat
.Prelude
9 import Distribution
.Parsec
10 import Distribution
.Pretty
12 import qualified Distribution
.Compat
.CharParsing
as P
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, Typeable
)
32 instance Pretty AbiDependency
where
33 pretty
(AbiDependency uid abi
) =
34 pretty uid
<<>> Disp
.char
'=' <<>> pretty abi
36 instance Parsec AbiDependency
where
41 return (AbiDependency uid abi
)
43 instance Binary AbiDependency
44 instance Structured AbiDependency
45 instance NFData AbiDependency
where rnf
= genericRnf