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.

- subterms :: forall f. Foldable f => Term f -> [Term f]
- subterms' :: forall f g. (Foldable f, g :<: f) => Term f -> [g (Term f)]
- transform :: Functor f => (Term f -> Term f) -> Term f -> Term f
- transform' :: Functor f => (Term f -> Maybe (Term f)) -> Term f -> Term f
- transformM :: (Traversable f, Monad m) => (Term f -> m (Term f)) -> Term f -> m (Term f)
- query :: Foldable f => (Term f -> r) -> (r -> r -> r) -> Term f -> r
- gsize :: Foldable f => Term f -> Int
- size :: Foldable f => Cxt h f a -> Int
- height :: Foldable f => Cxt h f a -> Int

# Documentation

subterms :: forall f. Foldable f => Term f -> [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. (Foldable f, g :<: f) => Term f -> [g (Term f)]Source

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

transform :: Functor 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 :: (Traversable f, Monad m) => (Term f -> m (Term f)) -> Term f -> m (Term f)Source

Monadic version of `transform`

.