Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Applicative sequencing for RPC requests
Documentation
A wrapper for Request
that allows applicative sequencing of calls for batch processing, used for a declarative
representation of the Neovim API.
Neovim has an API function named nvim_call_atomic
that makes it possible to send multiple RPC requests at once,
reducing the communcation overhead.
Applicative sequences of RpcCall
s are automatically batched into a single call by Rpc
.
This can be combined neatly with ApplicativeDo
:
import Ribosome import qualified Ribosome.Api.Data as Api sync do a :: Int <- Api.nvimGetVar "number1" b :: Int <- Api.nvimGetVar "number2" pure (a + b)
RpcCallRequest :: MsgpackDecode a => Request -> RpcCall a | |
RpcPure :: a -> RpcCall a | |
RpcFmap :: (a -> b) -> RpcCall a -> RpcCall b | |
RpcAtomic :: (a -> b -> c) -> RpcCall a -> RpcCall b -> RpcCall c |