HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleuniplate-1.6.13Haskell2010

Data.Generics.PlateDirect

Deprecated. Use Data.Generics.Uniplate.Direct instead

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
  • 7 values
  • Packageuniplate-1.6.13
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePlateDirect.hs

The Combinators

7 declarations
valueplate :: 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)
valueplateSelf :: to -> Type to to
#

Used for PlayAll definitions where both types are the same.

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

The field to the right may contain the target.

value(|-) :: Type (item -> from) to -> item -> Type from to
#

The field to the right does not contain the target.

value(|*) :: Type (to -> from) to -> to -> Type from to
#

The field to the right is the target.

value(||+)
  1. :: Biplate item to
  2. => Type ([item] -> from) to
  3. -> [item]
  4. -> Type from to
#

The field to the right is a list of types which may contain the target

value(||*) :: Type ([to] -> from) to -> [to] -> Type from to
#

The field to the right is a list of the type of the target