Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Convenience functions for loading a file into a GHC API session
Synopsis
- data Log
- get_fp :: TypecheckedModule -> Maybe FilePath
- loadFileWithMessage :: GhcMonad m => LogAction IO (WithSeverity Log) -> Maybe Messager -> (FilePath, FilePath) -> m (Maybe TypecheckedModule, [TypecheckedModule])
- loadFile :: GhcMonad m => LogAction IO (WithSeverity Log) -> (FilePath, FilePath) -> m (Maybe TypecheckedModule, [TypecheckedModule])
- setTargetFiles :: GhcMonad m => LogAction IO (WithSeverity Log) -> [(FilePath, FilePath)] -> m ()
- msTargetIs :: ModSummary -> Target -> Bool
- updateTime :: MonadIO m => [Target] -> ModuleGraph -> m ModuleGraph
- setTargetFilesWithMessage :: GhcMonad m => LogAction IO (WithSeverity Log) -> Maybe Messager -> [(FilePath, FilePath)] -> m ()
- collectASTs :: GhcMonad m => LogAction IO (WithSeverity Log) -> m a -> m (a, [TypecheckedModule])
- astHook :: LogAction IO (WithSeverity Log) -> IORef [TypecheckedModule] -> ModSummary -> Hsc FrontendResult
- initializePluginsGhc :: GhcMonad m => LogAction IO (WithSeverity Log) -> ModSummary -> m ModSummary
- ghcInHsc :: Ghc a -> Hsc a
- guessTargetMapped :: GhcMonad m => (FilePath, FilePath) -> m Target
- setTargetFilename :: FilePath -> Target -> Target
Documentation
LogLoaded FilePath FilePath | |
LogTypechecked [TypecheckedModule] | |
LogInitPlugins Int [ModuleName] | |
LogSetTargets [(FilePath, FilePath)] | |
LogModGraph ModuleGraph |
Instances
Pretty Log Source # | |
Defined in HIE.Bios.Ghc.Load prettyList :: [Log] -> Doc ann |
:: 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.
:: 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
.
msTargetIs :: ModSummary -> Target -> Bool Source #
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 TypecheckedModule
s 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.
initializePluginsGhc :: GhcMonad m => LogAction IO (WithSeverity Log) -> ModSummary -> m ModSummary 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.