diff options
Diffstat (limited to '')
20 files changed, 185 insertions, 155 deletions
diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index b7342a650..c1c707a98 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -41,12 +41,12 @@ (def: .public equivalence (Equivalence Artifact) - (# ..hash &equivalence)) + (# ..hash equivalence)) (implementation: .public order (Order Artifact) - (def: &equivalence + (def: equivalence ..equivalence) (def: (< reference subject) diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index e3cfaac74..7ae0c53d3 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -33,7 +33,7 @@ (# ! each (|>> (try.else (list)) (monad.each ! (targets fs)))) (# ! conjoint) - (# ! each (|>> list.together (list& path)))))) + (# ! each (|>> list.together (partial_list path)))))) (def: .public delay Nat diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 4538a2834..4ff240f96 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -143,7 +143,7 @@ (implementation: version_order (Order Version) - (def: &equivalence + (def: equivalence text.equivalence) (def: (< left right) @@ -218,7 +218,8 @@ {try.#Failure error} (if (exception.match? shell.no_more_output error) (write! {try.#Success []}) - (async.upon! write! (console.write_line error console))) + (async.upon! write! (is (Async (Try Any)) + (console.write_line error console)))) {try.#Success line} (async.upon! (function (_ outcome) @@ -229,7 +230,8 @@ {try.#Success _} (async.upon! again (# process <capability> [])))) - (console.write_line line console))))) + (is (Async (Try Any)) + (console.write_line line console)))))) io.run!)] read!))] @@ -269,9 +271,9 @@ _ (revised ///runtime.#parameters - (|>> (list& "-cp" (..jvm_class_path host_dependencies) - "--add-opens" "java.base/java.lang=ALL-UNNAMED" - "-Xss16m")) + (|>> (partial_list "-cp" (..jvm_class_path host_dependencies) + "--add-opens" "java.base/java.lang=ALL-UNNAMED" + "-Xss16m")) runtime))) (def: .public (do! console program fs shell resolution) @@ -290,26 +292,28 @@ (do ///action.monad [[resolution lux] (async#in (..lux resolution (the ///.#lux profile))) .let [host_dependencies (..host_dependencies fs home resolution) - [[command lux_params] output] (case lux - {#JVM dependency} - [(|> (the ///.#java profile) - (has ///runtime.#parameters (list "program._")) - (with_jvm_class_path {.#Item (..path fs home dependency) host_dependencies})) - "program.jar"] - - (^.template [<tag> <runtime> <program>] - [{<tag> dependency} - [(|> dependency - (..path fs home) - (///runtime.for (the <runtime> profile))) - <program>]]) - ([#JS ///.#js "program.js"] - [#Python ///.#java "program.py"] - [#Lua ///.#java "program.lua"] - [#Ruby ///.#java (file.rooted fs "program" ruby_packager.main_file)])) + [[command_environment command lux_params] output] + (case lux + {#JVM dependency} + [(|> (the ///.#java profile) + (has ///runtime.#parameters (list "program._")) + (with_jvm_class_path {.#Item (..path fs home dependency) host_dependencies})) + "program.jar"] + + (^.template [<tag> <runtime> <program>] + [{<tag> dependency} + [(|> dependency + (..path fs home) + (///runtime.for (the <runtime> profile))) + <program>]]) + ([#JS ///.#js "program.js"] + [#Python ///.#java "program.py"] + [#Lua ///.#java "program.lua"] + [#Ruby ///.#java (file.rooted fs "program" ruby_packager.main_file)])) / (# fs separator) cache_directory (format working_directory / target)] - _ (console.write_line ..start console) + _ (is (Async (Try Any)) + (console.write_line ..start console)) .let [full_parameters (list.together (list lux_params (list "build") (..plural "--library" (..libraries fs home resolution)) @@ -319,17 +323,18 @@ (..singular "--target" cache_directory) (..singular "--module" program_module) (..singular "--configuration" (configuration.format (the ///.#configuration profile)))))] - process (# shell execute [environment + process (# shell execute [(dictionary.composite command_environment environment) working_directory command full_parameters]) _ (..log_output! console process) _ (..log_error! console process) exit (# process await []) - _ (console.write_line (if (i.= shell.normal exit) - ..success - ..failure) - console)] + _ (is (Async (Try Any)) + (console.write_line (if (i.= shell.normal exit) + ..success + ..failure) + console))] (in [exit lux (format cache_directory / output)]))))))) diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index 16bfce404..98f1461a8 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -20,11 +20,12 @@ (def: (clean_files! fs root) (-> (file.System Async) Path (Async (Try Any))) - (let [! ///action.monad] - (|> root - (# fs directory_files) - (# ! each (monad.each ! (# fs delete))) - (# ! conjoint)))) + (do [! ///action.monad] + [_ (|> root + (# fs directory_files) + (# ! each (monad.each ! (# fs delete))) + (# ! conjoint))] + (in []))) (def: .public success (-> ///.Target Text) diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index eeecd1f8d..6fcd84e21 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -77,4 +77,5 @@ ///package.#pom [pom pom_data (///dependency/status.verified pom_data)]]))] - (console.write_line ..success console))) + (is (Async (Try Any)) + (console.write_line ..success console)))) diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 6933264d3..41338674d 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -73,7 +73,9 @@ ///package.#pom [pom pom_data (///dependency/status.verified pom_data)]]))] - (console.write_line ..success console)) + (is (Async (Try Any)) + (console.write_line ..success console))) _ - (console.write_line ..failure console))) + (is (Async (Try Any)) + (console.write_line ..failure console)))) diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux index 20bad61fe..23c25e7e1 100644 --- a/stdlib/source/program/aedifex/command/pom.lux +++ b/stdlib/source/program/aedifex/command/pom.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["[0]" try ("[1]#[0]" functor)] - [concurrency - ["[0]" async {"+" Async} ("[1]#[0]" monad)]]] - [data - [text - ["%" format {"+" format}] - [encoding - ["[0]" utf8]]] - [format - ["[0]" xml]]] - [world - ["[0]" file] - ["[0]" console {"+" Console}]]]] - ["[0]" /// "_" - [command {"+" Command}] - ["[1][0]" action] - ["[1][0]" pom]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + ["[0]" try {"+" Try} ("[1]#[0]" functor)] + [concurrency + ["[0]" async {"+" Async} ("[1]#[0]" monad)]]] + [data + [text + ["%" format {"+" format}] + [encoding + ["[0]" utf8]]] + [format + ["[0]" xml]]] + [world + ["[0]" file] + ["[0]" console {"+" Console}]]]] + ["[0]" /// "_" + [command {"+" Command}] + ["[1][0]" action] + ["[1][0]" pom]]) (def: .public success (format "Successfully created POM file: " ///pom.file)) @@ -32,5 +32,6 @@ (try#each (|>> (# xml.codec encoded) (# utf8.codec encoded))) async#in) - _ (# fs write content ///pom.file)] - (console.write_line ..success console))) + _ (# fs write ///pom.file content)] + (is (Async (Try Any)) + (console.write_line ..success console)))) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 3df3e0724..e6d36bfd8 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -4,8 +4,12 @@ [abstract [monad {"+" do}]] [control + [try {"+" Try}] [concurrency ["[0]" async {"+" Async} ("[1]#[0]" monad)]]] + [data + [collection + ["[0]" dictionary]]] [macro ["^" pattern]] [math @@ -41,32 +45,34 @@ (has ///.#program (the ///.#test profile) profile))] (if (i.= shell.normal build_exit) (do ! - [_ (console.write_line ..start console) + [_ (is (Async (Try Any)) + (console.write_line ..start console)) .let [host_dependencies (//build.host_dependencies fs home resolution) - [test_command test_parameters] (case compiler - {//build.#JVM dependency} - (|> program - (///runtime.for (the ///.#java profile)) - (//build.with_jvm_class_path host_dependencies)) + [command_environment test_command test_parameters] (case compiler + {//build.#JVM dependency} + (|> program + (///runtime.for (the ///.#java profile)) + (//build.with_jvm_class_path host_dependencies)) - (^.template [<tag> <runtime>] - [{<tag> artifact} - (///runtime.for (the <runtime> profile) - program)]) - ([//build.#JS ///.#js] - [//build.#Python ///.#python] - [//build.#Lua ///.#lua] - [//build.#Ruby ///.#ruby]))] - process (# shell execute [environment + (^.template [<tag> <runtime>] + [{<tag> artifact} + (///runtime.for (the <runtime> profile) + program)]) + ([//build.#JS ///.#js] + [//build.#Python ///.#python] + [//build.#Lua ///.#lua] + [//build.#Ruby ///.#ruby]))] + process (# shell execute [(dictionary.composite command_environment environment) working_directory test_command test_parameters]) _ (//build.log_output! console process) _ (//build.log_error! console process) exit (# process await []) - _ (console.write_line (if (i.= shell.normal exit) - ..success - ..failure) - console)] + _ (is (Async (Try Any)) + (console.write_line (if (i.= shell.normal exit) + ..success + ..failure) + console))] (in [exit []])) (in [build_exit []]))))) diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux index c61e796df..9c40edd97 100644 --- a/stdlib/source/program/aedifex/command/version.lux +++ b/stdlib/source/program/aedifex/command/version.lux @@ -2,6 +2,7 @@ [library [lux "*" [control + [try {"+" Try}] [concurrency ["[0]" async {"+" Async}]]] ["[0]" meta "_" @@ -16,5 +17,6 @@ (def: .public (do! console profile) (-> (Console Async) (Command Any)) - (console.write_line (version.format meta/version.latest) - console)) + (is (Async (Try Any)) + (console.write_line (version.format meta/version.latest) + console))) diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux index 5bf2e4ef9..4027354d9 100644 --- a/stdlib/source/program/aedifex/dependency.lux +++ b/stdlib/source/program/aedifex/dependency.lux @@ -27,12 +27,12 @@ (def: .public equivalence (Equivalence Dependency) - (# hash &equivalence)) + (# hash equivalence)) (implementation: .public order (Order Dependency) - (def: &equivalence + (def: equivalence ..equivalence) (def: (< reference subject) diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 735ec1ebd..0b9ca5b83 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -73,18 +73,18 @@ (-> ///artifact/type.Type Status (List ///artifact/type.Type)) (with_expansions [<sha-1> (format type ///artifact/extension.sha-1) <md5> (format type ///artifact/extension.md5)] - (list& type - (case status - {///dependency/status.#Unverified} - (list) - - {///dependency/status.#Partial partial} - (list (case partial - {.#Left _} <sha-1> - {.#Right _} <md5>)) - - {///dependency/status.#Verified _} - (list <sha-1> <md5>))))) + (partial_list type + (case status + {///dependency/status.#Unverified} + (list) + + {///dependency/status.#Partial partial} + (list (case partial + {.#Left _} <sha-1> + {.#Right _} <md5>)) + + {///dependency/status.#Verified _} + (list <sha-1> <md5>))))) (def: (update_snapshot [artifact type] now snapshot) (-> Dependency Instant Metadata (Try Metadata)) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 19800f4d9..b7dd105c1 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -141,9 +141,13 @@ (` [(~+ (..artifact' artifact)) (~ (code.text type))]))) -(def: (runtime [program parameters]) +(def: (runtime [environment program parameters]) (Format Runtime) - (` [(~ (code.text program)) + (` [(~+ (list#each (function (_ [var value]) + (` [(~ (code.text var)) + (~ (code.text value))])) + (dictionary.entries environment))) + (~ (code.text program)) (~+ (list#each code.text parameters))])) (def: (compiler [definition parameters]) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 6b3f973ce..a384c5368 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -131,7 +131,7 @@ {.#Some [head tail]} (do try.monad [head (# n.hex decoded head) - output (binary.write_64! index head output)] + output (binary.has_64! index head output)] (again tail (++ chunk) output)) {.#None} diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index e36db11f0..e15fc6552 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -58,5 +58,5 @@ (do [! try.monad] [it it it (..project_parser it) - it (monad.each ! (//project.profile it) (list& //profile.default profiles))] + it (monad.each ! (//project.profile it) (partial_list //profile.default profiles))] (in (mix.with_monoid //profile.monoid list.mix it))))))) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index da92a59d9..094f60507 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -5,7 +5,7 @@ [monad {"+" do}]] [control ["[0]" maybe] - ["<>" parser + ["<>" parser ("[1]#[0]" functor) ["<[0]>" code {"+" Parser}]]] [data ["[0]" text] @@ -184,8 +184,13 @@ (def: runtime (Parser Runtime) - (<code>.tuple (<>.and <code>.text - (<>.some <code>.text)))) + (let [environment (<>#each (dictionary.of_list text.hash) + (<>.some (<code>.tuple (<>.and <code>.text <code>.text))))] + (<code>.tuple + ($_ <>.and + environment + <code>.text + (<>.some <code>.text))))) (def: profile (Parser /.Profile) diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index 323afbb80..8b4e8e0ed 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -114,9 +114,9 @@ (def: (developer' [name email organization]) (-> /.Developer (List XML)) - (list& (..property "name" name) - (..property "email" email) - (|> organization (maybe#each ..developer_organization) (maybe.else (list))))) + (partial_list (..property "name" name) + (..property "email" email) + (|> organization (maybe#each ..developer_organization) (maybe.else (list))))) (template [<name> <type> <tag>] [(def: <name> diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index b76833c34..ada14650b 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - [concurrency - ["[0]" async {"+" Async}]]] - [data - ["[0]" text - ["%" format {"+" format}]]] - [world - [program {"+" Program}] - ["[0]" file] - [net - ["[0]" uri {"+" URI}]]]]] - ["[0]" // - ["/[1]" // "_" - ["[1][0]" local] - ["[1][0]" metadata]]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + ["[0]" try {"+" Try}] + [concurrency + ["[0]" async {"+" Async}]]] + [data + ["[0]" text + ["%" format {"+" format}]]] + [world + [program {"+" Program}] + ["[0]" file] + [net + ["[0]" uri {"+" URI}]]]]] + ["[0]" // + ["/[1]" // "_" + ["[1][0]" local] + ["[1][0]" metadata]]]) (def: (root program /) (-> (Program Async) Text file.Path) @@ -50,13 +50,13 @@ (do [! async.monad] [.let [absolute_path (..absolute_path program (# fs separator) uri)] ? (# fs file? absolute_path) - _ (if ? - (in []) - (case (file.parent fs absolute_path) - {.#Some parent} - (file.make_directories async.monad fs parent) - - _ - (let [! (try.with async.monad)] - (# ! in []))))] - (# fs write content absolute_path)))) + _ (is (Async (Try Any)) + (if ? + (in {try.#Success []}) + (case (file.parent fs absolute_path) + {.#Some parent} + (file.make_directories async.monad fs parent) + + _ + (in {try.#Success []}))))] + (# fs write absolute_path content)))) diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 782b872f1..313be177b 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -84,8 +84,8 @@ ..base_headers {.#Some [user password]} - (list& ["Authorization" (//identity.basic_auth user password)] - ..base_headers))) + (partial_list ["Authorization" (//identity.basic_auth user password)] + ..base_headers))) {.#Some content} http)) _ ((the @http.#body message) {.#Some 0})] diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index 57d18d265..7ba73519d 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -8,7 +8,8 @@ ["[0]" text ["%" format {"+" format}]] [collection - ["[0]" list ("[1]#[0]" monoid)]]] + ["[0]" list ("[1]#[0]" monoid)] + ["[0]" dictionary {"+" Dictionary}]]] [macro ["[0]" template]] [world @@ -16,28 +17,30 @@ (type: .public Runtime (Record - [#program Text + [#environment (Dictionary Text Text) + #program Text #parameters (List Text)])) (def: .public equivalence (Equivalence Runtime) ($_ product.equivalence + (dictionary.equivalence text.equivalence) text.equivalence (list.equivalence text.equivalence) )) -(template [<name> <command> <parameters>] +(template [<name> <command> <environment> <parameters>] [(def: .public <name> Runtime - [#program <command> + [#environment (dictionary.of_list text.hash (`` (list (~~ (template.spliced <environment>))))) + #program <command> #parameters (`` (list (~~ (template.spliced <parameters>))))])] - [default_java "java" ["--add-opens" "java.base/java.lang=ALL-UNNAMED" "-jar"]] - [default_js "node" ["--stack_size=8192"]] - [default_python "python3" []] - [default_lua "lua" []] - ... [default_ruby "RUBY_THREAD_VM_STACK_SIZE=15700000 ruby" []] - [default_ruby "ruby" []] + [default_java "java" [] ["--add-opens" "java.base/java.lang=ALL-UNNAMED" "-jar"]] + [default_js "node" [] ["--stack_size=8192"]] + [default_python "python3" [] []] + [default_lua "lua" [] []] + [default_ruby "ruby" [["RUBY_THREAD_VM_STACK_SIZE" "15700000"]] []] ) (def: .public (for runtime path) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index e803ead3f..0d5b056d1 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -158,7 +158,7 @@ ..timed (do (try.with async.monad) [.let [[compilation_host_dependencies compilation_libraries compilation_compilers compilation_sources compilation_target compilation_module compilation_configuration] compilation] - import (import.import (the platform.#&file_system platform) compilation_libraries) + import (import.import (the platform.#file_system platform) compilation_libraries) [state archive phase_wrapper] (sharing [<parameters>] (Platform <parameters>) platform @@ -174,8 +174,8 @@ (Async (Try [Archive (directive.State+ <parameters>)])) (as_expected (platform.compile lux_compiler phase_wrapper import file_context expander platform compilation [archive state]))) - _ (cache.cache! (the platform.#&file_system platform) file_context archive) - host_dependencies (..load_host_dependencies (the platform.#&file_system platform) compilation_host_dependencies) + _ (cache.cache! (the platform.#file_system platform) file_context archive) + host_dependencies (..load_host_dependencies (the platform.#file_system platform) compilation_host_dependencies) _ (..package! (for @.old (file.async file.default) @.jvm (file.async file.default) ... TODO: Handle this in a safer manner. @@ -190,7 +190,7 @@ {cli.#Export export} (<| (or_crash! "Export failed:") (do (try.with async.monad) - [_ (export.export (the platform.#&file_system platform) + [_ (export.export (the platform.#file_system platform) export)] (in (debug.log! "Export complete!")))) |