| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
GHC.Runtime.Eval
Synopsis
- data Resume = Resume {
- resumeStmt :: String
- resumeContext :: ForeignRef (ResumeContext [HValueRef])
- resumeBindings :: ResumeBindings
- resumeFinalIds :: [Id]
- resumeApStack :: ForeignHValue
- resumeBreakpointId :: Maybe InternalBreakpointId
- resumeSpan :: SrcSpan
- resumeDecl :: String
- resumeCCS :: RemotePtr CostCentreStack
- resumeHistory :: [History]
- resumeHistoryIx :: Int
- data History = History {}
- execStmt :: GhcMonad m => String -> ExecOptions -> m ExecResult
- execStmt' :: GhcMonad m => GhciLStmt GhcPs -> String -> ExecOptions -> m ExecResult
- data ExecOptions = ExecOptions {}
- execOptions :: ExecOptions
- data ExecResult
- = ExecComplete { }
- | ExecBreak { }
- resumeExec :: GhcMonad m => SingleStep -> Maybe Int -> m ExecResult
- runDecls :: GhcMonad m => String -> m [Name]
- runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name]
- runParsedDecls :: GhcMonad m => [LHsDecl GhcPs] -> m [Name]
- parseImportDecl :: GhcMonad m => String -> m (ImportDecl GhcPs)
- data SingleStep
- = RunToCompletion
- | RunAndLogSteps
- | SingleStep
- | StepOut { }
- | LocalStep { }
- | ModuleStep { }
- abandon :: GhcMonad m => m Bool
- abandonAll :: GhcMonad m => m Bool
- getResumeContext :: GhcMonad m => m [Resume]
- getHistorySpan :: HomeUnitGraph -> History -> IO SrcSpan
- getModBreaks :: HomeModInfo -> Maybe InternalModBreaks
- readIModBreaks :: HomeUnitGraph -> InternalBreakpointId -> IO InternalModBreaks
- readIModModBreaks :: HomeUnitGraph -> Module -> IO ModBreaks
- getHistoryModule :: HomeUnitGraph -> History -> IO Module
- setupBreakpoint :: GhcMonad m => Interp -> InternalBreakpointId -> Int -> m ()
- back :: GhcMonad m => Int -> m ([Name], Int, SrcSpan)
- forward :: GhcMonad m => Int -> m ([Name], Int, SrcSpan)
- setContext :: GhcMonad m => [InteractiveImport] -> m ()
- getContext :: GhcMonad m => m [InteractiveImport]
- mkTopLevEnv :: HscEnv -> Module -> IO (Either String GlobalRdrEnv)
- mkTopLevImportedEnv :: HscEnv -> HomeModInfo -> IO GlobalRdrEnv
- getNamesInScope :: GhcMonad m => m [Name]
- getRdrNamesInScope :: GhcMonad m => m [RdrName]
- moduleIsInterpreted :: GhcMonad m => Module -> m Bool
- getInfo :: GhcMonad m => Bool -> Name -> m (Maybe (TyThing, Fixity, [ClsInst], [FamInst], SDoc))
- exprType :: GhcMonad m => TcRnExprMode -> String -> m Type
- typeKind :: GhcMonad m => Bool -> String -> m (Type, Kind)
- parseName :: GhcMonad m => String -> m (NonEmpty Name)
- parseInstanceHead :: GhcMonad m => String -> m Type
- getInstancesForType :: GhcMonad m => Type -> m [ClsInst]
- getDocs :: GhcMonad m => Name -> m (Either GetDocsFailure (Maybe [HsDoc GhcRn], IntMap (HsDoc GhcRn)))
- data GetDocsFailure
- showModule :: GhcMonad m => ModuleNodeInfo -> m String
- moduleIsBootOrNotObjectLinkable :: GhcMonad m => Module -> m Bool
- parseExpr :: GhcMonad m => String -> m (LHsExpr GhcPs)
- compileParsedExpr :: GhcMonad m => LHsExpr GhcPs -> m HValue
- compileExpr :: GhcMonad m => String -> m HValue
- dynCompileExpr :: GhcMonad m => String -> m Dynamic
- compileExprRemote :: GhcMonad m => String -> m ForeignHValue
- compileParsedExprRemote :: GhcMonad m => LHsExpr GhcPs -> m ForeignHValue
- data Term
- = Term { }
- | Prim { }
- | Suspension { }
- | NewtypeWrap { }
- | RefWrap {
- ty :: RttiType
- wrapped_term :: Term
- obtainTermFromId :: HscEnv -> Int -> Bool -> Id -> IO Term
- obtainTermFromVal :: HscEnv -> Int -> Bool -> Type -> a -> IO Term
- reconstructType :: HscEnv -> Int -> Id -> IO (Maybe Type)
Documentation
Constructors
| Resume | |
Fields
| |
Constructors
| History | |
Fields
| |
Arguments
| :: GhcMonad m | |
| => String | a statement (bind or expression) |
| -> ExecOptions | |
| -> m ExecResult |
Run a statement in the current interactive context.
execStmt' :: GhcMonad m => GhciLStmt GhcPs -> String -> ExecOptions -> m ExecResult #
Like execStmt, but takes a parsed statement as argument. Useful when
doing preprocessing on the AST before execution, e.g. in GHCi (see
GHCi.UI.runStmt).
data ExecOptions #
Constructors
| ExecOptions | |
Fields
| |
default ExecOptions
data ExecResult #
Constructors
| ExecComplete | Execution is complete with either an exception or the list of user-visible names that were brought into scope. |
Fields | |
| ExecBreak | Execution stopped at a breakpoint. Note: |
Fields | |
resumeExec :: GhcMonad m => SingleStep -> Maybe Int -> m ExecResult #
runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name] #
Run some declarations and return any user-visible names that were brought into scope.
runParsedDecls :: GhcMonad m => [LHsDecl GhcPs] -> m [Name] #
Like runDeclsWithLocation, but takes parsed declarations as argument.
Useful when doing preprocessing on the AST before execution, e.g. in GHCi
(see GHCi.UI.runStmt).
parseImportDecl :: GhcMonad m => String -> m (ImportDecl GhcPs) #
data SingleStep #
What kind of stepping are we doing?
Constructors
| RunToCompletion | |
| RunAndLogSteps | :trace [expr] |
| SingleStep | :step [expr] |
| StepOut | :stepout |
Fields
| |
| LocalStep | :steplocal [expr] |
| ModuleStep | :stepmodule [expr] |
abandonAll :: GhcMonad m => m Bool #
getResumeContext :: GhcMonad m => m [Resume] #
getHistorySpan :: HomeUnitGraph -> History -> IO SrcSpan #
getModBreaks :: HomeModInfo -> Maybe InternalModBreaks #
Get the breakpoint information from the ByteCode object associated to this
HomeModInfo.
readIModBreaks :: HomeUnitGraph -> InternalBreakpointId -> IO InternalModBreaks #
Read the InternalModBreaks of the given home Module (via
InternalBreakpointId) from the HomeUnitGraph.
readIModModBreaks :: HomeUnitGraph -> Module -> IO ModBreaks #
Read the ModBreaks from the given module's InternalModBreaks
getHistoryModule :: HomeUnitGraph -> History -> IO Module #
setupBreakpoint :: GhcMonad m => Interp -> InternalBreakpointId -> Int -> m () #
setContext :: GhcMonad m => [InteractiveImport] -> m () #
Set the interactive evaluation context.
(setContext imports) sets the ic_imports field (which in turn
determines what is in scope at the prompt) to imports, and
updates the icReaderEnv environment to reflect it.
We retain in scope all the things defined at the prompt, and kept in ic_tythings. (Indeed, they shadow stuff from ic_imports.)
getContext :: GhcMonad m => m [InteractiveImport] #
Get the interactive evaluation context, consisting of a pair of the set of modules from which we take the full top-level scope, and the set of modules from which we take just the exports respectively.
mkTopLevEnv :: HscEnv -> Module -> IO (Either String GlobalRdrEnv) #
mkTopLevImportedEnv :: HscEnv -> HomeModInfo -> IO GlobalRdrEnv #
Make the top-level environment with all bindings imported by this module. Exported bindings from this module are not included in the result.
getNamesInScope :: GhcMonad m => m [Name] #
Returns all names in scope in the current interactive context
getRdrNamesInScope :: GhcMonad m => m [RdrName] #
Returns all RdrNames in scope in the current interactive
context, excluding any that are internally-generated.
moduleIsInterpreted :: GhcMonad m => Module -> m Bool #
Returns True if the specified module is interpreted, and hence has
its full top-level scope available.
getInfo :: GhcMonad m => Bool -> Name -> m (Maybe (TyThing, Fixity, [ClsInst], [FamInst], SDoc)) #
Looks up an identifier in the current interactive context (for :info) Filter the instances by the ones whose tycons (or classes resp) are in scope (qualified or otherwise). Otherwise we list a whole lot too many! The exact choice of which ones to show, and which to hide, is a judgement call. (see #1581)
exprType :: GhcMonad m => TcRnExprMode -> String -> m Type #
Get the type of an expression
Returns the type as described by TcRnExprMode
parseName :: GhcMonad m => String -> m (NonEmpty Name) #
Parses a string as an identifier, and returns the list of Names that
the identifier can refer to in the current interactive context.
parseInstanceHead :: GhcMonad m => String -> m Type #
getInstancesForType :: GhcMonad m => Type -> m [ClsInst] #
getDocs :: GhcMonad m => Name -> m (Either GetDocsFailure (Maybe [HsDoc GhcRn], IntMap (HsDoc GhcRn))) #
data GetDocsFailure #
Failure modes for getDocs.
Constructors
| NameHasNoModule Name |
|
| NoDocsInIface | The module was loaded without |
| InteractiveName | The |
Instances
| Outputable GetDocsFailure # | |
Defined in GHC.Runtime.Eval Methods ppr :: GetDocsFailure -> SDoc # | |
showModule :: GhcMonad m => ModuleNodeInfo -> m String #
moduleIsBootOrNotObjectLinkable :: GhcMonad m => Module -> m Bool #
parseExpr :: GhcMonad m => String -> m (LHsExpr GhcPs) #
Parse an expression, the parsed expression can be further processed and passed to compileParsedExpr.
compileExpr :: GhcMonad m => String -> m HValue #
Compile an expression, run it, and deliver the resulting HValue.
dynCompileExpr :: GhcMonad m => String -> m Dynamic #
Compile an expression, run it and return the result as a Dynamic.
compileExprRemote :: GhcMonad m => String -> m ForeignHValue #
Compile an expression, run it, and deliver the resulting HValue.
compileParsedExprRemote :: GhcMonad m => LHsExpr GhcPs -> m ForeignHValue #
Compile a parsed expression (before renaming), run it, and deliver the resulting HValue.
Constructors
| Term | |
| Prim | |
| Suspension | |
| NewtypeWrap | |
| RefWrap | |
Fields
| |
Instances
| Outputable Term # | |
Defined in GHC.Runtime.Heap.Inspect | |