GHCi.Message

ghci-8.0.2: The library supporting GHC's interactive interpreter

Safe Haskell | None
Language | Haskell2010

GHCi.Message

Contents

- Orphan instances

Synopsis

- data Message a where
  - Shutdown :: 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 ()
  - MallocData :: ByteString -> Message (RemotePtr ())
  - MallocStrings :: [ByteString] -> Message [RemotePtr ()]
  - PrepFFI :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)
  - FreeFFI :: RemotePtr C_ffi_cif -> Message ()
  - MkConInfoTable :: Int -> Int -> Int -> Int -> [Word8] -> 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)
  - EnableBreakpoint :: RemoteRef BreakArray -> Int -> Bool -> 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 ByteString
  - NewName :: String -> Message (THResult Name)
  - Report :: Bool -> String -> Message (THResult ())
  - LookupName :: Bool -> String -> Message (THResult (Maybe Name))
  - Reify :: Name -> Message (THResult Info)
  - ReifyFixity :: Name -> Message (THResult (Maybe Fixity))
  - ReifyInstances :: Name -> [Type] -> Message (THResult [Dec])
  - ReifyRoles :: Name -> Message (THResult [Role])
  - ReifyAnnotations :: AnnLookup -> TypeRep -> Message (THResult [ByteString])
  - ReifyModule :: Module -> Message (THResult ModuleInfo)
  - ReifyConStrictness :: Name -> Message (THResult [DecidedStrictness])
  - RunModFinalizers :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (THResult ())
  - AddDependentFile :: FilePath -> Message (THResult ())
  - AddModFinalizer :: RemoteRef (Q ()) -> Message (THResult ())
  - AddTopDecls :: [Dec] -> Message (THResult ())
  - IsExtEnabled :: Extension -> Message (THResult Bool)
  - ExtsEnabled :: Message (THResult [Extension])
  - StartRecover :: Message ()
  - EndRecover :: Bool -> Message ()
  - QDone :: Message ()
  - QException :: String -> Message ()
  - QFail :: String -> Message ()
- data Msg = (Binary a, Show a) => Msg (Message a)
- 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
  - = EvalException SerializableException
  - | EvalSuccess a
- data EvalOpts = EvalOpts {
  - useSandboxThread :: Bool
  - singleStep :: Bool
  - breakOnException :: Bool
  - breakOnError :: Bool
  }
- data EvalExpr a
  - = EvalThis a
  - | EvalApp (EvalExpr a) (EvalExpr a)
- data SerializableException
  - = EUserInterrupt
  - | EExitCode ExitCode
  - | EOtherException String
- 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 {
  - qsMap :: Map TypeRep Dynamic
  - qsLocation :: Maybe Loc
  - qsPipe :: Pipe
  }
- getMessage :: Get Msg
- putMessage :: Message a -> Put
- data Pipe = Pipe {
  - pipeRead :: Handle
  - pipeWrite :: Handle
  - pipeLeftovers :: IORef (Maybe ByteString)
  }
- remoteCall :: Binary a => Pipe -> Message a -> IO a
- readPipe :: Pipe -> Get a -> IO a
- writePipe :: Pipe -> Put -> IO ()

# Documentation

data Message a where Source #

A `Message a` is a message that returns a value of type `a`

Constructors

Shutdown :: Message () | Exit the iserv process
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
FreeHValueRefs :: [HValueRef] -> Message () | Release `HValueRef`s
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 :: Int -> Int -> Int -> Int -> [Word8] -> 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
EnableBreakpoint :: RemoteRef BreakArray -> Int -> Bool -> Message () | Enable a breakpoint
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 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.
NewName :: String -> Message (THResult Name) |
Report :: Bool -> String -> Message (THResult ()) |
LookupName :: Bool -> String -> Message (THResult (Maybe Name)) |
Reify :: Name -> Message (THResult Info) |
ReifyFixity :: Name -> Message (THResult (Maybe Fixity)) |
ReifyInstances :: Name -> [Type] -> Message (THResult [Dec]) |
ReifyRoles :: Name -> Message (THResult [Role]) |
ReifyAnnotations :: AnnLookup -> TypeRep -> Message (THResult [ByteString]) |
ReifyModule :: Module -> Message (THResult ModuleInfo) |
ReifyConStrictness :: Name -> Message (THResult [DecidedStrictness]) |
RunModFinalizers :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (THResult ()) | Run the given mod finalizers.
AddDependentFile :: FilePath -> Message (THResult ()) |
AddModFinalizer :: RemoteRef (Q ()) -> Message (THResult ()) |
AddTopDecls :: [Dec] -> Message (THResult ()) |
IsExtEnabled :: Extension -> Message (THResult Bool) |
ExtsEnabled :: Message (THResult [Extension]) |
StartRecover :: Message () |
EndRecover :: Bool -> Message () |
QDone :: Message () | RunTH finished successfully; return value follows
QException :: String -> Message () | RunTH threw an exception
QFail :: String -> Message () | RunTH called `fail`

Instances

Show (Message a) # |
Methods showsPrec :: Int -> Message a -> ShowS Source # show :: Message a -> String Source # showList :: [Message a] -> ShowS Source #

data Msg Source #

Constructors

(Binary a, Show a) => Msg (Message a) |

data EvalStatus_ a b Source #

Constructors

EvalComplete Word64 (EvalResult a) |
EvalBreak Bool HValueRef Int Int (RemoteRef (ResumeContext b)) (RemotePtr CostCentreStack) |

Instances

Show a => Show (EvalStatus_ a b) # |
Methods showsPrec :: Int -> EvalStatus_ a b -> ShowS Source # show :: EvalStatus_ a b -> String Source # showList :: [EvalStatus_ a b] -> ShowS Source #
Generic (EvalStatus_ a b) # |
Associated Types type Rep (EvalStatus_ a b) :: * -> * Source # Methods from :: EvalStatus_ a b -> Rep (EvalStatus_ a b) x Source # to :: Rep (EvalStatus_ a b) x -> EvalStatus_ a b Source #
Binary a => Binary (EvalStatus_ a b) # |
Methods put :: EvalStatus_ a b -> Put Source # get :: Get (EvalStatus_ a b) Source # putList :: [EvalStatus_ a b] -> Put Source #
type Rep (EvalStatus_ a b) # |
type Rep (EvalStatus_ a b) = D1 (MetaData "EvalStatus_" "GHCi.Message" "ghci-8.0.2" False) ((:+:) (C1 (MetaCons "EvalComplete" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (EvalResult a))))) (C1 (MetaCons "EvalBreak" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 HValueRef)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (RemoteRef (ResumeContext b)))) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (RemotePtr CostCentreStack))))))))

type EvalStatus a = EvalStatus_ a a Source #

data EvalResult a Source #

Constructors

EvalException SerializableException |
EvalSuccess a |

Instances

Show a => Show (EvalResult a) # |
Methods showsPrec :: Int -> EvalResult a -> ShowS Source # show :: EvalResult a -> String Source # showList :: [EvalResult a] -> ShowS Source #
Generic (EvalResult a) # |
Associated Types type Rep (EvalResult a) :: * -> * Source # Methods from :: EvalResult a -> Rep (EvalResult a) x Source # to :: Rep (EvalResult a) x -> EvalResult a Source #
Binary a => Binary (EvalResult a) # |
Methods put :: EvalResult a -> Put Source # get :: Get (EvalResult a) Source # putList :: [EvalResult a] -> Put Source #
type Rep (EvalResult a) # |
type Rep (EvalResult a) = D1 (MetaData "EvalResult" "GHCi.Message" "ghci-8.0.2" False) ((:+:) (C1 (MetaCons "EvalException" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SerializableException))) (C1 (MetaCons "EvalSuccess" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))))

data EvalOpts Source #

Constructors

EvalOpts |
Fields useSandboxThread :: Bool singleStep :: Bool breakOnException :: Bool breakOnError :: Bool

Instances

Show EvalOpts # |
Methods showsPrec :: Int -> EvalOpts -> ShowS Source # show :: EvalOpts -> String Source # showList :: [EvalOpts] -> ShowS Source #
Generic EvalOpts # |
Associated Types type Rep EvalOpts :: * -> * Source # Methods from :: EvalOpts -> Rep EvalOpts x Source # to :: Rep EvalOpts x -> EvalOpts Source #
Binary EvalOpts # |
Methods put :: EvalOpts -> Put Source # get :: Get EvalOpts Source # putList :: [EvalOpts] -> Put Source #
type Rep EvalOpts # |
type Rep EvalOpts = D1 (MetaData "EvalOpts" "GHCi.Message" "ghci-8.0.2" False) (C1 (MetaCons "EvalOpts" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "useSandboxThread") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "singleStep") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) ((:*:) (S1 (MetaSel (Just Symbol "breakOnException") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "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

Show a => Show (EvalExpr a) # |
Methods showsPrec :: Int -> EvalExpr a -> ShowS Source # show :: EvalExpr a -> String Source # showList :: [EvalExpr a] -> ShowS Source #
Generic (EvalExpr a) # |
Associated Types type Rep (EvalExpr a) :: * -> * Source # Methods from :: EvalExpr a -> Rep (EvalExpr a) x Source # to :: Rep (EvalExpr a) x -> EvalExpr a Source #
Binary a => Binary (EvalExpr a) # |
Methods put :: EvalExpr a -> Put Source # get :: Get (EvalExpr a) Source # putList :: [EvalExpr a] -> Put Source #
type Rep (EvalExpr a) # |
type Rep (EvalExpr a) = D1 (MetaData "EvalExpr" "GHCi.Message" "ghci-8.0.2" False) ((:+:) (C1 (MetaCons "EvalThis" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) (C1 (MetaCons "EvalApp" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (EvalExpr a))) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (EvalExpr a))))))

