Module System.CurryPath

This module contains operations related to module names and paths used in Curry system.

Author: Bernd Brassel, Michael Hanus, Bjoern Peemoeller, Finn Teegen

Version: December 2018

Summary of exported operations:

splitModuleFileName :: String -> String -> (String,String)   
Split the FilePath of a module into the directory prefix and the FilePath corresponding to the module name.
splitModuleIdentifiers :: String -> [String]   
Split up the components of a module identifier.
joinModuleIdentifiers :: [String] -> String   
Join the components of a module identifier.
stripCurrySuffix :: String -> String   
Strips the suffix ".curry" or ".lcurry" from a file name.
modNameToPath :: String -> String   
Transforms a hierarchical module name into a path name, i.e., replace the dots in the name by directory separator chars.
currySubdir :: String   
Name of the sub directory where auxiliary files (.fint, .fcy, etc) are stored.
inCurrySubdir :: String -> String   
Transforms a path to a module name into a file name by adding the currySubDir to the path and transforming a hierarchical module name into a path.
inCurrySubdirModule :: String -> String -> String   
Transforms a file name by adding the currySubDir to the file name.
addCurrySubdir :: String -> String   
Transforms a directory name into the name of the corresponding sub directory containing auxiliary files.
sysLibPath :: [String]   
finding files in correspondence to compiler load path Returns the current path (list of directory names) of the system libraries.
getLoadPathForModule :: String -> IO [String]   
Returns the current path (list of directory names) that is used for loading modules w.r.t.
lookupModuleSourceInLoadPath :: String -> IO (Maybe (String,String))   
Returns a directory name and the actual source file name for a module by looking up the module source in the current load path.
lookupModuleSource :: [String] -> String -> IO (Maybe (String,String))   
Returns a directory name and the actual source file name for a module by looking up the module source in the load path provided as the first argument.

Exported datatypes:


ModuleIdent

Functions for handling file names of Curry modules

Type synonym: ModuleIdent = String


ModulePath

A module path consists of a directory prefix (which can be omitted) and a module name (which can be hierarchical). For instance, the following strings are module paths in Unix-based systems:

HTML
Data.Number.Int
curry/Data.Number.Int

Type synonym: ModulePath = String


Exported operations:

splitModuleFileName :: String -> String -> (String,String)   

Split the FilePath of a module into the directory prefix and the FilePath corresponding to the module name. For instance, the call splitModuleFileName "Data.Set" "lib/Data/Set.curry" evaluates to ("lib", "Data/Set.curry"). This can be useful to compute output directories while retaining the hierarchical module structure.

splitModuleIdentifiers :: String -> [String]   

Split up the components of a module identifier. For instance, splitModuleIdentifiers "Data.Set" evaluates to ["Data", "Set"].

joinModuleIdentifiers :: [String] -> String   

Join the components of a module identifier. For instance, joinModuleIdentifiers ["Data", "Set"] evaluates to "Data.Set".

stripCurrySuffix :: String -> String   

Strips the suffix ".curry" or ".lcurry" from a file name.

modNameToPath :: String -> String   

Transforms a hierarchical module name into a path name, i.e., replace the dots in the name by directory separator chars.

currySubdir :: String   

Name of the sub directory where auxiliary files (.fint, .fcy, etc) are stored.

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

inCurrySubdir :: String -> String   

Transforms a path to a module name into a file name by adding the currySubDir to the path and transforming a hierarchical module name into a path. For instance, inCurrySubdir "mylib/Data.Char" evaluates to "mylib/.curry/Data/Char".

inCurrySubdirModule :: String -> String -> String   

Transforms a file name by adding the currySubDir to the file name. This version respects hierarchical module names.

addCurrySubdir :: String -> String   

Transforms a directory name into the name of the corresponding sub directory containing auxiliary files.

sysLibPath :: [String]   

finding files in correspondence to compiler load path Returns the current path (list of directory names) of the system libraries.

getLoadPathForModule :: String -> IO [String]   

Returns the current path (list of directory names) that is used for loading modules w.r.t. a given module path. The directory prefix of the module path (or "." if there is no such prefix) is the first element of the load path and the remaining elements are determined by the environment variable CURRYRPATH and the entry "libraries" of the system's rc file.

lookupModuleSourceInLoadPath :: String -> IO (Maybe (String,String))   

Returns a directory name and the actual source file name for a module by looking up the module source in the current load path. If the module is hierarchical, the directory is the top directory of the hierarchy. Returns Nothing if there is no corresponding source file.

lookupModuleSource :: [String] -> String -> IO (Maybe (String,String))   

Returns a directory name and the actual source file name for a module by looking up the module source in the load path provided as the first argument. If the module is hierarchical, the directory is the top directory of the hierarchy. Returns Nothing if there is no corresponding source file.