From db697bb636e2341d26bb188cc1b9981a1ab505d7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 7 May 2017 14:30:48 -0400 Subject: - Changed the name of "let%" to "with-expansions". --- stdlib/source/lux/data/format/json.lux | 56 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 27 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 41654d93d..535de1b53 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -773,15 +773,16 @@ (poly: #hidden (Codec//encode *env* :x:) (let [->Codec//encode (: (-> AST AST) (function [.type.] (` (-> (~ .type.) JSON))))] - (let% [ (do-template [ ] - [(do @ [_ ( :x:)] (wrap (` (: (~ (->Codec//encode (` ))) ))))] - - [Unit poly;unit (function [(~ (ast;symbol ["" "0"]))] #Null)] - [Bool poly;bool ;;gen-boolean] - [Int poly;int (|>. ;int-to-real ;;gen-number)] - [Real poly;real ;;gen-number] - [Char poly;char (|>. char;as-text ;;gen-string)] - [Text poly;text ;;gen-string])] + (with-expansions + [ (do-template [ ] + [(do @ [_ ( :x:)] (wrap (` (: (~ (->Codec//encode (` ))) ))))] + + [Unit poly;unit (function [(~ (ast;symbol ["" "0"]))] #Null)] + [Bool poly;bool ;;gen-boolean] + [Int poly;int (|>. ;int-to-real ;;gen-number)] + [Real poly;real ;;gen-number] + [Char poly;char (|>. char;as-text ;;gen-string)] + [Text poly;text ;;gen-string])] ($_ macro;either (with-gensyms [g!type-fun g!case g!input g!key g!val] @@ -924,24 +925,25 @@ (poly: #hidden (Codec//decode *env* :x:) (let [->Codec//decode (: (-> AST AST) (function [.type.] (` (-> JSON (Error (~ .type.))))))] - (let% [ (do-template [ ] - [(do @ [_ ( :x:)] (wrap (` (: (~ (->Codec//decode (` ))) ))))] - - [Unit poly;unit ;;unit] - [Bool poly;bool ;;bool] - [Int poly;int ;;int] - [Real poly;real ;;real] - [Char poly;char ;;char] - [Text poly;text ;;text]) - (do-template [ ] - [(do @ - [:sub: ( :x:) - .sub. (Codec//decode *env* :sub:)] - (wrap (` (: (~ (->Codec//decode (type;to-ast :x:))) - ( (~ .sub.))))))] - - [Maybe poly;maybe ;;nullable] - [List poly;list ;;array])] + (with-expansions + [ (do-template [ ] + [(do @ [_ ( :x:)] (wrap (` (: (~ (->Codec//decode (` ))) ))))] + + [Unit poly;unit ;;unit] + [Bool poly;bool ;;bool] + [Int poly;int ;;int] + [Real poly;real ;;real] + [Char poly;char ;;char] + [Text poly;text ;;text]) + (do-template [ ] + [(do @ + [:sub: ( :x:) + .sub. (Codec//decode *env* :sub:)] + (wrap (` (: (~ (->Codec//decode (type;to-ast :x:))) + ( (~ .sub.))))))] + + [Maybe poly;maybe ;;nullable] + [List poly;list ;;array])] ($_ macro;either (with-gensyms [g!type-fun g!case g!input g!key g!val] -- cgit v1.2.3