aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/json.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/data/format/json.lux84
1 files changed, 42 insertions, 42 deletions
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 3a0e69a6c..19c3a9bba 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -178,45 +178,45 @@
[object_field #Object Object]
)
-(implementation: .public equivalence
+(def: .public equivalence
(Equivalence JSON)
-
- (def: (= x y)
- (case [x y]
- [{#Null} {#Null}]
- #1
-
- (^.with_template [<tag> <struct>]
- [[{<tag> x'} {<tag> y'}]
- (at <struct> = x' y')])
- ([#Boolean bit.equivalence]
- [#Number f.equivalence]
- [#String text.equivalence])
-
- [{#Array xs} {#Array ys}]
- (and (n.= (sequence.size xs) (sequence.size ys))
- (list#mix (function (_ idx prev)
- (and prev
- (maybe.else #0
- (do maybe.monad
- [x' (sequence.item idx xs)
- y' (sequence.item idx ys)]
- (in (= x' y'))))))
- #1
- (list.indices (sequence.size xs))))
-
- [{#Object xs} {#Object ys}]
- (and (n.= (dictionary.size xs) (dictionary.size ys))
- (list#mix (function (_ [xk xv] prev)
- (and prev
- (case (dictionary.value xk ys)
- {.#None} #0
- {.#Some yv} (= xv yv))))
- #1
- (dictionary.entries xs)))
-
- _
- #0)))
+ (implementation
+ (def: (= x y)
+ (case [x y]
+ [{#Null} {#Null}]
+ #1
+
+ (^.with_template [<tag> <struct>]
+ [[{<tag> x'} {<tag> y'}]
+ (at <struct> = x' y')])
+ ([#Boolean bit.equivalence]
+ [#Number f.equivalence]
+ [#String text.equivalence])
+
+ [{#Array xs} {#Array ys}]
+ (and (n.= (sequence.size xs) (sequence.size ys))
+ (list#mix (function (_ idx prev)
+ (and prev
+ (maybe.else #0
+ (do maybe.monad
+ [x' (sequence.item idx xs)
+ y' (sequence.item idx ys)]
+ (in (= x' y'))))))
+ #1
+ (list.indices (sequence.size xs))))
+
+ [{#Object xs} {#Object ys}]
+ (and (n.= (dictionary.size xs) (dictionary.size ys))
+ (list#mix (function (_ [xk xv] prev)
+ (and prev
+ (case (dictionary.value xk ys)
+ {.#None} #0
+ {.#Some yv} (= xv yv))))
+ #1
+ (dictionary.entries xs)))
+
+ _
+ #0))))
............................................................
............................................................
@@ -432,8 +432,8 @@
(array_parser json_parser)
(object_parser json_parser)))))
-(implementation: .public codec
+(def: .public codec
(Codec Text JSON)
-
- (def: encoded ..format)
- (def: decoded (<text>.result json_parser)))
+ (implementation
+ (def: encoded ..format)
+ (def: decoded (<text>.result json_parser))))