diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/format/json.lux | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 04e462feb..675aabfde 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -748,16 +748,16 @@ .val. (Codec<JSON,?>//encode new-*env* :val:) #let [:x:+ (case g!vars #;Nil - (->Codec//encode (type;type-to-ast :x:)) + (->Codec//encode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//encode g!vars)) - (~ (->Codec//encode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))]] + (~ (->Codec//encode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))]] (wrap (` (: (~ :x:+) (lambda [(~@ g!vars) (~ g!input)] (|> (~ g!input) - (_map_ (: (-> [Text (~ (type;type-to-ast :val:))] + (_map_ (: (-> [Text (~ (type;to-ast :val:))] [Text JSON]) (lambda [[(~ g!key) (~ g!val)]] [(~ g!key) @@ -768,12 +768,12 @@ (do @ [:sub: (poly;maybe :x:) .sub. (Codec<JSON,?>//encode *env* :sub:)] - (wrap (` (: (~ (->Codec//encode (type;type-to-ast :x:))) + (wrap (` (: (~ (->Codec//encode (type;to-ast :x:))) (;;gen-nullable (~ .sub.)))))) (do @ [:sub: (poly;list :x:) .sub. (Codec<JSON,?>//encode *env* :sub:)] - (wrap (` (: (~ (->Codec//encode (type;type-to-ast :x:))) + (wrap (` (: (~ (->Codec//encode (type;to-ast :x:))) (|>. (_map_ (~ .sub.)) vector;from-list ;;gen-array))))) (with-gensyms [g!type-fun g!case g!input] (do @ @@ -790,12 +790,12 @@ cases) #let [:x:+ (case g!vars #;Nil - (->Codec//encode (type;type-to-ast :x:)) + (->Codec//encode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//encode g!vars)) - (~ (->Codec//encode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))]] + (~ (->Codec//encode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))]] (wrap (` (: (~ :x:+) (lambda [(~@ g!vars) (~ g!input)] (case (~ g!input) @@ -814,12 +814,12 @@ slots) #let [:x:+ (case g!vars #;Nil - (->Codec//encode (type;type-to-ast :x:)) + (->Codec//encode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//encode g!vars)) - (~ (->Codec//encode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))]] + (~ (->Codec//encode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))]] (wrap (` (: (~ :x:+) (lambda [(~@ g!vars) (~ g!input)] (;;json (~ (ast;record synthesis)))) @@ -837,12 +837,12 @@ members) #let [:x:+ (case g!vars #;Nil - (->Codec//encode (type;type-to-ast :x:)) + (->Codec//encode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//encode g!vars)) - (~ (->Codec//encode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))] + (~ (->Codec//encode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))] #let [.tuple. (` [(~@ (List/map product;left pattern-matching))])]] (wrap (` (: (~ :x:+) (lambda [(~@ g!vars) (~ .tuple.)] @@ -855,10 +855,10 @@ [[:func: :args:] (poly;apply :x:) .func. (Codec<JSON,?>//encode *env* :func:) .args. (mapM @ (Codec<JSON,?>//encode *env*) :args:)] - (wrap (` (: (~ (->Codec//encode (type;type-to-ast :x:))) + (wrap (` (: (~ (->Codec//encode (type;to-ast :x:))) ((~ .func.) (~@ .args.)))))) (poly;bound *env* :x:) - (compiler;fail (format "Can't create JSON encoder for: " (type;type-to-text :x:))) + (compiler;fail (format "Can't create JSON encoder for: " (%type :x:))) )))) (poly: #export (Codec<JSON,?>//decode *env* :x:) @@ -877,7 +877,7 @@ [(do @ [:sub: (<matcher> :x:) .sub. (Codec<JSON,?>//decode *env* :sub:)] - (wrap (` (: (~ (->Codec//decode (type;type-to-ast :x:))) + (wrap (` (: (~ (->Codec//decode (type;to-ast :x:))) (<decoder> (~ .sub.))))))] [Maybe poly;maybe ;;nullable] @@ -899,12 +899,12 @@ .val. (Codec<JSON,?>//decode new-*env* :val:) #let [:x:+ (case g!vars #;Nil - (->Codec//decode (type;type-to-ast :x:)) + (->Codec//decode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//decode g!vars)) - (~ (->Codec//decode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))]] + (~ (->Codec//decode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))]] (wrap (` (: (~ :x:+) (lambda [(~@ g!vars) (~ g!input)] (do Monad<Error> @@ -935,12 +935,12 @@ cases) #let [:x:+ (case g!vars #;Nil - (->Codec//decode (type;type-to-ast :x:)) + (->Codec//decode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//decode g!vars)) - (~ (->Codec//decode (` ((~ (type;type-to-ast :x:)) (~@ g!vars))))))))) + (~ (->Codec//decode (` ((~ (type;to-ast :x:)) (~@ g!vars))))))))) base-parser (` ($_ ;;either (~@ (List/join pattern-matching)))) parser (case g!vars @@ -967,12 +967,12 @@ slots) #let [:x:+ (case g!vars #;Nil - (->Codec//decode (type;type-to-ast :x:)) + (->Codec//decode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//decode g!vars)) - (~ (->Codec//decode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))]] + (~ (->Codec//decode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))]] (wrap (` (: (~ :x:+) (lambda [(~@ g!vars) (~ g!input)] (do Monad<Error> @@ -994,12 +994,12 @@ members) #let [:x:+ (case g!vars #;Nil - (->Codec//decode (type;type-to-ast :x:)) + (->Codec//decode (type;to-ast :x:)) _ (` (All (~ g!type-fun) [(~@ g!vars)] (-> (~@ (List/map ->Codec//decode g!vars)) - (~ (->Codec//decode (` ((~ (type;type-to-ast :x:)) (~@ g!vars)))))))))] + (~ (->Codec//decode (` ((~ (type;to-ast :x:)) (~@ g!vars)))))))))] #let [.decoder. (case g!vars #;Nil (` (;;shape^ [(~@ (List/map product;right pattern-matching))])) @@ -1013,12 +1013,12 @@ [[:func: :args:] (poly;apply :x:) .func. (Codec<JSON,?>//decode *env* :func:) .args. (mapM @ (Codec<JSON,?>//decode *env*) :args:)] - (wrap (` (: (~ (->Codec//decode (type;type-to-ast :x:))) + (wrap (` (: (~ (->Codec//decode (type;to-ast :x:))) ((~ .func.) (~@ .args.)))))) (do @ [g!bound (poly;bound *env* :x:)] (wrap g!bound)) - (compiler;fail (format "Can't create JSON decoder for: " (type;type-to-text :x:))) + (compiler;fail (format "Can't create JSON decoder for: " (%type :x:))) )))) (syntax: #export (Codec<JSON,?> :x:) |