[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Tue Sep 11 13:53:40 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 RyanGlScott):

 I'll chime in one opinion as a member of the CLC. If I'm reading
 comment:24 correctly, then there still exists a solution (two solutions,
 even, depending on how verbose you want to be) to avoiding redundant
 imports warnings that is compliant with the three-release policy.
 Moreover, the less verbose of these solutions:

 {{{#!hs
 {-# OPTIONS_GHC -Wall #-}
 import Data.Semigroup
 import Prelude

 squash :: Semigroup a => a -> a -> a
 squash = (<>)

 foo :: Int
 foo = 42
 }}}

 Isn't terribly different from the usual advice that we give for avoiding
 redundant imports on old GHCs, so it wouldn't be //too// far of a break
 from convention to espouse this advice instead.

 The only thing we'd have to be conscious of is that code like this, where
 explicit imports are used:

 {{{#!hs
 {-# OPTIONS_GHC -Wall #-}
 import Data.Semigroup (Semigroup, (<>))
 import Prelude

 squash :: Semigroup a => a -> a -> a
 squash = (<>)

 foo :: Int
 foo = 42
 }}}

 Will now start emitting warnings, so there will likely need to be some
 migration to mitigate these warnings once they start popping up in the
 wild. The question is: exactly how much migration can we expect? I'm
 unsure of what the answer to this question is, so to help get an
 approximate answer, I'm going to build the `wip/T13064` branch and try
 building a slew of Hackage libraries with it in order to see which new
 warnings appear.

 Regardless of what this experiment produces, I still lean towards the side
 of applying this change, since it fixes an outright bug. It helps that one
 can migrate any code to adapt to this new warning scheme without too much
 trouble as well.

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


More information about the ghc-tickets mailing list