Typos in comments
[ghc.git] / compiler / main / InteractiveEvalTypes.hs
1 {-# LANGUAGE CPP #-}
2
3 -- -----------------------------------------------------------------------------
4 --
5 -- (c) The University of Glasgow, 2005-2007
6 --
7 -- Running statements interactively
8 --
9 -- -----------------------------------------------------------------------------
10
11 module InteractiveEvalTypes (
12 #ifdef GHCI
13 Resume(..), History(..), ExecResult(..),
14 SingleStep(..), isStep, ExecOptions(..),
15 BreakInfo(..)
16 #endif
17 ) where
18
19 #ifdef GHCI
20
21 import GHCi.RemoteTypes
22 import GHCi.Message (EvalExpr, ResumeContext)
23 import Id
24 import Name
25 import Module
26 import RdrName
27 import Type
28 import SrcLoc
29 import Exception
30
31 import Data.Word
32 import GHC.Stack.CCS
33
34 data ExecOptions
35 = ExecOptions
36 { execSingleStep :: SingleStep -- ^ stepping mode
37 , execSourceFile :: String -- ^ filename (for errors)
38 , execLineNumber :: Int -- ^ line number (for errors)
39 , execWrap :: ForeignHValue -> EvalExpr ForeignHValue
40 }
41
42 data SingleStep
43 = RunToCompletion
44 | SingleStep
45 | RunAndLogSteps
46
47 isStep :: SingleStep -> Bool
48 isStep RunToCompletion = False
49 isStep _ = True
50
51 data ExecResult
52 = ExecComplete
53 { execResult :: Either SomeException [Name]
54 , execAllocation :: Word64
55 }
56 | ExecBreak
57 { breakNames :: [Name]
58 , breakInfo :: Maybe BreakInfo
59 }
60
61 data BreakInfo = BreakInfo
62 { breakInfo_module :: Module
63 , breakInfo_number :: Int
64 }
65
66 data Resume = Resume
67 { resumeStmt :: String -- the original statement
68 , resumeContext :: ForeignRef (ResumeContext [HValueRef])
69 , resumeBindings :: ([TyThing], GlobalRdrEnv)
70 , resumeFinalIds :: [Id] -- [Id] to bind on completion
71 , resumeApStack :: ForeignHValue -- The object from which we can get
72 -- value of the free variables.
73 , resumeBreakInfo :: Maybe BreakInfo
74 -- the breakpoint we stopped at
75 -- (module, index)
76 -- (Nothing <=> exception)
77 , resumeSpan :: SrcSpan -- just a copy of the SrcSpan
78 -- from the ModBreaks,
79 -- otherwise it's a pain to
80 -- fetch the ModDetails &
81 -- ModBreaks to get this.
82 , resumeDecl :: String -- ditto
83 , resumeCCS :: RemotePtr CostCentreStack
84 , resumeHistory :: [History]
85 , resumeHistoryIx :: Int -- 0 <==> at the top of the history
86 }
87
88 data History
89 = History {
90 historyApStack :: ForeignHValue,
91 historyBreakInfo :: BreakInfo,
92 historyEnclosingDecls :: [String] -- declarations enclosing the breakpoint
93 }
94 #endif