[GHC] #3691: Error message doesn't mention necessary extension in warning

GHC trac at galois.com
Thu Nov 26 10:05:07 EST 2009


#3691: Error message doesn't mention necessary extension in warning
------------------------------------------------+---------------------------
  Reporter:  arsenm                             |          Owner:                  
      Type:  bug                                |         Status:  closed          
  Priority:  normal                             |      Milestone:                  
 Component:  Compiler                           |        Version:  6.10.4          
Resolution:  invalid                            |       Keywords:                  
Difficulty:                                     |             Os:  Unknown/Multiple
  Testcase:                                     |   Architecture:  Unknown/Multiple
   Failure:  Incorrect warning at compile-time  |  
------------------------------------------------+---------------------------
Changes (by simonpj):

  * status:  new => closed
  * difficulty:  =>
  * resolution:  => invalid

Comment:

 The error message looks right to me.  GHC can't deduce `(Print' flag a)`
 from `(Print' flag1 a)`.  You may ask why it doesn't choose `flag1` to be
 equal to `flag`.  It doesn't because it's too hard for the type inference
 engine to do.  The declaration
 {{{
 instance (ShowPred a flag, Print' flag a) => Print a where
     print = print' (undefined::flag)
 }}}
 tries to do so, by using "`flag`" in both places, but under Haskell 98
 rules the type signature on `undefined` means `undefined :: forall flag.
 flag`, and that is not what you want.

 So the language extensions you supplied are not "the minimum required";
 you need `ScopedTypeVariables`.

 I've modified the HaskellWiki page to use LANGUAGE pragmas.

 Simon

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


More information about the Glasgow-haskell-bugs mailing list