diff options
author | Eduardo Julian | 2021-07-27 03:51:10 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-27 03:51:10 -0400 |
commit | 061fd8a209bbcaffc2bfb850ac6046752a567d50 (patch) | |
tree | 8cd83ad7d0bc06ded7976eb5420467e485733ae8 /stdlib/source/library/lux/tool/compiler | |
parent | e64b6d0114c26a455e19a416b5f02a4d19dd711f (diff) |
Re-named wrap => in && unwrap => out.
Diffstat (limited to '')
129 files changed, 2621 insertions, 2620 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 7fcbb94eb..8b668b60f 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -48,7 +48,8 @@ ["." archive (#+ Archive) ["." descriptor (#+ Module)] ["." artifact] - ["." document]]]]]) + ["." document]]]] + ]) (def: #export (state target module expander host_analysis host generate generation_bundle) (All [anchor expression directive] @@ -132,8 +133,8 @@ _ (monad.map ! module.import dependencies) #let [source (///analysis.source (get@ #///.module input) (get@ #///.code input))] _ (///analysis.set_source_code source)] - (wrap [source [///generation.empty_buffer - artifact.empty]]))))) + (in [source [///generation.empty_buffer + artifact.empty]]))))) (def: (end module) (-> Module @@ -150,8 +151,8 @@ ///generation.buffer) final_registry (///directive.lift_generation ///generation.get_registry)] - (wrap [analysis_module [final_buffer - final_registry]]))) + (in [analysis_module [final_buffer + final_registry]]))) ## TODO: Inline ASAP (def: (get_current_payload _) @@ -165,7 +166,7 @@ ///generation.buffer) registry (///directive.lift_generation ///generation.get_registry)] - (wrap [buffer registry]))) + (in [buffer registry]))) ## TODO: Inline ASAP (def: (process_directive archive expander pre_payoad code) @@ -183,7 +184,7 @@ requirements (let [execute! (directiveP.phase expander)] (execute! archive code)) post_payload (..get_current_payload pre_payoad)] - (wrap [requirements post_payload]))) + (in [requirements post_payload]))) (def: (iteration archive expander reader source pre_payload) (All [directive] @@ -195,7 +196,7 @@ [[source code] (///directive.lift_analysis (..read source reader)) [requirements post_payload] (process_directive archive expander pre_payload code)] - (wrap [source requirements post_payload]))) + (in [source requirements post_payload]))) (def: (iterate archive expander module source pre_payload aliases) (All [directive] @@ -255,33 +256,33 @@ #descriptor.references (set.of_list text.hash dependencies) #descriptor.state #.Compiled #descriptor.registry final_registry}]] - (wrap [state - (#.Right [descriptor - (document.write key analysis_module) - (row\map (function (_ [artifact_id custom directive]) - [artifact_id custom (write_directive directive)]) - final_buffer)])])) + (in [state + (#.Right [descriptor + (document.write key analysis_module) + (row\map (function (_ [artifact_id custom directive]) + [artifact_id custom (write_directive directive)]) + final_buffer)])])) (#.Some [source requirements temporary_payload]) (let [[temporary_buffer temporary_registry] temporary_payload] - (wrap [state - (#.Left {#///.dependencies (|> requirements - (get@ #///directive.imports) - (list\map product.left)) - #///.process (function (_ state archive) - (recur (<| (///phase.run' state) - (do {! ///phase.monad} - [analysis_module (<| (: (Operation .Module)) - ///directive.lift_analysis - extension.lift - meta.current_module) - _ (///directive.lift_generation - (///generation.set_buffer temporary_buffer)) - _ (///directive.lift_generation - (///generation.set_registry temporary_registry)) - _ (|> requirements - (get@ #///directive.referrals) - (monad.map ! (execute! archive))) - temporary_payload (..get_current_payload temporary_payload)] - (..iterate archive expander module source temporary_payload (..module_aliases analysis_module))))))})])) + (in [state + (#.Left {#///.dependencies (|> requirements + (get@ #///directive.imports) + (list\map product.left)) + #///.process (function (_ state archive) + (recur (<| (///phase.run' state) + (do {! ///phase.monad} + [analysis_module (<| (: (Operation .Module)) + ///directive.lift_analysis + extension.lift + meta.current_module) + _ (///directive.lift_generation + (///generation.set_buffer temporary_buffer)) + _ (///directive.lift_generation + (///generation.set_registry temporary_registry)) + _ (|> requirements + (get@ #///directive.referrals) + (monad.map ! (execute! archive))) + temporary_payload (..get_current_payload temporary_payload)] + (..iterate archive expander module source temporary_payload (..module_aliases analysis_module))))))})])) )))))})))) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index c60700019..8a3d4a1cd 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -2,8 +2,8 @@ [library [lux (#- Module) [type (#+ :sharing)] - ["." debug] ["@" target] + ["." debug] [abstract ["." monad (#+ Monad do)]] [control @@ -58,9 +58,9 @@ ["ioW" archive]]]]] [program [compositor - ["." cli (#+ Compilation Library)] - ["." static (#+ Static)] - ["." import (#+ Import)]]]) + [cli (#+ Compilation Library)] + [import (#+ Import)] + ["." static (#+ Static)]]]) (with_expansions [<type_vars> (as_is anchor expression directive) <Operation> (as_is ///generation.Operation <type_vars>)] @@ -112,7 +112,7 @@ row.to_list (monad.map ..monad write_artifact!) (: (Action (List Any))))) - document (\ async.monad wrap + document (\ async.monad in (document.check $.key document))] (ioW.cache system static module_id (_.run ..writer [descriptor document]))))) @@ -158,7 +158,7 @@ (do try.monad [[_ archive] (archive.reserve archive.runtime_module archive)] (archive.add archive.runtime_module [descriptor document payload] archive))))] - (wrap [archive [descriptor document payload]]))) + (in [archive [descriptor document payload]]))) (def: (initialize_state extender [analysers @@ -191,7 +191,7 @@ _ (///directive.lift_generation (extension.with extender (:assume generators))) _ (extension.with extender (:assume directives))] - (wrap []))) + (in []))) (///phase.run' state) (\ try.monad map product.left))) @@ -249,7 +249,7 @@ (: (All [<type_vars>] (-> <Platform> (Program expression directive) <State+> (Async (Try <State+>)))) (function (_ platform program state) - (async\wrap + (async\in (do try.monad [[state phase_wrapper] (..phase_wrapper archive platform state)] (|> state @@ -260,15 +260,15 @@ (if (archive.archived? archive archive.runtime_module) (do ! [state (with_missing_extensions platform program state)] - (wrap [state archive])) + (in [state archive])) (do ! [[state [archive payload]] (|> (..process_runtime archive platform) (///phase.run' state) - async\wrap) + async\in) _ (..cache_module static platform 0 payload) state (with_missing_extensions platform program state)] - (wrap [state archive]))))) + (in [state archive]))))) (def: compilation_log_separator (format text.new_line text.tab)) @@ -369,10 +369,10 @@ (def: (verify_dependencies importer importee dependence) (-> Module Module Dependence (Try Any)) (cond (text\= importer importee) - (exception.throw ..module_cannot_import_itself [importer]) + (exception.except ..module_cannot_import_itself [importer]) (..circular_dependency? importer importee dependence) - (exception.throw ..cannot_import_circular_dependency [importer importee]) + (exception.except ..cannot_import_circular_dependency [importer importee]) ## else (#try.Success []))) @@ -414,30 +414,30 @@ (stm.read dependence) (do ! [[_ dependence] (stm.update (..depend importer module) dependence)] - (wrap dependence)))] + (in dependence)))] (case (..verify_dependencies importer module dependence) (#try.Failure error) - (wrap [(async.resolved (#try.Failure error)) - #.None]) + (in [(async.resolved (#try.Failure error)) + #.None]) (#try.Success _) (do ! [[archive state] (stm.read current)] (if (archive.archived? archive module) - (wrap [(async\wrap (#try.Success [archive state])) - #.None]) + (in [(async\in (#try.Success [archive state])) + #.None]) (do ! [@pending (stm.read pending)] (case (dictionary.get module @pending) (#.Some [return signal]) - (wrap [return - #.None]) + (in [return + #.None]) #.None (case (if (archive.reserved? archive module) (do try.monad [module_id (archive.id module archive)] - (wrap [module_id archive])) + (in [module_id archive])) (archive.reserve module archive)) (#try.Success [module_id archive]) (do ! @@ -449,24 +449,24 @@ <Pending> (async.async []))] _ (stm.update (dictionary.put module [return signal]) pending)] - (wrap [return - (#.Some [[archive state] - module_id - signal])])) + (in [return + (#.Some [[archive state] + module_id + signal])])) (#try.Failure error) - (wrap [(async\wrap (#try.Failure error)) - #.None]))))))))))) + (in [(async\in (#try.Failure error)) + #.None]))))))))))) _ (case signal #.None - (wrap []) + (in []) (#.Some [context module_id resolver]) (do ! [result (compile importer import! module_id context module) result (case result (#try.Failure error) - (wrap result) + (in result) (#try.Success [resulting_archive resulting_state]) (stm.commit (do stm.monad @@ -474,9 +474,9 @@ [(archive.merge resulting_archive archive) state]) current)] - (wrap (#try.Success [merged_archive resulting_state]))))) + (in (#try.Success [merged_archive resulting_state]))))) _ (async.future (resolver result))] - (wrap [])))] + (in [])))] return))))) ## TODO: Find a better way, as this only works for the Lux compiler. @@ -488,26 +488,26 @@ (do ! [[descriptor document output] (archive.find module archive) lux_module (document.read $.key document)] - (wrap [module lux_module]))) + (in [module lux_module]))) (archive.archived archive)) #let [additions (|> modules (list\map product.left) (set.of_list text.hash))]] - (wrap (update@ [#extension.state - #///directive.analysis - #///directive.state - #extension.state] - (function (_ analysis_state) - (|> analysis_state - (:as .Lux) - (update@ #.modules (function (_ current) - (list\compose (list.only (|>> product.left - (set.member? additions) - not) - current) - modules))) - :assume)) - state)))) + (in (update@ [#extension.state + #///directive.analysis + #///directive.state + #extension.state] + (function (_ analysis_state) + (|> analysis_state + (:as .Lux) + (update@ #.modules (function (_ current) + (list\compose (list.only (|>> product.left + (set.member? additions) + not) + current) + modules))) + :assume)) + state)))) (def: (set_current_module module state) (All [<type_vars>] @@ -556,7 +556,7 @@ (do ! [[archive state] (case new_dependencies #.Nil - (wrap [archive state]) + (in [archive state]) (#.Cons _) (do ! @@ -566,8 +566,8 @@ #let [archive (|> archive,document+ (list\map product.left) (list\fold archive.merge archive))]] - (wrap [archive (try.assumed - (..updated_state archive state))])))] + (in [archive (try.assumed + (..updated_state archive state))])))] (case ((get@ #///.process compilation) ## TODO: The "///directive.set_current_module" below shouldn't be necessary. Remove it ASAP. ## TODO: The context shouldn't need to be re-set either. @@ -588,15 +588,15 @@ _ (..cache_module static platform module_id [descriptor document output])] (case (archive.add module [descriptor document output] archive) (#try.Success archive) - (wrap [archive - (..with_reset_log state)]) + (in [archive + (..with_reset_log state)]) (#try.Failure error) - (async\wrap (#try.Failure error))))) + (async\in (#try.Failure error))))) (#try.Failure error) (do ! [_ (ioW.freeze (get@ #&file_system platform) static archive)] - (async\wrap (#try.Failure error))))))))))] + (async\in (#try.Failure error))))))))))] (compiler archive.runtime_module compilation_module))) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index e6d5816a4..e5c8e654d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -98,7 +98,7 @@ ## #module_annotations (<b>.maybe <b>.code) ## #module_state - (\ <>.monad wrap #.Cached)))) + (\ <>.monad in #.Cached)))) (def: #export key (Key .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 0fc5d90fc..b2b7b6c18 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -469,22 +469,22 @@ (function (_ [bundle state]) (#try.Failure (locate_error (get@ #.location state) error)))) -(def: #export (throw exception parameters) +(def: #export (except exception parameters) (All [e] (-> (Exception e) e Operation)) (..failure (exception.construct exception parameters))) (def: #export (assert exception parameters condition) (All [e] (-> (Exception e) e Bit (Operation Any))) (if condition - (\ phase.monad wrap []) - (..throw exception parameters))) + (\ phase.monad in []) + (..except exception parameters))) (def: #export (failure' error) (-> Text (phase.Operation Lux)) (function (_ state) (#try.Failure (locate_error (get@ #.location state) error)))) -(def: #export (throw' exception parameters) +(def: #export (except' exception parameters) (All [e] (-> (Exception e) e (phase.Operation Lux))) (..failure' (exception.construct exception parameters))) 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 f8f295429..ecc765794 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 @@ -46,7 +46,7 @@ [expansion (expand expander name macro inputs)] (case expansion (^ (list single)) - (wrap single) + (in single) _ (meta.failure (exception.construct ..must_have_single_expansion [name inputs expansion]))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux index 29796ead6..bbe6da451 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -128,7 +128,7 @@ (#try.Success [stateE output]) #.None - (exception.throw <exception> [])))) + (exception.except <exception> [])))) (def: #export (<set> value) (All [anchor expression directive] @@ -171,7 +171,7 @@ (do phase.monad [count (extension.read (get@ #counter)) _ (extension.update (update@ #counter inc))] - (wrap count))) + (in count))) (def: #export (gensym prefix) (All [anchor expression directive] @@ -197,7 +197,7 @@ (#try.Success [state+ output]) (#try.Failure error) - (exception.throw ..cannot_interpret error)))) + (exception.except ..cannot_interpret error)))) (def: #export (execute! code) (All [anchor expression directive] @@ -208,7 +208,7 @@ (#try.Success [state+ output]) (#try.Failure error) - (exception.throw ..cannot_interpret error)))) + (exception.except ..cannot_interpret error)))) (def: #export (define! context custom code) (All [anchor expression directive] @@ -219,7 +219,7 @@ (#try.Success [stateE output]) (#try.Failure error) - (exception.throw ..cannot_interpret error)))) + (exception.except ..cannot_interpret error)))) (def: #export (save! artifact_id custom code) (All [anchor expression directive] @@ -230,11 +230,11 @@ (#.Some buffer) ## TODO: Optimize by no longer checking for overwrites... (if (row.any? (|>> product.left (n.= artifact_id)) buffer) - (phase.throw ..cannot_overwrite_output [artifact_id]) + (phase.except ..cannot_overwrite_output [artifact_id]) (extension.update (set@ #buffer (#.Some (row.add [artifact_id custom code] buffer))))) #.None - (phase.throw ..no_buffer_for_saving_code [artifact_id])))) + (phase.except ..no_buffer_for_saving_code [artifact_id])))) (template [<name> <artifact>] [(def: #export (<name> name) @@ -274,7 +274,7 @@ (#try.Success (get@ #descriptor.registry descriptor))))] (case (artifact.remember _name registry) #.None - (exception.throw ..unknown_definition [name (artifact.definitions registry)]) + (exception.except ..unknown_definition [name (artifact.definitions registry)]) (#.Some id) (#try.Success [stateE [module_id id]])))))) @@ -287,7 +287,7 @@ (function (_ (^@ stateE [bundle state])) (do try.monad [module_id (archive.id module archive)] - (wrap [stateE module_id])))) + (in [stateE module_id])))) (def: #export (context archive) (All [anchor expression directive] @@ -295,12 +295,12 @@ (function (_ (^@ stateE [bundle state])) (case (get@ #context state) #.None - (exception.throw ..no_context []) + (exception.except ..no_context []) (#.Some id) (do try.monad [module_id (archive.id (get@ #module state) archive)] - (wrap [stateE [module_id id]]))))) + (in [stateE [module_id id]]))))) (def: #export (with_context id body) (All [anchor expression directive a] @@ -310,8 +310,8 @@ (function (_ [bundle state]) (do try.monad [[[bundle' state'] output] (body [bundle (set@ #context (#.Some id) state)])] - (wrap [[bundle' (set@ #context (get@ #context state) state')] - output])))) + (in [[bundle' (set@ #context (get@ #context state) state')] + output])))) (def: #export (with_new_context archive body) (All [anchor expression directive a] @@ -324,9 +324,9 @@ (set@ #registry registry') (set@ #context (#.Some id)))]) module_id (archive.id (get@ #module state) archive)] - (wrap [[bundle' (set@ #context (get@ #context state) state')] - [[module_id id] - output]]))))) + (in [[bundle' (set@ #context (get@ #context state) state')] + [[module_id id] + output]]))))) (def: #export (log! message) (All [anchor expression directive a] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux index c35404a68..b2a5e9fc6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux @@ -116,7 +116,7 @@ (case functionA (#/.Reference (#reference.Constant def_name)) (do ! - [?macro (//extension.lift (meta.find_macro def_name))] + [?macro (//extension.lift (meta.macro def_name))] (case ?macro (#.Some macro) (do ! @@ -130,7 +130,7 @@ (/function.apply compile argsC+ functionT functionA archive functionC))) _ - (//.throw ..unrecognized_syntax [location.dummy code']))) + (//.except ..unrecognized_syntax [location.dummy code']))) (def: #export (phase expander) (-> Expander Phase) 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 54e4e90d6..fb8d67bf5 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 @@ -90,7 +90,7 @@ (recur envs caseT') _ - (/.throw ..cannot_simplify_for_pattern_matching caseT))) + (/.except ..cannot_simplify_for_pattern_matching caseT))) (#.Named name unnamedT) (recur envs unnamedT) @@ -102,7 +102,7 @@ (do ///.monad [[var_id varT] (//type.with_env check.var)] - (recur envs (maybe.assume (type.apply (list varT) caseT)))) + (recur envs (maybe.assume (type.applied (list varT) caseT)))) (#.Apply inputT funcT) (.case funcT @@ -113,29 +113,29 @@ [?funct' (check.read funcT_id)] (.case ?funct' (#.Some funct') - (wrap funct') + (in funct') _ - (check.throw ..cannot_simplify_for_pattern_matching caseT))))] + (check.except ..cannot_simplify_for_pattern_matching caseT))))] (recur envs (#.Apply inputT funcT'))) _ - (.case (type.apply (list inputT) funcT) + (.case (type.applied (list inputT) funcT) (#.Some outputT) (recur envs outputT) #.None - (/.throw ..cannot_simplify_for_pattern_matching caseT))) + (/.except ..cannot_simplify_for_pattern_matching caseT))) (#.Product _) (|> caseT type.flat_tuple (list\map (re_quantify envs)) type.tuple - (\ ///.monad wrap)) + (\ ///.monad in)) _ - (\ ///.monad wrap (re_quantify envs caseT))))) + (\ ///.monad in (re_quantify envs caseT))))) (def: (analyse_primitive type inputT location output next) (All [a] (-> Type Type Location Pattern (Operation a) (Operation [Pattern a]))) @@ -144,7 +144,7 @@ [_ (//type.with_env (check.check inputT type)) outputA next] - (wrap [output outputA])))) + (in [output outputA])))) ## This function handles several concerns at once, but it must be that ## way because those concerns are interleaved when doing @@ -171,7 +171,7 @@ [outputA (//scope.with_local [name inputT] next) idx //scope.next_local] - (wrap [(#/.Bind idx) outputA]))) + (in [(#/.Bind idx) outputA]))) (^template [<type> <input> <output>] [[location <input>] @@ -216,16 +216,16 @@ [[memberP [memberP+ thenA]] ((:as (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) analyse_pattern) #.None memberT memberC then)] - (wrap [(list& memberP memberP+) thenA])))) + (in [(list& memberP memberP+) thenA])))) (do ! [nextA next] - (wrap [(list) nextA])) + (in [(list) nextA])) (list.reverse matches))] - (wrap [(/.pattern/tuple memberP+) - thenA]))) + (in [(/.pattern/tuple memberP+) + thenA]))) _ - (/.throw ..cannot_match_with_pattern [inputT' pattern]) + (/.except ..cannot_match_with_pattern [inputT' pattern]) ))) [location (#.Record record)] @@ -238,7 +238,7 @@ (check.check inputT recordT)) _ - (wrap []))] + (in []))] (analyse_pattern (#.Some (list.size members)) inputT [location (#.Tuple members)] next)) [location (#.Tag tag)] @@ -266,23 +266,23 @@ (` [(~+ values)]) next) (analyse_pattern #.None caseT (` [(~+ values)]) next))] - (wrap [(/.pattern/variant [lefts right? testP]) - nextA])) + (in [(/.pattern/variant [lefts right? testP]) + nextA])) _ - (/.throw ..sum_has_no_case [idx inputT]))) + (/.except ..sum_has_no_case [idx inputT]))) (#.UnivQ _) (do ///.monad [[ex_id exT] (//type.with_env check.existential)] (analyse_pattern num_tags - (maybe.assume (type.apply (list exT) inputT')) + (maybe.assume (type.applied (list exT) inputT')) pattern next)) _ - (/.throw ..cannot_match_with_pattern [inputT' pattern])))) + (/.except ..cannot_match_with_pattern [inputT' pattern])))) (^ [location (#.Form (list& [_ (#.Tag tag)] values))]) (/.with_location location @@ -295,7 +295,7 @@ (analyse_pattern (#.Some (list.size group)) inputT (` ((~ (code.nat lefts)) (~ (code.bit right?)) (~+ values))) next))) _ - (/.throw ..not_a_pattern pattern) + (/.except ..not_a_pattern pattern) )) (def: #export (case analyse branches archive inputC) @@ -319,7 +319,7 @@ (#try.Failure error) (/.failure error))] - (wrap (#/.Case inputA [outputH outputT]))) + (in (#/.Case inputA [outputH outputT]))) #.Nil - (/.throw ..cannot_have_empty_branches ""))) + (/.except ..cannot_have_empty_branches ""))) 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 2bb0fe957..37177e7ba 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 @@ -99,13 +99,13 @@ (case pattern (^or (#/.Simple #/.Unit) (#/.Bind _)) - (////\wrap #Exhaustive) + (////\in #Exhaustive) ## Primitive patterns always have partial coverage because there ## are too many possibilities as far as values go. (^template [<tag>] [(#/.Simple (<tag> _)) - (////\wrap #Partial)]) + (////\in #Partial)]) ([#/.Nat] [#/.Int] [#/.Rev] @@ -116,14 +116,14 @@ ## "#0", which means it is possible for bit ## pattern-matching to become exhaustive if complementary parts meet. (#/.Simple (#/.Bit value)) - (////\wrap (#Bit value)) + (////\in (#Bit value)) ## Tuple patterns can be exhaustive if there is exhaustiveness for all of ## their sub-patterns. (#/.Complex (#/.Tuple membersP+)) (case (list.reverse membersP+) (^or #.Nil (#.Cons _ #.Nil)) - (/.throw ..invalid_tuple_pattern []) + (/.except ..invalid_tuple_pattern []) (#.Cons lastP prevsP+) (do ////.monad @@ -134,10 +134,10 @@ [leftC (determine leftP)] (case rightC #Exhaustive - (wrap leftC) + (in leftC) _ - (wrap (#Seq leftC rightC))))) + (in (#Seq leftC rightC))))) lastC prevsP+))) ## Variant patterns can be shown to be exhaustive if all the possible @@ -148,11 +148,11 @@ #let [idx (if right? (inc lefts) lefts)]] - (wrap (#Variant (if right? - (#.Some idx) - #.None) - (|> (dictionary.new n.hash) - (dictionary.put idx value_coverage))))))) + (in (#Variant (if right? + (#.Some idx) + #.None) + (|> (dictionary.new n.hash) + (dictionary.put idx value_coverage))))))) (def: (xor left right) (-> Bit Bit Bit) @@ -221,12 +221,12 @@ (-> Coverage Coverage (Try Coverage)) (case [addition so_far] [#Partial #Partial] - (try\wrap #Partial) + (try\in #Partial) ## 2 bit coverages are exhaustive if they complement one another. (^multi [(#Bit sideA) (#Bit sideSF)] (xor sideA sideSF)) - (try\wrap #Exhaustive) + (try\in #Exhaustive) [(#Variant allA casesA) (#Variant allSF casesSF)] (let [addition_cases (cases allSF) @@ -234,10 +234,10 @@ (cond (and (known_cases? addition_cases) (known_cases? so_far_cases) (not (n.= addition_cases so_far_cases))) - (ex.throw ..variants_do_not_match [addition_cases so_far_cases]) + (ex.except ..variants_do_not_match [addition_cases so_far_cases]) (\ (dictionary.equivalence ..equivalence) = casesSF casesA) - (ex.throw ..redundant_pattern [so_far addition]) + (ex.except ..redundant_pattern [so_far addition]) ## else (do {! try.monad} @@ -247,24 +247,24 @@ (#.Some coverageSF) (do ! [coverageM (merge coverageA coverageSF)] - (wrap (dictionary.put tagA coverageM casesSF'))) + (in (dictionary.put tagA coverageM casesSF'))) #.None - (wrap (dictionary.put tagA coverageA casesSF')))) + (in (dictionary.put tagA coverageA casesSF')))) casesSF (dictionary.entries casesA))] - (wrap (if (and (or (known_cases? addition_cases) - (known_cases? so_far_cases)) - (n.= (inc (n.max addition_cases so_far_cases)) - (dictionary.size casesM)) - (list.every? exhaustive? (dictionary.values casesM))) - #Exhaustive - (#Variant (case allSF - (#.Some _) - allSF - - _ - allA) - casesM)))))) + (in (if (and (or (known_cases? addition_cases) + (known_cases? so_far_cases)) + (n.= (inc (n.max addition_cases so_far_cases)) + (dictionary.size casesM)) + (list.every? exhaustive? (dictionary.values casesM))) + #Exhaustive + (#Variant (case allSF + (#.Some _) + allSF + + _ + allA) + casesM)))))) [(#Seq leftA rightA) (#Seq leftSF rightSF)] (case [(coverage/= leftSF leftA) (coverage/= rightSF rightA)] @@ -276,40 +276,40 @@ ## If all that follows is exhaustive, then it can be safely dropped ## (since only the "left" part would influence whether the ## merged coverage is exhaustive or not). - (wrap leftSF) - (wrap (#Seq leftSF rightM)))) + (in leftSF) + (in (#Seq leftSF rightM)))) ## Same suffix [#0 #1] (do try.monad [leftM (merge leftA leftSF)] - (wrap (#Seq leftM rightA))) + (in (#Seq leftM rightA))) ## The 2 sequences cannot possibly be merged. [#0 #0] - (try\wrap (#Alt so_far addition)) + (try\in (#Alt so_far addition)) ## There is nothing the addition adds to the coverage. [#1 #1] - (ex.throw ..redundant_pattern [so_far addition])) + (ex.except ..redundant_pattern [so_far addition])) ## The addition cannot possibly improve the coverage. [_ #Exhaustive] - (ex.throw ..redundant_pattern [so_far addition]) + (ex.except ..redundant_pattern [so_far addition]) ## The addition completes the coverage. [#Exhaustive _] - (try\wrap #Exhaustive) + (try\in #Exhaustive) ## The left part will always match, so the addition is redundant. (^multi [(#Seq left right) single] (coverage/= left single)) - (ex.throw ..redundant_pattern [so_far addition]) + (ex.except ..redundant_pattern [so_far addition]) ## The right part is not necessary, since it can always match the left. (^multi [single (#Seq left right)] (coverage/= left single)) - (try\wrap single) + (try\in single) ## When merging a new coverage against one based on Alt, it may be ## that one of the many coverages in the Alt is complementary to @@ -329,7 +329,7 @@ (loop [altsSF possibilitiesSF] (case altsSF #.Nil - (wrap [#.None (list coverageA)]) + (in [#.None (list coverageA)]) (#.Cons altSF altsSF') (case (merge coverageA altSF) @@ -338,13 +338,13 @@ (#Alt _) (do ! [[success altsSF+] (recur altsSF')] - (wrap [success (#.Cons altSF altsSF+)])) + (in [success (#.Cons altSF altsSF+)])) _ - (wrap [(#.Some altMSF) altsSF'])) + (in [(#.Some altMSF) altsSF'])) (#try.Failure error) - (try.failure error)) + (#try.Failure error)) ))))] [successA possibilitiesSF] (fuse_once addition (flat_alt so_far))] (loop [successA successA @@ -358,9 +358,9 @@ #.None (case (list.reverse possibilitiesSF) (#.Cons last prevs) - (wrap (list\fold (function (_ left right) (#Alt left right)) - last - prevs)) + (in (list\fold (function (_ left right) (#Alt left right)) + last + prevs)) #.Nil (undefined))))) @@ -368,6 +368,6 @@ _ (if (coverage/= so_far addition) ## The addition cannot possibly improve the coverage. - (ex.throw ..redundant_pattern [so_far addition]) + (ex.except ..redundant_pattern [so_far addition]) ## There are now 2 alternative paths. - (try\wrap (#Alt so_far addition))))) + (try\in (#Alt so_far addition))))) 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 1ef5c88c4..7fb985f4b 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 @@ -53,7 +53,7 @@ (recur unnamedT) (#.Apply argT funT) - (case (type.apply (list argT) funT) + (case (type.applied (list argT) funT) (#.Some value) (recur value) @@ -64,7 +64,7 @@ [(<tag> _) (do ! [[_ instanceT] (//type.with_env <instancer>)] - (recur (maybe.assume (type.apply (list instanceT) expectedT))))]) + (recur (maybe.assume (type.applied (list instanceT) expectedT))))]) ([#.UnivQ check.existential] [#.ExQ check.var]) @@ -85,7 +85,7 @@ functionA (recur functionT) _ (//type.with_env (check.check expectedT functionT))] - (wrap functionA)) + (in functionA)) )) (#.Function inputT outputT) @@ -110,4 +110,4 @@ (<| (/.with_stack ..cannot_apply [functionT functionC argsC+]) (do ///.monad [[applyT argsA+] (//inference.general archive analyse functionT argsC+)]) - (wrap (/.apply [functionA argsA+])))) + (in (/.apply [functionA argsA+])))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux index ace669fbe..abdf5b806 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux @@ -98,7 +98,7 @@ (do ///.monad [location (///extension.lift meta.location) [ex_id _] (//type.with_env check.existential)] - (wrap (named_type location ex_id)))) + (in (named_type location ex_id)))) ## Type-inference works by applying some (potentially quantified) type ## to a sequence of values. @@ -113,7 +113,7 @@ #.Nil (do ///.monad [_ (//type.infer inferT)] - (wrap [inferT (list)])) + (in [inferT (list)])) (#.Cons argC args') (case inferT @@ -123,31 +123,31 @@ (#.UnivQ _) (do ///.monad [[var_id varT] (//type.with_env check.var)] - (general archive analyse (maybe.assume (type.apply (list varT) inferT)) args)) + (general archive analyse (maybe.assume (type.applied (list varT) inferT)) args)) (#.ExQ _) (do {! ///.monad} [[var_id varT] (//type.with_env check.var) output (general archive analyse - (maybe.assume (type.apply (list varT) inferT)) + (maybe.assume (type.applied (list varT) inferT)) args) bound? (//type.with_env (check.bound? var_id)) _ (if bound? - (wrap []) + (in []) (do ! [newT new_named_type] (//type.with_env (check.check varT newT))))] - (wrap output)) + (in output)) (#.Apply inputT transT) - (case (type.apply (list inputT) transT) + (case (type.applied (list inputT) transT) (#.Some outputT) (general archive analyse outputT args) #.None - (/.throw ..invalid_type_application inferT)) + (/.except ..invalid_type_application inferT)) ## Arguments are inferred back-to-front because, by convention, ## Lux functions take the most important arguments *last*, which @@ -162,7 +162,7 @@ argA (<| (/.with_stack ..cannot_infer_argument [inputT argC]) (//type.with_type inputT) (analyse archive argC))] - (wrap [outputT' (list& argA args'A)])) + (in [outputT' (list& argA args'A)])) (#.Var infer_id) (do ///.monad @@ -172,10 +172,10 @@ (general archive analyse inferT' args) _ - (/.throw ..cannot_infer [inferT args]))) + (/.except ..cannot_infer [inferT args]))) _ - (/.throw ..cannot_infer [inferT args])) + (/.except ..cannot_infer [inferT args])) )) (def: (substitute_bound target sub) @@ -214,25 +214,25 @@ [(<tag> env bodyT) (do ///.monad [bodyT+ (record' (n.+ 2 target) originalT bodyT)] - (wrap (<tag> env bodyT+)))]) + (in (<tag> env bodyT+)))]) ([#.UnivQ] [#.ExQ]) (#.Apply inputT funcT) - (case (type.apply (list inputT) funcT) + (case (type.applied (list inputT) funcT) (#.Some outputT) (record' target originalT outputT) #.None - (/.throw ..invalid_type_application inferT)) + (/.except ..invalid_type_application inferT)) (#.Product _) - (///\wrap (|> inferT - (type.function (type.flat_tuple inferT)) - (substitute_bound target originalT))) + (///\in (|> inferT + (type.function (type.flat_tuple inferT)) + (substitute_bound target originalT))) _ - (/.throw ..not_a_record_type inferT))) + (/.except ..not_a_record_type inferT))) (def: #export (record inferT) (-> Type (Operation Type)) @@ -247,13 +247,13 @@ (#.Named name unnamedT) (do ///.monad [unnamedT+ (recur depth unnamedT)] - (wrap unnamedT+)) + (in unnamedT+)) (^template [<tag>] [(<tag> env bodyT) (do ///.monad [bodyT+ (recur (inc depth) bodyT)] - (wrap (<tag> env bodyT+)))]) + (in (<tag> env bodyT+)))]) ([#.UnivQ] [#.ExQ]) @@ -266,36 +266,36 @@ (n.< boundary tag))) (case (list.nth tag cases) (#.Some caseT) - (///\wrap (if (n.= 0 depth) - (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n.* 2)) inferT)] - (type.function (list (replace' caseT)) - (replace' currentT))))) + (///\in (if (n.= 0 depth) + (type.function (list caseT) currentT) + (let [replace' (replace (|> depth dec (n.* 2)) inferT)] + (type.function (list (replace' caseT)) + (replace' currentT))))) #.None - (/.throw ..variant_tag_out_of_bounds [expected_size tag inferT])) + (/.except ..variant_tag_out_of_bounds [expected_size tag inferT])) (n.< expected_size actual_size) - (/.throw ..smaller_variant_than_expected [expected_size actual_size]) + (/.except ..smaller_variant_than_expected [expected_size actual_size]) (n.= boundary tag) (let [caseT (type.variant (list.drop boundary cases))] - (///\wrap (if (n.= 0 depth) - (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n.* 2)) inferT)] - (type.function (list (replace' caseT)) - (replace' currentT)))))) + (///\in (if (n.= 0 depth) + (type.function (list caseT) currentT) + (let [replace' (replace (|> depth dec (n.* 2)) inferT)] + (type.function (list (replace' caseT)) + (replace' currentT)))))) ## else - (/.throw ..variant_tag_out_of_bounds [expected_size tag inferT]))) + (/.except ..variant_tag_out_of_bounds [expected_size tag inferT]))) (#.Apply inputT funcT) - (case (type.apply (list inputT) funcT) + (case (type.applied (list inputT) funcT) (#.Some outputT) (variant tag expected_size outputT) #.None - (/.throw ..invalid_type_application inferT)) + (/.except ..invalid_type_application inferT)) _ - (/.throw ..not_a_variant_type inferT)))) + (/.except ..not_a_variant_type inferT)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux index 94b289a08..1ae1152bd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -93,7 +93,7 @@ []])) (#.Some old) - (/.throw' cannot_set_module_annotations_more_than_once [self_name old annotations]))))) + (/.except' cannot_set_module_annotations_more_than_once [self_name old annotations]))))) (def: #export (import module) (-> Text (Operation Any)) @@ -151,7 +151,7 @@ []]) (#.Some already_existing) - ((/.throw' ..cannot_define_more_than_once [[self_name name] already_existing]) state)))))) + ((/.except' ..cannot_define_more_than_once [[self_name name] already_existing]) state)))))) (def: #export (create hash name) (-> Nat Text (Operation Any)) @@ -168,8 +168,8 @@ [_ (create hash name) output (/.with_current_module name action) - module (///extension.lift (meta.find_module name))] - (wrap [module output]))) + module (///extension.lift (meta.module name))] + (in [module output]))) (template [<setter> <asker> <tag>] [(def: #export (<setter> module_name) @@ -186,11 +186,11 @@ (plist.put module_name (set@ #.module_state <tag> module)) state) []]) - ((/.throw' can_only_change_state_of_active_module [module_name <tag>]) + ((/.except' can_only_change_state_of_active_module [module_name <tag>]) state))) #.None - ((/.throw' unknown_module module_name) state))))) + ((/.except' unknown_module module_name) state))))) (def: #export (<asker> module_name) (-> Text (Operation Bit)) @@ -204,7 +204,7 @@ _ #0)]) #.None - ((/.throw' unknown_module module_name) state)))))] + ((/.except' unknown_module module_name) state)))))] [set_active active? #.Active] [set_compiled compiled? #.Compiled] @@ -221,7 +221,7 @@ (#try.Success [state (get@ <tag> module)]) #.None - ((/.throw' unknown_module module_name) state)))))] + ((/.except' unknown_module module_name) state)))))] [tags #.tags (List [Text [Nat (List Name) Bit Type]])] [types #.types (List [Text [(List Name) Bit Type]])] @@ -236,12 +236,12 @@ (function (_ tag) (case (plist.get tag bindings) #.None - (wrap []) + (in []) (#.Some _) - (/.throw ..cannot_declare_tag_twice [module_name tag]))) + (/.except ..cannot_declare_tag_twice [module_name tag]))) tags)] - (wrap []))) + (in []))) (def: #export (declare_tags tags exported? type) (-> (List Tag) Bit Type (Operation Any)) @@ -249,10 +249,10 @@ [self_name (///extension.lift meta.current_module_name) [type_module type_name] (case type (#.Named type_name _) - (wrap type_name) + (in type_name) _ - (/.throw ..cannot_declare_tags_for_unnamed_type [tags type])) + (/.except ..cannot_declare_tags_for_unnamed_type [tags type])) _ (ensure_undeclared_tags self_name tags) _ (///.assert cannot_declare_tags_for_foreign_type [tags type] (text\= self_name type_module))] @@ -272,4 +272,4 @@ state) []])) #.None - ((/.throw' unknown_module self_name) state)))))) + ((/.except' unknown_module self_name) state)))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index 27c4d98f4..4840dca2a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -16,7 +16,7 @@ (-> <type> (Operation Analysis)) (do ///.monad [_ (//type.infer <type>)] - (wrap (#/.Primitive (<tag> value)))))] + (in (#/.Primitive (<tag> value)))))] [bit .Bit #/.Bit] [nat .Nat #/.Nat] @@ -30,4 +30,4 @@ (Operation Analysis) (do ///.monad [_ (//type.infer .Any)] - (wrap (#/.Primitive #/.Unit)))) + (in (#/.Primitive #/.Unit)))) 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 4e085a6b9..25f478f04 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 @@ -31,9 +31,9 @@ (def: (definition def_name) (-> Name (Operation Analysis)) - (with_expansions [<return> (wrap (|> def_name ///reference.constant #/.Reference))] + (with_expansions [<return> (in (|> def_name ///reference.constant #/.Reference))] (do {! ///.monad} - [constant (///extension.lift (meta.find_def def_name))] + [constant (///extension.lift (meta.definition def_name))] (case constant (#.Left real_def_name) (definition real_def_name) @@ -50,8 +50,8 @@ [imported! (///extension.lift (meta.imported_by? ::module current))] (if imported! <return> - (/.throw foreign_module_has_not_been_imported [current ::module]))) - (/.throw definition_has_not_been_exported def_name)))))))) + (/.except foreign_module_has_not_been_imported [current ::module]))) + (/.except definition_has_not_been_exported def_name)))))))) (def: (variable var_name) (-> Text (Operation (Maybe Analysis))) @@ -61,10 +61,10 @@ (#.Some [actualT ref]) (do ! [_ (//type.infer actualT)] - (wrap (#.Some (|> ref ///reference.variable #/.Reference)))) + (in (#.Some (|> ref ///reference.variable #/.Reference)))) #.None - (wrap #.None)))) + (in #.None)))) (def: #export (reference reference) (-> Name (Operation Analysis)) @@ -74,7 +74,7 @@ [?var (variable simple_name)] (case ?var (#.Some varA) - (wrap varA) + (in varA) #.None (do ! diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux index c0e598e06..ab202ed61 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux @@ -129,13 +129,13 @@ output])) _ - (exception.throw ..invalid_scope_alteration [])) + (exception.except ..invalid_scope_alteration [])) (#try.Failure error) (#try.Failure error))) _ - (exception.throw ..cannot_create_local_binding_without_a_scope [])) + (exception.except ..cannot_create_local_binding_without_a_scope [])) )) (template [<name> <val_type>] @@ -188,7 +188,7 @@ (#try.Success [state (get@ [#.locals #.counter] top)]) #.Nil - (exception.throw ..cannot_get_next_reference_when_there_is_no_scope []))))) + (exception.except ..cannot_get_next_reference_when_there_is_no_scope []))))) (def: (ref_to_variable ref) (-> Ref Variable) 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 ca42337d5..449ac9606 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 @@ -107,10 +107,10 @@ (do ! [valueA (//type.with_type variant_type (analyse archive valueC))] - (wrap (/.variant [lefts right? valueA]))) + (in (/.variant [lefts right? valueA]))) #.None - (/.throw //inference.variant_tag_out_of_bounds [(list.size flat) tag expectedT]))) + (/.except //inference.variant_tag_out_of_bounds [(list.size flat) tag expectedT]))) (#.Named name unnamedT) (//type.with_type unnamedT @@ -129,13 +129,13 @@ ## This is because there is no way of knowing how many ## cases the inferred sum type would have. _ - (/.throw ..cannot_infer_numeric_tag [expectedT tag valueC]))) + (/.except ..cannot_infer_numeric_tag [expectedT tag valueC]))) (^template [<tag> <instancer>] [(<tag> _) (do ! [[instance_id instanceT] (//type.with_env <instancer>)] - (//type.with_type (maybe.assume (type.apply (list instanceT) expectedT)) + (//type.with_type (maybe.assume (type.applied (list instanceT) expectedT)) (recur valueC)))]) ([#.UnivQ check.existential] [#.ExQ check.var]) @@ -151,19 +151,19 @@ (recur valueC)) _ - (/.throw ..invalid_variant_type [expectedT tag valueC]))) + (/.except ..invalid_variant_type [expectedT tag valueC]))) _ - (case (type.apply (list inputT) funT) + (case (type.applied (list inputT) funT) (#.Some outputT) (//type.with_type outputT (recur valueC)) #.None - (/.throw ..not_a_quantified_type funT))) + (/.except ..not_a_quantified_type funT))) _ - (/.throw ..invalid_variant_type [expectedT tag valueC]))))))) + (/.except ..invalid_variant_type [expectedT tag valueC]))))))) (def: (typed_product archive analyse members) (-> Archive Phase (List Code) (Operation Analysis)) @@ -186,11 +186,11 @@ [memberA (//type.with_type memberT (analyse archive memberC)) memberA+ (recur membersT+' membersC+')] - (wrap (#.Cons memberA memberA+))) + (in (#.Cons memberA memberA+))) _ - (/.throw ..cannot_analyse_tuple [expectedT members]))))] - (wrap (/.tuple membersA+)))) + (/.except ..cannot_analyse_tuple [expectedT members]))))] + (in (/.tuple membersA+)))) (def: #export (product archive analyse membersC) (-> Archive Phase (List Code) (Operation Analysis)) @@ -222,13 +222,13 @@ _ (//type.with_env (check.check expectedT (type.tuple (list\map product.left membersTA))))] - (wrap (/.tuple (list\map product.right membersTA)))))) + (in (/.tuple (list\map product.right membersTA)))))) (^template [<tag> <instancer>] [(<tag> _) (do ! [[instance_id instanceT] (//type.with_env <instancer>)] - (//type.with_type (maybe.assume (type.apply (list instanceT) expectedT)) + (//type.with_type (maybe.assume (type.applied (list instanceT) expectedT)) (product archive analyse membersC)))]) ([#.UnivQ check.existential] [#.ExQ check.var]) @@ -244,19 +244,19 @@ (product archive analyse membersC)) _ - (/.throw ..invalid_tuple_type [expectedT membersC]))) + (/.except ..invalid_tuple_type [expectedT membersC]))) _ - (case (type.apply (list inputT) funT) + (case (type.applied (list inputT) funT) (#.Some outputT) (//type.with_type outputT (product archive analyse membersC)) #.None - (/.throw ..not_a_quantified_type funT))) + (/.except ..not_a_quantified_type funT))) _ - (/.throw ..invalid_tuple_type [expectedT membersC]) + (/.except ..invalid_tuple_type [expectedT membersC]) )))) (def: #export (tagged_sum analyse tag archive valueC) @@ -272,7 +272,7 @@ (do ! [inferenceT (//inference.variant idx case_size variantT) [inferredT valueA+] (//inference.general archive analyse inferenceT (list valueC))] - (wrap (/.variant [lefts right? (|> valueA+ list.head maybe.assume)]))) + (in (/.variant [lefts right? (|> valueA+ list.head maybe.assume)]))) _ (..sum analyse lefts right? archive valueC)))) @@ -289,10 +289,10 @@ [_ (#.Tag key)] (do ///.monad [key (///extension.lift (meta.normal key))] - (wrap [key val])) + (in [key val])) _ - (/.throw ..record_keys_must_be_tags [key record]))) + (/.except ..record_keys_must_be_tags [key record]))) record)) ## Lux already possesses the means to analyse tuples, so @@ -303,7 +303,7 @@ (case record ## empty_record = empty_tuple = unit = [] #.Nil - (\ ///.monad wrap [(list) Any]) + (\ ///.monad in [(list) Any]) (#.Cons [head_k head_v] _) (do {! ///.monad} @@ -312,8 +312,8 @@ #let [size_record (list.size record) size_ts (list.size tag_set)] _ (if (n.= size_ts size_record) - (wrap []) - (/.throw ..record_size_mismatch [size_ts size_record recordT record])) + (in []) + (/.except ..record_size_mismatch [size_ts size_record recordT record])) #let [tuple_range (list.indices size_ts) tag->idx (dictionary.of_list name.hash (list.zipped/2 tag_set tuple_range))] idx->val (monad.fold ! @@ -323,17 +323,17 @@ (case (dictionary.get key tag->idx) (#.Some idx) (if (dictionary.key? idx->val idx) - (/.throw ..cannot_repeat_tag [key record]) - (wrap (dictionary.put idx val idx->val))) + (/.except ..cannot_repeat_tag [key record]) + (in (dictionary.put idx val idx->val))) #.None - (/.throw ..tag_does_not_belong_to_record [key recordT])))) + (/.except ..tag_does_not_belong_to_record [key recordT])))) (: (Dictionary Nat Code) (dictionary.new n.hash)) record) #let [ordered_tuple (list\map (function (_ idx) (maybe.assume (dictionary.get idx idx->val))) tuple_range)]] - (wrap [ordered_tuple recordT])) + (in [ordered_tuple recordT])) )) (def: #export (record archive analyse members) @@ -355,7 +355,7 @@ (do ! [inferenceT (//inference.record recordT) [inferredT membersA] (//inference.general archive analyse inferenceT membersC)] - (wrap (/.tuple membersA))) + (in (/.tuple membersA))) _ (..product archive analyse membersC))))) 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 c9227aa31..f530c80ae 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 @@ -53,4 +53,4 @@ action) knownT (..with_env (check.clean varT))] - (wrap [knownT output]))) + (in [knownT output]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux index 882ac3a6e..ef7cffba4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux @@ -54,17 +54,17 @@ (case macroA (^ (///analysis.constant macro_name)) (do ! - [?macro (//extension.lift (meta.find_macro macro_name)) + [?macro (//extension.lift (meta.macro macro_name)) macro (case ?macro (#.Some macro) - (wrap macro) + (in macro) #.None - (//.throw ..macro_was_not_found macro_name))] + (//.except ..macro_was_not_found macro_name))] (//extension.lift (///analysis/macro.expand expander macro_name macro inputs))) _ - (//.throw ..invalid_macro_call code))))] + (//.except ..invalid_macro_call code))))] (case expansion (^ (list& <lux_def_module> referrals)) (|> (recur archive <lux_def_module>) @@ -76,4 +76,4 @@ (\ ! map (list\fold /.merge_requirements /.no_requirements))))) _ - (//.throw ..not_a_directive code)))))) + (//.except ..not_a_directive code)))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index fd30c45d2..d0f8db7c5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -96,7 +96,7 @@ []]) _ - (exception.throw ..cannot_overwrite name)))) + (exception.except ..cannot_overwrite name)))) (def: #export (with extender extensions) (All [s i o] @@ -118,7 +118,7 @@ stateE) #.None - (exception.throw ..unknown [name bundle])))) + (exception.except ..unknown [name bundle])))) (def: #export (localized get set transform) (All [s s' i o v] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index 5660a2a85..4f185f810 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list lengthA)))))])) + (in (#analysis.Extension extension (list lengthA)))))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (wrap (#analysis.Extension extension (list arrayA)))))])) + (in (#analysis.Extension extension (list arrayA)))))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: bundle::array Bundle @@ -117,7 +117,7 @@ (phase archive constructorC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& constructorA inputsA)))))])) + (in (#analysis.Extension extension (list& constructorA inputsA)))))])) (def: object::get Handler @@ -128,8 +128,8 @@ [objectA (analysis/type.with_type Any (phase archive objectC)) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in (#analysis.Extension extension (list (analysis.text fieldC) + objectA)))))])) (def: object::do Handler @@ -141,9 +141,9 @@ (phase archive objectC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& (analysis.text methodC) - objectA - inputsA)))))])) + (in (#analysis.Extension extension (list& (analysis.text methodC) + objectA + inputsA)))))])) (def: bundle::object Bundle @@ -165,7 +165,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: js::apply Handler @@ -177,7 +177,7 @@ (phase archive abstractionC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) (def: js::type_of Handler @@ -188,7 +188,7 @@ [objectA (analysis/type.with_type Any (phase archive objectC)) _ (analysis/type.infer .Text)] - (wrap (#analysis.Extension extension (list objectA)))))])) + (in (#analysis.Extension extension (list objectA)))))])) (def: js::function Handler @@ -201,8 +201,8 @@ (phase archive abstractionC)) _ (analysis/type.infer (for {@.js ffi.Function} Any))] - (wrap (#analysis.Extension extension (list (analysis.nat arity) - abstractionA)))))])) + (in (#analysis.Extension extension (list (analysis.nat arity) + abstractionA)))))])) (def: #export bundle Bundle 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 bd49944a1..6ff584f36 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 @@ -352,12 +352,12 @@ (jvm_type anonymousT) (#.Apply inputT abstractionT) - (case (type.apply (list inputT) abstractionT) + (case (type.applied (list inputT) abstractionT) (#.Some outputT) (jvm_type outputT) #.None - (/////analysis.throw ..non_jvm_type luxT)) + (/////analysis.except ..non_jvm_type luxT)) (^ (#.Primitive (static array.type_name) (list elemT))) (phase\map jvm.array (jvm_type elemT)) @@ -367,10 +367,10 @@ (#.Some [_ primitive_type]) (case parametersT #.Nil - (phase\wrap primitive_type) + (phase\in primitive_type) _ - (/////analysis.throw ..primitives_cannot_have_type_parameters class)) + (/////analysis.except ..primitives_cannot_have_type_parameters class)) #.None (do {! phase.monad} @@ -381,18 +381,18 @@ [parameterJT (jvm_type parameterT)] (case (jvm_parser.parameter? parameterJT) (#.Some parameterJT) - (wrap parameterJT) + (in parameterJT) #.None - (/////analysis.throw ..non_parameter parameterT)))) + (/////analysis.except ..non_parameter parameterT)))) parametersT))] - (wrap (jvm.class class parametersJT)))) + (in (jvm.class class parametersJT)))) (#.Ex _) - (phase\wrap (jvm.class ..object_class (list))) + (phase\in (jvm.class ..object_class (list))) _ - (/////analysis.throw ..non_jvm_type luxT))) + (/////analysis.except ..non_jvm_type luxT))) (def: (jvm_array_type objectT) (-> .Type (Operation (Type Array))) @@ -414,10 +414,10 @@ ..reflection) (list)) (analyse archive arrayC))] - (wrap (#/////analysis.Extension extension_name (list arrayA)))) + (in (#/////analysis.Extension extension_name (list arrayA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: array::length::object Handler @@ -431,11 +431,11 @@ (analyse archive arrayC)) varT (typeA.with_env (check.clean varT)) arrayJT (jvm_array_type (.type (array.Array varT)))] - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) - arrayA)))) + (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) + arrayA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: (new_primitive_array_handler primitive_type) (-> (Type Primitive) Handler) @@ -447,10 +447,10 @@ (analyse archive lengthC)) _ (typeA.infer (#.Primitive (|> (jvm.array primitive_type) ..reflection) (list)))] - (wrap (#/////analysis.Extension extension_name (list lengthA)))) + (in (#/////analysis.Extension extension_name (list lengthA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: array::new::object Handler @@ -464,22 +464,22 @@ expectedJT (jvm_array_type expectedT) elementJT (case (jvm_parser.array? expectedJT) (#.Some elementJT) - (wrap elementJT) + (in elementJT) #.None - (/////analysis.throw ..non_array expectedT))] - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text (..signature elementJT)) - lengthA)))) + (/////analysis.except ..non_array expectedT))] + (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature elementJT)) + lengthA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: (check_parameter objectT) (-> .Type (Operation (Type Parameter))) (case objectT (^ (#.Primitive (static array.type_name) (list elementT))) - (/////analysis.throw ..non_parameter objectT) + (/////analysis.except ..non_parameter objectT) (#.Primitive name parameters) (`` (cond (or (~~ (template [<type>] @@ -494,17 +494,17 @@ [jvm.double] [jvm.char])) (text.starts_with? descriptor.array_prefix name)) - (/////analysis.throw ..non_parameter objectT) + (/////analysis.except ..non_parameter objectT) ## else - (phase\wrap (jvm.class name (list))))) + (phase\in (jvm.class name (list))))) (#.Named name anonymous) (check_parameter anonymous) (^template [<tag>] [(<tag> id) - (phase\wrap (jvm.class ..object_class (list)))]) + (phase\in (jvm.class ..object_class (list)))]) ([#.Var] [#.Ex]) @@ -515,15 +515,15 @@ [#.ExQ]) (#.Apply inputT abstractionT) - (case (type.apply (list inputT) abstractionT) + (case (type.applied (list inputT) abstractionT) (#.Some outputT) (check_parameter outputT) #.None - (/////analysis.throw ..non_parameter objectT)) + (/////analysis.except ..non_parameter objectT)) _ - (/////analysis.throw ..non_parameter objectT))) + (/////analysis.except ..non_parameter objectT))) (def: (check_jvm objectT) (-> .Type (Operation (Type Value))) @@ -531,7 +531,7 @@ (#.Primitive name #.Nil) (`` (cond (~~ (template [<type>] [(text\= (..reflection <type>) name) - (phase\wrap <type>)] + (phase\in <type>)] [jvm.boolean] [jvm.byte] @@ -544,7 +544,7 @@ (~~ (template [<type>] [(text\= (..reflection (jvm.array <type>)) name) - (phase\wrap (jvm.array <type>))] + (phase\in (jvm.array <type>))] [jvm.boolean] [jvm.byte] @@ -561,7 +561,7 @@ (check_jvm (#.Primitive unprefixed (list))))) ## else - (phase\wrap (jvm.class name (list))))) + (phase\in (jvm.class name (list))))) (^ (#.Primitive (static array.type_name) (list elementT))) @@ -572,7 +572,7 @@ (#.Primitive name parameters) (do {! phase.monad} [parameters (monad.map ! check_parameter parameters)] - (phase\wrap (jvm.class name parameters))) + (phase\in (jvm.class name parameters))) (#.Named name anonymous) (check_jvm anonymous) @@ -584,12 +584,12 @@ [#.ExQ]) (#.Apply inputT abstractionT) - (case (type.apply (list inputT) abstractionT) + (case (type.applied (list inputT) abstractionT) (#.Some outputT) (check_jvm outputT) #.None - (/////analysis.throw ..non_object objectT)) + (/////analysis.except ..non_object objectT)) _ (check_parameter objectT))) @@ -599,13 +599,13 @@ (do {! phase.monad} [name (\ ! map ..reflection (check_jvm objectT))] (if (dictionary.key? ..boxes name) - (/////analysis.throw ..primitives_are_not_objects [name]) - (phase\wrap name)))) + (/////analysis.except ..primitives_are_not_objects [name]) + (phase\in name)))) (def: (check_return type) (-> .Type (Operation (Type Return))) (if (is? .Any type) - (phase\wrap jvm.void) + (phase\in jvm.void) (check_jvm type))) (def: (read_primitive_array_handler lux_type jvm_type) @@ -620,10 +620,10 @@ arrayA (typeA.with_type (#.Primitive (|> (jvm.array jvm_type) ..reflection) (list)) (analyse archive arrayC))] - (wrap (#/////analysis.Extension extension_name (list idxA arrayA)))) + (in (#/////analysis.Extension extension_name (list idxA arrayA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 2 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) (def: array::read::object Handler @@ -640,12 +640,12 @@ arrayJT (jvm_array_type (.type (array.Array varT))) idxA (typeA.with_type ..int (analyse archive idxC))] - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) - idxA - arrayA)))) + (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) + idxA + arrayA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 2 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) (def: (write_primitive_array_handler lux_type jvm_type) (-> .Type (Type Primitive) Handler) @@ -662,12 +662,12 @@ (analyse archive valueC)) arrayA (typeA.with_type array_type (analyse archive arrayC))] - (wrap (#/////analysis.Extension extension_name (list idxA - valueA - arrayA)))) + (in (#/////analysis.Extension extension_name (list idxA + valueA + arrayA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 3 (list.size args)]))))) + (/////analysis.except ///.incorrect_arity [extension_name 3 (list.size args)]))))) (def: array::write::object Handler @@ -686,13 +686,13 @@ (analyse archive idxC)) valueA (typeA.with_type varT (analyse archive valueC))] - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) - idxA - valueA - arrayA)))) + (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) + idxA + valueA + arrayA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 3 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 3 (list.size args)])))) (def: bundle::array Bundle @@ -752,10 +752,10 @@ (do phase.monad [expectedT (///.lift meta.expected_type) _ (check_object expectedT)] - (wrap (#/////analysis.Extension extension_name (list)))) + (in (#/////analysis.Extension extension_name (list)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 0 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 0 (list.size args)])))) (def: object::null? Handler @@ -767,10 +767,10 @@ [objectT objectA] (typeA.with_inference (analyse archive objectC)) _ (check_object objectT)] - (wrap (#/////analysis.Extension extension_name (list objectA)))) + (in (#/////analysis.Extension extension_name (list objectA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: object::synchronized Handler @@ -782,10 +782,10 @@ (analyse archive monitorC)) _ (check_object monitorT) exprA (analyse archive exprC)] - (wrap (#/////analysis.Extension extension_name (list monitorA exprA)))) + (in (#/////analysis.Extension extension_name (list monitorA exprA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 2 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) (def: (object::throw class_loader) (-> java/lang/ClassLoader Handler) @@ -800,12 +800,12 @@ ? (phase.lift (reflection!.sub? class_loader "java.lang.Throwable" exception_class)) _ (: (Operation Any) (if ? - (wrap []) - (/////analysis.throw non_throwable exception_class)))] - (wrap (#/////analysis.Extension extension_name (list exceptionA)))) + (in []) + (/////analysis.except non_throwable exception_class)))] + (in (#/////analysis.Extension extension_name (list exceptionA)))) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: (object::class class_loader) (-> java/lang/ClassLoader Handler) @@ -818,13 +818,13 @@ [_ (..ensure_fresh_class! class_loader class) _ (typeA.infer (#.Primitive "java.lang.Class" (list (#.Primitive class (list))))) _ (phase.lift (reflection!.load class_loader class))] - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text class))))) + (in (#/////analysis.Extension extension_name (list (/////analysis.text class))))) _ - (/////analysis.throw ///.invalid_syntax [extension_name %.code args])) + (/////analysis.except ///.invalid_syntax [extension_name %.code args])) _ - (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: (object::instance? class_loader) (-> java/lang/ClassLoader Handler) @@ -839,8 +839,8 @@ object_class (check_object objectT) ? (phase.lift (reflection!.sub? class_loader object_class sub_class))] (if ? - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text sub_class) objectA))) - (/////analysis.throw cannot_possibly_be_an_instance (format sub_class " !<= " object_class)))))])) + (in (#/////analysis.Extension extension_name (list (/////analysis.text sub_class) objectA))) + (/////analysis.except cannot_possibly_be_an_instance (format sub_class " !<= " object_class)))))])) (template [<name> <category> <parser>] [(def: #export (<name> mapping typeJ) @@ -871,7 +871,7 @@ #let [super_name (|> superJT ..reflection)] super_class (phase.lift (reflection!.load class_loader super_name)) superT (reflection_type mapping superJT)] - (wrap [[super_name superT] (java/lang/Class::isAssignableFrom super_class to_class)]))) + (in [[super_name superT] (java/lang/Class::isAssignableFrom super_class to_class)]))) (case (java/lang/Class::getGenericSuperclass from_class) (#.Some super) (list& super (array.to_list (java/lang/Class::getGenericInterfaces from_class))) @@ -891,12 +891,12 @@ (do {! phase.monad} [super_name (\ ! map ..reflection (check_jvm superT)) super_class (phase.lift (reflection!.load class_loader super_name))] - (wrap [[super_name superT] - (java/lang/Class::isAssignableFrom super_class to_class)]))) + (in [[super_name superT] + (java/lang/Class::isAssignableFrom super_class to_class)]))) (list& super_classT super_interfacesT+)) _ - (/////analysis.throw ..cannot_cast [fromT toT fromC]))) + (/////analysis.except ..cannot_cast [fromT toT fromC]))) (def: (object::cast class_loader) (-> java/lang/ClassLoader Handler) @@ -917,7 +917,7 @@ (text\= =primitive to_name))) (and (text\= <object> from_name) (text\= =primitive to_name)))) - (wrap true)] + (in true)] [reflection.boolean box.boolean] [reflection.byte box.byte] @@ -936,14 +936,14 @@ (not (dictionary.key? ..boxes to_name))) to_class (phase.lift (reflection!.load class_loader to_name)) _ (if (text\= ..inheritance_relationship_type_name from_name) - (wrap []) + (in []) (do ! [from_class (phase.lift (reflection!.load class_loader from_name))] (phase.assert ..cannot_cast [fromT toT fromC] (java/lang/Class::isAssignableFrom from_class to_class))))] (loop [[current_name currentT] [from_name fromT]] (if (text\= to_name current_name) - (wrap true) + (in true) (do ! [candidate_parents (: (Operation (List [[Text .Type] Bit])) (if (text\= ..inheritance_relationship_type_name current_name) @@ -956,15 +956,15 @@ (recur [next_name nextT]) #.Nil - (wrap false)))))))))] + (in false)))))))))] (if can_cast? - (wrap (#/////analysis.Extension extension_name (list (/////analysis.text from_name) - (/////analysis.text to_name) - fromA))) - (/////analysis.throw ..cannot_cast [fromT toT fromC]))) + (in (#/////analysis.Extension extension_name (list (/////analysis.text from_name) + (/////analysis.text to_name) + fromA))) + (/////analysis.except ..cannot_cast [fromT toT fromC]))) _ - (/////analysis.throw ///.invalid_syntax [extension_name %.code args])))) + (/////analysis.except ///.invalid_syntax [extension_name %.code args])))) (def: (bundle::object class_loader) (-> java/lang/ClassLoader Bundle) @@ -994,10 +994,10 @@ (not deprecated?)) fieldT (reflection_type luxT.fresh fieldJT) _ (typeA.infer fieldT)] - (wrap (<| (#/////analysis.Extension extension_name) - (list (/////analysis.text class) - (/////analysis.text field) - (/////analysis.text (|> fieldJT ..reflection)))))))])) + (in (<| (#/////analysis.Extension extension_name) + (list (/////analysis.text class) + (/////analysis.text field) + (/////analysis.text (|> fieldJT ..reflection)))))))])) (def: (put::static class_loader) (-> java/lang/ClassLoader Handler) @@ -1018,10 +1018,10 @@ fieldT (reflection_type luxT.fresh fieldJT) valueA (typeA.with_type fieldT (analyse archive valueC))] - (wrap (<| (#/////analysis.Extension extension_name) - (list (/////analysis.text class) - (/////analysis.text field) - valueA)))))])) + (in (<| (#/////analysis.Extension extension_name) + (list (/////analysis.text class) + (/////analysis.text field) + valueA)))))])) (def: (get::virtual class_loader) (-> java/lang/ClassLoader Handler) @@ -1037,16 +1037,16 @@ [class (reflection!.load class_loader class) [final? deprecated? fieldJT] (reflection!.virtual_field field class) mapping (reflection!.correspond class objectT)] - (wrap [deprecated? mapping fieldJT]))) + (in [deprecated? mapping fieldJT]))) _ (phase.assert ..deprecated_field [class field] (not deprecated?)) fieldT (reflection_type mapping fieldJT) _ (typeA.infer fieldT)] - (wrap (<| (#/////analysis.Extension extension_name) - (list (/////analysis.text class) - (/////analysis.text field) - (/////analysis.text (..reflection fieldJT)) - objectA)))))])) + (in (<| (#/////analysis.Extension extension_name) + (list (/////analysis.text class) + (/////analysis.text field) + (/////analysis.text (..reflection fieldJT)) + objectA)))))])) (def: (put::virtual class_loader) (-> java/lang/ClassLoader Handler) @@ -1063,7 +1063,7 @@ [class (reflection!.load class_loader class) [final? deprecated? fieldJT] (reflection!.virtual_field field class) mapping (reflection!.correspond class objectT)] - (wrap [final? deprecated? mapping fieldJT]))) + (in [final? deprecated? mapping fieldJT]))) _ (phase.assert ..deprecated_field [class field] (not deprecated?)) _ (phase.assert ..cannot_set_a_final_field [class field] @@ -1071,12 +1071,12 @@ fieldT (reflection_type mapping fieldJT) valueA (typeA.with_type fieldT (analyse archive valueC))] - (wrap (<| (#/////analysis.Extension extension_name) - (list (/////analysis.text class) - (/////analysis.text field) - (/////analysis.text (..reflection fieldJT)) - valueA - objectA)))))])) + (in (<| (#/////analysis.Extension extension_name) + (list (/////analysis.text class) + (/////analysis.text field) + (/////analysis.text (..reflection fieldJT)) + valueA + objectA)))))])) (type: Method_Style #Static @@ -1124,12 +1124,12 @@ actualJC))))) true (list.zipped/2 parameters inputsJT)))]] - (wrap (and correct_class? - correct_method? - static_matches? - special_matches? - arity_matches? - inputs_match?)))) + (in (and correct_class? + correct_method? + static_matches? + special_matches? + arity_matches? + inputs_match?)))) (def: (check_constructor aliasing class inputsJT constructor) (-> Aliasing (java/lang/Class java/lang/Object) (List (Type Value)) (java/lang/reflect/Constructor java/lang/Object) (Operation Bit)) @@ -1138,22 +1138,22 @@ array.to_list (monad.map try.monad reflection!.type) phase.lift)] - (wrap (and (java/lang/Object::equals class (java/lang/reflect/Constructor::getDeclaringClass constructor)) - (n.= (list.size inputsJT) (list.size parameters)) - (list\fold (function (_ [expectedJC actualJC] prev) - (and prev - (jvm\= expectedJC (: (Type Value) - (case (jvm_parser.var? actualJC) - (#.Some name) - (|> aliasing - (dictionary.get name) - (maybe.default name) - jvm.var) - - #.None - actualJC))))) - true - (list.zipped/2 parameters inputsJT)))))) + (in (and (java/lang/Object::equals class (java/lang/reflect/Constructor::getDeclaringClass constructor)) + (n.= (list.size inputsJT) (list.size parameters)) + (list\fold (function (_ [expectedJC actualJC] prev) + (and prev + (jvm\= expectedJC (: (Type Value) + (case (jvm_parser.var? actualJC) + (#.Some name) + (|> aliasing + (dictionary.get name) + (maybe.default name) + jvm.var) + + #.None + actualJC))))) + true + (list.zipped/2 parameters inputsJT)))))) (def: idx_to_parameter (-> Nat .Type) @@ -1214,9 +1214,9 @@ (list& (#.Primitive (java/lang/Class::getName owner) owner_tvarsT) inputsT))) outputT)]] - (wrap [methodT - (reflection!.deprecated? (java/lang/reflect/Method::getDeclaredAnnotations method)) - exceptionsT])))) + (in [methodT + (reflection!.deprecated? (java/lang/reflect/Method::getDeclaredAnnotations method)) + exceptionsT])))) (def: (constructor_signature constructor) (-> (java/lang/reflect/Constructor java/lang/Object) (Operation Method_Signature)) @@ -1243,9 +1243,9 @@ constructorT (<| (type.univ_q (dictionary.size mapping)) (type.function inputsT) objectT)]] - (wrap [constructorT - (reflection!.deprecated? (java/lang/reflect/Constructor::getDeclaredAnnotations constructor)) - exceptionsT])))) + (in [constructorT + (reflection!.deprecated? (java/lang/reflect/Constructor::getDeclaredAnnotations constructor)) + exceptionsT])))) (type: Evaluation (#Pass Method_Signature) @@ -1304,13 +1304,13 @@ (method_signature method_style method)))))))] (case (list.all pass! candidates) (#.Cons method #.Nil) - (wrap method) + (in method) #.Nil - (/////analysis.throw ..no_candidates [class_name method_name inputsJT (list.all hint! candidates)]) + (/////analysis.except ..no_candidates [class_name method_name inputsJT (list.all hint! candidates)]) candidates - (/////analysis.throw ..too_many_candidates [class_name method_name inputsJT candidates])))) + (/////analysis.except ..too_many_candidates [class_name method_name inputsJT candidates])))) (def: constructor_method "<init>") @@ -1334,18 +1334,18 @@ (constructor_signature constructor))))))] (case (list.all pass! candidates) (#.Cons constructor #.Nil) - (wrap constructor) + (in constructor) #.Nil - (/////analysis.throw ..no_candidates [class_name ..constructor_method inputsJT (list.all hint! candidates)]) + (/////analysis.except ..no_candidates [class_name ..constructor_method inputsJT (list.all hint! candidates)]) candidates - (/////analysis.throw ..too_many_candidates [class_name ..constructor_method inputsJT candidates])))) + (/////analysis.except ..too_many_candidates [class_name ..constructor_method inputsJT candidates])))) (template [<name> <category> <parser>] [(def: #export <name> (Parser (Type <category>)) - (<text>.embed <parser> <code>.text))] + (<text>.then <parser> <code>.text))] [var Var jvm_parser.var] [class Class jvm_parser.class] @@ -1380,10 +1380,10 @@ (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list\map product.right argsTC)) outputJT (check_return outputT)] - (wrap (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) - (/////analysis.text method) - (/////analysis.text (..signature outputJT)) - (decorate_inputs argsT argsA))))))])) + (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (/////analysis.text method) + (/////analysis.text (..signature outputJT)) + (decorate_inputs argsT argsA))))))])) (def: (invoke::virtual class_loader) (-> java/lang/ClassLoader Handler) @@ -1404,11 +1404,11 @@ _ (undefined))] outputJT (check_return outputT)] - (wrap (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) - (/////analysis.text method) - (/////analysis.text (..signature outputJT)) - objectA - (decorate_inputs argsT argsA))))))])) + (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (/////analysis.text method) + (/////analysis.text (..signature outputJT)) + objectA + (decorate_inputs argsT argsA))))))])) (def: (invoke::special class_loader) (-> java/lang/ClassLoader Handler) @@ -1423,10 +1423,10 @@ (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) outputJT (check_return outputT)] - (wrap (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) - (/////analysis.text method) - (/////analysis.text (..signature outputJT)) - (decorate_inputs argsT argsA))))))])) + (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (/////analysis.text method) + (/////analysis.text (..signature outputJT)) + (decorate_inputs argsT argsA))))))])) (def: (invoke::interface class_loader) (-> java/lang/ClassLoader Handler) @@ -1450,12 +1450,12 @@ _ (undefined))] outputJT (check_return outputT)] - (wrap (#/////analysis.Extension extension_name - (list& (/////analysis.text (..signature (jvm.class class_name (list)))) - (/////analysis.text method) - (/////analysis.text (..signature outputJT)) - objectA - (decorate_inputs argsT argsA))))))])) + (in (#/////analysis.Extension extension_name + (list& (/////analysis.text (..signature (jvm.class class_name (list)))) + (/////analysis.text method) + (/////analysis.text (..signature outputJT)) + objectA + (decorate_inputs argsT argsA))))))])) (def: (invoke::constructor class_loader) (-> java/lang/ClassLoader Handler) @@ -1469,8 +1469,8 @@ _ (phase.assert ..deprecated_method [class ..constructor_method methodT] (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list\map product.right argsTC))] - (wrap (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) - (decorate_inputs argsT argsA))))))])) + (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (decorate_inputs argsT argsA))))))])) (def: (bundle::member class_loader) (-> java/lang/ClassLoader Bundle) @@ -1565,8 +1565,8 @@ exceptions (|> (java/lang/reflect/Method::getGenericExceptionTypes method) array.to_list (monad.map ! reflection!.class))] - (wrap [(java/lang/reflect/Method::getName method) - (jvm.method [type_variables inputs return exceptions])]))))))] + (in [(java/lang/reflect/Method::getName method) + (jvm.method [type_variables inputs return exceptions])]))))))] [abstract_methods (list.only (|>> java/lang/reflect/Method::getModifiers java/lang/reflect/Modifier::isAbstract))] [methods (<|)] @@ -1667,22 +1667,22 @@ [parametersA (monad.map ! (function (_ [name value]) (do ! [valueA (analyse archive value)] - (wrap [name valueA]))) + (in [name valueA]))) parameters)] - (wrap [name parametersA]))) + (in [name parametersA]))) annotations) super_arguments (monad.map ! (function (_ [jvmT super_argC]) (do ! [luxT (reflection_type mapping jvmT) super_argA (typeA.with_type luxT (analyse archive super_argC))] - (wrap [jvmT super_argA]))) + (in [jvmT super_argA]))) super_arguments) arguments' (monad.map ! (function (_ [name jvmT]) (do ! [luxT (boxed_reflection_type mapping jvmT)] - (wrap [name luxT]))) + (in [name luxT]))) arguments) [scope bodyA] (|> arguments' (#.Cons [self_name selfT]) @@ -1690,20 +1690,20 @@ (list\fold scope.with_local (analyse archive body)) (typeA.with_type .Any) /////analysis.with_scope)] - (wrap (/////analysis.tuple (list (/////analysis.text ..constructor_tag) - (visibility_analysis visibility) - (/////analysis.bit strict_fp?) - (/////analysis.tuple (list\map annotation_analysis annotationsA)) - (/////analysis.tuple (list\map var_analysis vars)) - (/////analysis.text self_name) - (/////analysis.tuple (list\map ..argument_analysis arguments)) - (/////analysis.tuple (list\map class_analysis exceptions)) - (/////analysis.tuple (list\map typed_analysis super_arguments)) - (#/////analysis.Function - (list\map (|>> /////analysis.variable) - (scope.environment scope)) - (/////analysis.tuple (list bodyA))) - )))))) + (in (/////analysis.tuple (list (/////analysis.text ..constructor_tag) + (visibility_analysis visibility) + (/////analysis.bit strict_fp?) + (/////analysis.tuple (list\map annotation_analysis annotationsA)) + (/////analysis.tuple (list\map var_analysis vars)) + (/////analysis.text self_name) + (/////analysis.tuple (list\map ..argument_analysis arguments)) + (/////analysis.tuple (list\map class_analysis exceptions)) + (/////analysis.tuple (list\map typed_analysis super_arguments)) + (#/////analysis.Function + (list\map (|>> /////analysis.variable) + (scope.environment scope)) + (/////analysis.tuple (list bodyA))) + )))))) (type: #export (Virtual_Method a) [Text @@ -1749,16 +1749,16 @@ [parametersA (monad.map ! (function (_ [name value]) (do ! [valueA (analyse archive value)] - (wrap [name valueA]))) + (in [name valueA]))) parameters)] - (wrap [name parametersA]))) + (in [name parametersA]))) annotations) returnT (reflection_return mapping return) arguments' (monad.map ! (function (_ [name jvmT]) (do ! [luxT (boxed_reflection_type mapping jvmT)] - (wrap [name luxT]))) + (in [name luxT]))) arguments) [scope bodyA] (|> arguments' (#.Cons [self_name selfT]) @@ -1766,22 +1766,22 @@ (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) /////analysis.with_scope)] - (wrap (/////analysis.tuple (list (/////analysis.text ..virtual_tag) - (/////analysis.text method_name) - (visibility_analysis visibility) - (/////analysis.bit final?) - (/////analysis.bit strict_fp?) - (/////analysis.tuple (list\map annotation_analysis annotationsA)) - (/////analysis.tuple (list\map var_analysis vars)) - (/////analysis.text self_name) - (/////analysis.tuple (list\map ..argument_analysis arguments)) - (return_analysis return) - (/////analysis.tuple (list\map class_analysis exceptions)) - (#/////analysis.Function - (list\map (|>> /////analysis.variable) - (scope.environment scope)) - (/////analysis.tuple (list bodyA))) - )))))) + (in (/////analysis.tuple (list (/////analysis.text ..virtual_tag) + (/////analysis.text method_name) + (visibility_analysis visibility) + (/////analysis.bit final?) + (/////analysis.bit strict_fp?) + (/////analysis.tuple (list\map annotation_analysis annotationsA)) + (/////analysis.tuple (list\map var_analysis vars)) + (/////analysis.text self_name) + (/////analysis.tuple (list\map ..argument_analysis arguments)) + (return_analysis return) + (/////analysis.tuple (list\map class_analysis exceptions)) + (#/////analysis.Function + (list\map (|>> /////analysis.variable) + (scope.environment scope)) + (/////analysis.tuple (list bodyA))) + )))))) (type: #export (Static_Method a) [Text @@ -1823,37 +1823,37 @@ [parametersA (monad.map ! (function (_ [name value]) (do ! [valueA (analyse archive value)] - (wrap [name valueA]))) + (in [name valueA]))) parameters)] - (wrap [name parametersA]))) + (in [name parametersA]))) annotations) returnT (reflection_return mapping return) arguments' (monad.map ! (function (_ [name jvmT]) (do ! [luxT (boxed_reflection_type mapping jvmT)] - (wrap [name luxT]))) + (in [name luxT]))) arguments) [scope bodyA] (|> arguments' list.reverse (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) /////analysis.with_scope)] - (wrap (/////analysis.tuple (list (/////analysis.text ..static_tag) - (/////analysis.text method_name) - (visibility_analysis visibility) - (/////analysis.bit strict_fp?) - (/////analysis.tuple (list\map annotation_analysis annotationsA)) - (/////analysis.tuple (list\map var_analysis vars)) - (/////analysis.tuple (list\map ..argument_analysis arguments)) - (return_analysis return) - (/////analysis.tuple (list\map class_analysis - exceptions)) - (#/////analysis.Function - (list\map (|>> /////analysis.variable) - (scope.environment scope)) - (/////analysis.tuple (list bodyA))) - )))))) + (in (/////analysis.tuple (list (/////analysis.text ..static_tag) + (/////analysis.text method_name) + (visibility_analysis visibility) + (/////analysis.bit strict_fp?) + (/////analysis.tuple (list\map annotation_analysis annotationsA)) + (/////analysis.tuple (list\map var_analysis vars)) + (/////analysis.tuple (list\map ..argument_analysis arguments)) + (return_analysis return) + (/////analysis.tuple (list\map class_analysis + exceptions)) + (#/////analysis.Function + (list\map (|>> /////analysis.variable) + (scope.environment scope)) + (/////analysis.tuple (list bodyA))) + )))))) (type: #export (Overriden_Method a) [(Type Class) @@ -1918,10 +1918,10 @@ (|> super_parameters (monad.map ! (..reflection_type mapping)) (\ ! map (|>> (list.zipped/2 parent_parameters))))) - (phase.lift (exception.throw ..mismatched_super_parameters [parent_name expected_count actual_count])))) + (phase.lift (exception.except ..mismatched_super_parameters [parent_name expected_count actual_count])))) #.None - (phase.lift (exception.throw ..unknown_super [parent_name supers]))))) + (phase.lift (exception.except ..unknown_super [parent_name supers]))))) (def: #export (with_fresh_type_vars vars mapping) (-> (List (Type Var)) Mapping (Operation Mapping)) @@ -1930,21 +1930,21 @@ (do ! [[_ exT] (typeA.with_env check.existential)] - (wrap [var exT]))) + (in [var exT]))) vars)] - (wrap (list\fold (function (_ [varJ varT] mapping) - (dictionary.put (jvm_parser.name varJ) varT mapping)) - mapping - pairings)))) + (in (list\fold (function (_ [varJ varT] mapping) + (dictionary.put (jvm_parser.name varJ) varT mapping)) + mapping + pairings)))) (def: #export (with_override_mapping supers parent_type mapping) (-> (List (Type Class)) (Type Class) Mapping (Operation Mapping)) (do phase.monad [override_mapping (..override_mapping mapping supers parent_type)] - (wrap (list\fold (function (_ [super_var bound_type] mapping) - (dictionary.put super_var bound_type mapping)) - mapping - override_mapping)))) + (in (list\fold (function (_ [super_var bound_type] mapping) + (dictionary.put super_var bound_type mapping)) + mapping + override_mapping)))) (def: #export (hide_method_body arity bodyA) (-> Nat Analysis Analysis) @@ -1989,15 +1989,15 @@ [parametersA (monad.map ! (function (_ [name value]) (do ! [valueA (analyse archive value)] - (wrap [name valueA]))) + (in [name valueA]))) parameters)] - (wrap [name parametersA]))) + (in [name parametersA]))) annotations) arguments' (monad.map ! (function (_ [name jvmT]) (do ! [luxT (boxed_reflection_type mapping jvmT)] - (wrap [name luxT]))) + (in [name luxT]))) arguments) returnT (boxed_reflection_return mapping return) [scope bodyA] (|> arguments' @@ -2006,22 +2006,22 @@ (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) /////analysis.with_scope)] - (wrap (/////analysis.tuple (list (/////analysis.text ..overriden_tag) - (class_analysis parent_type) - (/////analysis.text method_name) - (/////analysis.bit strict_fp?) - (/////analysis.tuple (list\map annotation_analysis annotationsA)) - (/////analysis.tuple (list\map var_analysis vars)) - (/////analysis.text self_name) - (/////analysis.tuple (list\map ..argument_analysis arguments)) - (return_analysis return) - (/////analysis.tuple (list\map class_analysis - exceptions)) - (#/////analysis.Function - (list\map (|>> /////analysis.variable) - (scope.environment scope)) - (..hide_method_body (list.size arguments) bodyA)) - )))))) + (in (/////analysis.tuple (list (/////analysis.text ..overriden_tag) + (class_analysis parent_type) + (/////analysis.text method_name) + (/////analysis.bit strict_fp?) + (/////analysis.tuple (list\map annotation_analysis annotationsA)) + (/////analysis.tuple (list\map var_analysis vars)) + (/////analysis.text self_name) + (/////analysis.tuple (list\map ..argument_analysis arguments)) + (return_analysis return) + (/////analysis.tuple (list\map class_analysis + exceptions)) + (#/////analysis.Function + (list\map (|>> /////analysis.variable) + (scope.environment scope)) + (..hide_method_body (list.size arguments) bodyA)) + )))))) (type: #export (Method_Definition a) (#Overriden_Method (Overriden_Method a))) @@ -2032,7 +2032,7 @@ (function (_ parameterJ) (do check.monad [[_ parameterT] check.existential] - (wrap [parameterJ parameterT]))))) + (in [parameterJ parameterT]))))) (def: (mismatched_methods super_set sub_set) (-> (List [Text (Type Method)]) @@ -2067,15 +2067,15 @@ _ (phase.assert ..class_parameter_mismatch [expected_parameters actual_parameters] (n.= (list.size expected_parameters) (list.size actual_parameters)))] - (wrap (|> (list.zipped/2 expected_parameters actual_parameters) - (list\fold (function (_ [expected actual] mapping) - (case (jvm_parser.var? actual) - (#.Some actual) - (dictionary.put actual expected mapping) - - #.None - mapping)) - jvm_alias.fresh))))) + (in (|> (list.zipped/2 expected_parameters actual_parameters) + (list\fold (function (_ [expected actual] mapping) + (case (jvm_parser.var? actual) + (#.Some actual) + (dictionary.put actual expected mapping) + + #.None + mapping)) + jvm_alias.fresh))))) (def: (anonymous_class_name module id) (-> Module Nat Text) @@ -2094,11 +2094,11 @@ body]) (do ! [aliasing (super_aliasing class_loader parent_type)] - (wrap [method_name (|> (jvm.method [type_vars - (list\map product.right arguments) - return - exceptions]) - (jvm_alias.method aliasing))]))) + (in [method_name (|> (jvm.method [type_vars + (list\map product.right arguments) + return + exceptions]) + (jvm_alias.method aliasing))]))) methods) #let [missing_abstract_methods (mismatched_methods overriden_methods required_abstract_methods) invalid_overriden_methods (mismatched_methods available_methods overriden_methods)] @@ -2106,7 +2106,7 @@ (list.empty? missing_abstract_methods)) _ (phase.assert ..invalid_overriden_methods invalid_overriden_methods (list.empty? invalid_overriden_methods))] - (wrap []))) + (in []))) (def: (class::anonymous class_loader) (-> java/lang/ClassLoader Handler) @@ -2142,25 +2142,25 @@ selfT (///.lift (do meta.monad [where meta.current_module_name id meta.count] - (wrap (inheritance_relationship_type (#.Primitive (..anonymous_class_name where id) (list)) - super_classT - super_interfaceT+)))) + (in (inheritance_relationship_type (#.Primitive (..anonymous_class_name where id) (list)) + super_classT + super_interfaceT+)))) _ (typeA.infer selfT) constructor_argsA+ (monad.map ! (function (_ [type term]) (do ! [argT (reflection_type mapping type) termA (typeA.with_type argT (analyse archive term))] - (wrap [type termA]))) + (in [type termA]))) constructor_args) #let [supers (#.Cons super_class super_interfaces)] _ (..require_complete_method_concretion class_loader supers methods) methodsA (monad.map ! (analyse_overriden_method analyse archive selfT mapping supers) methods)] - (wrap (#/////analysis.Extension extension_name - (list (class_analysis super_class) - (/////analysis.tuple (list\map class_analysis super_interfaces)) - (/////analysis.tuple (list\map typed_analysis constructor_argsA+)) - (/////analysis.tuple methodsA))))))])) + (in (#/////analysis.Extension extension_name + (list (class_analysis super_class) + (/////analysis.tuple (list\map class_analysis super_interfaces)) + (/////analysis.tuple (list\map typed_analysis constructor_argsA+)) + (/////analysis.tuple methodsA))))))])) (def: (bundle::class class_loader) (-> java/lang/ClassLoader Bundle) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index b0bdba0cb..9fc9ce902 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -50,7 +50,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list lengthA)))))])) + (in (#analysis.Extension extension (list lengthA)))))])) (def: array::length Handler @@ -62,7 +62,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (wrap (#analysis.Extension extension (list arrayA)))))])) + (in (#analysis.Extension extension (list arrayA)))))])) (def: array::read Handler @@ -76,7 +76,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: array::write Handler @@ -92,7 +92,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) (def: array::delete Handler @@ -106,7 +106,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: bundle::array Bundle @@ -128,8 +128,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in (#analysis.Extension extension (list (analysis.text fieldC) + objectA)))))])) (def: object::do Handler @@ -141,9 +141,9 @@ (phase archive objectC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& (analysis.text methodC) - objectA - inputsA)))))])) + (in (#analysis.Extension extension (list& (analysis.text methodC) + objectA + inputsA)))))])) (def: bundle::object Bundle @@ -165,7 +165,7 @@ [inputA (analysis/type.with_type (type <fromT>) (phase archive inputC)) _ (analysis/type.infer (type <toT>))] - (wrap (#analysis.Extension extension (list inputA)))))]))] + (in (#analysis.Extension extension (list inputA)))))]))] [utf8::encode Text (array.Array (I64 Any))] [utf8::decode (array.Array (I64 Any)) Text] @@ -186,7 +186,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: lua::apply Handler @@ -198,7 +198,7 @@ (phase archive abstractionC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) (def: lua::power Handler @@ -211,7 +211,7 @@ baseA (analysis/type.with_type Frac (phase archive baseC)) _ (analysis/type.infer Frac)] - (wrap (#analysis.Extension extension (list powerA baseA)))))])) + (in (#analysis.Extension extension (list powerA baseA)))))])) (def: lua::import Handler @@ -220,7 +220,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer ..Object)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: lua::function Handler @@ -232,8 +232,8 @@ abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) _ (analysis/type.infer ..Function)] - (wrap (#analysis.Extension extension (list (analysis.nat arity) - abstractionA)))))])) + (in (#analysis.Extension extension (list (analysis.nat arity) + abstractionA)))))])) (def: #export bundle Bundle 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 2804d568f..78d3b7aac 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 @@ -45,7 +45,7 @@ (handler extension_name analyse archive inputs) (#try.Failure _) - (////analysis.throw ///.invalid_syntax [extension_name %.code args])))) + (////analysis.except ///.invalid_syntax [extension_name %.code args])))) (def: (simple inputsT+ outputT) (-> (List Type) Type Handler) @@ -60,8 +60,8 @@ (typeA.with_type argT (analyse archive argC))) (list.zipped/2 inputsT+ args))] - (wrap (#////analysis.Extension extension_name argsA))) - (////analysis.throw ///.incorrect_arity [extension_name num_expected num_actual])))))) + (in (#////analysis.Extension extension_name argsA))) + (////analysis.except ///.incorrect_arity [extension_name num_expected num_actual])))))) (def: #export (nullary valueT) (-> Type Handler) @@ -90,7 +90,7 @@ (do <>.monad [raw <code>.text] (case (text.size raw) - 1 (wrap (|> raw (text.nth 0) maybe.assume)) + 1 (in (|> raw (text.nth 0) maybe.assume)) _ (<>.failure (exception.construct ..char_text_must_be_size_1 [raw]))))) (def: lux::syntax_char_case! @@ -109,17 +109,17 @@ (do ! [branch (typeA.with_type expectedT (phase archive branch))] - (wrap [cases branch]))) + (in [cases branch]))) conditionals) else (typeA.with_type expectedT (phase archive else))] - (wrap (|> conditionals - (list\map (function (_ [cases branch]) - (////analysis.tuple - (list (////analysis.tuple (list\map (|>> ////analysis.nat) cases)) - branch)))) - (list& input else) - (#////analysis.Extension extension_name)))))]))) + (in (|> conditionals + (list\map (function (_ [cases branch]) + (////analysis.tuple + (list (////analysis.tuple (list\map (|>> ////analysis.nat) cases)) + branch)))) + (list& input else) + (#////analysis.Extension extension_name)))))]))) ## "lux is" represents reference/pointer equality. (def: lux::is @@ -142,10 +142,10 @@ _ (typeA.infer (type (Either Text varT))) opA (typeA.with_type (type (-> .Any varT)) (analyse archive opC))] - (wrap (#////analysis.Extension extension_name (list opA)))) + (in (#////analysis.Extension extension_name (list opA)))) _ - (////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) + (////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) (def: lux::in_module Handler @@ -156,7 +156,7 @@ (analyse archive exprC)) _ - (////analysis.throw ///.invalid_syntax [extension_name %.code argsC+])))) + (////analysis.except ///.invalid_syntax [extension_name %.code argsC+])))) (def: (lux::type::check eval) (-> Eval Handler) @@ -172,7 +172,7 @@ (analyse archive valueC))) _ - (////analysis.throw ///.incorrect_arity [extension_name 2 (list.size args)])))) + (////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) (def: (lux::type::as eval) (-> Eval Handler) @@ -186,10 +186,10 @@ _ (typeA.infer actualT) [valueT valueA] (typeA.with_inference (analyse archive valueC))] - (wrap valueA)) + (in valueA)) _ - (////analysis.throw ///.incorrect_arity [extension_name 2 (list.size args)])))) + (////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) (def: (caster input output) (-> Type Type Handler) @@ -210,10 +210,10 @@ [_ (typeA.infer .Macro) input_type (loop [input_name (name_of .Macro')] (do ! - [input_type (///.lift (meta.find_def (name_of .Macro')))] + [input_type (///.lift (meta.definition (name_of .Macro')))] (case input_type (#.Definition [exported? def_type def_data def_value]) - (wrap (:as Type def_value)) + (in (:as Type def_value)) (#.Alias real_name) (recur real_name))))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux index a30c9e6f0..40cf1f094 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list lengthA)))))])) + (in (#analysis.Extension extension (list lengthA)))))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (wrap (#analysis.Extension extension (list arrayA)))))])) + (in (#analysis.Extension extension (list arrayA)))))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: bundle::array Bundle @@ -127,7 +127,7 @@ (do {! phase.monad} [inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& (analysis.text constructor) inputsA)))))])) + (in (#analysis.Extension extension (list& (analysis.text constructor) inputsA)))))])) (def: object::get Handler @@ -138,8 +138,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in (#analysis.Extension extension (list (analysis.text fieldC) + objectA)))))])) (def: object::do Handler @@ -151,9 +151,9 @@ (phase archive objectC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& (analysis.text methodC) - objectA - inputsA)))))])) + (in (#analysis.Extension extension (list& (analysis.text methodC) + objectA + inputsA)))))])) (def: bundle::object Bundle @@ -173,7 +173,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: php::apply Handler @@ -185,7 +185,7 @@ (phase archive abstractionC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) (def: php::pack Handler @@ -198,7 +198,7 @@ dataA (analysis/type.with_type (type (Array (I64 Any))) (phase archive dataC)) _ (analysis/type.infer Text)] - (wrap (#analysis.Extension extension (list formatA dataA)))))])) + (in (#analysis.Extension extension (list formatA dataA)))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index a3635cf96..6d5e3290f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list lengthA)))))])) + (in (#analysis.Extension extension (list lengthA)))))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (wrap (#analysis.Extension extension (list arrayA)))))])) + (in (#analysis.Extension extension (list arrayA)))))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: bundle::array Bundle @@ -133,8 +133,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in (#analysis.Extension extension (list (analysis.text fieldC) + objectA)))))])) (def: object::do Handler @@ -146,9 +146,9 @@ (phase archive objectC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& (analysis.text methodC) - objectA - inputsA)))))])) + (in (#analysis.Extension extension (list& (analysis.text methodC) + objectA + inputsA)))))])) (def: bundle::object Bundle @@ -167,7 +167,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: python::import Handler @@ -176,7 +176,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer ..Object)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: python::apply Handler @@ -188,7 +188,7 @@ (phase archive abstractionC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) (def: python::function Handler @@ -200,8 +200,8 @@ abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) _ (analysis/type.infer ..Function)] - (wrap (#analysis.Extension extension (list (analysis.nat arity) - abstractionA)))))])) + (in (#analysis.Extension extension (list (analysis.nat arity) + abstractionA)))))])) (def: python::exec Handler @@ -214,7 +214,7 @@ globalsA (analysis/type.with_type ..Dict (phase archive globalsC)) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list codeA globalsA)))))])) + (in (#analysis.Extension extension (list codeA globalsA)))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index 1d01b479d..65650c837 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list lengthA)))))])) + (in (#analysis.Extension extension (list lengthA)))))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (wrap (#analysis.Extension extension (list arrayA)))))])) + (in (#analysis.Extension extension (list arrayA)))))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: bundle::array Bundle @@ -128,8 +128,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in (#analysis.Extension extension (list (analysis.text fieldC) + objectA)))))])) (def: object::do Handler @@ -141,9 +141,9 @@ (phase archive objectC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (wrap (#analysis.Extension extension (list& (analysis.text methodC) - objectA - inputsA)))))])) + (in (#analysis.Extension extension (list& (analysis.text methodC) + objectA + inputsA)))))])) (def: bundle::object Bundle @@ -162,7 +162,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: ruby::apply Handler @@ -174,7 +174,7 @@ (phase archive abstractionC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) (def: ruby::import Handler @@ -183,7 +183,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Bit)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index e7ff4ba15..8e309a9de 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list lengthA)))))])) + (in (#analysis.Extension extension (list lengthA)))))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (wrap (#analysis.Extension extension (list arrayA)))))])) + (in (#analysis.Extension extension (list arrayA)))))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (wrap (#analysis.Extension extension (list indexA arrayA)))))])) + (in (#analysis.Extension extension (list indexA arrayA)))))])) (def: bundle::array Bundle @@ -131,7 +131,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list (analysis.text name))))))])) + (in (#analysis.Extension extension (list (analysis.text name))))))])) (def: scheme::apply Handler @@ -143,7 +143,7 @@ (phase archive abstractionC)) inputsA (monad.map ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (wrap (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index d11c6cb49..a3265adb0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -77,7 +77,7 @@ (Parser (Modifier field.Field)) (`` ($_ <>.either (~~ (template [<label> <modifier>] - [(<>.after (<c>.text! <label>) (<>\wrap <modifier>))] + [(<>.after (<c>.text! <label>) (<>\in <modifier>))] ["public" field.public] ["private" field.private] @@ -88,7 +88,7 @@ (Parser (Modifier class.Class)) (`` ($_ <>.either (~~ (template [<label> <modifier>] - [(<>.after (<c>.text! <label>) (<>\wrap <modifier>))] + [(<>.after (<c>.text! <label>) (<>\in <modifier>))] ["final" class.final] ["abstract" class.abstract] @@ -98,7 +98,7 @@ (Parser (Modifier field.Field)) (`` ($_ <>.either (~~ (template [<label> <modifier>] - [(<>.after (<c>.text! <label>) (<>\wrap <modifier>))] + [(<>.after (<c>.text! <label>) (<>\in <modifier>))] ["volatile" field.volatile] ["final" field.final] @@ -110,9 +110,9 @@ (Parser Annotation) <c>.any) -(def: field-type +(def: field_type (Parser (Type Value)) - (<t>.embed parser.value <c>.text)) + (<t>.then parser.value <c>.text)) (type: Constant [Text (List Annotation) (Type Value) Code]) @@ -124,7 +124,7 @@ ($_ <>.and <c>.text (<c>.tuple (<>.some ..annotation)) - ..field-type + ..field_type <c>.any ))) @@ -140,7 +140,7 @@ ..visibility ..state (<c>.tuple (<>.some ..annotation)) - ..field-type + ..field_type ))) (type: Field @@ -154,26 +154,26 @@ ..variable )) -(type: Method-Definition +(type: Method_Definition (#Constructor (jvm.Constructor Code)) - (#Virtual-Method (jvm.Virtual-Method Code)) - (#Static-Method (jvm.Static-Method Code)) - (#Overriden-Method (jvm.Overriden-Method Code))) + (#Virtual_Method (jvm.Virtual_Method Code)) + (#Static_Method (jvm.Static_Method Code)) + (#Overriden_Method (jvm.Overriden_Method Code))) (def: method - (Parser Method-Definition) + (Parser Method_Definition) ($_ <>.or - jvm.constructor-definition - jvm.virtual-method-definition - jvm.static-method-definition - jvm.overriden-method-definition + jvm.constructor_definition + jvm.virtual_method_definition + jvm.static_method_definition + jvm.overriden_method_definition )) (def: (constraint name) (-> Text Constraint) {#type.name name - #type.super-class (type.class "java.lang.Object" (list)) - #type.super-interfaces (list)}) + #type.super_class (type.class "java.lang.Object" (list)) + #type.super_interfaces (list)}) (def: constant::modifier (Modifier field.Field) @@ -182,7 +182,7 @@ field.static field.final)) -(def: (field-definition field) +(def: (field_definition field) (-> Field (Resource field.Field)) (case field ## TODO: Handle annotations. @@ -199,7 +199,7 @@ [#.Int type.short [.i64 i32.i32 constant.integer pool.integer]] [#.Int type.int [.i64 i32.i32 constant.integer pool.integer]] [#.Int type.long [constant.long pool.long]] - [#.Frac type.float [host.double-to-float constant.float pool.float]] + [#.Frac type.float [host.double_to_float constant.float pool.float]] [#.Frac type.double [constant.double pool.double]] [#.Nat type.char [.i64 i32.i32 constant.integer pool.integer]] [#.Text (type.class "java.lang.String" (list)) [pool.string]] @@ -214,29 +214,29 @@ (field.field (modifier\compose visibility state) name type (row.row)))) -(def: (method-definition [mapping selfT] [analyse synthesize generate]) +(def: (method_definition [mapping selfT] [analyse synthesize generate]) (-> [Mapping .Type] [analysis.Phase synthesis.Phase (generation.Phase Anchor (Bytecode Any) Definition)] - (-> Method-Definition (Operation synthesis.Synthesis))) + (-> Method_Definition (Operation synthesis.Synthesis))) (function (_ methodC) (do phase.monad [methodA (: (Operation analysis.Analysis) - (directive.lift-analysis + (directive.lift_analysis (case methodC (#Constructor method) - (jvm.analyse-constructor-method analyse selfT mapping method) + (jvm.analyse_constructor_method analyse selfT mapping method) - (#Virtual-Method method) - (jvm.analyse-virtual-method analyse selfT mapping method) + (#Virtual_Method method) + (jvm.analyse_virtual_method analyse selfT mapping method) - (#Static-Method method) - (jvm.analyse-static-method analyse mapping method) + (#Static_Method method) + (jvm.analyse_static_method analyse mapping method) - (#Overriden-Method method) - (jvm.analyse-overriden-method analyse selfT mapping method))))] - (directive.lift-synthesis + (#Overriden_Method method) + (jvm.analyse_overriden_method analyse selfT mapping method))))] + (directive.lift_synthesis (synthesize methodA))))) (def: jvm::class @@ -252,51 +252,51 @@ (<c>.tuple (<>.some ..method))) (function (_ extension phase [[name parameters] - super-class - super-interfaces + super_class + super_interfaces inheritance ## TODO: Handle annotations. annotations fields methods]) (do {! phase.monad} - [parameters (directive.lift-analysis - (typeA.with-env - (jvm.parameter-types parameters))) + [parameters (directive.lift_analysis + (typeA.with_env + (jvm.parameter_types parameters))) #let [mapping (list\fold (function (_ [parameterJ parameterT] mapping) (dictionary.put (parser.name parameterJ) parameterT mapping)) luxT.fresh parameters)] - super-classT (directive.lift-analysis - (typeA.with-env - (luxT.check (luxT.class mapping) (..signature super-class)))) - super-interfaceT+ (directive.lift-analysis - (typeA.with-env + super_classT (directive.lift_analysis + (typeA.with_env + (luxT.check (luxT.class mapping) (..signature super_class)))) + super_interfaceT+ (directive.lift_analysis + (typeA.with_env (monad.map check.monad (|>> ..signature (luxT.check (luxT.class mapping))) - super-interfaces))) - #let [selfT (jvm.inheritance-relationship-type (#.Primitive name (list\map product.right parameters)) - super-classT - super-interfaceT+)] - state (extension.lift phase.get-state) + super_interfaces))) + #let [selfT (jvm.inheritance_relationship_type (#.Primitive name (list\map product.right parameters)) + super_classT + super_interfaceT+)] + state (extension.lift phase.get_state) #let [analyse (get@ [#directive.analysis #directive.phase] state) synthesize (get@ [#directive.synthesis #directive.phase] state) generate (get@ [#directive.generation #directive.phase] state)] - methods (monad.map ! (..method-definition [mapping selfT] [analyse synthesize generate]) + methods (monad.map ! (..method_definition [mapping selfT] [analyse synthesize generate]) methods) - ## _ (directive.lift-generation + ## _ (directive.lift_generation ## (generation.save! true ["" name] ## [name ## (class.class version.v6_0 ## (modifier\compose class.public inheritance) ## (name.internal name) (list\map (|>> product.left parser.name ..constraint) parameters) - ## super-class super-interfaces - ## (list\map ..field-definition fields) + ## super_class super_interfaces + ## (list\map ..field_definition fields) ## (list) ## TODO: Add methods ## (row.row))])) - _ (directive.lift-generation + _ (directive.lift_generation (generation.log! (format "Class " name)))] - (wrap directive.no-requirements)))])) + (in directive.no_requirements)))])) (def: #export bundle (Bundle Anchor (Bytecode Any) Definition) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index b67f9287b..d70b59aef 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -59,7 +59,7 @@ (handler extension_name phase archive inputs) (#try.Failure error) - (phase.throw ///.invalid_syntax [extension_name %.code inputs])))) + (phase.except ///.invalid_syntax [extension_name %.code inputs])))) (def: (context [module_id artifact_id]) (-> Context Context) @@ -81,7 +81,7 @@ codeG (generate archive codeS) module_id (/////generation.module_id module archive) codeV (/////generation.evaluate! (..context [module_id id]) codeG)] - (wrap [code//type codeG codeV])))) + (in [code//type codeG codeV])))) (def: #export (evaluate! archive type codeC) (All [anchor expression directive] @@ -116,7 +116,7 @@ module_id (phase.lift (archive.id module archive)) [target_name value directive] (/////generation.define! [module_id id] #.None codeG) _ (/////generation.save! id #.None directive)] - (wrap [code//type codeG value])))) + (in [code//type codeG value])))) (def: (definition archive name expected codeC) (All [anchor expression directive] @@ -137,13 +137,13 @@ (analyse archive codeC)) code//type (typeA.with_env (check.clean code//type))] - (wrap [code//type codeA])) + (in [code//type codeA])) (#.Some expected) (do ! [codeA (typeA.with_type expected (analyse archive codeC))] - (wrap [expected codeA])))))) + (in [expected codeA])))))) codeS (/////directive.lift_synthesis (synthesize archive codeA))] (definition' archive generate name code//type codeS))) @@ -168,7 +168,7 @@ id (<learn> extension) [target_name value directive] (/////generation.define! [module_id id] #.None codeG) _ (/////generation.save! id #.None directive)] - (wrap [codeG value]))))) + (in [codeG value]))))) (def: #export (<full> archive extension codeT codeC) (All [anchor expression directive] @@ -231,10 +231,10 @@ (module.define short_name (#.Right [exported? type (:as Code annotations) value]))) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] - (wrap /////directive.no_requirements)) + (in /////directive.no_requirements)) _ - (phase.throw ///.invalid_syntax [extension_name %.code inputsC+])))) + (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) (def: (def::type_tagged expander host_analysis) (-> Expander /////analysis.Bundle Handler) @@ -254,7 +254,7 @@ (module.declare_tags tags exported? (:as Type value)))) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] - (wrap /////directive.no_requirements)))])) + (in /////directive.no_requirements)))])) (def: imports (Parser (List Import)) @@ -276,12 +276,12 @@ (do ! [_ (module.import module)] (case alias - "" (wrap []) + "" (in []) _ (module.alias alias module)))) imports)] (module.set_annotations annotationsV)))] - (wrap {#/////directive.imports imports - #/////directive.referrals (list)})))])) + (in {#/////directive.imports imports + #/////directive.referrals (list)})))])) (exception: #export (cannot_alias_an_alias {local Alias} {foreign Alias} {target Name}) (exception.report @@ -293,10 +293,10 @@ (-> Text Name (/////analysis.Operation Any)) (do phase.monad [current_module (///.lift meta.current_module_name) - constant (///.lift (meta.find_def original))] + constant (///.lift (meta.definition original))] (case constant (#.Left de_aliased) - (phase.throw ..cannot_alias_an_alias [[current_module alias] original de_aliased]) + (phase.except ..cannot_alias_an_alias [[current_module alias] original de_aliased]) (#.Right [exported? original_type original_annotations original_value]) (module.define alias (#.Left original))))) @@ -311,7 +311,7 @@ (phase.sub [(get@ [#/////directive.analysis #/////directive.state]) (set@ [#/////directive.analysis #/////directive.state])] (define_alias alias def_name)))] - (wrap /////directive.no_requirements)))])) + (in /////directive.no_requirements)))])) (template [<description> <mame> <def_type> <type> <scope> <definer>] [(def: (<mame> [anchorT expressionT directiveT] extender) @@ -336,10 +336,10 @@ (:assume handlerV))) _ (/////directive.lift_generation (/////generation.log! (format <description> " " (%.text (:as Text name)))))] - (wrap /////directive.no_requirements)) + (in /////directive.no_requirements)) _ - (phase.throw ///.invalid_syntax [extension_name %.code inputsC+]))))] + (phase.except ///.invalid_syntax [extension_name %.code inputsC+]))))] ["Analysis" def::analysis @@ -412,10 +412,10 @@ module_id (phase.lift (archive.id current_module archive)) _ (/////directive.lift_generation (define_program archive module_id generate program programS))] - (wrap /////directive.no_requirements)) + (in /////directive.no_requirements)) _ - (phase.throw ///.invalid_syntax [extension_name %.code inputsC+])))) + (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) (def: (bundle::def expander host_analysis program anchorT,expressionT,directiveT extender) (All [anchor expression directive] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux index 7f911e3b3..ec91d1e10 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux @@ -49,7 +49,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) (|>> list _.apply/* (|> (_.constant function)))) @@ -71,10 +71,10 @@ ## (monad.map ! (function (_ [chars branch]) ## (do ! ## [branchG (phase archive branch)] -## (wrap [(|> chars (list\map (|>> .int _.int (_.=/2 @input))) _.or) +## (in [(|> chars (list\map (|>> .int _.int (_.=/2 @input))) _.or) ## branchG]))) ## conditionals))] -## (wrap (_.let (list [@input inputG]) +## (in (_.let (list [@input inputG]) ## (list (list\fold (function (_ [test then] else) ## (_.if test then else)) ## elseG diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux index 9cc6c1dbc..e84d5cdf7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux @@ -43,7 +43,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ## [Procedures] ## [[Bits]] @@ -108,14 +108,14 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch)] - (wrap [(list\map (|>> .int _.int) chars) - (_.return branchG)]))) + (in [(list\map (|>> .int _.int) chars) + (_.return branchG)]))) conditionals))] - (wrap (_.apply/* (_.closure (list) - (_.switch (_.the //runtime.i64_low_field inputG) - conditionalsG - (#.Some (_.return elseG)))) - (list)))))])) + (in (_.apply/* (_.closure (list) + (_.switch (_.the //runtime.i64_low_field inputG) + conditionalsG + (#.Some (_.return elseG)))) + (list)))))])) ## [Bundles] (def: lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux index 67966efe8..8e9464e77 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux @@ -69,7 +69,7 @@ (do {! ////////phase.monad} [constructorG (phase archive constructorS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.new constructorG inputsG))))])) + (in (_.new constructorG inputsG))))])) (def: object::get Handler @@ -78,7 +78,7 @@ (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] - (wrap (_.the fieldS objectG))))])) + (in (_.the fieldS objectG))))])) (def: object::do Handler @@ -88,7 +88,7 @@ (do {! ////////phase.monad} [objectG (phase archive objectS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.do methodS inputsG objectG))))])) + (in (_.do methodS inputsG objectG))))])) (template [<!> <?> <unit>] [(def: <!> (Nullary Expression) (function.constant <unit>)) @@ -115,7 +115,7 @@ (custom [<s>.text (function (_ extension phase archive name) - (\ ////////phase.monad wrap (_.var name)))])) + (\ ////////phase.monad in (_.var name)))])) (def: js::apply (custom @@ -124,7 +124,7 @@ (do {! ////////phase.monad} [abstractionG (phase archive abstractionS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.apply/* abstractionG inputsG))))])) + (in (_.apply/* abstractionG inputsG))))])) (def: js::function (custom @@ -138,13 +138,13 @@ g!inputs (monad.map ! (function (_ _) (variable "input")) (list.repeat (.nat arity) [])) g!abstraction (variable "abstraction")] - (wrap (_.closure g!inputs - ($_ _.then - (_.define g!abstraction abstractionG) - (_.return (case (.nat arity) - 0 (_.apply/1 g!abstraction //runtime.unit) - 1 (_.apply/* g!abstraction g!inputs) - _ (_.apply/1 g!abstraction (_.array g!inputs)))))))))])) + (in (_.closure g!inputs + ($_ _.then + (_.define g!abstraction abstractionG) + (_.return (case (.nat arity) + 0 (_.apply/1 g!abstraction //runtime.unit) + 1 (_.apply/* g!abstraction g!inputs) + _ (_.apply/1 g!abstraction (_.array g!inputs)))))))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux index d71b9dbcc..eed3eb6ce 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux @@ -47,13 +47,13 @@ (-> [(Parser s) (-> Text Phase Archive s (Operation (Bytecode Any)))] Handler)) - (function (_ extension-name phase archive input) + (function (_ extension_name phase archive input) (case (<s>.run parser input) (#try.Success input') - (handler extension-name phase archive input') + (handler extension_name phase archive input') (#try.Failure error) - (/////.throw /////extension.invalid-syntax [extension-name //////synthesis.%synthesis input])))) + (/////.except /////extension.invalid_syntax [extension_name //////synthesis.%synthesis input])))) (def: $Boolean (type.class "java.lang.Boolean" (list))) (def: $Double (type.class "java.lang.Double" (list))) @@ -65,19 +65,19 @@ (def: $System (type.class "java.lang.System" (list))) (def: $Error (type.class "java.lang.Error" (list))) -(def: lux-int +(def: lux_int (Bytecode Any) ($_ _.compose _.i2l (///value.wrap type.long))) -(def: jvm-int +(def: jvm_int (Bytecode Any) ($_ _.compose (///value.unwrap type.long) _.l2i)) -(def: ensure-string +(def: ensure_string (Bytecode Any) (_.checkcast $String)) @@ -85,28 +85,28 @@ (-> (-> Label (Bytecode Any)) (Bytecode Any)) (do _.monad - [@then _.new-label - @end _.new-label] + [@then _.new_label + @end _.new_label] ($_ _.compose (bytecode @then) (_.getstatic $Boolean "FALSE" $Boolean) (_.goto @end) - (_.set-label @then) + (_.set_label @then) (_.getstatic $Boolean "TRUE" $Boolean) - (_.set-label @end) + (_.set_label @end) ))) ## TODO: Get rid of this ASAP -(def: lux::syntax-char-case! +(def: lux::syntax_char_case! (..custom [($_ <>.and <s>.any <s>.any (<>.some (<s>.tuple ($_ <>.and (<s>.tuple (<>.many <s>.i64)) <s>.any)))) - (function (_ extension-name phase archive [inputS elseS conditionalsS]) + (function (_ extension_name phase archive [inputS elseS conditionalsS]) (do {! /////.monad} - [@end ///runtime.forge-label + [@end ///runtime.forge_label inputG (phase archive inputS) elseG (phase archive elseS) conditionalsG+ (: (Operation (List [(List [S4 Label]) @@ -114,14 +114,14 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch) - @branch ///runtime.forge-label] - (wrap [(list\map (function (_ char) - [(try.assumed (signed.s4 (.int char))) @branch]) - chars) - ($_ _.compose - (_.set-label @branch) - branchG - (_.goto @end))]))) + @branch ///runtime.forge_label] + (in [(list\map (function (_ char) + [(try.assumed (signed.s4 (.int char))) @branch]) + chars) + ($_ _.compose + (_.set_label @branch) + branchG + (_.goto @end))]))) conditionalsS)) #let [table (|> conditionalsG+ (list\map product.left) @@ -129,23 +129,23 @@ conditionalsG (|> conditionalsG+ (list\map product.right) (monad.seq _.monad))]] - (wrap (do _.monad - [@else _.new-label] - ($_ _.compose - inputG (///value.unwrap type.long) _.l2i - (_.lookupswitch @else table) - conditionalsG - (_.set-label @else) - elseG - (_.set-label @end) - )))))])) + (in (do _.monad + [@else _.new_label] + ($_ _.compose + inputG (///value.unwrap type.long) _.l2i + (_.lookupswitch @else table) + conditionalsG + (_.set_label @else) + elseG + (_.set_label @end) + )))))])) (def: (lux::is [referenceG sampleG]) (Binary (Bytecode Any)) ($_ _.compose referenceG sampleG - (..predicate _.if-acmpeq))) + (..predicate _.if_acmpeq))) (def: (lux::try riskyG) (Unary (Bytecode Any)) @@ -157,7 +157,7 @@ (def: bundle::lux Bundle (|> (: Bundle /////bundle.empty) - (/////bundle.install "syntax char case!" ..lux::syntax-char-case!) + (/////bundle.install "syntax char case!" ..lux::syntax_char_case!) (/////bundle.install "is" (binary ..lux::is)) (/////bundle.install "try" (unary ..lux::try)))) @@ -179,11 +179,11 @@ (Binary (Bytecode Any)) ($_ _.compose inputG (///value.unwrap type.long) - shiftG ..jvm-int + shiftG ..jvm_int <op> (///value.wrap type.long)))] - [i64::left-shift _.lshl] - [i64::right-shift _.lushr] + [i64::left_shift _.lshl] + [i64::right_shift _.lushr] ) (template [<name> <type> <op>] @@ -216,16 +216,16 @@ paramG (///value.unwrap <type>) <cmp> <reference> - (..predicate _.if-icmpeq)))] + (..predicate _.if_icmpeq)))] - [<eq> _.iconst-0] - [<lt> _.iconst-m1])] + [<eq> _.iconst_0] + [<lt> _.iconst_m1])] [i64::= i64::< type.long _.lcmp] [f64::= f64::< type.double _.dcmpg] ) -(def: (to-string class from) +(def: (to_string class from) (-> (Type Class) (Type Primitive) (Bytecode Any)) (_.invokestatic class "toString" (type.method [(list from) ..$String (list)]))) @@ -248,7 +248,7 @@ ($_ _.compose _.l2i _.i2c - (..to-string ..$Character type.char))] + (..to_string ..$Character type.char))] [f64::i64 (///value.unwrap type.double) @@ -258,11 +258,11 @@ [f64::encode (///value.unwrap type.double) - (..to-string ..$Double type.double)] + (..to_string ..$Double type.double)] [f64::decode - ..ensure-string - ///runtime.decode-frac] + ..ensure_string + ///runtime.decode_frac] ) (def: bundle::i64 @@ -272,8 +272,8 @@ (/////bundle.install "and" (binary ..i64::and)) (/////bundle.install "or" (binary ..i64::or)) (/////bundle.install "xor" (binary ..i64::xor)) - (/////bundle.install "left-shift" (binary ..i64::left-shift)) - (/////bundle.install "right-shift" (binary ..i64::right-shift)) + (/////bundle.install "left-shift" (binary ..i64::left_shift)) + (/////bundle.install "right-shift" (binary ..i64::right_shift)) (/////bundle.install "=" (binary ..i64::=)) (/////bundle.install "<" (binary ..i64::<)) (/////bundle.install "+" (binary ..i64::+)) @@ -303,67 +303,67 @@ (Unary (Bytecode Any)) ($_ _.compose inputG - ..ensure-string + ..ensure_string (_.invokevirtual ..$String "length" (type.method [(list) type.int (list)])) - ..lux-int)) + ..lux_int)) -(def: no-op (Bytecode Any) (_\wrap [])) +(def: no_op (Bytecode Any) (_\in [])) -(template [<name> <pre-subject> <pre-param> <op> <post>] +(template [<name> <pre_subject> <pre_param> <op> <post>] [(def: (<name> [paramG subjectG]) (Binary (Bytecode Any)) ($_ _.compose - subjectG <pre-subject> - paramG <pre-param> + subjectG <pre_subject> + paramG <pre_param> <op> <post>))] - [text::= ..no-op ..no-op + [text::= ..no_op ..no_op (_.invokevirtual ..$Object "equals" (type.method [(list ..$Object) type.boolean (list)])) (///value.wrap type.boolean)] - [text::< ..ensure-string ..ensure-string + [text::< ..ensure_string ..ensure_string (_.invokevirtual ..$String "compareTo" (type.method [(list ..$String) type.int (list)])) (..predicate _.iflt)] - [text::char ..ensure-string ..jvm-int + [text::char ..ensure_string ..jvm_int (_.invokevirtual ..$String "charAt" (type.method [(list type.int) type.char (list)])) - ..lux-int] + ..lux_int] ) (def: (text::concat [leftG rightG]) (Binary (Bytecode Any)) ($_ _.compose - leftG ..ensure-string - rightG ..ensure-string + leftG ..ensure_string + rightG ..ensure_string (_.invokevirtual ..$String "concat" (type.method [(list ..$String) ..$String (list)])))) (def: (text::clip [startG endG subjectG]) (Trinary (Bytecode Any)) ($_ _.compose - subjectG ..ensure-string - startG ..jvm-int - endG ..jvm-int + subjectG ..ensure_string + startG ..jvm_int + endG ..jvm_int (_.invokevirtual ..$String "substring" (type.method [(list type.int type.int) ..$String (list)])))) -(def: index-method (type.method [(list ..$String type.int) type.int (list)])) +(def: index_method (type.method [(list ..$String type.int) type.int (list)])) (def: (text::index [startG partG textG]) (Trinary (Bytecode Any)) (do _.monad - [@not-found _.new-label - @end _.new-label] + [@not_found _.new_label + @end _.new_label] ($_ _.compose - textG ..ensure-string - partG ..ensure-string - startG ..jvm-int - (_.invokevirtual ..$String "indexOf" index-method) + textG ..ensure_string + partG ..ensure_string + startG ..jvm_int + (_.invokevirtual ..$String "indexOf" index_method) _.dup - _.iconst-m1 - (_.if-icmpeq @not-found) - ..lux-int - ///runtime.some-injection + _.iconst_m1 + (_.if_icmpeq @not_found) + ..lux_int + ///runtime.some_injection (_.goto @end) - (_.set-label @not-found) + (_.set_label @not_found) _.pop - ///runtime.none-injection - (_.set-label @end)))) + ///runtime.none_injection + (_.set_label @end)))) (def: bundle::text Bundle @@ -377,14 +377,14 @@ (/////bundle.install "char" (binary ..text::char)) (/////bundle.install "clip" (trinary ..text::clip))))) -(def: string-method (type.method [(list ..$String) type.void (list)])) +(def: string_method (type.method [(list ..$String) type.void (list)])) (def: (io::log messageG) (Unary (Bytecode Any)) ($_ _.compose (_.getstatic ..$System "out" ..$PrintStream) messageG - ..ensure-string - (_.invokevirtual ..$PrintStream "println" ..string-method) + ..ensure_string + (_.invokevirtual ..$PrintStream "println" ..string_method) ///runtime.unit)) (def: (io::error messageG) @@ -393,8 +393,8 @@ (_.new ..$Error) _.dup messageG - ..ensure-string - (_.invokespecial ..$Error "<init>" ..string-method) + ..ensure_string + (_.invokespecial ..$Error "<init>" ..string_method) _.athrow)) (def: bundle::io 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 bcab57722..9827c2480 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 @@ -34,7 +34,7 @@ [encoding ["." name]] ["_" bytecode (#+ Label Bytecode) ("#\." monad) - ["__" instruction (#+ Primitive-Array-Type)]] + ["__" instruction (#+ Primitive_Array_Type)]] ["." type (#+ Type Typed Argument) ["." category (#+ Void Value' Value Return' Return Primitive Object Array Var Parameter)] ["." box] @@ -90,60 +90,60 @@ inputG <conversion>)))] - [_.d2f conversion::double-to-float] - [_.d2i conversion::double-to-int] - [_.d2l conversion::double-to-long] - [_.f2d conversion::float-to-double] - [_.f2i conversion::float-to-int] - [_.f2l conversion::float-to-long] - [_.i2b conversion::int-to-byte] - [_.i2c conversion::int-to-char] - [_.i2d conversion::int-to-double] - [_.i2f conversion::int-to-float] - [_.i2l conversion::int-to-long] - [_.i2s conversion::int-to-short] - [_.l2d conversion::long-to-double] - [_.l2f conversion::long-to-float] - [_.l2i conversion::long-to-int] - [..l2s conversion::long-to-short] - [..l2b conversion::long-to-byte] - [..l2c conversion::long-to-char] - [_.i2b conversion::char-to-byte] - [_.i2s conversion::char-to-short] - [_.nop conversion::char-to-int] - [_.i2l conversion::char-to-long] - [_.i2l conversion::byte-to-long] - [_.i2l conversion::short-to-long] + [_.d2f conversion::double_to_float] + [_.d2i conversion::double_to_int] + [_.d2l conversion::double_to_long] + [_.f2d conversion::float_to_double] + [_.f2i conversion::float_to_int] + [_.f2l conversion::float_to_long] + [_.i2b conversion::int_to_byte] + [_.i2c conversion::int_to_char] + [_.i2d conversion::int_to_double] + [_.i2f conversion::int_to_float] + [_.i2l conversion::int_to_long] + [_.i2s conversion::int_to_short] + [_.l2d conversion::long_to_double] + [_.l2f conversion::long_to_float] + [_.l2i conversion::long_to_int] + [..l2s conversion::long_to_short] + [..l2b conversion::long_to_byte] + [..l2c conversion::long_to_char] + [_.i2b conversion::char_to_byte] + [_.i2s conversion::char_to_short] + [_.nop conversion::char_to_int] + [_.i2l conversion::char_to_long] + [_.i2l conversion::byte_to_long] + [_.i2l conversion::short_to_long] ) (def: bundle::conversion Bundle (<| (/////bundle.prefix "conversion") (|> (: Bundle /////bundle.empty) - (/////bundle.install "double-to-float" (unary conversion::double-to-float)) - (/////bundle.install "double-to-int" (unary conversion::double-to-int)) - (/////bundle.install "double-to-long" (unary conversion::double-to-long)) - (/////bundle.install "float-to-double" (unary conversion::float-to-double)) - (/////bundle.install "float-to-int" (unary conversion::float-to-int)) - (/////bundle.install "float-to-long" (unary conversion::float-to-long)) - (/////bundle.install "int-to-byte" (unary conversion::int-to-byte)) - (/////bundle.install "int-to-char" (unary conversion::int-to-char)) - (/////bundle.install "int-to-double" (unary conversion::int-to-double)) - (/////bundle.install "int-to-float" (unary conversion::int-to-float)) - (/////bundle.install "int-to-long" (unary conversion::int-to-long)) - (/////bundle.install "int-to-short" (unary conversion::int-to-short)) - (/////bundle.install "long-to-double" (unary conversion::long-to-double)) - (/////bundle.install "long-to-float" (unary conversion::long-to-float)) - (/////bundle.install "long-to-int" (unary conversion::long-to-int)) - (/////bundle.install "long-to-short" (unary conversion::long-to-short)) - (/////bundle.install "long-to-byte" (unary conversion::long-to-byte)) - (/////bundle.install "long-to-char" (unary conversion::long-to-char)) - (/////bundle.install "char-to-byte" (unary conversion::char-to-byte)) - (/////bundle.install "char-to-short" (unary conversion::char-to-short)) - (/////bundle.install "char-to-int" (unary conversion::char-to-int)) - (/////bundle.install "char-to-long" (unary conversion::char-to-long)) - (/////bundle.install "byte-to-long" (unary conversion::byte-to-long)) - (/////bundle.install "short-to-long" (unary conversion::short-to-long)) + (/////bundle.install "double-to-float" (unary conversion::double_to_float)) + (/////bundle.install "double-to-int" (unary conversion::double_to_int)) + (/////bundle.install "double-to-long" (unary conversion::double_to_long)) + (/////bundle.install "float-to-double" (unary conversion::float_to_double)) + (/////bundle.install "float-to-int" (unary conversion::float_to_int)) + (/////bundle.install "float-to-long" (unary conversion::float_to_long)) + (/////bundle.install "int-to-byte" (unary conversion::int_to_byte)) + (/////bundle.install "int-to-char" (unary conversion::int_to_char)) + (/////bundle.install "int-to-double" (unary conversion::int_to_double)) + (/////bundle.install "int-to-float" (unary conversion::int_to_float)) + (/////bundle.install "int-to-long" (unary conversion::int_to_long)) + (/////bundle.install "int-to-short" (unary conversion::int_to_short)) + (/////bundle.install "long-to-double" (unary conversion::long_to_double)) + (/////bundle.install "long-to-float" (unary conversion::long_to_float)) + (/////bundle.install "long-to-int" (unary conversion::long_to_int)) + (/////bundle.install "long-to-short" (unary conversion::long_to_short)) + (/////bundle.install "long-to-byte" (unary conversion::long_to_byte)) + (/////bundle.install "long-to-char" (unary conversion::long_to_char)) + (/////bundle.install "char-to-byte" (unary conversion::char_to_byte)) + (/////bundle.install "char-to-short" (unary conversion::char_to_short)) + (/////bundle.install "char-to-int" (unary conversion::char_to_int)) + (/////bundle.install "char-to-long" (unary conversion::char_to_long)) + (/////bundle.install "byte-to-long" (unary conversion::byte_to_long)) + (/////bundle.install "short-to-long" (unary conversion::short_to_long)) ))) (template [<name> <op>] @@ -199,42 +199,42 @@ [(def: (<name> [xG yG]) (Binary (Bytecode Any)) (do _.monad - [@then _.new-label - @end _.new-label] + [@then _.new_label + @end _.new_label] ($_ _.compose xG yG (<op> @then) falseG (_.goto @end) - (_.set-label @then) + (_.set_label @then) trueG - (_.set-label @end))))] + (_.set_label @end))))] - [int::= _.if-icmpeq] - [int::< _.if-icmplt] + [int::= _.if_icmpeq] + [int::< _.if_icmplt] - [char::= _.if-icmpeq] - [char::< _.if-icmplt] + [char::= _.if_icmpeq] + [char::< _.if_icmplt] ) (template [<name> <op> <reference>] [(def: (<name> [xG yG]) (Binary (Bytecode Any)) (do _.monad - [@then _.new-label - @end _.new-label] + [@then _.new_label + @end _.new_label] ($_ _.compose xG yG <op> (_.int (i32.i32 (.i64 <reference>))) - (_.if-icmpeq @then) + (_.if_icmpeq @then) falseG (_.goto @end) - (_.set-label @then) + (_.set_label @then) trueG - (_.set-label @end))))] + (_.set_label @end))))] [long::= _.lcmp +0] [long::< _.lcmp -1] @@ -321,7 +321,7 @@ (template [<name> <category> <parser>] [(def: #export <name> (Parser (Type <category>)) - (<t>.embed <parser> <s>.text))] + (<t>.then <parser> <s>.text))] [var Var parser.var] [class category.Class parser.class] @@ -330,133 +330,133 @@ [return Return parser.return] ) -(exception: #export (not-an-object-array {arrayJT (Type Array)}) +(exception: #export (not_an_object_array {arrayJT (Type Array)}) (exception.report ["JVM Type" (|> arrayJT type.signature signature.signature)])) -(def: #export object-array +(def: #export object_array (Parser (Type Object)) (do <>.monad - [arrayJT (<t>.embed parser.array <s>.text)] + [arrayJT (<t>.then parser.array <s>.text)] (case (parser.array? arrayJT) (#.Some elementJT) (case (parser.object? elementJT) (#.Some elementJT) - (wrap elementJT) + (in elementJT) #.None - (<>.failure (exception.construct ..not-an-object-array arrayJT))) + (<>.failure (exception.construct ..not_an_object_array arrayJT))) #.None (undefined)))) -(def: (primitive-array-length-handler jvm-primitive) +(def: (primitive_array_length_handler jvm_primitive) (-> (Type Primitive) Handler) (..custom [<s>.any - (function (_ extension-name generate archive arrayS) + (function (_ extension_name generate archive arrayS) (do //////.monad [arrayG (generate archive arrayS)] - (wrap ($_ _.compose - arrayG - (_.checkcast (type.array jvm-primitive)) - _.arraylength))))])) + (in ($_ _.compose + arrayG + (_.checkcast (type.array jvm_primitive)) + _.arraylength))))])) (def: array::length::object Handler (..custom - [($_ <>.and ..object-array <s>.any) - (function (_ extension-name generate archive [elementJT arrayS]) + [($_ <>.and ..object_array <s>.any) + (function (_ extension_name generate archive [elementJT arrayS]) (do //////.monad [arrayG (generate archive arrayS)] - (wrap ($_ _.compose - arrayG - (_.checkcast (type.array elementJT)) - _.arraylength))))])) + (in ($_ _.compose + arrayG + (_.checkcast (type.array elementJT)) + _.arraylength))))])) -(def: (new-primitive-array-handler jvm-primitive) - (-> Primitive-Array-Type Handler) +(def: (new_primitive_array_handler jvm_primitive) + (-> Primitive_Array_Type Handler) (..custom [<s>.any - (function (_ extension-name generate archive [lengthS]) + (function (_ extension_name generate archive [lengthS]) (do //////.monad [lengthG (generate archive lengthS)] - (wrap ($_ _.compose - lengthG - (_.newarray jvm-primitive)))))])) + (in ($_ _.compose + lengthG + (_.newarray jvm_primitive)))))])) (def: array::new::object Handler (..custom [($_ <>.and ..object <s>.any) - (function (_ extension-name generate archive [objectJT lengthS]) + (function (_ extension_name generate archive [objectJT lengthS]) (do //////.monad [lengthG (generate archive lengthS)] - (wrap ($_ _.compose - lengthG - (_.anewarray objectJT)))))])) + (in ($_ _.compose + lengthG + (_.anewarray objectJT)))))])) -(def: (read-primitive-array-handler jvm-primitive loadG) +(def: (read_primitive_array_handler jvm_primitive loadG) (-> (Type Primitive) (Bytecode Any) Handler) (..custom [($_ <>.and <s>.any <s>.any) - (function (_ extension-name generate archive [idxS arrayS]) + (function (_ extension_name generate archive [idxS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS)] - (wrap ($_ _.compose - arrayG - (_.checkcast (type.array jvm-primitive)) - idxG - loadG))))])) + (in ($_ _.compose + arrayG + (_.checkcast (type.array jvm_primitive)) + idxG + loadG))))])) (def: array::read::object Handler (..custom - [($_ <>.and ..object-array <s>.any <s>.any) - (function (_ extension-name generate archive [elementJT idxS arrayS]) + [($_ <>.and ..object_array <s>.any <s>.any) + (function (_ extension_name generate archive [elementJT idxS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS)] - (wrap ($_ _.compose - arrayG - (_.checkcast (type.array elementJT)) - idxG - _.aaload))))])) + (in ($_ _.compose + arrayG + (_.checkcast (type.array elementJT)) + idxG + _.aaload))))])) -(def: (write-primitive-array-handler jvm-primitive storeG) +(def: (write_primitive_array_handler jvm_primitive storeG) (-> (Type Primitive) (Bytecode Any) Handler) (..custom [($_ <>.and <s>.any <s>.any <s>.any) - (function (_ extension-name generate archive [idxS valueS arrayS]) + (function (_ extension_name generate archive [idxS valueS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS) valueG (generate archive valueS)] - (wrap ($_ _.compose - arrayG - (_.checkcast (type.array jvm-primitive)) - _.dup - idxG - valueG - storeG))))])) + (in ($_ _.compose + arrayG + (_.checkcast (type.array jvm_primitive)) + _.dup + idxG + valueG + storeG))))])) (def: array::write::object Handler (..custom - [($_ <>.and ..object-array <s>.any <s>.any <s>.any) - (function (_ extension-name generate archive [elementJT idxS valueS arrayS]) + [($_ <>.and ..object_array <s>.any <s>.any <s>.any) + (function (_ extension_name generate archive [elementJT idxS valueS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS) valueG (generate archive valueS)] - (wrap ($_ _.compose - arrayG - (_.checkcast (type.array elementJT)) - _.dup - idxG - valueG - _.aastore))))])) + (in ($_ _.compose + arrayG + (_.checkcast (type.array elementJT)) + _.dup + idxG + valueG + _.aastore))))])) (def: bundle::array Bundle @@ -464,67 +464,67 @@ (|> /////bundle.empty (dictionary.merge (<| (/////bundle.prefix "length") (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (primitive-array-length-handler type.boolean)) - (/////bundle.install (reflection.reflection reflection.byte) (primitive-array-length-handler type.byte)) - (/////bundle.install (reflection.reflection reflection.short) (primitive-array-length-handler type.short)) - (/////bundle.install (reflection.reflection reflection.int) (primitive-array-length-handler type.int)) - (/////bundle.install (reflection.reflection reflection.long) (primitive-array-length-handler type.long)) - (/////bundle.install (reflection.reflection reflection.float) (primitive-array-length-handler type.float)) - (/////bundle.install (reflection.reflection reflection.double) (primitive-array-length-handler type.double)) - (/////bundle.install (reflection.reflection reflection.char) (primitive-array-length-handler type.char)) + (/////bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler type.boolean)) + (/////bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler type.byte)) + (/////bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler type.short)) + (/////bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler type.int)) + (/////bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler type.long)) + (/////bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler type.float)) + (/////bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler type.double)) + (/////bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler type.char)) (/////bundle.install "object" array::length::object)))) (dictionary.merge (<| (/////bundle.prefix "new") (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (new-primitive-array-handler __.t-boolean)) - (/////bundle.install (reflection.reflection reflection.byte) (new-primitive-array-handler __.t-byte)) - (/////bundle.install (reflection.reflection reflection.short) (new-primitive-array-handler __.t-short)) - (/////bundle.install (reflection.reflection reflection.int) (new-primitive-array-handler __.t-int)) - (/////bundle.install (reflection.reflection reflection.long) (new-primitive-array-handler __.t-long)) - (/////bundle.install (reflection.reflection reflection.float) (new-primitive-array-handler __.t-float)) - (/////bundle.install (reflection.reflection reflection.double) (new-primitive-array-handler __.t-double)) - (/////bundle.install (reflection.reflection reflection.char) (new-primitive-array-handler __.t-char)) + (/////bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler __.t_boolean)) + (/////bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler __.t_byte)) + (/////bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler __.t_short)) + (/////bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler __.t_int)) + (/////bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler __.t_long)) + (/////bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler __.t_float)) + (/////bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler __.t_double)) + (/////bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler __.t_char)) (/////bundle.install "object" array::new::object)))) (dictionary.merge (<| (/////bundle.prefix "read") (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (read-primitive-array-handler type.boolean _.baload)) - (/////bundle.install (reflection.reflection reflection.byte) (read-primitive-array-handler type.byte _.baload)) - (/////bundle.install (reflection.reflection reflection.short) (read-primitive-array-handler type.short _.saload)) - (/////bundle.install (reflection.reflection reflection.int) (read-primitive-array-handler type.int _.iaload)) - (/////bundle.install (reflection.reflection reflection.long) (read-primitive-array-handler type.long _.laload)) - (/////bundle.install (reflection.reflection reflection.float) (read-primitive-array-handler type.float _.faload)) - (/////bundle.install (reflection.reflection reflection.double) (read-primitive-array-handler type.double _.daload)) - (/////bundle.install (reflection.reflection reflection.char) (read-primitive-array-handler type.char _.caload)) + (/////bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler type.boolean _.baload)) + (/////bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler type.byte _.baload)) + (/////bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler type.short _.saload)) + (/////bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler type.int _.iaload)) + (/////bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler type.long _.laload)) + (/////bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler type.float _.faload)) + (/////bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler type.double _.daload)) + (/////bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler type.char _.caload)) (/////bundle.install "object" array::read::object)))) (dictionary.merge (<| (/////bundle.prefix "write") (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (write-primitive-array-handler type.boolean _.bastore)) - (/////bundle.install (reflection.reflection reflection.byte) (write-primitive-array-handler type.byte _.bastore)) - (/////bundle.install (reflection.reflection reflection.short) (write-primitive-array-handler type.short _.sastore)) - (/////bundle.install (reflection.reflection reflection.int) (write-primitive-array-handler type.int _.iastore)) - (/////bundle.install (reflection.reflection reflection.long) (write-primitive-array-handler type.long _.lastore)) - (/////bundle.install (reflection.reflection reflection.float) (write-primitive-array-handler type.float _.fastore)) - (/////bundle.install (reflection.reflection reflection.double) (write-primitive-array-handler type.double _.dastore)) - (/////bundle.install (reflection.reflection reflection.char) (write-primitive-array-handler type.char _.castore)) + (/////bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler type.boolean _.bastore)) + (/////bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler type.byte _.bastore)) + (/////bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler type.short _.sastore)) + (/////bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler type.int _.iastore)) + (/////bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler type.long _.lastore)) + (/////bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler type.float _.fastore)) + (/////bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler type.double _.dastore)) + (/////bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler type.char _.castore)) (/////bundle.install "object" array::write::object)))) ))) (def: (object::null _) (Nullary (Bytecode Any)) - _.aconst-null) + _.aconst_null) (def: (object::null? objectG) (Unary (Bytecode Any)) (do _.monad - [@then _.new-label - @end _.new-label] + [@then _.new_label + @end _.new_label] ($_ _.compose objectG (_.ifnull @then) ..falseG (_.goto @end) - (_.set-label @then) + (_.set_label @then) ..trueG - (_.set-label @end)))) + (_.set_label @end)))) (def: (object::synchronized [monitorG exprG]) (Binary (Bytecode Any)) @@ -549,24 +549,24 @@ Handler (..custom [<s>.text - (function (_ extension-name generate archive [class]) + (function (_ extension_name generate archive [class]) (do //////.monad [] - (wrap ($_ _.compose - (_.string class) - (_.invokestatic ..$Class "forName" (type.method [(list ..$String) ..$Class (list)]))))))])) + (in ($_ _.compose + (_.string class) + (_.invokestatic ..$Class "forName" (type.method [(list ..$String) ..$Class (list)]))))))])) (def: object::instance? Handler (..custom [($_ <>.and <s>.text <s>.any) - (function (_ extension-name generate archive [class objectS]) + (function (_ extension_name generate archive [class objectS]) (do //////.monad [objectG (generate archive objectS)] - (wrap ($_ _.compose - objectG - (_.instanceof (type.class class (list))) - (_.invokestatic ..$Boolean "valueOf" (type.method [(list type.boolean) ..$Boolean (list)]))))))])) + (in ($_ _.compose + objectG + (_.instanceof (type.class class (list))) + (_.invokestatic ..$Boolean "valueOf" (type.method [(list type.boolean) ..$Boolean (list)]))))))])) (def: reflection (All [category] @@ -577,39 +577,39 @@ Handler (..custom [($_ <>.and <s>.text <s>.text <s>.any) - (function (_ extension-name generate archive [from to valueS]) + (function (_ extension_name generate archive [from to valueS]) (do //////.monad [valueG (generate archive valueS)] - (wrap (`` (cond (~~ (template [<object> <type> <unwrap>] - [(and (text\= (..reflection <type>) - from) - (text\= <object> - to)) - (let [$<object> (type.class <object> (list))] - ($_ _.compose - valueG - (_.invokestatic $<object> "valueOf" (type.method [(list <type>) $<object> (list)])))) - - (and (text\= <object> - from) - (text\= (..reflection <type>) - to)) - (let [$<object> (type.class <object> (list))] - ($_ _.compose - valueG - (_.checkcast $<object>) - (_.invokevirtual $<object> <unwrap> (type.method [(list) <type> (list)]))))] - - [box.boolean type.boolean "booleanValue"] - [box.byte type.byte "byteValue"] - [box.short type.short "shortValue"] - [box.int type.int "intValue"] - [box.long type.long "longValue"] - [box.float type.float "floatValue"] - [box.double type.double "doubleValue"] - [box.char type.char "charValue"])) - ## else - valueG)))))])) + (in (`` (cond (~~ (template [<object> <type> <unwrap>] + [(and (text\= (..reflection <type>) + from) + (text\= <object> + to)) + (let [$<object> (type.class <object> (list))] + ($_ _.compose + valueG + (_.invokestatic $<object> "valueOf" (type.method [(list <type>) $<object> (list)])))) + + (and (text\= <object> + from) + (text\= (..reflection <type>) + to)) + (let [$<object> (type.class <object> (list))] + ($_ _.compose + valueG + (_.checkcast $<object>) + (_.invokevirtual $<object> <unwrap> (type.method [(list) <type> (list)]))))] + + [box.boolean type.boolean "booleanValue"] + [box.byte type.byte "byteValue"] + [box.short type.short "shortValue"] + [box.int type.int "intValue"] + [box.long type.long "longValue"] + [box.float type.float "floatValue"] + [box.double type.double "doubleValue"] + [box.char type.char "charValue"])) + ## else + valueG)))))])) (def: bundle::object Bundle @@ -634,21 +634,21 @@ [(reflection.reflection reflection.float) type.float] [(reflection.reflection reflection.double) type.double] [(reflection.reflection reflection.char) type.char]) - (dictionary.from-list text.hash))) + (dictionary.from_list text.hash))) (def: get::static Handler (..custom [($_ <>.and <s>.text <s>.text <s>.text) - (function (_ extension-name generate archive [class field unboxed]) + (function (_ extension_name generate archive [class field unboxed]) (do //////.monad [#let [$class (type.class class (list))]] (case (dictionary.get unboxed ..primitives) (#.Some primitive) - (wrap (_.getstatic $class field primitive)) + (in (_.getstatic $class field primitive)) #.None - (wrap (_.getstatic $class field (type.class unboxed (list)))))))])) + (in (_.getstatic $class field (type.class unboxed (list)))))))])) (def: unitG (_.string //////synthesis.unit)) @@ -656,29 +656,29 @@ Handler (..custom [($_ <>.and <s>.text <s>.text <s>.text <s>.any) - (function (_ extension-name generate archive [class field unboxed valueS]) + (function (_ extension_name generate archive [class field unboxed valueS]) (do //////.monad [valueG (generate archive valueS) #let [$class (type.class class (list))]] (case (dictionary.get unboxed ..primitives) (#.Some primitive) - (wrap ($_ _.compose - valueG - (_.putstatic $class field primitive) - ..unitG)) + (in ($_ _.compose + valueG + (_.putstatic $class field primitive) + ..unitG)) #.None - (wrap ($_ _.compose - valueG - (_.checkcast $class) - (_.putstatic $class field $class) - ..unitG)))))])) + (in ($_ _.compose + valueG + (_.checkcast $class) + (_.putstatic $class field $class) + ..unitG)))))])) (def: get::virtual Handler (..custom [($_ <>.and <s>.text <s>.text <s>.text <s>.any) - (function (_ extension-name generate archive [class field unboxed objectS]) + (function (_ extension_name generate archive [class field unboxed objectS]) (do //////.monad [objectG (generate archive objectS) #let [$class (type.class class (list)) @@ -688,16 +688,16 @@ #.None (_.getfield $class field (type.class unboxed (list))))]] - (wrap ($_ _.compose - objectG - (_.checkcast $class) - getG))))])) + (in ($_ _.compose + objectG + (_.checkcast $class) + getG))))])) (def: put::virtual Handler (..custom [($_ <>.and <s>.text <s>.text <s>.text <s>.any <s>.any) - (function (_ extension-name generate archive [class field unboxed valueS objectS]) + (function (_ extension_name generate archive [class field unboxed valueS objectS]) (do //////.monad [valueG (generate archive valueS) objectG (generate archive objectS) @@ -711,12 +711,12 @@ ($_ _.compose (_.checkcast $unboxed) (_.putfield $class field $unboxed))))]] - (wrap ($_ _.compose - objectG - (_.checkcast $class) - _.dup - valueG - putG))))])) + (in ($_ _.compose + objectG + (_.checkcast $class) + _.dup + valueG + putG))))])) (type: Input (Typed Synthesis)) @@ -724,55 +724,55 @@ (Parser Input) (<s>.tuple (<>.and ..value <s>.any))) -(def: (generate-input generate archive [valueT valueS]) +(def: (generate_input generate archive [valueT valueS]) (-> Phase Archive Input (Operation (Typed (Bytecode Any)))) (do //////.monad [valueG (generate archive valueS)] (case (type.primitive? valueT) (#.Right valueT) - (wrap [valueT valueG]) + (in [valueT valueG]) (#.Left valueT) - (wrap [valueT ($_ _.compose - valueG - (_.checkcast valueT))])))) + (in [valueT ($_ _.compose + valueG + (_.checkcast valueT))])))) -(def: (prepare-output outputT) +(def: (prepare_output outputT) (-> (Type Return) (Bytecode Any)) (case (type.void? outputT) (#.Right outputT) ..unitG (#.Left outputT) - (\ _.monad wrap []))) + (\ _.monad in []))) (def: invoke::static Handler (..custom [($_ <>.and ..class <s>.text ..return (<>.some ..input)) - (function (_ extension-name generate archive [class method outputT inputsTS]) + (function (_ extension_name generate archive [class method outputT inputsTS]) (do {! //////.monad} - [inputsTG (monad.map ! (generate-input generate archive) inputsTS)] - (wrap ($_ _.compose - (monad.map _.monad product.right inputsTG) - (_.invokestatic class method (type.method [(list\map product.left inputsTG) outputT (list)])) - (prepare-output outputT)))))])) + [inputsTG (monad.map ! (generate_input generate archive) inputsTS)] + (in ($_ _.compose + (monad.map _.monad product.right inputsTG) + (_.invokestatic class method (type.method [(list\map product.left inputsTG) outputT (list)])) + (prepare_output outputT)))))])) (template [<name> <invoke>] [(def: <name> Handler (..custom [($_ <>.and ..class <s>.text ..return <s>.any (<>.some ..input)) - (function (_ extension-name generate archive [class method outputT objectS inputsTS]) + (function (_ extension_name generate archive [class method outputT objectS inputsTS]) (do {! //////.monad} [objectG (generate archive objectS) - inputsTG (monad.map ! (generate-input generate archive) inputsTS)] - (wrap ($_ _.compose - objectG - (_.checkcast class) - (monad.map _.monad product.right inputsTG) - (<invoke> class method (type.method [(list\map product.left inputsTG) outputT (list)])) - (prepare-output outputT)))))]))] + inputsTG (monad.map ! (generate_input generate archive) inputsTS)] + (in ($_ _.compose + objectG + (_.checkcast class) + (monad.map _.monad product.right inputsTG) + (<invoke> class method (type.method [(list\map product.left inputsTG) outputT (list)])) + (prepare_output outputT)))))]))] [invoke::virtual _.invokevirtual] [invoke::special _.invokespecial] @@ -783,14 +783,14 @@ Handler (..custom [($_ <>.and ..class (<>.some ..input)) - (function (_ extension-name generate archive [class inputsTS]) + (function (_ extension_name generate archive [class inputsTS]) (do {! //////.monad} - [inputsTG (monad.map ! (generate-input generate archive) inputsTS)] - (wrap ($_ _.compose - (_.new class) - _.dup - (monad.map _.monad product.right inputsTG) - (_.invokespecial class "<init>" (type.method [(list\map product.left inputsTG) type.void (list)]))))))])) + [inputsTG (monad.map ! (generate_input generate archive) inputsTS)] + (in ($_ _.compose + (_.new class) + _.dup + (monad.map _.monad product.right inputsTG) + (_.invokespecial class "<init>" (type.method [(list\map product.left inputsTG) type.void (list)]))))))])) (def: bundle::member Bundle @@ -813,40 +813,40 @@ (/////bundle.install "constructor" invoke::constructor)))) ))) -(def: annotation-parameter - (Parser (/.Annotation-Parameter Synthesis)) +(def: annotation_parameter + (Parser (/.Annotation_Parameter Synthesis)) (<s>.tuple (<>.and <s>.text <s>.any))) (def: annotation (Parser (/.Annotation Synthesis)) - (<s>.tuple (<>.and <s>.text (<>.some ..annotation-parameter)))) + (<s>.tuple (<>.and <s>.text (<>.some ..annotation_parameter)))) (def: argument (Parser Argument) (<s>.tuple (<>.and <s>.text ..value))) -(def: overriden-method-definition - (Parser [(Environment Synthesis) (/.Overriden-Method Synthesis)]) +(def: overriden_method_definition + (Parser [(Environment Synthesis) (/.Overriden_Method Synthesis)]) (<s>.tuple (do <>.monad - [_ (<s>.text! /.overriden-tag) + [_ (<s>.text! /.overriden_tag) ownerT ..class name <s>.text - strict-fp? <s>.bit + strict_fp? <s>.bit annotations (<s>.tuple (<>.some ..annotation)) vars (<s>.tuple (<>.some ..var)) - self-name <s>.text + self_name <s>.text arguments (<s>.tuple (<>.some ..argument)) returnT ..return exceptionsT (<s>.tuple (<>.some ..class)) [environment body] (<s>.function 1 (<s>.tuple <s>.any))] - (wrap [environment - [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT - body]])))) + (in [environment + [ownerT name + strict_fp? annotations vars + self_name arguments returnT exceptionsT + body]])))) -(def: (normalize-path normalize) +(def: (normalize_path normalize) (-> (-> Synthesis Synthesis) (-> Path Path)) (function (recur path) @@ -870,7 +870,7 @@ _ (undefined)))) -(def: (normalize-method-body mapping) +(def: (normalize_method_body mapping) (-> (Dictionary Variable Variable) Synthesis Synthesis) (function (recur body) (case body @@ -893,7 +893,7 @@ //////synthesis.variable) (^ (//////synthesis.branch/case [inputS pathS])) - (//////synthesis.branch/case [(recur inputS) (normalize-path recur pathS)]) + (//////synthesis.branch/case [(recur inputS) (normalize_path recur pathS)]) (^ (//////synthesis.branch/let [inputS register outputS])) (//////synthesis.branch/let [(recur inputS) register (recur outputS)]) @@ -933,40 +933,40 @@ (def: $Object (type.class "java.lang.Object" (list))) -(def: (anonymous-init-method env) +(def: (anonymous_init_method env) (-> (Environment Synthesis) (Type category.Method)) (type.method [(list.repeat (list.size env) ..$Object) type.void (list)])) -(def: (with-anonymous-init class env super-class inputsTG) +(def: (with_anonymous_init class env super_class inputsTG) (-> (Type category.Class) (Environment Synthesis) (Type category.Class) (List (Typed (Bytecode Any))) (Resource Method)) - (let [store-capturedG (|> env + (let [store_capturedG (|> env list.size list.indices (monad.map _.monad (.function (_ register) ($_ _.compose (_.aload 0) (_.aload (inc register)) - (_.putfield class (///reference.foreign-name register) $Object)))))] - (method.method method.public "<init>" (anonymous-init-method env) + (_.putfield class (///reference.foreign_name register) $Object)))))] + (method.method method.public "<init>" (anonymous_init_method env) (list) (#.Some ($_ _.compose (_.aload 0) (monad.map _.monad product.right inputsTG) - (_.invokespecial super-class "<init>" (type.method [(list\map product.left inputsTG) type.void (list)])) - store-capturedG + (_.invokespecial super_class "<init>" (type.method [(list\map product.left inputsTG) type.void (list)])) + store_capturedG _.return))))) -(def: (anonymous-instance generate archive class env) +(def: (anonymous_instance generate archive class env) (-> Phase Archive (Type category.Class) (Environment Synthesis) (Operation (Bytecode Any))) (do {! //////.monad} [captureG+ (monad.map ! (generate archive) env)] - (wrap ($_ _.compose - (_.new class) - _.dup - (monad.seq _.monad captureG+) - (_.invokespecial class "<init>" (anonymous-init-method env)))))) + (in ($_ _.compose + (_.new class) + _.dup + (monad.seq _.monad captureG+) + (_.invokespecial class "<init>" (anonymous_init_method env)))))) (def: (returnG returnT) (-> (Type Return) (Bytecode Any)) @@ -1005,83 +1005,83 @@ ..class (<s>.tuple (<>.some ..class)) (<s>.tuple (<>.some ..input)) - (<s>.tuple (<>.some ..overriden-method-definition))) - (function (_ extension-name generate archive [super-class super-interfaces + (<s>.tuple (<>.some ..overriden_method_definition))) + (function (_ extension_name generate archive [super_class super_interfaces inputsTS - overriden-methods]) + overriden_methods]) (do {! //////.monad} - [[context _] (//////generation.with-new-context archive (wrap [])) - #let [[module-id artifact-id] context - anonymous-class-name (///runtime.class-name context) - class (type.class anonymous-class-name (list)) - total-environment (|> overriden-methods + [[context _] (//////generation.with_new_context archive (in [])) + #let [[module_id artifact_id] context + anonymous_class_name (///runtime.class_name context) + class (type.class anonymous_class_name (list)) + total_environment (|> overriden_methods ## Get all the environments. (list\map product.left) ## Combine them. list\join ## Remove duplicates. - (set.from-list //////synthesis.hash) + (set.from_list //////synthesis.hash) set.to_list) - global-mapping (|> total-environment + global_mapping (|> total_environment ## Give them names as "foreign" variables. list.enumeration (list\map (function (_ [id capture]) [capture (#//////variable.Foreign id)])) - (dictionary.from-list //////variable.hash)) - normalized-methods (list\map (function (_ [environment + (dictionary.from_list //////variable.hash)) + normalized_methods (list\map (function (_ [environment [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT + strict_fp? annotations vars + self_name arguments returnT exceptionsT body]]) - (let [local-mapping (|> environment + (let [local_mapping (|> environment list.enumeration - (list\map (function (_ [foreign-id capture]) - [(#//////variable.Foreign foreign-id) - (|> global-mapping + (list\map (function (_ [foreign_id capture]) + [(#//////variable.Foreign foreign_id) + (|> global_mapping (dictionary.get capture) maybe.assume)])) - (dictionary.from-list //////variable.hash))] + (dictionary.from_list //////variable.hash))] [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT - (normalize-method-body local-mapping body)])) - overriden-methods)] - inputsTI (monad.map ! (generate-input generate archive) inputsTS) - method-definitions (monad.map ! (function (_ [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT + strict_fp? annotations vars + self_name arguments returnT exceptionsT + (normalize_method_body local_mapping body)])) + overriden_methods)] + inputsTI (monad.map ! (generate_input generate archive) inputsTS) + method_definitions (monad.map ! (function (_ [ownerT name + strict_fp? annotations vars + self_name arguments returnT exceptionsT bodyS]) (do ! - [bodyG (//////generation.with-context artifact-id - (generate archive bodyS))] - (wrap (method.method ($_ modifier\compose - method.public - method.final - (if strict-fp? - method.strict - modifier\identity)) - name - (type.method [(list\map product.right arguments) - returnT - exceptionsT]) - (list) - (#.Some ($_ _.compose - bodyG - (returnG returnT))))))) - normalized-methods) + [bodyG (//////generation.with_context artifact_id + (generate archive bodyS))] + (in (method.method ($_ modifier\compose + method.public + method.final + (if strict_fp? + method.strict + modifier\identity)) + name + (type.method [(list\map product.right arguments) + returnT + exceptionsT]) + (list) + (#.Some ($_ _.compose + bodyG + (returnG returnT))))))) + normalized_methods) bytecode (<| (\ ! map (format.run class.writer)) //////.lift (class.class version.v6_0 ($_ modifier\compose class.public class.final) - (name.internal anonymous-class-name) - (name.internal (..reflection super-class)) - (list\map (|>> ..reflection name.internal) super-interfaces) - (foreign.variables total-environment) - (list& (..with-anonymous-init class total-environment super-class inputsTI) - method-definitions) + (name.internal anonymous_class_name) + (name.internal (..reflection super_class)) + (list\map (|>> ..reflection name.internal) super_interfaces) + (foreign.variables total_environment) + (list& (..with_anonymous_init class total_environment super_class inputsTI) + method_definitions) (row.row))) - _ (//////generation.execute! [anonymous-class-name bytecode]) - _ (//////generation.save! (%.nat artifact-id) [anonymous-class-name bytecode])] - (anonymous-instance generate archive class total-environment)))])) + _ (//////generation.execute! [anonymous_class_name bytecode]) + _ (//////generation.save! (%.nat artifact_id) [anonymous_class_name bytecode])] + (anonymous_instance generate archive class total_environment)))])) (def: bundle::class Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux index b31bf5610..e8022f806 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux @@ -46,7 +46,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) (|>> list _.apply/* (|> (_.var function)))) @@ -68,21 +68,21 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch)] - (wrap [(|> chars - (list\map (|>> .int _.int (_.= @input))) - (list\fold (function (_ clause total) - (if (is? _.nil total) - clause - (_.or clause total))) - _.nil)) - branchG]))) + (in [(|> chars + (list\map (|>> .int _.int (_.= @input))) + (list\fold (function (_ clause total) + (if (is? _.nil total) + clause + (_.or clause total))) + _.nil)) + branchG]))) conditionals)) #let [closure (_.closure (list @input) (list\fold (function (_ [test then] else) (_.if test (_.return then) else)) (_.return elseG) conditionalsG))]] - (wrap (_.apply/1 closure inputG))))])) + (in (_.apply/1 closure inputG))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux index 1bb7d771c..35d895177 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux @@ -71,7 +71,7 @@ (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] - (wrap (_.the fieldS objectG))))])) + (in (_.the fieldS objectG))))])) (def: object::do Handler @@ -81,7 +81,7 @@ (do {! ////////phase.monad} [objectG (phase archive objectS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.do methodS inputsG objectG))))])) + (in (_.do methodS inputsG objectG))))])) (template [<!> <?> <unit>] [(def: <!> (Nullary Expression) (function.constant <unit>)) @@ -109,11 +109,11 @@ (function (_ extension phase archive inputS) (do {! ////////phase.monad} [inputG (phase archive inputS)] - (wrap (_.apply/1 (<| (_.closure (list $input)) - (_.return (|> (_.var "string.byte") - (_.apply/* (list $input (_.int +1) (_.length $input))) - (_.apply/1 (_.var "table.pack"))))) - inputG))))])) + (in (_.apply/1 (<| (_.closure (list $input)) + (_.return (|> (_.var "string.byte") + (_.apply/* (list $input (_.int +1) (_.length $input))) + (_.apply/1 (_.var "table.pack"))))) + inputG))))])) (def: utf8::decode (custom @@ -121,9 +121,9 @@ (function (_ extension phase archive inputS) (do {! ////////phase.monad} [inputG (phase archive inputS)] - (wrap (|> inputG - (_.apply/1 (_.var "table.unpack")) - (_.apply/1 (_.var "string.char"))))))])) + (in (|> inputG + (_.apply/1 (_.var "table.unpack")) + (_.apply/1 (_.var "string.char"))))))])) (def: utf8 Bundle @@ -137,7 +137,7 @@ (custom [<s>.text (function (_ extension phase archive name) - (\ ////////phase.monad wrap (_.var name)))])) + (\ ////////phase.monad in (_.var name)))])) (def: lua::apply (custom @@ -146,7 +146,7 @@ (do {! ////////phase.monad} [abstractionG (phase archive abstractionS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.apply/* inputsG abstractionG))))])) + (in (_.apply/* inputsG abstractionG))))])) (def: lua::power (custom @@ -155,13 +155,13 @@ (do {! ////////phase.monad} [powerG (phase archive powerS) baseG (phase archive baseS)] - (wrap (_.^ powerG baseG))))])) + (in (_.^ powerG baseG))))])) (def: lua::import (custom [<s>.text (function (_ extension phase archive module) - (\ ////////phase.monad wrap + (\ ////////phase.monad in (_.require/1 (_.string module))))])) (def: lua::function @@ -176,12 +176,12 @@ g!inputs (monad.map ! (function (_ _) (variable "input")) (list.repeat (.nat arity) []))] - (wrap (<| (_.closure g!inputs) - _.statement - (case (.nat arity) - 0 (_.apply/1 abstractionG //runtime.unit) - 1 (_.apply/* g!inputs abstractionG) - _ (_.apply/1 abstractionG (_.array g!inputs)))))))])) + (in (<| (_.closure g!inputs) + _.statement + (case (.nat arity) + 0 (_.apply/1 abstractionG //runtime.unit) + 1 (_.apply/* g!inputs abstractionG) + _ (_.apply/1 abstractionG (_.array g!inputs)))))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index aa07cbe9f..519ed6563 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -49,7 +49,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) (|>> list _.apply/* (|> (_.constant function)))) @@ -72,14 +72,14 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch)] - (wrap [(|> chars - (list\map (|>> .int _.int (_.=== @input))) - (list\fold (function (_ clause total) - (if (is? _.null total) - clause - (_.or clause total))) - _.null)) - branchG]))) + (in [(|> chars + (list\map (|>> .int _.int (_.=== @input))) + (list\fold (function (_ clause total) + (if (is? _.null total) + clause + (_.or clause total))) + _.null)) + branchG]))) conditionals)) #let [foreigns (|> conditionals (list\map (|>> product.right synthesis.path/then //case.dependencies)) @@ -95,7 +95,7 @@ conditionalsG))] _ (generation.execute! directive) _ (generation.save! context_artifact directive)] - (wrap (_.apply/* (list& inputG foreigns) @expression))))])) + (in (_.apply/* (list& inputG foreigns) @expression))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux index ab01b5938..a8ef44fc8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux @@ -66,7 +66,7 @@ (function (_ extension phase archive [constructor inputsS]) (do {! ////////phase.monad} [inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.new (_.constant constructor) inputsG))))])) + (in (_.new (_.constant constructor) inputsG))))])) (def: object::get Handler @@ -75,7 +75,7 @@ (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] - (wrap (_.the fieldS objectG))))])) + (in (_.the fieldS objectG))))])) (def: object::do Handler @@ -85,7 +85,7 @@ (do {! ////////phase.monad} [objectG (phase archive objectS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.do methodS inputsG objectG))))])) + (in (_.do methodS inputsG objectG))))])) (template [<!> <?> <unit>] [(def: <!> (Nullary Expression) (function.constant <unit>)) @@ -109,7 +109,7 @@ (custom [<s>.text (function (_ extension phase archive name) - (\ ////////phase.monad wrap (_.constant name)))])) + (\ ////////phase.monad in (_.constant name)))])) (def: php::apply (custom @@ -118,7 +118,7 @@ (do {! ////////phase.monad} [abstractionG (phase archive abstractionS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.apply/* inputsG abstractionG))))])) + (in (_.apply/* inputsG abstractionG))))])) (def: php::pack (custom @@ -127,7 +127,7 @@ (do {! ////////phase.monad} [formatG (phase archive formatS) dataG (phase archive dataS)] - (wrap (_.pack/2 [formatG (_.splat dataG)]))))])) + (in (_.pack/2 [formatG (_.splat dataG)]))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux index da9ab4a4b..d9c7fe72f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux @@ -46,7 +46,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ## TODO: Get rid of this ASAP (def: lux::syntax_char_case! @@ -66,21 +66,21 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch)] - (wrap [(|> chars - (list\map (|>> .int _.int (_.= @input))) - (list\fold (function (_ clause total) - (if (is? _.none total) - clause - (_.or clause total))) - _.none)) - branchG]))) + (in [(|> chars + (list\map (|>> .int _.int (_.= @input))) + (list\fold (function (_ clause total) + (if (is? _.none total) + clause + (_.or clause total))) + _.none)) + branchG]))) conditionals)) #let [closure (_.lambda (list @input) (list\fold (function (_ [test then] else) (_.? test then else)) elseG conditionalsG))]] - (wrap (_.apply/* closure (list inputG)))))])) + (in (_.apply/* closure (list inputG)))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux index 6612cda07..a9215898d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux @@ -70,7 +70,7 @@ (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] - (wrap (_.the fieldS objectG))))])) + (in (_.the fieldS objectG))))])) (def: object::do Handler @@ -80,7 +80,7 @@ (do {! ////////phase.monad} [objectG (phase archive objectS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.do methodS inputsG objectG))))])) + (in (_.do methodS inputsG objectG))))])) (template [<!> <?> <unit>] [(def: <!> (Nullary (Expression Any)) (function.constant <unit>)) @@ -105,7 +105,7 @@ (function (_ extension phase archive name) (do ////////phase.monad [] - (wrap (_.var name))))])) + (in (_.var name))))])) (def: python::import (custom @@ -113,7 +113,7 @@ (function (_ extension phase archive module) (do ////////phase.monad [] - (wrap (_.apply/* (_.var "__import__") (list (_.string module))))))])) + (in (_.apply/* (_.var "__import__") (list (_.string module))))))])) (def: python::apply (custom @@ -122,7 +122,7 @@ (do {! ////////phase.monad} [abstractionG (phase archive abstractionS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.apply/* abstractionG inputsG))))])) + (in (_.apply/* abstractionG inputsG))))])) (def: python::function (custom @@ -135,11 +135,11 @@ (\ ! map _.var)))] g!inputs (monad.map ! (function (_ _) (variable "input")) (list.repeat (.nat arity) []))] - (wrap (_.lambda g!inputs - (case (.nat arity) - 0 (_.apply/1 abstractionG //runtime.unit) - 1 (_.apply/* abstractionG g!inputs) - _ (_.apply/1 abstractionG (_.list g!inputs)))))))])) + (in (_.lambda g!inputs + (case (.nat arity) + 0 (_.apply/1 abstractionG //runtime.unit) + 1 (_.apply/* abstractionG g!inputs) + _ (_.apply/1 abstractionG (_.list g!inputs)))))))])) (def: python::exec (custom @@ -148,7 +148,7 @@ (do {! ////////phase.monad} [codeG (phase archive codeS) globalsG (phase archive globalsS)] - (wrap (//runtime.lux::exec codeG globalsG))))])) + (in (//runtime.lux::exec codeG globalsG))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux index 36238f9e3..9f43c5f28 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux @@ -49,7 +49,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ## (template: (!unary function) ## (|>> list _.apply/* (|> (_.constant function)))) @@ -71,10 +71,10 @@ ## ## (monad.map ! (function (_ [chars branch]) ## ## (do ! ## ## [branchG (phase archive branch)] -## ## (wrap [(|> chars (list\map (|>> .int _.int (_.=/2 @input))) _.or) +## ## (in [(|> chars (list\map (|>> .int _.int (_.=/2 @input))) _.or) ## ## branchG]))) ## ## conditionals))] -## ## (wrap (_.let (list [@input inputG]) +## ## (in (_.let (list [@input inputG]) ## ## (list (list\fold (function (_ [test then] else) ## ## (_.if test then else)) ## ## elseG diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux index 4f2cd3291..970566967 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux @@ -46,7 +46,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ## TODO: Get rid of this ASAP (def: lux::syntax_char_case! @@ -65,21 +65,21 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch)] - (wrap [(|> chars - (list\map (|>> .int _.int (_.= @input))) - (list\fold (function (_ clause total) - (if (is? _.nil total) - clause - (_.or clause total))) - _.nil)) - branchG]))) + (in [(|> chars + (list\map (|>> .int _.int (_.= @input))) + (list\fold (function (_ clause total) + (if (is? _.nil total) + clause + (_.or clause total))) + _.nil)) + branchG]))) conditionals)) #let [closure (_.lambda #.None (list @input) (list\fold (function (_ [test then] else) (_.if test (_.return then) else)) (_.return elseG) conditionalsG))]] - (wrap (_.apply_lambda/* (list inputG) closure))))])) + (in (_.apply_lambda/* (list inputG) closure))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux index 6f538b8dd..0d0f94f50 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux @@ -71,7 +71,7 @@ (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] - (wrap (_.the fieldS objectG))))])) + (in (_.the fieldS objectG))))])) (def: object::do Handler @@ -81,7 +81,7 @@ (do {! ////////phase.monad} [objectG (phase archive objectS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.do methodS inputsG objectG))))])) + (in (_.do methodS inputsG objectG))))])) (template [<!> <?> <unit>] [(def: <!> (Nullary Expression) (function.constant <unit>)) @@ -104,7 +104,7 @@ (custom [<s>.text (function (_ extension phase archive name) - (\ ////////phase.monad wrap (_.local name)))])) + (\ ////////phase.monad in (_.local name)))])) (def: ruby::apply (custom @@ -113,13 +113,13 @@ (do {! ////////phase.monad} [abstractionG (phase archive abstractionS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.apply/* inputsG abstractionG))))])) + (in (_.apply/* inputsG abstractionG))))])) (def: ruby::import (custom [<s>.text (function (_ extension phase archive module) - (\ ////////phase.monad wrap + (\ ////////phase.monad in (_.require/1 (_.string module))))])) (def: #export bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux index 17df72ac2..2025fe4e2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux @@ -49,7 +49,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (/////.throw extension.invalid_syntax [extension_name %synthesis input])))) + (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) (|>> list _.apply/* (|> (_.constant function)))) @@ -71,14 +71,14 @@ (monad.map ! (function (_ [chars branch]) (do ! [branchG (phase archive branch)] - (wrap [(|> chars (list\map (|>> .int _.int (_.=/2 @input))) _.or) - branchG]))) + (in [(|> chars (list\map (|>> .int _.int (_.=/2 @input))) _.or) + branchG]))) conditionals))] - (wrap (_.let (list [@input inputG]) - (list\fold (function (_ [test then] else) - (_.if test then else)) - elseG - conditionalsG)))))])) + (in (_.let (list [@input inputG]) + (list\fold (function (_ [test then] else) + (_.if test then else)) + elseG + conditionalsG)))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux index e67e05db4..33a9624c3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux @@ -85,7 +85,7 @@ (function (_ extension phase archive name) (do ////////phase.monad [] - (wrap (_.var name))))])) + (in (_.var name))))])) (def: scheme::apply (custom @@ -94,7 +94,7 @@ (do {! ////////phase.monad} [abstractionG (phase archive abstractionS) inputsG (monad.map ! (phase archive) inputsS)] - (wrap (_.apply/* inputsG abstractionG))))])) + (in (_.apply/* inputsG abstractionG))))])) (def: #export bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux index 972e318c2..c7ef94ce9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux @@ -28,7 +28,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux index 2425e2cb4..45e2a3bba 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux @@ -48,8 +48,8 @@ (do ///////phase.monad [valueG (expression archive valueS) bodyG (expression archive bodyS)] - (wrap (_.let (list [(..register register) valueG]) - (list bodyG))))) + (in (_.let (list [(..register register) valueG]) + (list bodyG))))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -57,22 +57,22 @@ [testG (expression archive testS) thenG (expression archive thenS) elseG (expression archive elseS)] - (wrap (_.if testG thenG elseG)))) + (in (_.if testG thenG elseG)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueG (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] - (method source))) - valueG - pathP)))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple//left] + [#.Right //runtime.tuple//right]))] + (method source))) + valueG + pathP)))) (def: @savepoint (_.var "lux_pm_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) @@ -148,10 +148,10 @@ (expression archive bodyS)) #/////synthesis.Pop - (///////phase\wrap ..pop!) + (///////phase\in ..pop!) (#/////synthesis.Bind register) - (///////phase\wrap (_.setq (..register register) ..peek)) + (///////phase\in (_.setq (..register register) ..peek)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -161,14 +161,14 @@ (recur [$output @done @fail elseP]) #.None - (wrap (_.go @fail)))] - (wrap (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!)))) + (in (_.go @fail)))] + (in (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!)))) (^template [<tag> <format> <=>] [(<tag> cons) @@ -176,21 +176,21 @@ [clauses (monad.map ! (function (_ [match then]) (do ! [then! (recur [$output @done @fail then])] - (wrap [(<=> [(|> match <format>) - ..peek]) - then!]))) + (in [(<=> [(|> match <format>) + ..peek]) + then!]))) (#.Cons cons))] - (wrap (list\fold (function (_ [when then] else) - (_.if when then else)) - (_.go @fail) - clauses)))]) + (in (list\fold (function (_ [when then] else) + (_.if when then else)) + (_.go @fail) + clauses)))]) ([#/////synthesis.I64_Fork //primitive.i64 _.=/2] [#/////synthesis.F64_Fork //primitive.f64 _.=/2] [#/////synthesis.Text_Fork //primitive.text _.string=/2]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) - (///////phase\wrap (<choice> @fail false idx #.None)) + (///////phase\in (<choice> @fail false idx #.None)) (^ (<simple> idx nextP)) (|> nextP @@ -200,11 +200,11 @@ [/////synthesis.side/right /////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (..push! (_.elt/2 [..peek (_.int +0)]))) + (///////phase\in (..push! (_.elt/2 [..peek (_.int +0)]))) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) @@ -212,21 +212,21 @@ (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)] (do ///////phase.monad [next! (recur [$output @done @fail nextP'])] - (///////phase\wrap (_.progn (list (..multi_pop! (n.+ 2 extra_pops)) - next!))))) + (///////phase\in (_.progn (list (..multi_pop! (n.+ 2 extra_pops)) + next!))))) (^ (/////synthesis.path/alt preP postP)) (do {! ///////phase.monad} [@otherwise (\ ! map (|>> %.nat (format "lux_case_otherwise") _.tag) /////generation.next) pre! (recur [$output @done @otherwise preP]) post! (recur [$output @done @fail postP])] - (wrap (..alternation @otherwise pre! post!))) + (in (..alternation @otherwise pre! post!))) (^ (/////synthesis.path/seq preP postP)) (do ///////phase.monad [pre! (recur [$output @done @fail preP]) post! (recur [$output @done @fail postP])] - (wrap (_.progn (list pre! post!))))))) + (in (_.progn (list pre! post!))))))) (def: (pattern_matching $output expression archive pathP) (-> Var/1 (Generator Path)) @@ -234,11 +234,11 @@ [@done (\ ! map (|>> %.nat (format "lux_case_done") _.tag) /////generation.next) @fail (\ ! map (|>> %.nat (format "lux_case_fail") _.tag) /////generation.next) pattern_matching! (pattern_matching' expression archive [$output @done @fail pathP])] - (wrap (_.tagbody - (list pattern_matching! - @fail - (_.error/1 (_.string ////synthesis/case.pattern_matching_error)) - @done))))) + (in (_.tagbody + (list pattern_matching! + @fail + (_.error/1 (_.string ////synthesis/case.pattern_matching_error)) + @done))))) (def: #export (case expression archive [valueS pathP]) (Generator [Synthesis Path]) @@ -253,10 +253,10 @@ (list\map (function (_ register) [(..register register) _.nil])))]] - (wrap (_.let (list& [@cursor (_.list/* (list initG))] - [@savepoint (_.list/* (list))] - [@temp _.nil] - [$output _.nil] - storage) - (list pattern_matching! - $output))))) + (in (_.let (list& [@cursor (_.list/* (list initG))] + [@savepoint (_.list/* (list))] + [@temp _.nil] + [$output _.nil] + storage) + (list pattern_matching! + $output))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux index 6adc2d747..a43c24bc8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux @@ -34,7 +34,7 @@ (do {! ///////phase.monad} [functionG (expression archive functionS) argsG+ (monad.map ! (expression archive) argsS+)] - (wrap (_.funcall/+ [functionG argsG+])))) + (in (_.funcall/+ [functionG argsG+])))) (def: capture (-> Register Var/1) @@ -44,16 +44,16 @@ (-> (List (Expression Any)) (Expression Any) (Operation (Expression Any))) (case inits #.Nil - (\ ///////phase.monad wrap function_definition) + (\ ///////phase.monad in function_definition) _ (do {! ///////phase.monad} [@closure (\ ! map _.var (/////generation.gensym "closure"))] - (wrap (_.labels (list [@closure [(|> (list.enumeration inits) - (list\map (|>> product.left ..capture)) - _.args) - function_definition]]) - (_.funcall/+ [(_.function/1 @closure) inits])))))) + (in (_.labels (list [@closure [(|> (list.enumeration inits) + (list\map (|>> product.left ..capture)) + _.args) + function_definition]]) + (_.funcall/+ [(_.function/1 @closure) inits])))))) (def: input (|>> inc //case.register)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux index bfe5e2787..5d7faa8f8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux @@ -47,15 +47,15 @@ initsG+ (monad.map ! (expression archive) initsS+) bodyG (/////generation.with_anchor [@scope start] (expression archive bodyS))] - (wrap (_.let (|> initsG+ - list.enumeration - (list\map (function (_ [idx init]) - [(|> idx (n.+ start) //case.register) - init])) - (list& [@output _.nil])) - (list (_.tagbody (list @scope - (_.setq @output bodyG))) - @output)))))) + (in (_.let (|> initsG+ + list.enumeration + (list\map (function (_ [idx init]) + [(|> idx (n.+ start) //case.register) + init])) + (list& [@output _.nil])) + (list (_.tagbody (list @scope + (_.setq @output bodyG))) + @output)))))) (def: #export (recur expression archive argsS+) (Generator (List Synthesis)) @@ -66,5 +66,5 @@ list.enumeration (list\map (|>> product.left (n.+ offset) //case.register)) _.args)]] - (wrap (_.progn (list (_.multiple-value-setq bindings (_.values/* argsO+)) - (_.go tag)))))) + (in (_.progn (list (_.multiple-value-setq bindings (_.values/* argsO+)) + (_.go tag)))))) 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 4febcca3c..b9b97fdbe 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 @@ -91,13 +91,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (syntax: (runtime: {declaration (<>.or <code>.local_identifier (<code>.form (<>.and <code>.local_identifier @@ -112,13 +112,13 @@ (#.Left name) (let [g!name (code.local_identifier name) code_nameC (code.local_identifier (format "@" name))] - (wrap (list (` (def: #export (~ g!name) - _.Var/1 - (~ runtime_name))) - - (` (def: (~ code_nameC) - (_.Expression Any) - (_.defparameter (~ runtime_name) (~ code))))))) + (in (list (` (def: #export (~ g!name) + _.Var/1 + (~ runtime_name))) + + (` (def: (~ code_nameC) + (_.Expression Any) + (_.defparameter (~ runtime_name) (~ code))))))) (#.Right [name inputs]) (let [g!name (code.local_identifier name) @@ -127,15 +127,15 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` (_.Expression Any))) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) (_.Computation Any)) - (_.call/* (~ runtime_name) (list (~+ inputsC))))) - - (` (def: (~ code_nameC) - (_.Expression Any) - (..with_vars [(~+ inputsC)] - (_.defun (~ runtime_name) (_.args (list (~+ inputsC))) - (~ code))))))))))))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) (_.Computation Any)) + (_.call/* (~ runtime_name) (list (~+ inputsC))))) + + (` (def: (~ code_nameC) + (_.Expression Any) + (..with_vars [(~+ inputsC)] + (_.defun (~ runtime_name) (_.args (list (~+ inputsC))) + (~ code))))))))))))) (runtime: (lux//try op) (with_vars [error] @@ -284,10 +284,10 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! (%.nat ..module_id) ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [(%.nat ..module_id) - (|> ..runtime - _.code - (\ encoding.utf8 encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [(%.nat ..module_id) + (|> ..runtime + _.code + (\ encoding.utf8 encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux index 44bd542f6..6cfd16cc4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux @@ -18,7 +18,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (expression archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux index 5196c6e33..7c50630d7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux @@ -22,7 +22,7 @@ ["#" phase]]]]) (syntax: (Vector {size s.nat} elemT) - (wrap (list (` [(~+ (list.repeat size elemT))])))) + (in (list (` [(~+ (list.repeat size elemT))])))) (type: #export (Nullary of) (-> (Vector 0 of) of)) (type: #export (Unary of) (-> (Vector 1 of) of)) @@ -34,22 +34,22 @@ (with_gensyms [g!_ g!extension g!name g!phase g!archive g!inputs g!of g!anchor g!expression g!directive] (do {! meta.monad} [g!input+ (monad.seq ! (list.repeat arity (macro.gensym "input")))] - (wrap (list (` (def: #export ((~ (code.local_identifier name)) (~ g!extension)) - (All [(~ g!anchor) (~ g!expression) (~ g!directive)] - (-> ((~ type) (~ g!expression)) - (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive)))) - (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs)) - (case (~ g!inputs) - (^ (list (~+ g!input+))) - (do ///.monad - [(~+ (|> g!input+ - (list\map (function (_ g!input) - (list g!input (` ((~ g!phase) (~ g!archive) (~ g!input)))))) - list.concat))] - ((~' wrap) ((~ g!extension) [(~+ g!input+)]))) + (in (list (` (def: #export ((~ (code.local_identifier name)) (~ g!extension)) + (All [(~ g!anchor) (~ g!expression) (~ g!directive)] + (-> ((~ type) (~ g!expression)) + (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive)))) + (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs)) + (case (~ g!inputs) + (^ (list (~+ g!input+))) + (do ///.monad + [(~+ (|> g!input+ + (list\map (function (_ g!input) + (list g!input (` ((~ g!phase) (~ g!archive) (~ g!input)))))) + list.concat))] + ((~' in) ((~ g!extension) [(~+ g!input+)]))) - (~' _) - (///.throw ///extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) + (~' _) + (///.except ///extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) (arity: 0 nullary ..Nullary) (arity: 1 unary ..Unary) @@ -63,4 +63,4 @@ (function (_ phase archive inputsS) (do {! ///.monad} [inputsI (monad.map ! (phase archive) inputsS)] - (wrap (extension inputsI)))))) + (in (extension inputsI)))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux index 18319d0a2..20a26e9cb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux @@ -70,7 +70,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([synthesis.bit /primitive.bit] [synthesis.i64 /primitive.i64] [synthesis.f64 /primitive.f64] @@ -101,7 +101,7 @@ (/loop.scope ..statement expression archive scope) (^ (synthesis.loop/recur updates)) - (//////phase.throw ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot-recur-as-an-expression []) (^ (synthesis.function/abstraction abstraction)) (/function.function ..statement expression archive abstraction) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index 76da7c8f1..8c0ef681a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -41,18 +41,18 @@ [valueO (expression archive valueS) bodyO (expression archive bodyS)] ## TODO: Find some way to do 'let' without paying the price of the closure. - (wrap (_.apply/* (_.closure (list (..register register)) - (_.return bodyO)) - (list valueO))))) + (in (_.apply/* (_.closure (list (..register register)) + (_.return bodyO)) + (list valueO))))) (def: #export (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (wrap ($_ _.then - (_.define (..register register) valueO) - bodyO)))) + (in ($_ _.then + (_.define (..register register) valueO) + bodyO)))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -60,7 +60,7 @@ [testO (expression archive testS) thenO (expression archive thenS) elseO (expression archive elseS)] - (wrap (_.? testO thenO elseO)))) + (in (_.? testO thenO elseO)))) (def: #export (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) @@ -68,24 +68,24 @@ [testO (expression archive testS) thenO (statement expression archive thenS) elseO (statement expression archive elseS)] - (wrap (_.if testO - thenO - elseO)))) + (in (_.if testO + thenO + elseO)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.i32 (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] - (method source))) - valueO - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.i32 (.int lefts)))]) + ([#.Left //runtime.tuple//left] + [#.Right //runtime.tuple//right]))] + (method source))) + valueO + (list.reverse pathP))))) (def: @savepoint (_.var "lux_pm_cursor_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) @@ -170,7 +170,7 @@ [/////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (#.Some (push_cursor! (_.at (_.i32 +0) ..peek_cursor)))) + (///////phase\in (#.Some (push_cursor! (_.at (_.i32 +0) ..peek_cursor)))) ## Extra optimization (^ (/////synthesis.path/seq @@ -178,9 +178,9 @@ (/////synthesis.!bind_top register thenP))) (do ///////phase.monad [then! (recur thenP)] - (wrap (#.Some ($_ _.then - (_.define (..register register) (_.at (_.i32 +0) ..peek_cursor)) - then!)))) + (in (#.Some ($_ _.then + (_.define (..register register) (_.at (_.i32 +0) ..peek_cursor)) + then!)))) ## Extra optimization (^template [<pm> <getter>] @@ -189,29 +189,29 @@ (/////synthesis.!bind_top register thenP))) (do ///////phase.monad [then! (recur thenP)] - (wrap (#.Some ($_ _.then - (_.define (..register register) (<getter> (_.i32 (.int lefts)) ..peek_cursor)) - then!))))]) + (in (#.Some ($_ _.then + (_.define (..register register) (<getter> (_.i32 (.int lefts)) ..peek_cursor)) + then!))))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) (^ (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (recur thenP)] - (wrap (#.Some ($_ _.then - (_.define (..register register) ..peek_and_pop_cursor) - then!)))) + (in (#.Some ($_ _.then + (_.define (..register register) ..peek_and_pop_cursor) + then!)))) (^ (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)] (do ///////phase.monad [next! (recur nextP')] - (wrap (#.Some ($_ _.then - (multi_pop_cursor! (n.+ 2 extra_pops)) - next!))))) + (in (#.Some ($_ _.then + (multi_pop_cursor! (n.+ 2 extra_pops)) + next!))))) _ - (///////phase\wrap #.None))) + (///////phase\in #.None))) (def: (pattern_matching' statement expression archive) (-> Phase! Phase Archive @@ -221,7 +221,7 @@ [outcome (optimized_pattern_matching recur pathP)] (.case outcome (#.Some outcome) - (wrap outcome) + (in outcome) #.None (.case pathP @@ -229,10 +229,10 @@ (statement expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap pop_cursor!) + (///////phase\in pop_cursor!) (#/////synthesis.Bind register) - (///////phase\wrap (_.define (..register register) ..peek_cursor)) + (///////phase\in (_.define (..register register) ..peek_cursor)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -242,25 +242,25 @@ (recur elseP) #.None - (wrap ..fail_pm!))] - (wrap (.if when - (_.if ..peek_cursor - then! - else!) - (_.if ..peek_cursor - else! - then!)))) + (in ..fail_pm!))] + (in (.if when + (_.if ..peek_cursor + then! + else!) + (_.if ..peek_cursor + else! + then!)))) (#/////synthesis.I64_Fork cons) (do {! ///////phase.monad} [clauses (monad.map ! (function (_ [match then]) (do ! [then! (recur then)] - (wrap [(//runtime.i64//= (//primitive.i64 (.int match)) - ..peek_cursor) - then!]))) + (in [(//runtime.i64//= (//primitive.i64 (.int match)) + ..peek_cursor) + then!]))) (#.Cons cons))] - (wrap (_.cond clauses ..fail_pm!))) + (in (_.cond clauses ..fail_pm!))) (^template [<tag> <format>] [(<tag> cons) @@ -268,21 +268,21 @@ [cases (monad.map ! (function (_ [match then]) (\ ! map (|>> [(list (<format> match))]) (recur then))) (#.Cons cons))] - (wrap (_.switch ..peek_cursor - cases - (#.Some ..fail_pm!))))]) + (in (_.switch ..peek_cursor + cases + (#.Some ..fail_pm!))))]) ([#/////synthesis.F64_Fork //primitive.f64] [#/////synthesis.Text_Fork //primitive.text]) (^template [<complex> <choice>] [(^ (<complex> idx)) - (///////phase\wrap (<choice> false idx))]) + (///////phase\in (<choice> false idx))]) ([/////synthesis.side/left ..left_choice] [/////synthesis.side/right ..right_choice]) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (push_cursor! (<getter> (_.i32 (.int lefts)) ..peek_cursor)))]) + (///////phase\in (push_cursor! (<getter> (_.i32 (.int lefts)) ..peek_cursor)))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) @@ -291,7 +291,7 @@ (do ///////phase.monad [left! (recur leftP) right! (recur rightP)] - (wrap (<combinator> left! right!)))]) + (in (<combinator> left! right!)))]) ([/////synthesis.path/seq _.then] [/////synthesis.path/alt ..alternation])))))) @@ -299,24 +299,24 @@ (-> Phase! Phase Archive Path (Operation Statement)) (do ///////phase.monad [pattern_matching! (pattern_matching' statement expression archive pathP)] - (wrap ($_ _.then - (_.do_while (_.boolean false) - pattern_matching!) - (_.throw (_.string ////synthesis/case.pattern_matching_error)))))) + (in ($_ _.then + (_.do_while (_.boolean false) + pattern_matching!) + (_.throw (_.string ////synthesis/case.pattern_matching_error)))))) (def: #export (case! statement expression archive [valueS pathP]) (Generator! [Synthesis Path]) (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching statement expression archive pathP)] - (wrap ($_ _.then - (_.declare @temp) - (_.define @cursor (_.array (list stack_init))) - (_.define @savepoint (_.array (list))) - pattern_matching!)))) + (in ($_ _.then + (_.declare @temp) + (_.define @cursor (_.array (list stack_init))) + (_.define @savepoint (_.array (list))) + pattern_matching!)))) (def: #export (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) (do ///////phase.monad [pattern_matching! (..case! statement expression archive [valueS pathP])] - (wrap (_.apply/* (_.closure (list) pattern_matching!) (list))))) + (in (_.apply/* (_.closure (list) pattern_matching!) (list))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index 0f2d9adf6..b06f9e347 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -32,7 +32,7 @@ (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply/* functionO argsO+)))) + (in (_.apply/* functionO argsO+)))) (def: capture (-> Register Var) @@ -120,4 +120,4 @@ ))] _ (/////generation.execute! definition) _ (/////generation.save! (product.right function_name) #.None definition)] - (wrap instantiation))) + (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index 720257105..8e9f4265c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -55,10 +55,10 @@ initsO+ (monad.map ! (expression archive) initsS+) body! (/////generation.with_anchor [start @scope] (statement expression archive bodyS))] - (wrap (..setup true start initsO+ - (_.with_label (_.label @scope) - (_.do_while (_.boolean true) - body!))))))) + (in (..setup true start initsO+ + (_.with_label (_.label @scope) + (_.do_while (_.boolean true) + body!))))))) (def: #export (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -71,7 +71,7 @@ _ (do {! ///////phase.monad} [loop! (scope! statement expression archive [start initsS+ bodyS])] - (wrap (_.apply/* (_.closure (list) loop!) (list)))))) + (in (_.apply/* (_.closure (list) loop!) (list)))))) (def: @temp (_.var "lux_recur_values")) @@ -81,11 +81,11 @@ (do {! ///////phase.monad} [[offset @scope] /////generation.anchor argsO+ (monad.map ! (expression archive) argsS+)] - (wrap ($_ _.then - (_.define @temp (_.array argsO+)) - (..setup false offset - (|> argsO+ - list.enumeration - (list\map (function (_ [idx _]) - (_.at (_.i32 (.int idx)) @temp)))) - (_.continue_at (_.label @scope))))))) + (in ($_ _.then + (_.define @temp (_.array argsO+)) + (..setup false offset + (|> argsO+ + list.enumeration + (list\map (function (_ [idx _]) + (_.at (_.i32 (.int idx)) @temp)))) + (_.continue_at (_.label @scope))))))) 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 a4c5ebd10..506a957c7 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 @@ -89,13 +89,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (syntax: (runtime: {declaration (<>.or <code>.local_identifier (<code>.form (<>.and <code>.local_identifier @@ -106,31 +106,31 @@ (case declaration (#.Left name) (let [g!name (code.local_identifier name)] - (wrap (list (` (def: #export (~ g!name) - Var - (~ runtime_name))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!name)) - (~ code)))))))) + (in (list (` (def: #export (~ g!name) + Var + (~ runtime_name))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!name)) + (~ code)))))))) (#.Right [name inputs]) (let [g!name (code.local_identifier name) inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) Computation) - (_.apply/* (~ runtime_name) (list (~+ inputsC))))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!_)) - (..with_vars [(~+ inputsC)] - (_.function (~ g!_) (list (~+ inputsC)) - (~ code)))))))))))))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) Computation) + (_.apply/* (~ runtime_name) (list (~+ inputsC))))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!_)) + (..with_vars [(~+ inputsC)] + (_.function (~ g!_) (list (~+ inputsC)) + (~ code)))))))))))))) (def: length (-> Expression Computation) @@ -776,11 +776,11 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id #.None ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [..module_id - #.None - (|> ..runtime - _.code - (\ utf8.codec encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [..module_id + #.None + (|> ..runtime + _.code + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux index 8c68d5b23..1b3f8e526 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux @@ -18,7 +18,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap //runtime.unit) + (///////phase\in //runtime.unit) (#.Cons singletonS #.Nil) (generate archive singletonS) @@ -26,7 +26,7 @@ _ (do {! ///////phase.monad} [elemsT+ (monad.map ! (generate archive) elemsS+)] - (wrap (_.array elemsT+))))) + (in (_.array elemsT+))))) (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.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux index e8357027d..629f7704e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux @@ -24,7 +24,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (///\wrap (<generator> value))]) + (///\in (<generator> value))]) ([synthesis.bit /primitive.bit] [synthesis.i64 /primitive.i64] [synthesis.f64 /primitive.f64] 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 74cbae5c8..04d5926a7 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 @@ -38,7 +38,7 @@ (def: (pop_alt stack_depth) (-> Nat (Bytecode Any)) (.case stack_depth - 0 (_\wrap []) + 0 (_\in []) 1 _.pop 2 _.pop2 _ ## (n.> 2) @@ -93,24 +93,24 @@ (-> Nat Label Label (Generator Path)) (.case path #synthesis.Pop - (operation\wrap ..pop) + (operation\in ..pop) (#synthesis.Bind register) - (operation\wrap ($_ _.compose - ..peek - (_.astore register))) + (operation\in ($_ _.compose + ..peek + (_.astore register))) (#synthesis.Then bodyS) (do phase.monad [bodyG (phase archive bodyS)] - (wrap ($_ _.compose - (..pop_alt stack_depth) - bodyG - (_.goto @end)))) + (in ($_ _.compose + (..pop_alt stack_depth) + bodyG + (_.goto @end)))) (^template [<pattern> <right?>] [(^ (<pattern> lefts)) - (operation\wrap + (operation\in (do _.monad [@success _.new_label @fail _.new_label] @@ -133,10 +133,10 @@ (^template [<pattern> <projection>] [(^ (<pattern> lefts)) - (operation\wrap ($_ _.compose - ..peek - (<projection> lefts) - //runtime.push))]) + (operation\in ($_ _.compose + ..peek + (<projection> lefts) + //runtime.push))]) ([synthesis.member/left ..left_projection] [synthesis.member/right ..right_projection]) @@ -146,13 +146,13 @@ (synthesis.!bind_top register thenP))) (do phase.monad [thenG (path' stack_depth @else @end phase archive thenP)] - (wrap ($_ _.compose - ..peek - (_.checkcast //type.tuple) - _.iconst_0 - _.aaload - (_.astore register) - thenG))) + (in ($_ _.compose + ..peek + (_.checkcast //type.tuple) + _.iconst_0 + _.aaload + (_.astore register) + thenG))) ## Extra optimization (^template [<pm> <projection>] @@ -161,13 +161,13 @@ (synthesis.!bind_top register thenP))) (do phase.monad [then! (path' stack_depth @else @end phase archive thenP)] - (wrap ($_ _.compose - ..peek - (_.checkcast //type.tuple) - (..int lefts) - <projection> - (_.astore register) - then!)))]) + (in ($_ _.compose + ..peek + (_.checkcast //type.tuple) + (..int lefts) + <projection> + (_.astore register) + then!)))]) ([synthesis.member/left //runtime.left_projection] [synthesis.member/right //runtime.right_projection]) @@ -176,20 +176,20 @@ [@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) - _.pop - right!))) + (in ($_ _.compose + _.dup + left! + (_.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)] - (wrap ($_ _.compose - left! - right!))) + (in ($_ _.compose + left! + right!))) _ (undefined) @@ -200,13 +200,13 @@ (do phase.monad [@else //runtime.forge_label pathG (..path' 1 @else @end phase archive path)] - (wrap ($_ _.compose - pathG - (_.set_label @else) - _.pop - //runtime.pm_failure - _.aconst_null - (_.goto @end))))) + (in ($_ _.compose + pathG + (_.set_label @else) + _.pop + //runtime.pm_failure + _.aconst_null + (_.goto @end))))) (def: #export (if phase archive [conditionS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -214,43 +214,43 @@ [conditionG (phase archive conditionS) thenG (phase archive thenS) elseG (phase archive elseS)] - (wrap (do _.monad - [@else _.new_label - @end _.new_label] - ($_ _.compose - conditionG - (//value.unwrap type.boolean) - (_.ifeq @else) - thenG - (_.goto @end) - (_.set_label @else) - elseG - (_.set_label @end)))))) + (in (do _.monad + [@else _.new_label + @end _.new_label] + ($_ _.compose + conditionG + (//value.unwrap type.boolean) + (_.ifeq @else) + thenG + (_.goto @end) + (_.set_label @else) + elseG + (_.set_label @end)))))) (def: #export (let phase archive [inputS register bodyS]) (Generator [Synthesis Register Synthesis]) (do phase.monad [inputG (phase archive inputS) bodyG (phase archive bodyS)] - (wrap ($_ _.compose - inputG - (_.astore register) - bodyG)))) + (in ($_ _.compose + inputG + (_.astore register) + bodyG)))) (def: #export (get phase archive [path recordS]) (Generator [(List synthesis.Member) Synthesis]) (do phase.monad [recordG (phase archive recordS)] - (wrap (list\fold (function (_ step so_far) - (.let [next (.case step - (#.Left lefts) - (..left_projection lefts) - - (#.Right lefts) - (..right_projection lefts))] - (_.compose so_far next))) - recordG - (list.reverse path))))) + (in (list\fold (function (_ step so_far) + (.let [next (.case step + (#.Left lefts) + (..left_projection lefts) + + (#.Right lefts) + (..right_projection lefts))] + (_.compose so_far next))) + recordG + (list.reverse path))))) (def: #export (case phase archive [valueS path]) (Generator [Synthesis Path]) @@ -258,9 +258,9 @@ [@end //runtime.forge_label valueG (phase archive valueS) pathG (..path @end phase archive path)] - (wrap ($_ _.compose - _.aconst_null - valueG - //runtime.push - pathG - (_.set_label @end))))) + (in ($_ _.compose + _.aconst_null + valueG + //runtime.push + pathG + (_.set_label @end))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux index 65c141283..82f5b442b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux @@ -15,17 +15,17 @@ (def: extension ".class") -(def: #export (write-class! name bytecode) +(def: #export (write_class! name bytecode) (-> Text Binary (IO Text)) - (let [file-path (format name ..extension)] + (let [file_path (format name ..extension)] (do io.monad [outcome (do (try.with @) [file (: (IO (Try (File IO))) - (file.get-file io.monad file.default file-path))] - (\ file over-write bytecode))] - (wrap (case outcome - (#try.Success definition) - file-path + (file.get_file io.monad file.default file_path))] + (\ file over_write bytecode))] + (in (case outcome + (#try.Success definition) + file_path - (#try.Failure error) - error))))) + (#try.Failure error) + error))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux index 42d9cf2a4..640543f45 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux @@ -79,7 +79,7 @@ (list (/implementation.method' //runtime.apply::name arity @begin body)))))] (do phase.monad [instance (/new.instance generate archive classT environment arity)] - (wrap [fields methods instance])))) + (in [fields methods instance])))) (def: modifier (Modifier Class) @@ -114,22 +114,22 @@ #let [bytecode (format.run class.writer class)] _ (generation.execute! [function_class bytecode]) _ (generation.save! function_class #.None [function_class bytecode])] - (wrap instance))) + (in instance))) (def: #export (apply generate archive [abstractionS inputsS]) (Generator Apply) (do {! phase.monad} [abstractionG (generate archive abstractionS) inputsG (monad.map ! (generate archive) inputsS)] - (wrap ($_ _.compose - abstractionG - (|> inputsG - (list.chunk /arity.maximum) - (monad.map _.monad - (function (_ batchG) - ($_ _.compose - (_.checkcast /abstract.class) - (monad.seq _.monad batchG) - (_.invokevirtual /abstract.class //runtime.apply::name (//runtime.apply::type (list.size batchG))) - )))) - )))) + (in ($_ _.compose + abstractionG + (|> inputsG + (list.chunk /arity.maximum) + (monad.map _.monad + (function (_ batchG) + ($_ _.compose + (_.checkcast /abstract.class) + (monad.seq _.monad batchG) + (_.invokevirtual /abstract.class //runtime.apply::name (//runtime.apply::type (list.size batchG))) + )))) + )))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux index 4506bb2f8..ccfd84401 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/foreign.lux @@ -29,12 +29,12 @@ (def: #export (get class register) (-> (Type Class) Register (Bytecode Any)) - (//.get class (/////reference.foreign-name register))) + (//.get class (/////reference.foreign_name register))) (def: #export (put class register value) (-> (Type Class) Register (Bytecode Any) (Bytecode Any)) - (//.put /////reference.foreign-name class register value)) + (//.put /////reference.foreign_name class register value)) (def: #export variables (-> (Environment Synthesis) (List (Resource Field))) - (|>> list.size (//.variables /////reference.foreign-name))) + (|>> list.size (//.variables /////reference.foreign_name))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux index 0a2e25b3d..7e5e8a6ca 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux @@ -33,22 +33,22 @@ (def: #export (initial amount) (-> Nat (Bytecode Any)) ($_ _.compose - (|> _.aconst-null + (|> _.aconst_null (list.repeat amount) (monad.seq _.monad)) - (_\wrap []))) + (_\in []))) (def: #export (get class register) (-> (Type Class) Register (Bytecode Any)) - (//.get class (/////reference.partial-name register))) + (//.get class (/////reference.partial_name register))) (def: #export (put class register value) (-> (Type Class) Register (Bytecode Any) (Bytecode Any)) - (//.put /////reference.partial-name class register value)) + (//.put /////reference.partial_name class register value)) (def: #export variables (-> Arity (List (Resource Field))) - (|>> (n.- ///arity.minimum) (//.variables /////reference.partial-name))) + (|>> (n.- ///arity.minimum) (//.variables /////reference.partial_name))) (def: #export (new arity) (-> Arity (Bytecode Any)) @@ -56,4 +56,4 @@ ($_ _.compose /count.initial (initial (n.- ///arity.minimum arity))) - (_\wrap []))) + (_\in []))) 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 943604bbc..cfe49a36b 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 @@ -59,7 +59,7 @@ (|> amount list.indices (monad.map _.monad (|>> (n.+ offset) _.aload))) - (_\wrap []) + (_\in []) )) (def: (apply offset amount) @@ -72,7 +72,7 @@ (if (n.> ///arity.maximum amount) (apply (n.+ ///arity.maximum offset) (n.- ///arity.maximum amount)) - (_\wrap [])) + (_\in [])) ))) (def: this_offset 1) @@ -114,7 +114,7 @@ ////reference.this (if already_partial? (_.invokevirtual class //reset.name (//reset.type class)) - (_\wrap [])) + (_\in [])) current_partials (..inputs ..this_offset apply_arity) (_.invokevirtual class //implementation.name (//implementation.type function_arity)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux index 14cde40a2..347ab1a8a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux @@ -32,7 +32,7 @@ (..type arity) (list) (#.Some ($_ _.compose - (_.set-label @begin) + (_.set_label @begin) body _.areturn )))) 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 19c84c828..1707b1413 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 @@ -55,7 +55,7 @@ (-> Phase Archive (Type Class) (Environment Synthesis) Arity (Operation (Bytecode Any))) (do {! phase.monad} [foreign* (monad.map ! (generate archive) environment)] - (wrap (instance' foreign* class environment arity)))) + (in (instance' foreign* class environment arity)))) (def: #export (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux index 229538870..8ad6fd92e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux @@ -32,7 +32,7 @@ (-> (Type Class) (Type category.Method)) (type.method [(list) class (list)])) -(def: (current-environment class) +(def: (current_environment class) (-> (Type Class) (Environment Synthesis) (List (Bytecode Any))) (|>> list.size list.indices @@ -45,6 +45,6 @@ (list) (#.Some ($_ _.compose (if (arity.multiary? arity) - (//new.instance' (..current-environment class environment) class environment arity) + (//new.instance' (..current_environment class environment) class environment arity) ////reference.this) _.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 c0fb1765f..fc9f4d3ca 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 @@ -1,7 +1,7 @@ (.module: [library [lux (#- Definition) - ["." ffi (#+ import: do-to object)] + ["." ffi (#+ import: do_to object)] [abstract [monad (#+ do)]] [control @@ -60,22 +60,22 @@ (def: init::type (type.method [(list) type.void (list)])) (def: init::modifier ($_ modifier\compose method.public method.static method.strict)) -(exception: #export (cannot-load {class Text} {error Text}) +(exception: #export (cannot_load {class Text} {error Text}) (exception.report ["Class" class] ["Error" error])) -(exception: #export (invalid-field {class Text} {field Text} {error Text}) +(exception: #export (invalid_field {class Text} {field Text} {error Text}) (exception.report ["Class" class] ["Field" field] ["Error" error])) -(exception: #export (invalid-value {class Text}) +(exception: #export (invalid_value {class Text}) (exception.report ["Class" class])) -(def: (class-value class-name class) +(def: (class_value class_name class) (-> Text (java/lang/Class java/lang/Object) (Try Any)) (case (java/lang/Class::getField ..value::field class) (#try.Success field) @@ -86,22 +86,23 @@ (#try.Success value) #.None - (exception.throw ..invalid-value [class-name])) + (exception.except ..invalid_value [class_name])) (#try.Failure error) - (exception.throw ..cannot-load [class-name error])) + (exception.except ..cannot_load [class_name error])) (#try.Failure error) - (exception.throw ..invalid-field [class-name ..value::field error]))) + (exception.except ..invalid_field [class_name ..value::field error]))) -(def: class-path-separator ".") +(def: class_path_separator + ".") -(def: (evaluate! library loader eval-class valueG) +(def: (evaluate! library loader eval_class valueG) (-> Library java/lang/ClassLoader Text (Bytecode Any) (Try [Any Definition])) - (let [bytecode-name (text.replace-all class-path-separator .module-separator eval-class) + (let [bytecode_name (text.replace_all class_path_separator .module_separator eval_class) bytecode (class.class version.v6_0 class.public - (encoding/name.internal bytecode-name) + (encoding/name.internal bytecode_name) (encoding/name.internal "java.lang.Object") (list) (list (field.field ..value::modifier ..value::field ..value::type (row.row))) (list (method.method ..init::modifier "<clinit>" ..init::type @@ -109,50 +110,50 @@ (#.Some ($_ _.compose valueG - (_.putstatic (type.class bytecode-name (list)) ..value::field ..value::type) + (_.putstatic (type.class bytecode_name (list)) ..value::field ..value::type) _.return)))) (row.row))] (io.run (do {! (try.with io.monad)} [bytecode (\ ! map (format.run class.writer) (io.io bytecode)) - _ (loader.store eval-class bytecode library) - class (loader.load eval-class loader) - value (\ io.monad wrap (class-value eval-class class))] - (wrap [value - [eval-class bytecode]]))))) + _ (loader.store eval_class bytecode library) + class (loader.load eval_class loader) + value (\ io.monad in (class_value eval_class class))] + (in [value + [eval_class bytecode]]))))) -(def: (execute! library loader temp-label [class-name class-bytecode]) +(def: (execute! library loader temp_label [class_name class_bytecode]) (-> Library java/lang/ClassLoader Text Definition (Try Any)) (io.run (do (try.with io.monad) - [existing-class? (|> (atom.read library) + [existing_class? (|> (atom.read library) (\ io.monad map (function (_ library) - (dictionary.key? library class-name))) + (dictionary.key? library class_name))) (try.lift io.monad) (: (IO (Try Bit)))) - _ (if existing-class? - (wrap []) - (loader.store class-name class-bytecode library))] - (loader.load class-name loader)))) + _ (if existing_class? + (in []) + (loader.store class_name class_bytecode library))] + (loader.load class_name loader)))) (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.normal name) + (let [class_name (format (text.replace_all .module_separator class_path_separator module) + class_path_separator (name.normal name) "___" (%.nat (text\hash name)))] (do try.monad - [[value definition] (evaluate! library loader class-name valueG)] - (wrap [class-name value definition])))) + [[value definition] (evaluate! library loader class_name valueG)] + (in [class_name value definition])))) (def: #export host (IO //runtime.Host) - (io (let [library (loader.new-library []) + (io (let [library (loader.new_library []) loader (loader.memory library)] (: //runtime.Host (implementation - (def: (evaluate! temp-label valueG) - (let [eval-class (|> temp-label name.normal (text.replace-all " " "$"))] + (def: (evaluate! temp_label valueG) + (let [eval_class (|> temp_label name.normal (text.replace_all " " "$"))] (\ try.monad map product.left - (..evaluate! library loader eval-class valueG)))) + (..evaluate! library loader eval_class valueG)))) (def: execute! (..execute! library loader)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux index 465e8d1af..ba6cb27ef 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux @@ -34,8 +34,8 @@ _ false)) -(def: no-op - (_\wrap [])) +(def: no_op + (_\in [])) (def: #export (recur translate archive updatesS) (Generator (List Synthesis)) @@ -47,36 +47,36 @@ [(n.+ offset index) updateS])) (monad.map ! (function (_ [register updateS]) (if (invariant? register updateS) - (wrap [..no-op - ..no-op]) + (in [..no_op + ..no_op]) (do ! [fetchG (translate archive updateS) #let [storeG (_.astore register)]] - (wrap [fetchG storeG]))))))] - (wrap ($_ _.compose - ## It may look weird that first I fetch all the values separately, - ## and then I store them all. - ## It must be done that way in order to avoid a potential bug. - ## Let's say that you'll recur with 2 expressions: X and Y. - ## If Y depends on the value of X, and you don't perform fetches - ## and stores separately, then by the time Y is evaluated, it - ## will refer to the new value of X, instead of the old value, as - ## should be the case. - (|> updatesG - (list\map product.left) - (monad.seq _.monad)) - (|> updatesG - list.reverse - (list\map product.right) - (monad.seq _.monad)) - (_.goto @begin))))) + (in [fetchG storeG]))))))] + (in ($_ _.compose + ## It may look weird that first I fetch all the values separately, + ## and then I store them all. + ## It must be done that way in order to avoid a potential bug. + ## Let's say that you'll recur with 2 expressions: X and Y. + ## If Y depends on the value of X, and you don't perform fetches + ## and stores separately, then by the time Y is evaluated, it + ## will refer to the new value of X, instead of the old value, as + ## should be the case. + (|> updatesG + (list\map product.left) + (monad.seq _.monad)) + (|> updatesG + list.reverse + (list\map product.right) + (monad.seq _.monad)) + (_.goto @begin))))) (def: #export (scope translate archive [offset initsS+ iterationS]) (Generator [Nat (List Synthesis) Synthesis]) (do {! phase.monad} - [@begin //runtime.forge-label + [@begin //runtime.forge_label initsI+ (monad.map ! (translate archive) initsS+) - iterationG (generation.with-anchor [@begin offset] + iterationG (generation.with_anchor [@begin offset] (translate archive iterationS)) #let [initializationG (|> (list.enumeration initsI+) (list\map (function (_ [index initG]) @@ -84,7 +84,7 @@ initG (_.astore (n.+ offset index))))) (monad.seq _.monad))]] - (wrap ($_ _.compose - initializationG - (_.set-label @begin) - iterationG)))) + (in ($_ _.compose + initializationG + (_.set_label @begin) + iterationG)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux index 6b24fb2f5..42f9a24fa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux @@ -21,7 +21,7 @@ (-> Bit (Bytecode Any)) (_.getstatic $Boolean (if value "TRUE" "FALSE") $Boolean)) -(def: wrap-i64 +(def: wrap_i64 (_.invokestatic $Long "valueOf" (type.method [(list type.long) $Long (list)]))) (def: #export (i64 value) @@ -31,23 +31,23 @@ [<int> (do _.monad [_ <instruction>] - ..wrap-i64)]) - ([+0 _.lconst-0] - [+1 _.lconst-1]) + ..wrap_i64)]) + ([+0 _.lconst_0] + [+1 _.lconst_1]) (^template [<int> <instruction>] [<int> (do _.monad [_ <instruction> _ _.i2l] - ..wrap-i64)]) - ([-1 _.iconst-m1] - ## [+0 _.iconst-0] - ## [+1 _.iconst-1] - [+2 _.iconst-2] - [+3 _.iconst-3] - [+4 _.iconst-4] - [+5 _.iconst-5]) + ..wrap_i64)]) + ([-1 _.iconst_m1] + ## [+0 _.iconst_0] + ## [+1 _.iconst_1] + [+2 _.iconst_2] + [+3 _.iconst_3] + [+4 _.iconst_4] + [+5 _.iconst_5]) value (case (signed.s1 value) @@ -55,7 +55,7 @@ (do _.monad [_ (_.bipush value) _ _.i2l] - ..wrap-i64) + ..wrap_i64) (#try.Failure _) (case (signed.s2 value) @@ -63,14 +63,14 @@ (do _.monad [_ (_.sipush value) _ _.i2l] - ..wrap-i64) + ..wrap_i64) (#try.Failure _) (do _.monad [_ (_.long value)] - ..wrap-i64))))) + ..wrap_i64))))) -(def: wrap-f64 +(def: wrap_f64 (_.invokestatic $Double "valueOf" (type.method [(list type.double) $Double (list)]))) (import: java/lang/Double @@ -83,39 +83,39 @@ [<int> (do _.monad [_ <instruction>] - ..wrap-f64)]) - ([+1.0 _.dconst-1]) + ..wrap_f64)]) + ([+1.0 _.dconst_1]) (^template [<int> <instruction>] [<int> (do _.monad [_ <instruction> _ _.f2d] - ..wrap-f64)]) - ([+2.0 _.fconst-2]) + ..wrap_f64)]) + ([+2.0 _.fconst_2]) (^template [<int> <instruction>] [<int> (do _.monad [_ <instruction> _ _.i2d] - ..wrap-f64)]) - ([-1.0 _.iconst-m1] - ## [+0.0 _.iconst-0] - ## [+1.0 _.iconst-1] - [+2.0 _.iconst-2] - [+3.0 _.iconst-3] - [+4.0 _.iconst-4] - [+5.0 _.iconst-5]) + ..wrap_f64)]) + ([-1.0 _.iconst_m1] + ## [+0.0 _.iconst_0] + ## [+1.0 _.iconst_1] + [+2.0 _.iconst_2] + [+3.0 _.iconst_3] + [+4.0 _.iconst_4] + [+5.0 _.iconst_5]) _ - (let [constantI (if (i.= ..d0-bits + (let [constantI (if (i.= ..d0_bits (java/lang/Double::doubleToRawLongBits (:as java/lang/Double value))) - _.dconst-0 + _.dconst_0 (_.double value))] (do _.monad [_ constantI] - ..wrap-f64)))) + ..wrap_f64)))) (def: #export text _.string) 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 441cf5c63..2e3fe8618 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 @@ -44,17 +44,17 @@ (do {! ////.monad} [bytecode_name (\ ! map //runtime.class_name (generation.context archive))] - (wrap ($_ _.compose - ..this - (_.getfield (type.class bytecode_name (list)) - (..foreign_name variable) - //type.value))))) + (in ($_ _.compose + ..this + (_.getfield (type.class bytecode_name (list)) + (..foreign_name variable) + //type.value))))) (def: #export (variable archive variable) (-> Archive Variable (Operation (Bytecode Any))) (case variable (#variable.Local variable) - (operation\wrap (_.aload variable)) + (operation\in (_.aload variable)) (#variable.Foreign variable) (..foreign archive variable))) @@ -64,4 +64,4 @@ (do {! ////.monad} [bytecode_name (\ ! map //runtime.class_name (generation.remember archive name))] - (wrap (_.getstatic (type.class bytecode_name (list)) //value.field //type.value)))) + (in (_.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 6bc0ffe91..b997af01d 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 @@ -30,7 +30,7 @@ (Generator (Tuple Synthesis)) (case membersS #.Nil - (\ phase.monad wrap //runtime.unit) + (\ phase.monad in //runtime.unit) (#.Cons singletonS #.Nil) (generate archive singletonS) @@ -42,15 +42,15 @@ (monad.map ! (function (_ [idx member]) (do ! [memberI (generate archive member)] - (wrap (do _.monad - [_ _.dup - _ (_.int (.i64 idx)) - _ memberI] - _.aastore))))))] - (wrap (do {! _.monad} - [_ (_.int (.i64 (list.size membersS))) - _ (_.anewarray $Object)] - (monad.seq ! membersI)))))) + (in (do _.monad + [_ _.dup + _ (_.int (.i64 idx)) + _ memberI] + _.aastore))))))] + (in (do {! _.monad} + [_ (_.int (.i64 (list.size membersS))) + _ (_.anewarray $Object)] + (monad.seq ! membersI)))))) (def: #export (tag lefts right?) (-> Nat Bit (Bytecode Any)) @@ -85,11 +85,11 @@ (Generator (Variant Synthesis)) (do phase.monad [valueI (generate archive valueS)] - (wrap (do _.monad - [_ (..tag lefts right?) - _ (..flag right?) - _ valueI] - (_.invokestatic //runtime.class "variant" - (type.method [(list type.int $Object $Object) - (type.array $Object) - (list)])))))) + (in (do _.monad + [_ (..tag lefts right?) + _ (..flag right?) + _ valueI] + (_.invokestatic //runtime.class "variant" + (type.method [(list type.int $Object $Object) + (type.array $Object) + (list)])))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux index 529dd28a0..3c9054abf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux @@ -56,7 +56,7 @@ (^ (synthesis.loop/scope scope)) (do //////phase.monad [[inits scope!] (/loop.scope! statement expression archive false scope)] - (wrap scope!)) + (in scope!)) (^ (synthesis.loop/recur updates)) (/loop.recur! statement expression archive updates) @@ -72,7 +72,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([synthesis.bit /primitive.bit] [synthesis.i64 /primitive.i64] [synthesis.f64 /primitive.f64] @@ -103,7 +103,7 @@ (/loop.scope ..statement expression archive scope) (^ (synthesis.loop/recur updates)) - (//////phase.throw ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot-recur-as-an-expression []) (^ (synthesis.function/abstraction abstraction)) (/function.function ..statement expression archive abstraction) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 0be2698f8..94b086149 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -44,34 +44,34 @@ [valueO (expression archive valueS) bodyO (expression archive bodyS)] ## TODO: Find some way to do 'let' without paying the price of the closure. - (wrap (|> bodyO - _.return - (_.closure (list (..register register))) - (_.apply/* (list valueO)))))) + (in (|> bodyO + _.return + (_.closure (list (..register register))) + (_.apply/* (list valueO)))))) (def: #export (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (wrap ($_ _.then - (_.local/1 (..register register) valueO) - bodyO)))) + (in ($_ _.then + (_.local/1 (..register register) valueO) + bodyO)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] - (method source))) - valueO - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple//left] + [#.Right //runtime.tuple//right]))] + (method source))) + valueO + (list.reverse pathP))))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -79,11 +79,11 @@ [testO (expression archive testS) thenO (expression archive thenS) elseO (expression archive elseS)] - (wrap (|> (_.if testO - (_.return thenO) - (_.return elseO)) - (_.closure (list)) - (_.apply/* (list)))))) + (in (|> (_.if testO + (_.return thenO) + (_.return elseO)) + (_.closure (list)) + (_.apply/* (list)))))) (def: #export (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) @@ -91,9 +91,9 @@ [testO (expression archive testS) thenO (statement expression archive thenS) elseO (statement expression archive elseS)] - (wrap (_.if testO - thenO - elseO)))) + (in (_.if testO + thenO + elseO)))) (def: @savepoint (_.var "lux_pm_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) @@ -167,10 +167,10 @@ (statement expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap ..pop!) + (///////phase\in ..pop!) (#/////synthesis.Bind register) - (///////phase\wrap (_.local/1 (..register register) ..peek)) + (///////phase\in (_.local/1 (..register register) ..peek)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -180,14 +180,14 @@ (recur elseP) #.None - (wrap ..fail!))] - (wrap (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!)))) + (in ..fail!))] + (in (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!)))) (^template [<tag> <format>] [(<tag> cons) @@ -195,18 +195,18 @@ [clauses (monad.map ! (function (_ [match then]) (do ! [then! (recur then)] - (wrap [(_.= (|> match <format>) - ..peek) - then!]))) + (in [(_.= (|> match <format>) + ..peek) + then!]))) (#.Cons cons))] - (wrap (_.cond clauses ..fail!)))]) + (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork (<| _.int .int)] [#/////synthesis.F64_Fork _.float] [#/////synthesis.Text_Fork _.string]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) - (///////phase\wrap (<choice> false idx)) + (///////phase\in (<choice> false idx)) (^ (<simple> idx nextP)) (///////phase\map (_.then (<choice> true idx)) (recur nextP))]) @@ -214,27 +214,27 @@ [/////synthesis.side/right /////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (|> ..peek (_.nth (_.int +1)) ..push!)) + (///////phase\in (|> ..peek (_.nth (_.int +1)) ..push!)) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) (^ (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (recur thenP)] - (///////phase\wrap ($_ _.then - (_.local/1 (..register register) ..peek_and_pop) - then!))) + (///////phase\in ($_ _.then + (_.local/1 (..register register) ..peek_and_pop) + then!))) (^template [<tag> <combinator>] [(^ (<tag> preP postP)) (do ///////phase.monad [pre! (recur preP) post! (recur postP)] - (wrap (<combinator> pre! post!)))]) + (in (<combinator> pre! post!)))]) ([/////synthesis.path/seq _.then] [/////synthesis.path/alt ..alternation])))) @@ -242,10 +242,10 @@ (-> Phase! Phase Archive Path (Operation Statement)) (do ///////phase.monad [pattern_matching! (pattern_matching' statement expression archive pathP)] - (wrap ($_ _.then - (_.while (_.bool true) - pattern_matching!) - (_.statement (|> (_.var "error") (_.apply/* (list (_.string ////synthesis/case.pattern_matching_error))))))))) + (in ($_ _.then + (_.while (_.bool true) + pattern_matching!) + (_.statement (|> (_.var "error") (_.apply/* (list (_.string ////synthesis/case.pattern_matching_error))))))))) (def: #export dependencies (-> Path (List Var)) @@ -265,11 +265,11 @@ (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching statement expression archive pathP)] - (wrap ($_ _.then - (_.local (list @temp)) - (_.local/1 @cursor (_.array (list stack_init))) - (_.local/1 @savepoint (_.array (list))) - pattern_matching!)))) + (in ($_ _.then + (_.local (list @temp)) + (_.local/1 @cursor (_.array (list stack_init))) + (_.local/1 @savepoint (_.array (list))) + pattern_matching!)))) (def: #export (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index 789d30fcc..66f2aa0c4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -34,7 +34,7 @@ (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply/* argsO+ functionO)))) + (in (_.apply/* argsO+ functionO)))) (def: capture (-> Register Var) @@ -134,4 +134,4 @@ ))] _ (/////generation.execute! definition) _ (/////generation.save! (product.right function_name) #.None definition)] - (wrap instantiation))) + (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 6004e31a8..7d063fa09 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -65,11 +65,11 @@ initsO+ (monad.map ! (expression archive) initsS+) body! (/////generation.with_anchor [start @scope] (statement expression archive bodyS))] - (wrap [initsO+ - (..setup true start initsO+ as_expression? - ($_ _.then - (_.set_label @scope) - body!))])))) + (in [initsO+ + (..setup true start initsO+ as_expression? + ($_ _.then + (_.set_label @scope) + body!))])))) (def: #export (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -109,11 +109,11 @@ (|> @context (_.apply/* foreigns))])))] _ (/////generation.execute! directive) _ (/////generation.save! artifact_id #.None directive)] - (wrap (|> instantiation (_.apply/* initsO+)))))) + (in (|> instantiation (_.apply/* initsO+)))))) (def: #export (recur! statement expression archive argsS+) (Generator! (List Synthesis)) (do {! ///////phase.monad} [[offset @scope] /////generation.anchor argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (..setup false offset argsO+ false (_.go_to @scope))))) + (in (..setup false offset argsO+ false (_.go_to @scope))))) 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 f01c90d7a..1565f7c0e 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 @@ -106,13 +106,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (def: module_id 0) @@ -130,15 +130,15 @@ (#.Left name) (macro.with_gensyms [g!_] (let [g!name (code.local_identifier name)] - (wrap (list (` (def: #export (~ g!name) - Var - (~ runtime_name))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!name)) - (_.set (~ g!name) (~ code)))))))))) + (in (list (` (def: #export (~ g!name) + Var + (~ runtime_name))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!name)) + (_.set (~ g!name) (~ code)))))))))) (#.Right [name inputs]) (macro.with_gensyms [g!_] @@ -146,17 +146,17 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) Computation) - (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!_)) - (..with_vars [(~+ inputsC)] - (_.function (~ g!_) (list (~+ inputsC)) - (~ code)))))))))))))))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) Computation) + (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!_)) + (..with_vars [(~+ inputsC)] + (_.function (~ g!_) (list (~+ inputsC)) + (~ code)))))))))))))))) (def: (nth index table) (-> Expression Expression Location) @@ -423,11 +423,11 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id #.None ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [..module_id - #.None - (|> ..runtime - _.code - (\ utf8.codec encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [..module_id + #.None + (|> ..runtime + _.code + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux index ff9bae4be..56954873e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux @@ -18,7 +18,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (generate archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux index 5bcb2770d..12714b2cd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux @@ -66,7 +66,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] @@ -93,7 +93,7 @@ [////synthesis.function/abstraction /function.function]) (^ (////synthesis.loop/recur _)) - (//////phase.throw ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot-recur-as-an-expression []) (#////synthesis.Extension extension) (///extension.apply archive expression extension))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index d6a4c67b0..48a05b104 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -47,19 +47,19 @@ (do ///////phase.monad [valueG (expression archive valueS) bodyG (expression archive bodyS)] - (wrap (|> bodyG - (list (_.set (..register register) valueG)) - _.array/* - (_.nth (_.int +1)))))) + (in (|> bodyG + (list (_.set (..register register) valueG)) + _.array/* + (_.nth (_.int +1)))))) (def: #export (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) body! (statement expression archive bodyS)] - (wrap ($_ _.then - (_.set! (..register register) valueO) - body!)))) + (in ($_ _.then + (_.set! (..register register) valueO) + body!)))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -67,7 +67,7 @@ [testG (expression archive testS) thenG (expression archive thenS) elseG (expression archive elseS)] - (wrap (_.? testG thenG elseG)))) + (in (_.? testG thenG elseG)))) (def: #export (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) @@ -75,24 +75,24 @@ [test! (expression archive testS) then! (statement expression archive thenS) else! (statement expression archive elseS)] - (wrap (_.if test! - then! - else!)))) + (in (_.if test! + then! + else!)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueG (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] - (method source))) - valueG - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple//left] + [#.Right //runtime.tuple//right]))] + (method source))) + valueG + (list.reverse pathP))))) (def: @savepoint (_.var "lux_pm_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) @@ -167,10 +167,10 @@ (statement expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap ..pop!) + (///////phase\in ..pop!) (#/////synthesis.Bind register) - (///////phase\wrap (_.set! (..register register) ..peek)) + (///////phase\in (_.set! (..register register) ..peek)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -180,14 +180,14 @@ (recur elseP) #.None - (wrap ..fail!))] - (wrap (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!)))) + (in ..fail!))] + (in (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!)))) (^template [<tag> <format>] [(<tag> cons) @@ -195,18 +195,18 @@ [clauses (monad.map ! (function (_ [match then]) (do ! [then! (recur then)] - (wrap [(_.=== (|> match <format>) - ..peek) - then!]))) + (in [(_.=== (|> match <format>) + ..peek) + then!]))) (#.Cons cons))] - (wrap (_.cond clauses ..fail!)))]) + (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork //primitive.i64] [#/////synthesis.F64_Fork //primitive.f64] [#/////synthesis.Text_Fork //primitive.text]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) - (///////phase\wrap (<choice> false idx)) + (///////phase\in (<choice> false idx)) (^ (<simple> idx nextP)) (|> nextP @@ -216,26 +216,26 @@ [/////synthesis.side/right /////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (|> ..peek (_.nth (_.int +0)) ..push!)) + (///////phase\in (|> ..peek (_.nth (_.int +0)) ..push!)) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) (^ (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (recur thenP)] - (///////phase\wrap ($_ _.then - (_.set! (..register register) ..peek_and_pop) - then!))) + (///////phase\in ($_ _.then + (_.set! (..register register) ..peek_and_pop) + then!))) ## (^ (/////synthesis.!multi_pop nextP)) ## (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)] ## (do ///////phase.monad ## [next! (recur nextP')] - ## (///////phase\wrap ($_ _.then + ## (///////phase\in ($_ _.then ## (..multi_pop! (n.+ 2 extra_pops)) ## next!)))) @@ -244,7 +244,7 @@ (do ///////phase.monad [pre! (recur preP) post! (recur postP)] - (wrap (<combinator> pre! post!)))]) + (in (<combinator> pre! post!)))]) ([/////synthesis.path/seq _.then] [/////synthesis.path/alt ..alternation])))) @@ -252,10 +252,10 @@ (Generator! Path) (do ///////phase.monad [iteration! (pattern_matching' statement expression archive pathP)] - (wrap ($_ _.then - (_.do_while (_.bool false) - iteration!) - (_.throw (_.new (_.constant "Exception") (list (_.string ////synthesis/case.pattern_matching_error)))))))) + (in ($_ _.then + (_.do_while (_.bool false) + iteration!) + (_.throw (_.new (_.constant "Exception") (list (_.string ////synthesis/case.pattern_matching_error)))))))) (def: (gensym prefix) (-> Text (Operation Text)) @@ -279,10 +279,10 @@ (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching statement expression archive pathP)] - (wrap ($_ _.then - (_.set! @cursor (_.array/* (list stack_init))) - (_.set! @savepoint (_.array/* (list))) - pattern_matching!)))) + (in ($_ _.then + (_.set! @cursor (_.array/* (list stack_init))) + (_.set! @savepoint (_.array/* (list))) + pattern_matching!)))) (def: #export (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) @@ -295,4 +295,4 @@ directive (_.define_function @case (list\map _.parameter @dependencies+) case!)] _ (/////generation.execute! directive) _ (/////generation.save! case_artifact directive)] - (wrap (_.apply/* @dependencies+ @case)))) + (in (_.apply/* @dependencies+ @case)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux index 819f6b244..d1cfcea2e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -34,7 +34,7 @@ (do {! ///////phase.monad} [functionG (expression archive functionS) argsG+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply/*' argsG+ functionG)))) + (in (_.apply/*' argsG+ functionG)))) (def: capture (-> Register Var) @@ -113,4 +113,4 @@ ))] _ (/////generation.execute! definition) _ (/////generation.save! (product.right function_name) definition)] - (wrap instantiation))) + (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 8b99967a2..4952b71ab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -61,10 +61,10 @@ initsO+ (monad.map ! (expression archive) initsS+) body! (/////generation.with_anchor [start @scope] (statement expression archive bodyS))] - (wrap (..setup start initsO+ - ($_ _.then - (_.set_label @scope) - body!)))))) + (in (..setup start initsO+ + ($_ _.then + (_.set_label @scope) + body!)))))) (def: #export (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -102,7 +102,7 @@ (_.apply/* foreigns @loop)]))] _ (/////generation.execute! directive) _ (/////generation.save! loop_artifact directive)] - (wrap (_.apply/* (list) instantiation))))) + (in (_.apply/* (list) instantiation))))) (def: @temp (_.var "lux_recur_values")) @@ -112,11 +112,11 @@ (do {! ///////phase.monad} [[offset @scope] /////generation.anchor argsO+ (monad.map ! (expression archive) argsS+)] - (wrap ($_ _.then - (_.set! @temp (_.array/* argsO+)) - (..setup offset - (|> argsO+ - list.enumeration - (list\map (function (_ [idx _]) - (_.nth (_.int (.int idx)) @temp)))) - (_.go_to @scope)))))) + (in ($_ _.then + (_.set! @temp (_.array/* argsO+)) + (..setup offset + (|> argsO+ + list.enumeration + (list\map (function (_ [idx _]) + (_.nth (_.int (.int idx)) @temp)))) + (_.go_to @scope)))))) 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 07b72e742..9729815b6 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 @@ -74,13 +74,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (def: module_id 0) @@ -98,15 +98,15 @@ (#.Left name) (macro.with_gensyms [g!_] (let [g!name (code.local_identifier name)] - (wrap (list (` (def: #export (~ g!name) - Var - (~ runtime_name))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!name)) - (_.define (~ g!name) (~ code)))))))))) + (in (list (` (def: #export (~ g!name) + Var + (~ runtime_name))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!name)) + (_.define (~ g!name) (~ code)))))))))) (#.Right [name inputs]) (macro.with_gensyms [g!_] @@ -114,18 +114,18 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) Computation) - (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!_)) - (..with_vars [(~+ inputsC)] - (_.define_function (~ g!_) - (list (~+ (list\map (|>> (~) [false] (`)) inputsC))) - (~ code)))))))))))))))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) Computation) + (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!_)) + (..with_vars [(~+ inputsC)] + (_.define_function (~ g!_) + (list (~+ (list\map (|>> (~) [false] (`)) inputsC))) + (~ code)))))))))))))))) (runtime: (io//log! message) ($_ _.then @@ -601,10 +601,10 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [..module_id - (|> ..runtime - _.code - (\ utf8.codec encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [..module_id + (|> ..runtime + _.code + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux index 8d9334dca..5d01a16c6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux @@ -21,7 +21,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (expression archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux index 683a64ffe..d88f2eb0c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux @@ -66,7 +66,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] @@ -97,7 +97,7 @@ (/loop.scope ..statement expression archive scope) (^ (////synthesis.loop/recur updates)) - (//////phase.throw ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot-recur-as-an-expression []) (^ (////synthesis.function/abstraction abstraction)) (/function.function ..statement expression archive abstraction) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 3a776a2a7..71e856034 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -53,18 +53,18 @@ [valueO (expression archive valueS) bodyO (expression archive bodyS)] ## TODO: Find some way to do 'let' without paying the price of the closure. - (wrap (_.apply/* (_.lambda (list (..register register)) - bodyO) - (list valueO))))) + (in (_.apply/* (_.lambda (list (..register register)) + bodyO) + (list valueO))))) (def: #export (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (wrap ($_ _.then - (_.set (list (..register register)) valueO) - bodyO)))) + (in ($_ _.then + (_.set (list (..register register)) valueO) + bodyO)))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -72,7 +72,7 @@ [testO (expression archive testS) thenO (expression archive thenS) elseO (expression archive elseS)] - (wrap (_.? testO thenO elseO)))) + (in (_.? testO thenO elseO)))) (def: #export (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) @@ -80,24 +80,24 @@ [test! (expression archive testS) then! (statement expression archive thenS) else! (statement expression archive elseS)] - (wrap (_.if test! - then! - else!)))) + (in (_.if test! + then! + else!)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple::left] - [#.Right //runtime.tuple::right]))] - (method source))) - valueO - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple::left] + [#.Right //runtime.tuple::right]))] + (method source))) + valueO + (list.reverse pathP))))) (def: @savepoint (_.var "lux_pm_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) @@ -187,14 +187,14 @@ (recur elseP) #.None - (wrap ..fail_pm!))] - (wrap (#.Some (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!))))) + (in ..fail_pm!))] + (in (#.Some (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!))))) (^template [<tag> <format>] [(<tag> cons) @@ -205,14 +205,14 @@ ..peek)]) (recur then))) (#.Cons cons))] - (wrap (#.Some (_.cond clauses - ..fail_pm!))))]) + (in (#.Some (_.cond clauses + ..fail_pm!))))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] [#/////synthesis.F64_Fork (<| //primitive.f64)] [#/////synthesis.Text_Fork (<| //primitive.text)]) _ - (\ ///////phase.monad wrap #.None))) + (\ ///////phase.monad in #.None))) (def: (pattern_matching' in_closure? statement expression archive) (-> Bit Phase! Phase Archive Path (Operation (Statement Any))) @@ -221,7 +221,7 @@ [?output (primitive_pattern_matching recur pathP)] (.case ?output (#.Some output) - (wrap output) + (in output) #.None (.case pathP @@ -229,14 +229,14 @@ (statement expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap ..pop!) + (///////phase\in ..pop!) (#/////synthesis.Bind register) - (///////phase\wrap (_.set (list (..register register)) ..peek)) + (///////phase\in (_.set (list (..register register)) ..peek)) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) - (///////phase\wrap (<choice> false idx)) + (///////phase\in (<choice> false idx)) (^ (<simple> idx nextP)) (|> nextP @@ -246,41 +246,41 @@ [/////synthesis.side/right /////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (|> ..peek (_.nth (_.int +0)) ..push!)) + (///////phase\in (|> ..peek (_.nth (_.int +0)) ..push!)) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) ([/////synthesis.member/left //runtime.tuple::left] [/////synthesis.member/right //runtime.tuple::right]) (^ (/////synthesis.!bind_top register thenP)) (do ! [then! (recur thenP)] - (///////phase\wrap ($_ _.then - (_.set (list (..register register)) ..peek_and_pop) - then!))) + (///////phase\in ($_ _.then + (_.set (list (..register register)) ..peek_and_pop) + then!))) (^ (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (case.count_pops nextP)] (do ! [next! (recur nextP')] - (///////phase\wrap ($_ _.then - (..multi_pop! (n.+ 2 extra_pops)) - next!)))) + (///////phase\in ($_ _.then + (..multi_pop! (n.+ 2 extra_pops)) + next!)))) (^ (/////synthesis.path/seq preP postP)) (do ! [pre! (recur preP) post! (recur postP)] - (wrap (_.then pre! post!))) + (in (_.then pre! post!))) (^ (/////synthesis.path/alt preP postP)) (do ! [pre! (recur preP) post! (recur postP) g!once (..gensym "once")] - (wrap (..alternation in_closure? g!once pre! post!))) + (in (..alternation in_closure? g!once pre! post!))) _ (undefined)))))) @@ -290,10 +290,10 @@ (do ///////phase.monad [pattern_matching! (pattern_matching' in_closure? statement expression archive pathP) g!once (..gensym "once")] - (wrap ($_ _.then - (..with_looping in_closure? g!once - pattern_matching!) - (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))))) + (in ($_ _.then + (..with_looping in_closure? g!once + pattern_matching!) + (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))))) (def: #export dependencies (-> Path (List SVar)) @@ -313,11 +313,11 @@ (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching in_closure? statement expression archive pathP)] - (wrap ($_ _.then - (_.set (list @cursor) (_.list (list stack_init))) - (_.set (list @savepoint) (_.list (list))) - pattern_matching! - )))) + (in ($_ _.then + (_.set (list @cursor) (_.list (list stack_init))) + (_.set (list @savepoint) (_.list (list))) + pattern_matching! + )))) (def: #export (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) @@ -331,4 +331,4 @@ pattern_matching!)] _ (/////generation.execute! directive) _ (/////generation.save! case_artifact #.None directive)] - (wrap (_.apply/* @case @dependencies+)))) + (in (_.apply/* @case @dependencies+)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index d2e70def2..3c114a935 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -36,7 +36,7 @@ (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply/* functionO argsO+)))) + (in (_.apply/* functionO argsO+)))) (def: #export capture (-> Register SVar) @@ -49,7 +49,7 @@ (do ///////phase.monad [_ (/////generation.execute! function_definition) _ (/////generation.save! function_id #.None function_definition)] - (wrap @function)) + (in @function)) _ (do {! ///////phase.monad} @@ -61,7 +61,7 @@ (_.return @function)))] _ (/////generation.execute! directive) _ (/////generation.save! function_id #.None directive)] - (wrap (_.apply/* @function inits))))) + (in (_.apply/* @function inits))))) (def: input (|>> inc //case.register)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 96c1d1ce1..45dbaf999 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -60,9 +60,9 @@ [initsO+ (monad.map ! (expression archive) initsS+) body! (/////generation.with_anchor start (statement expression archive bodyS))] - (wrap (<| (..setup start initsO+) - ..set_scope - body!))))) + (in (<| (..setup start initsO+) + ..set_scope + body!))))) (def: #export (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -104,7 +104,7 @@ (_.apply/* @loop foreigns)]))] _ (/////generation.execute! directive) _ (/////generation.save! loop_artifact #.None directive)] - (wrap (_.apply/* instantiation initsO+))))) + (in (_.apply/* instantiation initsO+))))) (def: #export (recur! statement expression archive argsS+) (Generator! (List Synthesis)) @@ -116,7 +116,7 @@ list.enumeration (list\map (function (_ [idx _]) (_.nth (_.int (.int idx)) @temp))))]] - (wrap ($_ _.then - (_.set (list @temp) (_.list argsO+)) - (..setup offset re_binds - _.continue))))) + (in ($_ _.then + (_.set (list @temp) (_.list argsO+)) + (..setup offset re_binds + _.continue))))) 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 26aeb7f76..440f208ba 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 @@ -113,13 +113,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (syntax: (runtime: {declaration (<>.or <code>.local_identifier (<code>.form (<>.and <code>.local_identifier @@ -131,12 +131,12 @@ (let [nameC (code.local_identifier name) code_nameC (code.local_identifier (format "@" name)) runtime_nameC (` (runtime_name (~ (code.text name))))] - (wrap (list (` (def: #export (~ nameC) SVar (~ runtime_nameC))) - (` (def: (~ code_nameC) - (Statement Any) - (..feature (~ runtime_nameC) - (function ((~ g!_) (~ g!_)) - (_.set (list (~ g!_)) (~ code)))))))))) + (in (list (` (def: #export (~ nameC) SVar (~ runtime_nameC))) + (` (def: (~ code_nameC) + (Statement Any) + (..feature (~ runtime_nameC) + (function ((~ g!_) (~ g!_)) + (_.set (list (~ g!_)) (~ code)))))))))) (#.Right [name inputs]) (macro.with_gensyms [g!_] @@ -146,16 +146,16 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` (_.Expression Any))) inputs)] - (wrap (list (` (def: #export ((~ nameC) (~+ inputsC)) - (-> (~+ inputs_typesC) (Computation Any)) - (_.apply/* (~ runtime_nameC) (list (~+ inputsC))))) - (` (def: (~ code_nameC) - (Statement Any) - (..feature (~ runtime_nameC) - (function ((~ g!_) (~ g!_)) - (..with_vars [(~+ inputsC)] - (_.def (~ g!_) (list (~+ inputsC)) - (~ code))))))))))))) + (in (list (` (def: #export ((~ nameC) (~+ inputsC)) + (-> (~+ inputs_typesC) (Computation Any)) + (_.apply/* (~ runtime_nameC) (list (~+ inputsC))))) + (` (def: (~ code_nameC) + (Statement Any) + (..feature (~ runtime_nameC) + (function ((~ g!_) (~ g!_)) + (..with_vars [(~+ inputsC)] + (_.def (~ g!_) (list (~+ inputsC)) + (~ code))))))))))))) (runtime: (lux::try op) (with_vars [exception] @@ -451,11 +451,11 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id #.None ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [..module_id - #.None - (|> ..runtime - _.code - (\ utf8.codec encode))])])))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [..module_id + #.None + (|> ..runtime + _.code + (\ utf8.codec encode))])])))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux index 342e180d0..394804f3e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux @@ -18,7 +18,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (generate archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux index d3636709a..80171bbfb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux @@ -30,7 +30,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index 912b7aff7..1026bd0fe 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -49,10 +49,10 @@ (do ///////phase.monad [valueO (expression archive valueS) bodyO (expression archive bodyS)] - (wrap (_.block - ($_ _.then - (_.set! (..register register) valueO) - bodyO))))) + (in (_.block + ($_ _.then + (_.set! (..register register) valueO) + bodyO))))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -60,22 +60,22 @@ [testO (expression archive testS) thenO (expression archive thenS) elseO (expression archive elseS)] - (wrap (_.if testO thenO elseO)))) + (in (_.if testO thenO elseO)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple::left] - [#.Right //runtime.tuple::right]))] - (method source))) - valueO - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple::left] + [#.Right //runtime.tuple::right]))] + (method source))) + valueO + (list.reverse pathP))))) (def: $savepoint (_.var "lux_pm_cursor_savepoint")) (def: $cursor (_.var "lux_pm_cursor")) @@ -139,10 +139,10 @@ (expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap ..pop_cursor!) + (///////phase\in ..pop_cursor!) (#/////synthesis.Bind register) - (///////phase\wrap (_.set! (..register register) ..peek)) + (///////phase\in (_.set! (..register register) ..peek)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -152,14 +152,14 @@ (recur elseP) #.None - (wrap ..fail!))] - (wrap (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!)))) + (in ..fail!))] + (in (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!)))) (^template [<tag> <format> <=>] [(<tag> cons) @@ -167,34 +167,34 @@ [clauses (monad.map ! (function (_ [match then]) (do ! [then! (recur then)] - (wrap [(<=> (|> match <format>) - ..peek) - then!]))) + (in [(<=> (|> match <format>) + ..peek) + then!]))) (#.Cons cons))] - (wrap (list\fold (function (_ [when then] else) - (_.if when then else)) - ..fail! - clauses)))]) + (in (list\fold (function (_ [when then] else) + (_.if when then else)) + ..fail! + clauses)))]) ([#/////synthesis.I64_Fork //primitive.i64 //runtime.i64::=] [#/////synthesis.F64_Fork //primitive.f64 _.=] [#/////synthesis.Text_Fork //primitive.text _.=]) (^template [<pm> <flag> <prep>] [(^ (<pm> idx)) - (///////phase\wrap ($_ _.then - (_.set! $temp (|> idx <prep> .int _.int (//runtime.sum::get ..peek (//runtime.flag <flag>)))) - (_.if (_.= _.null $temp) - ..fail! - (..push_cursor! $temp))))]) + (///////phase\in ($_ _.then + (_.set! $temp (|> idx <prep> .int _.int (//runtime.sum::get ..peek (//runtime.flag <flag>)))) + (_.if (_.= _.null $temp) + ..fail! + (..push_cursor! $temp))))]) ([/////synthesis.side/left false (<|)] [/////synthesis.side/right true inc]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (_.nth (_.int +1) ..peek)) + (///////phase\in (_.nth (_.int +1) ..peek)) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))]) ([/////synthesis.member/left //runtime.tuple::left] [/////synthesis.member/right //runtime.tuple::right]) @@ -202,32 +202,32 @@ (do ///////phase.monad [leftO (recur leftP) rightO (recur rightP)] - (wrap ($_ _.then - leftO - rightO))) + (in ($_ _.then + leftO + rightO))) (^ (/////synthesis.path/alt leftP rightP)) (do {! ///////phase.monad} [leftO (recur leftP) rightO (recur rightP)] - (wrap (_.try ($_ _.then - ..save_cursor! - leftO) - #.None - (#.Some (..catch ($_ _.then - ..restore_cursor! - rightO))) - #.None))) + (in (_.try ($_ _.then + ..save_cursor! + leftO) + #.None + (#.Some (..catch ($_ _.then + ..restore_cursor! + rightO))) + #.None))) ))) (def: (pattern_matching expression archive pathP) (Generator Path) (do ///////phase.monad [pattern_matching! (pattern_matching' expression archive pathP)] - (wrap (_.try pattern_matching! - #.None - (#.Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))) - #.None)))) + (in (_.try pattern_matching! + #.None + (#.Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))) + #.None)))) (def: #export (case expression archive [valueS pathP]) (Generator [Synthesis Path]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux index f30e18def..ed2ef6a5d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux @@ -37,7 +37,7 @@ (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply argsO+ functionO)))) + (in (_.apply argsO+ functionO)))) (def: (with_closure function_id $function inits function_definition) (-> artifact.ID SVar (List Expression) Expression (Operation Expression)) @@ -47,7 +47,7 @@ [_ (/////generation.execute! function_definition) _ (/////generation.save! (%.nat function_id) function_definition)] - (wrap $function)) + (in $function)) _ (do ///////phase.monad @@ -61,7 +61,7 @@ $function)))] _ (/////generation.execute! closure_definition) _ (/////generation.save! (%.nat function_id) closure_definition)] - (wrap (_.apply inits $function))))) + (in (_.apply inits $function))))) (def: $curried (_.var "curried")) (def: $missing (_.var "missing")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux index f4887aaaa..84d61fb44 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux @@ -47,19 +47,19 @@ initsO+ (monad.map ! (expression archive) initsS+) bodyO (/////generation.with_anchor $scope (expression archive bodyS))] - (wrap (_.block - ($_ _.then - (_.set! $scope - (_.function (|> initsS+ - list.size - list.indices - (list\map (|>> (n.+ offset) //case.register))) - bodyO)) - (_.apply initsO+ $scope))))))) + (in (_.block + ($_ _.then + (_.set! $scope + (_.function (|> initsS+ + list.size + list.indices + (list\map (|>> (n.+ offset) //case.register))) + bodyO)) + (_.apply initsO+ $scope))))))) (def: #export (recur expression archive argsS+) (Generator (List Synthesis)) (do {! ///////phase.monad} [$scope /////generation.anchor argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply argsO+ $scope)))) + (in (_.apply argsO+ $scope)))) 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 f646f82cd..557d5b572 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 @@ -35,7 +35,7 @@ (Dict Text Proc)) (syntax: (Vector {size s.nat} elemT) - (wrap (list (` [(~+ (list.repeat size elemT))])))) + (in (list (` [(~+ (list.repeat size elemT))])))) (type: #export Nullary (-> (Vector +0 Expression) Expression)) (type: #export Unary (-> (Vector +1 Expression) Expression)) @@ -66,7 +66,7 @@ (with-gensyms [g!_ g!proc g!name g!translate g!inputs] (do {@ macro.monad} [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))] - (wrap (list (` (def: #export ((~ (code.local-identifier name)) (~ g!proc)) + (in (list (` (def: #export ((~ (code.local-identifier name)) (~ g!proc)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Expression) (-> Text ..Proc)) (function ((~ g!_) (~ g!name)) @@ -78,7 +78,7 @@ (list/map (function (_ g!input) (list g!input (` ((~ g!translate) (~ g!input)))))) list.concat))] - ((~' wrap) ((~ g!proc) [(~+ g!input+)]))) + ((~' in) ((~ g!proc) [(~+ g!input+)]))) (~' _) (macro.failure (wrong-arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))) @@ -94,7 +94,7 @@ (function (_ translate inputsS) (do {@ macro.Monad<Meta>} [inputsI (monad.map @ translate inputsS)] - (wrap (proc inputsI)))))) + (in (proc inputsI)))))) ## [Procedures] ## [[Lux]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux index 5dabf7f2a..74dc0231e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux @@ -28,7 +28,7 @@ ## (^ (list [_ (#.Text name)])) ## (do macro.Monad<Meta> ## [] -## (wrap name)) +## (in name)) ## _ ## (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -40,7 +40,7 @@ ## (do {@ macro.Monad<Meta>} ## [functionO (translate functionS) ## argsO+ (monad.map @ translate argsS+)] -## (wrap (lua.apply functionO argsO+))) +## (in (lua.apply functionO argsO+))) ## _ ## (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -60,7 +60,7 @@ ## (do {@ macro.Monad<Meta>} ## [tableO (translate tableS) ## argsO+ (monad.map @ translate argsS+)] -## (wrap (lua.method field tableO argsO+))) +## (in (lua.method field tableO argsO+))) ## _ ## (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) 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 017a7a547..2fbaa82f3 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 @@ -80,13 +80,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (syntax: (runtime: {declaration (<>.or <code>.local_identifier (<code>.form (<>.and <code>.local_identifier @@ -100,29 +100,29 @@ (case declaration (#.Left name) (let [g!name (code.local_identifier name)] - (wrap (list (` (def: #export (~ g!name) - _.SVar - (~ runtime_name))) - - (` (def: (~ (code.local_identifier (format "@" name))) - _.Expression - (_.set! (~ runtime_name) (~ code))))))) + (in (list (` (def: #export (~ g!name) + _.SVar + (~ runtime_name))) + + (` (def: (~ (code.local_identifier (format "@" name))) + _.Expression + (_.set! (~ runtime_name) (~ code))))))) (#.Right [name inputs]) (let [g!name (code.local_identifier name) inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) _.Expression) - (_.apply (list (~+ inputsC)) (~ runtime_name)))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) _.Expression) + (_.apply (list (~+ inputsC)) (~ runtime_name)))) - (` (def: (~ (code.local_identifier (format "@" name))) - _.Expression - (..with_vars [(~+ inputsC)] - (_.set! (~ runtime_name) - (_.function (list (~+ inputsC)) - (~ code)))))))))))))) + (` (def: (~ (code.local_identifier (format "@" name))) + _.Expression + (..with_vars [(~+ inputsC)] + (_.set! (~ runtime_name) + (_.function (list (~+ inputsC)) + (~ code)))))))))))))) (def: #export variant_tag_field "luxVT") (def: #export variant_flag_field "luxVF") @@ -846,10 +846,10 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! (%.nat ..module_id) ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [(%.nat ..module_id) - (|> ..runtime - _.code - (\ utf8.codec encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [(%.nat ..module_id) + (|> ..runtime + _.code + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux index 1020cad97..1853aa963 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux @@ -21,7 +21,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (expression archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux index 8b2a907ca..f3643d685 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -86,4 +86,4 @@ (..constant system archive value) (#reference.Variable value) - (phase\wrap (..variable system value)))) + (phase\in (..variable system value)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux index c891727e4..f4c393a19 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux @@ -66,7 +66,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] @@ -92,7 +92,7 @@ [////synthesis.function/abstraction /function.function]) (^ (////synthesis.loop/recur _)) - (//////phase.throw ..cannot-recur-as-an-expression []) + (//////phase.except ..cannot-recur-as-an-expression []) (#////synthesis.Reference value) (//reference.reference /reference.system archive value) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index 3c080ba8a..edb00ae21 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -54,19 +54,19 @@ [valueO (expression archive valueS) bodyO (expression archive bodyS)] ## TODO: Find some way to do 'let' without paying the price of the closure. - (wrap (|> bodyO - _.return - (_.lambda #.None (list (..register register))) - (_.apply_lambda/* (list valueO)))))) + (in (|> bodyO + _.return + (_.lambda #.None (list (..register register))) + (_.apply_lambda/* (list valueO)))))) (def: #export (let! statement expression archive [valueS register bodyS]) (Generator! [Synthesis Register Synthesis]) (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (wrap ($_ _.then - (_.set (list (..register register)) valueO) - bodyO)))) + (in ($_ _.then + (_.set (list (..register register)) valueO) + bodyO)))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -74,7 +74,7 @@ [testO (expression archive testS) thenO (expression archive thenS) elseO (expression archive elseS)] - (wrap (_.? testO thenO elseO)))) + (in (_.? testO thenO elseO)))) (def: #export (if! statement expression archive [testS thenS elseS]) (Generator! [Synthesis Synthesis Synthesis]) @@ -82,24 +82,24 @@ [test! (expression archive testS) then! (statement expression archive thenS) else! (statement expression archive elseS)] - (wrap (_.if test! - then! - else!)))) + (in (_.if test! + then! + else!)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] - (method source))) - valueO - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple//left] + [#.Right //runtime.tuple//right]))] + (method source))) + valueO + (list.reverse pathP))))) (def: @savepoint (_.local "lux_pm_savepoint")) (def: @cursor (_.local "lux_pm_cursor")) @@ -196,14 +196,14 @@ (recur elseP) #.None - (wrap ..fail!))] - (wrap (#.Some (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!))))) + (in ..fail!))] + (in (#.Some (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!))))) (^template [<tag> <format>] [(<tag> cons) @@ -214,14 +214,14 @@ ..peek)]) (recur then))) (#.Cons cons))] - (wrap (#.Some (_.cond clauses - ..fail!))))]) + (in (#.Some (_.cond clauses + ..fail!))))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] [#/////synthesis.F64_Fork (<| //primitive.f64)] [#/////synthesis.Text_Fork (<| //primitive.text)]) _ - (\ ///////phase.monad wrap #.None))) + (\ ///////phase.monad in #.None))) (def: (pattern_matching' in_closure? statement expression archive) (-> Bit (Generator! Path)) @@ -230,7 +230,7 @@ [?output (primitive_pattern_matching recur pathP)] (.case ?output (#.Some output) - (wrap output) + (in output) #.None (.case pathP @@ -238,10 +238,10 @@ (statement expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap ..pop!) + (///////phase\in ..pop!) (#/////synthesis.Bind register) - (///////phase\wrap (_.set (list (..register register)) ..peek)) + (///////phase\in (_.set (list (..register register)) ..peek)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -251,14 +251,14 @@ (recur elseP) #.None - (wrap ..fail!))] - (wrap (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!)))) + (in ..fail!))] + (in (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!)))) (^template [<tag> <format>] [(<tag> cons) @@ -269,15 +269,15 @@ ..peek)]) (recur then))) (#.Cons cons))] - (wrap (_.cond clauses - ..fail!)))]) + (in (_.cond clauses + ..fail!)))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] [#/////synthesis.F64_Fork (<| //primitive.f64)] [#/////synthesis.Text_Fork (<| //primitive.text)]) (^template [<complex> <simple> <choice>] [(^ (<complex> idx)) - (///////phase\wrap (<choice> false idx)) + (///////phase\in (<choice> false idx)) (^ (<simple> idx nextP)) (|> nextP @@ -287,36 +287,36 @@ [/////synthesis.side/right /////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (|> ..peek (_.nth (_.int +0)) ..push!)) + (///////phase\in (|> ..peek (_.nth (_.int +0)) ..push!)) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) (^ (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (recur thenP)] - (///////phase\wrap ($_ _.then - (_.set (list (..register register)) ..peek_and_pop) - then!))) + (///////phase\in ($_ _.then + (_.set (list (..register register)) ..peek_and_pop) + then!))) (^ (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (case.count_pops nextP)] (do ///////phase.monad [next! (recur nextP')] - (///////phase\wrap ($_ _.then - (..multi_pop! (n.+ 2 extra_pops)) - next!)))) + (///////phase\in ($_ _.then + (..multi_pop! (n.+ 2 extra_pops)) + next!)))) (^ (/////synthesis.path/seq preP postP)) (do ///////phase.monad [pre! (recur preP) post! (recur postP)] - (wrap ($_ _.then - pre! - post!))) + (in ($_ _.then + pre! + post!))) (^ (/////synthesis.path/alt preP postP)) (do ///////phase.monad @@ -324,7 +324,7 @@ post! (recur postP) g!once (..gensym "once") g!continue? (..gensym "continue")] - (wrap (..alternation in_closure? g!once g!continue? pre! post!))) + (in (..alternation in_closure? g!once g!continue? pre! post!))) _ (undefined)))))) @@ -335,21 +335,21 @@ [pattern_matching! (pattern_matching' in_closure? statement expression archive pathP) g!once (..gensym "once") g!continue? (..gensym "continue")] - (wrap ($_ _.then - (..with_looping in_closure? g!once g!continue? - pattern_matching!) - (_.statement (_.raise (_.string case.pattern_matching_error))))))) + (in ($_ _.then + (..with_looping in_closure? g!once g!continue? + pattern_matching!) + (_.statement (_.raise (_.string case.pattern_matching_error))))))) (def: #export (case! in_closure? statement expression archive [valueS pathP]) (-> Bit (Generator! [Synthesis Path])) (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching in_closure? statement expression archive pathP)] - (wrap ($_ _.then - (_.set (list @cursor) (_.array (list stack_init))) - (_.set (list @savepoint) (_.array (list))) - pattern_matching! - )))) + (in ($_ _.then + (_.set (list @cursor) (_.array (list stack_init))) + (_.set (list @savepoint) (_.array (list))) + pattern_matching! + )))) (def: #export (case statement expression archive case) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index c24efad81..eae79b459 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -36,7 +36,7 @@ (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply_lambda/* argsO+ functionO)))) + (in (_.apply_lambda/* argsO+ functionO)))) (def: #export capture (-> Register LVar) @@ -109,4 +109,4 @@ )))] _ (/////generation.execute! declaration) _ (/////generation.save! function_artifact #.None declaration)] - (wrap instatiation))) + (in instatiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index c1639df6a..14f55ae91 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -61,9 +61,9 @@ [initsO+ (monad.map ! (expression archive) initsS+) body! (/////generation.with_anchor start (statement expression archive bodyS))] - (wrap (<| (..setup start initsO+) - ..with_scope - body!))))) + (in (<| (..setup start initsO+) + ..with_scope + body!))))) (def: #export (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -76,9 +76,9 @@ _ (do {! ///////phase.monad} [body! (scope! statement expression archive [start initsS+ bodyS])] - (wrap (|> body! - (_.lambda #.None (list)) - (_.apply_lambda/* (list))))))) + (in (|> body! + (_.lambda #.None (list)) + (_.apply_lambda/* (list))))))) (def: #export (recur! statement expression archive argsS+) (Generator! (List Synthesis)) @@ -90,7 +90,7 @@ list.enumeration (list\map (function (_ [idx _]) (_.nth (_.int (.int idx)) @temp))))]] - (wrap ($_ _.then - (_.set (list @temp) (_.array argsO+)) - (..setup offset re_binds - _.next))))) + (in ($_ _.then + (_.set (list @temp) (_.array argsO+)) + (..setup offset re_binds + _.next))))) 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 9e4f78b29..1a19be4a3 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 @@ -75,13 +75,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.local (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.local (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (def: module_id 0) @@ -99,12 +99,12 @@ (#.Left name) (macro.with_gensyms [g!_] (let [g!name (code.local_identifier name)] - (wrap (list (` (def: #export (~ g!name) LVar (~ runtime_name))) - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!name)) - (_.set (list (~ g!name)) (~ code)))))))))) + (in (list (` (def: #export (~ g!name) LVar (~ runtime_name))) + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!name)) + (_.set (list (~ g!name)) (~ code)))))))))) (#.Right [name inputs]) (macro.with_gensyms [g!_] @@ -112,17 +112,17 @@ inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) Computation) - (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) - - (` (def: (~ (code.local_identifier (format "@" name))) - Statement - (..feature (~ runtime_name) - (function ((~ g!_) (~ g!_)) - (..with_vars [(~+ inputsC)] - (_.function (~ g!_) (list (~+ inputsC)) - (~ code)))))))))))))))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) Computation) + (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) + + (` (def: (~ (code.local_identifier (format "@" name))) + Statement + (..feature (~ runtime_name) + (function ((~ g!_) (~ g!_)) + (..with_vars [(~+ inputsC)] + (_.function (~ g!_) (list (~+ inputsC)) + (~ code)))))))))))))))) (def: tuple_size (_.the "length")) @@ -394,11 +394,11 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id #.None ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [..module_id - #.None - (|> ..runtime - _.code - (\ utf8.codec encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [..module_id + #.None + (|> ..runtime + _.code + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux index c172b43b8..e5d1da1ea 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux @@ -18,7 +18,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (generate archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux index 98f7b88bb..6292d9686 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux @@ -30,7 +30,7 @@ (case synthesis (^template [<tag> <generator>] [(^ (<tag> value)) - (//////phase\wrap (<generator> value))]) + (//////phase\in (<generator> value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux index 99d115b9d..43409b31d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux @@ -49,8 +49,8 @@ (do ///////phase.monad [valueO (expression archive valueS) bodyO (expression archive bodyS)] - (wrap (_.let (list [(..register register) valueO]) - bodyO)))) + (in (_.let (list [(..register register) valueO]) + bodyO)))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -58,22 +58,22 @@ [testO (expression archive testS) thenO (expression archive thenS) elseO (expression archive elseS)] - (wrap (_.if testO thenO elseO)))) + (in (_.if testO thenO elseO)))) (def: #export (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) (do ///////phase.monad [valueO (expression archive valueS)] - (wrap (list\fold (function (_ side source) - (.let [method (.case side - (^template [<side> <accessor>] - [(<side> lefts) - (<accessor> (_.int (.int lefts)))]) - ([#.Left //runtime.tuple//left] - [#.Right //runtime.tuple//right]))] - (method source))) - valueO - (list.reverse pathP))))) + (in (list\fold (function (_ side source) + (.let [method (.case side + (^template [<side> <accessor>] + [(<side> lefts) + (<accessor> (_.int (.int lefts)))]) + ([#.Left //runtime.tuple//left] + [#.Right //runtime.tuple//right]))] + (method source))) + valueO + (list.reverse pathP))))) (def: @savepoint (_.var "lux_pm_cursor_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) @@ -133,10 +133,10 @@ (expression archive bodyS) #/////synthesis.Pop - (///////phase\wrap pop_cursor!) + (///////phase\in pop_cursor!) (#/////synthesis.Bind register) - (///////phase\wrap (_.define_constant (..register register) ..peek)) + (///////phase\in (_.define_constant (..register register) ..peek)) (#/////synthesis.Bit_Fork when thenP elseP) (do {! ///////phase.monad} @@ -146,14 +146,14 @@ (recur elseP) #.None - (wrap ..fail!))] - (wrap (.if when - (_.if ..peek - then! - else!) - (_.if ..peek - else! - then!)))) + (in ..fail!))] + (in (.if when + (_.if ..peek + then! + else!) + (_.if ..peek + else! + then!)))) (^template [<tag> <format> <=>] [(<tag> cons) @@ -161,33 +161,33 @@ [clauses (monad.map ! (function (_ [match then]) (do ! [then! (recur then)] - (wrap [(<=> (|> match <format>) - ..peek) - then!]))) + (in [(<=> (|> match <format>) + ..peek) + then!]))) (#.Cons cons))] - (wrap (list\fold (function (_ [when then] else) - (_.if when then else)) - ..fail! - clauses)))]) + (in (list\fold (function (_ [when then] else) + (_.if when then else)) + ..fail! + clauses)))]) ([#/////synthesis.I64_Fork //primitive.i64 _.=/2] [#/////synthesis.F64_Fork //primitive.f64 _.=/2] [#/////synthesis.Text_Fork //primitive.text _.string=?/2]) (^template [<pm> <flag> <prep>] [(^ (<pm> idx)) - (///////phase\wrap (_.let (list [@temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek (_.bool <flag>)))]) - (_.if (_.null?/1 @temp) - ..fail! - (push_cursor! @temp))))]) + (///////phase\in (_.let (list [@temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek (_.bool <flag>)))]) + (_.if (_.null?/1 @temp) + ..fail! + (push_cursor! @temp))))]) ([/////synthesis.side/left false (<|)] [/////synthesis.side/right true inc]) (^ (/////synthesis.member/left 0)) - (///////phase\wrap (..push_cursor! (_.vector-ref/2 ..peek (_.int +0)))) + (///////phase\in (..push_cursor! (_.vector-ref/2 ..peek (_.int +0)))) (^template [<pm> <getter>] [(^ (<pm> lefts)) - (///////phase\wrap (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))]) + (///////phase\in (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) @@ -195,17 +195,17 @@ (do ///////phase.monad [leftO (recur leftP) rightO (recur rightP)] - (wrap (_.begin (list leftO - rightO)))) + (in (_.begin (list leftO + rightO)))) (^ (/////synthesis.path/alt leftP rightP)) (do {! ///////phase.monad} [leftO (recur leftP) rightO (recur rightP)] - (wrap (try_pm (_.begin (list restore_cursor! - rightO)) - (_.begin (list save_cursor! - leftO))))) + (in (try_pm (_.begin (list restore_cursor! + rightO)) + (_.begin (list save_cursor! + leftO))))) ))) (def: (pattern_matching expression archive pathP) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux index 0275e8cd9..74362d6ad 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux @@ -29,7 +29,7 @@ ["#." synthesis (#+ Synthesis)]]]]) (syntax: (Vector {size s.nat} elemT) - (wrap (list (` [(~+ (list.repeat size elemT))])))) + (in (list (` [(~+ (list.repeat size elemT))])))) (type: #export Nullary (-> (Vector 0 Expression) Computation)) (type: #export Unary (-> (Vector 1 Expression) Computation)) @@ -39,23 +39,23 @@ (syntax: (arity: {name s.local-identifier} {arity s.nat}) (with-gensyms [g!_ g!extension g!name g!phase g!inputs] - (do {! macro.monad} - [g!input+ (monad.seq ! (list.repeat arity (macro.gensym "input")))] - (wrap (list (` (def: #export ((~ (code.local-identifier name)) (~ g!extension)) - (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) - Handler) - (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs)) - (case (~ g!inputs) - (^ (list (~+ g!input+))) - (do /////.monad - [(~+ (|> g!input+ - (list\map (function (_ g!input) - (list g!input (` ((~ g!phase) (~ g!input)))))) - list.concat))] - ((~' wrap) ((~ g!extension) [(~+ g!input+)]))) - - (~' _) - (/////.throw /////extension.incorrect-arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) + (do {! macro.monad} + [g!input+ (monad.seq ! (list.repeat arity (macro.gensym "input")))] + (in (list (` (def: #export ((~ (code.local-identifier name)) (~ g!extension)) + (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) + Handler) + (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!inputs)) + (case (~ g!inputs) + (^ (list (~+ g!input+))) + (do /////.monad + [(~+ (|> g!input+ + (list\map (function (_ g!input) + (list g!input (` ((~ g!phase) (~ g!input)))))) + list.concat))] + ((~' in) ((~ g!extension) [(~+ g!input+)]))) + + (~' _) + (/////.except /////extension.incorrect-arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) (arity: nullary 0) (arity: unary 1) @@ -68,7 +68,7 @@ (function (_ phase inputsS) (do {! /////.monad} [inputsI (monad.map ! phase inputsS)] - (wrap (extension inputsI)))))) + (in (extension inputsI)))))) (def: bundle::lux Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux index b12ddcde3..dbf2c47b9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux @@ -34,7 +34,7 @@ (do {! ///////phase.monad} [functionO (expression archive functionS) argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply/* argsO+ functionO)))) + (in (_.apply/* argsO+ functionO)))) (def: capture (-> Register Var) @@ -42,7 +42,7 @@ (def: (with_closure inits function_definition) (-> (List Expression) Computation (Operation Computation)) - (///////phase\wrap + (///////phase\in (case inits #.Nil function_definition diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux index 23718bfc5..3010bf016 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux @@ -49,16 +49,16 @@ [initsO+ (monad.map ! (expression archive) initsS+) bodyO (/////generation.with_anchor @scope (expression archive bodyS))] - (wrap (_.letrec (list [@scope (_.lambda [(|> initsS+ - list.enumeration - (list\map (|>> product.left (n.+ start) //case.register))) - #.None] - bodyO)]) - (_.apply/* initsO+ @scope)))))) + (in (_.letrec (list [@scope (_.lambda [(|> initsS+ + list.enumeration + (list\map (|>> product.left (n.+ start) //case.register))) + #.None] + bodyO)]) + (_.apply/* initsO+ @scope)))))) (def: #export (recur expression archive argsS+) (Generator (List Synthesis)) (do {! ///////phase.monad} [@scope /////generation.anchor argsO+ (monad.map ! (expression archive) argsS+)] - (wrap (_.apply/* argsO+ @scope)))) + (in (_.apply/* argsO+ @scope)))) 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 f383839f3..de05f8c6e 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 @@ -62,13 +62,13 @@ body) (do {! meta.monad} [ids (monad.seq ! (list.repeat (list.size vars) meta.count))] - (wrap (list (` (let [(~+ (|> vars - (list.zipped/2 ids) - (list\map (function (_ [id var]) - (list (code.local_identifier var) - (` (_.var (~ (code.text (format "v" (%.nat id))))))))) - list.concat))] - (~ body))))))) + (in (list (` (let [(~+ (|> vars + (list.zipped/2 ids) + (list\map (function (_ [id var]) + (list (code.local_identifier var) + (` (_.var (~ (code.text (format "v" (%.nat id))))))))) + list.concat))] + (~ body))))))) (syntax: (runtime: {declaration (<>.or <code>.local_identifier (<code>.form (<>.and <code>.local_identifier @@ -82,28 +82,28 @@ (case declaration (#.Left name) (let [g!name (code.local_identifier name)] - (wrap (list (` (def: #export (~ g!name) - Var - (~ runtime_name))) - - (` (def: (~ (code.local_identifier (format "@" name))) - _.Computation - (_.define_constant (~ runtime_name) (~ code))))))) + (in (list (` (def: #export (~ g!name) + Var + (~ runtime_name))) + + (` (def: (~ (code.local_identifier (format "@" name))) + _.Computation + (_.define_constant (~ runtime_name) (~ code))))))) (#.Right [name inputs]) (let [g!name (code.local_identifier name) inputsC (list\map code.local_identifier inputs) inputs_typesC (list\map (function.constant (` _.Expression)) inputs)] - (wrap (list (` (def: #export ((~ g!name) (~+ inputsC)) - (-> (~+ inputs_typesC) _.Computation) - (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) + (in (list (` (def: #export ((~ g!name) (~+ inputsC)) + (-> (~+ inputs_typesC) _.Computation) + (_.apply/* (list (~+ inputsC)) (~ runtime_name)))) - (` (def: (~ (code.local_identifier (format "@" name))) - _.Computation - (..with_vars [(~+ inputsC)] - (_.define_function (~ runtime_name) [(list (~+ inputsC)) #.None] - (~ code))))))))))))) + (` (def: (~ (code.local_identifier (format "@" name))) + _.Computation + (..with_vars [(~+ inputsC)] + (_.define_function (~ runtime_name) [(list (~+ inputsC)) #.None] + (~ code))))))))))))) (def: last_index (-> Expression Computation) @@ -361,10 +361,10 @@ (do ///////phase.monad [_ (/////generation.execute! ..runtime) _ (/////generation.save! (%.nat ..module_id) ..runtime)] - (wrap [(|> artifact.empty - artifact.resource - product.right) - (row.row [(%.nat ..module_id) - (|> ..runtime - _.code - (\ utf8.codec encode))])]))) + (in [(|> artifact.empty + artifact.resource + product.right) + (row.row [(%.nat ..module_id) + (|> ..runtime + _.code + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux index 50a8357f7..46237d2a2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux @@ -21,7 +21,7 @@ (Generator (Tuple Synthesis)) (case elemsS+ #.Nil - (///////phase\wrap (//primitive.text /////synthesis.unit)) + (///////phase\in (//primitive.text /////synthesis.unit)) (#.Cons singletonS #.Nil) (expression archive singletonS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux index 47260c0fc..306dfc48a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux @@ -50,10 +50,10 @@ (function (optimization' analysis) (case analysis (#///analysis.Primitive analysis') - (phase\wrap (#/.Primitive (..primitive analysis'))) + (phase\in (#/.Primitive (..primitive analysis'))) (#///analysis.Reference reference) - (phase\wrap (#/.Reference reference)) + (phase\in (#/.Reference reference)) (#///analysis.Structure structure) (/.with_currying? false @@ -61,7 +61,7 @@ (#///analysis.Variant variant) (do phase.monad [valueS (optimization' (get@ #///analysis.value variant))] - (wrap (/.variant (set@ #///analysis.value valueS variant)))) + (in (/.variant (set@ #///analysis.value valueS variant)))) (#///analysis.Tuple tuple) (|> tuple diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index e0f9ea89e..d004e97ef 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -228,7 +228,7 @@ (do {! ///.monad} [headSP (path archive synthesize headP headA) tailSP+ (monad.map ! (product.uncurry (path archive synthesize)) tailPA+)] - (wrap (/.branch/case [input (list\fold weave headSP tailSP+)])))) + (in (/.branch/case [input (list\fold weave headSP tailSP+)])))) (template: (!masking <variable> <output>) [[(#///analysis.Bind <variable>) @@ -240,12 +240,12 @@ (do ///.monad [body (/.with_new_local (synthesize archive body))] - (wrap (/.branch/let [input @variable body])))) + (in (/.branch/let [input @variable body])))) (def: #export (synthesize_masking synthesize archive input @variable @output) (-> Phase Archive Synthesis Register Register (Operation Synthesis)) (if (n.= @variable @output) - (///\wrap input) + (///\in input) (..synthesize_let synthesize archive input @variable (#///analysis.Reference (///reference.local @output))))) (def: #export (synthesize_if synthesize archive test then else) @@ -253,7 +253,7 @@ (do ///.monad [then (synthesize archive then) else (synthesize archive else)] - (wrap (/.branch/if [test then else])))) + (in (/.branch/if [test then else])))) (template: (!get <patterns> <output>) [[(///analysis.pattern/tuple <patterns>) @@ -269,10 +269,10 @@ path (case input (^ (/.branch/get [sub_path sub_input])) - (///\wrap (/.branch/get [(list\compose path sub_path) sub_input])) + (///\in (/.branch/get [(list\compose path sub_path) sub_input])) _ - (///\wrap (/.branch/get [path input]))))) + (///\in (/.branch/get [path input]))))) (def: #export (synthesize synthesize^ [headB tailB+] archive inputA) (-> Phase Match Phase) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 2b0319266..10a5c6eec 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -59,49 +59,49 @@ (list.size argsS)) (do ! [locals /.locals] - (wrap (|> functionS - (//loop.optimization true locals argsS) - (maybe\map (: (-> [Nat (List Synthesis) Synthesis] Synthesis) - (function (_ [start inits iteration]) - (case iteration - (^ (/.loop/scope [start' inits' output])) - (if (and (n.= start start') - (list.empty? inits')) - (/.loop/scope [start inits output]) - (/.loop/scope [start inits iteration])) + (in (|> functionS + (//loop.optimization true locals argsS) + (maybe\map (: (-> [Nat (List Synthesis) Synthesis] Synthesis) + (function (_ [start inits iteration]) + (case iteration + (^ (/.loop/scope [start' inits' output])) + (if (and (n.= start start') + (list.empty? inits')) + (/.loop/scope [start inits output]) + (/.loop/scope [start inits iteration])) - _ - (/.loop/scope [start inits iteration]))))) - (maybe.default <apply>)))) - (wrap <apply>)) + _ + (/.loop/scope [start inits iteration]))))) + (maybe.default <apply>)))) + (in <apply>)) (^ (/.function/apply [funcS' argsS'])) - (wrap (/.function/apply [funcS' (list\compose argsS' argsS)])) + (in (/.function/apply [funcS' (list\compose argsS' argsS)])) _ - (wrap <apply>))))))) + (in <apply>))))))) (def: (find_foreign environment register) (-> (Environment Synthesis) Register (Operation Synthesis)) (case (list.nth register environment) (#.Some aliased) - (phase\wrap aliased) + (phase\in aliased) #.None - (phase.throw ..cannot_find_foreign_variable_in_environment [register environment]))) + (phase.except ..cannot_find_foreign_variable_in_environment [register environment]))) (def: (grow_path grow path) (-> (-> Synthesis (Operation Synthesis)) Path (Operation Path)) (case path (#/.Bind register) - (phase\wrap (#/.Bind (inc register))) + (phase\in (#/.Bind (inc register))) (^template [<tag>] [(<tag> left right) (do phase.monad [left' (grow_path grow left) right' (grow_path grow right)] - (wrap (<tag> left' right')))]) + (in (<tag> left' right')))]) ([#/.Alt] [#/.Seq]) (#/.Bit_Fork when then else) @@ -112,8 +112,8 @@ (\ ! map (|>> #.Some) (grow_path grow else)) #.None - (wrap #.None))] - (wrap (#/.Bit_Fork when then else))) + (in #.None))] + (in (#/.Bit_Fork when then else))) (^template [<tag>] [(<tag> [[test then] elses]) @@ -122,9 +122,9 @@ elses (monad.map ! (function (_ [else_test else_then]) (do ! [else_then (grow_path grow else_then)] - (wrap [else_test else_then]))) + (in [else_test else_then]))) elses)] - (wrap (<tag> [[test then] elses])))]) + (in (<tag> [[test then] elses])))]) ([#/.I64_Fork] [#/.F64_Fork] [#/.Text_Fork]) @@ -135,7 +135,7 @@ (phase\map (|>> #/.Then))) _ - (phase\wrap path))) + (phase\in path))) (def: (grow environment expression) (-> (Environment Synthesis) Synthesis (Operation Synthesis)) @@ -153,20 +153,20 @@ (phase\map (|>> /.tuple)))) (^ (..self_reference)) - (phase\wrap (/.function/apply [expression (list (/.variable/local 1))])) + (phase\in (/.function/apply [expression (list (/.variable/local 1))])) (#/.Reference reference) (case reference (#////reference.Variable variable) (case variable (#////reference/variable.Local register) - (phase\wrap (/.variable/local (inc register))) + (phase\in (/.variable/local (inc register))) (#////reference/variable.Foreign register) (..find_foreign environment register)) (#////reference.Constant constant) - (phase\wrap expression)) + (phase\in expression)) (#/.Control control) (case control @@ -176,25 +176,25 @@ (do phase.monad [inputS' (grow environment inputS) bodyS' (grow environment bodyS)] - (wrap (/.branch/let [inputS' (inc register) bodyS']))) + (in (/.branch/let [inputS' (inc register) bodyS']))) (#/.If [testS thenS elseS]) (do phase.monad [testS' (grow environment testS) thenS' (grow environment thenS) elseS' (grow environment elseS)] - (wrap (/.branch/if [testS' thenS' elseS']))) + (in (/.branch/if [testS' thenS' elseS']))) (#/.Get members inputS) (do phase.monad [inputS' (grow environment inputS)] - (wrap (/.branch/get [members inputS']))) + (in (/.branch/get [members inputS']))) (#/.Case [inputS pathS]) (do phase.monad [inputS' (grow environment inputS) pathS' (grow_path (grow environment) pathS)] - (wrap (/.branch/case [inputS' pathS'])))) + (in (/.branch/case [inputS' pathS'])))) (#/.Loop loop) (case loop @@ -202,7 +202,7 @@ (do {! phase.monad} [initsS+' (monad.map ! (grow environment) initsS+) iterationS' (grow environment iterationS)] - (wrap (/.loop/scope [(inc start) initsS+' iterationS']))) + (in (/.loop/scope [(inc start) initsS+' iterationS']))) (#/.Recur argumentsS+) (|> argumentsS+ @@ -220,20 +220,20 @@ captured (grow environment captured))) _env)] - (wrap (/.function/abstraction [_env' _arity _body]))) + (in (/.function/abstraction [_env' _arity _body]))) (#/.Apply funcS argsS+) (do {! phase.monad} [funcS (grow environment funcS) argsS+ (monad.map ! (grow environment) argsS+)] - (wrap (/.function/apply (case funcS - (^ (/.function/apply [(..self_reference) pre_argsS+])) - [(..self_reference) - (list\compose pre_argsS+ argsS+)] + (in (/.function/apply (case funcS + (^ (/.function/apply [(..self_reference) pre_argsS+])) + [(..self_reference) + (list\compose pre_argsS+ argsS+)] - _ - [funcS - argsS+])))))) + _ + [funcS + argsS+])))))) (#/.Extension name argumentsS+) (|> argumentsS+ @@ -241,7 +241,7 @@ (phase\map (|>> (#/.Extension name)))) (#/.Primitive _) - (phase\wrap expression))) + (phase\in expression))) (def: #export (abstraction phase environment archive bodyA) (-> Phase (Environment Analysis) Phase) @@ -262,16 +262,16 @@ #/.body body}))) _ - (wrap {#/.environment environment - #/.arity 1 - #/.body bodyS})))] - (wrap (if currying? - (/.function/abstraction abstraction) - (case (//loop.optimization false 1 (list) abstraction) - (#.Some [startL initsL bodyL]) - (/.function/abstraction {#/.environment environment - #/.arity (get@ #/.arity abstraction) - #/.body (/.loop/scope [startL initsL bodyL])}) - - #.None - (/.function/abstraction abstraction)))))) + (in {#/.environment environment + #/.arity 1 + #/.body bodyS})))] + (in (if currying? + (/.function/abstraction abstraction) + (case (//loop.optimization false 1 (list) abstraction) + (#.Some [startL initsL bodyL]) + (/.function/abstraction {#/.environment environment + #/.arity (get@ #/.arity abstraction) + #/.body (/.loop/scope [startL initsL bodyL])}) + + #.None + (/.function/abstraction abstraction)))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index ed5381e02..f64693134 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -37,7 +37,7 @@ (do maybe.monad [left' (recur left) right' (recur right)] - (wrap (<tag> left' right')))]) + (in (<tag> left' right')))]) ([#/.Alt] [#/.Seq]) (#/.Bit_Fork when then else) @@ -48,8 +48,8 @@ (\ ! map (|>> #.Some) (recur else)) #.None - (wrap #.None))] - (wrap (#/.Bit_Fork when then else))) + (in #.None))] + (in (#/.Bit_Fork when then else))) (^template [<tag>] [(<tag> [[test then] elses]) @@ -58,9 +58,9 @@ elses (monad.map ! (function (_ [else_test else_then]) (do ! [else_then (recur else_then)] - (wrap [else_test else_then]))) + (in [else_test else_then]))) elses)] - (wrap (<tag> [[test then] elses])))]) + (in (<tag> [[test then] elses])))]) ([#/.I64_Fork] [#/.F64_Fork] [#/.Text_Fork]) @@ -86,9 +86,9 @@ (#analysis.Variant variant) (do maybe.monad [value' (|> variant (get@ #analysis.value) (recur false))] - (wrap (|> variant - (set@ #analysis.value value') - /.variant))) + (in (|> variant + (set@ #analysis.value value') + /.variant))) (#analysis.Tuple tuple) (|> tuple @@ -117,25 +117,25 @@ (do maybe.monad [input' (recur false input) path' (path_optimization (recur return?) offset path)] - (wrap (|> path' [input'] /.branch/case))) + (in (|> path' [input'] /.branch/case))) (^ (/.branch/let [input register body])) (do maybe.monad [input' (recur false input) body' (recur return? body)] - (wrap (/.branch/let [input' (register_optimization offset register) body']))) + (in (/.branch/let [input' (register_optimization offset register) body']))) (^ (/.branch/if [input then else])) (do maybe.monad [input' (recur false input) then' (recur return? then) else' (recur return? else)] - (wrap (/.branch/if [input' then' else']))) + (in (/.branch/if [input' then' else']))) (^ (/.branch/get [path record])) (do maybe.monad [record (recur false record)] - (wrap (/.branch/get [path record]))) + (in (/.branch/get [path record]))) (^ (/.loop/scope scope)) (do {! maybe.monad} @@ -143,9 +143,9 @@ (get@ #/.inits) (monad.map ! (recur false))) iteration' (recur return? (get@ #/.iteration scope))] - (wrap (/.loop/scope {#/.start (|> scope (get@ #/.start) (register_optimization offset)) - #/.inits inits' - #/.iteration iteration'}))) + (in (/.loop/scope {#/.start (|> scope (get@ #/.start) (register_optimization offset)) + #/.inits inits' + #/.iteration iteration'}))) (^ (/.loop/recur args)) (|> args @@ -155,19 +155,19 @@ (^ (/.function/abstraction [environment arity body])) (do {! maybe.monad} [environment' (monad.map ! (recur false) environment)] - (wrap (/.function/abstraction [environment' arity body]))) + (in (/.function/abstraction [environment' arity body]))) (^ (/.function/apply [abstraction arguments])) (do {! maybe.monad} [arguments' (monad.map maybe.monad (recur false) arguments)] (with_expansions [<application> (as_is (do ! [abstraction' (recur false abstraction)] - (wrap (/.function/apply [abstraction' arguments']))))] + (in (/.function/apply [abstraction' arguments']))))] (case abstraction (^ (#/.Reference (#reference.Variable (variable.self)))) (if (and return? (n.= arity (list.size arguments))) - (wrap (/.loop/recur arguments')) + (in (/.loop/recur arguments')) (if true_loop? #.None <application>)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 9e292c485..074790e37 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -205,8 +205,8 @@ (do try.monad [[redundancy head] (optimization [redundancy head]) [redundancy tail] (recur [redundancy tail])] - (wrap [redundancy - (#.Cons head tail)]))))) + (in [redundancy + (#.Cons head tail)]))))) (template [<name>] [(exception: #export (<name> {register Register}) @@ -224,13 +224,13 @@ (#try.Success (dictionary.put register ..redundant! redundancy)) (#.Some _) - (exception.throw ..redundant_declaration [register]))) + (exception.except ..redundant_declaration [register]))) (def: (observe register redundancy) (-> Register Redundancy (Try Redundancy)) (case (dictionary.get register redundancy) #.None - (exception.throw ..unknown_register [register]) + (exception.except ..unknown_register [register]) (#.Some _) (#try.Success (dictionary.put register ..necessary! redundancy)))) @@ -263,8 +263,8 @@ (recur [redundancy else])) #.None - (wrap [redundancy #.None]))] - (wrap [redundancy (#/.Bit_Fork when then else)])) + (in [redundancy #.None]))] + (in [redundancy (#/.Bit_Fork when then else)])) (^template [<tag> <type>] [(<tag> [[test then] elses]) @@ -274,9 +274,9 @@ (function (_ [redundancy [else_test else_then]]) (do ! [[redundancy else_then] (recur [redundancy else_then])] - (wrap [redundancy [else_test else_then]])))) + (in [redundancy [else_test else_then]])))) [redundancy elses])] - (wrap [redundancy (<tag> [[test then] elses])]))]) + (in [redundancy (<tag> [[test then] elses])]))]) ([#/.I64_Fork (I64 Any)] [#/.F64_Fork Frac] [#/.Text_Fork Text]) @@ -284,14 +284,14 @@ (#/.Bind register) (do try.monad [redundancy (..declare register redundancy)] - (wrap [redundancy - path])) + (in [redundancy + path])) (#/.Alt left right) (do try.monad [[redundancy left] (recur [redundancy left]) [redundancy right] (recur [redundancy right])] - (wrap [redundancy (#/.Alt left right)])) + (in [redundancy (#/.Alt left right)])) (#/.Seq pre post) (do try.monad @@ -310,15 +310,15 @@ (and (set.member? bindings register) redundant?))) (list\map product.left))]] - (wrap [(list\fold dictionary.remove redundancy (set.to_list bindings)) - (|> redundants - (list.sort n.>) - (list\fold (..remove_local_from_path ..remove_local) (#/.Seq pre post)))])) + (in [(list\fold dictionary.remove redundancy (set.to_list bindings)) + (|> redundants + (list.sort n.>) + (list\fold (..remove_local_from_path ..remove_local) (#/.Seq pre post)))])) (#/.Then then) (do try.monad [[redundancy then] (optimization [redundancy then])] - (wrap [redundancy (#/.Then then)])) + (in [redundancy (#/.Then then)])) ))) (def: (optimization' [redundancy synthesis]) @@ -334,14 +334,14 @@ (#analysis.Variant [lefts right value]) (do try.monad [[redundancy value] (optimization' [redundancy value])] - (wrap [redundancy - (#/.Structure (#analysis.Variant [lefts right value]))])) + (in [redundancy + (#/.Structure (#analysis.Variant [lefts right value]))])) (#analysis.Tuple tuple) (do try.monad [[redundancy tuple] (..list_optimization optimization' [redundancy tuple])] - (wrap [redundancy - (#/.Structure (#analysis.Tuple tuple))]))) + (in [redundancy + (#/.Structure (#analysis.Tuple tuple))]))) (#/.Reference reference) (case reference @@ -370,33 +370,33 @@ #let [redundant? (|> redundancy (dictionary.get register) (maybe.default ..necessary!))]] - (wrap [(dictionary.remove register redundancy) - (#/.Control (if redundant? - (#/.Branch (#/.Case input - (#/.Seq #/.Pop - (#/.Then (..remove_local register output))))) - (#/.Branch (#/.Let input register output))))])) + (in [(dictionary.remove register redundancy) + (#/.Control (if redundant? + (#/.Branch (#/.Case input + (#/.Seq #/.Pop + (#/.Then (..remove_local register output))))) + (#/.Branch (#/.Let input register output))))])) (#/.If test then else) (do try.monad [[redundancy test] (optimization' [redundancy test]) [redundancy then] (optimization' [redundancy then]) [redundancy else] (optimization' [redundancy else])] - (wrap [redundancy - (#/.Control (#/.Branch (#/.If test then else)))])) + (in [redundancy + (#/.Control (#/.Branch (#/.If test then else)))])) (#/.Get path record) (do try.monad [[redundancy record] (optimization' [redundancy record])] - (wrap [redundancy - (#/.Control (#/.Branch (#/.Get path record)))])) + (in [redundancy + (#/.Control (#/.Branch (#/.Get path record)))])) (#/.Case input path) (do try.monad [[redundancy input] (optimization' [redundancy input]) [redundancy path] (..path_optimization optimization' [redundancy path])] - (wrap [redundancy - (#/.Control (#/.Branch (#/.Case input path)))]))) + (in [redundancy + (#/.Control (#/.Branch (#/.Case input path)))]))) (#/.Loop loop) (case loop @@ -405,14 +405,14 @@ [[redundancy inits] (..list_optimization optimization' [redundancy inits]) #let [[extension redundancy] (..extended start (list.size inits) redundancy)] [redundancy iteration] (optimization' [redundancy iteration])] - (wrap [(list\fold dictionary.remove redundancy extension) - (#/.Control (#/.Loop (#/.Scope [start inits iteration])))])) + (in [(list\fold dictionary.remove redundancy extension) + (#/.Control (#/.Loop (#/.Scope [start inits iteration])))])) (#/.Recur resets) (do try.monad [[redundancy resets] (..list_optimization optimization' [redundancy resets])] - (wrap [redundancy - (#/.Control (#/.Loop (#/.Recur resets)))]))) + (in [redundancy + (#/.Control (#/.Loop (#/.Recur resets)))]))) (#/.Function function) (case function @@ -420,21 +420,21 @@ (do {! try.monad} [[redundancy environment] (..list_optimization optimization' [redundancy environment]) [_ body] (optimization' [(..default arity) body])] - (wrap [redundancy - (#/.Control (#/.Function (#/.Abstraction [environment arity body])))])) + (in [redundancy + (#/.Control (#/.Function (#/.Abstraction [environment arity body])))])) (#/.Apply abstraction inputs) (do try.monad [[redundancy abstraction] (optimization' [redundancy abstraction]) [redundancy inputs] (..list_optimization optimization' [redundancy inputs])] - (wrap [redundancy - (#/.Control (#/.Function (#/.Apply abstraction inputs)))])))) + (in [redundancy + (#/.Control (#/.Function (#/.Apply abstraction inputs)))])))) (#/.Extension name inputs) (do try.monad [[redundancy inputs] (..list_optimization optimization' [redundancy inputs])] - (wrap [redundancy - (#/.Extension name inputs)]))))) + (in [redundancy + (#/.Extension name inputs)]))))) (def: #export optimization (-> Synthesis (Try Synthesis)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux index f33831904..3f988197f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux @@ -42,16 +42,16 @@ (do ! [id (archive.id module archive) [descriptor document] (archive.find module archive)] - (wrap [[module id] (get@ #descriptor.registry descriptor)])))))] + (in [[module id] (get@ #descriptor.registry descriptor)])))))] (case (list.one (function (_ [[module module-id] registry]) (do maybe.monad [program-id (artifact.remember ..name registry)] - (wrap [module-id program-id]))) + (in [module-id program-id]))) registries) (#.Some program-context) - (wrap program-context) + (in program-context) #.None (|> registries (list\map (|>> product.left product.left)) - (exception.throw ..cannot-find-program))))) + (exception.except ..cannot-find-program))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index 4442bd5f3..a87745390 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -95,15 +95,15 @@ (#try.Success id) #.None - (exception.throw ..unknown_document [module - (dictionary.keys resolver)])))) + (exception.except ..unknown_document [module + (dictionary.keys resolver)])))) (def: #export (reserve module archive) (-> Module Archive (Try [ID Archive])) (let [(^slots [#..next #..resolver]) (:representation archive)] (case (dictionary.get module resolver) (#.Some _) - (exception.throw ..module_has_already_been_reserved [module]) + (exception.except ..module_has_already_been_reserved [module]) #.None (#try.Success [next @@ -127,10 +127,10 @@ (if (is? document existing_document) ## TODO: Find out why this code allows for the same module to be added more than once. It looks fishy... (#try.Success archive) - (exception.throw ..cannot_replace_document [module existing_document document])) + (exception.except ..cannot_replace_document [module existing_document document])) #.None - (exception.throw ..module_must_be_reserved_before_it_can_be_added [module])))) + (exception.except ..module_must_be_reserved_before_it_can_be_added [module])))) (def: #export (find module archive) (-> Module Archive (Try [Descriptor (Document Any) Output])) @@ -140,11 +140,11 @@ (#try.Success entry) (#.Some [id #.None]) - (exception.throw ..module_is_only_reserved [module]) + (exception.except ..module_is_only_reserved [module]) #.None - (exception.throw ..unknown_document [module - (dictionary.keys resolver)])))) + (exception.except ..unknown_document [module + (dictionary.keys resolver)])))) (def: #export (archived? archive module) (-> Archive Module Bit) @@ -275,10 +275,10 @@ (n\= expected actual)) _ (exception.assert ..corrupt_data [] (correct_reservations? reservations))] - (wrap (:abstraction - {#next next - #resolver (list\fold (function (_ [module id] archive) - (dictionary.put module [id #.None] archive)) - (get@ #resolver (:representation ..empty)) - reservations)})))) + (in (:abstraction + {#next next + #resolver (list\fold (function (_ [module id] archive) + (dictionary.put module [id #.None] archive)) + (get@ #resolver (:representation ..empty)) + reservations)})))) ) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux index 2c602ac89..08d1af30f 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/descriptor.lux @@ -43,7 +43,7 @@ <b>.text <b>.text <b>.nat - (\ <>.monad wrap #.Cached) + (\ <>.monad in #.Cached) (<b>.set text.hash <b>.text) artifact.parser )) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux index 3e2e86663..b8af027c1 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -41,8 +41,8 @@ e (:assume document//content))) - (exception.throw ..invalid_signature [(key.signature key) - document//signature])))) + (exception.except ..invalid_signature [(key.signature key) + document//signature])))) (def: #export (write key content) (All [d] (-> (Key d) d (Document d))) @@ -53,7 +53,7 @@ (All [d] (-> (Key d) (Document Any) (Try (Document d)))) (do try.monad [_ (..read key document)] - (wrap (:assume document)))) + (in (:assume document)))) (def: #export signature (-> (Document Any) Signature) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux index 3ba514b5f..37e5f7cfa 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux @@ -62,7 +62,7 @@ (#try.Failure error) ..fresh)] ancestors (monad.map ! recur (set.to_list parents))] - (wrap (list\fold set.union parents ancestors))))) + (in (list\fold set.union parents ancestors))))) ancestry (memo.open memo)] (list\fold (function (_ module memory) (if (dictionary.key? memory module) @@ -94,4 +94,4 @@ [module_id (archive.id module archive) [descriptor document output] (archive.find module archive) document (document.check key document)] - (wrap [module [module_id [descriptor document output]]]))))))) + (in [module [module_id [descriptor document output]]]))))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io.lux b/stdlib/source/library/lux/tool/compiler/meta/io.lux index fe11727b7..8802d00bd 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io.lux @@ -12,7 +12,7 @@ (type: #export Code Text) -(def: #export (sanitize system) +(def: #export (safe system) (All [m] (-> (System m) Text Text)) (text.replace_all "/" (\ system separator))) 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 ba2cec5c2..ee2e507e8 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -95,7 +95,7 @@ (do async.monad [? (\ fs directory? path)] (if ? - (wrap (#try.Success [])) + (in (#try.Success [])) (\ fs make_directory path)))) (def: #export (prepare fs static module_id) @@ -104,7 +104,7 @@ [#let [module (..module fs static module_id)] module_exists? (\ fs directory? module)] (if module_exists? - (wrap (#try.Success [])) + (in (#try.Success [])) (do (try.with !) [_ (ensure_directory fs (..unversioned_lux_archive fs static)) _ (ensure_directory fs (..versioned_lux_archive fs static))] @@ -114,9 +114,9 @@ (#try.Success []) (#try.Failure error) - (exception.throw ..cannot_prepare [(..archive fs static) - module_id - error]))))))))) + (exception.except ..cannot_prepare [(..archive fs static) + module_id + error]))))))))) (def: #export (write fs static module_id artifact_id content) (-> (file.System Async) Static archive.ID artifact.ID Binary (Async (Try Any))) @@ -172,9 +172,9 @@ (do ! [[descriptor document output] (archive.find module archive) content (document.read $.key document)] - (wrap [module content]))) + (in [module content]))) (archive.archived archive)))] - (wrap (set@ #.modules modules (fresh_analysis_state host))))) + (in (set@ #.modules modules (fresh_analysis_state host))))) (def: (cached_artifacts fs static module_id) (-> (file.System Async) Static archive.ID (Async (Try (Dictionary Text Binary)))) @@ -233,85 +233,85 @@ (do ! [#let [output (row.add [artifact_id #.None data] output)] _ (\ host re_learn context #.None directive)] - (wrap [definitions - [analysers - synthesizers - generators - directives] - output])) + (in [definitions + [analysers + synthesizers + generators + directives] + output])) (#artifact.Definition name) (let [output (row.add [artifact_id #.None data] output)] (if (text\= $/program.name name) - (wrap [definitions + (in [definitions + [analysers + synthesizers + generators + directives] + output]) + (do ! + [value (\ host re_load context #.None directive)] + (in [(dictionary.put name value definitions) [analysers synthesizers generators directives] - output]) - (do ! - [value (\ host re_load context #.None directive)] - (wrap [(dictionary.put name value definitions) - [analysers - synthesizers - generators - directives] - output])))) + output])))) (#artifact.Analyser extension) (do ! [#let [output (row.add [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] - (wrap [definitions - [(dictionary.put extension (:as analysis.Handler value) analysers) - synthesizers - generators - directives] - output])) + (in [definitions + [(dictionary.put extension (:as analysis.Handler value) analysers) + synthesizers + generators + directives] + output])) (#artifact.Synthesizer extension) (do ! [#let [output (row.add [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] - (wrap [definitions - [analysers - (dictionary.put extension (:as synthesis.Handler value) synthesizers) - generators - directives] - output])) + (in [definitions + [analysers + (dictionary.put extension (:as synthesis.Handler value) synthesizers) + generators + directives] + output])) (#artifact.Generator extension) (do ! [#let [output (row.add [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] - (wrap [definitions - [analysers - synthesizers - (dictionary.put extension (:as generation.Handler value) generators) - directives] - output])) + (in [definitions + [analysers + synthesizers + (dictionary.put extension (:as generation.Handler value) generators) + directives] + output])) (#artifact.Directive extension) (do ! [#let [output (row.add [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] - (wrap [definitions - [analysers - synthesizers - generators - (dictionary.put extension (:as directive.Handler value) directives)] - output])) + (in [definitions + [analysers + synthesizers + generators + (dictionary.put extension (:as directive.Handler value) directives)] + output])) (#artifact.Custom name) (do ! [#let [output (row.add [artifact_id (#.Some name) data] output)] _ (\ host re_learn context (#.Some name) directive)] - (wrap [definitions - [analysers - synthesizers - generators - directives] - output])))) + (in [definitions + [analysers + synthesizers + generators + directives] + output])))) (#try.Success [definitions' bundles' output']) (recur input' definitions' bundles' output') @@ -324,7 +324,7 @@ definitions (monad.map ! (function (_ [def_name def_global]) (case def_global (#.Alias alias) - (wrap [def_name (#.Alias alias)]) + (in [def_name (#.Alias alias)]) (#.Definition [exported? type annotations _]) (|> definitions @@ -334,8 +334,8 @@ #.Definition [def_name]))))) (get@ #.definitions content))] - (wrap [(document.write $.key (set@ #.definitions definitions content)) - bundles]))) + (in [(document.write $.key (set@ #.definitions definitions content)) + bundles]))) (def: (load_definitions fs static module_id host_environment descriptor document) (All [expression directive] @@ -346,8 +346,8 @@ (do (try.with async.monad) [actual (cached_artifacts fs static module_id) #let [expected (|> descriptor (get@ #descriptor.registry) artifact.artifacts)] - [document bundles output] (async\wrap (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))] - (wrap [[descriptor document output] bundles]))) + [document bundles output] (async\in (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))] + (in [[descriptor document output] bundles]))) (def: (purge! fs static [module_name module_id]) (-> (file.System Async) Static [Module archive.ID] (Async (Try Any))) @@ -412,14 +412,14 @@ (monad.map ! (function (_ [module_name module_id]) (do ! [data (..read_module_descriptor fs static module_id) - [descriptor document] (async\wrap (<binary>.run ..parser data))] + [descriptor document] (async\in (<binary>.run ..parser data))] (if (text\= archive.runtime_module module_name) - (wrap [true - [module_name [module_id [descriptor document]]]]) + (in [true + [module_name [module_id [descriptor document]]]]) (do ! [input (//context.read fs ..pseudo_module import contexts (get@ #static.host_module_extension static) module_name)] - (wrap [(..valid_cache? descriptor input) - [module_name [module_id [descriptor document]]]]))))))) + (in [(..valid_cache? descriptor input) + [module_name [module_id [descriptor document]]]]))))))) load_order (|> pre_loaded_caches (list\map product.right) (monad.fold try.monad @@ -428,7 +428,7 @@ archive) (\ try.monad map (dependency.load_order $.key)) (\ try.monad join) - async\wrap) + async\in) #let [purge (..full_purge pre_loaded_caches load_order)] _ (|> purge dictionary.entries @@ -438,9 +438,9 @@ (monad.map ! (function (_ [module_name [module_id [descriptor document _]]]) (do ! [[descriptor,document,output bundles] (..load_definitions fs static module_id host_environment descriptor document)] - (wrap [[module_name descriptor,document,output] - bundles])))))] - (async\wrap + (in [[module_name descriptor,document,output] + bundles])))))] + (async\in (do {! try.monad} [archive (monad.fold ! (function (_ [[module descriptor,document,output] _bundle] archive) @@ -448,16 +448,16 @@ archive loaded_caches) analysis_state (..analysis_state (get@ #static.host static) archive)] - (wrap [archive - analysis_state - (list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]] - [analysers synthesizers generators directives]) - [(dictionary.merge +analysers analysers) - (dictionary.merge +synthesizers synthesizers) - (dictionary.merge +generators generators) - (dictionary.merge +directives directives)]) - ..empty_bundles - loaded_caches)]))))) + (in [archive + analysis_state + (list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]] + [analysers synthesizers generators directives]) + [(dictionary.merge +analysers analysers) + (dictionary.merge +synthesizers synthesizers) + (dictionary.merge +generators generators) + (dictionary.merge +directives directives)]) + ..empty_bundles + loaded_caches)]))))) (def: #export (thaw host_environment fs static import contexts) (All [expression directive] @@ -468,10 +468,10 @@ (case binary (#try.Success binary) (do (try.with async.monad) - [archive (async\wrap (archive.import ///.version binary))] + [archive (async\in (archive.import ///.version binary))] (..load_every_reserved_module host_environment fs static import contexts archive)) (#try.Failure error) - (wrap (#try.Success [archive.empty - (fresh_analysis_state (get@ #static.host static)) - ..empty_bundles]))))) + (in (#try.Success [archive.empty + (fresh_analysis_state (get@ #static.host static)) + ..empty_bundles]))))) 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 f62d00cf2..b7838a270 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -56,14 +56,14 @@ (Async (Try file.Path))) (case contexts #.Nil - (async\wrap (exception.throw ..cannot_find_module [importer module])) + (async\in (exception.except ..cannot_find_module [importer module])) (#.Cons context contexts') (let [path (format (..path fs context module) extension)] (do async.monad [? (\ fs file? path)] (if ? - (wrap (#try.Success path)) + (in (#try.Success path)) (find_source_file fs importer contexts' module extension)))))) (def: (full_host_extension partial_host_extension) @@ -104,7 +104,7 @@ (#try.Success [path data]) #.None - (exception.throw ..cannot_find_module [importer module])))))) + (exception.except ..cannot_find_module [importer module])))))) (def: (find_any_source_file fs importer import contexts partial_host_extension module) (-> (file.System Async) Module Import (List Context) Extension Module @@ -115,10 +115,10 @@ [outcome (find_local_source_file fs importer import contexts partial_host_extension module)] (case outcome (#try.Success [path data]) - (wrap outcome) + (in outcome) (#try.Failure _) - (wrap (..find_library_source_file importer import partial_host_extension module))))) + (in (..find_library_source_file importer import partial_host_extension module))))) (def: #export (read fs importer import contexts partial_host_extension module) (-> (file.System Async) Module Import (List Context) Extension Module @@ -127,13 +127,13 @@ [[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)] (case (\ utf8.codec decode binary) (#try.Success code) - (wrap {#////.module module - #////.file path - #////.hash (text\hash code) - #////.code code}) + (in {#////.module module + #////.file path + #////.hash (text\hash code) + #////.code code}) (#try.Failure _) - (async\wrap (exception.throw ..cannot_read_module [module]))))) + (async\in (exception.except ..cannot_read_module [module]))))) (type: #export Enumeration (Dictionary file.Path Binary)) @@ -147,9 +147,8 @@ (if (text.ends_with? ..lux_extension file) (do ! [source_code (\ fs read file)] - (async\wrap - (dictionary.try_put (file.name fs file) source_code enumeration))) - (wrap enumeration))) + (async\in (dictionary.try_put (file.name fs file) source_code enumeration))) + (in enumeration))) enumeration)) (\ ! join))] (|> directory 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 8f0b9ee68..6a25f1094 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -146,10 +146,10 @@ (text.suffix (get@ #static.artifact_extension static)))] (do try.monad [_ (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new class_path) sink)] - (wrap (do_to sink - (java/util/zip/ZipOutputStream::write content +0 (.int (binary.size content))) - (java/io/Flushable::flush) - (java/util/zip/ZipOutputStream::closeEntry)))))) + (in (do_to sink + (java/util/zip/ZipOutputStream::write content +0 (.int (binary.size content))) + (java/io/Flushable::flush) + (java/util/zip/ZipOutputStream::closeEntry)))))) (def: (write_module static [module output] sink) (-> Static [archive.ID Output] java/util/jar/JarOutputStream @@ -262,4 +262,4 @@ #let [_ (do_to sink (java/io/Flushable::flush) (java/io/Closeable::close))]] - (wrap (java/io/ByteArrayOutputStream::toByteArray buffer))))) + (in (java/io/ByteArrayOutputStream::toByteArray buffer))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index e69755445..2239960c6 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -114,7 +114,7 @@ (\ encoding.utf8 encode) tar.content)) module_file (tar.path (..module_file module_id))] - (wrap (#tar.Normal [module_file now ..mode ..ownership entry_content])))) + (in (#tar.Normal [module_file now ..mode ..ownership entry_content])))) (def: #export (package now) (-> Instant Packager) @@ -127,6 +127,6 @@ (dictionary.of_list text.hash) (: (Dictionary Module archive.ID)))] entries (monad.map ! (..write_module now mapping) order)] - (wrap (|> entries - row.of_list - (binary.run tar.writer)))))) + (in (|> entries + row.of_list + (binary.run tar.writer)))))) diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index 522b564ab..845ba3dba 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -66,13 +66,13 @@ (function (_ state) (do try.monad [[state' output] (operation (get state))] - (wrap [(set state' state) output])))) + (in [(set state' state) output])))) (def: #export failure (-> Text Operation) (|>> #try.Failure (state.lift try.monad))) -(def: #export (throw exception parameters) +(def: #export (except exception parameters) (All [e] (-> (Exception e) e Operation)) (..failure (ex.construct exception parameters))) @@ -82,9 +82,9 @@ (try\map (|>> [state]) error))) (syntax: #export (assert exception message test) - (wrap (list (` (if (~ test) - (\ ..monad (~' wrap) []) - (..throw (~ exception) (~ message))))))) + (in (list (` (if (~ test) + (\ ..monad (~' in) []) + (..except (~ exception) (~ message))))))) (def: #export identity (All [s a] (Phase s a a)) @@ -100,13 +100,13 @@ (do try.monad [[pre/state' temp] (pre archive input pre/state) [post/state' output] (post archive temp post/state)] - (wrap [[pre/state' post/state'] output])))) + (in [[pre/state' post/state'] output])))) (def: #export (timed definition description operation) (All [s a] (-> Name Text (Operation s a) (Operation s a))) (do ..monad - [_ (wrap []) + [_ (in []) #let [pre (io.run instant.now)] output operation #let [_ (|> instant.now @@ -116,4 +116,4 @@ %.duration (format (%.name definition) " [" description "]: ") debug.log!)]] - (wrap output))) + (in output))) |