Skip to content

-fwarn-unused-imports complains about wrong import

If a symbol is accessible through multiple imports, ghc seems to complain about the first one, even if that's the one it's actually accessed through.

$ cat Test.hs
module Test where

import qualified Control.Monad (ap)
import qualified Control.Monad.Reader

foo :: IO ()
foo = return id `Control.Monad.ap` return ()

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6

$ ghc -c Test.hs -Werror -fwarn-unused-imports

Test.hs:3:0:
    Warning: Module `Control.Monad' is imported, but nothing from it is used,
               except perhaps instances visible in `Control.Monad'
             To suppress this warning, use: import Control.Monad()

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