aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/json.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-07-28 02:44:45 -0400
committerEduardo Julian2022-07-28 02:44:45 -0400
commita4847190df926d35f7ece97da50a2a8b1462a24f (patch)
treed368c52b41425631c3962d3c238e6c3c9c797ad6 /stdlib/source/library/lux/data/format/json.lux
parentebfe1bbbe543299f8691e4862fbc899637ff8cfd (diff)
Now statically resolving values from globals in pattern-matching.
Diffstat (limited to 'stdlib/source/library/lux/data/format/json.lux')
-rw-r--r--stdlib/source/library/lux/data/format/json.lux21
1 files changed, 12 insertions, 9 deletions
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 895a6931f..3dd15f400 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -184,7 +184,7 @@
(def (= x y)
(case [x y]
[{#Null} {#Null}]
- #1
+ true
(^.with_template [<tag> <struct>]
[[{<tag> x'} {<tag> y'}]
@@ -197,12 +197,12 @@
(and (n.= (sequence.size xs) (sequence.size ys))
(list#mix (function (_ idx prev)
(and prev
- (maybe.else #0
+ (maybe.else false
(do maybe.monad
[x' (sequence.item idx xs)
y' (sequence.item idx ys)]
(in (= x' y'))))))
- #1
+ true
(list.indices (sequence.size xs))))
[{#Object xs} {#Object ys}]
@@ -210,13 +210,13 @@
(list#mix (function (_ [xk xv] prev)
(and prev
(case (dictionary.value xk ys)
- {.#None} #0
+ {.#None} false
{.#Some yv} (= xv yv))))
- #1
+ true
(dictionary.entries xs)))
_
- #0))))
+ false))))
............................................................
............................................................
@@ -229,8 +229,11 @@
(def boolean_format
(-> Boolean Text)
(|>> (pipe.case
- #0 "false"
- #1 "true")))
+ .false
+ "false"
+
+ .true
+ "true")))
(def number_format
(-> Number Text)
@@ -331,8 +334,8 @@
[_ (<text>.this <token>)]
(in <value>)))]
- [true_parser "true" #1]
[false_parser "false" #0]
+ [true_parser "true" #1]
)
(def boolean_parser