Module FlatCurry.Annotated.Files

This library defines I/O actions to read and write type-annotated FlatCurry programs.

Author: Michael Hanus

Version: July 2020

Summary of exported operations:

typedFlatCurryFileName :: 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 type-annotated FlatCurry program.
typedFlatCurryFilePath :: String -> IO String   
Gets the standard type-annotated FlatCurry file location for a given Curry module name.
readTypedFlatCurry :: String -> IO (AProg TypeExpr)   
I/O action which parses a Curry program and returns the corresponding type-annotated FlatCurry program.
readTypedFlatCurryWithParseOptions :: String -> FrontendParams -> IO (AProg TypeExpr)   
I/O action which parses a Curry program with respect to some parser options and returns the corresponding FlatCurry program.
readTypedFlatCurryFile :: String -> IO (AProg TypeExpr)   
Reads a type-annotated FlatCurry program from a file in .tfcy format where the file name is provided as the argument.
writeTypedFlatCurry :: AProg TypeExpr -> IO ()   
Writes a type-annotated FlatCurry program into a file in .tfcy format.
writeTypedFlatCurryFile :: String -> AProg TypeExpr -> IO ()   
Writes a type-annotated FlatCurry program into a file in ".tfcy" format.

Exported operations:

typedFlatCurryFileName :: 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 type-annotated FlatCurry program.

typedFlatCurryFilePath :: String -> IO String   

Gets the standard type-annotated FlatCurry file location for a given Curry module name. The Curry source program must exist in the Curry load path, otherwise an error is raised.

readTypedFlatCurry :: String -> IO (AProg TypeExpr)   

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

readTypedFlatCurryWithParseOptions :: String -> FrontendParams -> IO (AProg TypeExpr)   

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 readTypedFlatCurry.

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

readTypedFlatCurryFile :: String -> IO (AProg TypeExpr)   

Reads a type-annotated FlatCurry program from a file in .tfcy format where the file name is provided as the argument.

writeTypedFlatCurry :: AProg TypeExpr -> IO ()   

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

writeTypedFlatCurryFile :: String -> AProg TypeExpr -> IO ()   

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