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
curry
curry-tools
Commits
b1676fa0
Commit
b1676fa0
authored
Oct 20, 2017
by
Michael Hanus
Browse files
cpm updated
parent
8978ef90
Changes
8
Hide whitespace changes
Inline
Side-by-side
cpm/Makefile
View file @
b1676fa0
...
...
@@ -2,7 +2,7 @@
# The tool name of the application:
TOOL
=
$(BINDIR)
/cpm
TOOL
=
$(BINDIR)
/c
y
pm
# The default options for the REPL (options "rts -T" required for KiCS2
# in order to get elapsed times):
...
...
cpm/README.md
View file @
b1676fa0
...
...
@@ -6,11 +6,11 @@ This repository contains the Curry package manager (CPM).
To build the Curry package manager, you need to run
`make`
inside this
directory. The
`Makefile`
assumes that the
`curry`
executable and
`git`
are on
your path. If the build was successful, a
`cpm`
binary will be placed in the
your path. If the build was successful, a
`c
y
pm`
binary will be placed in the
directory
`~/.cpm/bin`
(which is also the directory where CPM installs
binaries of tools distributed in packages). Therefore, you should
add this directory to your path. Afterwards, run
`cpm update`
to clone a copy of the central package index repository. More
`c
y
pm update`
to clone a copy of the central package index repository. More
information can be found in the manual, see the
`docs`
directory.
## Documentation
...
...
cpm/docs/currysystem_manual.tex
View file @
b1676fa0
...
...
@@ -8,18 +8,18 @@ Since CPM offers a lot of functionality, there is a separate
manual available.
\footnote
{
\url
{
http://curry-language.org/tools/cpm
}}
Therefore, we describe here only some basic CPM commands.
The executable
\code
{
cpm
}
is located in the
\code
{
bin
}
directory
The executable
\code
{
c
y
pm
}
is located in the
\code
{
bin
}
directory
of
\CYS
. Hence, if you have this directory in your path,
you can start CPM by cloning a copy of the central package index repository:
%
\begin{curry}
> cpm update
> c
y
pm update
\end{curry}
%
Now you can show a short list of all packages in this index by
%
\begin{curry}
> cpm list
> c
y
pm list
Name Synopsis Version
---- -------- -------
addtypes A tool to add missing type signatures in a Curry 0.0.1
...
...
@@ -32,7 +32,7 @@ $\ldots$
The command
%
\begin{curry}
> cpm info PACKAGE
> c
y
pm info PACKAGE
\end{curry}
%
can be used to show more information about the package with name
...
...
@@ -43,7 +43,7 @@ but also tools with some binary. In order to install such tools,
one can use the command
%
\begin{curry}
> cpm install PACKAGE
> c
y
pm install PACKAGE
\end{curry}
%
This command checks out the package in some internal directory
...
...
@@ -56,15 +56,15 @@ For instance, the most recent version of CPM
can be installed by the following commands:
%
\begin{curry}
> cpm update
> c
y
pm update
$
\ldots
$
> cpm install cpm
> c
y
pm install cpm
$
\ldots
$
Package 'cpm-xxx' checked out
$
\ldots
$
$
\ldots
$
INFO Installing executable 'cpm' into '/home/joe/.cpm/bin'
INFO Installing executable 'c
y
pm' into '/home/joe/.cpm/bin'
\end{curry}
%
Now, the binary
\code
{
cpm
}
of the most recent CPM version can be used
Now, the binary
\code
{
c
y
pm
}
of the most recent CPM version can be used
if
\code
{
\$
HOME/.cpm/bin
}
is in your path
(before
\code
{
\cyshome
{}
/bin
}
!).
...
...
cpm/docs/manual.tex
View file @
b1676fa0
...
...
@@ -100,7 +100,7 @@ The main executable \code{curry} of your Curry system must be in your
path (otherwise, you can also specify the root location of your Curry system
by modifying the definition of
\code
{
CURRYROOT
}
in the
\code
{
Makefile
}
).
Then type
\code
{
make
}
to compile CPM which generates
a binary called
\code
{
cpm
}
in the
\code
{
bin
}
subdirectory. Put
a binary called
\code
{
c
y
pm
}
in the
\code
{
bin
}
subdirectory. Put
this binary somewhere on your path.
...
...
@@ -108,10 +108,10 @@ this binary somewhere on your path.
\section
{
Starting the Curry Package Manager
}
If the binary
\code
{
cpm
}
is on your path, execute the command
If the binary
\code
{
c
y
pm
}
is on your path, execute the command
%
\begin{lstlisting}
> cpm update
> c
y
pm update
\end{lstlisting}
%
to pull down a copy of the central package index to your system.
...
...
@@ -121,20 +121,20 @@ your copy of the central package index to the newest version.
Afterwards, you can show a short list of all packages in this index by
%
\begin{lstlisting}
> cpm list
> c
y
pm list
\end{lstlisting}
%
The command
%
\begin{lstlisting}
> cpm info PACKAGE
> c
y
pm info PACKAGE
\end{lstlisting}
%
can be used to show more information about a package.
There is also a command
%
\begin{lstlisting}
> cpm search QUERY
> c
y
pm search QUERY
\end{lstlisting}
%
to search inside the central package index.
...
...
@@ -214,7 +214,7 @@ To use a Curry package in your project, create a
\code
{
package.json
}
file in the root, fill it with the minimum amount of
information discussed in the previous session, and move your Curry code to a
\code
{
src
}
directory inside your project's directory. Alternatively, if you are
starting a new project, use the
\code
{
cpm new <project-name>
}
command, which
starting a new project, use the
\code
{
c
y
pm new <project-name>
}
command, which
creates a new project directory with a
\code
{
package.json
}
file for you.
\footnote
{
The
\code
{
new
}
command
also creates some other useful template files. Look into the
...
...
@@ -230,33 +230,33 @@ Declare a dependency inside the new \code{package.json} file, e.g.:
}
\end{lstlisting}
%
Then run
\code
{
cpm install
}
to install all dependencies of the current package
and start your interactive Curry environment with
\code
{
cpm curry
}
. You will be
Then run
\code
{
c
y
pm install
}
to install all dependencies of the current package
and start your interactive Curry environment with
\code
{
c
y
pm curry
}
. You will be
able to load the JSON package's modules in your Curry session.
\subsection
{
Installing and Updating Dependencies
}
To install the current package's dependencies, run
\code
{
cpm install
}
. This will
To install the current package's dependencies, run
\code
{
c
y
pm install
}
. This will
install the most recent version of all dependencies that are compatible to the
package's dependency constraints. Note that a subsequent run of
\code
{
cpm install
}
will always prefer the versions it installed on a previous
\code
{
c
y
pm install
}
will always prefer the versions it installed on a previous
run, if they are still compatible to the package's dependencies. If you want to
explicitly install the newest compatible version regardless of what was
installed on previous runs of
\code
{
cpm install
}
, you can use the
\code
{
cpm upgrade
}
command to upgrade all dependencies to their newest
compatible versions, or
\code
{
cpm upgrade <package>
}
to update a specific
installed on previous runs of
\code
{
c
y
pm install
}
, you can use the
\code
{
c
y
pm upgrade
}
command to upgrade all dependencies to their newest
compatible versions, or
\code
{
c
y
pm upgrade <package>
}
to update a specific
package and all its transitive dependencies to the newest compatible version.
If the package also contains an implementation of a complete executable,
e.g., some useful tool,
which can be specifed in the
\code
{
package.json
}
file
(see Section~
\ref
{
sec:reference
}
),
then the command
\code
{
cpm install
}
also compiles the application
then the command
\code
{
c
y
pm install
}
also compiles the application
and installs the executable in the
\code
{
bin
}
install directory of CPM
(see Section~
\ref
{
sec:config
}
for details).
The installation of executables can be suppressed by the
\code
{
cpm install
}
option
\code
{
-n
}
or
\code
{
--noexec
}
.
\code
{
c
y
pm install
}
option
\code
{
-n
}
or
\code
{
--noexec
}
.
\subsection
{
Checking out Packages
}
...
...
@@ -265,7 +265,7 @@ The installation of executables can be suppressed by the
In order to use, experiment with or modify an existing package,
one can use the command
\begin{lstlisting}
cpm checkout <package>
c
y
pm checkout <package>
\end{lstlisting}
to install a local copy of a package.
This is also useful to install some tool distributed as a package.
...
...
@@ -274,10 +274,10 @@ a property-testing tool for Curry,
one can check out the most recent version and install the tool:
%
\begin{lstlisting}
> cpm checkout currycheck
> c
y
pm checkout currycheck
$
\ldots
$
Package 'currycheck-1.0.1' checked out into directory 'currycheck'.
> cd currycheck
> cpm install
> c
y
pm install
$
\ldots
$
INFO Installing executable 'curry-check into '/home/joe/.cpm/bin'
\end{lstlisting}
...
...
@@ -297,7 +297,7 @@ In order to install the executables of such applications without
explicitly checking out the package in some local directory,
one can use the command
\begin{lstlisting}
cpm install <package>
c
y
pm install <package>
\end{lstlisting}
This command checks out the package in some internal directory
(default:
\code
{
\$
HOME/.cpm/app
_
packages
}
, see
...
...
@@ -309,7 +309,7 @@ For instance, the most recent version of the web framework Spicey
can be installed by the following command:
%
\begin{lstlisting}
> cpm install spicey
> c
y
pm install spicey
$
\ldots
$
Package 'spicey-xxx' checked out
$
\ldots
$
$
\ldots
$
INFO Installing executable 'spiceup' into '/home/joe/.cpm/bin'
...
...
@@ -325,23 +325,23 @@ of this default path).
To use the dependencies of a package, the Curry system needs to be
started via CPM so that it will know where to search for the
modules provided. You can use the command
\ccode
{
cpm curry
}
to start the
modules provided. You can use the command
\ccode
{
c
y
pm curry
}
to start the
Curry system (which is either the compiler used to install CPM
or specified with the configuration option
\code
{
CURRY
_
BIN
}
,
see Section~
\ref
{
sec:config
}
).
Any parameters given to
\ccode
{
cpm curry
}
will be passed along verbatim to
Any parameters given to
\ccode
{
c
y
pm curry
}
will be passed along verbatim to
the Curry system.
For example, the following will start the Curry system,
print the result of evaluating the expression
\code
{
39+3
}
and then quit.
\begin{lstlisting}
> cpm curry :eval "39+3" :quit
> c
y
pm curry :eval "39+3" :quit
\end{lstlisting}
%
To execute other Curry commands, such as
\ccode
{
curry check
}
,
with the package's dependencies available,
you can use the
\ccode
{
cpm exec
}
command.
you can use the
\ccode
{
c
y
pm exec
}
command.
This command will set the
\code
{
CURRYPATH
}
environment variable
and then execute the command given after
\ccode
{
exec
}
.
...
...
@@ -355,16 +355,16 @@ but you want to use some package, you have to put
a package specification file into the source directory of
your application where you define the required packages.
As a shortcut for this, you can use the CPM command
\code
{
cpm add --dependency
}
(short:
\code
{
cpm add -d
}
)
\code
{
c
y
pm add --dependency
}
(short:
\code
{
c
y
pm add -d
}
)
to install the package specification file.
For instance, to use the libraries of the JSON package
in your application, one can use the following commands:
%
\begin{lstlisting}
> cpm add -d json # generate package specification with 'json' dependency
> cpm install # download and install all dependencies
> cpm curry # start Curry system with JSON libraries in load path
> c
y
pm add -d json # generate package specification with 'json' dependency
> c
y
pm install # download and install all dependencies
> c
y
pm curry # start Curry system with JSON libraries in load path
...
Prelude> :load JSON.Data
JSON.Data>
...
...
@@ -384,16 +384,16 @@ able to investigate, find and fix the bug. Since you are not the the author of
$
A
$
, however, you cannot release a new version with the bug fixed. So you send
off your patch to
$
A
$
's maintainer and wait for
$
1
.
0
.
4
$
to be released. In the
meantime, you want to use your local, fixed copy of version
$
1
.
0
.
3
$
from your
package. The
\code
{
cpm link
}
command allows you to replace a dependency with
package. The
\code
{
c
y
pm link
}
command allows you to replace a dependency with
your own local copy.
\code
{
cpm link
}
takes a directory containing a copy of one of the current
\code
{
c
y
pm link
}
takes a directory containing a copy of one of the current
package's dependencies as its argument. It creates a symbolic link from that
directory the the current package's local package cache. If you had a copy of
\code
{
A-1.0.3
}
in the
\code
{
~/src/A-1.0.3
}
directory, you could use
\code
{
cpm link ~/src/A-1.0.3
}
to ensure that any time
\code
{
A-1.0.3
}
is used
\code
{
c
y
pm link ~/src/A-1.0.3
}
to ensure that any time
\code
{
A-1.0.3
}
is used
from the current package, your local copy is used instead of the one from the
global package cache. To remove any links, use
\code
{
cpm upgrade
}
without any
global package cache. To remove any links, use
\code
{
c
y
pm upgrade
}
without any
arguments, which will clear the local package cache. See
Section~
\ref
{
sec:internals
}
for more information on the global and local package
caches.
...
...
@@ -446,10 +446,10 @@ whether they are acceptable under semantic versioning for the difference in
version numbers between the two package versions. To use
\code
{
diff
}
, you need
to be in the directory of one of the versions, i.e., your copy for development,
and have the other version installed in CPM's global package cache (see the
\code
{
cpm install
}
command). For example, if you are developing version
$
1
.
3
.
0
$
\code
{
c
y
pm install
}
command). For example, if you are developing version
$
1
.
3
.
0
$
of the JSON package and want to make sure you have not introduced any breaking
changes when compared to the previous version
$
1
.
2
.
6
$
, you can use the
\code
{
cpm diff 1.2.6
}
command while in the directory of version
$
1
.
3
.
0
$
.
\code
{
c
y
pm diff 1.2.6
}
command while in the directory of version
$
1
.
3
.
0
$
.
CPM will then check the types of all public functions and data types in all
exported modules of both versions (see the
\code
{
exportedModules
}
field of the
...
...
@@ -524,10 +524,10 @@ so that CPM will not generate tests for them.
When you have your package ready and want to use it in other packages,
it must be added to the central package index so that CPM can find it
when searching for packages. For this purpose, you can use the
\ccode
{
cpm add
}
command:
\ccode
{
c
y
pm add
}
command:
%
\begin{lstlisting}
> cpm add --package mypackage
> c
y
pm add --package mypackage
\end{lstlisting}
%
In this case,
\code
{
mypackage
}
is the name of the directory containing
...
...
@@ -593,7 +593,7 @@ to the tag \ccode{v\$version\$}.
After you have published the files for your new package version, you
have to add the corresponding package specification to the central
package index. This can be done with the
\ccode
{
cpm add
}
command
package index. This can be done with the
\ccode
{
c
y
pm add
}
command
(see Section~
\ref
{
sec:adding-a-package
}
).
If you have access to the Git
repository containing the central package index, then you can push
...
...
@@ -647,7 +647,7 @@ For instance, to install the binary
of the package
\code
{
spicey
}
in the directory
\code
{
\$
HOME/bin
}
,
one can execute the command
\begin{lstlisting}
> cpm --define bin
_
install
_
path=
$
\$
$
HOME/bin install spicey
> c
y
pm --define bin
_
install
_
path=
$
\$
$
HOME/bin install spicey
\end{lstlisting}
...
...
@@ -746,7 +746,7 @@ to occurrences of an exported module. Thus, the package
exporting the module
\code
{
JSON.Data
}
can be found by the command
%
\begin{lstlisting}
> cpm search --module JSON.Data
> c
y
pm search --module JSON.Data
\end{lstlisting}
%
If the option
\code
{
--exec
}
is set, then the search is restricted
...
...
@@ -754,7 +754,7 @@ to the name of the executable provided by the package.
For instance, the command
%
\begin{lstlisting}
> cpm search --exec show
> c
y
pm search --exec show
\end{lstlisting}
%
lists all packages where the name of the executable contains the
...
...
@@ -1060,8 +1060,8 @@ source directory.
\item
[\fbox{\code{exportedModules}}]
A list of modules intended for use by
consumers of the package.
These are the modules compared by the
\code
{
cpm diff
}
command (and tested by the
\code
{
cpm test
}
command if a list of
These are the modules compared by the
\code
{
c
y
pm diff
}
command (and tested by the
\code
{
c
y
pm test
}
command if a list of
test modules is not provided).
Note that modules not in this list are still accessible to consumers
of the package.
...
...
@@ -1100,7 +1100,7 @@ For instance, a possible specification could be as follows:
{
...,
"executable":
{
"name": "cpm",
"name": "c
y
pm",
"main": "CPM.Main",
"options":
{
"kics2" : ":set rts -T"
}
}
...
...
@@ -1108,7 +1108,7 @@ For instance, a possible specification could be as follows:
\end{lstlisting}
%
If a package contains an
\code
{
executable
}
specification,
the command
\code
{
cpm install
}
also compiles the main module
the command
\code
{
c
y
pm install
}
also compiles the main module
and installs the executable in the
\code
{
bin
}
install directory of CPM
(see Section~
\ref
{
sec:config
}
for details).
...
...
@@ -1131,7 +1131,7 @@ For instance, a possible test suite specification could be as follows:
\end{lstlisting}
%
All these modules are tested with CurryCheck
by the command
\code
{
cpm test
}
.
by the command
\code
{
c
y
pm test
}
.
If no test suite is defined, all (exported) modules are tested
in the directory
\code
{
src
}
.
A test suite can also contain a field
\code
{
options
}
...
...
@@ -1193,7 +1193,7 @@ the manual and \code{manual.tex} is its main file which will be
processed with the specified command.
Occurrences of the string
\code
{
OUTDIR
}
in the command string
will be replaced by the actual documentation directory
(see description of the command
\code
{
cpm doc
}
).
(see description of the command
\code
{
c
y
pm doc
}
).
If the command is omitted, the following commands are used
(and you have to ensure that these programs are installed):
\begin{itemize}
...
...
@@ -1290,11 +1290,11 @@ that something is wrong.
In such cases, it might be a good idea to clean up your package file system.
Here are some suggestions how to do this:
\begin{description}
\item
[\code{cpm clean}]
~
\\
\item
[\code{c
y
pm clean}]
~
\\
This command cleans the current package from
generated auxiliary files (see Section~
\ref
{
sec:cmd-reference
}
).
Then you can re-install the package and packages on which it depends
by the command
\code
{
cpm install
}
.
by the command
\code
{
c
y
pm install
}
.
\item
[\code{rm -rf \$HOME/.cpm/packages}]
~
\\
This cleans all packages which have been previously installed
in the global package cache (see Section~
\ref
{
sec:internals
}
).
...
...
@@ -1305,7 +1305,7 @@ are downloaded again when they are needed.
This removes the central package index of CPM
(see Section~
\ref
{
sec:internals
}
).
You can simply re-install the newest version of this index
by the command
\code
{
cpm update
}
.
by the command
\code
{
c
y
pm update
}
.
\end{description}
...
...
cpm/src/CPM/Diff/Behavior.curry
View file @
b1676fa0
...
...
@@ -131,13 +131,13 @@ createBaseTemp :: IO (ErrorLogger String)
createBaseTemp = getTemporaryDirectory >>=
\tmpDir ->
let
tmp = tmpDir </> "
cpm
" </> "bdiff"
tmp = tmpDir </> "
CPM
" </> "bdiff"
in recreateDirectory tmp >> succeedIO tmp
--- Get temporary directory for the behavior diff.
getBaseTemp :: IO (ErrorLogger String)
getBaseTemp = getTemporaryDirectory >>=
\tmpDir -> succeedIO $ tmpDir </> "
cpm
" </> "bdiff"
\tmpDir -> succeedIO $ tmpDir </> "
CPM
" </> "bdiff"
--- This message is printed before CurryCheck is executed.
infoText :: String
...
...
@@ -506,7 +506,7 @@ addModuleDir dir mod p (ACYCache ps) = case lookup mod ps of
--- Generate a translator function for a type expression. Expects a CTCons.
---
--- @param cfg current
cpm
configuration
--- @param cfg current
CPM
configuration
--- @param repo package repository
--- @param gc the global package cache
--- @param info information about the current comparison
...
...
@@ -762,7 +762,7 @@ replace' o n (x:xs) | x == o = n : replace' o n xs
--- module versions and find the functions that have not changed between
--- versions.
---
--- @param cfg the
cpm
configuration
--- @param cfg the
CPM
configuration
--- @param repo the current repository
--- @param gc the global package cache
--- @param dirA the directory of the A version of the package
...
...
@@ -1192,7 +1192,7 @@ isPublic (CmtFunc _ _ _ Private _ _) = False
--- comparison by copying them to the temporary directory and building renamed
--- versions.
---
--- @param cfg the
cpm
configuration
--- @param cfg the
CPM
configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param nameA the name of the first package
...
...
@@ -1218,7 +1218,7 @@ preparePackages cfg repo gc nameA verA nameB verB =
--- cache. Copies them to a temporary directory and builds renamed versions of
--- the packages and all dependencies.
---
--- @param cfg the
cpm
configuration
--- @param cfg the
CPM
configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param dirA the directory for the first package
...
...
@@ -1239,7 +1239,7 @@ preparePackageAndDir cfg repo gc dirA nameB verB = GC.tryFindPackage gc nameB ve
--- package files to a temporary directory and creates renamed version of the
--- packages and their dependencies.
---
--- @param cfg the
cpm
configuration
--- @param cfg the
CPM
configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param dirA the directory containing the first package
...
...
@@ -1290,7 +1290,7 @@ versionPrefix pkg = "V_" ++ (showVersion' $ version pkg)
--- another copy of the package with all its modules and the modules of its
--- dependencies prefixed with the given string.
---
--- @param cfg the
cpm
configuration
--- @param cfg the
CPM
configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param pkgDir the package directory to copy from
...
...
cpm/src/CPM/Main.curry
View file @
b1676fa0
...
...
@@ -48,13 +48,13 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of
19/09
/2017)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of
20/10
/2017)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
main = do
args <- getArgs
parseResult <- return $ parse (intercalate " " args) optionParser "cpm"
parseResult <- return $ parse (intercalate " " args) optionParser "c
y
pm"
case parseResult of
Left err -> do putStrLn cpmBanner
putStrLn err
...
...
@@ -62,7 +62,7 @@ main = do
exitWith 1
Right r -> case applyParse r of
Left err -> do putStrLn cpmBanner
--printUsage "cpm" 80 optionParser
--printUsage "c
y
pm" 80 optionParser
putStrLn err
exitWith 1
Right opts -> runWithArgs opts
...
...
@@ -73,7 +73,7 @@ runWithArgs opts = do
missingExecutables <- checkExecutables
unless (null missingExecutables) $ do
putStrLn $ "The following programs could not be found on the PATH " ++
"(they are required for
cpm
to work):\n" ++
"(they are required for
CPM
to work):\n" ++
intercalate ", " missingExecutables
exitWith 1
config <- readConfigurationWithDefault (optDefConfig opts) >>= \c ->
...
...
@@ -490,7 +490,7 @@ optionParser = optParser
arg (\s a -> Right $ a { optCommand = PkgInfo (infoOpts a)
{ infoPackage = Just s } })
( metavar "PACKAGE"
<> help ("The package name. If no name is specified,
cpm
tries " ++
<> help ("The package name. If no name is specified,
CPM
tries " ++
"to read a package specification in the current directory.")
<> optional)
<.> arg (\s a -> readVersion' s >.> \v -> a
...
...
@@ -498,7 +498,7 @@ optionParser = optParser
{ infoVersion = Just v } })
( metavar "VERSION"
<> help ("The package version. If no version is specified, " ++
"
cpm
uses the latest version of the specified package.")
"
CPM
uses the latest version of the specified package.")
<> optional )
<.> flag (\a -> Right $ a { optCommand = PkgInfo (infoOpts a)
{ infoAll = True } })
...
...
@@ -553,7 +553,7 @@ optionParser = optParser
a { optCommand = Diff (diffOpts a) { diffVersion = Just v } })
( metavar "VERSION"
<> help ("The other package version. If no version is specified, " ++
"
cpm
diffs against the latest repository version.")
"
CPM
diffs against the latest repository version.")
<> optional )
<.> option (\s a -> Right $ a { optCommand = Diff (diffOpts a)
{ diffModules = Just $ splitOn "," s } })
...
...
@@ -937,10 +937,10 @@ showVersionIfCompatible cfg p =
in if isCompatibleToCompiler cfg p then s else '(' : s ++ ")"
cpmInfo :: String
cpmInfo = "Use 'cpm info PACKAGE' for more information about a package."
cpmInfo = "Use 'c
y
pm info PACKAGE' for more information about a package."
cpmUpdate :: String
cpmUpdate = "Use 'cpm update' to download the newest package index."
cpmUpdate = "Use 'c
y
pm update' to download the newest package index."
--- Search in all (compiler-compatible) packages in the given repository.
...
...
@@ -1372,12 +1372,12 @@ newPackage (NewOptions pname) = do
, "- add further fields (e.g., 'description')"
, "- review field 'license' (and adapt file 'LICENSE')"
, ""
, "Then run 'cpm install' to install all dependencies and"
, "Then run 'c
y
pm install' to install all dependencies and"
, "put your program code in directory 'src'"
, "(where you find a template file 'Main.curry')"
, ""
, "Run the main program with:"
, "> cpm curry :load Main :eval main :quit"
, "> c
y
pm curry :load Main :eval main :quit"
]
---------------------------------------------------------------------------
...
...
cpm/src/CPM/PackageCopy.curry
View file @
b1676fa0
...
...
@@ -148,7 +148,7 @@ installLocalDependencies cfg repo gc dir =
copyDependencies cfg gc pkgSpec (resolvedPackages result) dir |>
succeedIO (pkgSpec, resolvedPackages result)
--- Links a directory into the local package cache. Used for `cpm link`.
--- Links a directory into the local package cache. Used for `c
y
pm link`.
linkToLocalCache :: String -> String -> IO (ErrorLogger ())
linkToLocalCache src pkgDir = do
dirExists <- doesDirectoryExist src
...
...
@@ -196,7 +196,7 @@ resolveAndCopyDependenciesForPackage cfg repo gc dir pkgSpec =
missingDeps = GC.missingPackages gc deps
failMsg = "Missing dependencies "
++ (intercalate "," $ map packageId missingDeps)
++ "\nUse `cpm install` to install missing dependencies."
++ "\nUse `c
y
pm install` to install missing dependencies."
in if length missingDeps > 0
then failIO failMsg
else copyDependencies cfg gc pkgSpec deps dir |>= \_ ->
...
...
currypp/.cpm/packages/regexp/test/TestRegExp.curry
0 → 100644
View file @
b1676fa0
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains some examples for integrated code to support
--- regular expression matching.
--- The syntax of regular expression is similar to
--- POSIX extended regular expressions
------------------------------------------------------------------------------
import RegExp -- required in the pre-processed program
import Test.EasyCheck
check1 :: Bool
check1 = match ``regex abc'' "abc"
testCheck1 = always check1
check2 :: Bool
check2 = match ``regex aba*c'' "abaaaaaaaaaaaaac"
testCheck2 = always check2
check3 :: String -> Bool
check3 = match ``regex (a|(bc*))+''
testCheck3a = always (check3 "abcccbccca")
testCheck3b = always (not (check3 "abcccbcccac"))
check4 :: String -> Bool
check4 = match ``regex [:alpha:]''
testCheck4a = always (check4 "a")
testCheck4b = always (check4 "A")
testCheck4c = always (not (check4 "0"))
testCheck4d = always (not (check4 "ab"))
check5 :: String -> Bool
check5 = match ``regex [a-z]+''
testCheck5a = always (check5 "a")
testCheck5b = always (check5 "abc")
testCheck5c = always (not (check5 "abc42"))
testCheck5d = always (not (check5 ""))
-- Tests with parameterized regular expressions:
pregexp1 :: Ord a => a -> a -> [a] -> Bool
pregexp1 v1 v2 = match ``regex [<v1>-<v2>]*''
testPregexp1a = always (pregexp1 'a' 'z' "abc")
testPregexp1b = always (pregexp1 'A' 'Z' "ABC")
testPregexp1c = always (not (pregexp1 'A' 'Z' "abc"))
pregexp2 :: Ord a => a -> a -> [a] -> Bool
pregexp2 v1 v2 = match ``regex (<v1>|<v2>)*''
testPregexp2a = always (pregexp2 'a' 'b' "abaabbb")
testPregexp2b = always (not (pregexp2 'a' 'z' "abaabbb"))
-- A regular expression containing a complex Curry expression:
check6 :: Bool
check6 = match ``regex <((\x -\> x) 'a')>'' "a"
testCheck6 = always check6
Write
Preview