transformations-0.1.1.0: Generic representation of tree transformations

Safe HaskellNone

Generics.Regular.Transformations.TH

Synopsis

Documentation

deriveRefRep :: Name -> (Name -> Name) -> Q [Dec]Source

Derive data type with references and HasRef instance. For a data type N the name of the constructor for a reference is RefN, and the given function is used to change the rest of the constructors and the data type name itself. For example, for the following definition:

 data Tree = Leaf Int | Bin Tree Tree
 $(deriveRefRep ''Tree (postfix "R"))

The following data type is generated:

 data TreeR = LeafR Int | BinR TreeR TreeR | RefTree Path
 instance HasRef Tree