Skip to content

Commit

Permalink
Merge pull request #4852 from andrevidela/contrib-json-eq
Browse files Browse the repository at this point in the history
Add Eq instance to JSON
  • Loading branch information
melted committed May 23, 2020
2 parents d6df648 + ccd01ce commit bfef360
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libs/contrib/Language/JSON/Data.idr
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ export
Show JSON where
show = stringify

export
Eq JSON where
JNull == JNull = True
(JBoolean a) == (JBoolean b) = a == b
(JNumber a) == (JNumber b) = a == b
(JString a) == (JString b) = a == b
(JArray a) == (JArray b) = assert_total $ a == b
(JObject a) == (JObject b) = assert_total $ a == b
_ == _ = False

||| Format a JSON value, indenting by `n` spaces per nesting level.
|||
||| @curr The current indentation amount, measured in spaces.
Expand Down

0 comments on commit bfef360

Please sign in to comment.