Revert "Generate Typeable info at definition sites"
[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 Status(..), Resume(..), History(..), ExecResult(..),
14 SingleStep(..), isStep, ExecOptions(..)
15 #endif
16 ) where
17
18 #ifdef GHCI
19
20 import Id
21 import BasicTypes
22 import Name
23 import RdrName
24 import TypeRep
25 import ByteCodeInstr
26 import SrcLoc
27 import Exception
28 import Control.Concurrent
29
30 import Data.Word
31
32 data ExecOptions
33 = ExecOptions
34 { execSingleStep :: SingleStep -- ^ stepping mode
35 , execSourceFile :: String -- ^ filename (for errors)
36 , execLineNumber :: Int -- ^ line number (for errors)
37 }
38
39 data SingleStep
40 = RunToCompletion
41 | SingleStep
42 | RunAndLogSteps
43
44 isStep :: SingleStep -> Bool
45 isStep RunToCompletion = False
46 isStep _ = True
47
48 data ExecResult
49 = ExecComplete
50 { execResult :: Either SomeException [Name]
51 , execAllocation :: Word64
52 }
53 | ExecBreak
54 { breakThreadId :: ThreadId
55 , breakNames :: [Name]
56 , breakInfo :: Maybe BreakInfo
57 }
58
59 data Status
60 = Break Bool HValue BreakInfo ThreadId
61 -- ^ the computation hit a breakpoint (Bool <=> was an exception)
62 | Complete (Either SomeException [HValue]) Word64
63 -- ^ the computation completed with either an exception or a value
64
65 data Resume
66 = Resume {
67 resumeStmt :: String, -- the original statement
68 resumeThreadId :: ThreadId, -- thread running the computation
69 resumeBreakMVar :: MVar (),
70 resumeStatMVar :: MVar Status,
71 resumeBindings :: ([TyThing], GlobalRdrEnv),
72 resumeFinalIds :: [Id], -- [Id] to bind on completion
73 resumeApStack :: HValue, -- The object from which we can get
74 -- value of the free variables.
75 resumeBreakInfo :: Maybe BreakInfo,
76 -- the breakpoint we stopped at
77 -- (Nothing <=> exception)
78 resumeSpan :: SrcSpan, -- just a cache, otherwise it's a pain
79 -- to fetch the ModDetails & ModBreaks
80 -- to get this.
81 resumeHistory :: [History],
82 resumeHistoryIx :: Int -- 0 <==> at the top of the history
83 }
84
85 data History
86 = History {
87 historyApStack :: HValue,
88 historyBreakInfo :: BreakInfo,
89 historyEnclosingDecls :: [String] -- declarations enclosing the breakpoint
90 }
91 #endif
92