Overly specific instances may not be resolved
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
class A x
class A x => B x
class A x => C x
instance B x => C x
produces
BrokenSuper.hs:8:10: error:
• Could not deduce (A x)
arising from the superclasses of an instance declaration
from the context: B x
bound by the instance declaration at BrokenSuper.hs:8:10-19
Possible fix: add (A x) to the context of the instance declaration
• In the instance declaration for ‘C x’
|
8 | instance B x => C x
This was noticed in this SO question and reduced by Daniel Wagner.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire |
| Operating system | |
| Architecture |