parseRawBlock :: HM.HashMap Text Value -> Maybe RawBlock
parseRawBlock p = do
  hashV <- look "hash"
  hash <- readText hashV
  feeV <- look "fee"
  fee <- readNumber feeV
  heightV <- look "height"
  height <- readNumber heightV
  timeV <- look "time"
  time <- readNumber timeV
  return $ RawBlock
    { rawBlockHash = unHash hash
    , rawBlockFee = fee
    , rawBlockHeight = height
    , rawBlockTime = time
    }
  where
    look label = HM.lookup label p
parseRawBlock :: HM.HashMap Text Value -> Maybe RawBlock
parseRawBlock p = do
  hashV <- look "hash"
  hash <- readText hashV
  feeV <- look "fee"
  fee <- readNumber feeV
  heightV <- look "height"
  height <- readNumber heightV
  timeV <- look "time"
  time <- readNumber timeV
  return $ RawBlock
    { rawBlockHash = unHash hash
    , rawBlockFee = fee
    , rawBlockHeight = height
    , rawBlockTime = time
    }
  where
    look label = HM.lookup label p
parseRawBlock p = do
  hashV <- look "hash"
  hash <- readText hashV
  feeV <- look "fee"
  fee <- readNumber feeV
  heightV <- look "height"
  height <- readNumber heightV
  timeV <- look "time"
  time <- readNumber timeV
  return $ RawBlock
    { rawBlockHash = unHash hash
    , rawBlockFee = fee
    , rawBlockHeight = height
    , rawBlockTime = time
    }
  where
    look label = HM.lookup label p