Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
GHCi.Message
Contents
Description
Remote GHCi message types and serialization.
For details on Remote GHCi, see Note [Remote GHCi] in compilerGHCRuntime/Interpreter.hs.
Synopsis
- data Message a where
- Shutdown :: Message ()
- RtsRevertCAFs :: Message ()
- InitLinker :: Message ()
- LookupSymbol :: String -> Message (Maybe (RemotePtr ()))
- LookupClosure :: String -> Message (Maybe HValueRef)
- LoadDLL :: String -> Message (Maybe String)
- LoadArchive :: String -> Message ()
- LoadObj :: String -> Message ()
- UnloadObj :: String -> Message ()
- AddLibrarySearchPath :: String -> Message (RemotePtr ())
- RemoveLibrarySearchPath :: RemotePtr () -> Message Bool
- ResolveObjs :: Message Bool
- FindSystemLibrary :: String -> Message (Maybe String)
- CreateBCOs :: [ByteString] -> Message [HValueRef]
- FreeHValueRefs :: [HValueRef] -> Message ()
- AddSptEntry :: Fingerprint -> HValueRef -> Message ()
- MallocData :: ByteString -> Message (RemotePtr ())
- MallocStrings :: [ByteString] -> Message [RemotePtr ()]
- PrepFFI :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)
- FreeFFI :: RemotePtr C_ffi_cif -> Message ()
- MkConInfoTable :: Bool -> Int -> Int -> Int -> Int -> ByteString -> Message (RemotePtr StgInfoTable)
- EvalStmt :: EvalOpts -> EvalExpr HValueRef -> Message (EvalStatus [HValueRef])
- ResumeStmt :: EvalOpts -> RemoteRef (ResumeContext [HValueRef]) -> Message (EvalStatus [HValueRef])
- AbandonStmt :: RemoteRef (ResumeContext [HValueRef]) -> Message ()
- EvalString :: HValueRef -> Message (EvalResult String)
- EvalStringToString :: HValueRef -> String -> Message (EvalResult String)
- EvalIO :: HValueRef -> Message (EvalResult ())
- MkCostCentres :: String -> [(String, String)] -> Message [RemotePtr CostCentre]
- CostCentreStackInfo :: RemotePtr CostCentreStack -> Message [String]
- NewBreakArray :: Int -> Message (RemoteRef BreakArray)
- SetupBreakpoint :: RemoteRef BreakArray -> Int -> Int -> Message ()
- BreakpointStatus :: RemoteRef BreakArray -> Int -> Message Bool
- GetBreakpointVar :: HValueRef -> Int -> Message (Maybe HValueRef)
- StartTH :: Message (RemoteRef (IORef QState))
- RunTH :: RemoteRef (IORef QState) -> HValueRef -> THResultType -> Maybe Loc -> Message (QResult ByteString)
- RunModFinalizers :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (QResult ())
- GetClosure :: HValueRef -> Message (GenClosure HValueRef)
- Seq :: HValueRef -> Message (EvalStatus ())
- ResumeSeq :: RemoteRef (ResumeContext ()) -> Message (EvalStatus ())
- data Msg = forall a.(Binary a, Show a) => Msg (Message a)
- data THMessage a where
- NewName :: String -> THMessage (THResult Name)
- Report :: Bool -> String -> THMessage (THResult ())
- LookupName :: Bool -> String -> THMessage (THResult (Maybe Name))
- Reify :: Name -> THMessage (THResult Info)
- ReifyFixity :: Name -> THMessage (THResult (Maybe Fixity))
- ReifyType :: Name -> THMessage (THResult Type)
- ReifyInstances :: Name -> [Type] -> THMessage (THResult [Dec])
- ReifyRoles :: Name -> THMessage (THResult [Role])
- ReifyAnnotations :: AnnLookup -> TypeRep -> THMessage (THResult [ByteString])
- ReifyModule :: Module -> THMessage (THResult ModuleInfo)
- ReifyConStrictness :: Name -> THMessage (THResult [DecidedStrictness])
- AddDependentFile :: FilePath -> THMessage (THResult ())
- AddTempFile :: String -> THMessage (THResult FilePath)
- AddModFinalizer :: RemoteRef (Q ()) -> THMessage (THResult ())
- AddCorePlugin :: String -> THMessage (THResult ())
- AddTopDecls :: [Dec] -> THMessage (THResult ())
- AddForeignFilePath :: ForeignSrcLang -> FilePath -> THMessage (THResult ())
- IsExtEnabled :: Extension -> THMessage (THResult Bool)
- ExtsEnabled :: THMessage (THResult [Extension])
- PutDoc :: DocLoc -> String -> THMessage (THResult ())
- GetDoc :: DocLoc -> THMessage (THResult (Maybe String))
- StartRecover :: THMessage ()
- EndRecover :: Bool -> THMessage ()
- FailIfErrs :: THMessage (THResult ())
- RunTHDone :: THMessage ()
- data THMsg = forall a.(Binary a, Show a) => THMsg (THMessage a)
- data QResult a
- = QDone a
- | QException String
- | QFail String
- data EvalStatus_ a b
- = EvalComplete Word64 (EvalResult a)
- | EvalBreak Bool HValueRef Int Int (RemoteRef (ResumeContext b)) (RemotePtr CostCentreStack)
- type EvalStatus a = EvalStatus_ a a
- data EvalResult a
- data EvalOpts = EvalOpts {}
- data EvalExpr a
- data SerializableException
- toSerializableException :: SomeException -> SerializableException
- fromSerializableException :: SerializableException -> SomeException
- data THResult a
- = THException String
- | THComplete a
- data THResultType
- = THExp
- | THPat
- | THType
- | THDec
- | THAnnWrapper
- data ResumeContext a = ResumeContext {
- resumeBreakMVar :: MVar ()
- resumeStatusMVar :: MVar (EvalStatus a)
- resumeThreadId :: ThreadId
- data QState = QState {}
- getMessage :: Get Msg
- putMessage :: Message a -> Put
- getTHMessage :: Get THMsg
- putTHMessage :: THMessage a -> Put
- data Pipe = Pipe {
- pipeRead :: Handle
- pipeWrite :: Handle
- pipeLeftovers :: IORef (Maybe ByteString)
- remoteCall :: Binary a => Pipe -> Message a -> IO a
- remoteTHCall :: Binary a => Pipe -> THMessage a -> IO a
- readPipe :: Pipe -> Get a -> IO a
- writePipe :: Pipe -> Put -> IO ()
Documentation
A Message a
is a message that returns a value of type a
.
These are requests sent from GHC to the server.
Constructors
Shutdown :: Message () | Exit the iserv process |
RtsRevertCAFs :: Message () | |
InitLinker :: Message () | |
LookupSymbol :: String -> Message (Maybe (RemotePtr ())) | |
LookupClosure :: String -> Message (Maybe HValueRef) | |
LoadDLL :: String -> Message (Maybe String) | |
LoadArchive :: String -> Message () | |
LoadObj :: String -> Message () | |
UnloadObj :: String -> Message () | |
AddLibrarySearchPath :: String -> Message (RemotePtr ()) | |
RemoveLibrarySearchPath :: RemotePtr () -> Message Bool | |
ResolveObjs :: Message Bool | |
FindSystemLibrary :: String -> Message (Maybe String) | |
CreateBCOs :: [ByteString] -> Message [HValueRef] | Create a set of BCO objects, and return HValueRefs to them
Note: Each ByteString contains a Binary-encoded [ResolvedBCO], not
a ResolvedBCO. The list is to allow us to serialise the ResolvedBCOs
in parallel. See |
FreeHValueRefs :: [HValueRef] -> Message () | Release |
AddSptEntry :: Fingerprint -> HValueRef -> Message () | Add entries to the Static Pointer Table |
MallocData :: ByteString -> Message (RemotePtr ()) | Malloc some data and return a |
MallocStrings :: [ByteString] -> Message [RemotePtr ()] | |
PrepFFI :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif) | Calls |
FreeFFI :: RemotePtr C_ffi_cif -> Message () | Free data previously created by |
MkConInfoTable :: Bool -> Int -> Int -> Int -> Int -> ByteString -> Message (RemotePtr StgInfoTable) | Create an info table for a constructor |
EvalStmt :: EvalOpts -> EvalExpr HValueRef -> Message (EvalStatus [HValueRef]) | Evaluate a statement |
ResumeStmt :: EvalOpts -> RemoteRef (ResumeContext [HValueRef]) -> Message (EvalStatus [HValueRef]) | Resume evaluation of a statement after a breakpoint |
AbandonStmt :: RemoteRef (ResumeContext [HValueRef]) -> Message () | Abandon evaluation of a statement after a breakpoint |
EvalString :: HValueRef -> Message (EvalResult String) | Evaluate something of type |
EvalStringToString :: HValueRef -> String -> Message (EvalResult String) | Evaluate something of type |
EvalIO :: HValueRef -> Message (EvalResult ()) | Evaluate something of type |
MkCostCentres :: String -> [(String, String)] -> Message [RemotePtr CostCentre] | Create a set of CostCentres with the same module name |
CostCentreStackInfo :: RemotePtr CostCentreStack -> Message [String] | Show a |
NewBreakArray :: Int -> Message (RemoteRef BreakArray) | Create a new array of breakpoint flags |
SetupBreakpoint :: RemoteRef BreakArray -> Int -> Int -> Message () | Set how many times a breakpoint should be ignored also used for enable/disable |
BreakpointStatus :: RemoteRef BreakArray -> Int -> Message Bool | Query the status of a breakpoint (True = enabled) |
GetBreakpointVar :: HValueRef -> Int -> Message (Maybe HValueRef) | Get a reference to a free variable at a breakpoint |
StartTH :: Message (RemoteRef (IORef QState)) | Start a new TH module, return a state token that should be |
RunTH :: RemoteRef (IORef QState) -> HValueRef -> THResultType -> Maybe Loc -> Message (QResult ByteString) | Evaluate a TH computation. Returns a ByteString, because we have to force the result before returning it to ensure there are no errors lurking in it. The TH types don't have NFData instances, and even if they did, we have to serialize the value anyway, so we might as well serialize it to force it. |
RunModFinalizers :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (QResult ()) | Run the given mod finalizers. |
GetClosure :: HValueRef -> Message (GenClosure HValueRef) | Remote interface to GHC.Exts.Heap.getClosureData. This is used by the GHCi debugger to inspect values in the heap for :print and type reconstruction. |
Seq :: HValueRef -> Message (EvalStatus ()) | Evaluate something. This is used to support :force in GHCi. |
ResumeSeq :: RemoteRef (ResumeContext ()) -> Message (EvalStatus ()) | Resume forcing a free variable in a breakpoint (#2950) |
data THMessage a where Source #
Messages sent back to GHC from GHCi.TH, to implement the methods
of Quasi
. For an overview of how TH works with Remote GHCi, see
Note [Remote Template Haskell] in GHCi.TH.
Constructors
Template Haskell return values
Constructors
QDone a | RunTH finished successfully; return value follows |
QException String | RunTH threw an exception |
QFail String | RunTH called |
Instances
Generic (QResult a) # | |
Show a => Show (QResult a) # | |
Binary a => Binary (QResult a) # | |
type Rep (QResult a) # | |
Defined in GHCi.Message type Rep (QResult a) = D1 ('MetaData "QResult" "GHCi.Message" "ghci-9.2.0.20210331" 'False) (C1 ('MetaCons "QDone" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: (C1 ('MetaCons "QException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "QFail" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) |
data EvalStatus_ a b Source #
Constructors
EvalComplete Word64 (EvalResult a) | |
EvalBreak Bool HValueRef Int Int (RemoteRef (ResumeContext b)) (RemotePtr CostCentreStack) |
Instances
type EvalStatus a = EvalStatus_ a a Source #
data EvalResult a Source #
Constructors
EvalException SerializableException | |
EvalSuccess a |
Instances
Generic (EvalResult a) # | |
Defined in GHCi.Message Methods from :: EvalResult a -> Rep (EvalResult a) x Source # to :: Rep (EvalResult a) x -> EvalResult a Source # | |
Show a => Show (EvalResult a) # | |
Defined in GHCi.Message | |
Binary a => Binary (EvalResult a) # | |
Defined in GHCi.Message Methods put :: EvalResult a -> Put Source # get :: Get (EvalResult a) Source # putList :: [EvalResult a] -> Put Source # | |
type Rep (EvalResult a) # | |
Defined in GHCi.Message type Rep (EvalResult a) = D1 ('MetaData "EvalResult" "GHCi.Message" "ghci-9.2.0.20210331" 'False) (C1 ('MetaCons "EvalException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SerializableException)) :+: C1 ('MetaCons "EvalSuccess" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) |
Constructors
EvalOpts | |
Fields
|
Instances
Generic EvalOpts # | |
Show EvalOpts # | |
Binary EvalOpts # | |
type Rep EvalOpts # | |
Defined in GHCi.Message type Rep EvalOpts = D1 ('MetaData "EvalOpts" "GHCi.Message" "ghci-9.2.0.20210331" 'False) (C1 ('MetaCons "EvalOpts" 'PrefixI 'True) ((S1 ('MetaSel ('Just "useSandboxThread") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "singleStep") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "breakOnException") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "breakOnError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) |
We can pass simple expressions to EvalStmt, consisting of values and application. This allows us to wrap the statement to be executed in another function, which is used by GHCi to implement :set args and :set prog. It might be worthwhile to extend this little language in the future.
Instances
Generic (EvalExpr a) # | |
Show a => Show (EvalExpr a) # | |
Binary a => Binary (EvalExpr a) # | |
type Rep (EvalExpr a) # | |
Defined in GHCi.Message type Rep (EvalExpr a) = D1 ('MetaData "EvalExpr" "GHCi.Message" "ghci-9.2.0.20210331" 'False) (C1 ('MetaCons "EvalThis" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "EvalApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EvalExpr a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EvalExpr a)))) |
data SerializableException Source #
Constructors
EUserInterrupt | |
EExitCode ExitCode | |
EOtherException String |
Instances
Constructors
THException String | |
THComplete a |
Instances
Generic (THResult a) # | |
Show a => Show (THResult a) # | |
Binary a => Binary (THResult a) # | |
type Rep (THResult a) # | |
Defined in GHCi.Message type Rep (THResult a) = D1 ('MetaData "THResult" "GHCi.Message" "ghci-9.2.0.20210331" 'False) (C1 ('MetaCons "THException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "THComplete" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) |
data THResultType Source #
Constructors
THExp | |
THPat | |
THType | |
THDec | |
THAnnWrapper |
Instances
data ResumeContext a Source #
Constructors
ResumeContext | |
Fields
|
The server-side Template Haskell state. This is created by the StartTH message. A new one is created per module that GHC typechecks.
Constructors
QState | |
getMessage :: Get Msg Source #
putMessage :: Message a -> Put Source #
getTHMessage :: Get THMsg Source #
putTHMessage :: THMessage a -> Put Source #
Constructors
Pipe | |
Fields
|