| |||||||||||||||
| |||||||||||||||
| |||||||||||||||
Description | |||||||||||||||
RECOMMENDATION: Use Data.Generics.Uniplate.Typeable instead. This module supplies a method for writing Biplate instances more easily. To take an example: data Expr = Var Int | Neg Expr | Add Expr Expr instance Typeable Expr where ... instance (Typeable a, Uniplate a) => PlateAll Expr a where plateAll (Var x ) = plate Var |- x plateAll (Neg x ) = plate Neg |+ x plateAll (Add x y) = plate Add |+ x |+ y instance Uniplate Expr where uniplate = uniplateAll | |||||||||||||||
Synopsis | |||||||||||||||
| |||||||||||||||
Documentation | |||||||||||||||
module Data.Generics.Biplate | |||||||||||||||
module Data.Typeable | |||||||||||||||
The Class | |||||||||||||||
class PlateAll from to where | |||||||||||||||
uniplateAll :: PlateAll a b => a -> (Str b, Str b -> a) | |||||||||||||||
This function is used to write a Uniplate instance from a PlateAll one | |||||||||||||||
The Combinators | |||||||||||||||
plate :: from -> Type from to | |||||||||||||||
The main combinator used to start the chain. The following rule can be used for optimisation: plate Ctor |- x == plate (Ctor x) | |||||||||||||||
(|+) :: (Typeable item, Typeable to, PlateAll item to) => Type (item -> from) to -> item -> Type from to | |||||||||||||||
the field to the right may contain the target. | |||||||||||||||
(|-) :: Type (item -> from) to -> item -> Type from to | |||||||||||||||
The field to the right does not contain the target. This can be used as either an optimisation, or more commonly for excluding primitives such as Int. | |||||||||||||||
Produced by Haddock version 2.6.0 |