#2854: Extended defaulting rules not used for super classes
-----------------------------+----------------------------------------------
Reporter:  guest             |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  6.10.1            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 Consider the following module
 {{{
 {-# LANGUAGE ExtendedDefaultRules #-}
 module Bug4 where

 class (Num a) => C a where
     f :: a -> a

 instance C Integer where
     f = (+1)

 x = show (f 5)
 }}}
 The type of x is
 {{{
 x :: (C a) => String
 }}}
 and since a is ambiguous the defaulting rules should be used.  Since Num
 is a superclass of C the type variable should be defaulted to Integer.
 But instead we get an error.

 Removing the Num superclass of C makes it work, since the type of x is
 {{{
 x ::: (Num a, C a) => String
 }}}
 and the defaulting kicks in as expected.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2854>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to