[GHC] #7039: Panic due 'instance Foo a => Bar a => Baz a' style declarations

GHC cvs-ghc at haskell.org
Sun Jul 1 16:00:45 CEST 2012


#7039: Panic due 'instance Foo a => Bar a => Baz a' style declarations
--------------------------------+-------------------------------------------
 Reporter:  ksf                 |          Owner:                  
     Type:  bug                 |         Status:  new             
 Priority:  normal              |      Component:  Compiler        
  Version:  7.4.2               |       Keywords:                  
       Os:  Unknown/Multiple    |   Architecture:  Unknown/Multiple
  Failure:  Compile-time crash  |       Testcase:                  
Blockedby:                      |       Blocking:                  
  Related:                      |  
--------------------------------+-------------------------------------------
 {{{
 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
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7039>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list