Skip to content

Commit

Permalink
Replace FromJSON instance for EntryId to fix failing `getUSDAccou…
Browse files Browse the repository at this point in the history
…ntLedger` test; see dimitri-xyz#18.
  • Loading branch information
ericpashman committed May 20, 2020
1 parent 642a828 commit 1951df5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Coinbase/Exchange/Types/Private.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ instance FromJSON Account where
--

newtype EntryId = EntryId { unEntryId :: Word64 }
deriving (Eq, Ord, Num, Show, Read, Data, Typeable, Generic, NFData, Hashable, FromJSON, ToJSON)
deriving (Eq, Ord, Num, Show, Read, Data, Typeable, Generic, NFData, Hashable, ToJSON)

instance FromJSON EntryId where
parseJSON (String t) = pure $ EntryId $ read $ T.unpack t
parseJSON (Number n) = pure $ EntryId $ floor n
parseJSON _ = mzero

data Entry
= Entry
Expand Down

0 comments on commit 1951df5

Please sign in to comment.