capnp-0.11.0.0: Cap'n Proto for Haskell
Safe HaskellNone
LanguageHaskell2010

Capnp.Rpc.Invoke

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 'Const (Cerial 'Const p), ToStruct ('Mut (PrimState m)) (Cerial ('Mut (PrimState m)) p), Cerialize (PrimState m) p, FromPtr 'Const (Cerial 'Const 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 'Const (Cerial 'Const p), FromPtr 'Const (Cerial 'Const r)) => MethodHandler m p r -> Cerial 'Const p -> Fulfiller (Cerial 'Const 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.