Traversable package:traverse-with-class

All of the functions below work only on «interesting» subterms. It is up to the instance writer to decide which subterms are interesting and which subterms should count as immediate. This can also depend on the context c. The context, denoted c, is a constraint (of kind * -> Constraint) that provides additional facilities to work with the data. In most cases, the context cannot be inferred automatically. You need to provide it using the type application syntax:
gmap @Show f x
everywhere @Typeable f x
etc. For more information, see:
Special version of GTraversable for the representation types from Generic.
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)