Safe Haskell | None |
---|---|
Language | Haskell2010 |
For the generated instances you'll typically need the following extensions:
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, ConstraintKinds, UndecidableInstances #-}
- deriveGTraversable :: Name -> Q [Dec]
- gtraverseExpr :: Name -> Q Exp
Documentation
deriveGTraversable :: Name -> Q [Dec] Source
Example usage:
data MyType = MyType deriveGTraversable ''MyType
It tries to create the necessary instance constraints, but is not very
smart about it For tricky types, it may fail or produce an
overconstrained instance. In that case, write the instance declaration
yourself and use gtraverseExpr
to derive the implementation:
data MyType a = MyType instance GTraversable (MyType a) where gtraverse = $(gtraverseExpr ''MyType)