Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data InteractiveContext = InteractiveContext {
- ic_dflags :: DynFlags
- ic_mod_index :: Int
- ic_imports :: [InteractiveImport]
- ic_tythings :: [TyThing]
- ic_gre_cache :: IcGlobalRdrEnv
- ic_instances :: (InstEnv, [FamInst])
- ic_fix_env :: FixityEnv
- ic_default :: DefaultEnv
- ic_resume :: [Resume]
- ic_monad :: Name
- ic_int_print :: Name
- ic_cwd :: Maybe FilePath
- ic_plugins :: !Plugins
- data InteractiveImport
- emptyInteractiveContext :: DynFlags -> InteractiveContext
- extendInteractiveContext :: InteractiveContext -> [TyThing] -> InstEnv -> [FamInst] -> DefaultEnv -> FixityEnv -> InteractiveContext
- extendInteractiveContextWithIds :: InteractiveContext -> [Id] -> InteractiveContext
- setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext
- substInteractiveContext :: InteractiveContext -> Subst -> InteractiveContext
- replaceImportEnv :: IcGlobalRdrEnv -> GlobalRdrEnv -> IcGlobalRdrEnv
- icReaderEnv :: InteractiveContext -> GlobalRdrEnv
- icExtendGblRdrEnv :: Bool -> GlobalRdrEnv -> [TyThing] -> GlobalRdrEnv
- icInteractiveModule :: InteractiveContext -> Module
- icInScopeTTs :: InteractiveContext -> [TyThing]
- icNamePprCtx :: UnitEnv -> InteractiveContext -> NamePprCtx
Documentation
data InteractiveContext Source #
Interactive context, recording information about the state of the context in which statements are executed in a GHCi session.
InteractiveContext | |
|
data InteractiveImport Source #
IIDecl (ImportDecl GhcPs) | Bring the exports of a particular module (filtered by an import decl) into scope |
IIModule ModuleName | Bring into scope the entire top-level envt of of this module, including the things imported into it. |
Instances
Outputable InteractiveImport Source # | |
Defined in GHC.Runtime.Context ppr :: InteractiveImport -> SDoc Source # |
emptyInteractiveContext :: DynFlags -> InteractiveContext Source #
Constructs an empty InteractiveContext.
extendInteractiveContext :: InteractiveContext -> [TyThing] -> InstEnv -> [FamInst] -> DefaultEnv -> FixityEnv -> InteractiveContext Source #
extendInteractiveContext is called with new TyThings recently defined to update the InteractiveContext to include them. By putting new things first, unqualified use will pick the most recently defined thing with a given name, while still keeping the old names in scope in their qualified form (Ghci1.foo).
:: Bool | discard names that are only available qualified? |
-> GlobalRdrEnv | |
-> [TyThing] | |
-> GlobalRdrEnv |
Add TyThings
to the GlobalRdrEnv
, earlier ones in the list shadowing
later ones, and shadowing existing entries in the GlobalRdrEnv
.
icInScopeTTs :: InteractiveContext -> [TyThing] Source #
This function returns the list of visible TyThings (useful for e.g. showBindings).
It picks only those TyThings that are not shadowed by later definitions on the interpreter, to not clutter :showBindings with shadowed ids, which would show up as Ghci9.foo.
Some TyThings define many names; we include them if _any_ name is still available unqualified.
icNamePprCtx :: UnitEnv -> InteractiveContext -> NamePprCtx Source #
Get the NamePprCtx function based on the flags and this InteractiveContext