diagrams-builder-0.8.0.1: hint-based build service for the diagrams graphics EDSL.

Copyright(c) 2012 diagrams-lib team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Builder.Modules

Description

Tools used by diagrams-builder for manipulating Haskell modules.

Synopsis

Documentation

createModule Source #

Arguments

:: Maybe String

Module name to use

-> BuildOpts b v n 
-> Either String Module 

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 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, Maybe 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.