[GHC] #3696: Incorrect type inferred with -fwarn-missing-signatures and a type class

GHC trac at galois.com
Thu Nov 26 18:57:41 EST 2009


#3696: Incorrect type inferred with -fwarn-missing-signatures and a type class
---------------------------------+------------------------------------------
    Reporter:  spl               |       Owner:                                   
        Type:  bug               |      Status:  new                              
    Priority:  normal            |   Component:  Compiler (Type checker)          
     Version:  6.10.1            |    Keywords:                                   
          Os:  Unknown/Multiple  |    Testcase:                                   
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at compile-time
---------------------------------+------------------------------------------
 The inferred type using -fwarn-missing-signatures and a type class is too
 general for top-level values.

 Here is a simplified example:

 {{{
 {-# OPTIONS -Wall #-}

 class C a where c :: a

 instance C Int where c = 37

 def = c

 use :: Int
 use = def
 }}}

 The inferred type reported by GHCi when -fwarn-missing-signatures is
 enabled is:

 {{{
 Ex.hs:7:0:
     Warning: Definition but no type signature for `def'
              Inferred type: def :: a
 }}}

 The most general possible type here is {{{C a => a}}}. When asking GHCi
 for the type of {{{def}}}, it reports {{{Int}}}.

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


More information about the Glasgow-haskell-bugs mailing list