diff options
author | Eduardo Julian | 2020-11-28 21:40:29 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-11-28 21:40:29 -0400 |
commit | 7444deb1b80d469280fcb0684d91c13f752a86d6 (patch) | |
tree | 132f8aa480dad400c20971f5e085876da8772b75 /stdlib/source/lux/data/format/json.lux | |
parent | a02b7bf8ff358ccfa35b03272d28537aeac723ae (diff) |
Re-named "_.claim" to "_.cover'".
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/format/json.lux | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index a5611a7c3..5f46f997e 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -10,19 +10,19 @@ [control pipe ["." try (#+ Try)] - ["<>" parser ("#@." monad) + ["<>" parser ("#\." monad) ["<.>" text (#+ Parser)]]] [data ["." bit] ["." maybe] ["." product] - ["." text ("#@." equivalence monoid)] + ["." text ("#\." equivalence monoid)] [number ["n" nat] - ["f" frac ("#@." decimal)]] + ["f" frac ("#\." decimal)]] [collection - ["." list ("#@." fold functor)] - ["." row (#+ Row row) ("#@." monad)] + ["." list ("#\." fold functor)] + ["." row (#+ Row row) ("#\." monad)] ["." dictionary (#+ Dictionary)]]] [macro [syntax (#+ syntax:)] @@ -86,7 +86,7 @@ (wrap (list (` (: JSON #..Null)))) [_ (#.Tuple members)] - (wrap (list (` (: JSON (#..Array ((~! row) (~+ (list@map wrapper members)))))))) + (wrap (list (` (: JSON (#..Array ((~! row) (~+ (list\map wrapper members)))))))) [_ (#.Record pairs)] (do {! ..monad} @@ -114,7 +114,7 @@ (#try.Success (dictionary.keys obj)) _ - (#try.Failure ($_ text@compose "Cannot get the fields of a non-object.")))) + (#try.Failure ($_ text\compose "Cannot get the fields of a non-object.")))) (def: #export (get key json) {#.doc "A JSON object field getter."} @@ -126,10 +126,10 @@ (#try.Success value) #.None - (#try.Failure ($_ text@compose "Missing field '" key "' on object."))) + (#try.Failure ($_ text\compose "Missing field '" key "' on object."))) _ - (#try.Failure ($_ text@compose "Cannot get field '" key "' on a non-object.")))) + (#try.Failure ($_ text\compose "Cannot get field '" key "' on a non-object.")))) (def: #export (set key value json) {#.doc "A JSON object field setter."} @@ -139,18 +139,18 @@ (#try.Success (#Object (dictionary.put key value obj))) _ - (#try.Failure ($_ text@compose "Cannot set field '" key "' on a non-object.")))) + (#try.Failure ($_ text\compose "Cannot set field '" key "' on a non-object.")))) (template [<name> <tag> <type> <desc>] [(def: #export (<name> key json) - {#.doc (code.text ($_ text@compose "A JSON object field getter for " <desc> "."))} + {#.doc (code.text ($_ text\compose "A JSON object field getter for " <desc> "."))} (-> Text JSON (Try <type>)) (case (get key json) (#try.Success (<tag> value)) (#try.Success value) (#try.Success _) - (#try.Failure ($_ text@compose "Wrong value type at key: " key)) + (#try.Failure ($_ text\compose "Wrong value type at key: " key)) (#try.Failure error) (#try.Failure error)))] @@ -179,7 +179,7 @@ [(#Array xs) (#Array ys)] (and (n.= (row.size xs) (row.size ys)) - (list@fold (function (_ idx prev) + (list\fold (function (_ idx prev) (and prev (maybe.default #0 (do maybe.monad @@ -191,7 +191,7 @@ [(#Object xs) (#Object ys)] (and (n.= (dictionary.size xs) (dictionary.size ys)) - (list@fold (function (_ [xk xv] prev) + (list\fold (function (_ [xk xv] prev) (and prev (case (dictionary.get xk ys) #.None #0 @@ -226,7 +226,7 @@ (|> raw (text.split 1) maybe.assume product.right)))))) (def: escape "\") -(def: escaped-dq (text@compose ..escape text.double-quote)) +(def: escaped-dq (text\compose ..escape text.double-quote)) (def: format-string (-> String Text) @@ -250,14 +250,14 @@ (def: (format-array format) (-> (-> JSON Text) (-> Array Text)) - (|>> (row@map format) + (|>> (row\map format) row.to-list (text.join-with ..separator) (text.enclose [..open-array ..close-array]))) (def: (format-kv format [key value]) (-> (-> JSON Text) (-> [String JSON] Text)) - ($_ text@compose + ($_ text\compose (..format-string key) ..entry-separator (format value) @@ -266,7 +266,7 @@ (def: (format-object format) (-> (-> JSON Text) (-> Object Text)) (|>> dictionary.entries - (list@map (..format-kv format)) + (list\map (..format-kv format)) (text.join-with ..separator) (text.enclose [..open-object ..close-object]))) @@ -336,8 +336,8 @@ [mark (<text>.one-of "eE") signed?' (<>.parses? (<text>.this "-")) offset (<text>.many <text>.decimal)] - (wrap ($_ text@compose mark (if signed?' "-" "") offset))))] - (case (f@decode ($_ text@compose (if signed? "-" "") digits "." decimals exp)) + (wrap ($_ text\compose mark (if signed?' "-" "") offset))))] + (case (f\decode ($_ text\compose (if signed? "-" "") digits "." decimals exp)) (#try.Failure message) (<>.fail message) @@ -348,32 +348,32 @@ (Parser Text) ($_ <>.either (<>.after (<text>.this "\t") - (<>@wrap text.tab)) + (<>\wrap text.tab)) (<>.after (<text>.this "\b") - (<>@wrap text.back-space)) + (<>\wrap text.back-space)) (<>.after (<text>.this "\n") - (<>@wrap text.new-line)) + (<>\wrap text.new-line)) (<>.after (<text>.this "\r") - (<>@wrap text.carriage-return)) + (<>\wrap text.carriage-return)) (<>.after (<text>.this "\f") - (<>@wrap text.form-feed)) - (<>.after (<text>.this (text@compose "\" text.double-quote)) - (<>@wrap text.double-quote)) + (<>\wrap text.form-feed)) + (<>.after (<text>.this (text\compose "\" text.double-quote)) + (<>\wrap text.double-quote)) (<>.after (<text>.this "\\") - (<>@wrap "\")))) + (<>\wrap "\")))) (def: parse-string (Parser String) (<| (<text>.enclosed [text.double-quote text.double-quote]) (loop [_ []]) (do {! <>.monad} - [chars (<text>.some (<text>.none-of (text@compose "\" text.double-quote))) + [chars (<text>.some (<text>.none-of (text\compose "\" text.double-quote))) stop <text>.peek]) - (if (text@= "\" stop) + (if (text\= "\" stop) (do ! [escaped parse-escaped next-chars (recur [])] - (wrap ($_ text@compose chars escaped next-chars))) + (wrap ($_ text\compose chars escaped next-chars))) (wrap chars)))) (def: (parse-kv parse-json) |