Copyright | Isaac Jones 2003-2004 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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"
.
- data PackageName
- unPackageName :: PackageName -> String
- mkPackageName :: String -> PackageName
- data PackageIdentifier = PackageIdentifier {}
- type PackageId = PackageIdentifier
- data PkgconfigName
- unPkgconfigName :: PkgconfigName -> String
- mkPkgconfigName :: String -> PkgconfigName
- data ComponentId
- unComponentId :: ComponentId -> String
- mkComponentId :: String -> ComponentId
- 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
- data Module = Module DefUnitId ModuleName
- data AbiHash
- unAbiHash :: AbiHash -> String
- mkAbiHash :: String -> AbiHash
- 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
data PackageName Source #
A package name.
Use mkPackageName
and unPackageName
to convert from/to a
String
.
This type is opaque since Cabal-2.0
Since: 2.0
unPackageName :: PackageName -> String Source #
Convert PackageName
to String
mkPackageName :: String -> PackageName Source #
Construct a PackageName
from a String
mkPackageName
is the inverse to unPackageName
Note: No validations are performed to ensure that the resulting
PackageName
is valid
Since: 2.0
data PackageIdentifier Source #
The name and version of a package.
PackageIdentifier | |
|
type PackageId = PackageIdentifier Source #
Type alias so we can use the shorter name PackageId.
data PkgconfigName Source #
A pkg-config library name
This is parsed as any valid argument to the pkg-config utility.
Since: 2.0
unPkgconfigName :: PkgconfigName -> String Source #
Convert PkgconfigName
to String
Since: 2.0
mkPkgconfigName :: String -> PkgconfigName Source #
Construct a PkgconfigName
from a String
mkPkgconfigName
is the inverse to unPkgconfigName
Note: No validations are performed to ensure that the resulting
PkgconfigName
is valid
Since: 2.0
Package keys/installed package IDs (used for linker symbols)
data ComponentId Source #
A ComponentId
uniquely identifies the transitive source
code closure of a component (i.e. libraries, executables).
For non-Backpack components, this corresponds one to one with
the UnitId
, which serves as the basis for install paths,
linker symbols, etc.
Use mkComponentId
and unComponentId
to convert from/to a
String
.
This type is opaque since Cabal-2.0
Since: 2.0
unComponentId :: ComponentId -> String Source #
Convert ComponentId
to String
Since: 2.0
mkComponentId :: String -> ComponentId Source #
Construct a ComponentId
from a String
mkComponentId
is the inverse to unComponentId
Note: No validations are performed to ensure that the resulting
ComponentId
is valid
Since: 2.0
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
isNothing
. In the absence of Backpack,UnitId
is the same as aComponentId
. - An indefinite, Backpack library with holes. In this case,
unitIdHash
is stillNothing
, but in the install, there are only interfaces, no compiled objects. - An instantiated Backpack library with all the holes
filled in.
unitIdHash
is aJust
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.
unUnitId :: UnitId -> String Source #
If you need backwards compatibility, consider using display
instead, which is supported by all versions of Cabal.
unsafeMkDefUnitId :: UnitId -> DefUnitId Source #
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
getHSLibraryName :: UnitId -> String Source #
Returns library name prefixed with HS, suitable for filenames
type InstalledPackageId = UnitId Source #
Deprecated: Use UnitId instead
Modules
A module identity uniquely identifies a Haskell module by
qualifying a ModuleName
with the UnitId
which defined
it. This type distinguishes between two packages
which provide a module with the same name, or a module
from the same package compiled with different dependencies.
There are a few cases where Cabal needs to know about
module identities, e.g., when writing out reexported modules in
the InstalledPackageInfo
.
ABI hash
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 unit ID
installedUnitId :: pkg -> UnitId Source #
installedPackageId :: HasUnitId pkg => pkg -> UnitId Source #
Deprecated: Use installedUnitId instead
Compatibility wrapper for Cabal pre-1.24.
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 #