plugins-1.5.7: Dynamic linking for Haskell and C objects

Safe HaskellNone
LanguageHaskell98

System.Plugins.Parser

Synopsis

Documentation

parse Source #

Arguments

:: FilePath

module name

-> String

haskell src

-> Either String HsModule

abstract syntax

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#

parsePragmas Source #

Arguments

:: String

input 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

data HsModule :: * #

A Haskell source module.

Instances

Data HsModule 

Methods

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 

Methods

pretty :: HsModule -> Doc

prettyPrec :: Int -> HsModule -> Doc

replaceModName :: HsModule -> String -> HsModule Source #

replace Module name with String.