[GHC] #12543: Warning for duplicate language extensions

GHC ghc-devs at haskell.org
Fri Aug 26 17:37:39 UTC 2016


#12543: Warning for duplicate language extensions
-------------------------------------+-------------------------------------
           Reporter:  crockeea       |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12543>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list