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. If you are working with abstract data types, such as
containers package, you may also need to use the data types defined
For faster performance (5x faster, but requires writing instances) switch to
Data.Generics.Uniplate.Direct. If you get instance conflicts
when using both
Direct, switch to Data.Generics.Uniplate.DataOnly.
The instances are faster than GHC because they precompute a table of useful information, then use this information when performing the traversals. Sometimes it is not possible to compute the table, in which case this library will perform about the same speed as SYB.
Setting the environment variable
$UNIPLATE_VERBOSE has the following effects:
-1- raise a program error every time construction of the table fails
0(or unset) - never print any messages or raise any errors
1- give a message every time a table is computed
2- give a message when table computation fails
$UNIPLATE_VERBOSE environment variable must be set before the first call to uniplate.
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.