[GHC] #10117: Change the scheme for reporting redundant imports

GHC ghc-devs at haskell.org
Thu Jun 9 05:46:35 UTC 2016


#10117: Change the scheme for reporting redundant imports
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.4
      Resolution:                    |             Keywords:  deprecate
                                     |  warning
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ezyang):

 Your first bullet point is exactly right.

 To refine the old principle, I think this is good enough: an import is
 unused if it can be deleted without changing the meaning of the program,
 EXCEPT if the import explicitly brings x into scope (e.g., `import A
 (x)`), and the only other ways x was brought into scope are implicit
 (e.g., `import B`), AND each such implicit import is of a different module
 (e.g., `import A (x)` is still redundant if we `import A`). I've expanded
 the wikipage on this point, and I also streamlined the proposed algorithm
 so that we don't need a textual subsumption check anymore: I'm just a bit
 choosier about what import-items I mark as used when I hit a RdrName.

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


More information about the ghc-tickets mailing list