Cabal-1.3.10: A framework for packaging Haskell softwareContentsIndex
Distribution.Simple.PackageIndex
Portabilityportable
Stabilityprovisional
MaintainerDuncan Coutts <duncan@haskell.org>
Contents
Package index data type
Creating the index
Merging indexes
Queries
Precise lookups
Case-insensitive searches
Bulk queries
Special queries
Description
An index of packages.
Synopsis
data PackageIndex pkg
fromList :: Package pkg => [pkg] -> PackageIndex pkg
merge :: Package pkg => PackageIndex pkg -> PackageIndex pkg -> PackageIndex pkg
lookupPackageId :: Package pkg => PackageIndex pkg -> PackageIdentifier -> Maybe pkg
lookupDependency :: Package pkg => PackageIndex pkg -> Dependency -> [pkg]
searchByName :: Package pkg => PackageIndex pkg -> String -> SearchResult [pkg]
data SearchResult a
= None
| Unambiguous a
| Ambiguous [a]
searchByNameSubstring :: Package pkg => PackageIndex pkg -> String -> [pkg]
allPackages :: Package pkg => PackageIndex pkg -> [pkg]
allPackagesByName :: Package pkg => PackageIndex pkg -> [[pkg]]
brokenPackages :: PackageFixedDeps pkg => PackageIndex pkg -> [(pkg, [PackageIdentifier])]
dependencyClosure :: PackageFixedDeps pkg => PackageIndex pkg -> [PackageIdentifier] -> Either (PackageIndex pkg) [(pkg, [PackageIdentifier])]
dependencyInconsistencies :: PackageFixedDeps pkg => PackageIndex pkg -> pkg -> [(String, [(PackageIdentifier, Version)])]
Package index data type
data PackageIndex pkg

The collection of information about packages from one or more PackageDBs.

It can be searched effeciently by package name and version.

show/hide Instances
Package pkg => Monoid (PackageIndex pkg)
(Package pkg, ??? pkg) => Read (PackageIndex pkg)
(Package pkg, ??? pkg) => Show (PackageIndex pkg)
Creating the index
fromList :: Package pkg => [pkg] -> PackageIndex pkg

Build an index out of a bunch of Packages.

If there are duplicates, earlier ones mask later one.

Merging indexes
merge :: Package pkg => PackageIndex pkg -> PackageIndex pkg -> PackageIndex pkg

Merge two indexes.

Packages from the first mask packages of the same exact name (case-sensitively) from the second.

Queries
Precise lookups
lookupPackageId :: Package pkg => PackageIndex pkg -> PackageIdentifier -> Maybe pkg

Does a lookup by package id (name & version).

Since multiple package DBs mask each other case-sensitively by package name, then we get back at most one package.

lookupDependency :: Package pkg => PackageIndex pkg -> Dependency -> [pkg]

Does a case-sensitive search by package name and a range of versions.

We get back any number of versions of the specified package name, all satisfying the version range constraint.

Case-insensitive searches
searchByName :: Package pkg => PackageIndex pkg -> String -> SearchResult [pkg]

Does a case-insensitive search by package name.

If there is only one package that compares case-insentiviely to this name then the search is unambiguous and we get back all versions of that package. If several match case-insentiviely but one matches exactly then it is also unambiguous.

If however several match case-insentiviely and none match exactly then we have an ambiguous result, and we get back all the versions of all the packages. The list of ambiguous results is split by exact package name. So it is a non-empty list of non-empty lists.

data SearchResult a
Constructors
None
Unambiguous a
Ambiguous [a]
searchByNameSubstring :: Package pkg => PackageIndex pkg -> String -> [pkg]

Does a case-insensitive substring search by package name.

That is, all packages that contain the given string in their name.

Bulk queries
allPackages :: Package pkg => PackageIndex pkg -> [pkg]
Get all the packages from the index.
allPackagesByName :: Package pkg => PackageIndex pkg -> [[pkg]]

Get all the packages from the index.

They are grouped by package name, case-sensitively.

Special queries
brokenPackages :: PackageFixedDeps pkg => PackageIndex pkg -> [(pkg, [PackageIdentifier])]

All packages that have depends that are not in the index.

Returns such packages along with the depends that they're missing.

dependencyClosure :: PackageFixedDeps pkg => PackageIndex pkg -> [PackageIdentifier] -> Either (PackageIndex pkg) [(pkg, [PackageIdentifier])]

Tries to take the transative closure of the package dependencies.

If the transative closure is complete then it returns that subset of the index. Otherwise it returns the broken packages as in brokenPackages.

  • Note that if any of the result is Right [] it is because at least one of the original given PackageIdentifiers do not occur in the index.
dependencyInconsistencies :: PackageFixedDeps pkg => PackageIndex pkg -> pkg -> [(String, [(PackageIdentifier, Version)])]

Given a package index where we assume we want to use all the packages (use dependencyClosure if you need to get such a index subset) find out if the dependencies within it use consistent versions of each package. Return all cases where multiple packages depend on different versions of some other package.

Each element in the result is a package name along with the packages that depend on it and the versions they require. These are guaranteed to be distinct.

Produced by Haddock version 0.8