| Safe Haskell | Ignore |
|---|---|
| Language | GHC2021 |
GHCi.RemoteTypes
Description
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 :: k) = RemotePtr Word64
- toRemotePtr :: Ptr a -> RemotePtr a
- fromRemotePtr :: RemotePtr a -> Ptr a
- castRemotePtr :: forall {k1} {k2} (a :: k1) (b :: k2). RemotePtr a -> RemotePtr b
- newtype RemoteRef (a :: k) = RemoteRef (RemotePtr ())
- mkRemoteRef :: a -> IO (RemoteRef a)
- localRef :: RemoteRef a -> IO a
- freeRemoteRef :: forall {k} (a :: k). RemoteRef a -> IO ()
- castRemoteRef :: forall {k1} {k2} (a :: k1) (b :: k2). RemoteRef a -> RemoteRef b
- data ForeignRef (a :: k)
- mkForeignRef :: forall {k} (a :: k). RemoteRef a -> IO () -> IO (ForeignRef a)
- withForeignRef :: forall {k} (a :: k) b. ForeignRef a -> (RemoteRef a -> IO b) -> IO b
- finalizeForeignRef :: forall {k} (a :: k). ForeignRef a -> IO ()
- castForeignRef :: forall {k1} {k2} (a :: k1) (b :: k2). ForeignRef a -> ForeignRef b
- unsafeForeignRefToRemoteRef :: forall {k} (a :: k). ForeignRef a -> RemoteRef a
- newtype HValue = HValue (Any :: Type)
- type HValueRef = RemoteRef HValue
- type ForeignHValue = ForeignRef HValue
Remote pointer
toRemotePtr :: Ptr a -> RemotePtr a #
fromRemotePtr :: RemotePtr a -> Ptr a #
castRemotePtr :: forall {k1} {k2} (a :: k1) (b :: k2). RemotePtr a -> RemotePtr b #
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) #
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 #
Convert a RemoteRef to its carried type. Should only be used if the RemoteRef originated in this process.
freeRemoteRef :: forall {k} (a :: k). RemoteRef a -> IO () #
Release a RemoteRef that originated in this process
castRemoteRef :: forall {k1} {k2} (a :: k1) (b :: k2). RemoteRef a -> RemoteRef b #
ForeignRef: RemoteRef with a finalizer
data ForeignRef (a :: k) #
An RemoteRef with a finalizer
Instances
| NFData (ForeignRef a) # | |
Defined in GHCi.RemoteTypes Methods rnf :: ForeignRef a -> () # | |
mkForeignRef :: forall {k} (a :: k). RemoteRef a -> IO () -> IO (ForeignRef a) #
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 :: forall {k} (a :: k) b. ForeignRef a -> (RemoteRef a -> IO b) -> IO b #
Use a ForeignRef
finalizeForeignRef :: forall {k} (a :: k). ForeignRef a -> IO () #
castForeignRef :: forall {k1} {k2} (a :: k1) (b :: k2). ForeignRef a -> ForeignRef b #
unsafeForeignRefToRemoteRef :: forall {k} (a :: k). ForeignRef a -> RemoteRef a #
HValue
type ForeignHValue = ForeignRef HValue #