Skip to content

Change the scheme for reporting redundant imports

The current scheme for reporting redundant imports is given on the unusedimportspage.

The 7.10 migration page describes a hack to avoid redundant-import warnings during migration, without using CPP. The hack works for

  module Foo (Int, Word, Monoid(..)) where

  import Data.Monoid
  import Data.Word
  import Prelude

(the hack is putting import Prelude at the bottom). To understand why, read the specification on the unusedimportspage.

But it fails for

  module Foo (Int, Word, Monoid(..)) where

  import Data.Monoid (Monoid(..))
  import Data.Word (Word)
  import Prelude

because the specification treats itemised imports like import Data.Word(Word) differently to "import all" imports.

The question: is there alternative spec (vs the one on the unusedimportspage) that would support the behaviour desired here, without having other undesirable consequences?

Trac metadata
Trac field Value
Version 7.8.4
Type Bug
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