Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- 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] |
Instances
Data HsModule | |
Defined in Language.Haskell.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsModule -> c HsModule # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HsModule # toConstr :: HsModule -> Constr # dataTypeOf :: HsModule -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HsModule) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsModule) # gmapT :: (forall b. Data b => b -> b) -> HsModule -> HsModule # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsModule -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsModule -> r # gmapQ :: (forall d. Data d => d -> u) -> HsModule -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsModule -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsModule -> m HsModule # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule -> m HsModule # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule -> m HsModule # | |
Show HsModule | |
Pretty HsModule | |
Defined in Language.Haskell.Pretty prettyPrec :: Int -> HsModule -> Doc |