Module FlatCurry.TypeAnnotated.TypeSubst

Author
Bjoern Peemoeller
Version
December 2020

Type substitutions on type-annotated AnnotatedFlatCurry

Exported Datatypes


type AFCSubst = Map TVarIndex TypeExpr

The (abstract) data type for substitutions on TypeExpr.


Exported Functions


showAFCSubst :: Map Int TypeExpr -> String  Deterministic 


emptyAFCSubst :: Map Int TypeExpr  Deterministic 

The empty substitution

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

lookupAFCSubst :: Map Int TypeExpr -> Int -> Maybe TypeExpr  Deterministic 

Searches the substitution for a mapping from the given variable index to a term.

:: AFCSubst  the substitution to search
-> TVarIndex  the index to search for
-> Maybe TypeExpr  the found type expression or Nothing

substFunc :: Map Int TypeExpr -> AFuncDecl TypeExpr -> AFuncDecl TypeExpr  Deterministic 

Applies a substitution to a function.

:: AFCSubst  the substitution
-> AFuncDecl TypeExpr  the function
-> AFuncDecl TypeExpr  the function with the substitution applied

substRule :: Map Int TypeExpr -> ARule TypeExpr -> ARule TypeExpr  Deterministic 

Applies a substitution to a type expression.

:: AFCSubst  the substitution
-> ARule TypeExpr  the rule
-> ARule TypeExpr  the rule with the substitution applied

substExpr :: Map Int TypeExpr -> AExpr TypeExpr -> AExpr TypeExpr  Deterministic 

Applies a substitution to a type expression.

:: AFCSubst  the substitution
-> AExpr TypeExpr  the expression
-> AExpr TypeExpr  the expression with the substitution applied

substSnd :: Map Int TypeExpr -> (a, TypeExpr) -> (a, TypeExpr)  Deterministic 


substBranch :: Map Int TypeExpr -> ABranchExpr TypeExpr -> ABranchExpr TypeExpr  Deterministic 

Applies a substitution to a branch expression.

:: AFCSubst  the substitution
-> ABranchExpr TypeExpr  the branch
-> ABranchExpr TypeExpr  the branch with the substitution applied

substPattern :: Map Int TypeExpr -> APattern TypeExpr -> APattern TypeExpr  Deterministic 

Applies a substitution to a pattern.

:: AFCSubst  the substitution
-> APattern TypeExpr  the pattern
-> APattern TypeExpr  the pattern with the substitution applied

subst :: Map Int TypeExpr -> TypeExpr -> TypeExpr  Deterministic 

Looks up a type in a substitution and converts the resulting Term to a TypeExpr. Returns a given default value if the lookup fails.

:: AFCSubst  the type to look up
-> TypeExpr  the default value
-> TypeExpr  the substitution to search in either the looked-up and converted type or the default type