[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Wed Jan 4 14:21:37 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):

 I'm afraid I'm lost. You say "but `Binary Value` instance is imported from
 `Data.Binary.Orphans`"; but the error message explicitly says
 {{{
       except perhaps to import instances from ‘Data.Binary.Orphans’
 }}}
 so I don't see a problem.

 In general given a set of imports that is redundant, there isn't a unique
 way to remove imports to eliminate the redundancy. For example if I import
 modules `A` and `B` which both export `f` and I use `f` but nothing else
 from either `A` or `B`, then either the import of `A` or of `B` can be
 removed, but not both. In such cases GHC has to make a choice about which
 import to report as redundant. In your example it seems that GHC's choice
 changed between versions, probably having to do with the fact that you
 mentioned `Binary` in an explicit import list. I'm pretty sure that if you
 reverse the order of your two `import Data.Binary` lines, GHC 7.10.3 will
 give the same error you are getting with GHC 8.0.1.

 In any case the solution is to add an empty import list as the error
 message suggests.

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


More information about the ghc-tickets mailing list