[GHC] #7131: FlexibleInstances / UndecidableInstances confusion

GHC cvs-ghc at haskell.org
Thu Aug 9 18:10:29 CEST 2012


#7131: FlexibleInstances / UndecidableInstances confusion
------------------------------+---------------------------------------------
 Reporter:  goldfire          |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.5               |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 Consider the following code:

 {{{
 class Foo a

 bar :: Foo a => Int
 bar = 0
 }}}

 Compiling this code with no extensions correctly reports an error that
 {{{bar}}} is inherently ambiguous.

 However, if I enable {{{-XUndecidableInstances}}}, the ambiguity error
 disappears, though I still cannot declare {{{instance Foo a}}}. On the
 other hand, if I enable {{{-XFlexibleInstances}}}, the ambiguity error
 remains, even though I can now declare {{{instance Foo a}}}.

 I believe that the problem is due to confusion in the note {{{[The
 ambiguity check for type signatures]}}} in {{{typecheck/TcMType.lhs}}}.
 That note refers to {{{UndecidableInstances}}} where I believe it means
 {{{FlexibleInstances}}}. The code immediately below (line 1378, in
 function {{{checkAmbiguity}}}) also uses {{{UndecidableInstances}}} where
 it would seem to want {{{FlexibleInstances}}}.

 I would fix this myself, but I don't feel confident enough in this wing of
 GHC to know this is the right change!

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



More information about the Glasgow-haskell-bugs mailing list