-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNmcRpc.hs
27 lines (24 loc) · 887 Bytes
/
NmcRpc.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{-# LANGUAGE OverloadedStrings #-}
module NmcRpc ( NmcRes(..)
) where
import Data.ByteString.Lazy (ByteString)
import Data.Text as T (unpack)
import Data.List.Split
import Data.Char
import Data.Map as M (Map, lookup)
import Control.Applicative ((<$>), (<*>), empty)
import Data.Aeson
data NmcRes = NmcRes { resName :: String
, resValue :: ByteString -- string with NmcDom
, resTxid :: String
, resAddress :: String
, resExpires_in :: Int
} deriving (Show)
instance FromJSON NmcRes where
parseJSON (Object o) = NmcRes
<$> o .: "name"
<*> o .: "value"
<*> o .: "txid"
<*> o .: "address"
<*> o .: "expires_in"
parseJSON _ = empty