importify icon indicating copy to clipboard operation
importify copied to clipboard

[IMRF-50] Symbol imported from both `qualified` and non-`qualified` namespaces is not considered unused

Open chshersh opened this issue 8 years ago • 0 comments

Consider next imports:

import           Language.Haskell.Names (symbolName)
import qualified Language.Haskell.Names as N

GHC prints warning:

    The import of ‘N.Symbol(symbolName)’
    from module ‘Language.Haskell.Names’ is redundant

if only N.symbolName is used in this module. And importify doesn't remove such redundant import. Though, resolution of this bug is ambiguous.

Alexander Sukhoverkhov [22:07] Ok, the symbol needs to be imported both qualified and unqualified but used qualified. Then GHC displays warning on the unqualified import but Importify doesn't remove either. (edited)

Dmitry Kovanikov [22:25] @a.sukhoverkhov Yes, it's a warning. But we have two possibilities what to do next:

  1. Remove symbolName from imports
  2. Turn all usages of N.symbolName into symbolName . And in this exact module I want to perform second option. But importify is way too far from modifying not only import section :disappointed: Even if importify can, it's not obvious which behavior shoud it choose by default. So just postpone to better time.

chshersh avatar Aug 11 '17 14:08 chshersh