summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Model/Contract.hs
diff options
context:
space:
mode:
authorJulien Dessaux2023-07-19 22:04:46 +0200
committerJulien Dessaux2023-07-19 22:04:46 +0200
commitb76382337697d180f81a8bf0da2cd978b1613aba (patch)
treec451c3ebbf221d0c46bef7f8068593400619d3d3 /haskell/src/SpaceTraders/Model/Contract.hs
parent[haskell] refactoring (diff)
downloadspacetraders-b76382337697d180f81a8bf0da2cd978b1613aba.tar.gz
spacetraders-b76382337697d180f81a8bf0da2cd978b1613aba.tar.bz2
spacetraders-b76382337697d180f81a8bf0da2cd978b1613aba.zip
[haskell] Fixed models' serialization
Diffstat (limited to '')
-rw-r--r--haskell/src/SpaceTraders/Model/Contract.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/haskell/src/SpaceTraders/Model/Contract.hs b/haskell/src/SpaceTraders/Model/Contract.hs
index 742062e..a0bebcc 100644
--- a/haskell/src/SpaceTraders/Model/Contract.hs
+++ b/haskell/src/SpaceTraders/Model/Contract.hs
@@ -34,14 +34,14 @@ instance FromJSON Contract where
<*> o .: "fulfilled"
<*> o .: "terms"
instance ToJSON Contract where
- toEncoding (Contract a i ty e d fa fu te) = pairs ( "accepted" .= a
- <> "id" .= i
- <> "type" .= ty
- <> "expiration" .= e
- <> "deadlineToAccept" .= d
- <> "factionSymbol" .= fa
- <> "fulfilled" .= fu
- <> "terms" .= te )
+ toJSON (Contract a i ty e d fa fu te) = object [ "accepted" .= a
+ , "id" .= i
+ , "type" .= ty
+ , "expiration" .= e
+ , "deadlineToAccept" .= d
+ , "factionSymbol" .= fa
+ , "fulfilled" .= fu
+ , "terms" .= te ]
data Delivery = Delivery { destinationSymbol :: T.Text
, tradeSymbol :: T.Text