dodgey warning about redundant class method imports
Consider the code:
import qualified Distribution.Text as Text
( Text(disp, parse) )
instance Text.Text ReportLevel where
disp = ...
parse = ...
(This is from Distribution/Client/BuildReports/Types.hs
in cabal-install-0.8.0)
GHC warns us that:
Distribution/Client/BuildReports/Types.hs:17:0:
Warning: The import of `Text.disp, Text.parse'
from module `Distribution.Text' is redundant
But is it really redundant? If we change the import to:
import qualified Distribution.Text as Text
( Text )
Then the compile fails because disp
and parse
are not visible members of the Text
class.
Actually it's a bit odd that they become visible when imported qualified when the instance decl itself must use non-qualified class method names. But I guess that's just a quirk of H98.
One can get no warning by switching to:
import qualified Distribution.Text as Text
( Text(..) )
But that's not very satisfying. I did want to say which class methods I'm using.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |