Safe Haskell | Safe-Infered |
---|

*DEPRECATED*: Use Data.Generics.Uniplate.Direct instead.

This module supplies a method for writing `Biplate`

instances more easily.
This module requires fewest extensions, highest performance, and most instance
definitions.

To take an example:

data Expr = Var Int | Pos Expr String | Neg Expr | Add Expr Expr data Stmt = Seq [Stmt] | Sel [Expr] | Let String Expr instance Uniplate Expr where uniplate (Var x ) = plate Var |- x uniplate (Pos x y) = plate Pos |* x |- y uniplate (Neg x ) = plate Neg |* x uniplate (Add x y) = plate Add |* x |* y instance Biplate Expr Expr where biplate = plateSelf instance Uniplate Stmt where uniplate (Seq x ) = plate Seq ||* x uniplate (Sel x ) = plate Sel ||+ x uniplate (Let x y) = plate Let |- x |- y instance Biplate Stmt Stmt where biplate = plateSelf instance Biplate Stmt Expr where biplate (Seq x ) = plate Seq ||+ x biplate (Sel x ) = plate Sel ||* x biplate (Let x y) = plate Let |- x |* y

- module Data.Generics.Biplate
- plate :: from -> Type from to
- plateSelf :: to -> Type to to
- (|+) :: Biplate item to => Type (item -> from) to -> item -> Type from to
- (|-) :: Type (item -> from) to -> item -> Type from to
- (|*) :: Type (to -> from) to -> to -> Type from to
- (||+) :: Biplate item to => Type ([item] -> from) to -> [item] -> Type from to
- (||*) :: Type ([to] -> from) to -> [to] -> Type from to

# Documentation

module Data.Generics.Biplate

# The Combinators

plate :: from -> Type from toSource

The main combinator used to start the chain.

The following rule can be used for optimisation:

plate Ctor |- x == plate (Ctor x)

(|+) :: Biplate item to => Type (item -> from) to -> item -> Type from toSource

The field to the right may contain the target.

(|-) :: Type (item -> from) to -> item -> Type from toSource

The field to the right *does not* contain the target.