Safe Haskell | None |
---|
Implements Template Haskell generation of RPC server components from Haskell functions.
- data RpcFn m = forall i o . (JSON i, JSON o) => RpcFn (i -> m o)
- type RpcServer m = Handler Request m JSValue
- data Request = Request {}
- decodeRequest :: JSValue -> JSValue -> Result Request
- dispatch :: Monad m => Map String (RpcFn (ResultT GanetiException m)) -> RpcServer m
- toRpcFn :: Name -> Q Exp
- rpcFnsList :: [(String, Q Exp)] -> Q Exp
- mkRpcM :: [Name] -> Q Exp
Documentation
A RPC request consiting of a method and its argument(s).
decodeRequest :: JSValue -> JSValue -> Result RequestSource
rpcFnsList :: [(String, Q Exp)] -> Q ExpSource
:: [Name] | the names of functions to include |
-> Q Exp |
Takes a list of function names and creates a RPC handler that delegates calls to them.
The functions must conform to
(J.JSON i, J.JSON o) => i -> ResultT GanetiException m o
. The m
monads types of all the functions must unify.
The result expression is of type RpcServer m
.