GHC.Driver.Hooks

ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Driver.Hooks

Synopsis

- data Hooks
- class HasHooks (m :: Type -> Type) where
  - getHooks :: m Hooks
- class ContainsHooks a where
  - extractHooks :: a -> Hooks
- emptyHooks :: Hooks
- type family DsForeignsHook
- 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 #

class HasHooks (m :: Type -> Type) where #

Methods

getHooks :: m Hooks #

#### Instances

Instances details

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

class ContainsHooks a where #

Methods

extractHooks :: a -> Hooks #

#### Instances

Instances details

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

emptyHooks :: Hooks #

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 #

dsForeignsHook :: Hooks -> Maybe DsForeignsHook #

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

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)) #

Deprecated: cmmToRawCmmHook is being deprecated. If you do use it in your project, please raise a GHC issue!