Copyright | (c) 2011 Patrick Bahr |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <[email protected]> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Data.Comp.Generic
Description
This module defines type generic functions and recursive schemes along the lines of the Uniplate library.
Synopsis
- getSubterm :: forall (g :: Type -> Type). (Functor g, Foldable g) => [Int] -> Term g -> Maybe (Term g)
- subterms :: forall (f :: Type -> Type). Foldable f => Term f -> [Term f]
- subterms' :: forall (f :: Type -> Type) g. (Foldable f, g :<: f) => Term f -> [g (Term f)]
- transform :: forall (f :: Type -> Type). Functor f => (Term f -> Term f) -> Term f -> Term f
- transform' :: forall (f :: Type -> Type). Functor f => (Term f -> Maybe (Term f)) -> Term f -> Term f
- transformM :: forall (f :: Type -> Type) m. (Traversable f, Monad m) => (Term f -> m (Term f)) -> Term f -> m (Term f)
- query :: forall (f :: Type -> Type) r. Foldable f => (Term f -> r) -> (r -> r -> r) -> Term f -> r
- gsize :: forall (f :: Type -> Type). Foldable f => Term f -> Int
- size :: forall (f :: Type -> Type) h a. Foldable f => Cxt h f a -> Int
- height :: forall (f :: Type -> Type) h a. Foldable f => Cxt h f a -> Int
Documentation
getSubterm :: forall (g :: Type -> Type). (Functor g, Foldable g) => [Int] -> Term g -> Maybe (Term g) Source #
This function returns the subterm of a given term at the position
specified by the given path or Nothing
if the input term has no
such subterm
subterms :: forall (f :: Type -> Type). 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 :: Type -> Type) 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 :: forall (f :: Type -> Type). Functor 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.
transform' :: forall (f :: Type -> Type). Functor f => (Term f -> Maybe (Term f)) -> Term f -> Term f Source #
transformM :: forall (f :: Type -> Type) m. (Traversable f, Monad m) => (Term f -> m (Term f)) -> Term f -> m (Term f) Source #
Monadic version of transform
.
query :: forall (f :: Type -> Type) r. Foldable f => (Term f -> r) -> (r -> r -> r) -> Term f -> r Source #