Copyright | (c) 2012 diagrams-lib team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
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.
emptyModule :: Module Source
doModuleParse :: String -> Either String Module Source
Run the haskell-src-exts parser on a String
representing some
Haskell code, producing a Module
or an error message.
unLit :: String -> String Source
Remove all the literate comments and bird tracks from a literate Haskell file. Has no effect on non-literate source.
replaceModuleName :: String -> Module -> Module Source
Replace the name of a module.
deleteExports :: Module -> Module Source
Delete module exports.
addPragmas :: [String] -> Module -> Module Source
Add some LANGUAGE
pragmas to a module if necessary.
addImports :: [String] -> Module -> Module Source
Add some imports to a module if necessary.
combineModules :: Module -> Module -> Module Source
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 -> String Source
Convert a ModuleName
to a String
.