diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/format/json.lux | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 66ad6c093..0c61b958b 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -21,9 +21,9 @@ [error #- fail] [sum] [product] - (struct [list "" Fold<List> "List/" Monad<List>] - [vector #+ Vector vector "Vector/" Monad<Vector>] - [dict #+ Dict])) + (coll [list "" Fold<List> "List/" Monad<List>] + [vector #+ Vector vector "Vector/" Monad<Vector>] + [dict #+ Dict])) (codata [function]) [compiler #+ Monad<Lux> with-gensyms] (macro [syntax #+ syntax:] @@ -544,13 +544,13 @@ _ (#;Left (format "JSON value is not an object: " (show-json json)))))) -(def: #export (at idx parser) +(def: #export (nth idx parser) {#;doc "Parses an element inside a JSON array."} (All [a] (-> Nat (Parser a) (Parser a))) (lambda [json] (case json (#Array values) - (case (vector;at idx values) + (case (vector;nth idx values) (#;Some value) (case (parser value) (#;Right output) @@ -689,8 +689,8 @@ (and prev (default false (do Monad<Maybe> - [x' (vector;at idx xs) - y' (vector;at idx ys)] + [x' (vector;nth idx xs) + y' (vector;nth idx ys)] (wrap (= x' y')))))) true (list;indices (vector;size xs)))) @@ -734,7 +734,7 @@ parsers (|> parts (list;zip2 (list;indices array-size)) (List/map (lambda [[idx parser]] - (` (at (~ (ast;nat idx)) (~ parser))))))] + (` (nth (~ (ast;nat idx)) (~ parser))))))] (wrap (list (` ($_ seq (~@ parsers)))))) (#ObjectShape kvs) @@ -757,7 +757,7 @@ parsers (|> parts (list;zip2 (list;indices array-size)) (List/map (lambda [[idx parser]] - (` (at (~ (ast;nat idx)) (~ parser))))))] + (` (nth (~ (ast;nat idx)) (~ parser))))))] (wrap (list (` (ensure (array-size! (~ (ast;nat array-size))) ($_ seq (~@ parsers))))))) @@ -998,8 +998,8 @@ [#let [tag (ast;tag name)] decoder (Codec<JSON,?>//decode new-*env* :case:)] (wrap (list (` (do Monad<Parser> - [(~ g!_) (;;at +0 (;;text! (~ (ast;text (product;right name))))) - (~ g!_) (;;at +1 (~ decoder))] + [(~ g!_) (;;nth +0 (;;text! (~ (ast;text (product;right name))))) + (~ g!_) (;;nth +1 (~ decoder))] ((~ (' wrap)) ((~ tag) (~ g!_))))))))) members) #let [:x:+ (case g!vars |