| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.GRPC.Client.StreamType.CanCallRPC
Contents
Description
Like Network.GRPC.Client.StreamType.IO, but with an implicit Connection
These functions are useful in a monad stack in which the Connection object
is implicitly available; you must provide an instance of CanCallRPC.
Synopsis
- class (MonadIO m, MonadMask m) => CanCallRPC (m :: Type -> Type) where
- getConnection :: m Connection
- nonStreaming :: forall {k} (rpc :: k) m. ClientHandler' 'NonStreaming m rpc -> Input rpc -> m (Output rpc)
- clientStreaming :: forall {k} (rpc :: k) m r. ClientHandler' 'ClientStreaming m rpc -> ((NextElem (Input rpc) -> IO ()) -> m r) -> m (Output rpc, r)
- clientStreaming_ :: forall {k} (rpc :: k) m. Functor m => ClientHandler' 'ClientStreaming m rpc -> ((NextElem (Input rpc) -> IO ()) -> m ()) -> m (Output rpc)
- serverStreaming :: forall {k} (rpc :: k) m r. Functor m => ClientHandler' 'ServerStreaming m rpc -> Input rpc -> (IO (NextElem (Output rpc)) -> m r) -> m r
- biDiStreaming :: forall {k} (rpc :: k) m r. Functor m => ClientHandler' 'BiDiStreaming m rpc -> ((NextElem (Input rpc) -> IO ()) -> IO (NextElem (Output rpc)) -> m r) -> m r
Documentation
class (MonadIO m, MonadMask m) => CanCallRPC (m :: Type -> Type) where Source #
Monads in which we make RPC calls
In order to be able to make an RPC call, we need
MonadIO(obviously)MonadMaskin order to ensure that the RPC call is terminated cleanly- Access to the
Connectionto the server
Methods
getConnection :: m Connection Source #
Instances
| (MonadIO m, MonadMask m) => CanCallRPC (ReaderT Connection m) Source # | |
Defined in Network.GRPC.Client.StreamType Methods | |
Running client handlers
nonStreaming :: forall {k} (rpc :: k) m. ClientHandler' 'NonStreaming m rpc -> Input rpc -> m (Output rpc) Source #
Execute non-streaming handler in any monad stack
clientStreaming :: forall {k} (rpc :: k) m r. ClientHandler' 'ClientStreaming m rpc -> ((NextElem (Input rpc) -> IO ()) -> m r) -> m (Output rpc, r) Source #
Generalization of clientStreaming_ with an additional result
clientStreaming_ :: forall {k} (rpc :: k) m. Functor m => ClientHandler' 'ClientStreaming m rpc -> ((NextElem (Input rpc) -> IO ()) -> m ()) -> m (Output rpc) Source #
Execute client-side streaming handler in any monad stack
serverStreaming :: forall {k} (rpc :: k) m r. Functor m => ClientHandler' 'ServerStreaming m rpc -> Input rpc -> (IO (NextElem (Output rpc)) -> m r) -> m r Source #
Execute server-side streaming handler in any monad stack