Deriving in associated data families ignores instance's constraints
This code
class Class a where
data DF a
data family DF' a
instance (Eq (DF' a)) => Class a where
newtype DF a = DF (DF' a) deriving (Eq)
fails with
No instance for (Eq (DF' a))
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (Eq (DF' a))
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Eq (DF a))
The following way it compiles fine, however
class Class a where
data DF a
data family DF' a
instance Class a where
newtype DF a = DF (DF' a)
deriving instance (Eq (DF' a)) => Eq (DF a)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |
Edited by mojojojo