Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fredrik Wieczerkowski
curry-tools
Commits
f0ff0b01
Commit
f0ff0b01
authored
Nov 14, 2017
by
Michael Hanus
Browse files
CPM updated
parent
dd94d576
Changes
7
Hide whitespace changes
Inline
Side-by-side
cpm/src/CPM/AbstractCurry.curry
View file @
f0ff0b01
...
...
@@ -13,14 +13,10 @@ module CPM.AbstractCurry
, tcArgsOfType
) where
import Char (toUpper)
import Distribution (FrontendTarget (..), FrontendParams (..), defaultParams
, callFrontendWithParams
, setQuiet, setFullPath, setDefinitions
, callFrontendWithParams, setQuiet, setFullPath
, sysLibPath, inCurrySubdir, modNameToPath
, inCurrySubdirModule, lookupModuleSource
, curryCompiler, curryCompilerMajorVersion
, curryCompilerMinorVersion )
, inCurrySubdirModule, lookupModuleSource)
import List (intercalate, nub)
import FilePath ((</>), (<.>), takeFileName, replaceExtension)
import AbstractCurry.Files (readAbstractCurryFile, writeAbstractCurryFile)
...
...
@@ -66,19 +62,13 @@ readAbstractCurryFromPackagePath :: Package -> String -> [Package] -> String
-> IO CurryProg
readAbstractCurryFromPackagePath pkg pkgDir deps modname = do
let loadPath = fullLoadPathForPackage pkg pkgDir deps
params <- return $ setQuiet True
$ setFullPath loadPath
$ setDefinitions defs
$ defaultParams
params <- return $ setQuiet True (setFullPath loadPath defaultParams)
callFrontendWithParams ACY params modname
src <- lookupModuleSource loadPath modname
acyName <- return $ case src of
Nothing -> error $ "Module not found: " ++ modname
Just (_, file) -> replaceExtension (inCurrySubdirModule modname file) ".acy"
readAbstractCurryFile acyName
where
defs = [( "__" ++ map toUpper curryCompiler ++ "__"
, curryCompilerMajorVersion * 100 + curryCompilerMinorVersion )]
--- Reads an AbstractCurry module from a package or one of its dependencies.
---
...
...
cpm/src/CPM/Main.curry
View file @
f0ff0b01
...
...
@@ -49,7 +49,7 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 1
3
/11/2017)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of 1
4
/11/2017)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
...
...
@@ -725,13 +725,11 @@ infoCmdRepoGC :: String -> Maybe Version -> Bool -> Bool -> Config
-> Repository -> GlobalCache -> IO (ErrorLogger ())
infoCmdRepoGC pkg Nothing allinfos plain cfg repo gc =
case findLatestVersion cfg repo pkg False of
Nothing -> failIO $
"Package '" ++ pkg ++ "' not found in package repository."
Nothing -> packageNotFoundFailure pkg
Just p -> printInfo allinfos plain (Just (isPackageInstalled gc p)) p
infoCmdRepoGC pkg (Just v) allinfos plain _ repo gc =
case findVersion repo pkg v of
Nothing -> failIO $ "Package '" ++ pkg ++ "-" ++ showVersion v ++
"' not found in package repository."
Nothing -> packageNotFoundFailure $ pkg ++ "-" ++ showVersion v
Just p -> printInfo allinfos plain (Just (isPackageInstalled gc p)) p
printInfo :: Bool -> Bool -> Maybe Bool -> Package
...
...
@@ -746,14 +744,12 @@ checkout :: CheckoutOptions -> Config -> Repository -> GlobalCache
-> IO (ErrorLogger ())
checkout (CheckoutOptions pkg Nothing pre) cfg repo gc =
case findLatestVersion cfg repo pkg pre of
Nothing -> failIO $ "Package '" ++ pkg ++
"' not found in package repository."
Nothing -> packageNotFoundFailure pkg
Just p -> acquireAndInstallPackageWithDependencies cfg repo gc p |>
checkoutPackage cfg repo gc p
checkout (CheckoutOptions pkg (Just ver) _) cfg repo gc =
case findVersion repo pkg ver of
Nothing -> failIO $ "Package '" ++ pkg ++ "-" ++ showVersion ver ++
"' not found in package repository."
Nothing -> packageNotFoundFailure $ pkg ++ "-" ++ showVersion ver
Just p -> acquireAndInstallPackageWithDependencies cfg repo gc p |>
checkoutPackage cfg repo gc p
...
...
@@ -890,8 +886,7 @@ uninstallPackageExecutable cfg pkg =
tryFindVersion :: String -> Version -> Repository -> IO (ErrorLogger Package)
tryFindVersion pkg ver repo = case findVersion repo pkg ver of
Nothing -> failIO $ "Package '" ++ pkg ++ "-" ++ (showVersion ver) ++
"' not found in package repository."
Nothing -> packageNotFoundFailure $ pkg ++ "-" ++ showVersion ver
Just p -> succeedIO $ p
--- Lists all (compiler-compatible if `lall` is false) packages
...
...
@@ -1058,8 +1053,7 @@ addDependencyCmd :: String -> Bool -> Config -> IO (ErrorLogger ())
addDependencyCmd pkgname force config =
readRepository config >>= \repo ->
case findLatestVersion config repo pkgname False of
Nothing -> failIO $
"Package '" ++ pkgname ++ "' not found in package repository."
Nothing -> packageNotFoundFailure pkgname
Just p -> searchLocalPackageSpec "." |>=
maybe (genNewLocalPackage (version p))
(addDepToLocalPackage (version p))
...
...
@@ -1422,6 +1416,13 @@ newPackage (NewOptions pname) = do
, "> cypm curry :load Main :eval main :quit"
]
--- Fail with a "package not found" message.
packageNotFoundFailure :: String -> IO (ErrorLogger _)
packageNotFoundFailure pkgname =
failIO $ "Package '" ++ pkgname ++ "' not found in package repository.\n" ++
cpmUpdate
---------------------------------------------------------------------------
-- Caching the current CURRYPATH of a package for faster startup.
-- The file `.cpm/CURRYPATH_CACHE` contains the following lines:
...
...
cpm/vendor/abstract-curry/src/AbstractCurry/Files.curry
View file @
f0ff0b01
...
...
@@ -6,7 +6,7 @@
--- Assumption: an abstract Curry program is stored in file with
--- extension `.acy` in the subdirectory `.curry`
---
--- @author Michael Hanus, Bjoern Peemoeller, Jan Tikovsky
--- @author Michael Hanus, Bjoern Peemoeller, Jan Tikovsky
, Finn Teegen
--- @version November 2017
--- @category meta
-- ---------------------------------------------------------------------------
...
...
@@ -15,7 +15,7 @@ module AbstractCurry.Files where
import AbstractCurry.Select (imports)
import AbstractCurry.Types
import Char (isSpace
, toUpper
)
import Char (isSpace)
import Directory (doesFileExist, getModificationTime)
import Distribution
import FileGoodies (getFileInPath, lookupFileInPath)
...
...
@@ -30,7 +30,7 @@ import ReadShowTerm
--- or ".lcurry") and the result is a Curry term representing this
--- program.
readCurry :: String -> IO CurryProg
readCurry prog = readCurryWithParseOptions prog
cc
Params
readCurry prog = readCurryWithParseOptions prog
(setQuiet True default
Params
)
--- Read an AbstractCurry file with all its imports.
--- @param modname - Module name or file name of Curry module
...
...
@@ -66,7 +66,7 @@ tryReadCurryFile m = do
case mbSrc of
Nothing -> cancel $ "Source module '" ++ m ++ "' not found"
Just (_,srcFile) -> do
callFrontendWithParams ACY
cc
Params m
callFrontendWithParams ACY
(setQuiet True default
Params
)
m
mbFn <- getLoadPathForModule m >>=
lookupFileInPath (abstractCurryFileName m) [""]
case mbFn of
...
...
@@ -116,7 +116,7 @@ tryParse fn = do
--- the function declaration contains the type `(CTCons ("Prelude","untyped")`.
readUntypedCurry :: String -> IO CurryProg
readUntypedCurry prog =
readUntypedCurryWithParseOptions prog
cc
Params
readUntypedCurryWithParseOptions prog
(setQuiet True default
Params
)
--- I/O action which reads a typed Curry program from a file (with extension
--- ".acy") with respect to some parser options.
...
...
@@ -234,11 +234,4 @@ tryReadACYFile fn = do
writeAbstractCurryFile :: String -> CurryProg -> IO ()
writeAbstractCurryFile file prog = writeFile file (showTerm prog)
--- frontend params (quiet and definition for conditional compiling set)
ccParams :: FrontendParams
ccParams = setQuiet True $ setDefinitions defs defaultParams
where
defs = [( "__" ++ map toUpper curryCompiler ++ "__"
, curryCompilerMajorVersion * 100 + curryCompilerMinorVersion )]
------------------------------------------------------------------------------
cpm/vendor/flatcurry/src/FlatCurry/Files.curry
View file @
f0ff0b01
...
...
@@ -3,8 +3,8 @@
--- Curry programs in Curry. This library defines I/O actions
--- to read Curry programs and transform them into this representation.
---
--- @author Michael Hanus
--- @version
Octo
ber 201
5
--- @author Michael Hanus
, Finn Teegen
--- @version
Novem
ber 201
7
--- @category meta
------------------------------------------------------------------------------
...
...
@@ -13,7 +13,7 @@ module FlatCurry.Files where
import Directory (doesFileExist)
import Distribution ( FrontendParams, FrontendTarget (..), defaultParams
, setQuiet, inCurrySubdir, stripCurrySuffix
,
callFrontend,
callFrontendWithParams
, callFrontendWithParams
, lookupModuleSourceInLoadPath, getLoadPathForModule
)
import FileGoodies (getFileInPath, lookupFileInPath)
...
...
cpm/vendor/flatcurry/src/FlatCurry/Read.curry
View file @
f0ff0b01
...
...
@@ -2,8 +2,8 @@
--- This library defines operations to read FlatCurry programs or interfaces
--- together with all its imported modules in the current load path.
---
--- @author Michael Hanus, Bjoern Peemoeller
--- @version
Dec
ember 201
6
--- @author Michael Hanus, Bjoern Peemoeller
, Finn Teegen
--- @version
Nov
ember 201
7
--- @category meta
------------------------------------------------------------------------------
...
...
@@ -15,13 +15,10 @@ module FlatCurry.Read
, readFlatCurryIntWithImportsInPath
) where
import Char (toUpper)
import Directory (getModificationTime)
import Distribution ( getLoadPathForModule, lookupModuleSource
, FrontendTarget (FCY), callFrontendWithParams
, defaultParams, setQuiet, setFullPath, setDefinitions
, curryCompiler, curryCompilerMajorVersion
, curryCompilerMinorVersion
, defaultParams, setQuiet, setFullPath
)
import FileGoodies (baseName, lookupFileInPath, stripSuffix)
import FilePath (normalise)
...
...
@@ -97,14 +94,11 @@ parseFlatCurryFile withImp verb loadpath modname suffixes = do
putStrLn $ ">>>>> FlatCurry files not up-to-date, parsing module \""
++ modname ++ "\"..."
callFrontendWithParams FCY
(setQuiet True (setFullPath loadpath (setDefinitions defs defaultParams)))
modname
(setQuiet True (setFullPath loadpath defaultParams)) modname
when verb $ putStr "Reading FlatCurry files "
eiMods <- tryReadFlatCurryFile withImp verb loadpath modname suffixes
return (either (error . notFound) id eiMods)
where defs = [( "__" ++ map toUpper curryCompiler ++ "__"
, curryCompilerMajorVersion * 100 + curryCompilerMinorVersion )]
notFound mods = "FlatCurry file not found for the following module(s): "
where notFound mods = "FlatCurry file not found for the following module(s): "
++ unwords mods
-- Read a FlatCurry file (with all its imports if first argument is true).
...
...
optimize/.cpm/packages/flatcurry/src/FlatCurry/Files.curry
View file @
f0ff0b01
...
...
@@ -3,8 +3,8 @@
--- Curry programs in Curry. This library defines I/O actions
--- to read Curry programs and transform them into this representation.
---
--- @author Michael Hanus
--- @version
Octo
ber 201
5
--- @author Michael Hanus
, Finn Teegen
--- @version
Novem
ber 201
7
--- @category meta
------------------------------------------------------------------------------
...
...
@@ -13,7 +13,7 @@ module FlatCurry.Files where
import Directory (doesFileExist)
import Distribution ( FrontendParams, FrontendTarget (..), defaultParams
, setQuiet, inCurrySubdir, stripCurrySuffix
,
callFrontend,
callFrontendWithParams
, callFrontendWithParams
, lookupModuleSourceInLoadPath, getLoadPathForModule
)
import FileGoodies (getFileInPath, lookupFileInPath)
...
...
optimize/.cpm/packages/flatcurry/src/FlatCurry/Read.curry
View file @
f0ff0b01
...
...
@@ -2,8 +2,8 @@
--- This library defines operations to read FlatCurry programs or interfaces
--- together with all its imported modules in the current load path.
---
--- @author Michael Hanus, Bjoern Peemoeller
--- @version
Dec
ember 201
6
--- @author Michael Hanus, Bjoern Peemoeller
, Finn Teegen
--- @version
Nov
ember 201
7
--- @category meta
------------------------------------------------------------------------------
...
...
@@ -15,13 +15,10 @@ module FlatCurry.Read
, readFlatCurryIntWithImportsInPath
) where
import Char (toUpper)
import Directory (getModificationTime)
import Distribution ( getLoadPathForModule, lookupModuleSource
, FrontendTarget (FCY), callFrontendWithParams
, defaultParams, setQuiet, setFullPath, setDefinitions
, curryCompiler, curryCompilerMajorVersion
, curryCompilerMinorVersion
, defaultParams, setQuiet, setFullPath
)
import FileGoodies (baseName, lookupFileInPath, stripSuffix)
import FilePath (normalise)
...
...
@@ -97,14 +94,11 @@ parseFlatCurryFile withImp verb loadpath modname suffixes = do
putStrLn $ ">>>>> FlatCurry files not up-to-date, parsing module \""
++ modname ++ "\"..."
callFrontendWithParams FCY
(setQuiet True (setFullPath loadpath (setDefinitions defs defaultParams)))
modname
(setQuiet True (setFullPath loadpath defaultParams)) modname
when verb $ putStr "Reading FlatCurry files "
eiMods <- tryReadFlatCurryFile withImp verb loadpath modname suffixes
return (either (error . notFound) id eiMods)
where defs = [( "__" ++ map toUpper curryCompiler ++ "__"
, curryCompilerMajorVersion * 100 + curryCompilerMinorVersion )]
notFound mods = "FlatCurry file not found for the following module(s): "
where notFound mods = "FlatCurry file not found for the following module(s): "
++ unwords mods
-- Read a FlatCurry file (with all its imports if first argument is true).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment