[GHC] #10117: Change the scheme for reporting redundant imports

GHC ghc-devs at haskell.org
Thu Feb 26 17:03:02 UTC 2015


#10117: Change the scheme for reporting redundant imports
-------------------------------------+-------------------------------------
              Reporter:  simonpj     |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.8.4
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 The current scheme for reporting redundant imports is given on the
 [wiki:Commentary/Compiler/UnusedImports unused imports page].

 [wiki:Migration/7.10#GHCsaysTheimportof...isredundant 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 [wiki:Commentary/Compiler/UnusedImports
 unused imports page].

 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
 [wiki:Commentary/Compiler/UnusedImports unused imports page]) that would
 support the behaviour desired here, without having other undesirable
 consequences?'''

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10117>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list