Use TH
This commit is contained in:
parent
802f3a6a14
commit
dc2ae1ef07
@ -1,22 +1,20 @@
|
|||||||
{-# Language DeriveGeneric, RecordWildCards #-}
|
{-# Language TemplateHaskell, RecordWildCards #-}
|
||||||
|
|
||||||
import System.Process
|
import System.Process
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import GHC.Generics
|
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
|
import Data.Aeson.TH
|
||||||
import Data.ByteString.Lazy.Char8 (pack)
|
import Data.ByteString.Lazy.Char8 (pack)
|
||||||
|
|
||||||
readCommand = readProcess "namecoind" ["name_list"] ""
|
readCommand = readProcess "namecoind" ["name_list"] ""
|
||||||
updateCommand n v = readProcessWithExitCode "namecoind" ["name_update", n, v] ""
|
updateCommand n v = readProcessWithExitCode "namecoind" ["name_update", n, v] ""
|
||||||
|
|
||||||
data Name =
|
data Name = Name { name :: String
|
||||||
Name { name :: String
|
|
||||||
, value :: String
|
, value :: String
|
||||||
, address :: String
|
|
||||||
, expires_in :: Int
|
, expires_in :: Int
|
||||||
} deriving (Show, Generic)
|
}
|
||||||
|
|
||||||
instance FromJSON Name
|
deriveJSON defaultOptions ''Name
|
||||||
|
|
||||||
updateName :: Name -> IO Int
|
updateName :: Name -> IO Int
|
||||||
updateName Name{..}
|
updateName Name{..}
|
||||||
|
Loading…
Reference in New Issue
Block a user