Copyright | Isaac Jones 2003-2004 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
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"
.
- newtype PackageName = PackageName {}
- data PackageIdentifier = PackageIdentifier {}
- 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 Source
Eq PackageName | |
Data PackageName | |
Ord PackageName | |
Read PackageName | |
Show PackageName | |
Generic PackageName | |
Binary PackageName | |
NFData PackageName | |
Text PackageName | |
type Rep PackageName = D1 (MetaData "PackageName" "Distribution.Package" "Cabal-1.23.1.0" True) (C1 (MetaCons "PackageName" PrefixI True) (S1 (MetaSel (Just Symbol "unPackageName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) |
data PackageIdentifier Source
The name and version of a package.
PackageIdentifier | |
|
Eq PackageIdentifier | |
Data PackageIdentifier | |
Ord PackageIdentifier | |
Read PackageIdentifier | |
Show PackageIdentifier | |
Generic PackageIdentifier | |
Binary PackageIdentifier | |
NFData PackageIdentifier | |
Text PackageIdentifier | |
Package PackageIdentifier | |
type Rep PackageIdentifier = D1 (MetaData "PackageIdentifier" "Distribution.Package" "Cabal-1.23.1.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 Source
Type alias so we can use the shorter name PackageId.
Package keys/installed package IDs (used for linker symbols)
data ComponentId Source
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.
Eq ComponentId | |
Data ComponentId | |
Ord ComponentId | |
Read ComponentId | |
Show ComponentId | |
Generic ComponentId | |
Binary ComponentId | |
NFData ComponentId | |
Text ComponentId | |
type Rep ComponentId = D1 (MetaData "ComponentId" "Distribution.Package" "Cabal-1.23.1.0" False) (C1 (MetaCons "ComponentId" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) |
For now, there is no distinction between component IDs and unit IDs in Cabal.
Eq UnitId | |
Data UnitId | |
Ord UnitId | |
Read UnitId | |
Show UnitId | |
Generic UnitId | |
Binary UnitId | |
NFData UnitId | |
Text UnitId | |
type Rep UnitId = D1 (MetaData "UnitId" "Distribution.Package" "Cabal-1.23.1.0" True) (C1 (MetaCons "SimpleUnitId" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentId))) |
mkLegacyUnitId :: PackageId -> UnitId Source
Make an old-style UnitId from a package identifier
getHSLibraryName :: UnitId -> String Source
Returns library name prefixed with HS, suitable for filenames
type InstalledPackageId = UnitId Source
Deprecated: Use UnitId instead
ABI hash
Eq AbiHash | |
Read AbiHash | |
Show AbiHash | |
Generic AbiHash | |
Binary AbiHash | |
Text AbiHash | |
type Rep AbiHash = D1 (MetaData "AbiHash" "Distribution.Package" "Cabal-1.23.1.0" True) (C1 (MetaCons "AbiHash" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) |
Package source dependencies
data Dependency Source
Describes a dependency on a source package (API)
Eq Dependency | |
Data Dependency | |
Read Dependency | |
Show Dependency | |
Generic Dependency | |
Binary Dependency | |
Text Dependency | |
type Rep Dependency = D1 (MetaData "Dependency" "Distribution.Package" "Cabal-1.23.1.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)))) |
simplifyDependency :: Dependency -> Dependency Source
Simplify the VersionRange
expression in a Dependency
.
See simplifyVersionRange
.
Package classes
class Package pkg where Source
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.
packageId :: pkg -> PackageIdentifier Source
packageName :: Package pkg => pkg -> PackageName Source
packageVersion :: Package pkg => pkg -> Version Source
class Package pkg => HasUnitId pkg where Source
Packages that have an installed package ID
installedUnitId :: pkg -> UnitId Source
installedPackageId :: HasUnitId pkg => pkg -> UnitId Source
Deprecated: Use installedUnitId instead
Compatibility wrapper for pre-Cabal 1.23.
class HasUnitId pkg => PackageInstalled pkg where Source
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
.
installedDepends :: pkg -> [UnitId] Source