Module FlatCurryPretty

Pretty printing of FlatCurry.

This library provides pretty-printers for FlatCurry modules and all substructures (e.g., expressions).

Author: Björn Peemöller

Version: September 2015

Summary of exported operations:

ppProg :: Prog -> Doc   
pretty-print a FlatCurry module
ppHeader :: String -> [TypeDecl] -> [FuncDecl] -> Doc   
pretty-print the module header
ppExports :: [TypeDecl] -> [FuncDecl] -> Doc   
pretty-print the export list
ppTypeExport :: TypeDecl -> Doc   
pretty-print a type export
ppConsExports :: [ConsDecl] -> [Doc]   
pretty-print the export list of constructors
ppFuncExports :: [FuncDecl] -> [Doc]   
pretty-print the export list of functions
ppImports :: [String] -> Doc   
pretty-print a list of import statements
ppImport :: String -> Doc   
pretty-print a single import statement
ppOpDecls :: [OpDecl] -> Doc   
pretty-print a list of operator fixity declarations
ppOpDecl :: OpDecl -> Doc   
pretty-print a single operator fixity declaration
ppFixity :: Fixity -> Doc   
pretty-print the associativity keyword
ppTypeDecls :: [TypeDecl] -> Doc   
pretty-print a list of type declarations
ppTypeDecl :: TypeDecl -> Doc   
pretty-print a type declaration
ppConsDecls :: [ConsDecl] -> Doc   
pretty-print the constructor declarations
ppConsDecl :: ConsDecl -> Doc   
pretty print a single constructor
ppTypeExp :: TypeExpr -> Doc   
pretty a top-level type expression
ppTypeExpr :: Int -> TypeExpr -> Doc   
pretty-print a type expression
ppTVarIndex :: Int -> Doc   
pretty-print a type variable
ppFuncDecls :: [FuncDecl] -> Doc   
pretty-print a list of function declarations
ppFuncDecl :: FuncDecl -> Doc   
pretty-print a function declaration
ppRule :: Rule -> Doc   
pretty-print a function rule
ppExp :: Expr -> Doc   
Pretty-print a top-level expression.
ppExpr :: Int -> Expr -> Doc   
pretty-print an expression
ppVarIndex :: Int -> Doc   
pretty-print a variable
ppLiteral :: Literal -> Doc   
pretty-print a literal
ppComb :: Int -> (String,String) -> [Expr] -> Doc   
Pretty print a constructor or function call
ppDecls :: [(Int,Expr)] -> Doc   
pretty-print a list of declarations
ppDecl :: (Int,Expr) -> Doc   
pretty-print a single declaration
ppCaseType :: CaseType -> Doc   
Pretty print the type of a case expression
ppBranch :: BranchExpr -> Doc   
Pretty print a case branch
ppPattern :: Pattern -> Doc   
Pretty print a pattern
ppPrefixOp :: (String,String) -> Doc   
pretty-print a prefix operator
ppInfixOp :: (String,String) -> Doc   
pretty-print an infix operator
ppQName :: (String,String) -> Doc   
Pretty-print a qualified name
isInfixOp :: (String,String) -> Bool   
Check whether an operator is an infix operator
isListId :: (String,String) -> Bool   
Check whether an identifier represents a list
isTupleId :: (String,String) -> Bool   
Check whether an identifier represents a tuple
indent :: Doc -> Doc   
Indent a document by 2 spaces.

Exported operations:

ppProg :: Prog -> Doc   

pretty-print a FlatCurry module

ppHeader :: String -> [TypeDecl] -> [FuncDecl] -> Doc   

pretty-print the module header

ppExports :: [TypeDecl] -> [FuncDecl] -> Doc   

pretty-print the export list

ppTypeExport :: TypeDecl -> Doc   

pretty-print a type export

ppConsExports :: [ConsDecl] -> [Doc]   

pretty-print the export list of constructors

ppFuncExports :: [FuncDecl] -> [Doc]   

pretty-print the export list of functions

ppImports :: [String] -> Doc   

pretty-print a list of import statements

ppImport :: String -> Doc   

pretty-print a single import statement

ppOpDecls :: [OpDecl] -> Doc   

pretty-print a list of operator fixity declarations

ppOpDecl :: OpDecl -> Doc   

pretty-print a single operator fixity declaration

ppFixity :: Fixity -> Doc   

pretty-print the associativity keyword

Further infos:
  • solution complete, i.e., able to compute all solutions

ppTypeDecls :: [TypeDecl] -> Doc   

pretty-print a list of type declarations

ppTypeDecl :: TypeDecl -> Doc   

pretty-print a type declaration

ppConsDecls :: [ConsDecl] -> Doc   

pretty-print the constructor declarations

ppConsDecl :: ConsDecl -> Doc   

pretty print a single constructor

ppTypeExp :: TypeExpr -> Doc   

pretty a top-level type expression

ppTypeExpr :: Int -> TypeExpr -> Doc   

pretty-print a type expression

Further infos:
  • partially defined

ppTVarIndex :: Int -> Doc   

pretty-print a type variable

ppFuncDecls :: [FuncDecl] -> Doc   

pretty-print a list of function declarations

ppFuncDecl :: FuncDecl -> Doc   

pretty-print a function declaration

ppRule :: Rule -> Doc   

pretty-print a function rule

ppExp :: Expr -> Doc   

Pretty-print a top-level expression.

ppExpr :: Int -> Expr -> Doc   

pretty-print an expression

ppVarIndex :: Int -> Doc   

pretty-print a variable

ppLiteral :: Literal -> Doc   

pretty-print a literal

ppComb :: Int -> (String,String) -> [Expr] -> Doc   

Pretty print a constructor or function call

ppDecls :: [(Int,Expr)] -> Doc   

pretty-print a list of declarations

ppDecl :: (Int,Expr) -> Doc   

pretty-print a single declaration

ppCaseType :: CaseType -> Doc   

Pretty print the type of a case expression

Further infos:
  • solution complete, i.e., able to compute all solutions

ppBranch :: BranchExpr -> Doc   

Pretty print a case branch

ppPattern :: Pattern -> Doc   

Pretty print a pattern

ppPrefixOp :: (String,String) -> Doc   

pretty-print a prefix operator

ppInfixOp :: (String,String) -> Doc   

pretty-print an infix operator

ppQName :: (String,String) -> Doc   

Pretty-print a qualified name

isInfixOp :: (String,String) -> Bool   

Check whether an operator is an infix operator

isListId :: (String,String) -> Bool   

Check whether an identifier represents a list

isTupleId :: (String,String) -> Bool   

Check whether an identifier represents a tuple

indent :: Doc -> Doc   

Indent a document by 2 spaces.