Module "PrettyAbstract.curry"

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:

preludePrecs  :: [((String,String),(CFixity,Int))]  deterministic 
          the precedences of the operators in the Prelude module
prettyCProg  :: Int -> CurryProg -> String  deterministic 
          (prettyCProg w prog) pretty prints the curry prog prog and fits it to a page width of w characters.
prettyCTypeExpr  :: String -> CTypeExpr -> String  deterministic 
          (prettyCTypeExpr mod typeExpr) pretty prints the type expression typeExpr of the module mod and fits it to a page width of 78 characters.
prettyCTypes  :: String -> [CTypeDecl] -> String  deterministic 
          (prettyCTypes mod typeDecls) pretty prints the type declarations typeDecls of the module mod and fits it to a page width of 78 characters.
prettyCOps  :: [COpDecl] -> String  deterministic 
          (prettyCOps opDecls) pretty prints the operators opDecls and fits it to a page width of 78 characters.
showCProg  :: CurryProg -> String  deterministic 
          (showCProg prog) pretty prints the curry prog prog and fits it to a page width of 78 characters.
printCProg  :: String -> IO ()  deterministic 
          (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.
printUCProg  :: String -> IO ()  deterministic 
          (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.
cprogDoc  :: CurryProg -> Doc  deterministic 
          (cprogDoc prog) creates a document of the Curry program prog and fits it to a page width of 78 characters.
cprogDocWithPrecedences  :: [((String,String),(CFixity,Int))] -> CurryProg -> Doc  deterministic flexible
          (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
precs  :: [COpDecl] -> [((String,String),(CFixity,Int))]  deterministic 
          generates a list of precedences

 Imported modules:

AbstractCurry
List
Maybe
Prelude
Pretty
System
Char

 Exported datatypes:


 Exported functions:

preludePrecs :: [((String,String),(CFixity,Int))]  deterministic 

the precedences of the operators in the Prelude module

Returns:
a list of precedences
Further infos:

prettyCProg :: Int -> CurryProg -> String  deterministic 

(prettyCProg w prog) pretty prints the curry prog prog and fits it to a page width of w characters.

Example call:  (prettyCProg w prog)

Parameters:
w - width of page
prog - a curry prog
Returns:
a string, which represents the prog

prettyCTypeExpr :: String -> CTypeExpr -> String  deterministic 

(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)

Parameters:
mod - module name of the current module
typeExpr - a type expression
Returns:
a string, which represents the typeExpr

prettyCTypes :: String -> [CTypeDecl] -> String  deterministic 

(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)

Parameters:
mod - module name of the current module
typeDecls - a list of type declarations
Returns:
a string, which represents the typeDecls

prettyCOps :: [COpDecl] -> String  deterministic 

(prettyCOps opDecls) pretty prints the operators opDecls and fits it to a page width of 78 characters.

Example call:  (prettyCOps opDecls)

Parameters:
opDecls - a list of operators
Returns:
a string, which represents the opDecls

showCProg :: CurryProg -> String  deterministic 

(showCProg prog) pretty prints the curry prog prog and fits it to a page width of 78 characters.

Example call:  (showCProg prog)

Parameters:
prog - a curry prog
Returns:
a string, which represents the prog

printCProg :: String -> IO ()  deterministic 

(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)

Parameters:
modulname - the file name without suffix ".curry" or ".acy"

printUCProg :: String -> IO ()  deterministic 

(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)

Parameters:
modulname - the file name without suffix ".curry" or ".uacy"

cprogDoc :: CurryProg -> Doc  deterministic 

(cprogDoc prog) creates a document of the Curry program prog and fits it to a page width of 78 characters.

Example call:  (cprogDoc prog)

Parameters:
prog - a curry prog
Returns:
the document, which represents the prog

cprogDocWithPrecedences :: [((String,String),(CFixity,Int))] -> CurryProg -> Doc  deterministic flexible

(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)

Parameters:
precs - a list of precedences
prog - a curry prog
Returns:
the document, which represents the prog

precs :: [COpDecl] -> [((String,String),(CFixity,Int))]  deterministic 

generates a list of precedences

Example call:  (precs opDecls)

Parameters:
opDecls - a list of operators
Returns:
a list of precedences


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Jun 16 17:36:04 2009