compdata-0.3: Compositional Data Types

Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
MaintainerPatrick Bahr <paba@diku.dk>

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 :=> [A (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 :=> [A (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.

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

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

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

size :: HFoldable f => Cxt h f a :=> IntSource

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 :=> IntSource

This function computes the generic depth of the given term.