GHCi.RemoteTypes

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

Safe Haskell | None
Language | Haskell2010

GHCi.RemoteTypes

Description

Types for referring to remote objects in Remote GHCi. For more details, see Note [External GHCi pointers] in compilerghciGHCi.hs

For details on Remote GHCi, see Note [Remote GHCi] in compilerghciGHCi.hs.

Synopsis

- 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

newtype RemotePtr a #

Constructors

RemotePtr Word64 |

Instances

Show (RemotePtr a) # |
Instance details Defined in GHCi.RemoteTypes Methods showsPrec :: Int -> RemotePtr a -> ShowS Source # show :: RemotePtr a -> String Source # showList :: [RemotePtr a] -> ShowS Source #
Binary (RemotePtr a) # |
Instance details Defined in GHCi.RemoteTypes Methods put :: RemotePtr a -> Put Source # get :: Get (RemotePtr a) Source # putList :: [RemotePtr a] -> Put Source #
NFData (RemotePtr a) # |
Instance details Defined in GHCi.RemoteTypes Methods rnf :: RemotePtr a -> () Source #

toRemotePtr :: Ptr a -> RemotePtr a #

fromRemotePtr :: RemotePtr a -> Ptr a #

castRemotePtr :: RemotePtr a -> RemotePtr b #

newtype HValue #

Constructors

HValue Any |

Instances

Show HValue # |
Instance details Defined in GHCi.RemoteTypes Methods showsPrec :: Int -> HValue -> ShowS Source # show :: HValue -> String Source # showList :: [HValue] -> ShowS Source #

data RemoteRef a #

A reference to a remote value. These are allocated and freed explicitly.

Instances

Show (RemoteRef a) # |
Instance details Defined in GHCi.RemoteTypes Methods showsPrec :: Int -> RemoteRef a -> ShowS Source # show :: RemoteRef a -> String Source # showList :: [RemoteRef a] -> ShowS Source #
Binary (RemoteRef a) # |
Instance details Defined in GHCi.RemoteTypes Methods put :: RemoteRef a -> Put Source # get :: Get (RemoteRef a) Source # putList :: [RemoteRef a] -> Put Source #

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 an HValueRef to an HValue. Should only be used if the HValue originated in this process.

freeRemoteRef :: RemoteRef a -> IO () #

Release an HValueRef that originated in this process

type HValueRef = RemoteRef HValue #

toHValueRef :: RemoteRef a -> RemoteRef HValue #

data ForeignRef a #

An HValueRef with a finalizer

Instances

NFData (ForeignRef a) # |
Instance details Defined in GHCi.RemoteTypes Methods rnf :: ForeignRef a -> () Source #

mkForeignRef :: RemoteRef a -> IO () -> IO (ForeignRef a) #

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 #

Use a `ForeignHValue`

type ForeignHValue = ForeignRef HValue #

unsafeForeignRefToRemoteRef :: ForeignRef a -> RemoteRef a #

finalizeForeignRef :: ForeignRef a -> IO () #