Maintainer | diagrams-discuss@googlegroups.com |
---|---|
Safe Haskell | None |
Tools used by diagrams-builder for manipulating Haskell modules.
- createModule :: Maybe String -> BuildOpts b v -> Either String Module
- emptyModule :: Module
- doModuleParse :: String -> Either String Module
- unLit :: String -> String
- replaceModuleName :: String -> Module -> Module
- deleteExports :: Module -> Module
- addPragmas :: [String] -> Module -> Module
- addImports :: [String] -> Module -> Module
- combineModules :: Module -> Module -> Module
- getModuleName :: ModuleName -> String
Documentation
Extend some snippets of source code into a proper module, by
combining them intelligently (preserving imports, pragmas, etc.),
(possibly) giving it a different name, and adding LANGUAGE
pragmas
and imports if necessary. Only those pragmas and imports which
are not already included in the code will be added.
Returns the updated module, or an error message if parsing failed.
doModuleParse :: String -> Either String ModuleSource
Run the haskell-src-exts parser on a String
representing some
Haskell code, producing a Module
or an error message.
unLit :: String -> StringSource
Remove all the literate comments and bird tracks from a literate Haskell file. Has no effect on non-literate source.
replaceModuleName :: String -> Module -> ModuleSource
Replace the name of a module.
deleteExports :: Module -> ModuleSource
Delete module exports.
addPragmas :: [String] -> Module -> ModuleSource
Add some LANGUAGE
pragmas to a module if necessary.
addImports :: [String] -> Module -> ModuleSource
Add some imports to a module if necessary.
combineModules :: Module -> Module -> ModuleSource
Combine two modules into one, with a left bias in the case of things that can't be sensibly combined (e.g. the module name). Note that combining multiple imports of the same module with different import specifications (qualification, hiding, explicit import) is unlikely to work sensibly.
getModuleName :: ModuleName -> StringSource
Convert a ModuleName
to a String
.