Skip to content

More consistent deprecation of extensions

The excellent work by @Jade on !12322 (closed) exposed some potential improvements to how deprecated extensions are managed (see in particular !12322 (diffs, comment 558389)).

  1. -XNoOverlappingInstances results in a deprecation warning that doesn't really make sense:

    ghci> :set -XNoOverlappingInstances
    <no location info>: warning: [GHC-53692] [-Wdeprecated-flags]
        -XNoOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS

    It's debatable whether this should be deprecated or not. I guess it's reasonable to deprecate it since -XOverlappingInstances is never normally enabled and so disabling it shouldn't be necessary. But the message is misleading.

  2. xFlagsDeps carries only a single Deprecated value, even though it is reasonable for an extension but not its negation to be deprecated (e.g. -XDatatypeContexts is deprecated but -XNoDatatypeContexts is not, because one might reasonably want -XHaskell98 -XNoDatatypeContexts). As a consequence, spelling suggestions and tab-completion will not suggest -XNoDatatypeContexts.

  3. -XRank2Types is documented as deprecated but does not raise a -Wdeprecated-flags warning because it is treated as a synonym of -XRankNTypes (see also !12322 (diffs, comment 558390)). Perhaps -XPolymorphicComponents should be deprecated too.

  4. Perhaps TurnOnFlag should be a new datatype rather than reusing Bool.

I'm hoping that in due course we will get a bit more clarity out of the GHC Steering Committee over which extensions should be considered deprecated. This ticket is mostly to record some things that might be worth tackling at the same time.

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