ghci-9.5: The library supporting GHC's interactive interpreter
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHCi.Message

Description

Remote GHCi message types and serialization.

For details on Remote GHCi, see Note [Remote GHCi] in compilerGHCRuntime/Interpreter.hs.

Synopsis

Documentation

data Message a where Source #

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 createBCOs in compilerGHCRuntime/Interpreter.hs.

FreeHValueRefs :: [HValueRef] -> Message ()

Release HValueRefs

AddSptEntry :: Fingerprint -> HValueRef -> Message ()

Add entries to the Static Pointer Table

MallocData :: ByteString -> Message (RemotePtr ())

Malloc some data and return a RemotePtr to it

MallocStrings :: [ByteString] -> Message [RemotePtr ()] 
PrepFFI :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)

Calls prepareForeignCall

FreeFFI :: RemotePtr C_ffi_cif -> Message ()

Free data previously created by PrepFFI

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 IO String

EvalStringToString :: HValueRef -> String -> Message (EvalResult String)

Evaluate something of type String -> IO String

EvalIO :: HValueRef -> Message (EvalResult ())

Evaluate something of type IO ()

MkCostCentres :: String -> [(String, String)] -> Message [RemotePtr CostCentre]

Create a set of CostCentres with the same module name

CostCentreStackInfo :: RemotePtr CostCentreStack -> Message [String]

Show a CostCentreStack as a [String]

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)

Instances

Instances details
Show (Message a) Source # 
Instance details

Defined in GHCi.Message

data Msg Source #

Constructors

forall a.(Binary a, Show a) => Msg (Message a) 

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

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]) 
GetPackageRoot :: THMessage (THResult FilePath) 
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 ()

Indicates that this RunTH is finished, and the next message will be the result of RunTH (a QResult).

Instances

Instances details
Show (THMessage a) Source # 
Instance details

Defined in GHCi.Message

data THMsg Source #

Constructors

forall a.(Binary a, Show a) => THMsg (THMessage a) 

data QResult a Source #

Template Haskell return values

Constructors

QDone a

RunTH finished successfully; return value follows

QException String

RunTH threw an exception

QFail String

RunTH called fail

Instances

Instances details
Generic (QResult a) Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep (QResult a) :: Type -> Type Source #

Methods

from :: QResult a -> Rep (QResult a) x Source #

to :: Rep (QResult a) x -> QResult a Source #

Show a => Show (QResult a) Source # 
Instance details

Defined in GHCi.Message

Binary a => Binary (QResult a) Source # 
Instance details

Defined in GHCi.Message

Methods

put :: QResult a -> Put Source #

get :: Get (QResult a) Source #

putList :: [QResult a] -> Put Source #

type Rep (QResult a) Source # 
Instance details

Defined in GHCi.Message

data EvalStatus_ a b Source #

Instances

Instances details
Generic (EvalStatus_ a b) Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep (EvalStatus_ a b) :: Type -> Type Source #

Methods

from :: EvalStatus_ a b -> Rep (EvalStatus_ a b) x Source #

to :: Rep (EvalStatus_ a b) x -> EvalStatus_ a b Source #

Show a => Show (EvalStatus_ a b) Source # 
Instance details

Defined in GHCi.Message

Binary a => Binary (EvalStatus_ a b) Source # 
Instance details

Defined in GHCi.Message

type Rep (EvalStatus_ a b) Source # 
Instance details

Defined in GHCi.Message

data EvalResult a Source #

Instances

Instances details
Generic (EvalResult a) Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep (EvalResult a) :: Type -> Type Source #

Methods

from :: EvalResult a -> Rep (EvalResult a) x Source #

to :: Rep (EvalResult a) x -> EvalResult a Source #

Show a => Show (EvalResult a) Source # 
Instance details

Defined in GHCi.Message

Binary a => Binary (EvalResult a) Source # 
Instance details

Defined in GHCi.Message

type Rep (EvalResult a) Source # 
Instance details

