Skip to content

GHC does not inform me about -Wdeprecated-flags

If I say

{-# LANGUAGE DatatypeContexts #-}

module Bug where

I get

Bug.hs:1:14: warning:
    -XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
  |
1 | {-# LANGUAGE DatatypeContexts #-}
  |              ^^^^^^^^^^^^^^^^

I had assumed for some time that this was an unsuppressable warning. A bit annoying to have an unsuppressable warning, but nothing I felt compelled to take action about.

But this was wrong.

If instead I say

{-# LANGUAGE DatatypeContexts #-}
{-# OPTIONS_GHC -Wno-deprecated-flags #-}

module Bug where

I get no warning. This is because the deprecation warning is actually controlled by -Wdeprecated-flags (on by default), but GHC unhelpfully does not tell me this when printing the warning.

Happily, there is a fix: !5207 (57a98976), originally part of !5207 (closed), but I believe will be committed separately, in the end.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information