| Safe Haskell | None |
|---|
Language.Haskell.Modules.Split
- splitModule :: MonadClean m => (Maybe Name -> ModuleName) -> FilePath -> m [ModuleResult]
- splitModuleDecls :: MonadClean m => FilePath -> m [ModuleResult]
- defaultSymbolToModule :: ModuleInfo -> Maybe Name -> ModuleName
Documentation
Arguments
| :: MonadClean m | |
| => (Maybe Name -> ModuleName) | Map declaration to new module name. The name |
| -> FilePath | |
| -> 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 import 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.
splitModuleDecls :: MonadClean m => FilePath -> m [ModuleResult]Source
Do splitModuleBy with the default symbol to module mapping (was splitModule)
Arguments
| :: ModuleInfo | Parent module name |
| -> Maybe Name | |
| -> ModuleName |
This can be used to build function parameter of splitModule, it determines which module should a symbol be moved to.