[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Tue Aug 21 07:52:24 UTC 2018


#13064: Incorrect redudant imports warning
-------------------------------------+-------------------------------------
        Reporter:  phadej            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15393            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Well I'm entirely open to changing the rules.  They are documented here:
 [wiki:Commentary/Compiler/UnusedImports].

 But for some time GHC has claimed to follow the rules, but has simply
 failed to do so. And we have bug reports asking that we fix that.

 It's unfortunate that this `SemiGroup` business has (inadvertently) relied
 on this bug in GHC.  The truth is that the warning is spot-on: the import
 is redundant.

 What rules would we like instead?  Perhaps we want to warn about some
 redundant imports bu not all? But which redundant imports should not be
 warned about? The obvious thing is to make a special case for the Prelude,
 since it is implicitly imported.  For example

 * Never warn about an import declaration (or import item) that is
 unnecessary because of the implicit Prelude import.  For example
 {{{
 import Data.List( null )  -- Already imported by Prelude
 }}}
 Views? The status quo is bad; see #15393

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


More information about the ghc-tickets mailing list