uniplate-1.6.1: Help writing simple, concise and fast generic operations.

Data.Generics.Uniplate.Data

Description

This module defines Uniplate / Biplate instances for every type with a Data instance. Using GHC, Data can be derived automatically with:

 data Expr = Var Int | Neg Expr | Add Expr Expr
             deriving (Data,Typeable)

All the Uniplate operations defined in Data.Generics.Uniplate.Operations can be used.

For faster performance (5x faster, but requires writing instances) switch to Data.Generics.Uniplate.Direct. If you get instance conflicts when using both Data and Direct, switch to Data.Generics.Uniplate.DataOnly.

Synopsis

Documentation

transformBis :: forall a. Data a => [[Transformer]] -> a -> aSource

Apply a sequence of transformations in order. This function obeys the equivalence:

 transformBis [[transformer f],[transformer g],...] == transformBi f . transformBi g . ...

Each item of type [Transformer] is applied in turn, right to left. Within each [Transformer], the individual Transformer values may be interleaved.

The implementation will attempt to perform fusion, and avoid walking any part of the data structure more than necessary. To further improve performance, you may wish to partially apply the first argument, which will calculate information about the relationship between the transformations.

transformer :: Data a => (a -> a) -> TransformerSource

Wrap up a (a -> a) transformation function, to use with transformBis