... | ... | @@ -37,36 +37,36 @@ For the purposes of this commentary, we are mostly concerned with GHC and `ghc-p |
|
|
|
|
|
## Identifying Packages
|
|
|
|
|
|
<table><tr><th>`PackageName` ("base")</th>
|
|
|
<table><tr><th>`Cabal.PackageName` ("base")</th>
|
|
|
<td>
|
|
|
A string. Defined in `Distribution.Package`. Does not uniquely identify a package: the package
|
|
|
database can contain several packages with the same name.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`PackageIdentifier` ("base-4.1.0.0")</th>
|
|
|
<table><tr><th>`Cabal.PackageId` ("base-4.1.0.0")</th>
|
|
|
<td>
|
|
|
A `PackageName` plus a `Version`. A `PackageIdentifier` names an API. If two `PackageIdentifiers` are
|
|
|
the same, they have the same API.
|
|
|
`InstalledPackageInfo` contains the field `package :: PackageIdentifier`.
|
|
|
A `PackageName` plus a `Version`. A `PackageId` names an API. If two `PackageId`s are
|
|
|
the same, they are assumed to have the same API.
|
|
|
`InstalledPackageInfo` contains the field `sourcePackageId :: PackageId`.
|
|
|
|
|
|
In GHC 6.11, the `PackageIdentifier` also uniquely identifies a package instance in the package database, but
|
|
|
In GHC 6.11, the `PackageId` also uniquely identifies a package instance in the package database, but
|
|
|
only by convention (we may lift this restriction in the future, and allow the database to contain
|
|
|
multiple package instances with the same `PackageIdentifier` (and different `InstalledPackageId`s).
|
|
|
multiple package instances with the same `PackageId` (and different `InstalledPackageId`s).
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`InstalledPackageId` ("base-4.1.0.0-1mpgjN")</th>
|
|
|
<table><tr><th>`Cabal.InstalledPackageId` ("base-4.1.0.0-1mpgjN")</th>
|
|
|
<td>
|
|
|
(introduced in GHC 6.12 / Cabal 1.7.2) A string that uniquely identifies a package instance in the database.
|
|
|
An `InstalledPackageId` identifies an ABI: if two `InstalledPackageIds` are the same, they have the
|
|
|
same ABI.
|
|
|
`InstalledPackageInfo` contains the field `package :: PackageIdentifier`.
|
|
|
`InstalledPackageInfo` contains the field `installedPackageId :: InstalledPackageId`.
|
|
|
|
|
|
Dependencies between installed packages are identified by the `InstalledPackageId`. An `InstalledPackageId` is
|
|
|
currently chosen by adding a random suffix to the string representing the `PackageIdentifier` when a package is
|
|
|
registered.
|
|
|
chosen when a package is registered. It is chosen by calling `ghc --abi-hash` on the compiled modules and appending
|
|
|
the hash as a suffix to the string representing the `PackageIdentifier`.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`PackageId` (these currently look like "base-4.1.0.0" in GHC 6.12)</th>
|
|
|
<table><tr><th>`GHC.PackageId` (these currently look like "base-4.1.0.0" in GHC 6.12)</th>
|
|
|
<td>
|
|
|
Inside GHC, we use the type `PackageId`, which is a `FastString`. The (Z-encoding of) `PackageId` prefixes each
|
|
|
external symbol in the generated code, so that the modules of one package do not clash with those of another package,
|
... | ... | |