[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Tue Aug 21 09:09:32 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 phadej):

 Thanks Simon for doing this!

 Ben: I want to point out, that this is a regression between 7.10 and 8.0.
 The change to less strict version as is currently where done pre-GHC-
 proposal process, but it really should been scrutinized in something like
 that.

 For AMP, the 7.10.3 (which works correctly) warns about

 {{{
 {-# OPTIONS_GHC -Wall #-}
 import Control.Applicative (Applicative (..), (<$>))
 import Prelude

 mult :: Applicative f => f a -> f b -> f (a, b)
 mult x y = (,) <$> x <*> y
 }}}

 but not about

 {{{
 {-# OPTIONS_GHC -Wall #-}
 import Control.Applicative
 import Prelude

 mult :: Applicative f => f a -> f b -> f (a, b)
 mult x y = (,) <$> x <*> y
 }}}

 Similarly, GHC-8.4.3 doesn't warn, but the wip/T13064 does about:

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

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

 However, neither warns about (open imports)

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

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

 or (at least single qualified use)

 {{{
 {-# OPTIONS_GHC -Wall #-}
 import Data.Semigroup (Semigroup (..))
 import Prelude

 squash :: Data.Semigroup.Semigroup a => a -> a -> a
 squash = (<>)
 }}}

 S 3-release-policy is easily satisfied. You'll need to do "something" in
 your code,
 but it's not "use CPP". I hope that CLC agrees.

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


More information about the ghc-tickets mailing list