| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Ribosome.Host.Data.RpcHandler
Synopsis
- type Handler r a = Sem (Stop Report ': r) a
- type RpcHandlerFun r = [Object] -> Handler r Object
- data RpcHandler r = RpcHandler {
- rpcType :: RpcType
- rpcName :: RpcName
- rpcExecution :: Execution
- rpcHandler :: RpcHandlerFun r
- hoistRpcHandler :: (forall x. Sem (Stop Report ': r) x -> Sem (Stop Report ': r1) x) -> RpcHandler r -> RpcHandler r1
- hoistRpcHandlers :: (forall x. Sem (Stop Report ': r) x -> Sem (Stop Report ': r1) x) -> [RpcHandler r] -> [RpcHandler r1]
- rpcMethod :: RpcType -> RpcName -> RpcMethod
- rpcHandlerMethod :: RpcHandler r -> RpcMethod
- simpleHandler :: Member (Rpc !! RpcError) r => Sem (Rpc ': (Stop Report ': r)) a -> Handler r a
Documentation
type Handler r a = Sem (Stop Report ': r) a Source #
A request handler function is a Sem with arbitrary stack that has an error of type Report at its head.
These error messages are reported to the user by return value for synchronous requests and via echo for
asynchronous ones, provided that the severity specified in the error is greater than the log level set in
UserError.
If the plugin was started with --log-file, it is also written to the file log.
Additionally, reports are stored in memory by the effect Reports.
data RpcHandler r Source #
This type defines a request handler, using a Handler function, the request type, a name, and whether it should
block Neovim while executing.
It can be constructed from handler functions using rpcFunction, rpcCommand and
rpcAutocmd.
A list of RpcHandlers can be used as a Neovim plugin by passing them to runNvimHandlersIO.
Constructors
| RpcHandler | |
Fields
| |
Instances
hoistRpcHandler :: (forall x. Sem (Stop Report ': r) x -> Sem (Stop Report ': r1) x) -> RpcHandler r -> RpcHandler r1 Source #
Apply a stack-manipulating transformation to the handler function.
hoistRpcHandlers :: (forall x. Sem (Stop Report ': r) x -> Sem (Stop Report ': r1) x) -> [RpcHandler r] -> [RpcHandler r1] Source #
Apply a stack-manipulating transformation to the handler functions.
rpcHandlerMethod :: RpcHandler r -> RpcMethod Source #
Create an RpcMethod by joining an RpcType and an RpcName with a colon, extracted from an RpcHandler.