Module FlatCurry.Show

This library contains operations to transform FlatCurry programs into string representations, either in a FlatCurry format or in a Curry-like syntax.

This library contains

  • show functions for a string representation of FlatCurry programs (showFlatProg, showFlatType, showFlatFunc)
  • functions for showing FlatCurry (type) expressions in (almost) Curry syntax (showCurryType, showCurryExpr,...).

Author: Michael Hanus

Version: September 2024

Summary of exported operations:

showFlatProg :: Prog -> String  Deterministic 
Shows a FlatCurry program term as a string (with some pretty printing).
showFlatType :: TypeDecl -> String  Deterministic 
showFlatFunc :: FuncDecl -> String  Deterministic 
showCurryType :: ((String,String) -> String) -> Bool -> TypeExpr -> String  Deterministic 
Shows a FlatCurry type in Curry syntax.
isClassContext :: TypeExpr -> Maybe (String,[TypeExpr])  Deterministic 
Tests whether a FlatCurry type is a class context.
showCurryExpr :: ((String,String) -> String) -> Bool -> Int -> Expr -> String  Deterministic 
Shows a FlatCurry expressions in (almost) Curry syntax.
showCurryVar :: Show a => a -> String  Deterministic 
showCurryId :: String -> String  Deterministic 
Shows an identifier in Curry form.

Exported operations:

showFlatProg :: Prog -> String  Deterministic 

Shows a FlatCurry program term as a string (with some pretty printing).

showFlatType :: TypeDecl -> String  Deterministic 

showFlatFunc :: FuncDecl -> String  Deterministic 

showCurryType :: ((String,String) -> String) -> Bool -> TypeExpr -> String  Deterministic 

Shows a FlatCurry type in Curry syntax.

Example call:
(showCurryType trans nested texpr)
Parameters:
  • trans : a translation function from qualified type names to external type names
  • nested : True iff brackets must be written around complex types
  • texpr : the FlatCurry type expression to be formatted
Returns:
the String representation of the formatted type expression

isClassContext :: TypeExpr -> Maybe (String,[TypeExpr])  Deterministic 

Tests whether a FlatCurry type is a class context. If it is the case, return the class name and the type parameters of the class context.

showCurryExpr :: ((String,String) -> String) -> Bool -> Int -> Expr -> String  Deterministic 

Shows a FlatCurry expressions in (almost) Curry syntax.

Example call:
(showCurryExpr trans nested indent expr)
Parameters:
  • trans : a translation function from qualified functions names to external function names
  • nested : True iff brackets must be written around complex terms
  • indent : the indentation used in case expressions and if-then-else
  • expr : the FlatCurry expression to be formatted
Returns:
the String representation of the formatted expression
Further infos:
  • partially defined

showCurryVar :: Show a => a -> String  Deterministic 

showCurryId :: String -> String  Deterministic 

Shows an identifier in Curry form. Thus, operators are enclosed in brackets.

Further infos:
  • partially defined