#4983: Warning about redundant import is wrong when hiding identifiers in order
to
avoid export ambiguities
---------------------------------+------------------------------------------
Reporter: Lemming | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Incorrect warning at
compile-time
---------------------------------+------------------------------------------
Although warnings about redundant imports are almost perfect since
GHC-6.12, I have a corner case, where the warning about a redundant import
is wrong.
Consider the module
{{{
module Data.Monoid.HT (cycle, ) where
import Data.Monoid (Monoid, mappend, )
import Data.Function (fix, )
import Prelude hiding (cycle, )
{- |
Generalization of 'Data.List.cycle' to any monoid.
-}
cycle :: Monoid m => m -> m
cycle x =
fix (mappend x)
}}}
GHC says:
{{{
src/Data/Monoid/HT.hs:6:1:
Warning: The import of `Prelude' is redundant
except perhaps to import instances from `Prelude'
To import instances alone, use: import Prelude()
}}}
I have to hide 'cycle' from Prelude if I want to export it unqualified.
I have several work-arounds: Export 'cycle' with qualification, use no
export list at all, import from Prelude by enumeration of needed
functions. I think this problem has low priority. I report it just for the
case that someone claims that Haskell's module system is simple and could
be more complicated. ;-)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4983>
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