Distribution.Types.UnitId

Cabal-2.0.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Types.UnitId

Synopsis

- data UnitId
- unUnitId :: UnitId -> String
- mkUnitId :: String -> UnitId
- data DefUnitId
- unsafeMkDefUnitId :: UnitId -> DefUnitId
- unDefUnitId :: DefUnitId -> UnitId
- newSimpleUnitId :: ComponentId -> UnitId
- mkLegacyUnitId :: PackageId -> UnitId
- getHSLibraryName :: UnitId -> String
- type InstalledPackageId = UnitId

# Documentation

data UnitId Source #

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 `unitIdHash` is `Nothing`. In the absence of Backpack, `UnitId` is the same as a `ComponentId`.
- An indefinite, Backpack library with holes. In this case, `unitIdHash` is still `Nothing`, but in the install, there are only interfaces, no compiled objects.
- An instantiated Backpack library with all the holes filled in. `unitIdHash` is a `Just` a 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.

Instances

Eq UnitId # |
Methods (==) :: UnitId -> UnitId -> Bool # (/=) :: UnitId -> UnitId -> Bool #
Data UnitId # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnitId -> c UnitId Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnitId Source # toConstr :: UnitId -> Constr Source # dataTypeOf :: UnitId -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c UnitId) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnitId) Source # gmapT :: (forall b. Data b => b -> b) -> UnitId -> UnitId Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnitId -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnitId -> r Source # gmapQ :: (forall d. Data d => d -> u) -> UnitId -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnitId -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnitId -> m UnitId Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitId -> m UnitId Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitId -> m UnitId Source #
Ord UnitId # |
Methods compare :: UnitId -> UnitId -> Ordering # (<) :: UnitId -> UnitId -> Bool # (<=) :: UnitId -> UnitId -> Bool # (>) :: UnitId -> UnitId -> Bool # (>=) :: UnitId -> UnitId -> Bool # max :: UnitId -> UnitId -> UnitId # min :: UnitId -> UnitId -> UnitId #
Read UnitId # |
Methods readsPrec :: Int -> ReadS UnitId Source # readList :: ReadS [UnitId] Source # readPrec :: ReadPrec UnitId Source # readListPrec :: ReadPrec [UnitId] Source #
Show UnitId # |
Methods showsPrec :: Int -> UnitId -> ShowS Source # show :: UnitId -> String Source # showList :: [UnitId] -> ShowS Source #
IsString UnitId # | `mkUnitId` Since: 2.0
Methods fromString :: String -> UnitId Source #
Generic UnitId # |
Associated Types type Rep UnitId :: * -> * Source # Methods from :: UnitId -> Rep UnitId x Source # to :: Rep UnitId x -> UnitId Source #
NFData UnitId # |
Methods rnf :: UnitId -> () Source #
Binary UnitId # |
Methods put :: UnitId -> Put Source # get :: Get UnitId Source # putList :: [UnitId] -> Put Source #
Text UnitId # | The textual format for `UnitId` coincides with the format GHC accepts for `-package-id`.
Methods disp :: UnitId -> Doc Source # parse :: ReadP r UnitId Source #
type Rep UnitId # |
type Rep UnitId = D1 * (MetaData "UnitId" "Distribution.Types.UnitId" "Cabal-2.0.0.0" True) (C1 * (MetaCons "UnitId" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * ShortText)))

unUnitId :: UnitId -> String Source #

If you need backwards compatibility, consider using `display` instead, which is supported by all versions of Cabal.

mkUnitId :: String -> UnitId Source #

data DefUnitId Source #

A `UnitId` for a definite package. The `DefUnitId` invariant says that a `UnitId` identified this way is definite; i.e., it has no unfilled holes.

Instances

Eq DefUnitId # |
Methods (==) :: DefUnitId -> DefUnitId -> Bool # (/=) :: DefUnitId -> DefUnitId -> Bool #
Data DefUnitId # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DefUnitId -> c DefUnitId Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DefUnitId Source # toConstr :: DefUnitId -> Constr Source # dataTypeOf :: DefUnitId -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c DefUnitId) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DefUnitId) Source # gmapT :: (forall b. Data b => b -> b) -> DefUnitId -> DefUnitId Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DefUnitId -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DefUnitId -> r Source # gmapQ :: (forall d. Data d => d -> u) -> DefUnitId -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> DefUnitId -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DefUnitId -> m DefUnitId Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DefUnitId -> m DefUnitId Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DefUnitId -> m DefUnitId Source #
Ord DefUnitId # |
Methods compare :: DefUnitId -> DefUnitId -> Ordering # (<) :: DefUnitId -> DefUnitId -> Bool # (<=) :: DefUnitId -> DefUnitId -> Bool # (>) :: DefUnitId -> DefUnitId -> Bool # (>=) :: DefUnitId -> DefUnitId -> Bool # max :: DefUnitId -> DefUnitId -> DefUnitId # min :: DefUnitId -> DefUnitId -> DefUnitId #
Read DefUnitId # |
Methods readsPrec :: Int -> ReadS DefUnitId Source # readList :: ReadS [DefUnitId] Source # readPrec :: ReadPrec DefUnitId Source # readListPrec :: ReadPrec [DefUnitId] Source #
Show DefUnitId # |
Methods showsPrec :: Int -> DefUnitId -> ShowS Source # show :: DefUnitId -> String Source # showList :: [DefUnitId] -> ShowS Source #
Generic DefUnitId # |
Associated Types type Rep DefUnitId :: * -> * Source # Methods from :: DefUnitId -> Rep DefUnitId x Source # to :: Rep DefUnitId x -> DefUnitId Source #
NFData DefUnitId # |
Methods rnf :: DefUnitId -> () Source #
Binary DefUnitId # |
Methods put :: DefUnitId -> Put Source # get :: Get DefUnitId Source # putList :: [DefUnitId] -> Put Source #
Text DefUnitId # |
Methods disp :: DefUnitId -> Doc Source # parse :: ReadP r DefUnitId Source #
type Rep DefUnitId # |
type Rep DefUnitId = D1 * (MetaData "DefUnitId" "Distribution.Types.UnitId" "Cabal-2.0.0.0" True) (C1 * (MetaCons "DefUnitId" PrefixI True) (S1 * (MetaSel (Just Symbol "unDefUnitId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * UnitId)))

unsafeMkDefUnitId :: UnitId -> DefUnitId Source #

Unsafely create a `DefUnitId` from a `UnitId`. Your responsibility is to ensure that the `DefUnitId` invariant holds.

unDefUnitId :: DefUnitId -> UnitId Source #

newSimpleUnitId :: ComponentId -> UnitId Source #

Create a unit identity with no associated hash directly from a `ComponentId`.

mkLegacyUnitId :: PackageId -> UnitId Source #

Make an old-style UnitId from a package identifier. Assumed to be for the public library

getHSLibraryName :: UnitId -> String Source #

Returns library name prefixed with HS, suitable for filenames

type InstalledPackageId = UnitId Source #

Deprecated: Use UnitId instead