hydra-0.1.1: Type-aware transformations for data and programs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hydra.Rewriting

Description

Functions for type and term rewriting

Synopsis

Documentation

expandLambdas :: Ord m => Term m -> GraphFlow m (Term m) Source #

Turn arbitrary terms like 'compareTo 42' into terms like 'x.compareTo 42 x', whose arity (in the absences of application terms) is equal to the depth of nested lambdas. This function leaves application terms intact, simply rewriting their left and right subterms.

foldOverTerm :: TraversalOrder -> (a -> Term m -> a) -> a -> Term m -> a Source #

foldOverType :: TraversalOrder -> (a -> Type m -> a) -> a -> Type m -> a Source #

removeTermAnnotations :: Ord m => Term m -> Term m Source #

Recursively remove term annotations, including within subterms

removeTypeAnnotations :: Ord m => Type m -> Type m Source #

Recursively remove type annotations, including within subtypes

rewrite :: ((a -> b) -> a -> b) -> ((a -> b) -> a -> b) -> a -> b Source #

rewriteTerm :: Ord b => ((Term a -> Term b) -> Term a -> Term b) -> (a -> b) -> Term a -> Term b Source #

rewriteTermM :: Ord b => ((Term a -> Flow s (Term b)) -> Term a -> Flow s (Term b)) -> (a -> Flow s b) -> Term a -> Flow s (Term b) Source #

rewriteTermMeta :: Ord b => (a -> b) -> Term a -> Term b Source #

rewriteType :: ((Type a -> Type b) -> Type a -> Type b) -> (a -> b) -> Type a -> Type b Source #

rewriteTypeMeta :: (a -> b) -> Type a -> Type b Source #

simplifyTerm :: Ord m => Term m -> Term m Source #

subterms :: Term m -> [Term m] Source #

subtypes :: Type m -> [Type m] Source #