This module implements the LookupSet datatype. A lookup set is used to store and query packages for dependency resolution. It stores the source of a package specification alongside the specification itself (e.g. the global repository or the local package cache).
data LookupSource
Constructors:
FromRepository
:: LookupSource
FromLocalCache
:: LookupSource
FromGlobalCache
:: LookupSource
data LookupSet
The empty lookup set.
setLocallyIgnored
:: LookupSet -> [String] -> LookupSet
Set the set of packages whose locally installed versions are ignored when finding all package versions.
addPackages
:: LookupSet -> [Package] -> LookupSource -> LookupSet
Adds multiple packages to a lookup set with the same source.
:: LookupSet
|
the set to add to |
-> [Package]
|
the packages to add |
-> LookupSource
|
where are the package specs from? |
-> LookupSet
|
allPackages
:: LookupSet -> [Package]
addPackage
:: LookupSet -> Package -> LookupSource -> LookupSet
Adds a package to a lookup set.
:: LookupSet
|
the set to add to |
-> Package
|
the package to add |
-> LookupSource
|
where is the package spec from? |
-> LookupSet
|
findAllVersions
:: LookupSet -> String -> Bool -> [Package]
Finds all versions of a package known to the lookup set. Returns the packages from the local cache first, and then from other sources. Each group is sorted from newest do oldest version.
:: LookupSet
|
the lookup set |
-> String
|
the name of the package to search for |
-> Bool
|
should pre-release versions be included? |
-> [Package]
|
findAllVersions ls "A" False -=- [aLocal,aNonLocal]
where
aLocal = cPackage "A" (1,0,0,Nothing) []
aNonLocal = cPackage "A" (1,1,0,Nothing) []
ls =
addPackage (addPackage emptySet aLocal FromLocalCache) aNonLocal
FromRepository
(test_findAllVersions_localBeforeNonLocal)
findAllVersions ls "A" False -=- [aNonLocal]
where
aLocal = cPackage "A" (1,0,0,Nothing) []
aNonLocal = cPackage "A" (1,1,0,Nothing) []
ls =
setLocallyIgnored
(addPackage (addPackage emptySet aLocal FromLocalCache) aNonLocal
FromRepository)
["A"]
(test_findAllVersions_nonLocalIfIgnored)
lookupSource
:: LookupSet -> Package -> Maybe LookupSource
Finds the source for a package in the lookup set
:: LookupSet
|
the lookup set |
-> Package
|
the package to search for |
-> Maybe LookupSource
|
findLatestVersion
:: LookupSet -> String -> Bool -> Maybe Package
Finds the latest version of a package known to the lookup set.
:: LookupSet
|
the lookup set |
-> String
|
the name of the package to search for |
-> Bool
|
should pre-release versions be included? |
-> Maybe Package
|
findVersion
:: LookupSet -> String -> (Int, Int, Int, Maybe String) -> Maybe Package
Finds a specific version of a package in the lookup set.
:: LookupSet
|
the lookup set |
-> String
|
the name of the package |
-> Version
|
the package version |
-> Maybe Package
|