Skip to content

Commit 7f4525a

Browse files
committed
Removed call to newer Aeson function
Data.Aeson.withObject does not exist in aeson-0.6.0.0.
1 parent 6644620 commit 7f4525a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Network/JsonRpc/Types.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ data Request = Request Text Args (Maybe Id)
113113

114114
instance A.FromJSON Request where
115115
parseJSON (A.Object x) = (checkVersion =<< x .:? versionKey .!= jsonRpcVersion) *>
116-
(Request <$>
117-
x .: "method" <*>
118-
(parseParams =<< x .:? "params" .!= emptyObject) <*>
119-
parseId)
116+
(Request <$>
117+
x .: "method" <*>
118+
(parseParams =<< x .:? "params" .!= emptyObject) <*>
119+
parseId)
120120
where parseParams (A.Object obj) = return $ Left obj
121121
parseParams (A.Array ar) = return $ Right ar
122122
parseParams _ = empty
@@ -170,11 +170,11 @@ instance A.ToJSON RpcError where
170170
, ("data" .=) <$> data' ]
171171

172172
instance A.FromJSON RpcError where
173-
parseJSON = A.withObject "JSON-RPC error object" $
174-
\v -> RpcError <$>
175-
v .: "code" <*>
176-
v .: "message" <*>
177-
v .:? "data"
173+
parseJSON (A.Object v) = RpcError <$>
174+
v .: "code" <*>
175+
v .: "message" <*>
176+
v .:? "data"
177+
parseJSON _ = empty
178178

179179
-- | Creates an 'RpcError' with the given error code and message.
180180
-- According to the specification, server error codes should be

0 commit comments

Comments
 (0)