Module FlatCurry.Typed.Goodies

Some goodies to deal with type-annotated FlatCurry programs.

Author: Michael Hanus

Version: May 2021

Summary of exported operations:

unionTAProg :: AProg TypeExpr -> AProg TypeExpr -> AProg TypeExpr  Deterministic 
Returns the union of two typed FlatCurry programs.
funcsOfFuncDecl :: AFuncDecl TypeExpr -> [(String,String)]  Deterministic 
Returns the names of all functions/constructors occurring in the body of a function declaration.
funcsOfExpr :: AExpr TypeExpr -> [(String,String)]  Deterministic 
Returns the names of all occurrences (with duplicates) of functions/constructors in an expression.
ppTAExpr :: AExpr TypeExpr -> String  Deterministic 
Pretty prints an expression.
setAnnPattern :: TypeExpr -> APattern TypeExpr -> APattern TypeExpr  Deterministic 
Sets the top annotation of a pattern.
etaExpandFuncDecl :: AFuncDecl TypeExpr -> AFuncDecl TypeExpr  Deterministic 
Eta-expansion of user-defined function declarations.
applyExp :: AExpr TypeExpr -> [AExpr TypeExpr] -> AExpr TypeExpr  Deterministic 
Apply arguments to a given FlatCurry expression by transforming this expression whenever possible.
dropArgTypes :: Int -> TypeExpr -> TypeExpr  Deterministic 
Remove the given number of argument types from a (nested) functional type.
isBaseType :: TypeExpr -> Bool  Deterministic 
Is the type expression a base type?
matchType :: TypeExpr -> TypeExpr -> Maybe (Map Int TypeExpr)  Deterministic 
Compute type matching, i.e., if matchType t1 t2 = s, then t2 = s(t1).
matchTypes :: [TypeExpr] -> [TypeExpr] -> Maybe (Map Int TypeExpr)  Deterministic 
typesOfFunc :: AFuncDecl TypeExpr -> [TypeExpr]  Deterministic 
Get all types occurring in function declaration.
typesOfExp :: AExpr TypeExpr -> [TypeExpr]  Deterministic 
Get all types occurring in an expression.
pre :: String -> (String,String)  Deterministic 
Transform name into Prelude-qualified name.

Exported operations:

unionTAProg :: AProg TypeExpr -> AProg TypeExpr -> AProg TypeExpr  Deterministic 

Returns the union of two typed FlatCurry programs.

funcsOfFuncDecl :: AFuncDecl TypeExpr -> [(String,String)]  Deterministic 

Returns the names of all functions/constructors occurring in the body of a function declaration.

funcsOfExpr :: AExpr TypeExpr -> [(String,String)]  Deterministic 

Returns the names of all occurrences (with duplicates) of functions/constructors in an expression.

ppTAExpr :: AExpr TypeExpr -> String  Deterministic 

Pretty prints an expression.

setAnnPattern :: TypeExpr -> APattern TypeExpr -> APattern TypeExpr  Deterministic 

Sets the top annotation of a pattern.

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

etaExpandFuncDecl :: AFuncDecl TypeExpr -> AFuncDecl TypeExpr  Deterministic 

Eta-expansion of user-defined function declarations.

applyExp :: AExpr TypeExpr -> [AExpr TypeExpr] -> AExpr TypeExpr  Deterministic 

Apply arguments to a given FlatCurry expression by transforming this expression whenever possible.

dropArgTypes :: Int -> TypeExpr -> TypeExpr  Deterministic 

Remove the given number of argument types from a (nested) functional type.

isBaseType :: TypeExpr -> Bool  Deterministic 

Is the type expression a base type?

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

matchType :: TypeExpr -> TypeExpr -> Maybe (Map Int TypeExpr)  Deterministic 

Compute type matching, i.e., if matchType t1 t2 = s, then t2 = s(t1).

matchTypes :: [TypeExpr] -> [TypeExpr] -> Maybe (Map Int TypeExpr)  Deterministic 

typesOfFunc :: AFuncDecl TypeExpr -> [TypeExpr]  Deterministic 

Get all types occurring in function declaration.

typesOfExp :: AExpr TypeExpr -> [TypeExpr]  Deterministic 

Get all types occurring in an expression.

pre :: String -> (String,String)  Deterministic 

Transform name into Prelude-qualified name.

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