module-management-0.17.1: Clean up module imports, split and merge modules

Safe HaskellNone

Language.Haskell.Modules.Imports

Synopsis

Documentation

cleanImports :: MonadClean m => [FilePath] -> m [ModuleResult]Source

Clean up the imports of a source file. This means:

  • All import lines get an explict list of symbols
  • Imports of unused symbols are removed
  • Imports of modules whose symbol list becomse empty are removed, unless the removeEmptyImports flag is set to False. However, imports that started out with an empty import list () are retained
  • Repeated imports are merged
  • Imports are alphabetized by module name
  • Imported symbols are alphabetized by symbol name
  • Imported constructors and field accessors are alphabetized

cleanResults :: MonadClean m => [ModuleResult] -> m [ModuleResult]Source

Do import cleaning in response to the values returned by the split and merge operations. Module import lists are cleaned if the module is modified or created.