5 Managing Curry Packages

5.1 Importing Existing Packages

To implement a larger application with Curry, one probably needs many libraries from other packages. In this case, one should write the application as a Curry package so that all required dependencies can be specified so that CPM can manage them. This is explained in more detail in Section 5.3. If one wants to execute a smaller Curry program which uses a library from some Curry package, then one can use CPM’s add command to add this package as a global dependency and download and install it globally (i.e., in your user-home environment). For instance, the package pflp supports probabilistic functional logic programming [8]. It can be installed as a global dependency by the command

> cypm add pflp

The command

> cypm info pflp --all

shows all information about this package. In particular, one can see that the module PFLP is exported by this package. Thus, one can use this module in a program using probabilistic functional logic programming by adding the line

import PFLP

in the header of the program. When this program is loaded with PAKCS, the load path is set in such a way so that the module PFLP from package pflp can be imported.

Note that this method to use packages should be used only for small programs or to try some package, since a specific appropriate version of the package is globally installed. Actually, each version of each Curry system has its own global package cache.66Use the command cypm config and look at HOME_PACKAGE_PATH to see the directory of this global cache. If it is no longer needed or should be initialized, one can simple delete this directory. For larger applications, one should install the required packages locally (which is described in Section 5.3 below).