Warning for duplicate language extensions
I recently discovered that -XRebindableSyntax
implies -XNoImplicitPrelude
. Since I frequently listed both extensions at the top of my file with a LANGUAGE
pragma, this knowledge allowed me to remove many superfluous -XNoImplicitPrelude
pragmas. I wouldn't be surprised if there are other unused/implied pragmas floating around in my code.
It would be nice to have a warning when two pragmas are explicitly listed, but one implies the other. The warning format could closely follow the warning for #9939 (closed).
For example:
{-# LANGUAGE NoImplicitPrelude, RebindableSyntax #-}
would produce the warning
Main.hs:1:1: warning: [-Wredundant-pragmas]
• Redundant pragmas: RebindableSyntax => NoImplicitPrelude
• In the language pragmas:
{-# LANGUAGE NoImplicitPrelude, RebindableSyntax #-}
Although it might be harder (impossible?) to detect, it would also be nice if there was a similar warning for unused pragmas.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |