ghc-simple- Simplified interface to the GHC API.

Safe HaskellNone



Lower level building blocks for custom code generation.



class Compile a where Source

Any type we can generate intermediate code for.


toCode :: DynFlags -> ModSummary -> Ghc a Source

Generate some sort of code (or other output) from a Haskell module.

data Ghc a :: * -> *

A minimal implementation of a GhcMonad. If you need a custom monad, e.g., to maintain additional state consider wrapping this monad or using GhcT.

type PkgKey = PackageId Source

Synonym for PackageId, to bridge a slight incompatibility between GHC 7.8 and 7.10.

liftIO :: MonadIO m => forall a. IO a -> m a

Lift a computation from the IO monad.

toSimplifiedStg :: GhcMonad m => DynFlags -> ModSummary -> m [StgBinding] Source

Compile a ModSummary into a list of simplified StgBindings. See for more information about STG and how it relates to core and Haskell.

toSimplifiedCore :: GhcMonad m => ModSummary -> m CgGuts Source

Compile a ModSummary into a CgGuts, containing all information about a core module that one could wish for.

toModGuts :: GhcMonad m => ModSummary -> m ModGuts Source

Parse, typecheck and desugar a module. Returned ModGuts structure is not simplified in any way.

simplify :: GhcMonad m => ModGuts -> m CgGuts Source

Simplify a core module for code generation.

prepare :: GhcMonad m => DynFlags -> ModSummary -> CgGuts -> m CoreProgram Source

Prepare a core module for code generation.

toStgBindings :: GhcMonad m => DynFlags -> ModSummary -> CoreProgram -> m [StgBinding] Source

Turn a core module into a list of simplified STG bindings.

toCompiledModule :: GhcMonad m => (DynFlags -> ModSummary -> m a) -> DynFlags -> ModSummary -> m (CompiledModule a) Source

Compile a ModSummary into a module with metadata using a custom compilation function.

modulePkgKey :: Module -> PkgKey Source

Package ID/key of a module.

pkgKeyString :: PkgKey -> String Source

String representation of a package ID/key.