| Copyright | Alexander Krupenkin 2016-2018 |
|---|---|
| License | BSD3 |
| Maintainer | mail@akru.me |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.JsonRpc.TinyClient
Description
Tiny JSON-RPC 2.0 client. Functions for implementing the client side of JSON-RPC 2.0. See http://www.jsonrpc.org/specification.
Synopsis
- data JsonRpcException
- data RpcError = RpcError {}
- type MethodName = Text
- type ServerUri = String
- class (MonadIO m, MonadThrow m, MonadReader Config m) => Remote m a | a -> m
- remote :: Remote m a => MethodName -> a
Documentation
data JsonRpcException #
Constructors
| ParsingException String | |
| CallException RpcError |
Instances
| Eq JsonRpcException # | |
Defined in Network.JsonRpc.TinyClient Methods (==) :: JsonRpcException -> JsonRpcException -> Bool # (/=) :: JsonRpcException -> JsonRpcException -> Bool # | |
| Show JsonRpcException # | |
Defined in Network.JsonRpc.TinyClient Methods showsPrec :: Int -> JsonRpcException -> ShowS # show :: JsonRpcException -> String # showList :: [JsonRpcException] -> ShowS # | |
| Exception JsonRpcException # | |
Defined in Network.JsonRpc.TinyClient Methods toException :: JsonRpcException -> SomeException # | |
type MethodName = Text #
Name of called method.
class (MonadIO m, MonadThrow m, MonadReader Config m) => Remote m a | a -> m #
Typeclass for JSON-RPC monad base.
If you have monad with MonadIO, MonadThrow and MonadReader instances,
it can be used as base for JSON-RPC calls.
Example:
newtype MyMonad a = ... instance Remote MyMonad (Mymonad a) foo :: Int -> Bool -> Mymonad Text foo = remote "foo"
Instances
| FromJSON a => Remote Web3 (Web3 a) # | |
Defined in Network.Ethereum.Web3.Provider Methods remote_ :: ([Value] -> Web3 ByteString) -> Web3 a | |
| (ToJSON a, Remote m b) => Remote m (a -> b) # | |
Defined in Network.JsonRpc.TinyClient Methods remote_ :: ([Value] -> m ByteString) -> a -> b | |
remote :: Remote m a => MethodName -> a #
Remote call of JSON-RPC method.
Arguments of function are stored into params request array.
Example:
myMethod :: Int -> Bool -> m String myMethod = remote "myMethod"