Skip to content

Ambiguity between redundant imports

GHC reports this program:

module Test where

import Data.ByteString (ByteString)
import qualified Data.ByteString as S

test :: ByteString -> ByteString
test x = x

as having a redundant import of Data.!ByteString:

$ ghc -c -Wall Test.hs
Test.hs:4:1:
    Warning: The import of `Data.ByteString' is redundant
               except perhaps to import instances from `Data.ByteString'
             To import instances alone, use: import Data.ByteString()

However, removing the restricted import of Data.!ByteString will cause the program to fail to compile, as the type is no longer available. The real problem is with the qualified import of Data.!ByteString as S that is never referenced in the program.

Would it be possible to change the message to distinguish between the qualified import an the restricted import, by more than the line number?

Trac metadata
Trac field Value
Version 7.4.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information