Module CPM.Main

This is the main module of the Curry Package Manager.

Summary of exported operations:

cpmBanner :: String   
main :: IO ()   
runWithArgs :: Options -> IO ()   
configOpts :: Options -> ConfigOptions   
depsOpts :: Options -> DepsOptions   
checkoutOpts :: Options -> CheckoutOptions   
installOpts :: Options -> InstallOptions   
uninstallOpts :: Options -> UninstallOptions   
infoOpts :: Options -> InfoOptions   
listOpts :: Options -> ListOptions   
searchOpts :: Options -> SearchOptions   
upgradeOpts :: Options -> UpgradeOptions   
linkOpts :: Options -> LinkOptions   
addOpts :: Options -> AddOptions   
newOpts :: Options -> NewOptions   
execOpts :: Options -> ExecOptions   
docOpts :: Options -> DocOptions   
defaultBaseDocURL :: String   
testOpts :: Options -> TestOptions   
diffOpts :: Options -> DiffOptions   
readLogLevel :: String -> Either String LogLevel   
readRcOption :: String -> Either String (String,String)   
readVersion' :: String -> Either String (Int,Int,Int,Maybe String)   
applyEither :: [Options -> Either String Options] -> Options -> Either String Options   
applyParse :: [Options -> Either String Options] -> Either String Options   
(>.>) :: Either String a -> (a -> b) -> Either String b   
optionParser :: [String] -> ParseSpec (Options -> Either String Options)   
checkRequiredExecutables :: IO ()   
checkExecutables :: [String] -> IO [String]   
configCmd :: ConfigOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
updateCmd :: Config -> IO ([LogEntry],Either LogEntry ())   
depsCmd :: DepsOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
infoCmd :: InfoOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
printInfo :: Config -> Bool -> Bool -> Package -> IO ([LogEntry],Either LogEntry ())   
checkoutCmd :: CheckoutOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
installCmd :: InstallOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
installapp :: CheckoutOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
Installs the application (i.e., binary) provided by a package.
checkCompiler :: Config -> Package -> IO ()   
Checks the compiler compatibility.
installExecutable :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   
Installs the executable specified in the package in the bin directory of CPM (compare .cpmrc).
uninstall :: UninstallOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
uninstallPackageExecutable :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   
tryFindVersion :: String -> (Int,Int,Int,Maybe String) -> Repository -> IO ([LogEntry],Either LogEntry Package)   
listCmd :: ListOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
Lists all (compiler-compatible if lall is false) packages in the given repository.
filterCompatPkgs :: Config -> [Package] -> Package   
Returns the first package of a list of packages compatible to the current compiler (according to the given configuration).
packageVersionAsTable :: Config -> [Package] -> ([Int],[[String]])   
showVersionIfCompatible :: Config -> Package -> String   
Shows the version of a package if it is compatible with the current compiler, otherwise shows the version in brackets.
cpmInfo :: String   
searchCmd :: SearchOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
Search in all (compiler-compatible) packages in the given repository.
upgradeCmd :: UpgradeOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
upgrade command.
linkCmd :: LinkOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
link command.
addCmd :: AddOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
add command: Option --package: copy the given package to the repository index and package installation directory so that it is available as any other package.
useForce :: String   
addDependencyCmd :: String -> Bool -> Config -> IO ([LogEntry],Either LogEntry ())   
add --dependency command: add the given package as a new dependency to the current package.
docCmd :: DocOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
doc command: run curry doc on the modules provided as an argument or, if they are not given, on exported modules (if specified in the package), on the main executable (if specified in the package), or on all source modules of the package.
genPackageManual :: DocOptions -> Config -> Package -> String -> IO ([LogEntry],Either LogEntry ())   
Generate manual according to documentation specification of package.
replaceSubString :: String -> String -> String -> String   
Replace every occurrence of the first argument by the second argument in a string (third argument).
genDocForPrograms :: DocOptions -> Config -> String -> String -> Package -> IO ([LogEntry],Either LogEntry ())   
Generate program documentation: run curry doc on the modules provided as an argument or, if they are not given, on exported modules (if specified in the package), on the main executable (if specified in the package), or on all source modules of the package.
testCmd :: TestOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
test command: run curry check on the modules provided as an argument or, if they are not provided, on the exported (if specified) or all source modules of the package.
curryModulesInDir :: String -> IO [String]   
Get the names of all Curry modules contained in a directory.
diffCmd :: DiffOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
compiler :: ExecOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
execCmd :: ExecOptions -> Config -> IO ([LogEntry],Either LogEntry ())   
execWithPkgDir :: ExecOptions -> Config -> String -> IO ([LogEntry],Either LogEntry ())   
execWithCurryPath :: ExecOptions -> Config -> String -> IO ([LogEntry],Either LogEntry ())   
computePackageLoadPath :: Config -> String -> IO ([LogEntry],Either LogEntry String)   
cleanPackage :: Config -> LogLevel -> IO ([LogEntry],Either LogEntry ())   
newPackage :: NewOptions -> IO ([LogEntry],Either LogEntry ())   
Creates a new package.
packageNotFoundFailure :: String -> IO ([LogEntry],Either LogEntry a)   
Fail with a "package not found" message.
compatPackageNotFoundFailure :: Config -> String -> String -> IO ([LogEntry],Either LogEntry a)   
Fail with a "compatible package not found" message and a comment
curryPathCacheFile :: String -> String   
The name of the cache file in a package directory.
baseVersionCacheFile :: String -> String   
The name of the cache file for the base version in a package directory.
saveBaseVersionToCache :: Config -> String -> IO ()   
Saves baseVersion of config in local cache file in the given package dir.
loadBaseVersionFromCache :: String -> IO String   
Loads baseVersion from local cache file in the given package dir.
saveCurryPathToCache :: Config -> String -> String -> IO ()   
Saves package CURRYPATH in local cache file in the given package dir.
getCurryLoadPath :: Config -> String -> IO ([LogEntry],Either LogEntry String)   
Gets CURRYPATH of the given package (either from the local cache file in the package dir or compute it).
loadCurryPathFromCache :: Config -> String -> IO ([LogEntry],Either LogEntry (Maybe String))   
Restores package CURRYPATH from local cache file in the given package dir, if it is still up-to-date, i.e., it exists and is newer than the package specification.
cleanCurryPathCache :: String -> IO ([LogEntry],Either LogEntry ())   
Cleans the local cache file for CURRYPATH.

Exported datatypes:


Options

Constructors:

  • Options :: LogLevel -> [(String,String)] -> Bool -> Command -> Options

    Fields:

    • optLogLevel :: LogLevel
    • optDefConfig :: [(String,String)]
    • optWithTime :: Bool
    • optCommand :: Command

Command

Constructors:


ConfigOptions

Constructors:

  • ConfigOptions :: Bool -> ConfigOptions

    Fields:

    • configAll :: Bool

DepsOptions

Constructors:

  • DepsOptions :: Bool -> DepsOptions

    Fields:

    • depsPath :: Bool

CheckoutOptions

Constructors:

  • CheckoutOptions :: String -> (Maybe Version) -> Bool -> CheckoutOptions

    Fields:

    • coPackage :: String
    • coVersion :: (Maybe Version)
    • coPrerelease :: Bool

InstallOptions

Constructors:

  • InstallOptions :: (Maybe String) -> (Maybe Version) -> Bool -> Bool -> Bool -> InstallOptions

    Fields:

    • instTarget :: (Maybe String)
    • instVersion :: (Maybe Version)
    • instPrerelease :: Bool
    • instExecutable :: Bool
    • instExecOnly :: Bool

UninstallOptions

Constructors:

  • UninstallOptions :: (Maybe String) -> (Maybe Version) -> UninstallOptions

    Fields:

    • uninstPackage :: (Maybe String)
    • uninstVersion :: (Maybe Version)

InfoOptions

Constructors:

  • InfoOptions :: (Maybe String) -> (Maybe Version) -> Bool -> Bool -> InfoOptions

    Fields:

    • infoPackage :: (Maybe String)
    • infoVersion :: (Maybe Version)
    • infoAll :: Bool
    • infoPlain :: Bool

ListOptions

Constructors:

  • ListOptions :: Bool -> Bool -> Bool -> ListOptions

    Fields:

    • listVers :: Bool
    • listCSV :: Bool
    • listCat :: Bool

SearchOptions

Constructors:

  • SearchOptions :: String -> Bool -> Bool -> SearchOptions

    Fields:

    • searchQuery :: String
    • searchModule :: Bool
    • searchExec :: Bool

UpgradeOptions

Constructors:

  • UpgradeOptions :: (Maybe String) -> UpgradeOptions

    Fields:

    • upgrTarget :: (Maybe String)

LinkOptions

Constructors:

  • LinkOptions :: String -> LinkOptions

    Fields:

    • lnkSource :: String

AddOptions

Constructors:

  • AddOptions :: Bool -> Bool -> String -> Bool -> AddOptions

    Fields:

    • addPackage :: Bool
    • addDependency :: Bool
    • addSource :: String
    • forceAdd :: Bool

NewOptions

Constructors:

  • NewOptions :: String -> NewOptions

    Fields:

    • projectName :: String

ExecOptions

Constructors:

  • ExecOptions :: String -> ExecOptions

    Fields:

    • exeCommand :: String

DocOptions

Constructors:

  • DocOptions :: (Maybe String) -> (Maybe [String]) -> Bool -> Bool -> Bool -> String -> DocOptions

    Fields:

    • docDir :: (Maybe String)
    • docModules :: (Maybe [String])
    • docPrograms :: Bool
    • docManual :: Bool
    • docGenImports :: Bool
    • docPackageURL :: String

TestOptions

Constructors:

  • TestOptions :: (Maybe [String]) -> TestOptions

    Fields:

    • testModules :: (Maybe [String])

DiffOptions

Constructors:

  • DiffOptions :: (Maybe Version) -> (Maybe [String]) -> Bool -> Bool -> Bool -> DiffOptions

    Fields:

    • diffVersion :: (Maybe Version)
    • diffModules :: (Maybe [String])
    • diffAPI :: Bool
    • diffBehavior :: Bool
    • diffUseAna :: Bool

Exported operations:

cpmBanner :: String   

main :: IO ()   

runWithArgs :: Options -> IO ()   

addOpts :: Options -> AddOptions   

newOpts :: Options -> NewOptions   

docOpts :: Options -> DocOptions   

defaultBaseDocURL :: String   

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

readLogLevel :: String -> Either String LogLevel   

readRcOption :: String -> Either String (String,String)   

readVersion' :: String -> Either String (Int,Int,Int,Maybe String)   

applyEither :: [Options -> Either String Options] -> Options -> Either String Options   

applyParse :: [Options -> Either String Options] -> Either String Options   

(>.>) :: Either String a -> (a -> b) -> Either String b   

optionParser :: [String] -> ParseSpec (Options -> Either String Options)   

checkRequiredExecutables :: IO ()   

checkExecutables :: [String] -> IO [String]   

configCmd :: ConfigOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

updateCmd :: Config -> IO ([LogEntry],Either LogEntry ())   

depsCmd :: DepsOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

infoCmd :: InfoOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

printInfo :: Config -> Bool -> Bool -> Package -> IO ([LogEntry],Either LogEntry ())   

checkoutCmd :: CheckoutOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

installCmd :: InstallOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

installapp :: CheckoutOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

Installs the application (i.e., binary) provided by a package. This is done by checking out the package into CPM's application packages cache (default: $HOME/.cpm/apppackages, see APPPACKAGE_PATH in .cpmrc configuration file) and then install this package.

Internal note: the installed package should not be cleaned or removed after the installation since its execution might refer (via the config module) to some data stored in the package.

checkCompiler :: Config -> Package -> IO ()   

Checks the compiler compatibility.

installExecutable :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   

Installs the executable specified in the package in the bin directory of CPM (compare .cpmrc).

uninstall :: UninstallOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

uninstallPackageExecutable :: Config -> Package -> IO ([LogEntry],Either LogEntry ())   

tryFindVersion :: String -> (Int,Int,Int,Maybe String) -> Repository -> IO ([LogEntry],Either LogEntry Package)   

listCmd :: ListOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

Lists all (compiler-compatible if lall is false) packages in the given repository.

