Skip to content

Incorrect "unnecessary import" warning

With the code:

{-# OPTIONS_GHC -Wall -fno-warn-missing-methods #-}
module Test where
import Data.Typeable
import Data.Data
data Test = Test
instance Typeable Test where

I get the warning:

    Warning: Module `Data.Typeable' is imported, but nothing from it is used
               except perhaps instances visible in `Data.Typeable'
             To suppress this warning, use: import Data.Typeable()

It seems like it's decided to pick up Typeable from Data.Data, but it's also available from Data.Typeable which would be a better choice. I'm not sure how this should be solved, but the current behaviour seems incorrect. Perhaps if two modules are imported, both of which export the same thing, they should both be allowed.

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