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

GHC trac at galois.com
Wed Nov 25 15:43:42 EST 2009


#3691: Error message doesn't mention necessary extension in warning
---------------------------------+------------------------------------------
    Reporter:  arsenm            |       Owner:                                   
        Type:  bug               |      Status:  new                              
    Priority:  normal            |   Component:  Compiler                         
     Version:  6.10.4            |    Keywords:                                   
          Os:  Unknown/Multiple  |    Testcase:                                   
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at compile-time
---------------------------------+------------------------------------------
 In this example(Taken from
 [http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap]) with the
 exception of removing -fglasgow-exts), GHC gives the wrong error message
 and fails to mention the missing necessary extension (which turns out to
 be ScopedTypeVariables).

 If you take the example, and remove -fglasgow-exts and try to only use the
 minimum required language extensions,

 {{{
 {-# LANGUAGE EmptyDataDecls,
              MultiParamTypeClasses,
              FunctionalDependencies,
              OverlappingInstances,
              FlexibleInstances,
              UndecidableInstances #-}
 }}}

 GHC fails with the error

 {{{
 wiki.hs:30:12:
     Could not deduce (Print' flag a)
       from the context (Print a, ShowPred a flag1, Print' flag1 a)
       arising from a use of `print'' at wiki.hs:30:12-35
     Possible fix:
       add (Print' flag a) to the context of the instance declaration
     In the expression: print' (undefined :: flag)
     In the definition of `print': print = print' (undefined :: flag)
     In the instance declaration for `Print a'
 Failed, modules loaded: none.

 }}}

 However, it compiles fine if ScopedTypeVariables is added to the list of
 extensions.

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


More information about the Glasgow-haskell-bugs mailing list