ghc-simple-0.1.3: Simplified interface to the GHC API.

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GHC.Simple.Impl

Description

Lower level building blocks for custom code generation.

Synopsis

Documentation

class Compile a where Source

Any type we can generate intermediate code for.

Methods

toCode :: 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 = PackageKey Source

Synonym for PackageKey, 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 => ModSummary -> m [StgBinding] Source

Compile a ModSummary into a list of simplified StgBindings. See https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/StgSynType 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 => CompConfig a -> (ModSummary -> m a) -> 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.