[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Wed Jan 4 22:03:45 UTC 2017


#13064: Incorrect redudant imports warning
-------------------------------------+-------------------------------------
        Reporter:  phadej            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       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:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Sorry if I am being dense here. I still don't understand why you care
 ''which'' import is reported as redundant. If you are only importing a
 module for its instances, writing an empty import list is the standard way
 to express that explicitly.

 It seems like the reason has to do with the fact that
 `Data.Binary.Orphans` provides instances you want that are not provided by
 `Data.Binary`, while `Data.Binary` does not provide any instances you want
 that are not provided by `Data.Binary.Orphans`. In the case of a custom
 prelude, "want" might even just mean that you want to make them available
 to your importers. So, there is no way for GHC to divine your intent in
 general. It certainly doesn't seem like this distinction between the two
 modules is related to whether or not you provide a (nonempty) explicit
 import list. So if you change the heuristics to handle this case to your
 satisfaction, it will just break a symmetric case for someone else.

 All in all, it seems like a lot of effort to avoid typing `()`.

 The RelaxedUnusedImports proposal is rather different in intent, since
 there the goal is to make it easier to write warning-free code across a
 range of versions of dependencies, while this issue is not about whether
 to issue a warning, but which warning to issue.

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


More information about the ghc-tickets mailing list