diff options
author | Eduardo Julian | 2022-06-12 13:33:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-12 13:33:48 -0400 |
commit | 8c3a1afab9efeb86e2f53d743551fc689fbad257 (patch) | |
tree | 396b2fd29bac407544d2136a0d9e6e3b8b2c30af /stdlib/source/library/lux/data/format/json.lux | |
parent | 9c21fd1f33eb52fb971d493ad21a67036d68b841 (diff) |
De-sigil-ification: suffix : [Part 4]
Diffstat (limited to 'stdlib/source/library/lux/data/format/json.lux')
-rw-r--r-- | stdlib/source/library/lux/data/format/json.lux | 84 |
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)))) |