diff options
author | Eduardo Julian | 2021-07-26 01:45:57 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-26 01:45:57 -0400 |
commit | e64b6d0114c26a455e19a416b5f02a4d19dd711f (patch) | |
tree | 020e426a40aefebf6b052e799b33c40fe4d8a80c /stdlib/source/library/lux/data/format/json.lux | |
parent | 62b3abfcc014ca1c19d62aacdd497f6a250b372c (diff) |
Re-named Promise to Async.
Diffstat (limited to 'stdlib/source/library/lux/data/format/json.lux')
-rw-r--r-- | stdlib/source/library/lux/data/format/json.lux | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 638048599..30903df3c 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -99,7 +99,7 @@ (wrap (` [(~ (code.text key_name)) (~ (wrapper value))])) _ - (meta.fail "Wrong syntax for JSON object."))) + (meta.failure "Wrong syntax for JSON object."))) pairs)] (wrap (list (` (: JSON (#..Object ((~! dictionary.of_list) (~! text.hash) @@ -208,17 +208,17 @@ ############################################################ ############################################################ -(def: (format_null _) +(def: (null_format _) (-> Null Text) "null") -(def: format_boolean +(def: boolean_format (-> Boolean Text) (|>> (case> #0 "false" #1 "true"))) -(def: format_number +(def: number_format (-> Number Text) (|>> (case> (^or +0.0 -0.0) "0.0" @@ -230,7 +230,7 @@ (def: escape "\") (def: escaped_dq (text\compose ..escape text.double_quote)) -(def: format_string +(def: string_format (-> String Text) (|>> (text.replace_all text.double_quote ..escaped_dq) (text.enclose [text.double_quote text.double_quote]))) @@ -250,25 +250,25 @@ ["}" close_object] ) -(def: (format_array format) +(def: (array_format format) (-> (-> JSON Text) (-> Array Text)) (|>> (row\map format) row.to_list (text.join_with ..separator) (text.enclose [..open_array ..close_array]))) -(def: (format_kv format [key value]) +(def: (kv_format format [key value]) (-> (-> JSON Text) (-> [String JSON] Text)) ($_ text\compose - (..format_string key) + (..string_format key) ..entry_separator (format value) )) -(def: (format_object format) +(def: (object_format format) (-> (-> JSON Text) (-> Object Text)) (|>> dictionary.entries - (list\map (..format_kv format)) + (list\map (..kv_format format)) (text.join_with ..separator) (text.enclose [..open_object ..close_object]))) @@ -278,12 +278,12 @@ (^template [<tag> <format>] [(<tag> value) (<format> value)]) - ([#Null ..format_null] - [#Boolean ..format_boolean] - [#Number ..format_number] - [#String ..format_string] - [#Array (..format_array format)] - [#Object (..format_object format)]) + ([#Null ..null_format] + [#Boolean ..boolean_format] + [#Number ..number_format] + [#String ..string_format] + [#Array (..array_format format)] + [#Object (..object_format format)]) )) ############################################################ @@ -341,7 +341,7 @@ (wrap ($_ text\compose mark (if signed?' "-" "") offset))))] (case (f\decode ($_ text\compose (if signed? "-" "") digits "." decimals exp)) (#try.Failure message) - (<>.fail message) + (<>.failure message) (#try.Success value) (wrap value)))) |