This library defines various I/O actions to read Curry programs and transform them into the AbstractCurry representation and to write AbstractCurry files.
Assumption: an abstract Curry program is stored in file with
extension .acy
in the subdirectory .curry
readCurry
:: String -> IO CurryProg
I/O action which parses a Curry program and returns the corresponding typed Abstract Curry program. Thus, the argument is the file name without suffix ".curry" or ".lcurry") and the result is a Curry term representing this program.
readCurryWithImports
:: String -> IO [CurryProg]
Read an AbstractCurry file with all its imports.
:: String
|
Module name or file name of Curry module |
-> IO [CurryProg]
|
a list of curry programs, having the AbstractCurry file as head. |
tryReadCurryFile
:: String -> IO (Either String CurryProg)
I/O action which tries to parse a Curry module and returns either an error message or the corresponding AbstractCurry program.
readUntypedCurry
:: String -> IO CurryProg
I/O action which parses a Curry program and returns the corresponding
untyped AbstractCurry program.
The argument is the file name without suffix ".curry"
or ".lcurry") and the result is a Curry term representing this
program.
In an untyped AbstractCurry program, the type signatures
of operations are the type signatures provided by the programmer
(and not the type signatures inferred by the front end).
If the programmer has not provided an explicit type signature,
the function declaration contains the type (CTCons ("Prelude","untyped")
.
readCurryWithParseOptions
:: String -> FrontendParams -> IO CurryProg
I/O action which reads a typed Curry program from a file (with extension ".acy") with respect to some parser options. This I/O action is used by the standard action readCurry. It is currently predefined only in Curry2Prolog.
:: String
|
the program file name (without suffix ".curry") |
-> FrontendParams
|
parameters passed to the front end |
-> IO CurryProg
|
readUntypedCurryWithParseOptions
:: String -> FrontendParams -> IO CurryProg
I/O action which reads an untyped Curry program from a file (with extension
".uacy") with respect to some parser options. For more details
see function readCurryWithParseOptions
In an untyped AbstractCurry program, the type signatures
of operations are the type signatures provided by the programmer
(and not the type signatures inferred by the front end).
If the programmer has not provided an explicit type signature,
the function declaration contains the type (CTCons ("Prelude","untyped")
.
abstractCurryFileName
:: 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 AbstractCurry program.
untypedAbstractCurryFileName
:: 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 untyped AbstractCurry program.
readAbstractCurryFile
:: String -> IO CurryProg
I/O action which reads an AbstractCurry program from a file in ".acy"
format. In contrast to CODE
readCurry/CODE
, this action does not parse
a source program. Thus, the argument must be the name of an existing
file (with suffix ".acy") containing an AbstractCurry program in ".acy"
format and the result is a Curry term representing this program.
It is currently predefined only in Curry2Prolog.
tryReadACYFile
:: String -> IO (Maybe CurryProg)
Tries to read an AbstractCurry file and returns
writeAbstractCurryFile
:: String -> CurryProg -> IO ()
Writes an AbstractCurry program into a file in ".acy" format. The first argument must be the name of the target file (with suffix ".acy").