Module CPC.Pretty

Pretty-printing of AbstractCurry.

This library provides a pretty-printer for AbstractCurry modules.

Author: Yannik Potdevin (with changes by Michael Hanus)

Version: March 2016

Summary of exported operations:

defaultOptions :: Options   
The default options to pretty print a module.
setEvExp :: FM ((Int,Int),(Int,Int)) [BoxLabel] -> Options -> Options   
Sets the page width of the pretty printer options.
setPageWith :: Int -> Options -> Options   
Sets the page width of the pretty printer options.
setIndentWith :: Int -> Options -> Options   
Sets the indentation width of the pretty printer options.
setImportQualification :: Options -> Options   
Sets the qualification method to be used to print identifiers to "import qualification" (which is the default).
setNoQualification :: Options -> Options   
Sets the qualification method to be used to print identifiers to "unqualified".
setFullQualification :: Options -> Options   
Sets the qualification method to be used to print identifiers to "fully qualified".
setOnDemandQualification :: [CurryProg] -> Options -> Options   
Sets the qualification method to be used to print identifiers to "qualification on demand".
setModName :: String -> Options -> Options   
Sets the name of the current module in the pretty printer options.
setLayoutChoice :: LayoutChoice -> Options -> Options   
Sets the preferred layout in the pretty printer options.
setRelatedMods :: [CurryProg] -> Options -> Options   
Sets the related modules in the pretty printer options.
tlPrec :: Int   
precedence of top level (pattern or application) context -- lowest
infAppPrec :: Int   
precedence of infix (pattern or application) context
prefAppPrec :: Int   
precedence of standard prefix (pattern or application) context
highestPrec :: Int   
precedence of atoms (variables, literals, tuples, lists ...)
showCProg :: CurryProg -> String   
Shows a pretty formatted version of an abstract Curry Program.
showDProg :: FM ((Int,Int),(Int,Int)) [BoxLabel] -> CurryProg -> String   
prettyCurryProg :: Options -> CurryProg -> String   
Pretty-print the document generated by ppCurryProg, using the page width specified by given options.
ppCurryProg :: Options -> CurryProg -> Doc   
Pretty-print a CurryProg (the representation of a program, written in Curry, using AbstractCurry) according to given options.
ppMName :: String -> Doc   
Pretty-print a module name (just a string).
ppExports :: Options -> [CTypeDecl] -> [CFuncDecl] -> Doc   
Pretty-print exports, i.e.
ppConsExports :: Options -> [CConsDecl] -> Doc   
ppImports :: Options -> [String] -> Doc   
Pretty-print imports (list of module names) by prepending the word "import" to the module name.
ppCOpDecl :: Options -> COpDecl -> Doc   
Pretty-print operator precedence declarations.
ppCFixity :: CFixity -> Doc   
Pretty-print the fixity of a function.
ppCTypeDecl :: Options -> CTypeDecl -> Doc   
Pretty-print type declarations, like `data ...
ppCConsDecls :: Options -> [CConsDecl] -> Doc   
Pretty-print a list of constructor declarations, including the = sign.
ppCConsDecl :: Options -> CConsDecl -> Doc   
Pretty-print a constructor declaration.
ppCFieldDecl :: Options -> CFieldDecl -> Doc   
Pretty-print a record field declaration (field :: type).
ppCFuncDecl :: Options -> CFuncDecl -> Doc   
Pretty-print a function declaration.
ppCFuncDeclWithoutSig :: Options -> CFuncDecl -> Doc   
Pretty-print a function declaration without signature.
ppCFuncSignature :: Options -> (((Int,Int),(Int,Int)),String,String) -> CTypeExpr -> Doc   
Pretty-print a function signature according to given options.
ppCTypeExpr :: Options -> CTypeExpr -> Doc   
Pretty-print a type expression.
ppCTypeExpr' :: Int -> Options -> CTypeExpr -> Doc   
ppCTVarINames :: Options -> [(((Int,Int),(Int,Int)),Int,String)] -> Doc   
Pretty-print a list of type variables horizontally separating them by space.
ppCTVarIName :: Options -> (((Int,Int),(Int,Int)),Int,String) -> Doc   
Pretty-print a type variable (currently the Int is ignored).
ppCRules :: Options -> (((Int,Int),(Int,Int)),String,String) -> [CRule] -> Doc   
Pretty-print a list of function rules, concatenated vertically.
ppCRule :: Options -> (((Int,Int),(Int,Int)),String,String) -> CRule -> Doc   
Pretty-print a rule of a function.
ppCPattern :: Options -> CPattern -> Doc   
Pretty-print a pattern expression.
ppCPattern' :: Int -> Options -> CPattern -> Doc   
ppCVarIName :: Options -> (((Int,Int),(Int,Int)),Int,String) -> Doc   
Pretty-print a pattern variable (currently the Int is ignored).
ppCLiteral :: Options -> CLiteral -> Doc   
Pretty-print given literal (Int, Float, ...).
ppCFieldPattern :: Options -> ((((Int,Int),(Int,Int)),String,String),CPattern) -> Doc   
Pretty-print a record pattern
ppCRhs :: Doc -> Options -> CRhs -> Doc   
Pretty-print the right hand side of a rule (or case expression), including the d sign, where d is the relation (as doc) between the left hand side and the right hand side -- usually this is one of =, ->.
ppFuncRhs :: Options -> CRhs -> Doc   
Like ppCRhs, but do not pretty-print local declarations.
ppCaseRhs :: Options -> CRhs -> Doc   
ppCGuardedRhs :: Options -> Doc -> [(((Int,Int),(Int,Int)),CExpr,CExpr)] -> Doc   
Pretty-print guard, i.e.
ppCLocalDecls :: Options -> Doc -> [CLocalDecl] -> Doc   
Pretty-print local declarations .
ppCLocalDecl :: Options -> CLocalDecl -> Doc   
Pretty-print local declarations (the part that follows the where keyword).
ppWhereDecl :: Options -> [CLocalDecl] -> Doc   
Pretty-print a where block, in which the word where stands alone in a single line, above the following declarations.
ppLetDecl :: Options -> [CLocalDecl] -> Doc   
Pretty-print a let block without in.
ppCExpr :: Options -> CExpr -> Doc   
Pretty-print an expression.
colorExp :: Options -> ((Int,Int),(Int,Int)) -> Doc -> Doc   
ppCExpr' :: Int -> Options -> CExpr -> Doc   
ppCStatement :: Options -> CStatement -> Doc   
ppCCaseType :: CCaseType -> Doc   
Pretty-print case, fcase keywords.
ppCases :: Options -> [(CPattern,CRhs)] -> Doc   
Pretty-print a list of case expressions, i.e.
ppCase :: Options -> (CPattern,CRhs) -> Doc   
Pretty-print a case expression.
ppRecordFields :: Options -> [((((Int,Int),(Int,Int)),String,String),CExpr)] -> Doc   
Pretty-print record field assignments like this: { lab1 = exp1, ..., labn expn } if it fits the page, or { lab1 = exp1 , ...
ppRecordField :: Options -> ((((Int,Int),(Int,Int)),String,String),CExpr) -> Doc   
Pretty-print a record field assignment (fieldLabel = exp).
genericPPQName :: [(((Int,Int),(Int,Int)),String,String)] -> [(((Int,Int),(Int,Int)),Int,String)] -> ((((Int,Int),(Int,Int)),String,String) -> Doc -> Doc) -> Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   
Pretty-print a QName qualified according to given options.
genericPPName :: ((((Int,Int),(Int,Int)),String,String) -> Doc -> Doc) -> (((Int,Int),(Int,Int)),String,String) -> Doc   
ppQFunc :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   
Pretty-print a function name or constructor name qualified according to given options.
ppQFuncParsIfInfix :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   
Like ppQFunc, but surround name with parentheses if it is an infix identifier.
ppFunc :: (((Int,Int),(Int,Int)),String,String) -> Doc   
Pretty-print a function name or constructor name non-qualified.
ppQType :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   
Pretty-print a type (QName) qualified according to given options.
ppQTypeParsIfInfix :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   
Like ppQType, but surround name with parentheses if it is an infix identifier.
ppType :: (((Int,Int),(Int,Int)),String,String) -> Doc   
Pretty-print a type (QName) non-qualified.
isInfixId :: (((Int,Int),(Int,Int)),String,String) -> Bool   
Check whether an operator is an infix identifier.
isUnitCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   
Check whether an identifier represents the unit constructor
isListCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   
Check whether an identifier represents the empty list constructor
isConsCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   
Check whether an identifier represents the list constructor :
isTupleCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   
Check whether an identifier represents a tuple constructor
extractITE :: CExpr -> Maybe (CExpr,CExpr,CExpr)   
Check if given application tree represents an if then else construct.
extractInfix :: CExpr -> Maybe ((((Int,Int),(Int,Int)),String,String),CExpr,CExpr)   
Check if given application tree represents an infix operator application.
extractTuple :: CExpr -> Maybe [CExpr]   
Check if given application tree represents a tuple contructor application.
extractFiniteListExp :: CExpr -> Maybe [CExpr]   
Check if given application tree represents a finite list [x1, ..., xn].
extractFiniteListPattern :: CPattern -> Maybe [CPattern]   
Check if given construct pattern represents a finite list [x1, ..., xn].
hsepMap :: (a -> Doc) -> [a] -> Doc   
vcatMap :: (a -> Doc) -> [a] -> Doc   
vsepMap :: (a -> Doc) -> [a] -> Doc   
vsepBlankMap :: (a -> Doc) -> [a] -> Doc   
vvsep :: [Doc] -> Doc   
vvsepMap :: (a -> Doc) -> [a] -> Doc   
fillSepMap :: (a -> Doc) -> [a] -> Doc   
encloseSepSpaced :: Doc -> Doc -> Doc -> [Doc] -> Doc   
alignedList :: [Doc] -> Doc   
filledList :: [Doc] -> Doc   
alignedSetSpaced :: [Doc] -> Doc   
alignedTupled :: [Doc] -> Doc   
filledTupled :: [Doc] -> Doc   
filledTupledSpaced :: [Doc] -> Doc   
nest' :: Options -> Doc -> Doc   
indent' :: Options -> Doc -> Doc   
bquotesIf :: Bool -> Doc -> Doc   
parsIfInfix :: (((Int,Int),(Int,Int)),String,String) -> Doc -> Doc   
larrow :: Doc   
where_ :: Doc   
nil :: Doc   
on' :: (a -> a -> b) -> (c -> a) -> (c -> a) -> c -> b   
emptyCol :: [a]   
appendCol :: [a] -> [a] -> [a]   
anyCol :: (a -> Bool) -> [a] -> Bool   
fromList :: [a] -> [a]   
addVarsToOpts :: [(((Int,Int),(Int,Int)),Int,String)] -> Options -> Options   
addFuncNamesToOpts :: [(((Int,Int),(Int,Int)),String,String)] -> Options -> Options   
addVarsAndFuncNamesToOpts :: [(((Int,Int),(Int,Int)),Int,String)] -> [(((Int,Int),(Int,Int)),String,String)] -> Options -> Options   
optsWithIncreasingNamespaces :: (a -> [(((Int,Int),(Int,Int)),Int,String)]) -> (a -> [(((Int,Int),(Int,Int)),String,String)]) -> [a] -> Options -> [Options]   
Generates a list of options with increasing numbers of visible variables and function names.
varsOfLDecl :: CLocalDecl -> [(((Int,Int),(Int,Int)),Int,String)]   
In contrast to AbstractCurry.Select.varsOfLDecl, this function does not include variables of right hand sides.
varsOfFDecl :: CFuncDecl -> [(((Int,Int),(Int,Int)),Int,String)]   
In contrast to AbstractCurry.Select.varsOfFDecl, this function does not include variables of right hand sides.
varsOfStat :: CStatement -> [(((Int,Int),(Int,Int)),Int,String)]   
In contrast to AbstractCurry.Select.varsOfStat, this function does not include variables of right hand sides.
third :: (a,b,c) -> c   
second :: (a,b,c) -> b   

Exported datatypes:


Collection

Type synonym: Collection a = [a]


Qualification

Constructors:

  • Full :: Qualification
  • Imports :: Qualification
  • OnDemand :: Qualification
  • None :: Qualification

LayoutChoice

The choice for a generally preferred layout.

Constructors:

  • PreferNestedLayout :: LayoutChoice : prefer a layout where the arguments of long expressions are vertically aligned
  • PreferFilledLayout :: LayoutChoice : prefer a layout where the arguments of long expressions are filled as long as possible into one line

Options

Constructors:


Exported operations:

defaultOptions :: Options   

The default options to pretty print a module. These are:

  • page width: 78 characters
  • indentation width: 2 characters
  • qualification method: qualify all imported names (except prelude names)
  • layout choice: prefer nested layout (see LayoutChoice)

These options can be changed by corresponding setters (setPageWith, setIndentWith, set...Qualification, setLayoutChoice).

Note: If these default options are used for pretty-print operations other than prettyCurryProg or ppCurryProg, then one has to set the current module name explicitly by setModName!

setEvExp :: FM ((Int,Int),(Int,Int)) [BoxLabel] -> Options -> Options   

Sets the page width of the pretty printer options.

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

setPageWith :: Int -> Options -> Options   

Sets the page width of the pretty printer options.

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

setIndentWith :: Int -> Options -> Options   

Sets the indentation width of the pretty printer options.

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

setImportQualification :: Options -> Options   

Sets the qualification method to be used to print identifiers to "import qualification" (which is the default). In this case, all identifiers imported from other modules (except for the identifiers of the prelude) are fully qualified.

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

setNoQualification :: Options -> Options   

Sets the qualification method to be used to print identifiers to "unqualified". In this case, no identifiers is printed with its module qualifier. This might lead to name conflicts or unintended references if some identifiers in the pretty-printed module are in conflict with imported identifiers.

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

setFullQualification :: Options -> Options   

Sets the qualification method to be used to print identifiers to "fully qualified". In this case, every identifiers, including those of the processed module and the prelude, are fully qualified.

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

setOnDemandQualification :: [CurryProg] -> Options -> Options   

Sets the qualification method to be used to print identifiers to "qualification on demand". In this case, an identifier is qualified only if it is necessary to avoid a name conflict, e.g., if a local identifier has the same names as an imported identifier. Since it is necessary to know the names of all identifiers defined in the current module (to be pretty printed) and imported from other modules, the first argument is the list of modules consisting of the current module and all imported modules (including the prelude). The current module must always be the head of this list.

setModName :: String -> Options -> Options   

Sets the name of the current module in the pretty printer options.

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

setLayoutChoice :: LayoutChoice -> Options -> Options   

Sets the preferred layout in the pretty printer options.

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

setRelatedMods :: [CurryProg] -> Options -> Options   

Sets the related modules in the pretty printer options. See options to read a specification of "related modules".

tlPrec :: Int   

precedence of top level (pattern or application) context -- lowest

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

infAppPrec :: Int   

precedence of infix (pattern or application) context

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

prefAppPrec :: Int   

precedence of standard prefix (pattern or application) context

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

highestPrec :: Int   

precedence of atoms (variables, literals, tuples, lists ...)

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

showCProg :: CurryProg -> String   

Shows a pretty formatted version of an abstract Curry Program. The options for pretty-printing are the defaultOptions (and therefore the restrictions mentioned there apply here too).

Example call:
(showCProg prog)
Parameters:
  • prog : a curry prog
Returns:
a string, which represents the input program prog

showDProg :: FM ((Int,Int),(Int,Int)) [BoxLabel] -> CurryProg -> String   

prettyCurryProg :: Options -> CurryProg -> String   

Pretty-print the document generated by ppCurryProg, using the page width specified by given options.

ppCurryProg :: Options -> CurryProg -> Doc   

Pretty-print a CurryProg (the representation of a program, written in Curry, using AbstractCurry) according to given options. This function will overwrite the module name given by options with the name specified as the first component of CurryProg. The list of imported modules is extended to all modules mentioned in the program if qualified pretty printing is used. This is necessary to avoid errors w.r.t. names re-exported by modules.

ppMName :: String -> Doc   

Pretty-print a module name (just a string).

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

ppExports :: Options -> [CTypeDecl] -> [CFuncDecl] -> Doc   

Pretty-print exports, i.e. all type and function declarations which are public. extract the type and function declarations which are public and gather their qualified names in a list.

ppConsExports :: Options -> [CConsDecl] -> Doc   

ppImports :: Options -> [String] -> Doc   

Pretty-print imports (list of module names) by prepending the word "import" to the module name. If the qualification mode is Imports or Full, then the imports are declared as qualified.

ppCOpDecl :: Options -> COpDecl -> Doc   

Pretty-print operator precedence declarations.

ppCFixity :: CFixity -> Doc   

Pretty-print the fixity of a function.

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

ppCTypeDecl :: Options -> CTypeDecl -> Doc   

Pretty-print type declarations, like data ... = ..., type ... = ... or newtype ... = ....

ppCConsDecls :: Options -> [CConsDecl] -> Doc   

Pretty-print a list of constructor declarations, including the = sign.

ppCConsDecl :: Options -> CConsDecl -> Doc   

Pretty-print a constructor declaration.

ppCFieldDecl :: Options -> CFieldDecl -> Doc   

Pretty-print a record field declaration (field :: type).

ppCFuncDecl :: Options -> CFuncDecl -> Doc   

Pretty-print a function declaration.

ppCFuncDeclWithoutSig :: Options -> CFuncDecl -> Doc   

Pretty-print a function declaration without signature.

ppCFuncSignature :: Options -> (((Int,Int),(Int,Int)),String,String) -> CTypeExpr -> Doc   

Pretty-print a function signature according to given options.

ppCTypeExpr :: Options -> CTypeExpr -> Doc   

Pretty-print a type expression.

ppCTypeExpr' :: Int -> Options -> CTypeExpr -> Doc   

ppCTVarINames :: Options -> [(((Int,Int),(Int,Int)),Int,String)] -> Doc   

Pretty-print a list of type variables horizontally separating them by space.

ppCTVarIName :: Options -> (((Int,Int),(Int,Int)),Int,String) -> Doc   

Pretty-print a type variable (currently the Int is ignored).

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

ppCRules :: Options -> (((Int,Int),(Int,Int)),String,String) -> [CRule] -> Doc   

Pretty-print a list of function rules, concatenated vertically.

ppCRule :: Options -> (((Int,Int),(Int,Int)),String,String) -> CRule -> Doc   

Pretty-print a rule of a function. Given a function f x y = x * y, then x y = x * y is a rule consisting of x y as list of patterns and x * y as right hand side.

ppCPattern :: Options -> CPattern -> Doc   

Pretty-print a pattern expression.

ppCPattern' :: Int -> Options -> CPattern -> Doc   

ppCVarIName :: Options -> (((Int,Int),(Int,Int)),Int,String) -> Doc   

Pretty-print a pattern variable (currently the Int is ignored).

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

ppCLiteral :: Options -> CLiteral -> Doc   

Pretty-print given literal (Int, Float, ...).

ppCFieldPattern :: Options -> ((((Int,Int),(Int,Int)),String,String),CPattern) -> Doc   

Pretty-print a record pattern

ppCRhs :: Doc -> Options -> CRhs -> Doc   

Pretty-print the right hand side of a rule (or case expression), including the d sign, where d is the relation (as doc) between the left hand side and the right hand side -- usually this is one of =, ->. If the right hand side contains local declarations, they will be pretty printed too, further indented.

ppFuncRhs :: Options -> CRhs -> Doc   

Like ppCRhs, but do not pretty-print local declarations. Instead give caller the choice how to handle the declarations. For example the function ppCRule uses this to prevent local declarations from being further indented.

ppCaseRhs :: Options -> CRhs -> Doc   

ppCGuardedRhs :: Options -> Doc -> [(((Int,Int),(Int,Int)),CExpr,CExpr)] -> Doc   

Pretty-print guard, i.e. the | cond d exp part of a right hand side, where d is the relation (as doc) between cond and exp -- usually this is one of =, ->.

ppCLocalDecls :: Options -> Doc -> [CLocalDecl] -> Doc   

Pretty-print local declarations . If the second argument is text "where", pretty-print a where block. If the second argument is text "let", pretty-print a let block without in.

ppCLocalDecl :: Options -> CLocalDecl -> Doc   

Pretty-print local declarations (the part that follows the where keyword).

ppWhereDecl :: Options -> [CLocalDecl] -> Doc   

Pretty-print a where block, in which the word where stands alone in a single line, above the following declarations.

ppLetDecl :: Options -> [CLocalDecl] -> Doc   

Pretty-print a let block without in. In contrast to ppWhereDecl, the word let is in the same line as the first local declaration.

ppCExpr :: Options -> CExpr -> Doc   

Pretty-print an expression.

colorExp :: Options -> ((Int,Int),(Int,Int)) -> Doc -> Doc   

ppCExpr' :: Int -> Options -> CExpr -> Doc   

ppCCaseType :: CCaseType -> Doc   

Pretty-print case, fcase keywords.

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

ppCases :: Options -> [(CPattern,CRhs)] -> Doc   

Pretty-print a list of case expressions, i.e. the p1 -> e1,...,pn -> en, transitions, vertically aligned.

ppCase :: Options -> (CPattern,CRhs) -> Doc   

Pretty-print a case expression.

ppRecordFields :: Options -> [((((Int,Int),(Int,Int)),String,String),CExpr)] -> Doc   

Pretty-print record field assignments like this: { lab1 = exp1, ..., labn expn } if it fits the page, or { lab1 = exp1 , ... , labn = expn } otherwise.

ppRecordField :: Options -> ((((Int,Int),(Int,Int)),String,String),CExpr) -> Doc   

Pretty-print a record field assignment (fieldLabel = exp).

genericPPQName :: [(((Int,Int),(Int,Int)),String,String)] -> [(((Int,Int),(Int,Int)),Int,String)] -> ((((Int,Int),(Int,Int)),String,String) -> Doc -> Doc) -> Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   

Pretty-print a QName qualified according to given options.

Example call:
(genericPPQName visNames visVars g opts qn)
Parameters:
  • visNames : Depending on call, this is the namespace of visible types or of visible functions. Used to determine if qn is ambiguous, in case the qualification method OnDemand was chosen
  • visVars : The in current context visible variables.
  • g : A doc tranformer used to manipulate (f.e. surround with parentheses) the QName, after it was (maybe) qualified.
  • opts : The options to use.
  • qn : The QName to pretty-print.
Returns:
A pretty-printed QName, maybe qualified (depending on settings).

genericPPName :: ((((Int,Int),(Int,Int)),String,String) -> Doc -> Doc) -> (((Int,Int),(Int,Int)),String,String) -> Doc   

ppQFunc :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   

Pretty-print a function name or constructor name qualified according to given options. Use ppQType or ppType for pretty-printing type names.

ppQFuncParsIfInfix :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   

Like ppQFunc, but surround name with parentheses if it is an infix identifier.

ppFunc :: (((Int,Int),(Int,Int)),String,String) -> Doc   

Pretty-print a function name or constructor name non-qualified. Use ppQType or ppType for pretty-printing type names.

ppQType :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   

Pretty-print a type (QName) qualified according to given options.

ppQTypeParsIfInfix :: Options -> (((Int,Int),(Int,Int)),String,String) -> Doc   

Like ppQType, but surround name with parentheses if it is an infix identifier.

ppType :: (((Int,Int),(Int,Int)),String,String) -> Doc   

Pretty-print a type (QName) non-qualified.

isInfixId :: (((Int,Int),(Int,Int)),String,String) -> Bool   

Check whether an operator is an infix identifier.

isUnitCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   

Check whether an identifier represents the unit constructor

isListCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   

Check whether an identifier represents the empty list constructor

isConsCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   

Check whether an identifier represents the list constructor :

isTupleCons :: (((Int,Int),(Int,Int)),String,String) -> Bool   

Check whether an identifier represents a tuple constructor

extractITE :: CExpr -> Maybe (CExpr,CExpr,CExpr)   

Check if given application tree represents an if then else construct. If so, return the condition, the "then expression" and the "else expression". Otherwise, return Nothing.

extractInfix :: CExpr -> Maybe ((((Int,Int),(Int,Int)),String,String),CExpr,CExpr)   

Check if given application tree represents an infix operator application. If so, return the operator, its left and its right argument. Otherwise, return Nothing.

extractTuple :: CExpr -> Maybe [CExpr]   

Check if given application tree represents a tuple contructor application. If so, return the constructor and its arguments in a list. Otherwise, return Nothing.

extractFiniteListExp :: CExpr -> Maybe [CExpr]   

Check if given application tree represents a finite list [x1, ..., xn]. If so, return the list elements in a list. Otherwise, return Nothing.

extractFiniteListPattern :: CPattern -> Maybe [CPattern]   

Check if given construct pattern represents a finite list [x1, ..., xn]. If so, return the list elements in a list. Otherwise, return Nothing.

hsepMap :: (a -> Doc) -> [a] -> Doc   

vcatMap :: (a -> Doc) -> [a] -> Doc   

vsepMap :: (a -> Doc) -> [a] -> Doc   

vsepBlankMap :: (a -> Doc) -> [a] -> Doc   

vvsep :: [Doc] -> Doc   

vvsepMap :: (a -> Doc) -> [a] -> Doc   

fillSepMap :: (a -> Doc) -> [a] -> Doc   

encloseSepSpaced :: Doc -> Doc -> Doc -> [Doc] -> Doc   

alignedList :: [Doc] -> Doc   

filledList :: [Doc] -> Doc   

alignedSetSpaced :: [Doc] -> Doc   

alignedTupled :: [Doc] -> Doc   

filledTupled :: [Doc] -> Doc   

filledTupledSpaced :: [Doc] -> Doc   

nest' :: Options -> Doc -> Doc   

indent' :: Options -> Doc -> Doc   

bquotesIf :: Bool -> Doc -> Doc   

parsIfInfix :: (((Int,Int),(Int,Int)),String,String) -> Doc -> Doc   

larrow :: Doc   

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

where_ :: Doc   

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

nil :: Doc   

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

on' :: (a -> a -> b) -> (c -> a) -> (c -> a) -> c -> b   

emptyCol :: [a]   

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

appendCol :: [a] -> [a] -> [a]   

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

anyCol :: (a -> Bool) -> [a] -> Bool   

fromList :: [a] -> [a]   

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

addVarsToOpts :: [(((Int,Int),(Int,Int)),Int,String)] -> Options -> Options   

addFuncNamesToOpts :: [(((Int,Int),(Int,Int)),String,String)] -> Options -> Options   

addVarsAndFuncNamesToOpts :: [(((Int,Int),(Int,Int)),Int,String)] -> [(((Int,Int),(Int,Int)),String,String)] -> Options -> Options   

optsWithIncreasingNamespaces :: (a -> [(((Int,Int),(Int,Int)),Int,String)]) -> (a -> [(((Int,Int),(Int,Int)),String,String)]) -> [a] -> Options -> [Options]   

Generates a list of options with increasing numbers of visible variables and function names. Resulting lists are useful to match the scopes of do expressions and list comprehensions, where latter statements see previous variables and functions names, but prior elements do not see subsequent variables and function names. Note that last $ optsWithIncreasingNamespaces varsOf funcNamesOf xs opts are options which contain all variables and function names of xs.

Example call:
(optsWithIncreasingNamespaces varsOf funcNamesOf opts)
Parameters:
  • varsOf : a projection function
  • funcNamesOf : a projection function
  • opts : root options
Returns:
a list [opts0, opts1, opts2, ...], where opts == opts0, opts1 == opts0 plus vars and funcNames of x1, opts2 == opts1 plus vars and funcNames of x2, ...

varsOfLDecl :: CLocalDecl -> [(((Int,Int),(Int,Int)),Int,String)]   

In contrast to AbstractCurry.Select.varsOfLDecl, this function does not include variables of right hand sides.

varsOfFDecl :: CFuncDecl -> [(((Int,Int),(Int,Int)),Int,String)]   

In contrast to AbstractCurry.Select.varsOfFDecl, this function does not include variables of right hand sides.

varsOfStat :: CStatement -> [(((Int,Int),(Int,Int)),Int,String)]   

In contrast to AbstractCurry.Select.varsOfStat, this function does not include variables of right hand sides.

third :: (a,b,c) -> c   

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

second :: (a,b,c) -> b   

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