diff options
Diffstat (limited to 'stdlib/source/library/lux/tool')
86 files changed, 627 insertions, 599 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index e8b91db8c..04971dadd 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -107,8 +107,8 @@ (#.Right [source' output]) (let [[location _] output] (#try.Success [[bundle (|> compiler - (set@ #.source source') - (set@ #.location location))] + (with@ #.source source') + (with@ #.location location))] [source' output]]))))) (type: (Operation a) @@ -125,13 +125,13 @@ (///directive.Operation anchor expression directive [Source (Payload directive)]))) (do ///phase.monad - [.let [module (get@ #///.module input)] + [.let [module (value@ #///.module input)] _ (///directive.set_current_module module)] (///directive.lifted_analysis (do {! ///phase.monad} [_ (module.create hash module) _ (monad.map ! module.import dependencies) - .let [source (///analysis.source (get@ #///.module input) (get@ #///.code input))] + .let [source (///analysis.source (value@ #///.module input) (value@ #///.code input))] _ (///analysis.set_source_code source)] (in [source [///generation.empty_buffer artifact.empty]]))))) @@ -220,13 +220,13 @@ (def: (default_dependencies prelude input) (-> Module ///.Input (List Module)) (list& archive.runtime_module - (if (text\= prelude (get@ #///.module input)) + (if (text\= prelude (value@ #///.module input)) (list) (list prelude)))) (def: module_aliases (-> .Module Aliases) - (|>> (get@ #.module_aliases) (dictionary.of_list text.hash))) + (|>> (value@ #.module_aliases) (dictionary.of_list text.hash))) (def: .public (compiler expander prelude write_directive) (All [anchor expression directive] @@ -238,10 +238,10 @@ {#///.dependencies dependencies #///.process (function (_ state archive) (do {! try.monad} - [.let [hash (text\hash (get@ #///.code input))] + [.let [hash (text\hash (value@ #///.code input))] [state [source buffer]] (<| (///phase.result' state) (..begin dependencies hash input)) - .let [module (get@ #///.module input)]] + .let [module (value@ #///.module input)]] (loop [iteration (<| (///phase.result' state) (..iteration archive expander module source buffer ///syntax.no_aliases))] (do ! @@ -252,7 +252,7 @@ [[state [analysis_module [final_buffer final_registry]]] (///phase.result' state (..end module)) .let [descriptor {#descriptor.hash hash #descriptor.name module - #descriptor.file (get@ #///.file input) + #descriptor.file (value@ #///.file input) #descriptor.references (set.of_list text.hash dependencies) #descriptor.state #.Compiled #descriptor.registry final_registry}]] @@ -267,7 +267,7 @@ (let [[temporary_buffer temporary_registry] temporary_payload] (in [state (#.Left {#///.dependencies (|> requirements - (get@ #///directive.imports) + (value@ #///directive.imports) (list\map product.left)) #///.process (function (_ state archive) (recur (<| (///phase.result' state) @@ -281,7 +281,7 @@ _ (///directive.lifted_generation (///generation.set_registry temporary_registry)) _ (|> requirements - (get@ #///directive.referrals) + (value@ #///directive.referrals) (monad.map ! (execute! archive))) temporary_payload (..get_current_payload temporary_payload)] (..iteration 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 53cb07e22..1ac28821f 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -97,7 +97,7 @@ (All [<type_vars>] (-> Static <Platform> archive.ID [Descriptor (Document Any) Output] (Async (Try Any)))) - (let [system (get@ #&file_system platform) + (let [system (value@ #&file_system platform) write_artifact! (: (-> [artifact.ID (Maybe Text) Binary] (Action Any)) (function (_ [artifact_id custom content]) (ioW.write system static module_id artifact_id content)))] @@ -129,7 +129,7 @@ (-> <Platform> (///generation.Operation <type_vars> [Registry Output]))) (do ///phase.monad [_ ..initialize_buffer!] - (get@ #runtime platform))) + (value@ #runtime platform))) (def: (runtime_descriptor registry) (-> Registry Descriptor) @@ -198,7 +198,7 @@ (def: (phase_wrapper archive platform state) (All [<type_vars>] (-> Archive <Platform> <State+> (Try [<State+> Phase_Wrapper]))) - (let [phase_wrapper (get@ #phase_wrapper platform)] + (let [phase_wrapper (value@ #phase_wrapper platform)] (|> archive phase_wrapper ///directive.lifted_generation @@ -236,15 +236,15 @@ Import (List Context) (Async (Try [<State+> Archive])))) (do {! (try.with async.monad)} - [.let [state (//init.state (get@ #static.host static) + [.let [state (//init.state (value@ #static.host static) module expander host_analysis - (get@ #host platform) - (get@ #phase platform) + (value@ #host platform) + (value@ #phase platform) generation_bundle)] - _ (ioW.enable (get@ #&file_system platform) static) - [archive analysis_state bundles] (ioW.thaw (get@ #host platform) (get@ #&file_system platform) static import compilation_sources) + _ (ioW.enable (value@ #&file_system platform) static) + [archive analysis_state bundles] (ioW.thaw (value@ #host platform) (value@ #&file_system platform) static import compilation_sources) .let [with_missing_extensions (: (All [<type_vars>] (-> <Platform> (Program expression directive) <State+> (Async (Try <State+>)))) @@ -276,11 +276,11 @@ (def: (module_compilation_log module) (All [<type_vars>] (-> Module <State+> Text)) - (|>> (get@ [#extension.state - #///directive.generation - #///directive.state - #extension.state - #///generation.log]) + (|>> (value@ [#extension.state + #///directive.generation + #///directive.state + #extension.state + #///generation.log]) (row\fold (function (_ right left) (format left ..compilation_log_separator right)) module))) @@ -288,12 +288,12 @@ (def: with_reset_log (All [<type_vars>] (-> <State+> <State+>)) - (set@ [#extension.state - #///directive.generation - #///directive.state - #extension.state - #///generation.log] - row.empty)) + (with@ [#extension.state + #///directive.generation + #///directive.state + #extension.state + #///generation.log] + row.empty)) (def: empty (Set Module) @@ -320,8 +320,8 @@ lens (dictionary.value module) (maybe.else ..empty)))) - transitive_depends_on (transitive_dependency (get@ #depends_on) import) - transitive_depended_by (transitive_dependency (get@ #depended_by) module) + transitive_depends_on (transitive_dependency (value@ #depends_on) import) + transitive_depended_by (transitive_dependency (value@ #depended_by) module) update_dependence (: (-> [Module (Set Module)] [Module (Set Module)] (-> Mapping Mapping)) (function (_ [source forward] [target backward]) @@ -335,14 +335,14 @@ with_dependence+transitives (set.list backward))))))] (|> dependence - (update@ #depends_on - (update_dependence - [module transitive_depends_on] - [import transitive_depended_by])) - (update@ #depended_by - ((function.flipped update_dependence) - [module transitive_depends_on] - [import transitive_depended_by]))))) + (revised@ #depends_on + (update_dependence + [module transitive_depends_on] + [import transitive_depended_by])) + (revised@ #depended_by + ((function.flipped update_dependence) + [module transitive_depends_on] + [import transitive_depended_by]))))) (def: (circular_dependency? module import dependence) (-> Module Module Dependence Bit) @@ -353,8 +353,8 @@ (dictionary.value from) (maybe.else ..empty))] (set.member? targets to))))] - (or (dependence? import (get@ #depends_on) module) - (dependence? module (get@ #depended_by) import)))) + (or (dependence? import (value@ #depends_on) module) + (dependence? module (value@ #depended_by) import)))) (exception: .public (module_cannot_import_itself {module Module}) (exception.report @@ -499,21 +499,21 @@ .let [additions (|> modules (list\map product.left) (set.of_list text.hash))]] - (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))) - :expected)) - state)))) + (in (revised@ [#extension.state + #///directive.analysis + #///directive.state + #extension.state] + (function (_ analysis_state) + (|> analysis_state + (:as .Lux) + (revised@ #.modules (function (_ current) + (list\compose (list.only (|>> product.left + (set.member? additions) + not) + current) + modules))) + :expected)) + state)))) (def: (set_current_module module state) (All [<type_vars>] @@ -533,24 +533,24 @@ (///.Compiler <State+> .Module Any) (:expected - ((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list)))) + ((//init.compiler expander syntax.prelude (value@ #write platform)) $.key (list)))) compiler (..parallel context (function (_ importer import! module_id [archive state] module) (do {! (try.with async.monad)} [.let [state (..set_current_module module state)] - input (context.read (get@ #&file_system platform) + input (context.read (value@ #&file_system platform) importer import compilation_sources - (get@ #static.host_module_extension static) + (value@ #static.host_module_extension static) module)] (loop [[archive state] [archive state] compilation (base_compiler (:as ///.Input input)) all_dependencies (: (Set Module) (set.of_list text.hash (list)))] (do ! - [.let [new_dependencies (get@ #///.dependencies compilation) + [.let [new_dependencies (value@ #///.dependencies compilation) continue! (:sharing [<type_vars>] <Platform> platform @@ -582,14 +582,14 @@ (do ! [archive,document+ (|> new_dependencies (list\map (import! module)) - (monad.seq ..monad)) + (monad.all ..monad)) .let [archive (|> archive,document+ (list\map product.left) (list\fold archive.merged archive))]] (in [archive (try.trusted (..updated_state archive state))]))) (async\in (exception.except ..cannot_import_twice [module duplicates])))] - (case ((get@ #///.process compilation) + (case ((value@ #///.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. (|> (///directive.set_current_module module) @@ -605,7 +605,7 @@ (#.Right [descriptor document output]) (do ! [.let [_ (debug.log! (..module_compilation_log module state)) - descriptor (set@ #descriptor.references all_dependencies descriptor)] + descriptor (with@ #descriptor.references all_dependencies descriptor)] _ (..cache_module static platform module_id [descriptor document output])] (case (archive.has module [descriptor document output] archive) (#try.Success archive) @@ -617,7 +617,7 @@ (#try.Failure error) (do ! - [_ (ioW.freeze (get@ #&file_system platform) static archive)] + [_ (ioW.freeze (value@ #&file_system platform) static archive)] (async\in (#try.Failure error)))))))))] (compiler archive.runtime_module compilation_module))) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index 571185dee..aefd908c4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -55,18 +55,18 @@ (def: .public (tag lefts right?) (-> Nat Bit Nat) (if right? - (inc lefts) + (++ lefts) lefts)) (def: (lefts tag right?) (-> Nat Bit Nat) (if right? - (dec tag) + (-- tag) tag)) (def: .public (choice options pick) (-> Nat Nat [Nat Bit]) - (let [right? (n.= (dec options) pick)] + (let [right? (n.= (-- options) pick)] [(..lefts pick right?) right?])) @@ -253,7 +253,7 @@ (def: (last? size tag) (-> Nat Tag Bit) - (n.= (dec size) tag)) + (n.= (-- size) tag)) (template: .public (no_op value) [(|> 1 #variable.Local #reference.Variable #..Reference @@ -402,10 +402,10 @@ (def: .public (with_source_code source action) (All [a] (-> Source (Operation a) (Operation a))) (function (_ [bundle state]) - (let [old_source (get@ #.source state)] - (case (action [bundle (set@ #.source source state)]) + (let [old_source (value@ #.source state)] + (case (action [bundle (with@ #.source source state)]) (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (set@ #.source old_source state')] + (#try.Success [[bundle' (with@ #.source old_source state')] output]) (#try.Failure error) @@ -426,11 +426,11 @@ (def: .public (with_scope action) (All [a] (-> (Operation a) (Operation [Scope a]))) (function (_ [bundle state]) - (case (action [bundle (update@ #.scopes (|>> (#.Item fresh_scope)) state)]) + (case (action [bundle (revised@ #.scopes (|>> (#.Item fresh_scope)) state)]) (#try.Success [[bundle' state'] output]) - (case (get@ #.scopes state') + (case (value@ #.scopes state') (#.Item head tail) - (#try.Success [[bundle' (set@ #.scopes tail state')] + (#try.Success [[bundle' (with@ #.scopes tail state')] [head output]]) #.End @@ -441,8 +441,8 @@ (def: .public (with_current_module name) (All [a] (-> Text (Operation a) (Operation a))) - (extension.localized (get@ #.current_module) - (set@ #.current_module) + (extension.localized (value@ #.current_module) + (with@ #.current_module) (function.constant (#.Some name)))) (def: .public (with_location location action) @@ -450,10 +450,10 @@ (if (text\= "" (product.left location)) action (function (_ [bundle state]) - (let [old_location (get@ #.location state)] - (case (action [bundle (set@ #.location location state)]) + (let [old_location (value@ #.location state)] + (case (action [bundle (with@ #.location location state)]) (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (set@ #.location old_location state')] + (#try.Success [[bundle' (with@ #.location old_location state')] output]) (#try.Failure error) @@ -467,7 +467,7 @@ (def: .public (failure error) (-> Text Operation) (function (_ [bundle state]) - (#try.Failure (locate_error (get@ #.location state) error)))) + (#try.Failure (locate_error (value@ #.location state) error)))) (def: .public (except exception parameters) (All [e] (-> (Exception e) e Operation)) @@ -482,7 +482,7 @@ (def: .public (failure' error) (-> Text (phase.Operation Lux)) (function (_ state) - (#try.Failure (locate_error (get@ #.location state) error)))) + (#try.Failure (locate_error (value@ #.location state) error)))) (def: .public (except' exception parameters) (All [e] (-> (Exception e) e (phase.Operation Lux))) @@ -498,7 +498,7 @@ (#try.Failure error) (let [[bundle state] bundle,state] - (#try.Failure (locate_error (get@ #.location state) error)))))) + (#try.Failure (locate_error (value@ #.location state) error)))))) (def: .public (install state) (-> .Lux (Operation Any)) @@ -509,7 +509,7 @@ (template [<name> <type> <field> <value>] [(def: .public (<name> value) (-> <type> (Operation Any)) - (extension.update (set@ <field> <value>)))] + (extension.update (with@ <field> <value>)))] [set_source_code Source #.source value] [set_current_module Text #.current_module (#.Some value)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux index 478697fd4..5f2770068 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux @@ -47,8 +47,8 @@ (def: .public (merge_requirements left right) (-> Requirements Requirements Requirements) - {#imports (list\compose (get@ #imports left) (get@ #imports right)) - #referrals (list\compose (get@ #referrals left) (get@ #referrals right))}) + {#imports (list\compose (value@ #imports left) (value@ #imports right)) + #referrals (list\compose (value@ #referrals left) (value@ #referrals right))}) (template [<special> <general>] [(type: .public (<special> anchor expression directive) @@ -66,7 +66,7 @@ (All [anchor expression directive] (Operation anchor expression directive <phase>)) (function (_ [bundle state]) - (#try.Success [[bundle state] (get@ [<component> #..phase] state)])))] + (#try.Success [[bundle state] (value@ [<component> #..phase] state)])))] [analysis #..analysis analysis.Phase] [synthesis #..synthesis synthesis.Phase] @@ -78,8 +78,8 @@ (All [anchor expression directive output] (-> (<operation> output) (Operation anchor expression directive output))) - (|>> (phase.sub [(get@ [<component> #..state]) - (set@ [<component> #..state])]) + (|>> (phase.sub [(value@ [<component> #..state]) + (with@ [<component> #..state])]) extension.lifted))] [lifted_analysis #..analysis analysis.Operation] 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 0a1841ad1..aee61ebc7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -111,9 +111,9 @@ (All [anchor expression directive output] <with_type>) (function (_ body) (function (_ [bundle state]) - (case (body [bundle (set@ <tag> (#.Some <with_value>) state)]) + (case (body [bundle (with@ <tag> (#.Some <with_value>) state)]) (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (set@ <tag> (get@ <tag> state) state')] + (#try.Success [[bundle' (with@ <tag> (value@ <tag> state) state')] output]) (#try.Failure error) @@ -123,7 +123,7 @@ (All [anchor expression directive] (Operation anchor expression directive <get_type>)) (function (_ (^@ stateE [bundle state])) - (case (get@ <tag> state) + (case (value@ <tag> state) (#.Some output) (#try.Success [stateE output]) @@ -134,7 +134,7 @@ (All [anchor expression directive] (-> <get_type> (Operation anchor expression directive Any))) (function (_ [bundle state]) - (#try.Success [[bundle (set@ <tag> (#.Some value) state)] + (#try.Success [[bundle (with@ <tag> (#.Some value) state)] []])))] [#anchor @@ -156,21 +156,21 @@ (All [anchor expression directive] (Operation anchor expression directive artifact.Registry)) (function (_ (^@ stateE [bundle state])) - (#try.Success [stateE (get@ #registry state)]))) + (#try.Success [stateE (value@ #registry state)]))) (def: .public (set_registry value) (All [anchor expression directive] (-> artifact.Registry (Operation anchor expression directive Any))) (function (_ [bundle state]) - (#try.Success [[bundle (set@ #registry value state)] + (#try.Success [[bundle (with@ #registry value state)] []]))) (def: .public next (All [anchor expression directive] (Operation anchor expression directive Nat)) (do phase.monad - [count (extension.read (get@ #counter)) - _ (extension.update (update@ #counter inc))] + [count (extension.read (value@ #counter)) + _ (extension.update (revised@ #counter ++))] (in count))) (def: .public (identifier prefix) @@ -181,18 +181,18 @@ (def: .public (enter_module module) (All [anchor expression directive] (-> Module (Operation anchor expression directive Any))) - (extension.update (set@ #module module))) + (extension.update (with@ #module module))) (def: .public module (All [anchor expression directive] (Operation anchor expression directive Module)) - (extension.read (get@ #module))) + (extension.read (value@ #module))) (def: .public (evaluate! label code) (All [anchor expression directive] (-> Context expression (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) - (case (\ (get@ #host state) evaluate! label code) + (case (\ (value@ #host state) evaluate! label code) (#try.Success output) (#try.Success [state+ output]) @@ -203,7 +203,7 @@ (All [anchor expression directive] (-> directive (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) - (case (\ (get@ #host state) execute! code) + (case (\ (value@ #host state) execute! code) (#try.Success output) (#try.Success [state+ output]) @@ -214,7 +214,7 @@ (All [anchor expression directive] (-> Context (Maybe Text) expression (Operation anchor expression directive [Text Any directive]))) (function (_ (^@ stateE [bundle state])) - (case (\ (get@ #host state) define! context custom code) + (case (\ (value@ #host state) define! context custom code) (#try.Success output) (#try.Success [stateE output]) @@ -225,13 +225,13 @@ (All [anchor expression directive] (-> artifact.ID (Maybe Text) directive (Operation anchor expression directive Any))) (do {! phase.monad} - [?buffer (extension.read (get@ #buffer))] + [?buffer (extension.read (value@ #buffer))] (case ?buffer (#.Some buffer) ... TODO: Optimize by no longer checking for overwrites... (if (row.any? (|>> product.left (n.= artifact_id)) buffer) (phase.except ..cannot_overwrite_output [artifact_id]) - (extension.update (set@ #buffer (#.Some (row.add [artifact_id custom code] buffer))))) + (extension.update (with@ #buffer (#.Some (row.suffix [artifact_id custom code] buffer))))) #.None (phase.except ..no_buffer_for_saving_code [artifact_id])))) @@ -241,8 +241,8 @@ (All [anchor expression directive] (-> Text (Operation anchor expression directive artifact.ID))) (function (_ (^@ stateE [bundle state])) - (let [[id registry'] (<artifact> name (get@ #registry state))] - (#try.Success [[bundle (set@ #registry registry' state)] + (let [[id registry'] (<artifact> name (value@ #registry state))] + (#try.Success [[bundle (with@ #registry registry' state)] id]))))] [learn artifact.definition] @@ -267,11 +267,11 @@ (let [[_module _name] name] (do try.monad [module_id (archive.id _module archive) - registry (if (text\= (get@ #module state) _module) - (#try.Success (get@ #registry state)) + registry (if (text\= (value@ #module state) _module) + (#try.Success (value@ #registry state)) (do try.monad [[descriptor document] (archive.find _module archive)] - (#try.Success (get@ #descriptor.registry descriptor))))] + (#try.Success (value@ #descriptor.registry descriptor))))] (case (artifact.remember _name registry) #.None (exception.except ..unknown_definition [name (artifact.definitions registry)]) @@ -293,13 +293,13 @@ (All [anchor expression directive] (-> Archive (Operation anchor expression directive Context))) (function (_ (^@ stateE [bundle state])) - (case (get@ #context state) + (case (value@ #context state) #.None (exception.except ..no_context []) (#.Some id) (do try.monad - [module_id (archive.id (get@ #module state) archive)] + [module_id (archive.id (value@ #module state) archive)] (in [stateE [module_id id]]))))) (def: .public (with_context id body) @@ -309,8 +309,8 @@ (Operation anchor expression directive a))) (function (_ [bundle state]) (do try.monad - [[[bundle' state'] output] (body [bundle (set@ #context (#.Some id) state)])] - (in [[bundle' (set@ #context (get@ #context state) state')] + [[[bundle' state'] output] (body [bundle (with@ #context (#.Some id) state)])] + (in [[bundle' (with@ #context (value@ #context state) state')] output])))) (def: .public (with_new_context archive body) @@ -318,13 +318,13 @@ (-> Archive (Operation anchor expression directive a) (Operation anchor expression directive [Context a]))) (function (_ (^@ stateE [bundle state])) - (let [[id registry'] (artifact.resource (get@ #registry state))] + (let [[id registry'] (artifact.resource (value@ #registry state))] (do try.monad [[[bundle' state'] output] (body [bundle (|> state - (set@ #registry registry') - (set@ #context (#.Some id)))]) - module_id (archive.id (get@ #module state) archive)] - (in [[bundle' (set@ #context (get@ #context state) state')] + (with@ #registry registry') + (with@ #context (#.Some id)))]) + module_id (archive.id (value@ #module state) archive)] + (in [[bundle' (with@ #context (value@ #context state) state')] [[module_id id] output]]))))) @@ -333,5 +333,5 @@ (-> Text (Operation anchor expression directive Any))) (function (_ [bundle state]) (#try.Success [[bundle - (update@ #log (row.add message) state)] + (revised@ #log (row.suffix message) state)] []]))) 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 c8cfe9c0e..ee12a8bf0 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 @@ -124,10 +124,10 @@ (compile archive expansion)) _ - (/function.apply compile argsC+ functionT functionA archive functionC))) + (/function.on compile argsC+ functionT functionA archive functionC))) _ - (/function.apply compile argsC+ functionT functionA archive functionC))) + (/function.on compile argsC+ functionT functionA archive functionC))) _ (//.except ..unrecognized_syntax [location.dummy code']))) 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 9463eeb8f..b3642f5f3 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 @@ -193,20 +193,28 @@ [inputT' (simplify_case inputT)] (.case inputT' (#.Product _) - (let [subs (type.flat_tuple inputT') - num_subs (maybe.else (list.size subs) - num_tags) - num_sub_patterns (list.size sub_patterns) - matches (cond (n.< num_subs num_sub_patterns) - (let [[prefix suffix] (list.split_at (dec num_sub_patterns) subs)] - (list.zipped/2 (list\compose prefix (list (type.tuple suffix))) sub_patterns)) - - (n.> num_subs num_sub_patterns) - (let [[prefix suffix] (list.split_at (dec num_subs) sub_patterns)] - (list.zipped/2 subs (list\compose prefix (list (code.tuple suffix))))) - - ... (n.= num_subs num_sub_patterns) - (list.zipped/2 subs sub_patterns))] + (let [matches (loop [types (type.flat_tuple inputT') + patterns sub_patterns + output (: (List [Type Code]) + #.End)] + (.case [types patterns] + [#.End #.End] + output + + [(#.Item headT #.End) (#.Item headP #.End)] + (#.Item [headT headP] output) + + [remainingT (#.Item headP #.End)] + (#.Item [(type.tuple remainingT) headP] output) + + [(#.Item headT #.End) remainingP] + (#.Item [headT (code.tuple remainingP)] output) + + [(#.Item headT tailT) (#.Item headP tailP)] + (recur tailT tailP (#.Item [headT headP] output)) + + _ + (undefined)))] (do ! [[memberP+ thenA] (list\fold (: (All [a] (-> [Type Code] (Operation [(List Pattern) a]) @@ -220,7 +228,7 @@ (do ! [nextA next] (in [(list) nextA])) - (list.reversed matches))] + matches)] (in [(/.pattern/tuple memberP+) thenA]))) @@ -231,7 +239,7 @@ [location (#.Record record)] (do ///.monad [record (//structure.normal record) - [members recordT] (//structure.order record) + [record_size members recordT] (//structure.order record) _ (.case inputT (#.Var _id) (//type.with_env @@ -239,7 +247,7 @@ _ (in []))] - (analyse_pattern (#.Some (list.size members)) inputT [location (#.Tuple members)] next)) + (analyse_pattern (#.Some record_size) inputT [location (#.Tuple members)] next)) [location (#.Tag tag)] (/.with_location location @@ -260,9 +268,9 @@ (n.< num_cases idx)) (do ///.monad [[testP nextA] (if (and (n.> num_cases size_sum) - (n.= (dec num_cases) idx)) + (n.= (-- num_cases) idx)) (analyse_pattern #.None - (type.variant (list.after (dec num_cases) flat_sum)) + (type.variant (list.after (-- num_cases) flat_sum)) (` [(~+ values)]) next) (analyse_pattern #.None caseT (` [(~+ values)]) next))] 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 25c85514e..e7efacf3c 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 @@ -146,7 +146,7 @@ (do ////.monad [value_coverage (determine value) .let [idx (if right? - (inc lefts) + (++ lefts) lefts)]] (in (#Variant (if right? (#.Some idx) @@ -256,7 +256,7 @@ casesSF (dictionary.entries casesA))] (in (if (and (or (known_cases? addition_cases) (known_cases? so_far_cases)) - (n.= (inc (n.max addition_cases so_far_cases)) + (n.= (++ (n.max addition_cases so_far_cases)) (dictionary.size casesM)) (list.every? exhaustive? (dictionary.values casesM))) #Exhaustive 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 6282980be..0420b7811 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 @@ -10,7 +10,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#\." functor)]]] + ["." list ("#\." functor monoid)]]] [math [number ["n" nat]]] @@ -204,16 +204,16 @@ base))) ... Turns a record type into the kind of function type suitable for inference. -(def: (record' target originalT inferT) - (-> Nat Type Type (Operation Type)) +(def: (record' record_size target originalT inferT) + (-> Nat Nat Type Type (Operation Type)) (case inferT (#.Named name unnamedT) - (record' target originalT unnamedT) + (record' record_size target originalT unnamedT) (^template [<tag>] [(<tag> env bodyT) (do ///.monad - [bodyT+ (record' (n.+ 2 target) originalT bodyT)] + [bodyT+ (record' record_size (n.+ 2 target) originalT bodyT)] (in (<tag> env bodyT+)))]) ([#.UnivQ] [#.ExQ]) @@ -221,22 +221,23 @@ (#.Apply inputT funcT) (case (type.applied (list inputT) funcT) (#.Some outputT) - (record' target originalT outputT) + (record' record_size target originalT outputT) #.None (/.except ..invalid_type_application inferT)) (#.Product _) - (///\in (|> inferT - (type.function (type.flat_tuple inferT)) - (substitute_bound target originalT))) + (let [[lefts right] (list.split_at (-- record_size) (type.flat_tuple inferT))] + (///\in (|> inferT + (type.function (list\compose lefts (list (type.tuple right)))) + (substitute_bound target originalT)))) _ (/.except ..not_a_record_type inferT))) -(def: .public (record inferT) - (-> Type (Operation Type)) - (record' (n.- 2 0) inferT inferT)) +(def: .public (record record_size inferT) + (-> Nat Type (Operation Type)) + (record' record_size (n.- 2 0) inferT inferT)) ... Turns a variant type into the kind of function type suitable for inference. (def: .public (variant tag expected_size inferT) @@ -252,7 +253,7 @@ (^template [<tag>] [(<tag> env bodyT) (do ///.monad - [bodyT+ (recur (inc depth) bodyT)] + [bodyT+ (recur (++ depth) bodyT)] (in (<tag> env bodyT+)))]) ([#.UnivQ] [#.ExQ]) @@ -260,7 +261,7 @@ (#.Sum _) (let [cases (type.flat_variant currentT) actual_size (list.size cases) - boundary (dec expected_size)] + boundary (-- expected_size)] (cond (or (n.= expected_size actual_size) (and (n.> expected_size actual_size) (n.< boundary tag))) @@ -268,7 +269,7 @@ (#.Some caseT) (///\in (if (n.= 0 depth) (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n.* 2)) inferT)] + (let [replace' (replace (|> depth -- (n.* 2)) inferT)] (type.function (list (replace' caseT)) (replace' currentT))))) @@ -282,7 +283,7 @@ (let [caseT (type.variant (list.after boundary cases))] (///\in (if (n.= 0 depth) (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n.* 2)) inferT)] + (let [replace' (replace (|> depth -- (n.* 2)) inferT)] (type.function (list (replace' caseT)) (replace' currentT)))))) 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 d5e2fd691..14e08a4c0 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 @@ -84,12 +84,12 @@ (do ///.monad [self_name meta.current_module_name self meta.current_module] - (case (get@ #.module_annotations self) + (case (value@ #.module_annotations self) #.None (function (_ state) - (#try.Success [(update@ #.modules - (plist.has self_name (set@ #.module_annotations (#.Some annotations) self)) - state) + (#try.Success [(revised@ #.modules + (plist.has self_name (with@ #.module_annotations (#.Some annotations) self)) + state) []])) (#.Some old) @@ -101,13 +101,13 @@ (do ///.monad [self_name meta.current_module_name] (function (_ state) - (#try.Success [(update@ #.modules - (plist.revised self_name (update@ #.imports (function (_ current) - (if (list.any? (text\= module) - current) - current - (#.Item module current))))) - state) + (#try.Success [(revised@ #.modules + (plist.revised self_name (revised@ #.imports (function (_ current) + (if (list.any? (text\= module) + current) + current + (#.Item module current))))) + state) []]))))) (def: .public (alias alias module) @@ -116,10 +116,10 @@ (do ///.monad [self_name meta.current_module_name] (function (_ state) - (#try.Success [(update@ #.modules - (plist.revised self_name (update@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text])) - (|>> (#.Item [alias module]))))) - state) + (#try.Success [(revised@ #.modules + (plist.revised self_name (revised@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text])) + (|>> (#.Item [alias module]))))) + state) []]))))) (def: .public (exists? module) @@ -127,7 +127,7 @@ (///extension.lifted (function (_ state) (|> state - (get@ #.modules) + (value@ #.modules) (plist.value module) (case> (#.Some _) #1 #.None #0) [state] #try.Success)))) @@ -139,15 +139,15 @@ [self_name meta.current_module_name self meta.current_module] (function (_ state) - (case (plist.value name (get@ #.definitions self)) + (case (plist.value name (value@ #.definitions self)) #.None - (#try.Success [(update@ #.modules - (plist.has self_name - (update@ #.definitions - (: (-> (List [Text Global]) (List [Text Global])) - (|>> (#.Item [name definition]))) - self)) - state) + (#try.Success [(revised@ #.modules + (plist.has self_name + (revised@ #.definitions + (: (-> (List [Text Global]) (List [Text Global])) + (|>> (#.Item [name definition]))) + self)) + state) []]) (#.Some already_existing) @@ -157,9 +157,9 @@ (-> Nat Text (Operation Any)) (///extension.lifted (function (_ state) - (#try.Success [(update@ #.modules - (plist.has name (..empty hash)) - state) + (#try.Success [(revised@ #.modules + (plist.has name (..empty hash)) + state) []])))) (def: .public (with_module hash name action) @@ -176,15 +176,15 @@ (-> Text (Operation Any)) (///extension.lifted (function (_ state) - (case (|> state (get@ #.modules) (plist.value module_name)) + (case (|> state (value@ #.modules) (plist.value module_name)) (#.Some module) - (let [active? (case (get@ #.module_state module) + (let [active? (case (value@ #.module_state module) #.Active #1 _ #0)] (if active? - (#try.Success [(update@ #.modules - (plist.has module_name (set@ #.module_state <tag> module)) - state) + (#try.Success [(revised@ #.modules + (plist.has module_name (with@ #.module_state <tag> module)) + state) []]) ((/.except' can_only_change_state_of_active_module [module_name <tag>]) state))) @@ -196,10 +196,10 @@ (-> Text (Operation Bit)) (///extension.lifted (function (_ state) - (case (|> state (get@ #.modules) (plist.value module_name)) + (case (|> state (value@ #.modules) (plist.value module_name)) (#.Some module) (#try.Success [state - (case (get@ #.module_state module) + (case (value@ #.module_state module) <tag> #1 _ #0)]) @@ -216,9 +216,9 @@ (-> Text (Operation <type>)) (///extension.lifted (function (_ state) - (case (|> state (get@ #.modules) (plist.value module_name)) + (case (|> state (value@ #.modules) (plist.value module_name)) (#.Some module) - (#try.Success [state (get@ <tag> module)]) + (#try.Success [state (value@ <tag> module)]) #.None ((/.except' unknown_module module_name) state)))))] @@ -258,18 +258,18 @@ (text\= self_name type_module))] (///extension.lifted (function (_ state) - (case (|> state (get@ #.modules) (plist.value self_name)) + (case (|> state (value@ #.modules) (plist.value self_name)) (#.Some module) (let [namespaced_tags (list\map (|>> [self_name]) tags)] - (#try.Success [(update@ #.modules - (plist.revised self_name - (|>> (update@ #.tags (function (_ tag_bindings) - (list\fold (function (_ [idx tag] table) - (plist.has tag [idx namespaced_tags exported? type] table)) - tag_bindings - (list.enumeration tags)))) - (update@ #.types (plist.has type_name [namespaced_tags exported? type])))) - state) + (#try.Success [(revised@ #.modules + (plist.revised self_name + (|>> (revised@ #.tags (function (_ tag_bindings) + (list\fold (function (_ [idx tag] table) + (plist.has tag [idx namespaced_tags exported? type] table)) + tag_bindings + (list.enumeration tags)))) + (revised@ #.types (plist.has type_name [namespaced_tags exported? type])))) + state) []])) #.None ((/.except' unknown_module self_name) state)))))) 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 052173d1f..44d3b7deb 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 @@ -32,13 +32,13 @@ (def: (local? name scope) (-> Text Scope Bit) (|> scope - (get@ [#.locals #.mappings]) + (value@ [#.locals #.mappings]) (plist.contains? name))) (def: (local name scope) (-> Text Scope (Maybe [Type Variable])) (|> scope - (get@ [#.locals #.mappings]) + (value@ [#.locals #.mappings]) (plist.value name) (maybe\map (function (_ [type value]) [type (#variable.Local value)])))) @@ -46,18 +46,18 @@ (def: (captured? name scope) (-> Text Scope Bit) (|> scope - (get@ [#.captured #.mappings]) + (value@ [#.captured #.mappings]) (plist.contains? name))) (def: (captured name scope) (-> Text Scope (Maybe [Type Variable])) (loop [idx 0 - mappings (get@ [#.captured #.mappings] scope)] + mappings (value@ [#.captured #.mappings] scope)] (case mappings (#.Item [_name [_source_type _source_ref]] mappings') (if (text\= name _name) (#.Some [_source_type (#variable.Foreign idx)]) - (recur (inc idx) mappings')) + (recur (++ idx) mappings')) #.End #.None))) @@ -81,7 +81,7 @@ (///extension.lifted (function (_ state) (let [[inner outer] (|> state - (get@ #.scopes) + (value@ #.scopes) (list.split_when (|>> (reference? name))))] (case outer #.End @@ -92,17 +92,17 @@ (..reference name top_outer)) [ref inner'] (list\fold (: (-> Scope [Variable (List Scope)] [Variable (List Scope)]) (function (_ scope ref+inner) - [(#variable.Foreign (get@ [#.captured #.counter] scope)) - (#.Item (update@ #.captured - (: (-> Foreign Foreign) - (|>> (update@ #.counter inc) - (update@ #.mappings (plist.has name [ref_type (product.left ref+inner)])))) - scope) + [(#variable.Foreign (value@ [#.captured #.counter] scope)) + (#.Item (revised@ #.captured + (: (-> Foreign Foreign) + (|>> (revised@ #.counter ++) + (revised@ #.mappings (plist.has name [ref_type (product.left ref+inner)])))) + scope) (product.right ref+inner))])) [init_ref #.End] (list.reversed inner)) scopes (list\compose inner' outer)] - (#.Right [(set@ #.scopes scopes state) + (#.Right [(with@ #.scopes scopes state) (#.Some [ref_type ref])])) ))))) @@ -112,23 +112,23 @@ (def: .public (with_local [name type] action) (All [a] (-> [Text Type] (Operation a) (Operation a))) (function (_ [bundle state]) - (case (get@ #.scopes state) + (case (value@ #.scopes state) (#.Item head tail) - (let [old_mappings (get@ [#.locals #.mappings] head) - new_var_id (get@ [#.locals #.counter] head) - new_head (update@ #.locals - (: (-> Local Local) - (|>> (update@ #.counter inc) - (update@ #.mappings (plist.has name [type new_var_id])))) - head)] - (case (///.result' [bundle (set@ #.scopes (#.Item new_head tail) state)] + (let [old_mappings (value@ [#.locals #.mappings] head) + new_var_id (value@ [#.locals #.counter] head) + new_head (revised@ #.locals + (: (-> Local Local) + (|>> (revised@ #.counter ++) + (revised@ #.mappings (plist.has name [type new_var_id])))) + head)] + (case (///.result' [bundle (with@ #.scopes (#.Item new_head tail) state)] action) (#try.Success [[bundle' state'] output]) - (case (get@ #.scopes state') + (case (value@ #.scopes state') (#.Item head' tail') - (let [scopes' (#.Item (set@ #.locals (get@ #.locals head) head') + (let [scopes' (#.Item (with@ #.locals (value@ #.locals head) head') tail')] - (#try.Success [[bundle' (set@ #.scopes scopes' state')] + (#try.Success [[bundle' (with@ #.scopes scopes' state')] output])) _ @@ -161,19 +161,19 @@ (def: .public (with_scope name action) (All [a] (-> Text (Operation a) (Operation a))) (function (_ [bundle state]) - (let [parent_name (case (get@ #.scopes state) + (let [parent_name (case (value@ #.scopes state) #.End (list) (#.Item top _) - (get@ #.name top))] - (case (action [bundle (update@ #.scopes - (|>> (#.Item (scope parent_name name))) - state)]) + (value@ #.name top))] + (case (action [bundle (revised@ #.scopes + (|>> (#.Item (scope parent_name name))) + state)]) (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (update@ #.scopes - (|>> list.tail (maybe.else (list))) - state')] + (#try.Success [[bundle' (revised@ #.scopes + (|>> list.tail (maybe.else (list))) + state')] output]) (#try.Failure error) @@ -185,9 +185,9 @@ (Operation Register) (///extension.lifted (function (_ state) - (case (get@ #.scopes state) + (case (value@ #.scopes state) (#.Item top _) - (#try.Success [state (get@ [#.locals #.counter] top)]) + (#try.Success [state (value@ [#.locals #.counter] top)]) #.End (exception.except ..cannot_get_next_reference_when_there_is_no_scope []))))) @@ -204,5 +204,5 @@ (def: .public (environment scope) (-> Scope (List Variable)) (|> scope - (get@ [#.captured #.mappings]) + (value@ [#.captured #.mappings]) (list\map (function (_ [_ [_ ref]]) (ref_variable ref))))) 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 56924a102..fe296c83e 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 @@ -299,11 +299,11 @@ ... re-implementing the same functionality for records makes no sense. ... Records, thus, get transformed into tuples by ordering the elements. (def: .public (order record) - (-> (List [Name Code]) (Operation [(List Code) Type])) + (-> (List [Name Code]) (Operation [Nat (List Code) Type])) (case record - ... empty_record = empty_tuple = unit = [] + ... empty_record = empty_tuple = unit/any = [] #.End - (\ ///.monad in [(list) Any]) + (\ ///.monad in [0 (list) Any]) (#.Item [head_k head_v] _) (do {! ///.monad} @@ -334,7 +334,7 @@ .let [ordered_tuple (list\map (function (_ idx) (maybe.trusted (dictionary.value idx idx->val))) tuple_range)]] - (in [ordered_tuple recordT])) + (in [size_ts ordered_tuple recordT])) )) (def: .public (record archive analyse members) @@ -349,12 +349,12 @@ _ (do {! ///.monad} [members (normal members) - [membersC recordT] (order members) + [record_size membersC recordT] (..order members) expectedT (///extension.lifted meta.expected_type)] (case expectedT (#.Var _) (do ! - [inferenceT (//inference.record recordT) + [inferenceT (//inference.record record_size recordT) [inferredT membersA] (//inference.general archive analyse inferenceT membersC)] (in (/.tuple membersA))) 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 ed980b1e6..f1ffa9026 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 @@ -18,15 +18,15 @@ (def: .public (with_type expected) (All [a] (-> Type (Operation a) (Operation a))) - (///extension.localized (get@ #.expected) (set@ #.expected) + (///extension.localized (value@ #.expected) (with@ #.expected) (function.constant (#.Some expected)))) (def: .public (with_env action) (All [a] (-> (Check a) (Operation a))) (function (_ (^@ stateE [bundle state])) - (case (action (get@ #.type_context state)) + (case (action (value@ #.type_context state)) (#try.Success [context' output]) - (#try.Success [[bundle (set@ #.type_context context' state)] + (#try.Success [[bundle (with@ #.type_context context' state)] output]) (#try.Failure error) @@ -34,7 +34,7 @@ (def: .public with_fresh_env (All [a] (-> (Operation a) (Operation a))) - (///extension.localized (get@ #.type_context) (set@ #.type_context) + (///extension.localized (value@ #.type_context) (with@ #.type_context) (function.constant check.fresh_context))) (def: .public (infer actualT) 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 81fc21caa..cc34e04cf 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 @@ -68,7 +68,7 @@ (case expansion (^ (list& <lux_def_module> referrals)) (|> (recur archive <lux_def_module>) - (\ ! map (update@ #/.referrals (list\compose referrals)))) + (\ ! map (revised@ #/.referrals (list\compose referrals)))) _ (|> expansion 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 aa1730655..508242cd8 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 @@ -1140,24 +1140,22 @@ phase.lifted)] (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.value name) - (maybe.else name) - jvm.var) - - #.None - actualJC))))) - true - (list.zipped/2 parameters inputsJT)))))) + (list.every? (function (_ [expectedJC actualJC]) + (jvm\= expectedJC (: (Type Value) + (case (jvm_parser.var? actualJC) + (#.Some name) + (|> aliasing + (dictionary.value name) + (maybe.else name) + jvm.var) + + #.None + actualJC)))) + (list.zipped/2 parameters inputsJT)))))) (def: index_parameter (-> Nat .Type) - (|>> (n.* 2) inc #.Parameter)) + (|>> (n.* 2) ++ #.Parameter)) (def: (jvm_type_var_mapping owner_tvars method_tvars) (-> (List Text) (List Text) [(List .Type) Mapping]) 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 61f4e3763..0242d94b6 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 @@ -279,9 +279,9 @@ super_classT super_interfaceT+)] state (extension.lifted 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)] + .let [analyse (value@ [#directive.analysis #directive.phase] state) + synthesize (value@ [#directive.synthesis #directive.phase] state) + generate (value@ [#directive.generation #directive.phase] state)] methods (monad.map ! (..method_definition [mapping selfT] [analyse synthesize generate]) methods) ... _ (directive.lifted_generation 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 604292cdd..329c79611 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 @@ -63,7 +63,7 @@ (def: (context [module_id artifact_id]) (-> Context Context) ... TODO: Find a better way that doesn't rely on clever tricks. - [module_id (n.- (inc artifact_id) 0)]) + [module_id (n.- (++ artifact_id) 0)]) ... TODO: Inline "evaluate!'" into "evaluate!" ASAP (def: (evaluate!' archive generate code//type codeS) @@ -87,9 +87,9 @@ (-> Archive Type Code (Operation anchor expression directive [Type expression Any]))) (do phase.monad [state (///.lifted 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)] + .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) + synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) + generate (value@ [#/////directive.generation #/////directive.phase] state)] [_ codeA] (/////directive.lifted_analysis (/////analysis.with_scope (typeA.with_fresh_env @@ -123,9 +123,9 @@ (Operation anchor expression directive [Type expression Any]))) (do {! phase.monad} [state (///.lifted 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)] + .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) + synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) + generate (value@ [#/////directive.generation #/////directive.phase] state)] [_ code//type codeA] (/////directive.lifted_analysis (/////analysis.with_scope (typeA.with_fresh_env @@ -175,9 +175,9 @@ (Operation anchor expression directive [expression Any]))) (do phase.monad [state (///.lifted 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)] + .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) + synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) + generate (value@ [#/////directive.generation #/////directive.phase] state)] [_ codeA] (/////directive.lifted_analysis (/////analysis.with_scope (typeA.with_fresh_env @@ -199,15 +199,15 @@ (do phase.monad [[bundle state] phase.get_state .let [eval (/////analysis/evaluation.evaluator expander - (get@ [#/////directive.synthesis #/////directive.state] state) - (get@ [#/////directive.generation #/////directive.state] state) - (get@ [#/////directive.generation #/////directive.phase] state))]] + (value@ [#/////directive.synthesis #/////directive.state] state) + (value@ [#/////directive.generation #/////directive.state] state) + (value@ [#/////directive.generation #/////directive.phase] state))]] (phase.set_state [bundle - (update@ [#/////directive.analysis #/////directive.state] - (: (-> /////analysis.State+ /////analysis.State+) - (|>> product.right - [(///analysis.bundle eval host_analysis)])) - state)]))) + (revised@ [#/////directive.analysis #/////directive.state] + (: (-> /////analysis.State+ /////analysis.State+) + (|>> product.right + [(///analysis.bundle eval host_analysis)])) + state)]))) (def: (announce_definition! short type) (All [anchor expression directive] @@ -310,8 +310,8 @@ (function (_ extension_name phase archive [alias def_name]) (do phase.monad [_ (///.lifted - (phase.sub [(get@ [#/////directive.analysis #/////directive.state]) - (set@ [#/////directive.analysis #/////directive.state])] + (phase.sub [(value@ [#/////directive.analysis #/////directive.state]) + (with@ [#/////directive.analysis #/////directive.state])] (define_alias alias def_name)))] (in /////directive.no_requirements)))])) @@ -405,9 +405,9 @@ (^ (list programC)) (do phase.monad [state (///.lifted 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)] + .let [analyse (value@ [#/////directive.analysis #/////directive.phase] state) + synthesize (value@ [#/////directive.synthesis #/////directive.phase] state) + generate (value@ [#/////directive.generation #/////directive.phase] state)] programS (prepare_program archive analyse synthesize programC) current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) 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 a8caf13bf..e18b6d356 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 @@ -128,7 +128,7 @@ list\join) conditionalsG (|> conditionalsG+ (list\map product.right) - (monad.seq _.monad))]] + (monad.all _.monad))]] (in (do _.monad [@else _.new_label] ($_ _.composite 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 a749fb6cd..be90b8876 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 @@ -948,7 +948,7 @@ (monad.map _.monad (.function (_ register) ($_ _.composite (_.aload 0) - (_.aload (inc register)) + (_.aload (++ register)) (_.putfield class (///reference.foreign_name register) $Object)))))] (method.method method.public "<init>" (anonymous_init_method env) (list) @@ -966,7 +966,7 @@ (in ($_ _.composite (_.new class) _.dup - (monad.seq _.monad captureG+) + (monad.all _.monad captureG+) (_.invokespecial class "<init>" (anonymous_init_method env)))))) (def: (returnG returnT) 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 45d6873da..02ddfbd71 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 @@ -84,7 +84,7 @@ .let [foreigns (|> conditionals (list\map (|>> product.right synthesis.path/then //case.dependencies)) (list& (//case.dependencies (synthesis.path/then else))) - list.joined + list.together (set.of_list _.hash) set.list) @expression (_.constant (reference.artifact [context_module context_artifact])) 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 f683c9b9a..c531d05d9 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 @@ -7,7 +7,7 @@ ["." function] ["." try] ["<>" parser - ["<s>" synthesis (#+ Parser)]]] + ["<.>" synthesis (#+ Parser)]]] [data ["." product] ["." text @@ -41,7 +41,7 @@ (-> Text (Generator s))] Handler)) (function (_ extension_name phase archive input) - (case (<s>.result parser input) + (case (<synthesis>.result parser input) (#try.Success input') (handler extension_name phase archive input') @@ -51,11 +51,11 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! (..custom [($_ <>.and - <s>.any - <s>.any - (<>.some (<s>.tuple ($_ <>.and - (<s>.tuple (<>.many <s>.i64)) - <s>.any)))) + <synthesis>.any + <synthesis>.any + (<>.some (<synthesis>.tuple ($_ <>.and + (<synthesis>.tuple (<>.many <synthesis>.i64)) + <synthesis>.any)))) (function (_ extension_name phase archive [input else conditionals]) (do {! /////.monad} [inputG (phase archive input) @@ -101,9 +101,9 @@ (/.install "and" (binary (product.uncurried //runtime.i64::and))) (/.install "or" (binary (product.uncurried //runtime.i64::or))) (/.install "xor" (binary (product.uncurried //runtime.i64::xor))) - (/.install "left-shift" (binary (product.uncurried //runtime.i64::left_shift))) - (/.install "right-shift" (binary (product.uncurried //runtime.i64::right_shift))) - + (/.install "left-shift" (binary (product.uncurried //runtime.i64::left_shifted))) + (/.install "right-shift" (binary (product.uncurried //runtime.i64::right_shifted))) + (/.install "<" (binary (product.uncurried _.<))) (/.install "=" (binary (product.uncurried _.=))) (/.install "+" (binary (product.uncurried (..capped _.+)))) 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 7bc4f46df..fae91850c 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 @@ -124,7 +124,7 @@ (list))))))] [left_choice _.nil (<|)] - [right_choice (_.string "") inc] + [right_choice (_.string "") ++] ) (def: (alternation @otherwise pre! post!) @@ -248,7 +248,7 @@ pattern_matching! (pattern_matching $output expression archive pathP) .let [storage (|> pathP ////synthesis/case.storage - (get@ #////synthesis/case.bindings) + (value@ #////synthesis/case.bindings) set.list (list\map (function (_ register) [(..register register) 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 917ab8503..41faa95b6 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 @@ -56,7 +56,7 @@ (_.funcall/+ [(_.function/1 @closure) inits])))))) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: .public (function expression archive [environment arity bodyS]) (Generator (Abstraction Synthesis)) 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 db8c9b18e..7eca077bf 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location inc) + [lux (#- Location) ["." meta] [abstract ["." monad (#+ do)]] @@ -90,13 +90,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (syntax: (runtime: [declaration (<>.or <code>.local_identifier 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 df957a3cd..6755b8f33 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 @@ -31,7 +31,7 @@ (def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (|>> [tag right?] //runtime.variant) (expression archive valueS)))) 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 6a5f40ef7..3802776c8 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 @@ -36,7 +36,7 @@ type <code>.any]) (with_identifiers [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.repeated arity (macro.identifier "input")))] + [g!input+ (monad.all ! (list.repeated arity (macro.identifier "input")))] (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension)) (All [(~ g!anchor) (~ g!expression) (~ g!directive)] (-> ((~ type) (~ g!expression)) @@ -48,7 +48,7 @@ [(~+ (|> g!input+ (list\map (function (_ g!input) (list g!input (` ((~ g!phase) (~ g!archive) (~ g!input)))))) - list.joined))] + list.together))] ((~' in) ((~ g!extension) [(~+ g!input+)]))) (~' _) 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 b89ca3c5a..9b0431808 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 @@ -144,7 +144,7 @@ (push_cursor! @temp)))))] [left_choice _.null (<|)] - [right_choice (_.string "") inc] + [right_choice (_.string "") ++] ) (def: (alternation pre! post!) 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 cccb72dd5..fdfc768a0 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 @@ -56,7 +56,7 @@ (_.var "curried")) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: @@arguments (_.var "arguments")) 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 57916d38a..368c69bb0 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 @@ -68,7 +68,7 @@ (def: .public low (-> (I64 Any) (I64 Any)) - (let [mask (dec (i64.left_shifted 32 1))] + (let [mask (-- (i64.left_shifted 32 1))] (|>> (i64.and mask)))) (def: .public unit @@ -88,13 +88,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (syntax: (runtime: [declaration (<>.or <code>.local_identifier 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 ebaaa7f49..6253b38b5 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 @@ -31,7 +31,7 @@ (def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (//runtime.variant (_.i32 (.int tag)) (//runtime.flag right?)) 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 aebb30404..417f74d2d 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 @@ -174,7 +174,7 @@ (#synthesis.Alt leftP rightP) (do phase.monad [@alt_else //runtime.forge_label - left! (path' (inc stack_depth) @alt_else @end phase archive leftP) + left! (path' (++ stack_depth) @alt_else @end phase archive leftP) right! (path' stack_depth @else @end phase archive rightP)] (in ($_ _.composite _.dup 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 f3938db06..5eafc6556 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 @@ -74,7 +74,7 @@ (if (arity.multiary? arity) (|> (n.min arity /arity.maximum) list.indices - (list\map (|>> inc (/apply.method classT environment arity @begin body))) + (list\map (|>> ++ (/apply.method classT environment arity @begin body))) (list& (/implementation.method arity @begin body))) (list (/implementation.method' //runtime.apply::name arity @begin body)))))] (do phase.monad @@ -129,7 +129,7 @@ (function (_ batchG) ($_ _.composite (_.checkcast /abstract.class) - (monad.seq _.monad batchG) + (monad.all _.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/partial/count.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux index 30f27def6..1ec854f71 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux @@ -6,11 +6,11 @@ [target [jvm ["_" bytecode (#+ Bytecode)] + ["." type] [encoding [name (#+ External)] - ["." signed]] - ["." type]]]]] - ["." ///// #_ + ["." signed]]]]]] + ["." //// #_ ["#." abstract]]) (def: .public field "partials") @@ -30,5 +30,5 @@ (Bytecode Any) ($_ _.composite ..this - (_.getfield /////abstract.class ..field ..type) + (_.getfield ////abstract.class ..field ..type) )) 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 57d285e8a..19dc23779 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 @@ -35,7 +35,7 @@ ($_ _.composite (|> _.aconst_null (list.repeated amount) - (monad.seq _.monad)) + (monad.all _.monad)) (_\in []))) (def: .public (get class register) 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 da3292be8..1addefe99 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 @@ -79,7 +79,7 @@ (def: .public (method class environment function_arity @begin body apply_arity) (-> (Type Class) (Environment Synthesis) Arity Label (Bytecode Any) Arity (Resource Method)) - (let [num_partials (dec function_arity) + (let [num_partials (-- function_arity) over_extent (i.- (.int apply_arity) (.int function_arity))] (method.method //.modifier ////runtime.apply::name @@ -95,15 +95,15 @@ [@default _.new_label @labelsH _.new_label @labelsT (|> _.new_label - (list.repeated (dec num_partials)) - (monad.seq _.monad)) + (list.repeated (-- num_partials)) + (monad.all _.monad)) .let [cases (|> (list\compose (#.Item [@labelsH @labelsT]) (list @default)) list.enumeration (list\map (function (_ [stage @case]) (let [current_partials (|> (list.indices stage) (list\map (///partial.get class)) - (monad.seq _.monad)) + (monad.all _.monad)) already_partial? (n.> 0 stage) exact_match? (i.= over_extent (.int stage)) has_more_than_necessary? (i.> over_extent (.int stage))] @@ -135,10 +135,10 @@ ... (i.< over_extent (.int stage)) (let [current_environment (|> (list.indices (list.size environment)) (list\map (///foreign.get class)) - (monad.seq _.monad)) + (monad.all _.monad)) missing_partials (|> _.aconst_null (list.repeated (|> num_partials (n.- apply_arity) (n.- stage))) - (monad.seq _.monad))] + (monad.all _.monad))] ($_ _.composite (_.new class) _.dup @@ -150,7 +150,7 @@ missing_partials (_.invokevirtual class //init.name (//init.type environment function_arity)) _.areturn))))))) - (monad.seq _.monad))]] + (monad.all _.monad))]] ($_ _.composite ///partial/count.value (_.tableswitch (try.trusted (signed.s4 +0)) @default [@labelsH @labelsT]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index cd92f4aca..3c1922063 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -45,7 +45,7 @@ (def: (partials arity) (-> Arity (List (Type Value))) - (list.repeated (dec arity) ////type.value)) + (list.repeated (-- arity) ////type.value)) (def: .public (type environment arity) (-> (Environment Synthesis) Arity (Type category.Method)) @@ -64,7 +64,7 @@ (def: .public (super environment_size arity) (-> Nat Arity (Bytecode Any)) - (let [arity_register (inc environment_size)] + (let [arity_register (++ environment_size)] ($_ _.composite (if (arity.unary? arity) ..no_partials @@ -80,7 +80,7 @@ (list\map (function (_ register) (put register (_.aload (offset register))))) - (monad.seq _.monad))) + (monad.all _.monad))) (def: .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) @@ -98,5 +98,5 @@ ////reference.this (..super environment_size arity) (store_all environment_size (///foreign.put class) offset_foreign) - (store_all (dec arity) (///partial.put class) offset_partial) + (store_all (-- arity) (///partial.put class) offset_partial) _.return))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux index d153b35e9..c126f0296 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 @@ -47,7 +47,7 @@ ($_ _.composite (_.new class) _.dup - (monad.seq _.monad foreign_setup) + (monad.all _.monad foreign_setup) (///partial.new arity) (_.invokespecial class //init.name (//init.type environment arity)))) 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 6757bc987..9b69ffbae 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 @@ -64,11 +64,11 @@ ... should be the case. (|> updatesG (list\map product.left) - (monad.seq _.monad)) + (monad.all _.monad)) (|> updatesG list.reversed (list\map product.right) - (monad.seq _.monad)) + (monad.all _.monad)) (_.goto @begin))))) (def: .public (scope translate archive [offset initsS+ iterationS]) @@ -83,7 +83,7 @@ ($_ _.composite initG (_.astore (n.+ offset index))))) - (monad.seq _.monad))]] + (monad.all _.monad))]] (in ($_ _.composite initializationG (_.set_label @begin) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux index f11c871c1..1d414ab77 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -44,8 +44,7 @@ [constant ["#/." arity]] [variable - [partial - ["#/." count]]]]] + ["#/." count]]]] ["//#" /// #_ [// ["." version] @@ -60,11 +59,14 @@ [io (#+ lux_context)] [archive (#+ Archive)]]]]]]) -(type: .public Byte_Code Binary) +(type: .public Byte_Code + Binary) -(type: .public Definition [Text Byte_Code]) +(type: .public Definition + [Text Byte_Code]) -(type: .public Anchor [Label Register]) +(type: .public Anchor + [Label Register]) (template [<name> <base>] [(type: .public <name> @@ -542,7 +544,7 @@ (def: generate_function (Operation Any) (let [apply::method+ (|> (enum.range n.enum - (inc //function/arity.minimum) + (++ //function/arity.minimum) //function/arity.maximum) (list\map (function (_ arity) (method.method method.public ..apply::name (..apply::type arity) @@ -553,7 +555,7 @@ (monad.map _.monad _.aload))] ($_ _.composite previous_inputs - (_.invokevirtual //function.class ..apply::name (..apply::type (dec arity))) + (_.invokevirtual //function.class ..apply::name (..apply::type (-- arity))) (_.checkcast //function.class) (_.aload arity) (_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum)) 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 062708388..815c4fca0 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 @@ -50,12 +50,12 @@ (in (do {! _.monad} [_ (_.int (.i64 (list.size membersS))) _ (_.anewarray $Object)] - (monad.seq ! membersI)))))) + (monad.all ! membersI)))))) (def: .public (tag lefts right?) (-> Nat Bit (Bytecode Any)) (case (if right? - (.inc lefts) + (.++ lefts) lefts) 0 _.iconst_0 1 _.iconst_1 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 d21adc3ef..ef53de88c 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 @@ -145,7 +145,7 @@ (..push! @temp)))))] [left_choice _.nil (<|)] - [right_choice (_.string "") inc] + [right_choice (_.string "") ++] ) (def: (alternation pre! post!) @@ -250,7 +250,7 @@ (def: .public dependencies (-> Path (List Var)) (|>> ////synthesis/case.storage - (get@ #////synthesis/case.dependencies) + (value@ #////synthesis/case.dependencies) set.list (list\map (function (_ variable) (.case variable 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 65930fb75..509808d62 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 @@ -57,7 +57,7 @@ (_.apply/* inits @self)]))) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: (@scope function_name) (-> Context Label) @@ -82,7 +82,7 @@ initialize! (list\fold (.function (_ post pre!) ($_ _.then pre! - (_.local/1 (..input post) (_.item (|> post inc .int _.int) @curried)))) + (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried)))) initialize_self! (list.indices arity)) pack (|>> (list) _.array) 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 a1c3d7ca2..988274333 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location inc) + [lux (#- Location) ["." meta] [abstract ["." monad (#+ do)]] @@ -105,13 +105,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (def: module_id 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 8c78dea65..6bbd167eb 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 @@ -31,7 +31,7 @@ (def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (//runtime.variant tag right?) (generate archive valueS)))) 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 04cce603a..28744fe33 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 @@ -145,7 +145,7 @@ (..push! @temp)))))] [left_choice _.null (<|)] - [right_choice (_.string "") inc] + [right_choice (_.string "") ++] ) (def: (alternation pre! post!) @@ -260,7 +260,7 @@ (def: .public dependencies (-> Path (List Var)) (|>> ////synthesis/case.storage - (get@ #////synthesis/case.dependencies) + (value@ #////synthesis/case.dependencies) set.list (list\map (function (_ variable) (.case variable 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 5cc25a622..175fadfc3 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 @@ -41,7 +41,7 @@ (|>> (///reference.foreign //reference.system) :expected)) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: (@scope function_name) (-> Context Label) 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 6f69ba6e6..bd36c0785 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location inc) + [lux (#- Location) ["." meta] [abstract ["." monad (#+ do)]] @@ -73,13 +73,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (def: module_id @@ -342,7 +342,7 @@ (def: .public low (-> (I64 Any) (I64 Any)) - (let [mask (dec (i64.left_shifted 32 1))] + (let [mask (-- (i64.left_shifted 32 1))] (|>> (i64.and mask)))) (runtime: (i64//right_shifted param subject) 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 69979afd6..a7fe22f6d 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 @@ -36,7 +36,7 @@ (def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (//runtime.variant tag right?) (expression archive valueS)))) 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 df2a1a3fc..5d66730d1 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 @@ -148,7 +148,7 @@ )))] [left_choice _.none (<|)] - [right_choice (_.string "") inc] + [right_choice (_.string "") ++] ) (def: (with_looping in_closure? g!once body!) @@ -298,7 +298,7 @@ (def: .public dependencies (-> Path (List SVar)) (|>> case.storage - (get@ #case.dependencies) + (value@ #case.dependencies) set.list (list\map (function (_ variable) (.case variable 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 b1ce3f5c8..eee714ea8 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 @@ -19,7 +19,7 @@ ["/#" // #_ ["#." reference] ["//#" /// #_ - [analysis (#+ Variant Tuple Environment Abstraction Application Analysis)] + [analysis (#+ Environment Abstraction Application Analysis)] [synthesis (#+ Synthesis)] ["#." generation (#+ Context)] ["//#" /// #_ @@ -64,7 +64,7 @@ (in (_.apply/* @function inits))))) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) 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 e26aca84a..207b74654 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- inc) + [lux (#- ++) ["." meta] [abstract ["." monad (#+ do)]] @@ -112,13 +112,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (syntax: (runtime: [declaration (<>.or <code>.local_identifier @@ -395,7 +395,7 @@ ..none (..some (..i64::64 idx))))))) -(def: inc +(def: ++ (|>> (_.+ (_.int +1)))) (def: (within? top value) @@ -408,7 +408,7 @@ (runtime: (text::char idx text) (_.if (|> idx (within? (_.len/1 text))) - (_.return (|> text (_.slice idx (..inc idx)) _.ord/1 ..i64::64)) + (_.return (|> text (_.slice idx (..++ idx)) _.ord/1 ..i64::64)) (_.raise (_.Exception/1 (_.unicode "[Lux Error] Cannot get char from text."))))) (def: runtime::text 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 1ab751074..756e3f00d 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 @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- Variant Tuple) [abstract ["." monad (#+ do)]] [target @@ -31,7 +31,7 @@ (def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (//runtime.variant tag right?) (generate archive valueS)))) 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 cd41e5f3d..288fdc4bf 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 @@ -187,7 +187,7 @@ ..fail! (..push_cursor! $temp))))]) ([/////synthesis.side/left false (<|)] - [/////synthesis.side/right true inc]) + [/////synthesis.side/right true ++]) (^ (/////synthesis.member/left 0)) (///////phase\in (_.item (_.int +1) ..peek)) 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 34334c668..4ae6231c5 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 @@ -68,8 +68,8 @@ (def: (input_declaration register) (-> Register Expression) - (_.set! (|> register inc //case.register) - (|> $curried (_.item (|> register inc .int _.int))))) + (_.set! (|> register ++ //case.register) + (|> $curried (_.item (|> register ++ .int _.int))))) (def: .public (function expression archive [environment arity bodyS]) (Generator (Abstraction Synthesis)) 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 e6134cb95..624826639 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 @@ -67,7 +67,7 @@ arity s.nat]) (with_identifiers [g!_ g!proc g!name g!translate g!inputs] (do {@ macro.monad} - [g!input+ (monad.seq @ (list.repeated arity (macro.identifier "input")))] + [g!input+ (monad.all @ (list.repeated arity (macro.identifier "input")))] (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!proc)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Expression) (-> Text ..Proc)) @@ -79,7 +79,7 @@ [(~+ (|> g!input+ (list/map (function (_ g!input) (list g!input (` ((~ g!translate) (~ g!input)))))) - list.joined))] + list.together))] ((~' in) ((~ g!proc) [(~+ g!input+)]))) (~' _) @@ -125,7 +125,7 @@ (-> Text Proc) (function (_ proc_name) (function (_ translate inputsS) - (case (s.result inputsS ($_ p.seq s.nat (s.tuple (p.many s.any)) s.any)) + (case (s.result inputsS ($_ p.and s.nat (s.tuple (p.many s.any)) s.any)) (#e.Success [offset initsS+ bodyS]) (loopT.translate_loop translate offset initsS+ bodyS) 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 36e86df65..21f2ded5a 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location inc i64) + [lux (#- Location ++ i64) ["." meta] [abstract ["." monad (#+ do)]] @@ -79,13 +79,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (syntax: (runtime: [declaration (<>.or <code>.local_identifier @@ -718,7 +718,7 @@ @frac::decode )) -(def: inc +(def: ++ (-> Expression Expression) (|>> (_.+ (_.int +1)))) @@ -749,8 +749,8 @@ ($_ _.then (_.set! idx (|> (_.apply_kw (list param (_.if (|> startF (_.= (_.int +0))) subject - (text_clip (inc startF) - (inc subjectL) + (text_clip (++ startF) + (++ subjectL) subject))) (list ["fixed" (_.bool #1)]) (_.var "regexpr")) @@ -766,7 +766,7 @@ (_.set! length (_.length text)) (_.set! to (_.+ additional minimum)) (_.if (within? length to) - (..some (text_clip (inc minimum) (inc to) text)) + (..some (text_clip (++ minimum) (++ to) text)) ..none)))) (def: (char_at idx text) @@ -777,7 +777,7 @@ (runtime: (text::char text idx) (_.if (|> idx (within? (_.length text))) ($_ _.then - (_.set! idx (inc idx)) + (_.set! idx (++ idx)) (..some (i64::of_float (char_at idx text)))) ..none)) 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 3c74989df..748f56955 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 @@ -34,7 +34,7 @@ (def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (|>> (//runtime.variant tag right?)) (expression archive valueS)))) 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 608bffb04..26ccf116d 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 @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- local) ["@" target] [data [text 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 fa95d1ba3..2af4e0dee 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 @@ -151,7 +151,7 @@ (..push! @temp)))))] [left_choice _.nil (<|)] - [right_choice (_.string "") inc] + [right_choice (_.string "") ++] ) (def: (with_looping in_closure? g!once g!continue? body!) 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 b64895b0e..192807829 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 @@ -61,7 +61,7 @@ (_.apply/* inits @self)]))) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) @@ -73,7 +73,7 @@ .let [function_name (///reference.artifact [function_module function_artifact]) @curried (_.local "curried") arityO (|> arity .int _.int) - limitO (|> arity dec .int _.int) + limitO (|> arity -- .int _.int) @num_args (_.local "num_args") @self (_.local function_name) initialize_self! (_.set (list (//case.register 0)) @self) 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 1bcb1d528..8a825e466 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- inc) + [lux #* ["." meta] [abstract ["." monad (#+ do)]] @@ -74,13 +74,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (def: module_id 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 f51cad8bc..57861f7d4 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 @@ -31,7 +31,7 @@ (def: .public (variant generate archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (//runtime.variant tag right?) (generate archive valueS)))) 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 70dfee409..ae841dc5b 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 @@ -180,7 +180,7 @@ ..fail! (push_cursor! @temp))))]) ([/////synthesis.side/left false (<|)] - [/////synthesis.side/right true inc]) + [/////synthesis.side/right true ++]) (^ (/////synthesis.member/left 0)) (///////phase\in (..push_cursor! (_.vector_ref/2 ..peek (_.int +0)))) 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 c52ecd6dd..dc3c75d98 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 @@ -42,7 +42,7 @@ arity <code>.nat]) (with_identifiers [g!_ g!extension g!name g!phase g!inputs] (do {! macro.monad} - [g!input+ (monad.seq ! (list.repeated arity (macro.identifier "input")))] + [g!input+ (monad.all ! (list.repeated arity (macro.identifier "input")))] (in (list (` (def: .public ((~ (code.local_identifier name)) (~ g!extension)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) Handler) @@ -53,7 +53,7 @@ [(~+ (|> g!input+ (list\map (function (_ g!input) (list g!input (` ((~ g!phase) (~ g!input)))))) - list.joined))] + list.together))] ((~' in) ((~ g!extension) [(~+ g!input+)]))) (~' _) 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 a36feb036..58d8b55c6 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 @@ -58,7 +58,7 @@ (def: @missing (_.var "missing")) (def: input - (|>> inc //case.register)) + (|>> ++ //case.register)) (def: .public (function expression archive [environment arity bodyS]) (Generator (Abstraction Synthesis)) 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 95dfef826..452da33ef 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 @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Location inc) + [lux (#- Location) ["." meta] [abstract ["." monad (#+ do)]] @@ -61,13 +61,13 @@ (syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_identifier)) body <code>.any]) (do {! meta.monad} - [ids (monad.seq ! (list.repeated (list.size vars) meta.seed))] + [ids (monad.all ! (list.repeated (list.size vars) meta.seed))] (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.joined))] + list.together))] (~ body))))))) (syntax: (runtime: [declaration (<>.or <code>.local_identifier 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 ebc933d4c..3c21b5e17 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 @@ -34,7 +34,7 @@ (def: .public (variant expression archive [lefts right? valueS]) (Generator (Variant Synthesis)) (let [tag (if right? - (inc lefts) + (++ lefts) lefts)] (///////phase\map (|>> [tag right?] //runtime.variant) (expression archive valueS)))) 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 c234f9902..9e80130aa 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 @@ -59,8 +59,8 @@ (case structure (#///analysis.Variant variant) (do phase.monad - [valueS (optimization' (get@ #///analysis.value variant))] - (in (/.variant (set@ #///analysis.value valueS variant)))) + [valueS (optimization' (value@ #///analysis.value variant))] + (in (/.variant (with@ #///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 7f2666d8b..1a178900e 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 @@ -71,7 +71,7 @@ thenC) (#///analysis.Complex (#///analysis.Tuple tuple)) - (let [tuple::last (dec (list.size tuple))] + (let [tuple::last (-- (list.size tuple))] (list\fold (function (_ [tuple::lefts tuple::member] nextC) (.case tuple::member (#///analysis.Simple #///analysis.Unit) @@ -81,7 +81,7 @@ (let [right? (n.= tuple::last tuple::lefts) end?' (and end? right?)] (<| (///\map (|>> (#/.Seq (#/.Access (#/.Member (if right? - (#.Right (dec tuple::lefts)) + (#.Right (-- tuple::lefts)) (#.Left tuple::lefts))))))) (path' tuple::member end?') (when> [(new> (not end?') [])] [(///\map ..clean_up)]) @@ -193,10 +193,10 @@ (loop [lefts 0 patterns patterns] (with_expansions [<failure> (as_is (list)) - <continue> (as_is (recur (inc lefts) + <continue> (as_is (recur (++ lefts) tail)) <member> (as_is (if (list.empty? tail) - (#.Right (dec lefts)) + (#.Right (-- lefts)) (#.Left lefts)))] (case patterns #.End @@ -308,7 +308,7 @@ (case path (^ (/.path/seq #/.Pop path')) (let [[pops post_pops] (count_pops path')] - [(inc pops) post_pops]) + [(++ pops) post_pops]) _ [0 path])) @@ -341,8 +341,8 @@ path_storage (^ (/.path/bind register)) - (update@ #bindings (set.has register) - path_storage) + (revised@ #bindings (set.has register) + path_storage) (#/.Bit_Fork _ default otherwise) (|> (case otherwise @@ -376,12 +376,12 @@ (list\fold for_synthesis synthesis_storage members) (#/.Reference (#///reference.Variable (#///reference/variable.Local register))) - (if (set.member? (get@ #bindings synthesis_storage) register) + (if (set.member? (value@ #bindings synthesis_storage) register) synthesis_storage - (update@ #dependencies (set.has (#///reference/variable.Local register)) synthesis_storage)) + (revised@ #dependencies (set.has (#///reference/variable.Local register)) synthesis_storage)) (#/.Reference (#///reference.Variable var)) - (update@ #dependencies (set.has var) synthesis_storage) + (revised@ #dependencies (set.has var) synthesis_storage) (^ (/.function/apply [functionS argsS])) (list\fold for_synthesis synthesis_storage (#.Item functionS argsS)) @@ -390,17 +390,17 @@ (list\fold for_synthesis synthesis_storage environment) (^ (/.branch/case [inputS pathS])) - (update@ #dependencies - (set.union (get@ #dependencies (for_path pathS synthesis_storage))) - (for_synthesis inputS synthesis_storage)) + (revised@ #dependencies + (set.union (value@ #dependencies (for_path pathS synthesis_storage))) + (for_synthesis inputS synthesis_storage)) (^ (/.branch/let [inputS register exprS])) - (update@ #dependencies - (set.union (|> synthesis_storage - (update@ #bindings (set.has register)) - (for_synthesis exprS) - (get@ #dependencies))) - (for_synthesis inputS synthesis_storage)) + (revised@ #dependencies + (set.union (|> synthesis_storage + (revised@ #bindings (set.has register)) + (for_synthesis exprS) + (value@ #dependencies))) + (for_synthesis inputS synthesis_storage)) (^ (/.branch/if [testS thenS elseS])) (list\fold for_synthesis synthesis_storage (list testS thenS elseS)) @@ -409,15 +409,15 @@ (for_synthesis whole synthesis_storage) (^ (/.loop/scope [start initsS+ iterationS])) - (update@ #dependencies - (set.union (|> synthesis_storage - (update@ #bindings (set.union (|> initsS+ - list.enumeration - (list\map (|>> product.left (n.+ start))) - (set.of_list n.hash)))) - (for_synthesis iterationS) - (get@ #dependencies))) - (list\fold for_synthesis synthesis_storage initsS+)) + (revised@ #dependencies + (set.union (|> synthesis_storage + (revised@ #bindings (set.union (|> initsS+ + list.enumeration + (list\map (|>> product.left (n.+ start))) + (set.of_list n.hash)))) + (for_synthesis iterationS) + (value@ #dependencies))) + (list\fold for_synthesis synthesis_storage initsS+)) (^ (/.loop/recur replacementsS+)) (list\fold for_synthesis synthesis_storage replacementsS+) 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 7becfbe4d..1e7ca8cc3 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 @@ -55,7 +55,7 @@ (with_expansions [<apply> (as_is (/.function/apply [funcS argsS]))] (case funcS (^ (/.function/abstraction functionS)) - (if (n.= (get@ #/.arity functionS) + (if (n.= (value@ #/.arity functionS) (list.size argsS)) (do ! [locals /.locals] @@ -94,7 +94,7 @@ (-> (-> Synthesis (Operation Synthesis)) Path (Operation Path)) (case path (#/.Bind register) - (phase\in (#/.Bind (inc register))) + (phase\in (#/.Bind (++ register))) (^template [<tag>] [(<tag> left right) @@ -160,7 +160,7 @@ (#////reference.Variable variable) (case variable (#////reference/variable.Local register) - (phase\in (/.variable/local (inc register))) + (phase\in (/.variable/local (++ register))) (#////reference/variable.Foreign register) (..find_foreign environment register)) @@ -176,7 +176,7 @@ (do phase.monad [inputS' (grow environment inputS) bodyS' (grow environment bodyS)] - (in (/.branch/let [inputS' (inc register) bodyS']))) + (in (/.branch/let [inputS' (++ register) bodyS']))) (#/.If [testS thenS elseS]) (do phase.monad @@ -202,7 +202,7 @@ (do {! phase.monad} [initsS+' (monad.map ! (grow environment) initsS+) iterationS' (grow environment iterationS)] - (in (/.loop/scope [(inc start) initsS+' iterationS']))) + (in (/.loop/scope [(++ start) initsS+' iterationS']))) (#/.Recur argumentsS+) (|> argumentsS+ @@ -258,7 +258,7 @@ (grow env') (\ ! map (function (_ body) {#/.environment environment - #/.arity (inc down_arity') + #/.arity (++ down_arity') #/.body body}))) _ @@ -270,7 +270,7 @@ (case (//loop.optimization false 1 (list) abstraction) (#.Some [startL initsL bodyL]) (/.function/abstraction {#/.environment environment - #/.arity (get@ #/.arity abstraction) + #/.arity (value@ #/.arity abstraction) #/.body (/.loop/scope [startL initsL bodyL])}) #.None 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 d9890dbc9..a615c00ef 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 @@ -24,7 +24,7 @@ (def: .public (register_optimization offset) (-> Register (-> Register Register)) - (|>> dec (n.+ offset))) + (|>> -- (n.+ offset))) (def: (path_optimization body_optimization offset) (-> (Transform Synthesis) Register (Transform Path)) @@ -86,9 +86,9 @@ (case structure (#analysis.Variant variant) (do maybe.monad - [value' (|> variant (get@ #analysis.value) (recur false))] + [value' (|> variant (value@ #analysis.value) (recur false))] (in (|> variant - (set@ #analysis.value value') + (with@ #analysis.value value') /.variant))) (#analysis.Tuple tuple) @@ -141,10 +141,10 @@ (^ (/.loop/scope scope)) (do {! maybe.monad} [inits' (|> scope - (get@ #/.inits) + (value@ #/.inits) (monad.map ! (recur false))) - iteration' (recur return? (get@ #/.iteration scope))] - (in (/.loop/scope {#/.start (|> scope (get@ #/.start) (register_optimization offset)) + iteration' (recur return? (value@ #/.iteration scope))] + (in (/.loop/scope {#/.start (|> scope (value@ #/.start) (register_optimization offset)) #/.inits inits' #/.iteration iteration'}))) @@ -183,6 +183,6 @@ (def: .public (optimization true_loop? offset inits functionS) (-> Bit Register (List Synthesis) Abstraction (Maybe [Register (List Synthesis) Synthesis])) - (|> (get@ #/.body functionS) - (body_optimization true_loop? offset (get@ #/.environment functionS) (get@ #/.arity functionS)) + (|> (value@ #/.body functionS) + (body_optimization true_loop? offset (value@ #/.environment functionS) (value@ #/.arity functionS)) (maybe\map (|>> [offset inits])))) 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 feadf7fa5..cb647c284 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 @@ -29,7 +29,7 @@ (def: (prune redundant register) (-> Register Register Register) (if (n.> redundant register) - (dec register) + (-- register) register)) (type: (Remover a) @@ -44,7 +44,7 @@ (if (n.= redundant register) (recur post) (#/.Seq (#/.Bind (if (n.> redundant register) - (dec register) + (-- register) register)) (recur post))) @@ -60,7 +60,7 @@ (recur post) (#/.Seq (#/.Access (#/.Member member)) (#/.Seq (#/.Bind (if (n.> redundant register) - (dec register) + (-- register) register)) (recur post)))) @@ -188,7 +188,7 @@ (def: (default arity) (-> Arity Redundancy) - (product.right (..extended 0 (inc arity) ..initial))) + (product.right (..extended 0 (++ arity) ..initial))) (type: (Optimization a) (-> [Redundancy a] (Try [Redundancy a]))) 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 365f9e804..f181fd077 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux @@ -42,7 +42,7 @@ (do ! [id (archive.id module archive) [descriptor document] (archive.find module archive)] - (in [[module id] (get@ #descriptor.registry descriptor)])))))] + (in [[module id] (value@ #descriptor.registry descriptor)])))))] (case (list.one (function (_ [[module module_id] registry]) (do maybe.monad [program_id (artifact.remember ..name registry)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index 15539ae10..d4b612bf2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -70,13 +70,13 @@ (type: Char Nat) -(template [<name> <extension> <diff>] +(template [<extension> <diff> <name>] [(template: (<name> value) [(<extension> <diff> value)])] - [!inc "lux i64 +" 1] - [!inc/2 "lux i64 +" 2] - [!dec "lux i64 -" 1] + ["lux i64 +" 1 !++] + ["lux i64 +" 2 !++/2] + ["lux i64 -" 1 !--] ) (template: (!clip from to text) @@ -198,14 +198,14 @@ (:expected <<otherwise>>))]) (template: (!horizontal where offset source_code) - [[(update@ #.column inc where) - (!inc offset) + [[(revised@ #.column ++ where) + (!++ offset) source_code]]) (inline: (!new_line where) (-> Location Location) (let [[where::file where::line where::column] where] - [where::file (!inc where::line) 0])) + [where::file (!++ where::line) 0])) (inline: (!forward length where) (-> Nat Location Location) @@ -214,7 +214,7 @@ (template: (!vertical where offset source_code) [[(!new_line where) - (!inc offset) + (!++ offset) source_code]]) (template [<name> <close> <tag>] @@ -272,8 +272,8 @@ (<| (let [g!content (!clip offset g!end source_code)]) (!guarantee_no_new_lines where offset source_code g!content) (#.Right [[(let [size (!n/- offset g!end)] - (update@ #.column (|>> (!n/+ size) (!n/+ 2)) where)) - (!inc g!end) + (revised@ #.column (|>> (!n/+ size) (!n/+ 2)) where)) + (!++ g!end) source_code] [where (#.Text g!content)]])) @@ -365,11 +365,11 @@ exponent (static ..no_exponent)] (<| (!with_char+ source_code//size source_code end char/0 <frac_output>) (!if_digit?+ char/0 - (recur (!inc end) exponent) + (recur (!++ end) exponent) [["e" "E"] (if (same? (static ..no_exponent) exponent) - (<| (!with_char+ source_code//size source_code (!inc end) char/1 <failure>) + (<| (!with_char+ source_code//size source_code (!++ end) char/1 <failure>) (`` ("lux syntax char case!" char/1 [[<signs>] (<| (!with_char+ source_code//size source_code (!n/+ 2 end) char/2 <failure>) @@ -389,10 +389,10 @@ (loop [end offset] (<| (!with_char+ source_code//size source_code end char <int_output>) (!if_digit?+ char - (recur (!inc end)) + (recur (!++ end)) [[<frac_separator>] - (frac_parser source_code//size start where (!inc end) source_code)] + (frac_parser source_code//size start where (!++ end) source_code)] <int_output>)))) ) @@ -404,7 +404,7 @@ (loop [g!end offset] (<| (!with_char+ source_code//size source_code g!end g!char (!number_output source_code start g!end <codec> <tag>)) (!if_digit?+ g!char - (recur (!inc g!end)) + (recur (!++ g!end)) [] (!number_output source_code start g!end <codec> <tag>)))))] @@ -413,13 +413,13 @@ ) (template: (!signed_parser source_code//size offset where source_code @aliases @end) - [(<| (let [g!offset/1 (!inc offset)]) + [(<| (let [g!offset/1 (!++ offset)]) (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end) (!if_digit? g!char/1 - (signed_parser source_code//size offset where (!inc/2 offset) source_code) - (!full_name_parser offset [where (!inc offset) source_code] where @aliases #.Identifier)))]) + (signed_parser source_code//size offset where (!++/2 offset) source_code) + (!full_name_parser offset [where (!++ offset) source_code] where @aliases #.Identifier)))]) -(with_expansions [<output> (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where) +(with_expansions [<output> (#.Right [[(revised@ #.column (|>> (!n/+ (!n/- start end))) where) end source_code] (!clip start end source_code)])] @@ -430,12 +430,12 @@ (loop [end offset] (<| (!with_char+ source_code//size source_code end char <output>) (!if_name_char?|tail char - (recur (!inc end)) + (recur (!++ end)) <output>)))))) (template: (!half_name_parser @offset @char @module) [(!if_name_char?|head @char - (!letE [source' name] (..name_part_parser @offset where (!inc @offset) source_code) + (!letE [source' name] (..name_part_parser @offset where (!++ @offset) source_code) (#.Right [source' [@module name]])) (!failure ..!half_name_parser where @offset source_code))]) @@ -444,7 +444,7 @@ (<| (!with_char+ source_code//size source_code offset/0 char/0 (!end_of_file where offset/0 source_code current_module)) (if (!n/= (char (~~ (static ..name_separator))) char/0) - (<| (let [offset/1 (!inc offset/0)]) + (<| (let [offset/1 (!++ offset/0)]) (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) (!half_name_parser offset/1 char/1 current_module)) @@ -462,7 +462,7 @@ (let [[where' offset' source_code'] source']) (!with_char source_code' offset' char/separator <simple>) (if (!n/= (char (~~ (static ..name_separator))) char/separator) - (<| (let [offset'' (!inc offset')]) + (<| (let [offset'' (!++ offset')]) (!letE [source'' complex] (..name_part_parser offset'' (!forward 1 where') offset'' source_code')) (if ("lux text =" "" complex) (let [[where offset source_code] source] @@ -482,9 +482,9 @@ ... [expression ...] ... [form "(" [#* expression] ")"]) -(with_expansions [<consume_1> (as_is where (!inc offset/0) source_code) - <move_1> (as_is [(!forward 1 where) (!inc offset/0) source_code]) - <move_2> (as_is [(!forward 1 where) (!inc/2 offset/0) source_code]) +(with_expansions [<consume_1> (as_is where (!++ offset/0) source_code) + <move_1> (as_is [(!forward 1 where) (!++ offset/0) source_code]) + <move_2> (as_is [(!forward 1 where) (!++/2 offset/0) source_code]) <recur> (as_is (parse current_module aliases source_code//size))] (template: (!close closer) @@ -492,8 +492,8 @@ (def: (bit_syntax value [where offset/0 source_code]) (-> Bit (Parser Code)) - (#.Right [[(update@ #.column (|>> !inc/2) where) - (!inc/2 offset/0) + (#.Right [[(revised@ #.column (|>> !++/2) where) + (!++/2 offset/0) source_code] [where (#.Bit value)]])) @@ -530,11 +530,11 @@ ... Text [(~~ (static ..text_delimiter))] - (text_parser where (!inc offset/0) source_code) + (text_parser where (!++ offset/0) source_code) ... Special code [(~~ (static ..sigil))] - (<| (let [offset/1 (!inc offset/0)]) + (<| (let [offset/1 (!++ offset/0)]) (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) ("lux syntax char case!" char/1 @@ -559,15 +559,15 @@ ... (~~ (static ..frac_separator)) ] ... It's either a Rev, an identifier, or a comment. - (with_expansions [<rev_parser> (rev_parser source_code//size offset/0 where (!inc offset/1) source_code) + (with_expansions [<rev_parser> (rev_parser source_code//size offset/0 where (!++ offset/1) source_code) <short_name_parser> (!short_name_parser source_code//size current_module [where offset/1 source_code] where #.Identifier) - <comment_parser> (case ("lux text index" (!inc offset/1) (static text.new_line) source_code) + <comment_parser> (case ("lux text index" (!++ offset/1) (static text.new_line) source_code) (#.Some end) (recur (!vertical where end source_code)) _ (!end_of_file where offset/1 source_code current_module))] - (<| (let [offset/1 (!inc offset/0)]) + (<| (let [offset/1 (!++ offset/0)]) (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) (!if_digit? char/1 @@ -577,7 +577,7 @@ ("lux syntax char case!" char/1 [[(~~ (static ..name_separator))] ... It's either an identifier, or a comment. - (<| (let [offset/2 (!inc offset/1)]) + (<| (let [offset/2 (!++ offset/1)]) (!with_char+ source_code//size source_code offset/2 char/2 (!end_of_file where offset/2 source_code current_module)) ("lux syntax char case!" char/2 @@ -597,7 +597,7 @@ ... else (!if_digit? char/0 ... Natural number - (nat_parser source_code//size offset/0 where (!inc offset/0) source_code) + (nat_parser source_code//size offset/0 where (!++ offset/0) source_code) ... Identifier (!full_name_parser offset/0 [<consume_1>] where aliases #.Identifier)) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index 58dc336dd..7f7d205c3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -190,11 +190,11 @@ (template [<with> <query> <tag> <type>] [(def: .public (<with> value) (-> <type> (All [a] (-> (Operation a) (Operation a)))) - (extension.temporary (set@ <tag> value))) + (extension.temporary (with@ <tag> value))) (def: .public <query> (Operation <type>) - (extension.read (get@ <tag>)))] + (extension.read (value@ <tag>)))] [with_locals locals #locals Nat] [with_currying? currying? #currying? Bit] @@ -204,7 +204,7 @@ (All [a] (-> (Operation a) (Operation a))) (<<| (do phase.monad [locals ..locals]) - (..with_locals (inc locals)))) + (..with_locals (++ locals)))) (template [<name> <tag>] [(template: .public (<name> content) @@ -389,12 +389,12 @@ (#Loop loop) (case loop (#Scope scope) - (|> (format (%.nat (get@ #start scope)) - " " (|> (get@ #inits scope) + (|> (format (%.nat (value@ #start scope)) + " " (|> (value@ #inits scope) (list\map %synthesis) (text.interposed " ") (text.enclosed ["[" "]"])) - " " (%synthesis (get@ #iteration scope))) + " " (%synthesis (value@ #iteration scope))) (text.enclosed ["(#loop " ")"])) (#Recur args) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index 06a2d5ca8..d810d7aca 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -82,7 +82,7 @@ (def: next (-> Archive ID) - (|>> :representation (get@ #next))) + (|>> :representation (value@ #next))) (def: .public empty Archive @@ -111,8 +111,8 @@ (#try.Success [next (|> archive :representation - (update@ #..resolver (dictionary.has module [next #.None])) - (update@ #..next inc) + (revised@ #..resolver (dictionary.has module [next #.None])) + (revised@ #..next ++) :abstraction)])))) (def: .public (has module [descriptor document output] archive) @@ -122,7 +122,7 @@ (#.Some [id #.None]) (#try.Success (|> archive :representation - (update@ #..resolver (dictionary.has module [id (#.Some [descriptor document output])])) + (revised@ #..resolver (dictionary.has module [id (#.Some [descriptor document output])])) :abstraction)) (#.Some [id (#.Some [existing_descriptor existing_document existing_output])]) @@ -160,7 +160,7 @@ (def: .public archived (-> Archive (List Module)) (|>> :representation - (get@ #resolver) + (value@ #resolver) dictionary.entries (list.all (function (_ [module [id descriptor+document]]) (case descriptor+document @@ -180,13 +180,13 @@ (def: .public reserved (-> Archive (List Module)) (|>> :representation - (get@ #resolver) + (value@ #resolver) dictionary.keys)) (def: .public reservations (-> Archive (List [Module ID])) (|>> :representation - (get@ #resolver) + (value@ #resolver) dictionary.entries (list\map (function (_ [module [id _]]) [module id])))) @@ -196,17 +196,17 @@ (let [[+next +resolver] (:representation additions)] (|> archive :representation - (update@ #next (n.max +next)) - (update@ #resolver (function (_ resolver) - (list\fold (function (_ [module [id entry]] resolver) - (case entry - (#.Some _) - (dictionary.has module [id entry] resolver) - - #.None - resolver)) - resolver - (dictionary.entries +resolver)))) + (revised@ #next (n.max +next)) + (revised@ #resolver (function (_ resolver) + (list\fold (function (_ [module [id entry]] resolver) + (case entry + (#.Some _) + (dictionary.has module [id entry] resolver) + + #.None + resolver)) + resolver + (dictionary.entries +resolver)))) :abstraction))) (type: Reservation @@ -281,6 +281,6 @@ {#next next #resolver (list\fold (function (_ [module id] archive) (dictionary.has module [id #.None] archive)) - (get@ #resolver (:representation ..empty)) + (value@ #resolver (:representation ..empty)) reservations)})))) ) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux index de1858b97..e4cc633de 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -50,7 +50,7 @@ (def: .public artifacts (-> Registry (Row Artifact)) - (|>> :representation (get@ #artifacts))) + (|>> :representation (value@ #artifacts))) (def: next (-> Registry ID) @@ -62,8 +62,8 @@ [id (|> registry :representation - (update@ #artifacts (row.add {#id id - #category #Anonymous})) + (revised@ #artifacts (row.suffix {#id id + #category #Anonymous})) :abstraction)])) (template [<tag> <create> <fetch>] @@ -73,18 +73,18 @@ [id (|> registry :representation - (update@ #artifacts (row.add {#id id - #category (<tag> name)})) - (update@ #resolver (dictionary.has name id)) + (revised@ #artifacts (row.suffix {#id id + #category (<tag> name)})) + (revised@ #resolver (dictionary.has name id)) :abstraction)])) (def: .public (<fetch> registry) (-> Registry (List Text)) (|> registry :representation - (get@ #artifacts) + (value@ #artifacts) row.list - (list.all (|>> (get@ #category) + (list.all (|>> (value@ #category) (case> (<tag> name) (#.Some name) _ #.None)))))] @@ -99,7 +99,7 @@ (def: .public (remember name registry) (-> Text Registry (Maybe ID)) (|> (:representation registry) - (get@ #resolver) + (value@ #resolver) (dictionary.value name))) (def: .public writer @@ -119,8 +119,8 @@ artifacts (: (Writer (Row Category)) (binary.row/64 category))] (|>> :representation - (get@ #artifacts) - (row\map (get@ #category)) + (value@ #artifacts) + (row\map (value@ #category)) artifacts))) (exception: .public (invalid_category {tag Nat}) 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 30777c282..a14d708d5 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -59,7 +59,7 @@ (def: .public signature (-> (Document Any) Signature) - (|>> :representation (get@ #signature))) + (|>> :representation (value@ #signature))) (def: .public (writer content) (All [d] (-> (Writer d) (Writer (Document d)))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux index bc413b413..8b4dfedb8 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux @@ -29,7 +29,7 @@ (def: .public (description signature) (-> Signature Text) - (format (%.name (get@ #name signature)) " " (%.nat (get@ #version signature)))) + (format (%.name (value@ #name signature)) " " (%.nat (value@ #version signature)))) (def: .public writer (Writer 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 2df8c36ec..6ee936f42 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux @@ -57,7 +57,7 @@ (do {! state.monad} [.let [parents (case (archive.find module archive) (#try.Success [descriptor document]) - (get@ #descriptor.references descriptor) + (value@ #descriptor.references descriptor) (#try.Failure error) ..fresh)] 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 c5483ac0c..b4fa30d12 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -61,9 +61,9 @@ (def: (archive fs static) (All [!] (-> (file.System !) Static file.Path)) - (format (get@ #static.target static) + (format (value@ #static.target static) (\ fs separator) - (get@ #static.host static))) + (value@ #static.host static))) (def: (unversioned_lux_archive fs static) (All [!] (-> (file.System !) Static file.Path)) @@ -88,7 +88,7 @@ (format (..module fs static module_id) (\ fs separator) (%.nat artifact_id) - (get@ #static.artifact_extension static))) + (value@ #static.artifact_extension static))) (def: (ensure_directory fs path) (-> (file.System Async) file.Path (Async (Try Any))) @@ -125,7 +125,7 @@ (def: .public (enable fs static) (-> (file.System Async) Static (Async (Try Any))) (do (try.with async.monad) - [_ (..ensure_directory fs (get@ #static.target static))] + [_ (..ensure_directory fs (value@ #static.target static))] (..ensure_directory fs (..archive fs static)))) (def: (general_descriptor fs static) @@ -174,7 +174,7 @@ content (document.read $.key document)] (in [module content]))) (archive.archived archive)))] - (in (set@ #.modules modules (fresh_analysis_state host))))) + (in (with@ #.modules modules (fresh_analysis_state host))))) (def: (cached_artifacts fs static module_id) (-> (file.System Async) Static archive.ID (Async (Try (Dictionary Text Binary)))) @@ -231,7 +231,7 @@ (case artifact_category #artifact.Anonymous (do ! - [.let [output (row.add [artifact_id #.None data] output)] + [.let [output (row.suffix [artifact_id #.None data] output)] _ (\ host re_learn context #.None directive)] (in [definitions [analysers @@ -241,7 +241,7 @@ output])) (#artifact.Definition name) - (let [output (row.add [artifact_id #.None data] output)] + (let [output (row.suffix [artifact_id #.None data] output)] (if (text\= $/program.name name) (in [definitions [analysers @@ -260,7 +260,7 @@ (#artifact.Analyser extension) (do ! - [.let [output (row.add [artifact_id #.None data] output)] + [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] (in [definitions [(dictionary.has extension (:as analysis.Handler value) analysers) @@ -271,7 +271,7 @@ (#artifact.Synthesizer extension) (do ! - [.let [output (row.add [artifact_id #.None data] output)] + [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] (in [definitions [analysers @@ -282,7 +282,7 @@ (#artifact.Generator extension) (do ! - [.let [output (row.add [artifact_id #.None data] output)] + [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] (in [definitions [analysers @@ -293,7 +293,7 @@ (#artifact.Directive extension) (do ! - [.let [output (row.add [artifact_id #.None data] output)] + [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] (in [definitions [analysers @@ -304,7 +304,7 @@ (#artifact.Custom name) (do ! - [.let [output (row.add [artifact_id (#.Some name) data] output)] + [.let [output (row.suffix [artifact_id (#.Some name) data] output)] _ (\ host re_learn context (#.Some name) directive)] (in [definitions [analysers @@ -333,8 +333,8 @@ (\ ! map (|>> [exported? type annotations] #.Definition [def_name]))))) - (get@ #.definitions content))] - (in [(document.write $.key (set@ #.definitions definitions content)) + (value@ #.definitions content))] + (in [(document.write $.key (with@ #.definitions definitions content)) bundles]))) (def: (load_definitions fs static module_id host_environment descriptor document) @@ -345,8 +345,8 @@ Bundles])))) (do (try.with async.monad) [actual (cached_artifacts fs static module_id) - .let [expected (|> descriptor (get@ #descriptor.registry) artifact.artifacts)] - [document bundles output] (async\in (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))] + .let [expected (|> descriptor (value@ #descriptor.registry) artifact.artifacts)] + [document bundles output] (async\in (loaded_document (value@ #static.artifact_extension static) host_environment module_id expected actual document))] (in [[descriptor document output] bundles]))) (def: (purge! fs static [module_name module_id]) @@ -361,12 +361,12 @@ (def: (valid_cache? expected actual) (-> Descriptor Input Bit) - (and (text\= (get@ #descriptor.name expected) - (get@ #////.module actual)) - (text\= (get@ #descriptor.file expected) - (get@ #////.file actual)) - (n.= (get@ #descriptor.hash expected) - (get@ #////.hash actual)))) + (and (text\= (value@ #descriptor.name expected) + (value@ #////.module actual)) + (text\= (value@ #descriptor.file expected) + (value@ #////.file actual)) + (n.= (value@ #descriptor.hash expected) + (value@ #////.hash actual)))) (type: Purge (Dictionary Module archive.ID)) @@ -390,7 +390,7 @@ (if (purged? module_name) purge (if (|> descriptor - (get@ #descriptor.references) + (value@ #descriptor.references) set.list (list.any? purged?)) (dictionary.has module_name module_id purge) @@ -417,7 +417,7 @@ (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)] + [input (//context.read fs ..pseudo_module import contexts (value@ #static.host_module_extension static) module_name)] (in [(..valid_cache? descriptor input) [module_name [module_id [descriptor document]]]]))))))) load_order (|> pre_loaded_caches @@ -447,7 +447,7 @@ (archive.has module descriptor,document,output archive)) archive loaded_caches) - analysis_state (..analysis_state (get@ #static.host static) archive)] + analysis_state (..analysis_state (value@ #static.host static) archive)] (in [archive analysis_state (list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]] @@ -473,5 +473,5 @@ (#try.Failure error) (in (#try.Success [archive.empty - (fresh_analysis_state (get@ #static.host static)) + (fresh_analysis_state (value@ #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 0c7969507..979edaa76 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -6,6 +6,7 @@ [predicate (#+ Predicate)] ["." monad (#+ Monad do)]] [control + ["." maybe] ["." try (#+ Try)] ["." exception (#+ exception:)] [concurrency @@ -17,7 +18,8 @@ [encoding ["." utf8]]] [collection - ["." dictionary (#+ Dictionary)]]] + ["." dictionary (#+ Dictionary)] + ["." list]]] [world ["." file]]]] [program @@ -138,8 +140,8 @@ (type: .public Enumeration (Dictionary file.Path Binary)) -(def: (context_listing fs directory enumeration) - (-> (file.System Async) Context Enumeration (Async (Try Enumeration))) +(def: (context_listing fs context directory enumeration) + (-> (file.System Async) Context file.Path Enumeration (Async (Try Enumeration))) (do {! (try.with async.monad)} [enumeration (|> directory (\ fs directory_files) @@ -147,23 +149,40 @@ (if (text.ends_with? ..lux_extension file) (do ! [source_code (\ fs read file)] - (async\in (dictionary.has' (file.name fs file) source_code enumeration))) + (async\in (dictionary.has' (text.replaced context "" file) source_code enumeration))) (in enumeration))) enumeration)) (\ ! join))] (|> directory (\ fs sub_directories) - (\ ! map (monad.fold ! (context_listing fs) enumeration)) + (\ ! map (monad.fold ! (context_listing fs context) enumeration)) (\ ! join)))) (def: Action (type (All [a] (Async (Try a))))) +(def: (canonical fs context) + (-> (file.System Async) Context (Action Context)) + (do (try.with async.monad) + [subs (\ fs sub_directories context)] + (in (|> subs + list.head + (maybe.else context) + (file.parent fs) + (maybe.else context))))) + (def: .public (listing fs contexts) (-> (file.System Async) (List Context) (Action Enumeration)) - (monad.fold (: (Monad Action) - (try.with async.monad)) - (..context_listing fs) - (: Enumeration - (dictionary.empty text.hash)) - contexts)) + (let [! (: (Monad Action) + (try.with async.monad))] + (monad.fold ! + (function (_ context enumeration) + (do ! + [context (..canonical fs context)] + (..context_listing fs + (format context (\ fs separator)) + context + enumeration))) + (: Enumeration + (dictionary.empty text.hash)) + contexts))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager.lux b/stdlib/source/library/lux/tool/compiler/meta/packager.lux index 21c15d551..744d0ecb9 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager.lux @@ -35,8 +35,8 @@ (-> dependency.Order Order) (list\map (function (_ [module [module_id [descriptor document]]]) (|> descriptor - (get@ #descriptor.registry) + (value@ #descriptor.registry) artifact.artifacts row.list - (list\map (|>> (get@ #artifact.id))) + (list\map (|>> (value@ #artifact.id))) [module_id])))) 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 06ef9b25b..d9707b0c0 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -143,7 +143,7 @@ (let [class_path (|> custom (maybe\map (|>> name.internal name.read)) (maybe.else (runtime.class_name [module artifact])) - (text.suffix (get@ #static.artifact_extension static)))] + (text.suffix (value@ #static.artifact_extension static)))] (do try.monad [_ (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new class_path) sink)] (in (do_to sink 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 90d28197a..a229c78a1 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -104,7 +104,7 @@ (..bundle_module output)) entry_content (: (Try tar.Content) (|> descriptor - (get@ #descriptor.references) + (value@ #descriptor.references) set.list (list.all (function (_ module) (dictionary.value module mapping))) (list\map (|>> ..module_file _.string _.load_relative/1)) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index 6e28d5c1a..ee02eacc9 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -75,14 +75,14 @@ (do Monad<!> [state (platform.initialize platform generation_bundle) state (platform.compile platform - (set@ #cli.module syntax.prelude configuration) - (set@ [#extension.state - #directive.analysis #directive.state - #extension.state - #.info #.mode] - #.Interpreter - state)) - [state _] (\ (get@ #platform.file_system platform) + (with@ #cli.module syntax.prelude configuration) + (with@ [#extension.state + #directive.analysis #directive.state + #extension.state + #.info #.mode] + #.Interpreter + state)) + [state _] (\ (value@ #platform.file_system platform) lift (phase.result' state enter_module)) _ (\ Console<!> write ..welcome_message)] (in state))) @@ -102,9 +102,9 @@ (-> Code <Interpretation>)) (do {! phase.monad} [state (extension.lifted 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)] + .let [analyse (value@ [#directive.analysis #directive.phase] state) + synthesize (value@ [#directive.synthesis #directive.phase] state) + generate (value@ [#directive.generation #directive.phase] state)] [_ codeT codeA] (directive.lifted_analysis (analysis.with_scope (type.with_fresh_env @@ -154,10 +154,10 @@ (do phase.monad [[codeT codeV] (interpret configuration code) state phase.get_state] - (in (/type.represent (get@ [#extension.state - #directive.analysis #directive.state - #extension.state] - state) + (in (/type.represent (value@ [#extension.state + #directive.analysis #directive.state + #extension.state] + state) codeT codeV)))) @@ -171,24 +171,24 @@ (All [anchor expression directive] (-> <Context> (Try [<Context> Text]))) (do try.monad - [.let [[_where _offset _code] (get@ #source context)] - [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (get@ #source context)) + [.let [[_where _offset _code] (value@ #source context)] + [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (value@ #source context)) [state' representation] (let [... TODO: Simplify ASAP state (:sharing [anchor expression directive] {<Context> context} {(State+ anchor expression directive) - (get@ #state context)})] + (value@ #state context)})] (<| (phase.result' state) ... TODO: Simplify ASAP (:sharing [anchor expression directive] {<Context> context} {(Operation anchor expression directive Text) - (execute (get@ #configuration context) input)})))] + (execute (value@ #configuration context) input)})))] (in [(|> context - (set@ #state state') - (set@ #source source')) + (with@ #state state') + (with@ #source source')) representation])))) (def: .public (run! Monad<!> Console<!> platform configuration generation_bundle) @@ -212,7 +212,7 @@ (if (and (not multi_line?) (text\= ..exit_command line)) (\ Console<!> write ..farewell_message) - (case (read_eval_print (update@ #source (add_line line) context)) + (case (read_eval_print (revised@ #source (add_line line) context)) (#try.Success [context' representation]) (do ! [_ (\ Console<!> write representation)] @@ -222,5 +222,5 @@ (if (ex.match? syntax.end_of_file error) (recur context #1) (exec (log! (ex.error ..error error)) - (recur (set@ #source ..fresh_source context) #0)))))) + (recur (with@ #source ..fresh_source context) #0)))))) ))) |