[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Thu Jan 5 05:41:42 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 phadej):

 I found even more minimal examples, they aren't tied to instances:

 {{{
 % cat Next.hs
 import Control.Applicative
 import Prelude (IO, pure)

 main :: IO ()
 main = pure ()
 % cat Next2.hs
 import Control.Applicative
 import Prelude (IO, pure)

 main :: IO ()
 main = () <$ pure ()
 % $(ghc-select ghc-7.10.3)
 % ghc -Wall -fforce-recomp Next.hs
 [1 of 1] Compiling Main             ( Next.hs, Next.o )

 Next.hs:2:1: Warning:
     The import of ‘pure’ from module ‘Prelude’ is redundant
 Linking Next ...
 % ghc -Wall -fforce-recomp Next2.hs
 [1 of 1] Compiling Main             ( Next2.hs, Next2.o )

 Next2.hs:2:1: Warning:
     The import of ‘pure’ from module ‘Prelude’ is redundant
 Linking Next2 ...
 % $(ghc-select ghc-8.0.1)
 % ghc -Wall -fforce-recomp Next.hs
 [1 of 1] Compiling Main             ( Next.hs, Next.o )

 Next.hs:1:1: warning: [-Wunused-imports]
     The import of ‘Control.Applicative’ is redundant
       except perhaps to import instances from ‘Control.Applicative’
     To import instances alone, use: import Control.Applicative()
 Linking Next ...
 % ghc -Wall -fforce-recomp Next2.hs
 [1 of 1] Compiling Main             ( Next2.hs, Next2.o )
 Linking Next2 ...
 }}}

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


More information about the ghc-tickets mailing list