Some goodies to deal with type-annotated FlatCurry programs.
Author: Michael Hanus
Version: August 2019
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. |
funcsOfExpr
:: AExpr TypeExpr -> [(String,String)]
Returns the names of all occurrences (with duplicates) of functions/constructors in an 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)
|
typesOfFunc
:: AFuncDecl TypeExpr -> [TypeExpr]
Get all types occurring in function declaration. |
typesOfExp
:: AExpr TypeExpr -> [TypeExpr]
Get all types occurring in an expression. |
pre
:: String -> (String,String)
Transform name into Prelude-qualified name. |
Returns the union of two typed FlatCurry programs. |
Returns the names of all functions/constructors occurring in the body of a function declaration. |
Returns the names of all occurrences (with duplicates) of functions/constructors in an expression. |
Sets the top annotation of a pattern.
|
Eta-expansion of user-defined function declarations. |
Apply arguments to a given FlatCurry expression by transforming this expression whenever possible. |
Remove the given number of argument types from a (nested) functional type. |
Is the type expression a base type?
|
Compute type matching, i.e., if |
|
Get all types occurring in function declaration. |
Get all types occurring in an expression. |
Transform name into Prelude-qualified name.
|