For example:
let context = sequence [classP (mkName "Eq") [varT (mkName "a")]]
in
[d| instance $(context) => Bar (Foo a) where
quux _ = undefined
|]
The result that I want is instance Eq a => Bar (Foo a) where quux _ = undefined
, however, Template Haskell complains, rightly, that context
has the type Q Cxt
instead of the expected Q Type
.
Is there a way to specify the constraints of the instance declaration without having to use the constructor InstanceD
directly?