Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Rewriting
Description
Functions for type and term rewriting
Synopsis
- elementsWithDependencies :: [Element] -> Flow Graph [Element]
- expandTypedLambdas :: Term -> Term
- flattenLetTerms :: Term -> Term
- freeVariablesInScheme :: TypeScheme -> Set Name
- inlineType :: Map Name Type -> Type -> Flow s Type
- isFreeIn :: Name -> Term -> Bool
- removeTermAnnotations :: Term -> Term
- removeTypeAnnotations :: Type -> Type
- replaceFreeName :: Name -> Type -> Type -> Type
- rewrite :: ((x -> y) -> x -> y) -> ((x -> y) -> x -> y) -> x -> y
- rewriteTerm :: ((Term -> Term) -> Term -> Term) -> (Map String Term -> Map String Term) -> Term -> Term
- rewriteTermM :: ((Term -> Flow s Term) -> Term -> Flow s Term) -> (Map String Term -> Flow s (Map String Term)) -> Term -> Flow s Term
- rewriteTermMeta :: (Map String Term -> Map String Term) -> Term -> Term
- rewriteTermMetaM :: (Map String Term -> Flow s (Map String Term)) -> Term -> Flow s Term
- rewriteType :: ((Type -> Type) -> Type -> Type) -> (Map String Term -> Map String Term) -> Type -> Type
- rewriteTypeM :: ((Type -> Flow s Type) -> Type -> Flow s Type) -> (Map String Term -> Flow s (Map String Term)) -> Type -> Flow s Type
- rewriteTypeMeta :: (Map String Term -> Map String Term) -> Type -> Type
- simplifyTerm :: Term -> Term
- stripTermRecursive :: Term -> Term
- substituteVariable :: Name -> Name -> Term -> Term
- substituteVariables :: Map Name Name -> Term -> Term
- termDependencyNames :: Bool -> Bool -> Bool -> Term -> Set Name
- topologicalSortElements :: [Element] -> Either [[Name]] [Name]
- typeDependencyNames :: Type -> Set Name
- wrapLambdas :: Term -> Flow Graph Term
Documentation
expandTypedLambdas :: Term -> Term Source #
Recursively transform arbitrary terms like 'add 42' into terms like 'x.add 42 x', whose arity (in the absence of application terms) is equal to the depth of nested lambdas. This is useful for targets like Java with weaker support for currying.
flattenLetTerms :: Term -> Term Source #
inlineType :: Map Name Type -> Type -> Flow s Type Source #
Inline all type variables in a type using the provided schema. Note: this function is only appropriate for nonrecursive type definitions.
removeTermAnnotations :: Term -> Term Source #
Recursively remove term annotations, including within subterms
removeTypeAnnotations :: Type -> Type Source #
Recursively remove type annotations, including within subtypes
rewriteTerm :: ((Term -> Term) -> Term -> Term) -> (Map String Term -> Map String Term) -> Term -> Term Source #
rewriteTermM :: ((Term -> Flow s Term) -> Term -> Flow s Term) -> (Map String Term -> Flow s (Map String Term)) -> Term -> Flow s Term Source #
rewriteType :: ((Type -> Type) -> Type -> Type) -> (Map String Term -> Map String Term) -> Type -> Type Source #
rewriteTypeM :: ((Type -> Flow s Type) -> Type -> Flow s Type) -> (Map String Term -> Flow s (Map String Term)) -> Type -> Flow s Type Source #
simplifyTerm :: Term -> Term Source #
stripTermRecursive :: Term -> Term Source #