An index of packages.
- data PackageIndex
- fromList :: [InstalledPackageInfo] -> PackageIndex
- merge :: PackageIndex -> PackageIndex -> PackageIndex
- insert :: InstalledPackageInfo -> PackageIndex -> PackageIndex
- deleteInstalledPackageId :: InstalledPackageId -> PackageIndex -> PackageIndex
- deleteSourcePackageId :: PackageId -> PackageIndex -> PackageIndex
- deletePackageName :: PackageName -> PackageIndex -> PackageIndex
- lookupInstalledPackageId :: PackageIndex -> InstalledPackageId -> Maybe InstalledPackageInfo
- lookupSourcePackageId :: PackageIndex -> PackageId -> [InstalledPackageInfo]
- lookupPackageName :: PackageIndex -> PackageName -> [(Version, [InstalledPackageInfo])]
- lookupDependency :: PackageIndex -> Dependency -> [(Version, [InstalledPackageInfo])]
- searchByName :: PackageIndex -> String -> SearchResult [InstalledPackageInfo]
- data SearchResult a
- searchByNameSubstring :: PackageIndex -> String -> [InstalledPackageInfo]
- allPackages :: PackageIndex -> [InstalledPackageInfo]
- allPackagesByName :: PackageIndex -> [[InstalledPackageInfo]]
- brokenPackages :: PackageIndex -> [(InstalledPackageInfo, [InstalledPackageId])]
- dependencyClosure :: PackageIndex -> [InstalledPackageId] -> Either PackageIndex [(InstalledPackageInfo, [InstalledPackageId])]
- reverseDependencyClosure :: PackageIndex -> [InstalledPackageId] -> [InstalledPackageInfo]
- topologicalOrder :: PackageIndex -> [InstalledPackageInfo]
- reverseTopologicalOrder :: PackageIndex -> [InstalledPackageInfo]
- dependencyInconsistencies :: PackageIndex -> [(PackageName, [(PackageId, Version)])]
- dependencyCycles :: PackageIndex -> [[InstalledPackageInfo]]
- dependencyGraph :: PackageIndex -> (Graph, Vertex -> InstalledPackageInfo, InstalledPackageId -> Maybe Vertex)
- moduleNameIndex :: PackageIndex -> Map ModuleName [InstalledPackageInfo]
Package index data type
The collection of information about packages from one or more
Packages are uniquely identified in by their
InstalledPackageId, they can
also be effeciently looked up by package name or by name and version.
Creating an index
Build an index out of a bunch of packages.
If there are duplicates by
InstalledPackageId then later ones mask earlier
Merge two indexes.
Packages from the second mask packages from the first if they have the exact
For packages with the same source
PackageId, packages from the second are
"preferred" over those from the first. Being preferred means they are top
result when we do a lookup by source
PackageId. This is the mechanism we
use to prefer user packages over global packages.
Removes a single installed package from the index.
Removes all packages with this source
PackageId from the index.
Removes all packages with this (case-sensitive) name from the index.
Does a lookup by source package id (name & version).
Since multiple package DBs mask each other by
then we get back at most one package.
Does a lookup by source package name.
Does a lookup by source 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.
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.
Does a case-insensitive substring search by package name.
That is, all packages that contain the given string in their name.
Get all the packages from the index.
They are grouped by package name, case-sensitively.
All packages that have immediate dependencies that are not in the index.
Returns such packages along with the dependencies that they're missing.
Tries to take the transitive closure of the package dependencies.
If the transitive closure is complete then it returns that subset of the
index. Otherwise it returns the broken packages as in
- Note that if the result is
Right it is because at least one of the original given
PackageIds do not occur in the index.
Takes the transitive closure of the packages reverse dependencies.
- The given
PackageIds must be in the index.
Given a package index where we assume we want to use all the packages
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.
Find if there are any cycles in the dependency graph. If there are no
cycles the result is
This actually computes the strongly connected components. So it gives us a list of groups of packages where within each group they all depend on each other, directly or indirectly.
Builds a graph of the package dependencies.
Dependencies on other packages that are not in the index are discarded.
You can check if there are any such dependencies with