Hooks

ghc-7.10.3: The GHC API

Safe Haskell | None
Language | Haskell2010

Hooks

Synopsis

- data Hooks
- emptyHooks :: Hooks
- lookupHook :: (Hooks -> Maybe a) -> a -> DynFlags -> a
- getHooked :: (Functor f, HasDynFlags f) => (Hooks -> Maybe a) -> a -> f a
- dsForeignsHook :: Hooks -> Maybe ([LForeignDecl Id] -> DsM (ForeignStubs, OrdList (Id, CoreExpr)))
- tcForeignImportsHook :: Hooks -> Maybe ([LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt))
- tcForeignExportsHook :: Hooks -> Maybe ([LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt))
- hscFrontendHook :: Hooks -> Maybe (ModSummary -> Hsc TcGblEnv)
- hscCompileOneShotHook :: Hooks -> Maybe (HscEnv -> ModSummary -> SourceModified -> IO HscStatus)
- hscCompileCoreExprHook :: Hooks -> Maybe (HscEnv -> SrcSpan -> CoreExpr -> IO HValue)
- ghcPrimIfaceHook :: Hooks -> Maybe ModIface
- runPhaseHook :: Hooks -> Maybe (PhasePlus -> FilePath -> DynFlags -> CompPipeline (PhasePlus, FilePath))
- runMetaHook :: Hooks -> Maybe (MetaHook TcM)
- linkHook :: Hooks -> Maybe (GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag)
- runQuasiQuoteHook :: Hooks -> Maybe (HsQuasiQuote Name -> RnM (HsQuasiQuote Name))
- runRnSpliceHook :: Hooks -> Maybe (LHsExpr Name -> RnM (LHsExpr Name))
- getValueSafelyHook :: Hooks -> Maybe (HscEnv -> Name -> Type -> IO (Maybe HValue))

# Documentation

data 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

lookupHook :: (Hooks -> Maybe a) -> a -> DynFlags -> a

getHooked :: (Functor f, HasDynFlags f) => (Hooks -> Maybe a) -> a -> f a

dsForeignsHook :: Hooks -> Maybe ([LForeignDecl Id] -> DsM (ForeignStubs, OrdList (Id, CoreExpr)))

tcForeignImportsHook :: Hooks -> Maybe ([LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt))

tcForeignExportsHook :: Hooks -> Maybe ([LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt))

hscFrontendHook :: Hooks -> Maybe (ModSummary -> Hsc TcGblEnv)

hscCompileOneShotHook :: Hooks -> Maybe (HscEnv -> ModSummary -> SourceModified -> IO HscStatus)

hscCompileCoreExprHook :: Hooks -> Maybe (HscEnv -> SrcSpan -> CoreExpr -> IO HValue)

ghcPrimIfaceHook :: Hooks -> Maybe ModIface

runPhaseHook :: Hooks -> Maybe (PhasePlus -> FilePath -> DynFlags -> CompPipeline (PhasePlus, FilePath))

runMetaHook :: Hooks -> Maybe (MetaHook TcM)

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

runQuasiQuoteHook :: Hooks -> Maybe (HsQuasiQuote Name -> RnM (HsQuasiQuote Name))

runRnSpliceHook :: Hooks -> Maybe (LHsExpr Name -> RnM (LHsExpr Name))

getValueSafelyHook :: Hooks -> Maybe (HscEnv -> Name -> Type -> IO (Maybe HValue))