#1614: Type checker does not use fundep to avoid ambiguity
--------------------------------------+-------------------------------------
  Reporter:  guest                    |          Owner:         
      Type:  bug                      |         Status:  new    
  Priority:  normal                   |      Milestone:         
 Component:  Compiler (Type checker)  |        Version:  6.7    
  Severity:  normal                   |       Keywords:         
Difficulty:  Unknown                  |             Os:  MacOS X
  Testcase:                           |   Architecture:  x86    
--------------------------------------+-------------------------------------
Compiling the following module gives an error
 {{{
 module X where

 class C a | -> a
 instance C Int

 unC :: (C a) => a -> Int
 unC i = undefined

 test :: Int
 test = unC undefined
 }}}
 Error message:
 {{{
 X.hs:13:7:
     Ambiguous type variable `a' in the constraint:
       `C a' arising from a use of `unC' at X.hs:13:7-19
     Probable fix: add a type signature that fixes these type variable(s)
 }}}

 But that is just plain wrong.  The functional dependency in the definition
 of C forces a to be Int.  No other type is possible.  So what's ambiguous
 about that?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1614>
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