Portability | portable |
---|---|
Maintainer | cabal-devel@haskell.org |
Safe Haskell | None |
Distribution.Package
Contents
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"
.
- newtype PackageName = PackageName {
- unPackageName :: String
- 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
- packageId :: pkg -> PackageIdentifier
- packageName :: Package pkg => pkg -> PackageName
- packageVersion :: Package pkg => pkg -> Version
- class Package pkg => HasUnitId pkg where
- installedUnitId :: pkg -> UnitId
- installedPackageId :: HasUnitId pkg => pkg -> UnitId
- class HasUnitId pkg => PackageInstalled pkg where
- installedDepends :: pkg -> [UnitId]
Package ids
newtype PackageName
Constructors
PackageName | |
Fields
|
Instances
Eq PackageName | |
Data PackageName | |
Ord PackageName | |
Read PackageName | |
Show PackageName | |
Typeable PackageName | |
Generic PackageName | |
NFData PackageName | |
Binary PackageName | |
Text PackageName |
data PackageIdentifier
The name and version of a package.
Constructors
PackageIdentifier | |
Fields
|
Instances
Eq PackageIdentifier | |
Data PackageIdentifier | |
Ord PackageIdentifier | |
Read PackageIdentifier | |
Show PackageIdentifier | |
Typeable PackageIdentifier | |
Generic PackageIdentifier | |
NFData PackageIdentifier | |
Binary PackageIdentifier | |
Text PackageIdentifier | |
Package PackageIdentifier |
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 | |
Data ComponentId | |
Ord ComponentId | |
Read ComponentId | |
Show ComponentId | |
Typeable ComponentId | |
Generic ComponentId | |
NFData ComponentId | |
Binary ComponentId | |
Text ComponentId |
newtype UnitId
For now, there is no distinction between component IDs and unit IDs in Cabal.
Constructors
SimpleUnitId ComponentId |
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
Package source dependencies
data Dependency
Describes a dependency on a source package (API)
Constructors
Dependency PackageName VersionRange |
Instances
Eq Dependency | |
Data Dependency | |
Read Dependency | |
Show Dependency | |
Typeable Dependency | |
Generic Dependency | |
Binary Dependency | |
Text 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.
Methods
packageId :: pkg -> PackageIdentifier
packageName :: Package pkg => pkg -> PackageName
packageVersion :: Package pkg => pkg -> Version
class Package pkg => HasUnitId pkg where
Packages that have an installed package ID
Methods
installedUnitId :: pkg -> UnitId
Instances
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
.
Methods
installedDepends :: pkg -> [UnitId]
Instances