Library for pretty printing AbstractCurry programs.
In contrast to the library AbstractCurryPrinter,
this library implements a better human-readable pretty printing
of AbstractCurry programs.
Author: Stefan Junge
Version: March 2009
| Exported names: |
Functions:
cprogDoc
| cprogDocWithPrecedences
| precs
| preludePrecs
| prettyCOps
| prettyCProg
| prettyCTypeExpr
| prettyCTypes
| printCProg
| printUCProg
| showCProg
| Summary of exported functions: |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
| Imported modules: |
| Exported datatypes: |
| Exported functions: |
:: [((String,String),(CFixity,Int))]
the precedences of the operators in the Prelude module
:: Int -> CurryProg -> String
(prettyCProg w prog) pretty prints the curry prog prog and
fits it to a page width of w characters.
Example call: (prettyCProg w prog)
w
- width of page
prog
- a curry prog
prog
:: String -> CTypeExpr -> String
(prettyCTypeExpr mod typeExpr) pretty prints the type expression
typeExpr of the module mod and fits it to a page
width of 78 characters.
Example call: (prettyCTypeExpr mod typeExpr)
mod
- module name of the current module
typeExpr
- a type expression
typeExpr
:: String -> [CTypeDecl] -> String
(prettyCTypes mod typeDecls) pretty prints the type declarations
typeDecls of the module mod and fits it to a page
width of 78 characters.
Example call: (prettyCTypes mod typeDecls)
mod
- module name of the current module
typeDecls
- a list of type declarations
typeDecls
:: [COpDecl] -> String
(prettyCOps opDecls) pretty prints the operators
opDecls and fits it to a page width of 78 characters.
Example call: (prettyCOps opDecls)
opDecls
- a list of operators
opDecls
:: CurryProg -> String
(showCProg prog) pretty prints the curry prog
prog and fits it to a page width of 78 characters.
Example call: (showCProg prog)
prog
- a curry prog
prog
:: String -> IO ()
(printCProg modulname) pretty prints the typed Abstract Curry program of
modulname produced by AbstractCurry.readCurry and
fits it to a page width of 78 characters.
The output is standard io.
Example call: (printCProg modulname)
modulname
- the file name without suffix ".curry" or ".acy"
:: String -> IO ()
(printUCProg modulname) pretty prints the untyped Abstract Curry program of
modulname produced by AbstractCurry.readUntypedCurry
and fits it to a page width of 78 characters.
The output ist standard io.
Example call: (printUCProg modulname)
modulname
- the file name without suffix ".curry" or ".uacy"
:: CurryProg -> Doc
(cprogDoc prog) creates a document of the Curry program
prog and fits it to a page width of 78 characters.
Example call: (cprogDoc prog)
prog
- a curry prog
prog
:: [((String,String),(CFixity,Int))] -> CurryProg -> Doc
(cprogDocWithPrecedences precs prog) creates a document of the curry prog
prog and fits it to a page width of 78 characters,
the precedences precs ensure a correct bracketing
of infix operators
Example call: (cprogDocWithPrecedences precs prog)
precs
- a list of precedences
prog
- a curry prog
prog
:: [COpDecl] -> [((String,String),(CFixity,Int))]
generates a list of precedences
Example call: (precs opDecls)
opDecls
- a list of operators