Defined in GHCi.Message

data EvalOpts Source #

Instances

Instances details
Generic EvalOpts Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep EvalOpts :: Type -> Type Source #

Show EvalOpts Source # 
Instance details

Defined in GHCi.Message

Binary EvalOpts Source # 
Instance details

Defined in GHCi.Message

type Rep EvalOpts Source # 
Instance details

Defined in GHCi.Message

type Rep EvalOpts = D1 ('MetaData "EvalOpts" "GHCi.Message" "ghci-9.5" '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))))

data EvalExpr a Source #

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.

Constructors

EvalThis a 
EvalApp (EvalExpr a) (EvalExpr a) 

Instances

Instances details
Generic (EvalExpr a) Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep (EvalExpr a) :: Type -> Type Source #

Methods

from :: EvalExpr a -> Rep (EvalExpr a) x Source #

to :: Rep (EvalExpr a) x -> EvalExpr a Source #

Show a => Show (EvalExpr a) Source # 
Instance details

Defined in GHCi.Message

Binary a => Binary (EvalExpr a) Source # 
Instance details

Defined in GHCi.Message

type Rep (EvalExpr a) Source # 
Instance details

Defined in GHCi.Message

data THResult a Source #

Constructors

THException String 
THComplete a 

Instances

Instances details
Generic (THResult a) Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep (THResult a) :: Type -> Type Source #

Methods

from :: THResult a -> Rep (THResult a) x Source #

to :: Rep (THResult a) x -> THResult a Source #

Show a => Show (THResult a) Source # 
Instance details

Defined in GHCi.Message

Binary a => Binary (THResult a) Source # 
Instance details

Defined in GHCi.Message

type Rep (THResult a) Source # 
Instance details

Defined in GHCi.Message

data THResultType Source #

Constructors

THExp 
THPat 
THType 
THDec 
THAnnWrapper 

Instances

Instances details
Enum THResultType Source # 
Instance details

Defined in GHCi.Message

Generic THResultType Source # 
Instance details

Defined in GHCi.Message

Associated Types

type Rep THResultType :: Type -> Type Source #

Show THResultType Source # 
Instance details

Defined in GHCi.Message

Binary THResultType Source # 
Instance details

Defined in GHCi.Message

type Rep THResultType Source # 
Instance details

Defined in GHCi.Message

type Rep THResultType = D1 ('MetaData "THResultType" "GHCi.Message" "ghci-9.5" 'False) ((C1 ('MetaCons "THExp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "THPat" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "THType" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "THDec" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "THAnnWrapper" 'PrefixI 'False) (U1 :: Type -> Type))))

data QState Source #

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 

Fields

Instances

Instances details
Show QState Source # 
Instance details

Defined in GHCi.Message

remoteCall :: Binary a => Pipe -> Message a -> IO a Source #

readPipe :: Pipe -> Get a -> IO a Source #

writePipe :: Pipe -> Put -> IO () Source #

Orphan instances

Binary ExitCode Source # 
Instance details

Binary ClosureType Source # 
Instance details

Binary PrimType Source # 
Instance details

Binary TsoFlags Source # 
Instance details

Binary WhatNext Source # 
Instance details

Binary WhyBlocked Source # 
Instance details

Binary StgInfoTable Source # 
Instance details

Binary CostCentre Source # 
Instance details

Binary CostCentreStack Source # 
Instance details

Binary IndexTable Source # 
Instance details

Binary StgTSOProfInfo Source # 
Instance details

Binary (FunPtr a) Source # 
Instance details

Methods

put :: FunPtr a -> Put Source #

get :: Get (FunPtr a) Source #

putList :: [FunPtr a] -> Put Source #

Binary (Ptr a) Source # 
Instance details

Methods

put :: Ptr a -> Put Source #

get :: Get (Ptr a) Source #

putList :: [Ptr a] -> Put Source #

Binary a => Binary (GenClosure a) Source # 
Instance details