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

Safe HaskellNone
LanguageHaskell98

Data.Generics.PlateTypeable

Contents

Description

Deprecated: Use Data.Generics.Uniplate.Typeable instead

DEPRECATED: 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

The Class

class PlateAll from to where #

This class represents going from the container type to the target.

This class should only be constructed with plate, |+ and |-

Minimal complete definition

plateAll

Methods

plateAll :: from -> Type from to #

Instances

PlateAll Bool to # 

Methods

plateAll :: Bool -> Type Bool to #

PlateAll Char to # 

Methods

plateAll :: Char -> Type Char to #

PlateAll Double to # 

Methods

plateAll :: Double -> Type Double to #

PlateAll Float to # 

Methods

plateAll :: Float -> Type Float to #

PlateAll Int to # 

Methods

plateAll :: Int -> Type Int to #

PlateAll Integer to # 

Methods

plateAll :: Integer -> Type Integer to #

PlateAll () to # 

Methods

plateAll :: () -> Type () to #

(PlateAll from to, Typeable * from, Typeable * to, Uniplate to) => PlateAll [from] to # 

Methods

plateAll :: [from] -> Type [from] to #

(PlateAll from to, Typeable * from, Typeable * to, Uniplate to) => PlateAll (Maybe from) to # 

Methods

plateAll :: Maybe from -> Type (Maybe from) to #

(PlateAll a to, Typeable * a, PlateAll b to, Typeable * b, Typeable * to, Uniplate to) => PlateAll (Either a b) to # 

Methods

plateAll :: Either a b -> Type (Either a b) to #

(PlateAll a to, Typeable * a, PlateAll b to, Typeable * b, Typeable * to, Uniplate to) => PlateAll (a, b) to # 

Methods

plateAll :: (a, b) -> Type (a, b) to #

(PlateAll a to, Typeable * a, PlateAll b to, Typeable * b, PlateAll c to, Typeable * c, Typeable * to, Uniplate to) => PlateAll (a, b, c) to # 

Methods

plateAll :: (a, b, c) -> Type (a, b, c) to #

(PlateAll a to, Typeable * a, PlateAll b to, Typeable * b, PlateAll c to, Typeable * c, PlateAll d to, Typeable * d, Typeable * to, Uniplate to) => PlateAll (a, b, c, d) to # 

Methods

plateAll :: (a, b, c, d) -> Type (a, b, c, d) to #

(PlateAll a to, Typeable * a, PlateAll b to, Typeable * b, PlateAll c to, Typeable * c, PlateAll d to, Typeable * d, PlateAll e to, Typeable * e, Typeable * to, Uniplate to) => PlateAll (a, b, c, d, e) to # 

Methods

plateAll :: (a, b, c, d, e) -> Type (a, b, c, d, e) to #

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.

Orphan instances