A unit identifier identifies a (possibly instantiated) package/component that can be installed the installed package database. There are several types of components that can be installed:
A traditional library with no holes, so that
unitIdHashisNothing. In the absence of Backpack, UnitId is the same as a ComponentId.An indefinite, Backpack library with holes. In this case,
unitIdHashis stillNothing, but in the install, there are only interfaces, no compiled objects.An instantiated Backpack library with all the holes filled in.
unitIdHashis aJusta hash of the instantiating mapping.
A unit is a component plus the additional information on how the holes are filled in. Thus there is a one to many relationship: for a particular component there are many different ways of filling in the holes, and each different combination is a unit (and has a separate UnitId).
UnitId is distinct from OpenUnitId, in that it is always
installed, whereas OpenUnitId are intermediate unit identities
that arise during mixin linking, and don't necessarily correspond
to any actually installed unit. Since the mapping is not actually
recorded in a UnitId, you can't actually substitute over them
(but you can substitute over OpenUnitId). See also
Distribution.Backpack.FullUnitId for a mechanism for expanding an
instantiated UnitId to retrieve its mapping.
Backwards compatibility note: if you need to get the string
representation of a UnitId to pass, e.g., as a -package-id
flag, use the display function, which will work on all
versions of Cabal.
Instances13Eq, Data, Ord, Read, Show, IsString, …
Eq UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdData UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdOrd UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdRead UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdShow UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdIsString UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdGeneric UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdNFData UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdBinary UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdParsec UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdThe textual format for UnitId coincides with the format GHC accepts for
-package-id.Pretty UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdThe textual format for UnitId coincides with the format GHC accepts for
-package-id.Structured UnitIdDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitIdtype Rep UnitId = D1 ('MetaDataDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.UnitId"UnitId"
"Distribution.Types.UnitId"
"Cabal-syntax-3.12.1.0-3adc"
'True) (C1 ('MetaCons"UnitId"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortText)))