Module FlatCurry.Typed.Goodies

Some goodies to deal with type-annotated FlatCurry programs.

Author: Michael Hanus

Version: April 2019

Summary of exported operations:

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

Exported operations:

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

Returns the union of two typed FlatCurry programs.

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

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

ndExpr :: AExpr TypeExpr -> Bool   

Returns True if the expression is non-deterministic, i.e., if Or or Free occurs in the expression.

ppTAExpr :: AExpr TypeExpr -> String   

Pretty prints an expression.

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

Sets the top annotation of a pattern.

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

etaExpandFuncDecl :: AFuncDecl TypeExpr -> AFuncDecl TypeExpr   

Eta-expansion of user-defined function declarations.

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

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

dropArgTypes :: Int -> TypeExpr -> TypeExpr   

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

isBaseType :: TypeExpr -> Bool   

Is the type expression a base type?

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

matchType :: TypeExpr -> TypeExpr -> Maybe (FM Int TypeExpr)   

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

matchTypes :: [TypeExpr] -> [TypeExpr] -> Maybe (FM Int TypeExpr)   

pre :: String -> (String,String)   

Transform name into Prelude-qualified name.

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