ghc-7.7.20120902: The GHC API

Safe HaskellNone

InteractiveEval

Synopsis

Documentation

data RunResult Source

Constructors

RunOk [Name]

names bound by this evaluation

RunException SomeException

statement raised an exception

RunBreak ThreadId [Name] (Maybe BreakInfo) 

data Status Source

Constructors

Break Bool HValue BreakInfo ThreadId

the computation hit a breakpoint (Bool = was an exception)

Complete (Either SomeException [HValue])

the computation completed with either an exception or a value

runStmt :: GhcMonad m => String -> SingleStep -> m RunResultSource

Run a statement in the current interactive context. Statement may bind multple values.

runStmtWithLocation :: GhcMonad m => String -> Int -> String -> SingleStep -> m RunResultSource

Run a statement in the current interactive context. Passing debug information Statement may bind multple values.

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

Set the interactive evaluation context.

Setting the context doesn't throw away any bindings; the bindings we've built up in the InteractiveContext simply move to the new module. They always shadow anything in scope in the current context.

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.

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

Returns all names in scope in the current interactive context

moduleIsInterpreted :: GhcMonad m => Module -> m BoolSource

Returns True if the specified module is interpreted, and hence has its full top-level scope available.

getInfo :: GhcMonad m => Name -> m (Maybe (TyThing, Fixity, [ClsInst]))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 => String -> m TypeSource

Get the type of an expression

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 Names that the identifier can refer to in the current interactive context.

data Term Source

Constructors

Term 

Fields

ty :: RttiType
 
dc :: Either String DataCon
 
val :: HValue
 
subTerms :: [Term]
 
Prim 

Fields

ty :: RttiType
 
value :: [Word]
 
Suspension 

Fields

ctype :: ClosureType
 
ty :: RttiType
 
val :: HValue
 
bound_to :: Maybe Name
 
NewtypeWrap 

Fields

ty :: RttiType
 
dc :: Either String DataCon
 
wrapped_term :: Term
 
RefWrap 

Fields

ty :: RttiType
 
wrapped_term :: Term
 

Instances