plugins-1.0ContentsIndex
System.Plugins.Parser
Synopsis
parse :: FilePath -> String -> Either String HsModule
mergeModules :: HsModule -> HsModule -> HsModule
pretty :: HsModule -> String
parsePragmas :: String -> ([String], [String])
HsModule (HsModule)
replaceModName :: HsModule -> String -> HsModule
Documentation
parse
:: FilePathmodule name
-> Stringhaskell src
-> Either String HsModuleabstract syntax
parse a file (as a string) as Haskell src
mergeModules :: HsModule -> HsModule -> HsModule

mergeModules : generate a full Haskell src file, give a .hs config file, and a stub to take default syntax and decls from. Mostly we just ensure they don't do anything bad, and that the names are correct for the module.

Transformations:

. Take src location pragmas from the conf file (1st file) . Use the template's (2nd argument) module name . Only use export list from template (2nd arg) . Merge top-level decls . need to force the type of the plugin to match the stub, overwriting any type they supply.

pretty :: HsModule -> String

pretty print haskell src

doesn't handle operators with # at the end. i.e. unsafeCoerce#

parsePragmas
:: Stringinput src
-> ([String], [String])normal options, global options

Parsing option pragmas.

This is not a type checker. If the user supplies bogus options, they'll get slightly mystical error messages. Also, we want to handle -package options, and other static flags. This is more than GHC.

GHC user's guide :

    OPTIONS pragmas are only looked for at the top of your source
    files, up to the first (non-literate,non-empty) line not
    containing OPTIONS. Multiple OPTIONS pragmas are recognised.

based on getOptionsFromSource(), in main/DriverUtil.hs

HsModule (HsModule)
replaceModName :: HsModule -> String -> HsModule
replace Module name with String.
Produced by Haddock version 0.8