Panic due 'instance Foo a => Bar a => Baz a' style declarations
class Foo a
instance Show a => Num a => Foo a where
foo = undefined
results in
ghc: panic! (the 'impossible' happened)
(GHC version 7.4.2 for x86_64-unknown-linux):
compiler/rename/RnSource.lhs:430:14-81: Irrefutable pattern failed for pattern Data.Maybe.Just (inst_tyvars,
_,
SrcLoc.L _ cls,
_)
It doesn't matter whether foo is declared in the class definition or not.
Things that work:
-
tuple-style context
-
not defining foo in the instance: Not crashing, but complaining about a malformed head, which might or might not be the right thing to do, considering
foo :: Show a => Num a => a
foo = undefined
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |