This library provides pretty-printers for FlatCurry modules and all substructures (e.g., expressions).
data Options
Options for pretty printing.
Constructors:
data QualMode
Qualification mode, determines whether identifiers are printed qualified
or unqualified. While QualNone
and QualImports
aim at readability,
there may be ambiguities due to shadowing. On the contrary, QualImports
and QualAll
produce correct output at the cost of readability.
Constructors:
QualNone
:: QualMode
QualImportsButPrelude
:: QualMode
Prelude
QualImports
:: QualMode
Prelude
QualAll
:: QualMode
Known instances:
Default Options
for pretty-printing.
ppProg
:: Options -> Prog -> Doc
pretty-print a FlatCurry module
ppHeader
:: Options -> String -> [TypeDecl] -> [FuncDecl] -> Doc
pretty-print the module header
ppExports
:: Options -> [TypeDecl] -> [FuncDecl] -> Doc
pretty-print the export list
ppTypeExport
:: Options -> TypeDecl -> Doc
pretty-print a type export
ppConsExports
:: Options -> [ConsDecl] -> [Doc]
pretty-print the export list of constructors
ppFuncExports
:: Options -> [FuncDecl] -> [Doc]
pretty-print the export list of functions
ppImports
:: Options -> [String] -> Doc
pretty-print a list of import statements
ppImport
:: Options -> String -> Doc
pretty-print a single import statement
ppOpDecls
:: Options -> [OpDecl] -> Doc
pretty-print a list of operator fixity declarations
ppOpDecl
:: Options -> OpDecl -> Doc
pretty-print a single operator fixity declaration
pretty-print the associativity keyword
ppTypeDecls
:: Options -> [TypeDecl] -> Doc
pretty-print a list of type declarations
ppTypeDecl
:: Options -> TypeDecl -> Doc
pretty-print a type declaration
ppConsDecls
:: Options -> [ConsDecl] -> Doc
pretty-print the constructor declarations
ppConsDecl
:: Options -> ConsDecl -> Doc
pretty print a single constructor
ppNewConsDecl
:: Options -> NewConsDecl -> Doc
pretty print a single newtype constructor
ppTypeExp
:: Options -> TypeExpr -> Doc
pretty a top-level type expression
ppTypeExpr
:: Options -> Int -> TypeExpr -> Doc
pretty-print a type expression
ppQuantifiedVars
:: [(Int, Kind)] -> Doc
pretty-print explicitly quantified type variables
ppTVarIndex
:: Int -> Doc
pretty-print a type variable
ppFuncDecls
:: Options -> [FuncDecl] -> Doc
pretty-print a list of function declarations
ppFuncDecl
:: Options -> FuncDecl -> Doc
pretty-print a function declaration
ppRule
:: Options -> Rule -> Doc
pretty-print a function rule
ppExp
:: Options -> Expr -> Doc
Pretty-print a top-level expression.
ppExpr
:: Options -> Int -> Expr -> Doc
pretty-print an expression
ppVarIndex
:: Int -> Doc
pretty-print a variable
pretty-print a literal
ppComb
:: Options -> Int -> (String, String) -> [Expr] -> Doc
Pretty print a constructor or function call
ppDecls
:: Options -> [(Int, Expr)] -> Doc
pretty-print a list of declarations
ppDecl
:: Options -> (Int, Expr) -> Doc
pretty-print a single declaration
ppCaseType
:: CaseType -> Doc
Pretty print the type of a case expression
ppBranch
:: Options -> BranchExpr -> Doc
Pretty print a case branch
ppPattern
:: Options -> Pattern -> Doc
Pretty print a pattern
ppPrefixQOp
:: Options -> (String, String) -> Doc
pretty-print a qualified prefix operator.
ppPrefixOp
:: (String, String) -> Doc
pretty-print a prefix operator unqualified.
ppInfixQOp
:: Options -> (String, String) -> Doc
pretty-print an infix operator
ppQName
:: Options -> (String, String) -> Doc
Pretty-print a qualified name
ppName
:: (String, String) -> Doc
Pretty-print a qualified name unqualified (e.g., for type definitions).
isInfixOp
:: (String, String) -> Bool
Check whether an operator is an infix operator
isConsId
:: (String, String) -> Bool
Check whether an identifier represents the :
list constructor.
isListId
:: (String, String) -> Bool
Check whether an identifier represents a list
isTupleId
:: (String, String) -> Bool
Check whether an identifier represents a tuple
indent
:: Options -> Doc -> Doc
Indentation