capnp-0.4.0.0: Cap'n Proto for Haskell

Safe HaskellNone
LanguageHaskell2010

Capnp.GenHelpers.Rpc

Description

This module defines various helpers used by generated code. Users of the library are not expected to use this module directly.

Synopsis

Documentation

isClientFromPtr :: (IsClient a, ReadCtx m msg) => msg -> Maybe (Ptr msg) -> m a Source #

A valid implementation of fromPtr for any type that implements IsClient.

GHC gets very confused if we try to just define a single instance IsClient a => FromPtr msg a, so instead we define this helper function and emit a trivial instance for each type from the code generator.

isClientToPtr :: (IsClient a, WriteCtx m s) => MutMsg s -> a -> m (Maybe (Ptr (MutMsg s))) Source #

A valid implementation of toPtr for any type that implements IsClient.

See the notes for isClientFromPtr.