Module ICurry.Pretty

Pretty print ICurry programs

Author: Marc Andre Wittorf

Summary of exported operations:

ppIProg :: IProg -> Doc   
Pretty print an ICurry module
ppHeader :: String -> Doc   
Pretty print an ICurry module header
ppImports :: [String] -> Doc   
Pretty print an ICurry module import list
ppImport :: String -> Doc   
Pretty print an import directive
ppTypes :: [((String,String),IVisibility,[Int],[IConstructor])] -> Doc   
Pretty print ICurry types
ppType :: ((String,String),IVisibility,[Int],[IConstructor]) -> Doc   
Pretty print an ICurry type
ppConstructors :: [IConstructor] -> Doc   
Pretty print ICurry constructors
ppConstructor :: IConstructor -> Doc   
Pretty print an ICurry constructor
ppFunctions :: [IFunction] -> Doc   
Pretty print ICurry functions
ppFunction :: IFunction -> Doc   
Pretty print an ICurry function
ppQName :: (String,String) -> Doc   
Pretty print a qualified ICurry name (module.localname)
ppArity :: Int -> Doc   
Pretty print an ICurry function's argument list
ppFuncBody :: IFuncBody -> Doc   
Pretty print an ICurry function's body
ppVars :: [Int] -> Doc   
Pretty print a list of variables
ppVar :: Int -> Doc   
Pretty print a variable.
ppTVars :: [Int] -> Doc   
Pretty print type variables
ppTVar :: Char -> Int -> Doc   
Pretty print a type variable
ppTExpr :: Char -> ITExpr -> Doc   
Pretty print a type expression
ppBlock :: IBlock -> Doc   
Pretty print an ICurry block
ppLocals :: [Int] -> Doc   
Pretty print local variable declarations
ppAssignments :: [(Int,IExpr)] -> Doc   
Pretty print assignments
ppAssignment :: (Int,IExpr) -> Doc   
Pretty print an assignment
ppExprs :: [IExpr] -> Doc   
Pretty print comma separated expressions
ppExpr :: IExpr -> Doc   
Pretty print an ICurry expression
ppLit :: ILiteral -> Doc   
Pretty print an ICurry literal
ppLitBranches :: [ILitBranch] -> Doc   
Pretty print branches over literals
ppLitBranch :: ILitBranch -> Doc   
Pretty print a branch over literals
ppConsBranches :: [IConsBranch] -> Doc   
Pretty print branches over constructors
ppConsBranch :: IConsBranch -> Doc   
Pretty print a branch over constructors

Exported operations:

ppIProg :: IProg -> Doc   

Pretty print an ICurry module

Example call:
(ppIProg prog)
Parameters:
  • prog : the module
Returns:
the pretty printed module

ppHeader :: String -> Doc   

Pretty print an ICurry module header

Example call:
(ppHeader name)
Parameters:
  • name : the module name
Returns:
the pretty printed module header

ppImports :: [String] -> Doc   

Pretty print an ICurry module import list

Example call:
(ppImports names)
Parameters:
  • names : the imported modules' names
Returns:
the pretty printed import list

ppImport :: String -> Doc   

Pretty print an import directive

Example call:
(ppImport name)
Parameters:
  • name : the imported module's name
Returns:
the pretty printed module import directive

ppTypes :: [((String,String),IVisibility,[Int],[IConstructor])] -> Doc   

Pretty print ICurry types

Example call:
(ppTypes dts)
Parameters:
  • dts : the data type declarations
Returns:
the pretty printed types

ppType :: ((String,String),IVisibility,[Int],[IConstructor]) -> Doc   

Pretty print an ICurry type

Example call:
(ppType dt)
Parameters:
  • dt : the data type declaration
Returns:
the pretty printed type

ppConstructors :: [IConstructor] -> Doc   

Pretty print ICurry constructors

Example call:
(ppConstructors cs)
Parameters:
  • cs : the data constructors
Returns:
the pretty printed constructors

ppConstructor :: IConstructor -> Doc   

Pretty print an ICurry constructor

Example call:
(ppConstructor c)
Parameters:
  • c : the data constructor
Returns:
the pretty printed constructor

ppFunctions :: [IFunction] -> Doc   

Pretty print ICurry functions

Example call:
(ppFunctions fns)
Parameters:
  • fns : the functions
Returns:
the pretty printed functions

ppFunction :: IFunction -> Doc   

Pretty print an ICurry function

Example call:
(ppFunction fns)
Parameters:
  • fns : the function
Returns:
the pretty printed function

ppQName :: (String,String) -> Doc   

Pretty print a qualified ICurry name (module.localname)

Example call:
(ppQName name)
Parameters:
  • name : the name
Returns:
the pretty printed name

ppArity :: Int -> Doc   

Pretty print an ICurry function's argument list

Example call:
(ppArity arity)
Parameters:
  • arity : the number of variables (1.. is assumed)
Returns:
the pretty printed argument list

ppFuncBody :: IFuncBody -> Doc   

Pretty print an ICurry function's body

Example call:
(ppFuncBody body)
Parameters:
  • body : the function's body
Returns:
the pretty printed function body

ppVars :: [Int] -> Doc   

Pretty print a list of variables

Example call:
(ppVars vs)
Parameters:
  • vs : the variables
Returns:
the pretty printed variables

ppVar :: Int -> Doc   

Pretty print a variable. Variables are called x0, x1, ...

Example call:
(ppVar v)
Parameters:
  • v : the variable
Returns:
the pretty printed variable

ppTVars :: [Int] -> Doc   

Pretty print type variables

Example call:
(ppTVars tvs)
Parameters:
  • tvs : the type variables
Returns:
the pretty printed type variables

ppTVar :: Char -> Int -> Doc   

Pretty print a type variable

Example call:
(ppTVar c tv)
Parameters:
  • c : the character to denote the variable
  • tv : the type variable
Returns:
the pretty printed type variable

ppTExpr :: Char -> ITExpr -> Doc   

Pretty print a type expression

Example call:
(ppTExpr c te)
Parameters:
  • c : the character to denote type variables
  • te : the type expression
Returns:
the pretty pritned type expression

ppBlock :: IBlock -> Doc   

Pretty print an ICurry block

Example call:
(ppBlock block)
Parameters:
  • block : the block
Returns:
the rendered block

ppLocals :: [Int] -> Doc   

Pretty print local variable declarations

Example call:
(ppLocals vs)
Parameters:
  • vs : the local variables
Returns:
the pretty printed variable declarations

ppAssignments :: [(Int,IExpr)] -> Doc   

Pretty print assignments

Example call:
(ppAssignments as)
Parameters:
  • as : the assignments
Returns:
the pretty printed assignments

ppAssignment :: (Int,IExpr) -> Doc   

Pretty print an assignment

Example call:
(ppAssignment as)
Parameters:
  • as : the assignment
Returns:
the pretty printed assignment

ppExprs :: [IExpr] -> Doc   

Pretty print comma separated expressions

Example call:
(ppExprs exprs)
Parameters:
  • exprs : the expressions
Returns:
the pretty printed expressions

ppExpr :: IExpr -> Doc   

Pretty print an ICurry expression

Example call:
(ppExpr expr)
Parameters:
  • expr : the expression
Returns:
the pretty printed expression

ppLit :: ILiteral -> Doc   

Pretty print an ICurry literal

Example call:
(ppLit lit)
Parameters:
  • lit : the literal
Returns:
the pretty printed literal

ppLitBranches :: [ILitBranch] -> Doc   

Pretty print branches over literals

Example call:
(ppLitBranches bs)
Parameters:
  • bs : the branches
Returns:
the pretty printed branches

ppLitBranch :: ILitBranch -> Doc   

Pretty print a branch over literals

Example call:
(ppLitBranch b)
Parameters:
  • b : the branch
Returns:
the pretty printed branch

ppConsBranches :: [IConsBranch] -> Doc   

Pretty print branches over constructors

Example call:
(ppConsBranches bs)
Parameters:
  • bs : the branches
Returns:
the pretty printed branches

ppConsBranch :: IConsBranch -> Doc   

Pretty print a branch over constructors

Example call:
(ppConsBranch b)
Parameters:
  • b : the branch
Returns:
the pretty printed branch