#6002: GHC 7.4+ thinks class instance is incoherent, 7.0.4 disagrees
---------------------------------------+------------------------------------
 Reporter:  heisenbug                  |          Owner:                  
     Type:  bug                        |         Status:  new             
 Priority:  normal                     |      Component:  Compiler        
  Version:  7.4.1                      |       Keywords:                  
       Os:  Unknown/Multiple           |   Architecture:  Unknown/Multiple
  Failure:  GHC rejects valid program  |       Testcase:                  
Blockedby:                             |       Blocking:                  
  Related:                             |  
---------------------------------------+------------------------------------
 Load this file into GHCi:

 http://omega.googlecode.com/svn/mosaic/TypeMachinery.lhs?r=1086

 With v7.4 (and HEAD) I get:

 {{{
 GHCi, version 7.5.20120410: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling TypeMachinery    ( TypeMachinery.lhs, interpreted )

 TypeMachinery.lhs:78:23:
     Overlapping instances for Show (Nat' (Plus n n1))
       arising from a use of `Hide'
     Matching instances:
       instance Show (Nat' a) -- Defined at TypeMachinery.lhs:24:3
     There exists a (perhaps superclass) match:
       from the context (Show (Nat' n))
         bound by a pattern with constructor
                    Hide :: forall (a :: * -> *) n. Show (a n) => a n ->
 Hidden a,
                  in an equation for `+'
         at TypeMachinery.lhs:78:5-10
       or from (Show (Nat' n1))
         bound by a pattern with constructor
                    Hide :: forall (a :: * -> *) n. Show (a n) => a n ->
 Hidden a,
                  in an equation for `+'
         at TypeMachinery.lhs:78:14-19
     (The choice depends on the instantiation of `n, n1'
      To pick the first instance above, use -XIncoherentInstances
      when compiling the other instance declarations)
     In the expression: Hide
     In the expression: Hide $ plus a b
     In an equation for `+': (Hide a) + (Hide b) = Hide $ plus a b
 Failed, modules loaded: none.
 }}}

 With 7.0.4 all compiles (and runs) correctly.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to