data SerializableException Source #

Constructors

EUserInterrupt |
EExitCode ExitCode |
EOtherException String |

Instances

Show SerializableException # |
Methods showsPrec :: Int -> SerializableException -> ShowS Source # show :: SerializableException -> String Source # showList :: [SerializableException] -> ShowS Source #
Generic SerializableException # |
Associated Types type Rep SerializableException :: * -> * Source # Methods from :: SerializableException -> Rep SerializableException x Source # to :: Rep SerializableException x -> SerializableException Source #
Binary SerializableException # |
Methods put :: SerializableException -> Put Source # get :: Get SerializableException Source # putList :: [SerializableException] -> Put Source #
type Rep SerializableException # |
type Rep SerializableException = D1 (MetaData "SerializableException" "GHCi.Message" "ghci-8.0.2" False) ((:+:) (C1 (MetaCons "EUserInterrupt" PrefixI False) U1) ((:+:) (C1 (MetaCons "EExitCode" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ExitCode))) (C1 (MetaCons "EOtherException" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))))

data THResult a Source #

Constructors

THException String |
THComplete a |

Instances

Show a => Show (THResult a) # |
Methods showsPrec :: Int -> THResult a -> ShowS Source # show :: THResult a -> String Source # showList :: [THResult a] -> ShowS Source #
Generic (THResult a) # |
Associated Types type Rep (THResult a) :: * -> * Source # Methods from :: THResult a -> Rep (THResult a) x Source # to :: Rep (THResult a) x -> THResult a Source #
Binary a => Binary (THResult a) # |
Methods put :: THResult a -> Put Source # get :: Get (THResult a) Source # putList :: [THResult a] -> Put Source #
type Rep (THResult a) # |
type Rep (THResult a) = D1 (MetaData "THResult" "GHCi.Message" "ghci-8.0.2" False) ((:+:) (C1 (MetaCons "THException" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) (C1 (MetaCons "THComplete" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))))

data THResultType Source #

Constructors

THExp |
THPat |
THType |
THDec |
THAnnWrapper |

Instances

Enum THResultType # |
Methods succ :: THResultType -> THResultType Source # pred :: THResultType -> THResultType Source # toEnum :: Int -> THResultType Source # fromEnum :: THResultType -> Int Source # enumFrom :: THResultType -> [THResultType] Source # enumFromThen :: THResultType -> THResultType -> [THResultType] Source # enumFromTo :: THResultType -> THResultType -> [THResultType] Source # enumFromThenTo :: THResultType -> THResultType -> THResultType -> [THResultType] Source #
Show THResultType # |
Methods showsPrec :: Int -> THResultType -> ShowS Source # show :: THResultType -> String Source # showList :: [THResultType] -> ShowS Source #
Generic THResultType # |
Associated Types type Rep THResultType :: * -> * Source # Methods from :: THResultType -> Rep THResultType x Source # to :: Rep THResultType x -> THResultType Source #
Binary THResultType # |
Methods put :: THResultType -> Put Source # get :: Get THResultType Source # putList :: [THResultType] -> Put Source #
type Rep THResultType # |
type Rep THResultType = D1 (MetaData "THResultType" "GHCi.Message" "ghci-8.0.2" False) ((:+:) ((:+:) (C1 (MetaCons "THExp" PrefixI False) U1) (C1 (MetaCons "THPat" PrefixI False) U1)) ((:+:) (C1 (MetaCons "THType" PrefixI False) U1) ((:+:) (C1 (MetaCons "THDec" PrefixI False) U1) (C1 (MetaCons "THAnnWrapper" PrefixI False) U1))))

data ResumeContext a Source #

Constructors

ResumeContext |
Fields resumeBreakMVar :: MVar () resumeStatusMVar :: MVar (EvalStatus a) resumeThreadId :: ThreadId

data QState Source #

Constructors

QState |
Fields qsMap :: Map TypeRep Dynamic persistent data between splices in a module qsLocation :: Maybe Loc location for current splice, if any qsPipe :: Pipe pipe to communicate with GHC

Instances

Show QState # |
Methods showsPrec :: Int -> QState -> ShowS Source # show :: QState -> String Source # showList :: [QState] -> ShowS Source #

getMessage :: Get Msg Source #

putMessage :: Message a -> Put Source #

data Pipe Source #

Constructors

Pipe |
Fields pipeRead :: Handle pipeWrite :: Handle pipeLeftovers :: IORef (Maybe ByteString)

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 # |
Methods put :: ExitCode -> Put Source # get :: Get ExitCode Source # putList :: [ExitCode] -> Put Source #