Safe Haskell | None |
---|
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