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

Safe HaskellNone

Language.Haskell.Modules.Split

Synopsis

Documentation

splitModuleSource

Arguments

:: MonadClean m 
=> (ModuleName -> DeclName -> ModuleName)

Map declaration to new module name

-> ModuleName 
-> m () 

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
 import
 a = 1 + a
 b = 2
 c = 3
 c' = 4
 (.+.) = b + c

After running splitModule defaultSymbolToModule 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.

splitModuleDecls :: MonadClean m => ModuleName -> m ()Source

Do splitModuleBy with the default symbol to module mapping (was splitModule)

defaultSymbolToModuleSource

Arguments

:: ModuleName

Parent module name

-> DeclName

Declared symbol

-> ModuleName 

What module should this symbol be moved to?