capnp-0.7.0.0: Cap'n Proto for Haskell

Safe HaskellNone
LanguageHaskell2010

Capnp.Rpc.Invoke

Contents

Description

Support for invoking MethodHandlers

Synopsis

Using high-level representations

invokePurePromise :: InvokePureCtx m p r => MethodHandler m p r -> p -> m (Promise r) Source #

Like invokePure, but returns a promise instead of accepting a fulfiller.

(?) :: InvokePureCtx m p r => MethodHandler m p r -> p -> m (Promise r) Source #

invokePure :: InvokePureCtx m p r => MethodHandler m p r -> p -> Fulfiller r -> m () Source #

Like invokeRaw, but uses the high-level representations of the data types.

type InvokePureCtx m p r = (MonadThrow m, MonadSTM m, PrimMonad m, Decerialize r, ToStruct ConstMsg (Cerial ConstMsg p), ToStruct (MutMsg (PrimState m)) (Cerial (MutMsg (PrimState m)) p), Cerialize p, FromPtr ConstMsg (Cerial ConstMsg r)) Source #

Shorthand for class contstraints needed to invoke a method using the high-level API.

Using low level representations

invokeRaw :: (MonadThrow m, MonadSTM m, PrimMonad m, Decerialize r, Decerialize p, ToStruct ConstMsg (Cerial ConstMsg p), FromPtr ConstMsg (Cerial ConstMsg r)) => MethodHandler m p r -> Cerial ConstMsg p -> Fulfiller (Cerial ConstMsg r) -> m () Source #

Invoke a method by passing it the low-level representation of its parameter, and a Fulfiller that can be used to supply (the low-level representation of) its return value.