Skip to content

Missing warning on duplicate import

The following program does not give a warning:

{-# OPTIONS_GHC -Wall #-}
import Data.List
import Data.List

main :: IO ()
main = print $ sort "hello"

But this program does:

{-# OPTIONS_GHC -Wall #-}

import Data.List(sort)
import Data.List

main :: IO ()
main = print $ sort "hello"

with:

    Warning: Redundant import of: `sort'
             It is also imported from Data.List at Test.hs:4:0-15

It seems surprising that 100% identical imports aren't given as warnings, as in the first example.

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