Malformed data type quotation accepted
This is accepted:
Prelude Language.Haskell.TH> $(stringE . show =<< [d| data A where C :: C |])
"[DataD [] A_1627402878 [] [ForallC [] [] (NormalC C_1627402879 [])] []]"
In contrast this is rejected:
Prelude Language.Haskell.TH> $(stringE . show =<< [d| data A p where C :: C |])
<interactive>:29:22: Malformed constructor result type: C
However it would make sense to form an equality constraint (for later kind/type checking) in these cases, something along the lines of:
data A p where
C :: (A p ~ C) => C
as there could be type synonym (or family) C
.
I have tested various versions >= 7.8.3 and all seem to behave the same.