Module CPM.Repository

This module implements functionality surrounding the package repository. The repository is the index of all packages known to the package manager. It contains metadata about the packages, such as their names, versions dependencies and where they can be acquired. The repository does not contain the actual packages. For a list of packages that are currently installed locally, you can consult the database.

Exported Datatypes


data Repository

Abstract data type of a repository.


Exported Functions


emptyRepository :: Repository  Deterministic 

Creates an empty repository.

Further infos:
  • solution complete, i.e., able to compute all solutions

allPackages :: Repository -> [Package]  Deterministic 

Get all packages in the central package index.

Further infos:
  • solution complete, i.e., able to compute all solutions

pkgsToRepository :: [Package] -> Repository  Deterministic 

Construct a repository from a list of packages.

Further infos:
  • solution complete, i.e., able to compute all solutions

findAllVersions :: Repository -> String -> Bool -> [Package]  Deterministic 

Finds all versions of a package known to the repository. Returns the packages sorted from newest to oldest.

:: Repository  the repository
-> String  the name of the package to search for
-> Bool  should pre-release versions be included?
-> [Package] 

searchPackages :: Repository -> Bool -> Bool -> String -> [[Package]]  Deterministic 

Search the names and synopses of all compiler-compatbile packages in the repository for a particular term. Lower/upercase is ignored for the search. Returns all matching versions (newest first) of each package.

:: Repository  the repository
-> Bool  search for some module?
-> Bool  search for some executable?
-> String  the term to search for
-> [[Package]] 

listPackages :: Repository -> [[Package]]  Deterministic 

Get all packages in the repository and group them by versions (newest first).

:: Repository  the current CPM configuration
-> [[Package]]  the repository

findLatestVersion :: Config -> Repository -> String -> Bool -> Maybe Package  Deterministic 

Finds the latest compiler-compatbile version of a package.

:: Config  the current CPM configuration
-> Repository  the central package index
-> String  the package to search for
-> Bool  include pre-release versions
-> Maybe Package 

findVersion :: Repository -> String -> (Int, Int, Int, Maybe String) -> Maybe Package  Deterministic 

Finds a specific version of a package.


warnIfRepositoryOld :: Config -> ErrorLogger ()  Deterministic 

Prints a warning if the repository index is older than 10 days. Abort with an error message if the repository index is not initialized (e.g., by the command cypm update).


useUpdateHelp :: String  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

readRepositoryFrom :: String -> ErrorLogger Repository  Deterministic 

Reads all package specifications from a repository. If some errors occur, show them and terminate with error exit status.

:: String  the location of the repository
-> ErrorLogger Repository  repository

repositoryCacheFilePrefix :: Config -> String  Deterministic 

The prefix of all file names implementing the repository cache.


cleanRepositoryCache :: Config -> ErrorLogger ()  Deterministic 

Cleans the repository cache.


readPackageFromRepository :: Config -> Package -> ErrorLogger Package  Deterministic 

Reads a given package from the default repository directory. This is useful to obtain the complete package specification from a possibly incomplete package specification.