
#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 bgamari): **Replying to comment:24:**
Ben: I want to point out, that this is a regression between 7.10 and 8.0.
Right, I don't dispute that that there is a regression here; rather, I want to point out that there may be a significant amount of code that (unfortunately) now relies on that regression.
or (at least single qualified use) {{{#!hs {-# OPTIONS_GHC -Wall #-} import Data.Semigroup (Semigroup (..)) import Prelude
squash :: Data.Semigroup.Semigroup a => a -> a -> a squash = (<>) }}}
Right; this is a reasonable option, albeit a bit ugly. However, it seems like this should serve as motivation to consider what mechanisms we could add to GHC to allow us to accomodate this sort of API reshuffling more easily and with fewer hacks in the future. For instance, wiki:Design/LocalWarningPragmas. **Replying to comment:23**
Never warn about an import declaration (or import item) that is unnecessary because of the implicit `Prelude` import. For example
I suppose this is a possibility, although it seems to be me that we should rather try to introduce a mechanism to allow the user to state explicitly what they mean. That is: the import is known to be redundant but added for compatibility's sake. This could either be a general mechanism (e.g. wiki:Design/LocalWarningPragmas) or something more specifically designed to address import redundancy. (e.g. a `{-# USED #-}` pragma which could be attached to an import to silence the redundancy checker), -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13064#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler