From 435771d3c4d4ffa791805e7006ee3bde488a4090 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 5 Apr 2018 07:48:25 -0400 Subject: - Improved the syntax for the "lux.function" macro. --- stdlib/source/lux/data/format/json.lux | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'stdlib/source/lux/data/format/json.lux') 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 - wrapper (function [x] (` (..json (~ x))))] + wrapper (function (_ x) (` (..json (~ x))))] (case token (^template [ ] [_ ( value)] @@ -80,7 +80,7 @@ [_ (#.Record pairs)] (do Monad [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 @@ -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 [] (|> (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~' []))))) -- cgit v1.2.3