importify-1.0: Tool for haskell imports refactoring

Safe HaskellNone
LanguageHaskell2010

Importify.Tree

Synopsis

Documentation

newtype UnusedHidings Source #

newtype wrapper for list of unused symbols from hiding.

Constructors

UnusedHidings 

newtype UnusedSymbols Source #

newtype wrapper for list of unused symbols.

Constructors

UnusedSymbols 

removeImports Source #

Arguments

:: UnusedSymbols

List of symbols which should be removed

-> UnusedHidings

List of hidings which should be removed

-> [InScoped ImportDecl]

Imports to be purified

-> [InScoped ImportDecl] 

Remove a list of identifiers from ImportDecls. Next algorithm is used:

  1. Remove all identifiers inside specified list of types. If list becomes empty then only type left. import Module.Name (Type (HERE)) ⇒ import Module.Name (Type)
  2. Traverse every ImportSpecs and check matching with symbols. import Module.Name (Type (something), HERE) ⇒ import Module.Name (Type (something))
  3. Translate empty imports into implicit import. import Module.Name () ⇒ import Module.Name
  4. Remove all implicit imports preserving only initially implicit or empty.