Deriving Data for existentially quantified types
I cannot derive Data for:
data EqBox where
EB :: forall e . (Data e, Eq e) => e -> EqBox
I am getting such error:
Ambiguous type variable `e' in the constraints:
(Eq e) arising from a use of `EB' at Test.hs:11:1-28
(Data e) arising from a use of `k' at Test.hs:11:1-28
Probable fix: add a type signature that fixes these type variable(s)
In the first argument of `z', namely `EB'
In the first argument of `k', namely `z EB'
In the expression: k (z EB)
When typechecking the code for `gunfold'
in a standalone derived instance for `Data EqBox':
To see the code I am typechecking, use -ddump-deriv
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | mmitar@gmail.com |
| Operating system | |
| Architecture |