ghc-lib-0.20190204: The GHC API, decoupled from GHC versions

Safe HaskellNone
LanguageHaskell2010

InteractiveEval

Synopsis

Documentation

data Resume Source #

Constructors

data History Source #

Constructors

execStmt Source #

Arguments

:: GhcMonad m
=> String

a statement (bind or expression)

-> m ExecResult

Run a statement in the current interactive context.

execStmt' :: GhcMonad m => GhciLStmt GhcPs -> String -> ExecOptions -> m ExecResult Source #

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 Source #

Constructors

Fields

execOptions :: ExecOptions Source #

default ExecOptions

data ExecResult Source #

Constructors

resumeExec :: GhcMonad m => (SrcSpan -> Bool) -> SingleStep -> m ExecResult Source #

runDecls :: GhcMonad m => String -> m [Name] Source #

runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name] Source #

Run some declarations and return any user-visible names that were brought into scope.

runParsedDecls :: GhcMonad m => [LHsDecl GhcPs] -> m [Name] Source #

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).

isStmt :: DynFlags -> String -> Bool Source #

Returns True if passed string is a statement.

hasImport :: DynFlags -> String -> Bool Source #

Returns True if passed string has an import declaration.

isImport :: DynFlags -> String -> Bool Source #

Returns True if passed string is an import declaration.

isDecl :: DynFlags -> String -> Bool Source #

Returns True if passed string is a declaration but not a splice.

parseImportDecl :: GhcMonad m => String -> m (ImportDecl GhcPs) Source #

data SingleStep Source #

Constructors

abandon :: GhcMonad m => m Bool Source #

abandonAll :: GhcMonad m => m Bool Source #

getResumeContext :: GhcMonad m => m [Resume] Source #

getHistorySpan :: HscEnv -> History -> SrcSpan Source #

getModBreaks :: HomeModInfo -> ModBreaks Source #

getHistoryModule :: History -> Module Source #

back :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String) Source #

forward :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String) Source #

setContext :: GhcMonad m => [InteractiveImport] -> m () Source #

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 constructs the ic_rn_glb_env 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] Source #

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.

availsToGlobalRdrEnv :: ModuleName -> [AvailInfo] -> GlobalRdrEnv Source #

getNamesInScope :: GhcMonad m => m [Name] Source #

Returns all names in scope in the current interactive context

getRdrNamesInScope :: GhcMonad m => m [RdrName] Source #

Returns all RdrName s in scope in the current interactive context, excluding any that are internally-generated.

moduleIsInterpreted :: GhcMonad m => Module -> m Bool Source #

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)) Source #

Looks up an identifier in the current interactive context (for :info) Filter the instances by the ones whose tycons (or clases 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 Trac #1581)

exprType :: GhcMonad m => TcRnExprMode -> String -> m Type Source #

Get the type of an expression Returns the type as described by TcRnExprMode

typeKind :: GhcMonad m => Bool -> String -> m (Type, Kind) Source #

Get the kind of a type

parseName :: GhcMonad m => String -> m [Name] Source #

Parses a string as an identifier, and returns the list of Name s that the identifier can refer to in the current interactive context.

getDocs :: GhcMonad m => Name -> m (Either GetDocsFailure (Maybe HsDocString, Map Int HsDocString)) Source #

data GetDocsFailure Source #

Failure modes for getDocs .

Constructors

NoDocsInIface Module Bool

True : The module was compiled. False : The module was :loaded.

InteractiveName

The Name was defined interactively.

Instances
Instance details

Defined in InteractiveEval

showModule :: GhcMonad m => ModSummary -> m String Source #

moduleIsBootOrNotObjectLinkable :: GhcMonad m => ModSummary -> m Bool Source #

parseExpr :: GhcMonad m => String -> m (LHsExpr GhcPs) Source #

Parse an expression, the parsed expression can be further processed and passed to compileParsedExpr.

compileParsedExpr :: GhcMonad m => LHsExpr GhcPs -> m HValue Source #

compileExpr :: GhcMonad m => String -> m HValue Source #

Compile an expression, run it, and deliver the resulting HValue.

dynCompileExpr :: GhcMonad m => String -> m Dynamic Source #

Compile an expression, run it and return the result as a Dynamic.

compileExprRemote :: GhcMonad m => String -> m ForeignHValue Source #

Compile an expression, run it, and deliver the resulting HValue.

compileParsedExprRemote :: GhcMonad m => LHsExpr GhcPs -> m ForeignHValue Source #

Compile a parsed expression (before renaming), run it, and deliver the resulting HValue.

data Term Source #

Constructors

Fields

Fields

Fields

Fields

Fields

Instances
Instance details

Defined in RtClosureInspect

Methods

ppr :: Term -> SDoc Source #

pprPrec :: Rational -> Term -> SDoc Source #

obtainTermFromId :: HscEnv -> Int -> Bool -> Id -> IO Term Source #

obtainTermFromVal :: HscEnv -> Int -> Bool -> Type -> a -> IO Term Source #

reconstructType :: HscEnv -> Int -> Id -> IO (Maybe Type) Source #

AltStyle によって変換されたページ (->オリジナル) /