multirec-alt-deriver-0.1: Alternative multirec instances deriverSource codeContentsIndex
Generics.MultiRec.TH.Alt
Description

Example usage:

import Generics.MultiRec
import Generics.MultiRec.TH.Alt
import Data.Tree

data TheFam :: (* -> *) where
              Tree_Int   :: TheFam   (Tree Int)
              Forest_Int :: TheFam (Forest Int)

$(deriveEverything
  (DerivOptions
   [ ( [t| Tree   Int |],   "Tree_Int" )
   , ( [t| Forest Int |], "Forest_Int" )
   ]
   "TheFam"
   (\t c -> "CONSTRUCTOR_" ++ t ++ "_" ++ c)
   "ThePF"
   True
  )
 )

type instance PF TheFam = ThePF
Documentation
data DerivOptions ft Source
Constructors
DerivOptions
familyTypes :: ft

A list of:

 (type quotation, name of corresponding constructor of the family GADT)

This defines our mutually recursive family. The types must resolve to datatypes or newtypes of kind * (type synonyms will be expanded).

indexGadtName :: StringName of the family GADT (this type has to be generated manually because TH doesn't support GADTs yet)
constructorNameModifier :: String -> String -> StringScheme for producing names for the empty types corresponding to constructors. The first arg is the name of the type (as given in familyTypes), the second arg is the name of the constructor (builtins will be called: NIL, CONS, TUPLE2, TUPLE3 ...)
patternFunctorName :: StringName of the pattern functor (PF) to generate
verbose :: BoolPrint various informational messges?
show/hide Instances
deriveEverything :: DerivOptions [(TypeQ, String)] -> Q [Dec]Source
Produced by Haddock version 2.4.2