ribosome-host-0.9.9.9: Neovim plugin host for Polysemy
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ribosome.Host.Data.RpcCall

Description

Applicative sequencing for RPC requests

Synopsis

Documentation

data RpcCall a where Source #

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 RpcCalls 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)

Constructors

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 

Instances

Instances details
Applicative RpcCall Source # 
Instance details

Defined in Ribosome.Host.Data.RpcCall

Methods

pure :: a -> RpcCall a #

(<*>) :: RpcCall (a -> b) -> RpcCall a -> RpcCall b #

liftA2 :: (a -> b -> c) -> RpcCall a -> RpcCall b -> RpcCall c #

(*>) :: RpcCall a -> RpcCall b -> RpcCall b #

(<*) :: RpcCall a -> RpcCall b -> RpcCall a #

Functor RpcCall Source # 
Instance details

Defined in Ribosome.Host.Data.RpcCall

Methods

fmap :: (a -> b) -> RpcCall a -> RpcCall b #

(<$) :: a -> RpcCall b -> RpcCall a #

Monoid a => Monoid (RpcCall a) Source # 
Instance details

Defined in Ribosome.Host.Data.RpcCall

Methods

mempty :: RpcCall a #

mappend :: RpcCall a -> RpcCall a -> RpcCall a #

mconcat :: [RpcCall a] -> RpcCall a #

Semigroup a => Semigroup (RpcCall a) Source # 
Instance details

Defined in Ribosome.Host.Data.RpcCall

Methods

(<>) :: RpcCall a -> RpcCall a -> RpcCall a #

sconcat :: NonEmpty (RpcCall a) -> RpcCall a #

stimes :: Integral b => b -> RpcCall a -> RpcCall a #