Support for deriving Generic1 for data families
The following code:
import GHC.Generics
data family F typ :: * -> *
data A
data instance F A a = AData a deriving Generic1
produces an error when run with ghc 7.8.2 or 7.8.3:
Couldn't match type ‘Rep1 (F A)’
with ‘M1 t0 t1 (M1 t2 t3 (M1 t4 t5 Par1))’
The type variables ‘t0’, ‘t1’, ‘t2’, ‘t3’, ‘t4’, ‘t5’ are ambiguous
Expected type: Rep1 (F A) a
Actual type: M1 t0 t1 (M1 t2 t3 (M1 t4 t5 Par1)) a
In the pattern: M1 (M1 (M1 g1))
In an equation for ‘to1’: to1 (M1 (M1 (M1 g1))) = AData (unPar1 g1)
In the instance declaration for ‘Generic1 (F A)’
whereas ghc 7.6.3 simply refuses to go ahead with the message:
generic1.hs:14:40:
Derived instance `Generic1 (F A)'
requires illegal partial application of data type family F
In the data instance declaration for `F'
Either a check has gone missing in 7.8.x, or a bug has crept up in the Generic1 support. I have gone through past tickets and #5936 (closed) suggests that it is the latter.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |