From dc93b41b2b38777c077e7327fe019e9a10acc8b9 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Mon, 24 Mar 2014 16:59:45 +0400 Subject: [PATCH 1/1] prototype own JsonRpc implementation --- Data/JsonRpc.hs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Data/JsonRpc.hs diff --git a/Data/JsonRpc.hs b/Data/JsonRpc.hs new file mode 100644 index 0000000..b1879bc --- /dev/null +++ b/Data/JsonRpc.hs @@ -0,0 +1,29 @@ +module JsonRpc ( JsonRpcRequest(..) + , JsonRpcNotification(..) + , JsonRpcResponse(..) + ) where + +import Data.ByteString (ByteString) +import Control.Applicative ((<$>), (<*>), empty) +import Data.Aeson + +data JsonRpcRequest = JsonRpcRequest { jrpcReqMethod :: ByteString + , jrpcReqParams :: [ByteString] + , jrpcReqId :: ByteString + } deriving (Show) + +data JsonRpcNotification = JsonRpcNotification { jrpcNtfMethod :: ByteString + , jrpcNtfParams :: [ByteString] + } deriving (Show) + +data JsonRpcError = JsonRpcError { jrpcErrCode :: Int + , jrpcErrMessage :: ByteString + , jrpcErrData :: Maybe Value + } deriving (Show) + +data JsonRpcResponse = JsonRpcResponse { jrpcRspResult :: Maybe Value + , jrpcRspError :: JsonRpcError + , jrpcRspId :: ByteString + } deriving (Show) + + -- 2.39.2