Safe Haskell | None |
---|---|
Language | Haskell98 |
- parse :: FilePath -> String -> Either String HsModule
- mergeModules :: HsModule -> HsModule -> HsModule
- pretty :: HsModule -> String
- parsePragmas :: String -> ([String], [String])
- data HsModule :: * = HsModule SrcLoc Module (Maybe [HsExportSpec]) [HsImportDecl] [HsDecl]
- replaceModName :: HsModule -> String -> HsModule
Documentation
parse a file (as a string) as Haskell src
mergeModules :: HsModule -> HsModule -> HsModule Source #
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 Source #
pretty print haskell src
doesn't handle operators with #
at the end. i.e. unsafeCoerce#
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
A Haskell source module.
HsModule SrcLoc Module (Maybe [HsExportSpec]) [HsImportDecl] [HsDecl] |