ghc-6.10.3: The GHC APIContentsIndex
InteractiveEval
Synopsis
data RunResult
= RunOk [Name]
| RunFailed
| RunException SomeException
| RunBreak ThreadId [Name] (Maybe BreakInfo)
data Status
= Break Bool HValue BreakInfo ThreadId
| Complete (Either SomeException [HValue])
data Resume = Resume {
resumeStmt :: String
resumeThreadId :: ThreadId
resumeBreakMVar :: MVar ()
resumeStatMVar :: MVar Status
resumeBindings :: ([Id], TyVarSet)
resumeFinalIds :: [Id]
resumeApStack :: HValue
resumeBreakInfo :: Maybe BreakInfo
resumeSpan :: SrcSpan
resumeHistory :: [History]
resumeHistoryIx :: Int
}
data History = History {
historyApStack :: HValue
historyBreakInfo :: BreakInfo
historyEnclosingDecl :: Id
}
runStmt :: GhcMonad m => String -> SingleStep -> m RunResult
data SingleStep
= RunToCompletion
| SingleStep
| RunAndLogSteps
resume :: GhcMonad m => (SrcSpan -> Bool) -> SingleStep -> m RunResult
abandon :: GhcMonad m => m Bool
abandonAll :: GhcMonad m => m Bool
getResumeContext :: GhcMonad m => m [Resume]
getHistorySpan :: HscEnv -> History -> SrcSpan
getModBreaks :: HomeModInfo -> ModBreaks
getHistoryModule :: History -> Module
back :: GhcMonad m => m ([Name], Int, SrcSpan)
forward :: GhcMonad m => m ([Name], Int, SrcSpan)
setContext :: GhcMonad m => [Module] -> [Module] -> m ()
getContext :: GhcMonad m => m ([Module], [Module])
nameSetToGlobalRdrEnv :: NameSet -> ModuleName -> GlobalRdrEnv
getNamesInScope :: GhcMonad m => m [Name]
getRdrNamesInScope :: GhcMonad m => m [RdrName]
moduleIsInterpreted :: GhcMonad m => Module -> m Bool
getInfo :: GhcMonad m => Name -> m (Maybe (TyThing, Fixity, [Instance]))
exprType :: GhcMonad m => String -> m Type
typeKind :: GhcMonad m => String -> m Kind
parseName :: GhcMonad m => String -> m [Name]
showModule :: GhcMonad m => ModSummary -> m String
isModuleInterpreted :: GhcMonad m => ModSummary -> m Bool
compileExpr :: GhcMonad m => String -> m HValue
dynCompileExpr :: GhcMonad m => String -> m Dynamic
lookupName :: GhcMonad m => Name -> m (Maybe TyThing)
data Term
= Term {
ty :: RttiType
dc :: Either String DataCon
val :: HValue
subTerms :: [Term]
}
| Prim {
ty :: RttiType
value :: [Word]
}
| Suspension {
ctype :: ClosureType
ty :: RttiType
val :: HValue
bound_to :: Maybe Name
}
| NewtypeWrap {
ty :: RttiType
dc :: Either String DataCon
wrapped_term :: Term
}
| 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)
skolemiseSubst :: TvSubst -> (TvSubst, TyVarSet)
skolemiseTy :: Type -> (Type, TyVarSet)
Documentation
data RunResult
Constructors
RunOk [Name]names bound by this evaluation
RunFailedstatement failed compilation
RunException SomeExceptionstatement raised an exception
RunBreak ThreadId [Name] (Maybe BreakInfo)
data Status
Constructors
Break Bool HValue BreakInfo ThreadIdthe computation hit a breakpoint (Bool = was an exception)
Complete (Either SomeException [HValue])the computation completed with either an exception or a value
data Resume
Constructors
Resume
resumeStmt :: String
resumeThreadId :: ThreadId
resumeBreakMVar :: MVar ()
resumeStatMVar :: MVar Status
resumeBindings :: ([Id], TyVarSet)
resumeFinalIds :: [Id]
resumeApStack :: HValue
resumeBreakInfo :: Maybe BreakInfo
resumeSpan :: SrcSpan
resumeHistory :: [History]
resumeHistoryIx :: Int
data History
Constructors
History
historyApStack :: HValue
historyBreakInfo :: BreakInfo
historyEnclosingDecl :: Id^ A cache of the enclosing top level declaration, for convenience
runStmt :: GhcMonad m => String -> SingleStep -> m RunResult
Run a statement in the current interactive context. Statement may bind multple values.
data SingleStep
Constructors
RunToCompletion
SingleStep
RunAndLogSteps
resume :: GhcMonad m => (SrcSpan -> Bool) -> SingleStep -> m RunResult
abandon :: GhcMonad m => m Bool
abandonAll :: GhcMonad m => m Bool
getResumeContext :: GhcMonad m => m [Resume]
getHistorySpan :: HscEnv -> History -> SrcSpan
getModBreaks :: HomeModInfo -> ModBreaks
getHistoryModule :: History -> Module
back :: GhcMonad m => m ([Name], Int, SrcSpan)
forward :: GhcMonad m => m ([Name], Int, SrcSpan)
setContext
:: GhcMonad m
=> [Module]entire top level scope of these modules
-> [Module]exports only of these modules
-> m ()

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 ([Module], [Module])
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.
nameSetToGlobalRdrEnv :: NameSet -> ModuleName -> GlobalRdrEnv
getNamesInScope :: GhcMonad m => m [Name]
Returns all names in scope in the current interactive context
getRdrNamesInScope :: GhcMonad m => m [RdrName]
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 => Name -> m (Maybe (TyThing, Fixity, [Instance]))
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 Type
Get the type of an expression
typeKind :: GhcMonad m => String -> m Kind
Get the kind of a type
parseName :: GhcMonad m => String -> m [Name]
Parses a string as an identifier, and returns the list of Names that the identifier can refer to in the current interactive context.
showModule :: GhcMonad m => ModSummary -> m String
isModuleInterpreted :: GhcMonad m => ModSummary -> m Bool
compileExpr :: GhcMonad m => String -> m HValue
dynCompileExpr :: GhcMonad m => String -> m Dynamic
lookupName :: GhcMonad m => Name -> m (Maybe TyThing)
Returns the TyThing for a Name. The Name may refer to any entity known to GHC, including Names defined using runStmt.
data Term
Constructors
Term
ty :: RttiType
dc :: Either String DataCon
val :: HValue
subTerms :: [Term]
Prim
ty :: RttiType
value :: [Word]
Suspension
ctype :: ClosureType
ty :: RttiType
val :: HValue
bound_to :: Maybe Name
NewtypeWrap
ty :: RttiType
dc :: Either String DataCon
wrapped_term :: Term
RefWrap
ty :: RttiType
wrapped_term :: Term
show/hide Instances
obtainTermFromId :: HscEnv -> Int -> Bool -> Id -> IO Term
obtainTermFromVal :: HscEnv -> Int -> Bool -> Type -> a -> IO Term
reconstructType :: HscEnv -> Int -> Id -> IO (Maybe Type)
skolemiseSubst :: TvSubst -> (TvSubst, TyVarSet)
skolemiseTy :: Type -> (Type, TyVarSet)
Produced by Haddock version 2.4.2