Safe Haskell | None |
---|---|
Language | Haskell2010 |
Importify.Tree
- newtype UnusedHidings = UnusedHidings {
- getUnusedHidings :: [Symbol]
- newtype UnusedSymbols = UnusedSymbols {
- getUnusedSymbols :: [Symbol]
- removeImports :: UnusedSymbols -> UnusedHidings -> [InScoped ImportDecl] -> [InScoped ImportDecl]
Documentation
newtype UnusedHidings Source #
newtype
wrapper for list of unused symbols from hiding
.
Constructors
UnusedHidings | |
Fields
|
newtype UnusedSymbols Source #
newtype
wrapper for list of unused symbols.
Constructors
UnusedSymbols | |
Fields
|
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 ImportDecl
s.
Next algorithm is used:
- 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)
- Traverse every
ImportSpec
s and check matching with symbols.import Module.Name (Type (something), HERE) ⇒ import Module.Name (Type (something))
- Translate empty imports into implicit import.
import Module.Name () ⇒ import Module.Name
- Remove all implicit imports preserving only initially implicit or empty.