#3419: Incorrect "unnecessary import" warning
---------------------------------+------------------------------------------
Reporter: NeilMitchell | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.4
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Comment (by igloo):
We recently rewrote the code for this warning in the HEAD, and found a
couple of places where there were non-obvious choices.
One was the case you're describing, where there are re-exports. The two
choices were
* '''consider both imports used'''; assuming, as you say, that the user
has mentally allocated different imported entites to different imports, so
the user believes that they are both used even though one of them is
technically redundant. I had another example of this, with
`Control.Monad.State`, `Control.Monad.Reader` and `Control.Monad`.
* '''consider only the first import used'''; this is what is currently
implemented. The first import decl to provide each of Data and Typeable is
`Data.Typeable`, so nothing marks `Data.Data` as used, so it is warned
about.
The other was to do with restricted vs complete imports. In this module:
{{{
module Foo where
import Data.List (sort)
import Data.List
f = sort
}}}
which import should we warn about?
Both of these are just a question of what we want; the code changes
required are minimal.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3419#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs