| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Syntactic.TH
Contents
Synopsis
- conName :: Con -> (Name, Int)
- data Method
- deriveClass :: Cxt -> Name -> Type -> [Method] -> DecsQ
- deriveClassSimple :: Name -> Name -> [Method] -> DecsQ
- varSupply :: [Name]
- deriveSymbol :: Name -> DecsQ
- deriveEquality :: Name -> DecsQ
- deriveRender :: (String -> String) -> Name -> DecsQ
- instD :: Cxt -> Type -> [Dec] -> Dec
- viewDataDef :: Info -> Maybe [Con]
- eqPred :: Type -> Type -> Pred
- classPred :: Name -> (Name -> Type) -> [Type] -> Pred
- tySynInst :: Name -> [Type] -> Type -> Dec
Documentation
Description of class methods
Arguments
| :: Cxt | Instance context |
| -> Name | Type constructor name |
| -> Type | Class head (e.g. |
| -> [Method] | Methods |
| -> DecsQ |
General method for class deriving
General method for class deriving
Derive Equality instance for a type
equal Con1 Con1 = True equal (Con2 a1 ... x1) (Con2 a2 ... x2) = and [a1==a2, ... x1==x2] equal _ _ = False
hash Con1 = hashInt 0 hash (Con2 a ... x) = foldr1 combine [hashInt 1, hash a, ... hash x]
Derive Render instance for a type
renderSym Con1 = "Con1"
renderSym (Con2 a ... x) = concat ["(", unwords ["Con2", show a, ... show x], ")"]Portability
Construct an instance declaration
eqPred :: Type -> Type -> Pred Source #
Portable method for constructing a Pred of the form (t1 ~ t2)