From 0d909187d5b9effcd08f533d50af7d29c0d6bfd8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 8 Apr 2022 05:42:36 -0400 Subject: De-sigil-ification: $ --- stdlib/source/library/lux.lux | 190 +++++++++++++++++++++--------------------- 1 file changed, 96 insertions(+), 94 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 5c6c625a8..7ff877259 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1337,32 +1337,34 @@ (function' [right left] (func left right))) -(macro:' .public (_$ tokens) +(macro:' .public (left tokens) ({{#Item op tokens'} ({{#Item first nexts} (meta#in (list (list#mix (function#flipped (right_associativity op)) first nexts))) _ - (failure "Wrong syntax for _$")} + (failure "Wrong syntax for left")} tokens') _ - (failure "Wrong syntax for _$")} + (failure "Wrong syntax for left")} tokens)) -(macro:' .public ($_ tokens) +(macro:' .public (right tokens) ({{#Item op tokens'} ({{#Item last prevs} (meta#in (list (list#mix (right_associativity op) last prevs))) _ - (failure "Wrong syntax for $_")} + (failure "Wrong syntax for right")} (list#reversed tokens')) _ - (failure "Wrong syntax for $_")} + (failure "Wrong syntax for right")} tokens)) +(def:''' .public all Macro ..right) + ... (type: (Monad m) ... (Interface ... (is (All (_ a) (-> a (m a))) @@ -1531,7 +1533,7 @@ (-> Symbol Text) (let' [[module name] full_name] ({"" name - _ ($_ text#composite module ..symbol_separator name)} + _ (all text#composite module ..symbol_separator name)} module))) (def:''' .private (global_symbol full_name state) @@ -1553,11 +1555,11 @@ constant) {#None} - {#Left ($_ text#composite "Unknown definition: " (symbol#encoded full_name))}} + {#Left (all text#composite "Unknown definition: " (symbol#encoded full_name))}} (plist#value name definitions)) {#None} - {#Left ($_ text#composite "Unknown module: " module " @ " (symbol#encoded full_name))}} + {#Left (all text#composite "Unknown module: " module " @ " (symbol#encoded full_name))}} (plist#value module modules)))) (def:''' .private (:List expression) @@ -2200,7 +2202,7 @@ (def:''' .private (text#encoded original) (-> Text Text) - ($_ text#composite ..double_quote original ..double_quote)) + (all text#composite ..double_quote original ..double_quote)) (def:''' .private (code#encoded code) (-> Code Text) @@ -2226,25 +2228,25 @@ (symbol#encoded [module name]) [_ {#Form xs}] - ($_ text#composite "(" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) ")") + (all text#composite "(" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) ")") [_ {#Tuple xs}] - ($_ text#composite "[" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) "]") + (all text#composite "[" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) "]") [_ {#Variant xs}] - ($_ text#composite "{" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) "}")} + (all text#composite "{" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) "}")} code)) (def:''' .private (normal_type type) @@ -2360,7 +2362,7 @@ ..#seed ("lux i64 +" 1 seed) ..#expected expected ..#location location ..#extensions extensions ..#scope_type_vars scope_type_vars ..#eval _eval] - (local$ ($_ text#composite "__gensym__" prefix (nat#encoded seed)))}} + (local$ (all text#composite "__gensym__" prefix (nat#encoded seed)))}} state)) (macro:' .public (exec tokens) @@ -2440,11 +2442,11 @@ (do meta_monad [] (in (list))) _ - (failure ($_ text#composite "'lux.case' expects an even number of tokens: " (|> branches - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite ""))))} + (failure (all text#composite "'lux.case' expects an even number of tokens: " (|> branches + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite ""))))} branches)) (macro:' .public (case tokens) @@ -3000,7 +3002,7 @@ {#Right state module} _ - {#Left ($_ text#composite "Unknown module: " name)})))) + {#Left (all text#composite "Unknown module: " name)})))) (def: (type_slot [module name]) (-> Symbol (Meta [Nat (List Symbol) Bit Type])) @@ -3083,38 +3085,38 @@ name _ - ($_ text#composite "(" name " " (|> params (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")")) + (all text#composite "(" name " " (|> params (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")")) {#Sum _} - ($_ text#composite "{" (|> (flat_variant type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "}") + (all text#composite "{" (|> (flat_variant type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "}") {#Product _} - ($_ text#composite "[" (|> (flat_tuple type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "]") + (all text#composite "[" (|> (flat_tuple type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "]") {#Function _} - ($_ text#composite "(-> " (|> (flat_lambda type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")") + (all text#composite "(-> " (|> (flat_lambda type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")") {#Parameter id} (nat#encoded id) {#Var id} - ($_ text#composite "-" (nat#encoded id)) + (all text#composite "-" (nat#encoded id)) {#Ex id} - ($_ text#composite "+" (nat#encoded id)) + (all text#composite "+" (nat#encoded id)) {#UnivQ env body} - ($_ text#composite "(All " (type#encoded body) ")") + (all text#composite "(All " (type#encoded body) ")") {#ExQ env body} - ($_ text#composite "(Ex " (type#encoded body) ")") + (all text#composite "(Ex " (type#encoded body) ")") {#Apply _} (let [[func args] (flat_application type)] - ($_ text#composite - "(" (type#encoded func) " " - (|> args (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) - ")")) + (all text#composite + "(" (type#encoded func) " " + (|> args (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) + ")")) {#Named name _} (symbol#encoded name) @@ -3131,9 +3133,9 @@ (meta#in tags) _ - (failure ($_ text#composite - "No tags available for type: " - (type#encoded struct_type))))) + (failure (all text#composite + "No tags available for type: " + (type#encoded struct_type))))) .let [tag_mappings (is (List [Text Code]) (list#each (function (_ tag) [(product#right tag) @@ -3164,7 +3166,7 @@ {#Item head tail} (list#mix (function (_ right left) - ($_ text#composite left separator right)) + (all text#composite left separator right)) head tail))) @@ -3478,7 +3480,7 @@ (function (again left right) (case (..text#split_by pattern right) {#Some [pre post]} - (again ($_ "lux text concat" left pre replacement) post) + (again (all "lux text concat" left pre replacement) post) {#None} ("lux text concat" left right)))) @@ -3486,7 +3488,7 @@ (def: (alias_stand_in index) (-> Nat Text) - ($_ "lux text concat" "[" (nat#encoded index) "]")) + (all "lux text concat" "[" (nat#encoded index) "]")) (def: (module_alias context aliased) (-> (List Text) Text Text) @@ -3514,7 +3516,7 @@ _ (case root "" hierarchy - _ ($_ text#composite root ..module_separator hierarchy)))) + _ (all text#composite root ..module_separator hierarchy)))) (def: (normal_parallel_path hierarchy root) (-> Text Text (Maybe Text)) @@ -3550,7 +3552,7 @@ (case (relative_ups 0 module) 0 (meta#in (if nested? - ($_ "lux text concat" relative_root ..module_separator module) + (all "lux text concat" relative_root ..module_separator module) module)) relatives @@ -3565,12 +3567,12 @@ clean ("lux text clip" relatives (|> module "lux text size" ("lux i64 -" relatives)) module) output (case ("lux text size" clean) 0 prefix - _ ($_ text#composite prefix ..module_separator clean))] + _ (all text#composite prefix ..module_separator clean))] (meta#in output)) - (failure ($_ "lux text concat" - "Cannot climb the module hierarchy..." \n - "Importing module: " module \n - " Relative Root: " relative_root \n)))))) + (failure (all "lux text concat" + "Cannot climb the module hierarchy..." \n + "Importing module: " module \n + " Relative Root: " relative_root \n)))))) (def: (imports_parser nested? relative_root context imports) (-> Bit Text (List Text) (List Code) (Meta (List Importation))) @@ -3642,9 +3644,9 @@ _ (do meta_monad [current_module current_module_name] - (failure ($_ text#composite - "Wrong syntax for import @ " current_module - \n (code#encoded token))))))) + (failure (all text#composite + "Wrong syntax for import @ " current_module + \n (code#encoded token))))))) imports)] (in (list#conjoint imports')))) @@ -3685,19 +3687,19 @@ {#Right state (list#conjoint to_alias)}) {#None} - {#Left ($_ text#composite - "Unknown module: " (text#encoded module) \n - "Current module: " (case current_module - {#Some current_module} - (text#encoded current_module) - - {#None} - "???") \n - "Known modules: " (|> modules - (list#each (function (_ [name module]) - (text$ name))) - tuple$ - code#encoded))}) + {#Left (all text#composite + "Unknown module: " (text#encoded module) \n + "Current module: " (case current_module + {#Some current_module} + (text#encoded current_module) + + {#None} + "???") \n + "Known modules: " (|> modules + (list#each (function (_ [name module]) + (text$ name))) + tuple$ + code#encoded))}) )) (def: (list#only p xs) @@ -3846,13 +3848,13 @@ {#Right [compiler struct_type]} _ - {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})) + {#Left (all text#composite "Unknown var: " (symbol#encoded full_name))})) (case (definition_type full_name compiler) {#Some struct_type} {#Right [compiler struct_type]} _ - {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})))] + {#Left (all text#composite "Unknown var: " (symbol#encoded full_name))})))] (case temp {#Right [compiler {#Var type_id}]} (let [[..#info _ ..#source _ ..#current_module _ ..#modules _ @@ -4108,11 +4110,11 @@ #refer_open openings]) _ - (failure ($_ text#composite "Wrong syntax for refer @ " current_module - \n (|> options - (list#each code#encoded) - (list#interposed " ") - (list#mix text#composite ""))))))) + (failure (all text#composite "Wrong syntax for refer @ " current_module + \n (|> options + (list#each code#encoded) + (list#interposed " ") + (list#mix text#composite ""))))))) (def: (referral_definitions module_name [r_defs r_opens]) (-> Text Refer (Meta (List Code))) @@ -4125,7 +4127,7 @@ (function (_ _def) (if (is_member? all_defs _def) (meta#in []) - (failure ($_ text#composite _def " is not defined in module " module_name " @ " current_module))))) + (failure (all text#composite _def " is not defined in module " module_name " @ " current_module))))) referred_defs)))] defs' (case r_defs {#All} @@ -4528,10 +4530,10 @@ (single_expansion expr) _ - (failure ($_ text#composite - "Incorrect expansion in with_expansions" - " | Binding: " (text#encoded var_name) - " | Expression: " (code#encoded expr))))] + (failure (all text#composite + "Incorrect expansion in with_expansions" + " | Binding: " (text#encoded var_name) + " | Expression: " (code#encoded expr))))] (again &rest (plist#with var_name expansion map))) {#End} @@ -4730,8 +4732,8 @@ (do meta_monad [location ..location .let [[module line column] location - location ($_ "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) - message ($_ "lux text concat" "Undefined behavior @ " location)]] + location (all "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) + message (all "lux text concat" "Undefined behavior @ " location)]] (in (list (` (..panic! (~ (text$ message))))))) _ @@ -4836,14 +4838,14 @@ (in (as ..Text value)) _ - (failure ($_ text#composite - "Invalid target platform (must be a value of type Text): " (symbol#encoded symbol) - " : " (..code#encoded (..type_code type)))))) + (failure (all text#composite + "Invalid target platform (must be a value of type Text): " (symbol#encoded symbol) + " : " (..code#encoded (..type_code type)))))) _ - (failure ($_ text#composite - "Invalid target platform syntax: " (..code#encoded choice) - \n "Must be either a text literal or a symbol.")))) + (failure (all text#composite + "Invalid target platform syntax: " (..code#encoded choice) + \n "Must be either a text literal or a symbol.")))) (def: (target_pick target options default) (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) @@ -4851,7 +4853,7 @@ {#End} (case default {#None} - (failure ($_ text#composite "No code for target platform: " target)) + (failure (all text#composite "No code for target platform: " target)) {#Some default} (meta#in (list default))) -- cgit v1.2.3