compdata-0.9: Compositional Data Types

Copyright (c) 2011 Patrick Bahr BSD3 Patrick Bahr experimental non-portable (GHC Extensions) None Haskell98

Data.Comp.Multi.Generic

Description

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.

Synopsis

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 f Source

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`.

query :: HFoldable f => (Term f :=> r) -> (r -> r -> r) -> Term f :=> r Source

subs :: HFoldable f => Term f :=> [E (Term f)] Source

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

size :: HFoldable f => Cxt h f a :=> Int Source

This function computes the generic size of the given term, i.e. the its number of subterm occurrences.

depth :: HFoldable f => Cxt h f a :=> Int Source

This function computes the generic depth of the given term.