Module FlatCurry.Files

This library supports meta-programming, i.e., the manipulation of Curry programs in Curry. This library defines I/O actions to read Curry programs and transform them into this representation.

Author: Michael Hanus, Finn Teegen

Version: July 2020

Summary of exported operations:

readFlatCurry :: String -> IO Prog   
I/O action which parses a Curry program and returns the corresponding FlatCurry program.
readFlatCurryWithParseOptions :: String -> FrontendParams -> IO Prog   
I/O action which parses a Curry program with respect to some parser options and returns the corresponding FlatCurry program.
flatCurryFileName :: String -> String   
Transforms a name of a Curry program (with or without suffix ".curry" or ".lcurry") into the name of the file containing the corresponding FlatCurry program.
flatCurryIntName :: String -> String   
Transforms a name of a Curry program (with or without suffix ".curry" or ".lcurry") into the name of the file containing the corresponding FlatCurry program.
readFlatCurryFile :: String -> IO Prog   
I/O action which reads a FlatCurry program from a file in ".fcy" format.
readFlatCurryInt :: String -> IO Prog   
I/O action which returns the interface of a Curry module, i.e., a FlatCurry program containing only "Public" entities and function definitions without rules (i.e., external functions).
readFlatCurryIntWithParseOptions :: String -> FrontendParams -> IO Prog   
I/O action which parses Curry program with respect to some parser options and returns the FlatCurry interface of this program, i.e., a FlatCurry program containing only "Public" entities and function definitions without rules (i.e., external functions).
writeFlatCurry :: Prog -> IO ()   
Writes a FlatCurry program into a file in .fcy format.
writeFlatCurryFile :: String -> Prog -> IO ()   
Writes a FlatCurry program into a file in ".fcy" format.
writeFCY :: String -> Prog -> IO ()   
Writes a FlatCurry program into a file in ".fcy" format.
lookupFlatCurryFileInLoadPath :: String -> IO (Maybe String)   
Returns the name of the FlatCurry file of a module in the load path, if this file exists.
getFlatCurryFileInLoadPath :: String -> IO String   
Returns the name of the FlatCurry file of a module in the load path, if this file exists.

Exported operations:

readFlatCurry :: String -> IO Prog   

I/O action which parses a Curry program and returns the corresponding FlatCurry program. Thus, the argument is the module path (without suffix ".curry" or ".lcurry") and the result is a FlatCurry term representing this program.

readFlatCurryWithParseOptions :: String -> FrontendParams -> IO Prog   

I/O action which parses a Curry program with respect to some parser options and returns the corresponding FlatCurry program. This I/O action is used by the standard action readFlatCurry.

Example call:
(readFlatCurryWithParseOptions progfile options)
Parameters:
  • progfile : the program file name (without suffix ".curry")
  • options : parameters passed to the front end

flatCurryFileName :: String -> String   

Transforms a name of a Curry program (with or without suffix ".curry" or ".lcurry") into the name of the file containing the corresponding FlatCurry program.

flatCurryIntName :: String -> String   

Transforms a name of a Curry program (with or without suffix ".curry" or ".lcurry") into the name of the file containing the corresponding FlatCurry program.

readFlatCurryFile :: String -> IO Prog   

I/O action which reads a FlatCurry program from a file in ".fcy" format. In contrast to readFlatCurry, this action does not parse a source program. Thus, the argument must be the name of an existing file (with suffix ".fcy") containing a FlatCurry program in ".fcy" format and the result is a FlatCurry term representing this program.

readFlatCurryInt :: String -> IO Prog   

I/O action which returns the interface of a Curry module, i.e., a FlatCurry program containing only "Public" entities and function definitions without rules (i.e., external functions). The argument is the file name without suffix ".curry" (or ".lcurry") and the result is a FlatCurry term representing the interface of this module.

readFlatCurryIntWithParseOptions :: String -> FrontendParams -> IO Prog   

I/O action which parses Curry program with respect to some parser options and returns the FlatCurry interface of this program, i.e., a FlatCurry program containing only "Public" entities and function definitions without rules (i.e., external functions). The argument is the file name without suffix ".curry" (or ".lcurry") and the result is a FlatCurry term representing the interface of this module.

writeFlatCurry :: Prog -> IO ()   

Writes a FlatCurry program into a file in .fcy format. The file is written in the standard location for intermediate files, i.e., in the flatCurryFileName relative to the directory of the Curry source program (which must exist!).

writeFlatCurryFile :: String -> Prog -> IO ()   

Writes a FlatCurry program into a file in ".fcy" format. The first argument must be the name of the target file (usually with suffix ".fcy").

writeFCY :: String -> Prog -> IO ()   

Writes a FlatCurry program into a file in ".fcy" format. The first argument must be the name of the target file (usually with suffix ".fcy").

lookupFlatCurryFileInLoadPath :: String -> IO (Maybe String)   

Returns the name of the FlatCurry file of a module in the load path, if this file exists.

getFlatCurryFileInLoadPath :: String -> IO String   

Returns the name of the FlatCurry file of a module in the load path, if this file exists.