Portability | non-portable |
---|---|

Stability | experimental |

Maintainer | generics@haskell.org |

Summary: Core machinery for rewriting terms.

- class (Regular a, Crush (PF a), GMap (PF a), Show (PF a), Zip (PF a), LR (PF a), Functor (PF a)) => Rewrite a
- applyRuleM :: (Builder r, Rewrite (Target r), Monad m) => r -> Target r -> m (Target r)
- applyRule :: (Builder r, Rewrite (Target r)) => r -> Target r -> Target r
- rewriteM :: (Rewrite a, Monad m) => Rule a -> a -> m a
- rewrite :: Rewrite a => Rule a -> a -> a

# Type class synonym summarizing generic functions.

class (Regular a, Crush (PF a), GMap (PF a), Show (PF a), Zip (PF a), LR (PF a), Functor (PF a)) => Rewrite a Source

The `Rewrite`

is a type class synonym, hiding some of the implementation
details.

To be able to use the rewriting functions, the user is required to provide an instance of this type class.

# Applying a rule specification to a term.

applyRuleM :: (Builder r, Rewrite (Target r), Monad m) => r -> Target r -> m (Target r)Source

Applies a rule specification to a term, obtaining a monadic value.

applyRule :: (Builder r, Rewrite (Target r)) => r -> Target r -> Target rSource

Applies a rule specification to a term, obtaining the original term when rewriting fails.