hie-bios-0.12.0: Set up a GHC API session

Safe Haskell | Safe-Inferred
Language | Haskell2010

HIE.Bios.Ghc.Api

Description

These functions are for conveniently implementing the simple CLI

Synopsis

- initializeFlagsWithCradle :: GhcMonad m => LogAction IO (WithSeverity Log) -> FilePath -> Cradle a -> m (CradleLoadResult (m SuccessFlag, ComponentOptions))
- initializeFlagsWithCradleWithMessage :: GhcMonad m => LogAction IO (WithSeverity Log) -> Maybe Messager -> FilePath -> Cradle a -> m (CradleLoadResult (m SuccessFlag, ComponentOptions))
- data SuccessFlag
  - = Succeeded
  - | Failed
- withDynFlags :: GhcMonad m => (DynFlags -> DynFlags) -> m a -> m a
- initSessionWithMessage :: GhcMonad m => Maybe Messager -> ComponentOptions -> (m SuccessFlag, ComponentOptions)

# Documentation

initializeFlagsWithCradle #

Arguments

:: GhcMonad m |
=> LogAction IO (WithSeverity Log) |
-> FilePath | The file we are loading the `Cradle` because of
-> Cradle a | The cradle we want to load
-> m (CradleLoadResult (m SuccessFlag, ComponentOptions)) |

Initialize a GHC session by loading a given file into a given cradle.

initializeFlagsWithCradleWithMessage #

Arguments

:: GhcMonad m |
=> LogAction IO (WithSeverity Log) |
-> Maybe Messager |
-> FilePath | The file we are loading the `Cradle` because of
-> Cradle a | The cradle we want to load
-> m (CradleLoadResult (m SuccessFlag, ComponentOptions)) | Whether we actually loaded the cradle or not.

The same as `initializeFlagsWithCradle` but with an additional argument to control how the loading progress messages are displayed to the user. In `haskell-ide-engine` the module loading progress is displayed in the UI by using a progress notification.

data SuccessFlag #

Constructors

Succeeded |
Failed |

#### Instances

Instances details

Semigroup SuccessFlag |
Instance details Defined in GHC.Types.Basic Methods (<>) :: SuccessFlag -> SuccessFlag -> SuccessFlag # sconcat :: NonEmpty SuccessFlag -> SuccessFlag stimes :: Integral b => b -> SuccessFlag -> SuccessFlag
Outputable SuccessFlag |
Instance details Defined in GHC.Types.Basic Methods ppr :: SuccessFlag -> SDoc

withDynFlags :: GhcMonad m => (DynFlags -> DynFlags) -> m a -> m a #

initSessionWithMessage :: GhcMonad m => Maybe Messager -> ComponentOptions -> (m SuccessFlag, ComponentOptions) #

Actually perform the initialisation of the session. Initialising the session corresponds to parsing the command line flags, setting the targets for the session and then attempting to load all the targets.