hie-bios-0.14.0: Set up a GHC API session
Safe HaskellSafe-Inferred
LanguageHaskell2010

HIE.Bios.Ghc.Load

Description

Convenience functions for loading a file into a GHC API session

Synopsis

Documentation

data Log Source #

Instances

Instances details
Pretty Log Source # 
Instance details

Defined in HIE.Bios.Ghc.Load

Methods

pretty :: Log -> Doc ann #

prettyList :: [Log] -> Doc ann #

loadFileWithMessage Source #

Arguments

:: GhcMonad m 
=> LogAction IO (WithSeverity Log) 
-> Maybe Messager

Optional messager hook to log messages produced by GHC.

-> (FilePath, FilePath)

Target file to load.

-> m (Maybe TypecheckedModule, [TypecheckedModule])

Typechecked module and modules that had to be loaded for the target.

Load a target into the GHC session.

The target is represented as a tuple. The tuple consists of the original filename and another file that contains the actual source code to compile.

The optional messager can be used to log diagnostics, warnings or errors that occurred during loading the target.

If the loading succeeds, the typechecked module is returned together with all the typechecked modules that had to be loaded in order to typecheck the given target.

loadFile Source #

Arguments

:: GhcMonad m 
=> LogAction IO (WithSeverity Log) 
-> (FilePath, FilePath)

Target file to load.

-> m (Maybe TypecheckedModule, [TypecheckedModule])

Typechecked module and modules that had to be loaded for the target.

Load a target into the GHC session with the default messager which outputs updates in the same format as normal GHC.

The target is represented as a tuple. The tuple consists of the original filename and another file that contains the actual source code to compile.

If the message should configured, use loadFileWithMessage.

If the loading succeeds, the typechecked module is returned together with all the typechecked modules that had to be loaded in order to typecheck the given target.

setTargetFiles :: GhcMonad m => LogAction IO (WithSeverity Log) -> [(FilePath, FilePath)] -> m () Source #

Set the files as targets and load them. This will reset GHC's targets so only the modules you set as targets and its dependencies will be loaded or reloaded. Produced diagnostics will be printed similar to the normal output of GHC. To configure this, use setTargetFilesWithMessage.

updateTime :: MonadIO m => [Target] -> ModuleGraph -> m ModuleGraph Source #

We bump the times for any ModSummary's that are Targets, to fool the recompilation checker so that we can get the typechecked modules

setTargetFilesWithMessage :: GhcMonad m => LogAction IO (WithSeverity Log) -> Maybe Messager -> [(FilePath, FilePath)] -> m () Source #

Set the files as targets and load them. This will reset GHC's targets so only the modules you set as targets and its dependencies will be loaded or reloaded.

collectASTs :: GhcMonad m => LogAction IO (WithSeverity Log) -> m a -> m (a, [TypecheckedModule]) Source #

Add a hook to record the contents of any TypecheckedModules which are produced during compilation.

astHook :: LogAction IO (WithSeverity Log) -> IORef [TypecheckedModule] -> ModSummary -> Hsc FrontendResult Source #

This hook overwrites the default frontend action of GHC.

ghcInHsc :: Ghc a -> Hsc a Source #

guessTargetMapped :: GhcMonad m => (FilePath, FilePath) -> m Target Source #

A variant of guessTarget which after guessing the target for a filepath, overwrites the target file to be a temporary file.