Skip to content

Template Haskell support for reifying non-vanilla data constructors

Apart from not supporting GADT syntax, Template Haskell also doesn't currently have support for reifying non-vanilla data constructors given with the normal syntax, even though the API is fully capable of representing all of its features.

In the case where I try to reify a data declaration of the form,

data AnyShow = forall a. Show a => AnyShow a

(using !ExistentialQuantification)

I get the error: Can't reify a GADT data constructor: `!AnyShow',

Even though it can easily be represented:

DataD [] AnyShow [] [ForallC [PlainTV a] [ClassP Show [VarT a]] (NormalC AnyShow [(NotStrict,VarT a)])] []

I propose to add support for reifying non-vanilla data constructors given with the normal syntax.

(Of note is that everything that can be done using GADT syntax can also be done with the normal syntax, using !ExistentialQuantification and equality constraints from !TypeFamilies.)

Patch shortly.

Trac metadata
Trac field Value
Version
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information