Skip to content

Error message doesn't mention necessary extension in warning

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.

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information