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