classyplate-0.2.0.0: Fuseable type-class based generics

Safe HaskellNone
LanguageHaskell2010

Data.Generics.ClassyPlate.Common

Description

Wrappers and common functionality for classyplates

Synopsis

Documentation

class MonoMatch a b where Source #

A class for the simple case when the applied function is monomorphic.

Minimal complete definition

monoApp

Methods

monoApp :: (a -> a) -> b -> b Source #

Apply a monomorphic function on a polymorphic data structure.

Instances

MonoMatch a a Source # 

Methods

monoApp :: (a -> a) -> a -> a Source #

type AppSelector (MonoMatch a) b Source # 
type AppSelector (MonoMatch a) b = TypEq a b

type family TypEq a b :: Bool where ... Source #

Equations

TypEq a a = True 
TypEq a b = False 

descend :: forall c b. ClassyPlate c b => (forall a. (ClassyPlate c a, c a) => a -> a) -> b -> b Source #

Go down one level in the data structure and apply the given polymorphic function

descendM :: forall c b m. (ClassyPlate c b, Monad m) => (forall a. (ClassyPlate c a, c a) => a -> m a) -> b -> m b Source #

topDown :: forall c b. ClassyPlate c b => (forall a. (ClassyPlate c a, c a) => a -> a) -> b -> b Source #

Traverse the data structure in a top-down fashion with a polymorphic function.

topDownM :: forall c b m. (ClassyPlate c b, Monad m) => (forall a. (ClassyPlate c a, c a) => a -> m a) -> b -> m b Source #

bottomUp :: forall c b. ClassyPlate c b => (forall a. (ClassyPlate c a, c a) => a -> a) -> b -> b Source #

Traverse the data structure with a polymorphic function.

bottomUpM :: forall c b m. (ClassyPlate c b, Monad m) => (forall a. (ClassyPlate c a, c a) => a -> m a) -> b -> m b Source #

Traverse the data structure with a polymorphic monadic function.

selectiveTraverse :: forall c b. ClassyPlate c b => (forall a. (ClassyPlate c a, c a) => a -> (a, Bool)) -> b -> b Source #

Traverse the data structure selectively with a function specifying if need to go down on the subtrees.

selectiveTraverseM :: forall c b m. (Monad m, ClassyPlate c b) => (forall a. (ClassyPlate c a, c a) => a -> m (a, Bool)) -> b -> m b Source #

Traverse the data structure selectively with a monadic function specifying if need to go down on the subtrees.

smartTraverse :: forall c b. SmartClassyPlate c (ClassIgnoresSubtree c b) b => (forall a. (ClassyPlate c a, c a) => a -> a) -> b -> b Source #

Traverse only those parts of the data structure that could possibly contain elements that the given function can be applied on

smartTraverseM :: forall c b m. (SmartClassyPlate c (ClassIgnoresSubtree c b) b, Monad m) => (forall a. (ClassyPlate c a, c a) => a -> m a) -> b -> m b Source #

Traverse only those parts of the data structure that could possibly contain elements that the given monadic function can be applied on