Skip to content

Report unrecognized pragmas earlier

In the following example, I have a typo in the UndecidableInstances pragma (LANGUAGE is misspelled), however, GHC only reports that UndecidableInstances is required. This is very confusing, since it appears that I have enabled that pragma.

{-# LANGUAGE FlexibleContexts     #-}
{-# LANGUAGE FlexibleInstances    #-}
{-# LANUGAGE UndecidableInstances #-}

instance (Num [a]) => Num a

Only when I comment out the instance does GHC report that there is an unrecognized pragma, at which point it became obvious that there was a typo. It would be very helpful if GHC reported the warning about the unrecognized pragma before or at the same time as the error about needing UndecidableInstances.

Trac metadata
Trac field Value
Version 8.0.2
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