Ticket #7039 (closed bug: duplicate)

Opened 11 months ago

Last modified 10 months ago

Panic due 'instance Foo a => Bar a => Baz a' style declarations

Reported by: ksf Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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:

1. tuple-style context

2. 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

3.

foo :: Show a => Num a => a
foo = undefined

Change History

Changed 11 months ago by guest

seems to be a duplicate of #5951

Changed 10 months ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to duplicate

Yes it is a dup, and indeed fixed:

T7039.hs:5:10: Malformed instance: Show a => Num a => Foo a
Note: See TracTickets for help on using tickets.