HORIZON HASKELLDocslts/ghc-10.0.xaa25b892026-10-10Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · aa25b89 · 2026-10-10

Moduleghc-10.0.0.20260917GHC2024

GHC.Driver.Env

  • 2 types
  • 1 class
  • 37 values
newtypenewtype Hsc a
#

The Hsc monad: Passing an environment and diagnostic state

Instances10Monad, Functor, Applicative, MonadIO, MonadCatch, MonadMask, …
  • Monad HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • Functor HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • Applicative HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • MonadIO HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • MonadCatch HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • MonadMask HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • MonadThrow HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • HasLogger HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • HasDynFlags HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
  • HasHscEnv HscDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
datadata HscEnv
#

HscEnv is like Session, except that some of the fields are immutable. An HscEnv is used to compile a single module from plain Haskell source code (after preprocessing) to either C, assembly or C--. It's also used to store the dynamic linker state to allow for multiple linkers in the same address space. Things like the module graph don't change during a single compilation.

Historical note: "hsc" used to be the name of the compiler binary, when there was a separate driver and compiler. To compile a single module, the driver would invoke hsc on the source code... so nowadays we think of hsc as the layer of the compiler that deals with compiling a single module.

Constructors

Instances2ContainsDynFlags, HasHscEnv

Update the LogFlags of the Log in hsc_logger from the DynFlags in hsc_dflags. You need to call this when DynFlags are modified.

valuerunInteractiveHsc :: HscEnv -> Hsc a -> IO a
#

A variant of runHsc that switches in the DynFlags and Plugins from the InteractiveContext before running the Hsc computation.

valuehscInterp :: HscEnv -> Interp
#

Retrieve the target code interpreter

Fails if no target code interpreter is available

valuediscardIC :: HscEnv -> HscEnv
#

Discard the contents of the InteractiveContext, but keep the DynFlags and the loaded plugins. It will also keep ic_int_print and ic_monad if their names are from external packages.

Legacy API

1 declaration

Deprecated. Updating the HPT directly is no longer a supported operation. Instead, the HPT is an insert-only data structure. If you want to overwrite an existing entry, just use hscInsertHPT to insert it again (it will override the existing entry if there is one). See GHC.Unit.Home.PackageTable for more details.