diff options
author | Eduardo Julian | 2018-04-05 07:48:25 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-05 07:48:25 -0400 |
commit | 435771d3c4d4ffa791805e7006ee3bde488a4090 (patch) | |
tree | 693b9e2a6d8c6ddf4e439336e5bfcd665c9955cd /stdlib/source/lux/data/format/json.lux | |
parent | 3de94c8a341ef3f19fd75eeeb98e5333d2fe89d0 (diff) |
- Improved the syntax for the "lux.function" macro.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/format/json.lux | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 49a739b4f..86faa0509 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -62,7 +62,7 @@ (json {"this" "is" "an" "object"}))} (let [(^open) Monad<Meta> - wrapper (function [x] (` (..json (~ x))))] + wrapper (function (_ x) (` (..json (~ x))))] (case token (^template [<ast-tag> <ctor> <json-tag>] [_ (<ast-tag> value)] @@ -80,7 +80,7 @@ [_ (#.Record pairs)] (do Monad<Meta> [pairs' (monad.map @ - (function [[slot value]] + (function (_ [slot value]) (case slot [_ (#.Text key-name)] (wrap (` [(~ (code.text key-name)) (~ (wrapper value))])) @@ -165,7 +165,7 @@ [(#Array xs) (#Array ys)] (and (n/= (sequence.size xs) (sequence.size ys)) - (list/fold (function [idx prev] + (list/fold (function (_ idx prev) (and prev (maybe.default false (do maybe.Monad<Maybe> @@ -177,7 +177,7 @@ [(#Object xs) (#Object ys)] (and (n/= (dict.size xs) (dict.size ys)) - (list/fold (function [[xk xv] prev] + (list/fold (function (_ [xk xv] prev) (and prev (case (dict.get xk ys) #.None false @@ -210,13 +210,13 @@ (def: #export (fail error) (All [a] (-> Text (Reader a))) - (function [inputs] + (function (_ inputs) (#e.Error error))) (def: #export any {#.doc "Just returns the JSON input without applying any logic."} (Reader JSON) - (<| (function [inputs]) + (<| (function (_ inputs)) (case inputs #.Nil (#e.Error "Empty JSON stream.") @@ -313,7 +313,7 @@ (case (do e.Monad<Error> [] (|> (dict.entries object) - (monad.map @ (function [[key val]] + (monad.map @ (function (_ [key val]) (do @ [val (run val parser)] (wrap [key val])))) @@ -338,7 +338,7 @@ (#.Some value) (case (run value parser) (#e.Success output) - (function [tail] + (function (_ tail) (#e.Success [(#.Cons (#Object (dict.remove field-name object)) tail) output])) @@ -375,7 +375,7 @@ ($_ text/compose "{" (|> object dict.entries - (list/map (function [[key value]] ($_ text/compose (show-string key) ":" (show-json value)))) + (list/map (function (_ [key value]) ($_ text/compose (show-string key) ":" (show-json value)))) (text.join-with ",")) "}")) @@ -500,4 +500,4 @@ (struct: #export _ (Codec Text JSON) (def: encode show-json) - (def: decode (function [input] (l.run input (json~' []))))) + (def: decode (function (_ input) (l.run input (json~' []))))) |