Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types for referring to remote objects in Remote GHCi. For more details, see Note [External GHCi pointers] in compilerGHCRuntime/Interpreter.hs
For details on Remote GHCi, see Note [Remote GHCi] in compilerGHCRuntime/Interpreter.hs.
Synopsis
- newtype RemotePtr a = RemotePtr Word64
- toRemotePtr :: Ptr a -> RemotePtr a
- fromRemotePtr :: RemotePtr a -> Ptr a
- castRemotePtr :: RemotePtr a -> RemotePtr b
- newtype RemoteRef a = RemoteRef (RemotePtr ())
- mkRemoteRef :: a -> IO (RemoteRef a)
- localRef :: RemoteRef a -> IO a
- freeRemoteRef :: RemoteRef a -> IO ()
- castRemoteRef :: RemoteRef a -> RemoteRef b
- data ForeignRef a
- mkForeignRef :: RemoteRef a -> IO () -> IO (ForeignRef a)
- withForeignRef :: ForeignRef a -> (RemoteRef a -> IO b) -> IO b
- finalizeForeignRef :: ForeignRef a -> IO ()
- castForeignRef :: ForeignRef a -> ForeignRef b
- unsafeForeignRefToRemoteRef :: ForeignRef a -> RemoteRef a
- newtype HValue = HValue (Any :: Type)
- type HValueRef = RemoteRef HValue
- type ForeignHValue = ForeignRef HValue
Remote pointer
toRemotePtr :: Ptr a -> RemotePtr a Source #
fromRemotePtr :: RemotePtr a -> Ptr a Source #
castRemotePtr :: RemotePtr a -> RemotePtr b Source #
RemoteRef: reference to some heap object (potentially remote)
A reference to a heap object. Potentially in a remote heap! These are allocated and freed explicitly.
mkRemoteRef :: a -> IO (RemoteRef a) Source #
Make a reference to a local value that we can send remotely.
This reference will keep the value that it refers to alive until
freeRemoteRef
is called.
localRef :: RemoteRef a -> IO a Source #
Convert a RemoteRef to its carried type. Should only be used if the RemoteRef originated in this process.
freeRemoteRef :: RemoteRef a -> IO () Source #
Release a RemoteRef that originated in this process
castRemoteRef :: RemoteRef a -> RemoteRef b Source #
ForeignRef: RemoteRef with a finalizer
data ForeignRef a Source #
An RemoteRef with a finalizer
Instances
NFData (ForeignRef a) Source # | |
Defined in GHCi.RemoteTypes rnf :: ForeignRef a -> () Source # |
mkForeignRef :: RemoteRef a -> IO () -> IO (ForeignRef a) Source #
Create a ForeignRef
from a RemoteRef
. The finalizer
should arrange to call freeRemoteRef
on the RemoteRef
. (since
this function needs to be called in the process that created the
RemoteRef
, it cannot be called directly from the finalizer).
withForeignRef :: ForeignRef a -> (RemoteRef a -> IO b) -> IO b Source #
Use a ForeignRef
finalizeForeignRef :: ForeignRef a -> IO () Source #
castForeignRef :: ForeignRef a -> ForeignRef b Source #
unsafeForeignRefToRemoteRef :: ForeignRef a -> RemoteRef a Source #
HValue
type ForeignHValue = ForeignRef HValue Source #