Skip to content

Commit 4b14e6e

Browse files
committed
Removed unnecessary uses of toJSON
1 parent 67078c3 commit 4b14e6e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/TestTypes.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ data TestRequest = TestRequest Text (Maybe (Either Object Array)) (Maybe TestId)
3131

3232
instance ToJSON TestRequest where
3333
toJSON (TestRequest name params i) = object pairs
34-
where pairs = catMaybes [Just $ "method" .= toJSON name, idPair, paramsPair]
34+
where pairs = catMaybes [Just $ "method" .= name, idPair, paramsPair]
3535
idPair = ("id" .=) <$> i
3636
paramsPair = either toPair toPair <$> params
37-
where toPair v = "params" .= toJSON v
37+
where toPair v = "params" .= v
3838

3939
data TestResponse = TestResponse { rspId :: TestId
4040
, rspResult :: Either TestRpcError Value }
@@ -59,8 +59,8 @@ instance FromJSON TestId where
5959

6060
instance ToJSON TestId where
6161
toJSON i = case i of
62-
IdString x -> toJSON x
63-
IdNumber x -> toJSON x
62+
IdString x -> String x
63+
IdNumber x -> Number x
6464
IdNull -> Null
6565

6666
versionKey :: Text

0 commit comments

Comments
 (0)