Distribution.Package

Cabal-1.24.0.0: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2004
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | None
Language | Haskell98

Distribution.Package

Contents

- Package ids
- Package keys/installed package IDs (used for linker symbols)
- ABI hash
- Package source dependencies
- Package classes

Description

Defines a package identifier along with a parser and pretty printer for it. `PackageIdentifier`s consist of a name and an exact version. It also defines a `Dependency` data type. A dependency is a package name and a version range, like `"foo >= 1.2 && < 2"`.

Synopsis

- newtype PackageName = PackageName {
  - unPackageName :: String
  }
- data PackageIdentifier = PackageIdentifier {
  - pkgName :: PackageName
  - pkgVersion :: Version
  }
- type PackageId = PackageIdentifier
- data ComponentId = ComponentId String
- newtype UnitId = SimpleUnitId ComponentId
- mkUnitId :: String -> UnitId
- mkLegacyUnitId :: PackageId -> UnitId
- getHSLibraryName :: UnitId -> String
- type InstalledPackageId = UnitId
- newtype AbiHash = AbiHash String
- data Dependency = Dependency PackageName VersionRange
- thisPackageVersion :: PackageIdentifier -> Dependency
- notThisPackageVersion :: PackageIdentifier -> Dependency
- simplifyDependency :: Dependency -> Dependency
- class Package pkg where
- packageName :: Package pkg => pkg -> PackageName
- packageVersion :: Package pkg => pkg -> Version
- class Package pkg => HasUnitId pkg where
- installedPackageId :: HasUnitId pkg => pkg -> UnitId
- class HasUnitId pkg => PackageInstalled pkg where

# Package ids

newtype PackageName #

Constructors

PackageName |
Fields unPackageName :: String

Instances

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

data PackageIdentifier #

The name and version of a package.

Constructors

PackageIdentifier |
Fields pkgName :: PackageName The name of this package, eg. foo pkgVersion :: Version the version of this package, eg 1.2

Instances

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

type PackageId = PackageIdentifier #

Type alias so we can use the shorter name PackageId.

# Package keys/installed package IDs (used for linker symbols)

data ComponentId #

A `ComponentId` uniquely identifies the transitive source code closure of a component. For non-Backpack components, it also serves as the basis for install paths, symbols, etc.

Constructors

ComponentId String |

Instances

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

newtype UnitId #

For now, there is no distinction between component IDs and unit IDs in Cabal.

Constructors

SimpleUnitId ComponentId |

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 #
Generic UnitId # |
Associated Types type Rep UnitId :: * -> * Source # Methods from :: UnitId -> Rep UnitId x Source # to :: Rep UnitId x -> UnitId Source #
Binary UnitId # |
Methods put :: UnitId -> Put Source # get :: Get UnitId Source # putList :: [UnitId] -> Put Source #
NFData UnitId # |
Methods rnf :: UnitId -> () Source #
Text UnitId # |
Methods disp :: UnitId -> Doc # parse :: ReadP r UnitId #
type Rep UnitId # |
type Rep UnitId = D1 (MetaData "UnitId" "Distribution.Package" "Cabal-1.24.0.0" True) (C1 (MetaCons "SimpleUnitId" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId)))

mkUnitId :: String -> UnitId #

Makes a simple-style UnitId from a string.

mkLegacyUnitId :: PackageId -> UnitId #

Make an old-style UnitId from a package identifier

getHSLibraryName :: UnitId -> String #

Returns library name prefixed with HS, suitable for filenames

type InstalledPackageId = UnitId #

Deprecated: Use UnitId instead

# ABI hash

newtype AbiHash #

Constructors

AbiHash String |

Instances

Eq AbiHash # |
Methods (==) :: AbiHash -> AbiHash -> Bool # (/=) :: AbiHash -> AbiHash -> Bool #
Read AbiHash # |
Methods readsPrec :: Int -> ReadS AbiHash Source # readList :: ReadS [AbiHash] Source # readPrec :: ReadPrec AbiHash Source # readListPrec :: ReadPrec [AbiHash] Source #
Show AbiHash # |
Methods showsPrec :: Int -> AbiHash -> ShowS Source # show :: AbiHash -> String Source # showList :: [AbiHash] -> ShowS Source #
Generic AbiHash # |
Associated Types type Rep AbiHash :: * -> * Source # Methods from :: AbiHash -> Rep AbiHash x Source # to :: Rep AbiHash x -> AbiHash Source #
Binary AbiHash # |
Methods put :: AbiHash -> Put Source # get :: Get AbiHash Source # putList :: [AbiHash] -> Put Source #
Text AbiHash # |
Methods disp :: AbiHash -> Doc # parse :: ReadP r AbiHash #
type Rep AbiHash # |
type Rep AbiHash = D1 (MetaData "AbiHash" "Distribution.Package" "Cabal-1.24.0.0" True) (C1 (MetaCons "AbiHash" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))

# Package source dependencies

data Dependency #

Describes a dependency on a source package (API)

Constructors

Dependency PackageName VersionRange |

Instances

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

thisPackageVersion :: PackageIdentifier -> Dependency #

notThisPackageVersion :: PackageIdentifier -> Dependency #

simplifyDependency :: Dependency -> Dependency #

Simplify the `VersionRange` expression in a `Dependency`. See `simplifyVersionRange`.

# Package classes

class Package pkg where #

Class of things that have a `PackageIdentifier`

Types in this class are all notions of a package. This allows us to have different types for the different phases that packages go though, from simple name/id, package description, configured or installed packages.

Not all kinds of packages can be uniquely identified by a `PackageIdentifier`. In particular, installed packages cannot, there may be many installed instances of the same source package.

Minimal complete definition

packageId

Methods

packageId :: pkg -> PackageIdentifier #

Instances

Package PackageIdentifier # |
Methods packageId :: PackageIdentifier -> PackageIdentifier #
Package GenericPackageDescription # |
Methods packageId :: GenericPackageDescription -> PackageIdentifier #
Package PackageDescription # |
Methods packageId :: PackageDescription -> PackageIdentifier #
Package InstalledPackageInfo # |
Methods packageId :: InstalledPackageInfo -> PackageIdentifier #

packageName :: Package pkg => pkg -> PackageName #

packageVersion :: Package pkg => pkg -> Version #

class Package pkg => HasUnitId pkg where #

Packages that have an installed package ID

Minimal complete definition

installedUnitId

Methods

installedUnitId :: pkg -> UnitId #

Instances

HasUnitId InstalledPackageInfo # |
Methods installedUnitId :: InstalledPackageInfo -> UnitId #

installedPackageId :: HasUnitId pkg => pkg -> UnitId #

Deprecated: Use installedUnitId instead

Compatibility wrapper for Cabal pre-1.24.

class HasUnitId pkg => PackageInstalled pkg where #

Class of installed packages.

The primary data type which is an instance of this package is `InstalledPackageInfo`, but when we are doing install plans in Cabal install we may have other, installed package-like things which contain more metadata. Installed packages have exact dependencies `installedDepends`.

Minimal complete definition

installedDepends

Methods

installedDepends :: pkg -> [UnitId] #

Instances

PackageInstalled InstalledPackageInfo # |
Methods installedDepends :: InstalledPackageInfo -> [UnitId] #