Safe Haskell | None |
---|---|
Language | Haskell2010 |
GHCi.RemoteTypes
- newtype RemotePtr a = RemotePtr Word64
- toRemotePtr :: Ptr a -> RemotePtr a
- fromRemotePtr :: RemotePtr a -> Ptr a
- castRemotePtr :: RemotePtr a -> RemotePtr b
- newtype HValue = HValue Any
- data RemoteRef a
- mkRemoteRef :: a -> IO (RemoteRef a)
- localRef :: RemoteRef a -> IO a
- freeRemoteRef :: RemoteRef a -> IO ()
- type HValueRef = RemoteRef HValue
- toHValueRef :: RemoteRef a -> RemoteRef HValue
- data ForeignRef a
- mkForeignRef :: RemoteRef a -> IO () -> IO (ForeignRef a)
- withForeignRef :: ForeignRef a -> (RemoteRef a -> IO b) -> IO b
- type ForeignHValue = ForeignRef HValue
- unsafeForeignRefToRemoteRef :: ForeignRef a -> RemoteRef a
- finalizeForeignRef :: ForeignRef a -> IO ()
Documentation
toRemotePtr :: Ptr a -> RemotePtr a Source
fromRemotePtr :: RemotePtr a -> Ptr a Source
castRemotePtr :: RemotePtr a -> RemotePtr b Source
A reference to a remote value. 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 an HValueRef to an HValue. Should only be used if the HValue originated in this process.
freeRemoteRef :: RemoteRef a -> IO () Source
Release an HValueRef that originated in this process
toHValueRef :: RemoteRef a -> RemoteRef HValue Source
data ForeignRef a Source
An HValueRef with a finalizer
mkForeignRef :: RemoteRef a -> IO () -> IO (ForeignRef a) Source
Create a ForeignRef
from a RemoteRef
. The finalizer
should arrange to call freeHValueRef
on the HValueRef
. (since
this function needs to be called in the process that created the
HValueRef
, it cannot be called directly from the finalizer).
withForeignRef :: ForeignRef a -> (RemoteRef a -> IO b) -> IO b Source
Use a ForeignHValue
type ForeignHValue = ForeignRef HValue Source
unsafeForeignRefToRemoteRef :: ForeignRef a -> RemoteRef a Source
finalizeForeignRef :: ForeignRef a -> IO () Source