Portability | non-portable (GHC Extensions) |
---|---|

Stability | experimental |

Maintainer | Patrick Bahr <paba@diku.dk> |

Safe Haskell | Safe-Infered |

This module defines type generic functions and recursive schemes along the lines of the Uniplate library. All definitions are generalised versions of those in Data.Comp.Generic.

- subterms :: forall f. HFoldable f => Term f :=> [E (Term f)]
- subterms' :: forall f g. (HFoldable f, g :<: f) => Term f :=> [E (g (Term f))]
- transform :: forall f. HFunctor f => (Term f :-> Term f) -> Term f :-> Term f
- transformM :: forall f m. (HTraversable f, Monad m) => NatM m (Term f) (Term f) -> NatM m (Term f) (Term f)
- query :: HFoldable f => (Term f :=> r) -> (r -> r -> r) -> Term f :=> r
- subs :: HFoldable f => Term f :=> [E (Term f)]
- subs' :: (HFoldable f, g :<: f) => Term f :=> [E (g (Term f))]
- size :: HFoldable f => Cxt h f a :=> Int
- depth :: HFoldable f => Cxt h f a :=> Int

# Documentation

subterms :: forall f. HFoldable f => Term f :=> [E (Term f)]Source

This function returns a list of all subterms of the given
term. This function is similar to Uniplate's `universe`

function.

subterms' :: forall f g. (HFoldable f, g :<: f) => Term f :=> [E (g (Term f))]Source

This function returns a list of all subterms of the given term that are constructed from a particular functor.

transform :: forall f. HFunctor f => (Term f :-> Term f) -> Term f :-> Term fSource

This function transforms every subterm according to the given
function in a bottom-up manner. This function is similar to
Uniplate's `transform`

function.

transformM :: forall f m. (HTraversable f, Monad m) => NatM m (Term f) (Term f) -> NatM m (Term f) (Term f)Source

Monadic version of `transform`

.