Safe Haskell | None |
---|
Implements Template Haskell generation of RPC server components from Haskell functions.
Synopsis
- 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 Request Source #
toRpcFn :: Name -> Q Exp Source #
Converts a function into the appropriate RpcFn m
expression.
The function's result must be monadic.
rpcFnsList :: [(String, Q Exp)] -> Q Exp Source #
Convert a list of named expressions into an expression containing a list of name/expression pairs.
:: [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
.