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.Exit
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Data.ByteString.Lazy.Char8 (pack)
|
||||
|
||||
readCommand = readProcess "namecoind" ["name_list"] ""
|
||||
updateCommand n v = readProcessWithExitCode "namecoind" ["name_update", n, v] ""
|
||||
|
||||
data Name =
|
||||
Name { name :: String
|
||||
, value :: String
|
||||
, address :: String
|
||||
, expires_in :: Int
|
||||
} deriving (Show, Generic)
|
||||
data Name = Name { name :: String
|
||||
, value :: String
|
||||
, expires_in :: Int
|
||||
}
|
||||
|
||||
instance FromJSON Name
|
||||
deriveJSON defaultOptions ''Name
|
||||
|
||||
updateName :: Name -> IO Int
|
||||
updateName Name{..}
|
||||
|
Loading…
Reference in New Issue
Block a user