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/tool/compiler | |
parent | 62b3abfcc014ca1c19d62aacdd497f6a250b372c (diff) |
Re-named Promise to Async.
Diffstat (limited to 'stdlib/source/library/lux/tool/compiler')
35 files changed, 293 insertions, 294 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 2e5fb6fed..c60700019 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -11,7 +11,7 @@ ["." try (#+ Try) ("#\." functor)] ["." exception (#+ exception:)] [concurrency - ["." promise (#+ Promise Resolver) ("#\." monad)] + ["." async (#+ Async Resolver) ("#\." monad)] ["." stm (#+ Var STM)]]] [data ["." binary (#+ Binary)] @@ -68,7 +68,7 @@ (All [s i o] (-> (Phase s i o) Any))) (type: #export (Platform <type_vars>) - {#&file_system (file.System Promise) + {#&file_system (file.System Async) #host (///generation.Host expression directive) #phase (///generation.Phase <type_vars>) #runtime (<Operation> [Registry Output]) @@ -77,12 +77,12 @@ ## TODO: Get rid of this (type: (Action a) - (Promise (Try a))) + (Async (Try a))) ## TODO: Get rid of this (def: monad (:as (Monad Action) - (try.with promise.monad))) + (try.with async.monad))) (with_expansions [<Platform> (as_is (Platform <type_vars>)) <State+> (as_is (///directive.State+ <type_vars>)) @@ -96,7 +96,7 @@ (def: (cache_module static platform module_id [descriptor document output]) (All [<type_vars>] (-> Static <Platform> archive.ID [Descriptor (Document Any) Output] - (Promise (Try Any)))) + (Async (Try Any)))) (let [system (get@ #&file_system platform) write_artifact! (: (-> [artifact.ID (Maybe Text) Binary] (Action Any)) (function (_ [artifact_id custom content]) @@ -112,7 +112,7 @@ row.to_list (monad.map ..monad write_artifact!) (: (Action (List Any))))) - document (\ promise.monad wrap + document (\ async.monad wrap (document.check $.key document))] (ioW.cache system static module_id (_.run ..writer [descriptor document]))))) @@ -234,8 +234,8 @@ (Program expression directive) [Type Type Type] (-> Phase_Wrapper Extender) Import (List Context) - (Promise (Try [<State+> Archive])))) - (do {! (try.with promise.monad)} + (Async (Try [<State+> Archive])))) + (do {! (try.with async.monad)} [#let [state (//init.state (get@ #static.host static) module expander @@ -247,9 +247,9 @@ [archive analysis_state bundles] (ioW.thaw (get@ #host platform) (get@ #&file_system platform) static import compilation_sources) #let [with_missing_extensions (: (All [<type_vars>] - (-> <Platform> (Program expression directive) <State+> (Promise (Try <State+>)))) + (-> <Platform> (Program expression directive) <State+> (Async (Try <State+>)))) (function (_ platform program state) - (promise\wrap + (async\wrap (do try.monad [[state phase_wrapper] (..phase_wrapper archive platform state)] (|> state @@ -264,7 +264,7 @@ (do ! [[state [archive payload]] (|> (..process_runtime archive platform) (///phase.run' state) - promise\wrap) + async\wrap) _ (..cache_module static platform 0 payload) state (with_missing_extensions platform program state)] @@ -379,7 +379,7 @@ (with_expansions [<Context> (as_is [Archive <State+>]) <Result> (as_is (Try <Context>)) - <Return> (as_is (Promise <Result>)) + <Return> (as_is (Async <Result>)) <Signal> (as_is (Resolver <Result>)) <Pending> (as_is [<Return> <Signal>]) <Importer> (as_is (-> Module Module <Return>)) @@ -399,14 +399,14 @@ (stm.var ..independence))] (function (_ compile) (function (import! importer module) - (do {! promise.monad} + (do {! async.monad} [[return signal] (:sharing [<type_vars>] <Context> initial - (Promise [<Return> (Maybe [<Context> - archive.ID - <Signal>])]) + (Async [<Return> (Maybe [<Context> + archive.ID + <Signal>])]) (:assume (stm.commit (do {! stm.monad} @@ -417,14 +417,14 @@ (wrap dependence)))] (case (..verify_dependencies importer module dependence) (#try.Failure error) - (wrap [(promise.resolved (#try.Failure error)) + (wrap [(async.resolved (#try.Failure error)) #.None]) (#try.Success _) (do ! [[archive state] (stm.read current)] (if (archive.archived? archive module) - (wrap [(promise\wrap (#try.Success [archive state])) + (wrap [(async\wrap (#try.Success [archive state])) #.None]) (do ! [@pending (stm.read pending)] @@ -447,7 +447,7 @@ initial <Pending> - (promise.promise []))] + (async.async []))] _ (stm.update (dictionary.put module [return signal]) pending)] (wrap [return (#.Some [[archive state] @@ -455,7 +455,7 @@ signal])])) (#try.Failure error) - (wrap [(promise\wrap (#try.Failure error)) + (wrap [(async\wrap (#try.Failure error)) #.None]))))))))))) _ (case signal #.None @@ -475,7 +475,7 @@ state]) current)] (wrap (#try.Success [merged_archive resulting_state]))))) - _ (promise.future (resolver result))] + _ (async.future (resolver result))] (wrap [])))] return))))) @@ -531,7 +531,7 @@ compiler (..parallel context (function (_ importer import! module_id [archive state] module) - (do {! (try.with promise.monad)} + (do {! (try.with async.monad)} [#let [state (..set_current_module module state)] input (context.read (get@ #&file_system platform) importer @@ -592,11 +592,11 @@ (..with_reset_log state)]) (#try.Failure error) - (promise\wrap (#try.Failure error))))) + (async\wrap (#try.Failure error))))) (#try.Failure error) (do ! [_ (ioW.freeze (get@ #&file_system platform) static archive)] - (promise\wrap (#try.Failure error))))))))))] + (async\wrap (#try.Failure error))))))))))] (compiler archive.runtime_module compilation_module))) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index c29eaaf54..0fc5d90fc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -464,14 +464,14 @@ (format (%.location location) text.new_line error)) -(def: #export (fail error) +(def: #export (failure error) (-> Text Operation) (function (_ [bundle state]) (#try.Failure (locate_error (get@ #.location state) error)))) (def: #export (throw exception parameters) (All [e] (-> (Exception e) e Operation)) - (..fail (exception.construct exception parameters))) + (..failure (exception.construct exception parameters))) (def: #export (assert exception parameters condition) (All [e] (-> (Exception e) e Bit (Operation Any))) @@ -479,14 +479,14 @@ (\ phase.monad wrap []) (..throw exception parameters))) -(def: #export (fail' error) +(def: #export (failure' error) (-> Text (phase.Operation Lux)) (function (_ state) (#try.Failure (locate_error (get@ #.location state) error)))) (def: #export (throw' exception parameters) (All [e] (-> (Exception e) e (phase.Operation Lux))) - (..fail' (exception.construct exception parameters))) + (..failure' (exception.construct exception parameters))) (def: #export (with_stack exception message action) (All [e o] (-> (Exception e) e (Operation o) (Operation o))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux index d0957820c..f8f295429 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux @@ -38,7 +38,7 @@ (#try.Success output) (#try.Failure error) - ((meta.fail (exception.construct ..expansion_failed [name inputs error])) state))))) + ((meta.failure (exception.construct ..expansion_failed [name inputs error])) state))))) (def: #export (expand_one expander name macro inputs) (-> Expander Name Macro (List Code) (Meta Code)) @@ -49,4 +49,4 @@ (wrap single) _ - (meta.fail (exception.construct ..must_have_single_expansion [name inputs expansion]))))) + (meta.failure (exception.construct ..must_have_single_expansion [name inputs expansion]))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux index 327488817..54e4e90d6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -199,14 +199,14 @@ num_sub_patterns (list.size sub_patterns) matches (cond (n.< num_subs num_sub_patterns) (let [[prefix suffix] (list.split (dec num_sub_patterns) subs)] - (list.zip/2 (list\compose prefix (list (type.tuple suffix))) sub_patterns)) + (list.zipped/2 (list\compose prefix (list (type.tuple suffix))) sub_patterns)) (n.> num_subs num_sub_patterns) (let [[prefix suffix] (list.split (dec num_subs) sub_patterns)] - (list.zip/2 subs (list\compose prefix (list (code.tuple suffix))))) + (list.zipped/2 subs (list\compose prefix (list (code.tuple suffix))))) ## (n.= num_subs num_sub_patterns) - (list.zip/2 subs sub_patterns))] + (list.zipped/2 subs sub_patterns))] (do ! [[memberP+ thenA] (list\fold (: (All [a] (-> [Type Code] (Operation [(List Pattern) a]) @@ -230,7 +230,7 @@ [location (#.Record record)] (do ///.monad - [record (//structure.normalize record) + [record (//structure.normal record) [members recordT] (//structure.order record) _ (.case inputT (#.Var _id) @@ -287,7 +287,7 @@ (^ [location (#.Form (list& [_ (#.Tag tag)] values))]) (/.with_location location (do ///.monad - [tag (///extension.lift (meta.normalize tag)) + [tag (///extension.lift (meta.normal tag)) [idx group variantT] (///extension.lift (meta.resolve_tag tag)) _ (//type.with_env (check.check inputT variantT)) @@ -318,7 +318,7 @@ (/coverage.exhaustive? coverage)) (#try.Failure error) - (/.fail error))] + (/.failure error))] (wrap (#/.Case inputA [outputH outputT]))) #.Nil diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index bc4fad3d3..2bb0fe957 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -202,7 +202,7 @@ (and (n.= (list.size flatR) (list.size flatS)) (list.every? (function (_ [coverageR coverageS]) (= coverageR coverageS)) - (list.zip/2 flatR flatS)))) + (list.zipped/2 flatR flatS)))) _ #0))) @@ -344,7 +344,7 @@ (wrap [(#.Some altMSF) altsSF'])) (#try.Failure error) - (try.fail error)) + (try.failure error)) ))))] [successA possibilitiesSF] (fuse_once addition (flat_alt so_far))] (loop [successA successA diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux index 5e41e907e..1ef5c88c4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -58,7 +58,7 @@ (recur value) #.None - (/.fail (ex.construct cannot_analyse [expectedT function_name arg_name body]))) + (/.failure (ex.construct cannot_analyse [expectedT function_name arg_name body]))) (^template [<tag> <instancer>] [(<tag> _) @@ -102,7 +102,7 @@ (analyse archive body)) _ - (/.fail "") + (/.failure "") ))))) (def: #export (apply analyse argsC+ functionT functionA archive functionC) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux index 9ce2b1faa..4e085a6b9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -41,7 +41,7 @@ (#.Right [exported? actualT def_anns _]) (do ! [_ (//type.infer actualT) - (^@ def_name [::module ::name]) (///extension.lift (meta.normalize def_name)) + (^@ def_name [::module ::name]) (///extension.lift (meta.normal def_name)) current (///extension.lift meta.current_module_name)] (if (text\= current ::module) <return> diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux index c49e936ec..ca42337d5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -262,7 +262,7 @@ (def: #export (tagged_sum analyse tag archive valueC) (-> Phase Name Phase) (do {! ///.monad} - [tag (///extension.lift (meta.normalize tag)) + [tag (///extension.lift (meta.normal tag)) [idx group variantT] (///extension.lift (meta.resolve_tag tag)) #let [case_size (list.size group) [lefts right?] (/.choice case_size idx)] @@ -281,14 +281,14 @@ ## records, so they must be normalized for further analysis. ## Normalization just means that all the tags get resolved to their ## canonical form (with their corresponding module identified). -(def: #export (normalize record) +(def: #export (normal record) (-> (List [Code Code]) (Operation (List [Name Code]))) (monad.map ///.monad (function (_ [key val]) (case key [_ (#.Tag key)] (do ///.monad - [key (///extension.lift (meta.normalize key))] + [key (///extension.lift (meta.normal key))] (wrap [key val])) _ @@ -307,7 +307,7 @@ (#.Cons [head_k head_v] _) (do {! ///.monad} - [head_k (///extension.lift (meta.normalize head_k)) + [head_k (///extension.lift (meta.normal head_k)) [_ tag_set recordT] (///extension.lift (meta.resolve_tag head_k)) #let [size_record (list.size record) size_ts (list.size tag_set)] @@ -315,11 +315,11 @@ (wrap []) (/.throw ..record_size_mismatch [size_ts size_record recordT record])) #let [tuple_range (list.indices size_ts) - tag->idx (dictionary.of_list name.hash (list.zip/2 tag_set tuple_range))] + tag->idx (dictionary.of_list name.hash (list.zipped/2 tag_set tuple_range))] idx->val (monad.fold ! (function (_ [key val] idx->val) (do ! - [key (///extension.lift (meta.normalize key))] + [key (///extension.lift (meta.normal key))] (case (dictionary.get key tag->idx) (#.Some idx) (if (dictionary.key? idx->val idx) @@ -347,7 +347,7 @@ _ (do {! ///.monad} - [members (normalize members) + [members (normal members) [membersC recordT] (order members) expectedT (///extension.lift meta.expected_type)] (case expectedT diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux index 61948e7c2..c9227aa31 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux @@ -30,7 +30,7 @@ output]) (#try.Failure error) - ((/.fail error) stateE)))) + ((/.failure error) stateE)))) (def: #export with_fresh_env (All [a] (-> (Operation a) (Operation a))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index f47ca7aea..bd49944a1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -851,7 +851,7 @@ check) (#try.Failure error) - (phase.fail error)))] + (phase.failure error)))] [boxed_reflection_type Value luxT.boxed_type] [reflection_type Value luxT.type] @@ -1123,7 +1123,7 @@ #.None actualJC))))) true - (list.zip/2 parameters inputsJT)))]] + (list.zipped/2 parameters inputsJT)))]] (wrap (and correct_class? correct_method? static_matches? @@ -1153,7 +1153,7 @@ #.None actualJC))))) true - (list.zip/2 parameters inputsJT)))))) + (list.zipped/2 parameters inputsJT)))))) (def: idx_to_parameter (-> Nat .Type) @@ -1278,8 +1278,8 @@ (def: (aliasing expected actual) (-> (List (Type Var)) (List (Type Var)) Aliasing) - (|> (list.zip/2 (list\map jvm_parser.name actual) - (list\map jvm_parser.name expected)) + (|> (list.zipped/2 (list\map jvm_parser.name actual) + (list\map jvm_parser.name expected)) (dictionary.of_list text.hash))) (def: (method_candidate class_loader actual_class_tvars class_name actual_method_tvars method_name method_style inputsJT) @@ -1360,7 +1360,7 @@ (def: (decorate_inputs typesT inputsA) (-> (List (Type Value)) (List Analysis) (List Analysis)) (|> inputsA - (list.zip/2 (list\map (|>> ..signature /////analysis.text) typesT)) + (list.zipped/2 (list\map (|>> ..signature /////analysis.text) typesT)) (list\map (function (_ [type value]) (/////analysis.tuple (list type value)))))) @@ -1917,7 +1917,7 @@ phase.lift)] (|> super_parameters (monad.map ! (..reflection_type mapping)) - (\ ! map (|>> (list.zip/2 parent_parameters))))) + (\ ! map (|>> (list.zipped/2 parent_parameters))))) (phase.lift (exception.throw ..mismatched_super_parameters [parent_name expected_count actual_count])))) #.None @@ -2067,7 +2067,7 @@ _ (phase.assert ..class_parameter_mismatch [expected_parameters actual_parameters] (n.= (list.size expected_parameters) (list.size actual_parameters)))] - (wrap (|> (list.zip/2 expected_parameters actual_parameters) + (wrap (|> (list.zipped/2 expected_parameters actual_parameters) (list\fold (function (_ [expected actual] mapping) (case (jvm_parser.var? actual) (#.Some actual) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index a5e924af1..2804d568f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -59,7 +59,7 @@ (function (_ [argT argC]) (typeA.with_type argT (analyse archive argC))) - (list.zip/2 inputsT+ args))] + (list.zipped/2 inputsT+ args))] (wrap (#////analysis.Extension extension_name argsA))) (////analysis.throw ///.incorrect_arity [extension_name num_expected num_actual])))))) @@ -91,7 +91,7 @@ [raw <code>.text] (case (text.size raw) 1 (wrap (|> raw (text.nth 0) maybe.assume)) - _ (<>.fail (exception.construct ..char_text_must_be_size_1 [raw]))))) + _ (<>.failure (exception.construct ..char_text_must_be_size_1 [raw]))))) (def: lux::syntax_char_case! (..custom diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index 079fc96ec..bcab57722 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -345,7 +345,7 @@ (wrap elementJT) #.None - (<>.fail (exception.construct ..not-an-object-array arrayJT))) + (<>.failure (exception.construct ..not-an-object-array arrayJT))) #.None (undefined)))) @@ -1053,7 +1053,7 @@ bodyS]) (do ! [bodyG (//////generation.with-context artifact-id - (generate archive bodyS))] + (generate archive bodyS))] (wrap (method.method ($_ modifier\compose method.public method.final diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index 41e7cda43..4febcca3c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -92,7 +92,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index bfd952cc9..a4c5ebd10 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -90,7 +90,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux index 7d2416d67..74cbae5c8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux @@ -29,22 +29,22 @@ [reference [variable (#+ Register)]]]]]) -(def: equals-name +(def: equals_name "equals") -(def: equals-type +(def: equals_type (type.method [(list //type.value) type.boolean (list)])) -(def: (pop-alt stack-depth) +(def: (pop_alt stack_depth) (-> Nat (Bytecode Any)) - (.case stack-depth + (.case stack_depth 0 (_\wrap []) 1 _.pop 2 _.pop2 _ ## (n.> 2) ($_ _.compose _.pop2 - (pop-alt (n.- 2 stack-depth))))) + (pop_alt (n.- 2 stack_depth))))) (def: int (-> (I64 Any) (Bytecode Any)) @@ -62,15 +62,15 @@ (Bytecode Any) ($_ _.compose _.dup - (//runtime.get //runtime.stack-head))) + (//runtime.get //runtime.stack_head))) (def: pop (Bytecode Any) ($_ _.compose - (//runtime.get //runtime.stack-tail) + (//runtime.get //runtime.stack_tail) (_.checkcast //type.stack))) -(def: (left-projection lefts) +(def: (left_projection lefts) (-> Nat (Bytecode Any)) ($_ _.compose (_.checkcast //type.tuple) @@ -80,16 +80,16 @@ _.aaload lefts - //runtime.left-projection))) + //runtime.left_projection))) -(def: (right-projection lefts) +(def: (right_projection lefts) (-> Nat (Bytecode Any)) ($_ _.compose (_.checkcast //type.tuple) (..int lefts) - //runtime.right-projection)) + //runtime.right_projection)) -(def: (path' stack-depth @else @end phase archive path) +(def: (path' stack_depth @else @end phase archive path) (-> Nat Label Label (Generator Path)) (.case path #synthesis.Pop @@ -104,7 +104,7 @@ (do phase.monad [bodyG (phase archive bodyS)] (wrap ($_ _.compose - (..pop-alt stack-depth) + (..pop_alt stack_depth) bodyG (_.goto @end)))) @@ -112,8 +112,8 @@ [(^ (<pattern> lefts)) (operation\wrap (do _.monad - [@success _.new-label - @fail _.new-label] + [@success _.new_label + @fail _.new_label] ($_ _.compose ..peek (_.checkcast //type.variant) @@ -123,10 +123,10 @@ _.dup (_.ifnull @fail) (_.goto @success) - (_.set-label @fail) + (_.set_label @fail) _.pop (_.goto @else) - (_.set-label @success) + (_.set_label @success) //runtime.push)))]) ([synthesis.side/left false] [synthesis.side/right true]) @@ -137,19 +137,19 @@ ..peek (<projection> lefts) //runtime.push))]) - ([synthesis.member/left ..left-projection] - [synthesis.member/right ..right-projection]) + ([synthesis.member/left ..left_projection] + [synthesis.member/right ..right_projection]) ## Extra optimization (^ (synthesis.path/seq (synthesis.member/left 0) - (synthesis.!bind-top register thenP))) + (synthesis.!bind_top register thenP))) (do phase.monad - [thenG (path' stack-depth @else @end phase archive thenP)] + [thenG (path' stack_depth @else @end phase archive thenP)] (wrap ($_ _.compose ..peek (_.checkcast //type.tuple) - _.iconst-0 + _.iconst_0 _.aaload (_.astore register) thenG))) @@ -158,9 +158,9 @@ (^template [<pm> <projection>] [(^ (synthesis.path/seq (<pm> lefts) - (synthesis.!bind-top register thenP))) + (synthesis.!bind_top register thenP))) (do phase.monad - [then! (path' stack-depth @else @end phase archive thenP)] + [then! (path' stack_depth @else @end phase archive thenP)] (wrap ($_ _.compose ..peek (_.checkcast //type.tuple) @@ -168,25 +168,25 @@ <projection> (_.astore register) then!)))]) - ([synthesis.member/left //runtime.left-projection] - [synthesis.member/right //runtime.right-projection]) + ([synthesis.member/left //runtime.left_projection] + [synthesis.member/right //runtime.right_projection]) (#synthesis.Alt leftP rightP) (do phase.monad - [@alt-else //runtime.forge-label - left! (path' (inc stack-depth) @alt-else @end phase archive leftP) - right! (path' stack-depth @else @end phase archive rightP)] + [@alt_else //runtime.forge_label + left! (path' (inc stack_depth) @alt_else @end phase archive leftP) + right! (path' stack_depth @else @end phase archive rightP)] (wrap ($_ _.compose _.dup left! - (_.set-label @alt-else) + (_.set_label @alt_else) _.pop right!))) (#synthesis.Seq leftP rightP) (do phase.monad - [left! (path' stack-depth @else @end phase archive leftP) - right! (path' stack-depth @else @end phase archive rightP)] + [left! (path' stack_depth @else @end phase archive leftP) + right! (path' stack_depth @else @end phase archive rightP)] (wrap ($_ _.compose left! right!))) @@ -198,14 +198,14 @@ (def: (path @end phase archive path) (-> Label (Generator Path)) (do phase.monad - [@else //runtime.forge-label + [@else //runtime.forge_label pathG (..path' 1 @else @end phase archive path)] (wrap ($_ _.compose pathG - (_.set-label @else) + (_.set_label @else) _.pop - //runtime.pm-failure - _.aconst-null + //runtime.pm_failure + _.aconst_null (_.goto @end))))) (def: #export (if phase archive [conditionS thenS elseS]) @@ -215,17 +215,17 @@ thenG (phase archive thenS) elseG (phase archive elseS)] (wrap (do _.monad - [@else _.new-label - @end _.new-label] + [@else _.new_label + @end _.new_label] ($_ _.compose conditionG (//value.unwrap type.boolean) (_.ifeq @else) thenG (_.goto @end) - (_.set-label @else) + (_.set_label @else) elseG - (_.set-label @end)))))) + (_.set_label @end)))))) (def: #export (let phase archive [inputS register bodyS]) (Generator [Synthesis Register Synthesis]) @@ -241,26 +241,26 @@ (Generator [(List synthesis.Member) Synthesis]) (do phase.monad [recordG (phase archive recordS)] - (wrap (list\fold (function (_ step so-far) + (wrap (list\fold (function (_ step so_far) (.let [next (.case step (#.Left lefts) - (..left-projection lefts) + (..left_projection lefts) (#.Right lefts) - (..right-projection lefts))] - (_.compose so-far next))) + (..right_projection lefts))] + (_.compose so_far next))) recordG (list.reverse path))))) (def: #export (case phase archive [valueS path]) (Generator [Synthesis Path]) (do phase.monad - [@end //runtime.forge-label + [@end //runtime.forge_label valueG (phase archive valueS) pathG (..path @end phase archive path)] (wrap ($_ _.compose - _.aconst-null + _.aconst_null valueG //runtime.push pathG - (_.set-label @end))))) + (_.set_label @end))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index da80cbfdd..943604bbc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -75,80 +75,80 @@ (_\wrap [])) ))) -(def: this-offset 1) +(def: this_offset 1) -(def: #export (method class environment function-arity @begin body apply-arity) +(def: #export (method class environment function_arity @begin body apply_arity) (-> (Type Class) (Environment Synthesis) Arity Label (Bytecode Any) Arity (Resource Method)) - (let [num-partials (dec function-arity) - over-extent (i.- (.int apply-arity) - (.int function-arity))] + (let [num_partials (dec function_arity) + over_extent (i.- (.int apply_arity) + (.int function_arity))] (method.method //.modifier ////runtime.apply::name - (////runtime.apply::type apply-arity) + (////runtime.apply::type apply_arity) (list) - (#.Some (case num-partials + (#.Some (case num_partials 0 ($_ _.compose ////reference.this - (..inputs ..this-offset apply-arity) - (_.invokevirtual class //implementation.name (//implementation.type function-arity)) + (..inputs ..this_offset apply_arity) + (_.invokevirtual class //implementation.name (//implementation.type function_arity)) _.areturn) _ (do _.monad - [@default _.new-label - @labelsH _.new-label - @labelsT (|> _.new-label - (list.repeat (dec num-partials)) + [@default _.new_label + @labelsH _.new_label + @labelsT (|> _.new_label + (list.repeat (dec num_partials)) (monad.seq _.monad)) #let [cases (|> (list\compose (#.Cons [@labelsH @labelsT]) (list @default)) list.enumeration (list\map (function (_ [stage @case]) - (let [current-partials (|> (list.indices stage) + (let [current_partials (|> (list.indices stage) (list\map (///partial.get class)) (monad.seq _.monad)) - already-partial? (n.> 0 stage) - exact-match? (i.= over-extent (.int stage)) - has-more-than-necessary? (i.> over-extent (.int stage))] + already_partial? (n.> 0 stage) + exact_match? (i.= over_extent (.int stage)) + has_more_than_necessary? (i.> over_extent (.int stage))] ($_ _.compose - (_.set-label @case) - (cond exact-match? + (_.set_label @case) + (cond exact_match? ($_ _.compose ////reference.this - (if already-partial? + (if already_partial? (_.invokevirtual class //reset.name (//reset.type class)) (_\wrap [])) - current-partials - (..inputs ..this-offset apply-arity) - (_.invokevirtual class //implementation.name (//implementation.type function-arity)) + current_partials + (..inputs ..this_offset apply_arity) + (_.invokevirtual class //implementation.name (//implementation.type function_arity)) _.areturn) - has-more-than-necessary? - (let [inputs-to-completion (|> function-arity (n.- stage)) - inputs-left (|> apply-arity (n.- inputs-to-completion))] + has_more_than_necessary? + (let [inputs_to_completion (|> function_arity (n.- stage)) + inputs_left (|> apply_arity (n.- inputs_to_completion))] ($_ _.compose ////reference.this (_.invokevirtual class //reset.name (//reset.type class)) - current-partials - (..inputs ..this-offset inputs-to-completion) - (_.invokevirtual class //implementation.name (//implementation.type function-arity)) - (apply (n.+ ..this-offset inputs-to-completion) inputs-left) + current_partials + (..inputs ..this_offset inputs_to_completion) + (_.invokevirtual class //implementation.name (//implementation.type function_arity)) + (apply (n.+ ..this_offset inputs_to_completion) inputs_left) _.areturn)) - ## (i.< over-extent (.int stage)) - (let [current-environment (|> (list.indices (list.size environment)) + ## (i.< over_extent (.int stage)) + (let [current_environment (|> (list.indices (list.size environment)) (list\map (///foreign.get class)) (monad.seq _.monad)) - missing-partials (|> _.aconst-null - (list.repeat (|> num-partials (n.- apply-arity) (n.- stage))) + missing_partials (|> _.aconst_null + (list.repeat (|> num_partials (n.- apply_arity) (n.- stage))) (monad.seq _.monad))] ($_ _.compose (_.new class) _.dup - current-environment + current_environment ///partial/count.value - (..increment apply-arity) - current-partials - (..inputs ..this-offset apply-arity) - missing-partials - (_.invokevirtual class //init.name (//init.type environment function-arity)) + (..increment apply_arity) + current_partials + (..inputs ..this_offset apply_arity) + missing_partials + (_.invokevirtual class //init.name (//init.type environment function_arity)) _.areturn))))))) (monad.seq _.monad))]] ($_ _.compose diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index ef5717521..f44d62118 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -56,18 +56,18 @@ type.void (list)])) -(def: no-partials (|> 0 unsigned.u1 try.assumed _.bipush)) +(def: no_partials (|> 0 unsigned.u1 try.assumed _.bipush)) -(def: #export (super environment-size arity) +(def: #export (super environment_size arity) (-> Nat Arity (Bytecode Any)) - (let [arity-register (inc environment-size)] + (let [arity_register (inc environment_size)] ($_ _.compose (if (arity.unary? arity) - ..no-partials - (_.iload arity-register)) + ..no_partials + (_.iload arity_register)) (_.invokespecial ///abstract.class ..name ///abstract.init)))) -(def: (store-all amount put offset) +(def: (store_all amount put offset) (-> Nat (-> Register (Bytecode Any) (Bytecode Any)) (-> Register Register) @@ -80,19 +80,19 @@ (def: #export (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) - (let [environment-size (list.size environment) - offset-foreign (: (-> Register Register) + (let [environment_size (list.size environment) + offset_foreign (: (-> Register Register) (n.+ 1)) - offset-arity (: (-> Register Register) - (|>> offset-foreign (n.+ environment-size))) - offset-partial (: (-> Register Register) - (|>> offset-arity (n.+ 1)))] + offset_arity (: (-> Register Register) + (|>> offset_foreign (n.+ environment_size))) + offset_partial (: (-> Register Register) + (|>> offset_arity (n.+ 1)))] (method.method //.modifier ..name (..type environment arity) (list) (#.Some ($_ _.compose ////reference.this - (..super environment-size arity) - (store-all environment-size (///foreign.put class) offset-foreign) - (store-all (dec arity) (///partial.put class) offset-partial) + (..super environment_size arity) + (store_all environment_size (///foreign.put class) offset_foreign) + (store_all (dec arity) (///partial.put class) offset_partial) _.return))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux index f6bfa0278..19c84c828 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux @@ -42,12 +42,12 @@ ["." arity (#+ Arity)] ["." phase]]]]]]) -(def: #export (instance' foreign-setup class environment arity) +(def: #export (instance' foreign_setup class environment arity) (-> (List (Bytecode Any)) (Type Class) (Environment Synthesis) Arity (Bytecode Any)) ($_ _.compose (_.new class) _.dup - (monad.seq _.monad foreign-setup) + (monad.seq _.monad foreign_setup) (///partial.new arity) (_.invokespecial class //init.name (//init.type environment arity)))) @@ -59,23 +59,23 @@ (def: #export (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) - (let [after-this (: (-> Nat Nat) + (let [after_this (: (-> Nat Nat) (n.+ 1)) - environment-size (list.size environment) - after-environment (: (-> Nat Nat) - (|>> after-this (n.+ environment-size))) - after-arity (: (-> Nat Nat) - (|>> after-environment (n.+ 1)))] + environment_size (list.size environment) + after_environment (: (-> Nat Nat) + (|>> after_this (n.+ environment_size))) + after_arity (: (-> Nat Nat) + (|>> after_environment (n.+ 1)))] (method.method //.modifier //init.name (//init.type environment arity) (list) (#.Some ($_ _.compose ////reference.this - (//init.super environment-size arity) + (//init.super environment_size arity) (monad.map _.monad (function (_ register) - (///foreign.put class register (_.aload (after-this register)))) - (list.indices environment-size)) + (///foreign.put class register (_.aload (after_this register)))) + (list.indices environment_size)) (monad.map _.monad (function (_ register) - (///partial.put class register (_.aload (after-arity register)))) + (///partial.put class register (_.aload (after_arity register)))) (list.indices (n.- ///arity.minimum arity))) _.areturn))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index 2f6b8041c..c0fb1765f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -137,7 +137,7 @@ (def: (define! library loader [module name] valueG) (-> Library java/lang/ClassLoader Name (Bytecode Any) (Try [Text Any Definition])) (let [class-name (format (text.replace-all .module-separator class-path-separator module) - class-path-separator (name.normalize name) + class-path-separator (name.normal name) "___" (%.nat (text\hash name)))] (do try.monad [[value definition] (evaluate! library loader class-name valueG)] @@ -150,7 +150,7 @@ (: //runtime.Host (implementation (def: (evaluate! temp-label valueG) - (let [eval-class (|> temp-label name.normalize (text.replace-all " " "$"))] + (let [eval-class (|> temp-label name.normal (text.replace-all " " "$"))] (\ try.monad map product.left (..evaluate! library loader eval-class valueG)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux index 67a384781..e87a3f0df 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux @@ -48,58 +48,58 @@ class.final )) -(def: nil //runtime.none-injection) +(def: nil //runtime.none_injection) -(def: amount-of-inputs +(def: amount_of_inputs (Bytecode Any) ($_ _.compose - _.aload-0 + _.aload_0 _.arraylength)) (def: decrease (Bytecode Any) ($_ _.compose - _.iconst-1 + _.iconst_1 _.isub)) (def: head (Bytecode Any) ($_ _.compose _.dup - _.aload-0 + _.aload_0 _.swap _.aaload _.swap - _.dup-x2 + _.dup_x2 _.pop)) (def: pair (Bytecode Any) ($_ _.compose - _.iconst-2 + _.iconst_2 (_.anewarray ^Object) - _.dup-x1 + _.dup_x1 _.swap - _.iconst-0 + _.iconst_0 _.swap _.aastore - _.dup-x1 + _.dup_x1 _.swap - _.iconst-1 + _.iconst_1 _.swap _.aastore)) -(def: cons //runtime.right-injection) +(def: cons //runtime.right_injection) -(def: input-list +(def: input_list (Bytecode Any) (do _.monad - [@loop _.new-label - @end _.new-label] + [@loop _.new_label + @end _.new_label] ($_ _.compose ..nil - ..amount-of-inputs - (_.set-label @loop) + ..amount_of_inputs + (_.set_label @loop) ..decrease _.dup (_.iflt @end) @@ -108,28 +108,29 @@ ..cons _.swap (_.goto @loop) - (_.set-label @end) + (_.set_label @end) _.pop))) -(def: feed-inputs //runtime.apply) +(def: feed_inputs + //runtime.apply) -(def: run-io +(def: run_io (Bytecode Any) ($_ _.compose (_.checkcast //function/abstract.class) - _.aconst-null + _.aconst_null //runtime.apply)) (def: #export (program program) (-> (Bytecode Any) Definition) - (let [super-class (|> ..^Object type.reflection reflection.reflection name.internal) + (let [super_class (|> ..^Object type.reflection reflection.reflection name.internal) main (method.method ..main::modifier "main" ..main::type (list) (#.Some ($_ _.compose program - ..input-list - ..feed-inputs - ..run-io + ..input_list + ..feed_inputs + ..run_io _.return)))] [..class (<| (format.run class.writer) @@ -137,7 +138,7 @@ (class.class version.v6_0 ..program::modifier (name.internal ..class) - super-class + super_class (list) (list) (list main) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux index c41e5c16a..441cf5c63 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux @@ -28,26 +28,26 @@ (def: #export this (Bytecode Any) - _.aload-0) + _.aload_0) (template [<name> <prefix>] [(def: #export <name> (-> Register Text) (|>> %.nat (format <prefix>)))] - [foreign-name "f"] - [partial-name "p"] + [foreign_name "f"] + [partial_name "p"] ) (def: (foreign archive variable) (-> Archive Register (Operation (Bytecode Any))) (do {! ////.monad} - [bytecode-name (\ ! map //runtime.class-name + [bytecode_name (\ ! map //runtime.class_name (generation.context archive))] (wrap ($_ _.compose ..this - (_.getfield (type.class bytecode-name (list)) - (..foreign-name variable) + (_.getfield (type.class bytecode_name (list)) + (..foreign_name variable) //type.value))))) (def: #export (variable archive variable) @@ -62,6 +62,6 @@ (def: #export (constant archive name) (-> Archive Name (Operation (Bytecode Any))) (do {! ////.monad} - [bytecode-name (\ ! map //runtime.class-name + [bytecode_name (\ ! map //runtime.class_name (generation.remember archive name))] - (wrap (_.getstatic (type.class bytecode-name (list)) //value.field //type.value)))) + (wrap (_.getstatic (type.class bytecode_name (list)) //value.field //type.value)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux index 4ff9bdb81..6bc0ffe91 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux @@ -57,12 +57,12 @@ (case (if right? (.inc lefts) lefts) - 0 _.iconst-0 - 1 _.iconst-1 - 2 _.iconst-2 - 3 _.iconst-3 - 4 _.iconst-4 - 5 _.iconst-5 + 0 _.iconst_0 + 1 _.iconst_1 + 2 _.iconst_2 + 3 _.iconst_3 + 4 _.iconst_4 + 5 _.iconst_5 tag (case (signed.s1 (.int tag)) (#try.Success value) (_.bipush value) @@ -78,8 +78,8 @@ (def: #export (flag right?) (-> Bit (Bytecode Any)) (if right? - //runtime.right-flag - //runtime.left-flag)) + //runtime.right_flag + //runtime.left_flag)) (def: #export (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux index 3e2ff3d09..36edc060a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux @@ -27,23 +27,23 @@ ## else (undefined))))] - [primitive-wrapper + [primitive_wrapper box.boolean box.byte box.short box.int box.long box.float box.double box.char] - [primitive-unwrap + [primitive_unwrap "booleanValue" "byteValue" "shortValue" "intValue" "longValue" "floatValue" "doubleValue" "charValue"] ) (def: #export (wrap type) (-> (Type Primitive) (Bytecode Any)) - (let [wrapper (type.class (primitive-wrapper type) (list))] + (let [wrapper (type.class (primitive_wrapper type) (list))] (_.invokestatic wrapper "valueOf" (type.method [(list) (list type) wrapper (list)])))) (def: #export (unwrap type) (-> (Type Primitive) (Bytecode Any)) - (let [wrapper (type.class (primitive-wrapper type) (list))] + (let [wrapper (type.class (primitive_wrapper type) (list))] ($_ _.compose (_.checkcast wrapper) - (_.invokevirtual wrapper (primitive-unwrap type) (type.method [(list) (list) type (list)]))))) + (_.invokevirtual wrapper (primitive_unwrap type) (type.method [(list) (list) type (list)]))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index 8f1e5b117..f01c90d7a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -107,7 +107,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index 231bb4a29..07b72e742 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -75,7 +75,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 34009976f..26aeb7f76 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -114,7 +114,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux index 4917eb90f..f646f82cd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux @@ -81,7 +81,7 @@ ((~' wrap) ((~ g!proc) [(~+ g!input+)]))) (~' _) - (macro.fail (wrong-arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))) + (macro.failure (wrong-arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))) (arity: nullary +0) (arity: unary +1) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index 40ef044f6..017a7a547 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -81,7 +81,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index 3e8e09d8c..9e4f78b29 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -76,7 +76,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.local (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index ec3def7fd..f383839f3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -63,7 +63,7 @@ (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip/2 ids) + (list.zipped/2 ids) (list\map (function (_ [id var]) (list (code.local_identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux index 2c6deeb27..c7f699f87 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -141,7 +141,7 @@ [5 #Directive <binary>.text] [6 #Custom <binary>.text]) - _ (<>.fail (exception.construct ..invalid_category [tag])))))] + _ (<>.failure (exception.construct ..invalid_category [tag])))))] (|> (<binary>.row/64 category) (\ <>.monad map (row\fold (function (_ artifact registry) (product.right diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index cb52004f4..ba2cec5c2 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -10,7 +10,7 @@ ["." try (#+ Try)] ["." exception (#+ exception:)] [concurrency - ["." promise (#+ Promise) ("#\." monad)]] + ["." async (#+ Async) ("#\." monad)]] ["<>" parser ["<.>" binary (#+ Parser)]]] [data @@ -91,16 +91,16 @@ (get@ #static.artifact_extension static))) (def: (ensure_directory fs path) - (-> (file.System Promise) file.Path (Promise (Try Any))) - (do promise.monad + (-> (file.System Async) file.Path (Async (Try Any))) + (do async.monad [? (\ fs directory? path)] (if ? (wrap (#try.Success [])) (\ fs make_directory path)))) (def: #export (prepare fs static module_id) - (-> (file.System Promise) Static archive.ID (Promise (Try Any))) - (do {! promise.monad} + (-> (file.System Async) Static archive.ID (Async (Try Any))) + (do {! async.monad} [#let [module (..module fs static module_id)] module_exists? (\ fs directory? module)] (if module_exists? @@ -119,40 +119,40 @@ error]))))))))) (def: #export (write fs static module_id artifact_id content) - (-> (file.System Promise) Static archive.ID artifact.ID Binary (Promise (Try Any))) + (-> (file.System Async) Static archive.ID artifact.ID Binary (Async (Try Any))) (\ fs write content (..artifact fs static module_id artifact_id))) (def: #export (enable fs static) - (-> (file.System Promise) Static (Promise (Try Any))) - (do (try.with promise.monad) + (-> (file.System Async) Static (Async (Try Any))) + (do (try.with async.monad) [_ (..ensure_directory fs (get@ #static.target static))] (..ensure_directory fs (..archive fs static)))) (def: (general_descriptor fs static) - (-> (file.System Promise) Static file.Path) + (-> (file.System Async) Static file.Path) (format (..archive fs static) (\ fs separator) "general_descriptor")) (def: #export (freeze fs static archive) - (-> (file.System Promise) Static Archive (Promise (Try Any))) + (-> (file.System Async) Static Archive (Async (Try Any))) (\ fs write (archive.export ///.version archive) (..general_descriptor fs static))) (def: module_descriptor_file "module_descriptor") (def: (module_descriptor fs static module_id) - (-> (file.System Promise) Static archive.ID file.Path) + (-> (file.System Async) Static archive.ID file.Path) (format (..module fs static module_id) (\ fs separator) ..module_descriptor_file)) (def: #export (cache fs static module_id content) - (-> (file.System Promise) Static archive.ID Binary (Promise (Try Any))) + (-> (file.System Async) Static archive.ID Binary (Async (Try Any))) (\ fs write content (..module_descriptor fs static module_id))) (def: (read_module_descriptor fs static module_id) - (-> (file.System Promise) Static archive.ID (Promise (Try Binary))) + (-> (file.System Async) Static archive.ID (Async (Try Binary))) (\ fs read (..module_descriptor fs static module_id))) (def: parser @@ -177,8 +177,8 @@ (wrap (set@ #.modules modules (fresh_analysis_state host))))) (def: (cached_artifacts fs static module_id) - (-> (file.System Promise) Static archive.ID (Promise (Try (Dictionary Text Binary)))) - (let [! (try.with promise.monad)] + (-> (file.System Async) Static archive.ID (Async (Try (Dictionary Text Binary)))) + (let [! (try.with async.monad)] (|> (..module fs static module_id) (\ fs directory_files) (\ ! map (|>> (list\map (function (_ file) @@ -339,19 +339,19 @@ (def: (load_definitions fs static module_id host_environment descriptor document) (All [expression directive] - (-> (file.System Promise) Static archive.ID (generation.Host expression directive) + (-> (file.System Async) Static archive.ID (generation.Host expression directive) Descriptor (Document .Module) - (Promise (Try [[Descriptor (Document .Module) Output] - Bundles])))) - (do (try.with promise.monad) + (Async (Try [[Descriptor (Document .Module) Output] + Bundles])))) + (do (try.with async.monad) [actual (cached_artifacts fs static module_id) #let [expected (|> descriptor (get@ #descriptor.registry) artifact.artifacts)] - [document bundles output] (promise\wrap (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))] + [document bundles output] (async\wrap (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))] (wrap [[descriptor document output] bundles]))) (def: (purge! fs static [module_name module_id]) - (-> (file.System Promise) Static [Module archive.ID] (Promise (Try Any))) - (do {! (try.with promise.monad)} + (-> (file.System Async) Static [Module archive.ID] (Async (Try Any))) + (do {! (try.with async.monad)} [#let [cache (..module fs static module_id)] _ (|> cache (\ fs directory_files) @@ -404,15 +404,15 @@ (def: (load_every_reserved_module host_environment fs static import contexts archive) (All [expression directive] - (-> (generation.Host expression directive) (file.System Promise) Static Import (List Context) Archive - (Promise (Try [Archive .Lux Bundles])))) - (do {! (try.with promise.monad)} + (-> (generation.Host expression directive) (file.System Async) Static Import (List Context) Archive + (Async (Try [Archive .Lux Bundles])))) + (do {! (try.with async.monad)} [pre_loaded_caches (|> archive archive.reservations (monad.map ! (function (_ [module_name module_id]) (do ! [data (..read_module_descriptor fs static module_id) - [descriptor document] (promise\wrap (<binary>.run ..parser data))] + [descriptor document] (async\wrap (<binary>.run ..parser data))] (if (text\= archive.runtime_module module_name) (wrap [true [module_name [module_id [descriptor document]]]]) @@ -428,7 +428,7 @@ archive) (\ try.monad map (dependency.load_order $.key)) (\ try.monad join) - promise\wrap) + async\wrap) #let [purge (..full_purge pre_loaded_caches load_order)] _ (|> purge dictionary.entries @@ -440,7 +440,7 @@ [[descriptor,document,output bundles] (..load_definitions fs static module_id host_environment descriptor document)] (wrap [[module_name descriptor,document,output] bundles])))))] - (promise\wrap + (async\wrap (do {! try.monad} [archive (monad.fold ! (function (_ [[module descriptor,document,output] _bundle] archive) @@ -461,14 +461,14 @@ (def: #export (thaw host_environment fs static import contexts) (All [expression directive] - (-> (generation.Host expression directive) (file.System Promise) Static Import (List Context) - (Promise (Try [Archive .Lux Bundles])))) - (do promise.monad + (-> (generation.Host expression directive) (file.System Async) Static Import (List Context) + (Async (Try [Archive .Lux Bundles])))) + (do async.monad [binary (\ fs read (..general_descriptor fs static))] (case binary (#try.Success binary) - (do (try.with promise.monad) - [archive (promise\wrap (archive.import ///.version binary))] + (do (try.with async.monad) + [archive (async\wrap (archive.import ///.version binary))] (..load_every_reserved_module host_environment fs static import contexts archive)) (#try.Failure error) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux index 6e619d93d..f62d00cf2 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -9,7 +9,7 @@ ["." try (#+ Try)] ["." exception (#+ exception:)] [concurrency - ["." promise (#+ Promise) ("#\." monad)]]] + ["." async (#+ Async) ("#\." monad)]]] [data [binary (#+ Binary)] ["." text ("#\." hash) @@ -48,19 +48,19 @@ (def: #export (path fs context module) (All [m] (-> (file.System m) Context Module file.Path)) (|> module - (//.sanitize fs) + (//.safe fs) (format context (\ fs separator)))) (def: (find_source_file fs importer contexts module extension) - (-> (file.System Promise) Module (List Context) Module Extension - (Promise (Try file.Path))) + (-> (file.System Async) Module (List Context) Module Extension + (Async (Try file.Path))) (case contexts #.Nil - (promise\wrap (exception.throw ..cannot_find_module [importer module])) + (async\wrap (exception.throw ..cannot_find_module [importer module])) (#.Cons context contexts') (let [path (format (..path fs context module) extension)] - (do promise.monad + (do async.monad [? (\ fs file? path)] (if ? (wrap (#try.Success path)) @@ -71,11 +71,11 @@ (format partial_host_extension ..lux_extension)) (def: (find_local_source_file fs importer import contexts partial_host_extension module) - (-> (file.System Promise) Module Import (List Context) Extension Module - (Promise (Try [file.Path Binary]))) + (-> (file.System Async) Module Import (List Context) Extension Module + (Async (Try [file.Path Binary]))) ## Preference is explicitly being given to Lux files that have a host extension. ## Normal Lux files (i.e. without a host extension) are then picked as fallback files. - (do {! promise.monad} + (do {! async.monad} [outcome (..find_source_file fs importer contexts module (..full_host_extension partial_host_extension))] (case outcome (#try.Success path) @@ -107,11 +107,11 @@ (exception.throw ..cannot_find_module [importer module])))))) (def: (find_any_source_file fs importer import contexts partial_host_extension module) - (-> (file.System Promise) Module Import (List Context) Extension Module - (Promise (Try [file.Path Binary]))) + (-> (file.System Async) Module Import (List Context) Extension Module + (Async (Try [file.Path Binary]))) ## Preference is explicitly being given to Lux files that have a host extension. ## Normal Lux files (i.e. without a host extension) are then picked as fallback files. - (do {! promise.monad} + (do {! async.monad} [outcome (find_local_source_file fs importer import contexts partial_host_extension module)] (case outcome (#try.Success [path data]) @@ -121,9 +121,9 @@ (wrap (..find_library_source_file importer import partial_host_extension module))))) (def: #export (read fs importer import contexts partial_host_extension module) - (-> (file.System Promise) Module Import (List Context) Extension Module - (Promise (Try Input))) - (do (try.with promise.monad) + (-> (file.System Async) Module Import (List Context) Extension Module + (Async (Try Input))) + (do (try.with async.monad) [[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)] (case (\ utf8.codec decode binary) (#try.Success code) @@ -133,21 +133,21 @@ #////.code code}) (#try.Failure _) - (promise\wrap (exception.throw ..cannot_read_module [module]))))) + (async\wrap (exception.throw ..cannot_read_module [module]))))) (type: #export Enumeration (Dictionary file.Path Binary)) (def: (enumerate_context fs directory enumeration) - (-> (file.System Promise) Context Enumeration (Promise (Try Enumeration))) - (do {! (try.with promise.monad)} + (-> (file.System Async) Context Enumeration (Async (Try Enumeration))) + (do {! (try.with async.monad)} [enumeration (|> directory (\ fs directory_files) (\ ! map (monad.fold ! (function (_ file enumeration) (if (text.ends_with? ..lux_extension file) (do ! [source_code (\ fs read file)] - (promise\wrap + (async\wrap (dictionary.try_put (file.name fs file) source_code enumeration))) (wrap enumeration))) enumeration)) @@ -158,12 +158,12 @@ (\ ! join)))) (def: Action - (type (All [a] (Promise (Try a))))) + (type (All [a] (Async (Try a))))) (def: #export (enumerate fs contexts) - (-> (file.System Promise) (List Context) (Action Enumeration)) + (-> (file.System Async) (List Context) (Action Enumeration)) (monad.fold (: (Monad Action) - (try.with promise.monad)) + (try.with async.monad)) (..enumerate_context fs) (: Enumeration (dictionary.new text.hash)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index 60c50db11..8f0b9ee68 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -5,9 +5,7 @@ [abstract ["." monad (#+ Monad do)]] [control - ["." try (#+ Try)] - [concurrency - ["." promise (#+ Promise)]]] + ["." try (#+ Try)]] [data ["." binary (#+ Binary)] ["." maybe ("#\." functor)] diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index f7e3ddf03..522b564ab 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -68,13 +68,13 @@ [[state' output] (operation (get state))] (wrap [(set state' state) output])))) -(def: #export fail +(def: #export failure (-> Text Operation) (|>> #try.Failure (state.lift try.monad))) (def: #export (throw exception parameters) (All [e] (-> (Exception e) e Operation)) - (..fail (ex.construct exception parameters))) + (..failure (ex.construct exception parameters))) (def: #export (lift error) (All [s a] (-> (Try a) (Operation s a))) |