Module CPM.AbstractCurry

This module contains helper functions for dealing with AbstractCurry. In particular, it contains functions that can read modules from a package and its dependencies with all dependencies available to the Curry frontend.

Summary of exported operations:

loadPathForPackage :: Package -> String -> [Package] -> [String]  Deterministic 
Returns the load path for a package stored in some directory w.r.t.
readAbstractCurryFromPackagePath :: Package -> String -> [Package] -> String -> IO CurryProg  Deterministic 
Reads an AbstractCurry module from a package.
readAbstractCurryFromDeps :: String -> [Package] -> String -> ErrorLogger CurryProg  Deterministic 
Reads an AbstractCurry module from a package or one of its dependencies.
transformAbstractCurryInDeps :: String -> [Package] -> (CurryProg -> CurryProg) -> String -> String -> ErrorLogger ()  Deterministic 
Applies a transformation function to a module from a package or one of its dependencies and writes the modified module to a file in Curry form.
applyModuleRenames :: [(String,String)] -> CurryProg -> CurryProg  Deterministic 
Renames all references to some modules in a Curry program.

Exported operations:

loadPathForPackage :: Package -> String -> [Package] -> [String]  Deterministic 

Returns the load path for a package stored in some directory w.r.t. the dependent packages.

Example call:
(loadPathForPackage )
Parameters:
  • : pkg - the package
  • : pkgDir - the directory containing this package
  • : deps - the resolved dependencies of the package
Returns:
the full load path for modules in the package or dependent packages

readAbstractCurryFromPackagePath :: Package -> String -> [Package] -> String -> IO CurryProg  Deterministic 

Reads an AbstractCurry module from a package.

Example call:
(readAbstractCurryFromPackagePath )
Parameters:
  • : dir the package's directory
  • : deps the resolved dependencies of the package
  • : mod the module to read

readAbstractCurryFromDeps :: String -> [Package] -> String -> ErrorLogger CurryProg  Deterministic 

Reads an AbstractCurry module from a package or one of its dependencies.

Example call:
(readAbstractCurryFromDeps dir deps mod)
Parameters:
  • dir : the package's directory
  • deps : the resolved dependencies of the package
  • mod : the module to read

transformAbstractCurryInDeps :: String -> [Package] -> (CurryProg -> CurryProg) -> String -> String -> ErrorLogger ()  Deterministic 

Applies a transformation function to a module from a package or one of its dependencies and writes the modified module to a file in Curry form.

Example call:
(transformAbstractCurryInDeps dir deps f mod dest)
Parameters:
  • dir : the package's directory
  • deps : the resolved dependencies of the package
  • f : the transformation function
  • mod : the module to transform
  • dest : the destination file for the transformed module

applyModuleRenames :: [(String,String)] -> CurryProg -> CurryProg  Deterministic 

Renames all references to some modules in a Curry program.

Example call:
(applyModuleRenames mods prog)
Parameters:
  • mods : a map from old to new module names
  • prog : the program to modify