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

Safe HaskellNone






:: MonadClean m 
=> (Maybe Name -> ModuleName)

Map each symbol name to the module it will be moved to. The name Nothing is used for instance declarations.

-> FilePath

The file containing the input module.

-> m [ModuleResult] 

Split the declarations of the module in the input file into new modules as specified by the symToModule function, which maps symbol name's to module names. It is permissable for the output function to map one or more symbols to the original module. The modules will be written into files whose names are constructed from the module name in the usual way, but with a prefix taken from the first element of the list of directories in the SourceDirs list. This list is just [.] by default.



:: MonadClean m 
=> FilePath

The file containing the input module.

-> m [ModuleResult] 

Split each of a module's declarations into a new module. Update the imports of all the modules in the moduVerse to reflect the split. For example, if you have a module like

 module Start (a, b, (.+.)) where
 a = 1 + a
 b = 2
 c = 3
 c' = 4
 (.+.) = b + c

After running splitModuleDecls Start.hs the Start module will be gone. The a and b symbols will be in new modules named Start.A and Start.B. Because they were not exported by Start, the c and c' symbols will both be in a new module named Start.Internal.C. And the .+. symbol will be in a module named Start.OtherSymbols. Note that this module needs to import new Start.A and Start.Internal.C modules.

If we had imported and then re-exported a symbol in Start it would go into a module named Start.ReExported. Any instance declarations would go into Start.Instances.



:: ModuleInfo

Parent module name

-> Maybe Name 
-> ModuleName 

This can be used to build the function parameter of splitModule, it determines which module should a symbol be moved to.