ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Driver.Hooks

Synopsis

- data Hooks
- class HasHooks m where
  - getHooks :: m Hooks
- class ContainsHooks a where
  - extractHooks :: a -> Hooks
- emptyHooks :: Hooks
- type family DsForeignsHook :: Type
- dsForeignsHook :: Hooks -> Maybe DsForeignsHook
- tcForeignImportsHook :: Hooks -> Maybe ([LForeignDecl GhcRn] -> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt))
- tcForeignExportsHook :: Hooks -> Maybe ([LForeignDecl GhcRn] -> TcM (LHsBinds GhcTc, [LForeignDecl GhcTc], Bag GlobalRdrElt))
- hscFrontendHook :: Hooks -> Maybe (ModSummary -> Hsc FrontendResult)
- hscCompileCoreExprHook :: Hooks -> Maybe (HscEnv -> SrcSpan -> CoreExpr -> IO (ForeignHValue, [Linkable], PkgsLoaded))
- ghcPrimIfaceHook :: Hooks -> Maybe ModIface
- runPhaseHook :: Hooks -> Maybe PhaseHook
- runMetaHook :: Hooks -> Maybe (MetaHook TcM)
- linkHook :: Hooks -> Maybe (GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag)
- runRnSpliceHook :: Hooks -> Maybe (HsUntypedSplice GhcRn -> RnM (HsUntypedSplice GhcRn))
- getValueSafelyHook :: Hooks -> Maybe (HscEnv -> Name -> Type -> IO (Either Type (HValue, [Linkable], PkgsLoaded)))
- createIservProcessHook :: Hooks -> Maybe (CreateProcess -> IO ProcessHandle)
- stgToCmmHook :: Hooks -> Maybe (StgToCmmConfig -> InfoTableProvMap -> [TyCon] -> CollectedCCs -> [CgStgTopBinding] -> HpcInfo -> Stream IO CmmGroup ModuleLFInfos)
- cmmToRawCmmHook :: Hooks -> forall a. Maybe (DynFlags -> Maybe Module -> Stream IO CmmGroupSRTs a -> IO (Stream IO RawCmmGroup a))

# Documentation

data Hooks Source #

class HasHooks m where Source #

Methods

getHooks :: m Hooks Source #

#### Instances

Instances details

ContainsHooks env => HasHooks (IOEnv env) Source # |
Instance details Defined in GHC.Data.IOEnv Methods getHooks :: IOEnv env Hooks Source #

class ContainsHooks a where Source #

Methods

extractHooks :: a -> Hooks Source #

#### Instances

Instances details

ContainsHooks (Env gbl lcl) Source # |
Instance details Defined in GHC.Tc.Types Methods extractHooks :: Env gbl lcl -> Hooks Source #

emptyHooks :: Hooks Source #

Hooks can be used by GHC API clients to replace parts of the compiler pipeline. If a hook is not installed, GHC uses the default built-in behaviour

type family DsForeignsHook :: Type Source #

#### Instances

Instances details

type DsForeignsHook Source # |
Instance details Defined in GHC.HsToCore.Types type DsForeignsHook = [LForeignDecl GhcTc] -> DsM (ForeignStubs, OrdList (Id, CoreExpr))

dsForeignsHook :: Hooks -> Maybe DsForeignsHook Source #

Actual type: `Maybe ([LForeignDecl GhcTc] -> DsM (ForeignStubs, OrdList (Id, CoreExpr)))`

tcForeignImportsHook :: Hooks -> Maybe ([LForeignDecl GhcRn] -> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt)) Source #

tcForeignExportsHook :: Hooks -> Maybe ([LForeignDecl GhcRn] -> TcM (LHsBinds GhcTc, [LForeignDecl GhcTc], Bag GlobalRdrElt)) Source #

hscFrontendHook :: Hooks -> Maybe (ModSummary -> Hsc FrontendResult) Source #

hscCompileCoreExprHook :: Hooks -> Maybe (HscEnv -> SrcSpan -> CoreExpr -> IO (ForeignHValue, [Linkable], PkgsLoaded)) Source #

ghcPrimIfaceHook :: Hooks -> Maybe ModIface Source #

runPhaseHook :: Hooks -> Maybe PhaseHook Source #

runMetaHook :: Hooks -> Maybe (MetaHook TcM) Source #

linkHook :: Hooks -> Maybe (GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag) Source #

runRnSpliceHook :: Hooks -> Maybe (HsUntypedSplice GhcRn -> RnM (HsUntypedSplice GhcRn)) Source #

getValueSafelyHook :: Hooks -> Maybe (HscEnv -> Name -> Type -> IO (Either Type (HValue, [Linkable], PkgsLoaded))) Source #

createIservProcessHook :: Hooks -> Maybe (CreateProcess -> IO ProcessHandle) Source #

stgToCmmHook :: Hooks -> Maybe (StgToCmmConfig -> InfoTableProvMap -> [TyCon] -> CollectedCCs -> [CgStgTopBinding] -> HpcInfo -> Stream IO CmmGroup ModuleLFInfos) Source #

cmmToRawCmmHook :: Hooks -> forall a. Maybe (DynFlags -> Maybe Module -> Stream IO CmmGroupSRTs a -> IO (Stream IO RawCmmGroup a)) Source #