filterCompatPkgs :: Config -> [Package] -> Package   

Returns the first package of a list of packages compatible to the current compiler (according to the given configuration). If there is no compatible package, returns the first one.

packageVersionAsTable :: Config -> [Package] -> ([Int],[[String]])   

showVersionIfCompatible :: Config -> Package -> String   

Shows the version of a package if it is compatible with the current compiler, otherwise shows the version in brackets.

cpmInfo :: String   

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

searchCmd :: SearchOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

Search in all (compiler-compatible) packages in the given repository.

upgradeCmd :: UpgradeOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

upgrade command.

linkCmd :: LinkOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

link command.

addCmd :: AddOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

add command: Option --package: copy the given package to the repository index and package installation directory so that it is available as any other package. Option --dependency: add the package name as a dependency to the current package

useForce :: String   

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

addDependencyCmd :: String -> Bool -> Config -> IO ([LogEntry],Either LogEntry ())   

add --dependency command: add the given package as a new dependency to the current package.

docCmd :: DocOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

doc command: run curry doc on the modules provided as an argument or, if they are not given, on exported modules (if specified in the package), on the main executable (if specified in the package), or on all source modules of the package.

genPackageManual :: DocOptions -> Config -> Package -> String -> IO ([LogEntry],Either LogEntry ())   

Generate manual according to documentation specification of package.

replaceSubString :: String -> String -> String -> String   

Replace every occurrence of the first argument by the second argument in a string (third argument).

genDocForPrograms :: DocOptions -> Config -> String -> String -> Package -> IO ([LogEntry],Either LogEntry ())   

Generate program documentation: run curry doc on the modules provided as an argument or, if they are not given, on exported modules (if specified in the package), on the main executable (if specified in the package), or on all source modules of the package.

testCmd :: TestOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

test command: run curry check on the modules provided as an argument or, if they are not provided, on the exported (if specified) or all source modules of the package.

curryModulesInDir :: String -> IO [String]   

Get the names of all Curry modules contained in a directory. Modules in subdirectories are returned as hierarchical modules.

diffCmd :: DiffOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

compiler :: ExecOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

execCmd :: ExecOptions -> Config -> IO ([LogEntry],Either LogEntry ())   

execWithPkgDir :: ExecOptions -> Config -> String -> IO ([LogEntry],Either LogEntry ())   

execWithCurryPath :: ExecOptions -> Config -> String -> IO ([LogEntry],Either LogEntry ())   

computePackageLoadPath :: Config -> String -> IO ([LogEntry],Either LogEntry String)   

cleanPackage :: Config -> LogLevel -> IO ([LogEntry],Either LogEntry ())   

newPackage :: NewOptions -> IO ([LogEntry],Either LogEntry ())   

Creates a new package.

packageNotFoundFailure :: String -> IO ([LogEntry],Either LogEntry a)   

Fail with a "package not found" message.

compatPackageNotFoundFailure :: Config -> String -> String -> IO ([LogEntry],Either LogEntry a)   

Fail with a "compatible package not found" message and a comment

curryPathCacheFile :: String -> String   

The name of the cache file in a package directory.

baseVersionCacheFile :: String -> String   

The name of the cache file for the base version in a package directory.

saveBaseVersionToCache :: Config -> String -> IO ()   

Saves baseVersion of config in local cache file in the given package dir.

loadBaseVersionFromCache :: String -> IO String   

Loads baseVersion from local cache file in the given package dir.

saveCurryPathToCache :: Config -> String -> String -> IO ()   

Saves package CURRYPATH in local cache file in the given package dir.

getCurryLoadPath :: Config -> String -> IO ([LogEntry],Either LogEntry String)   

Gets CURRYPATH of the given package (either from the local cache file in the package dir or compute it).

loadCurryPathFromCache :: Config -> String -> IO ([LogEntry],Either LogEntry (Maybe String))   

Restores package CURRYPATH from local cache file in the given package dir, if it is still up-to-date, i.e., it exists and is newer than the package specification.

cleanCurryPathCache :: String -> IO ([LogEntry],Either LogEntry ())   

Cleans the local cache file for CURRYPATH. This might be necessary for upgrade/install/link commands.