From 62b3abfcc014ca1c19d62aacdd497f6a250b372c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 25 Jul 2021 03:12:17 -0400 Subject: Better syntax for "library/lux.^multi". --- stdlib/source/program/aedifex/artifact/time.lux | 6 ++-- stdlib/source/program/aedifex/command/build.lux | 14 ++++----- stdlib/source/program/aedifex/command/deps.lux | 4 +-- .../program/aedifex/dependency/deployment.lux | 4 +-- stdlib/source/program/aedifex/input.lux | 8 ++--- .../source/program/aedifex/metadata/artifact.lux | 4 +-- stdlib/source/program/aedifex/parser.lux | 24 +++++++-------- stdlib/source/program/aedifex/pom.lux | 24 +++++++-------- stdlib/source/program/aedifex/project.lux | 2 +- stdlib/source/program/aedifex/runtime.lux | 2 +- stdlib/source/program/compositor.lux | 32 ++++++++++---------- stdlib/source/program/compositor/export.lux | 4 +-- stdlib/source/program/scriptum.lux | 34 +++++++++++----------- 13 files changed, 81 insertions(+), 81 deletions(-) (limited to 'stdlib/source/program') diff --git a/stdlib/source/program/aedifex/artifact/time.lux b/stdlib/source/program/aedifex/artifact/time.lux index ec7ddc4a9..524b68bb1 100644 --- a/stdlib/source/program/aedifex/artifact/time.lux +++ b/stdlib/source/program/aedifex/artifact/time.lux @@ -29,10 +29,10 @@ (def: #export (instant time) (-> Time Instant) (let [[date time] time] - (instant.from_date_time (/date.value date) - time))) + (instant.of_date_time (/date.value date) + time))) -(def: #export (from_instant instant) +(def: #export (of_instant instant) (-> Instant (Try Time)) (do try.monad [date (/date.date (instant.date instant))] diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 17301333a..52804be43 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -84,8 +84,8 @@ (def: (remove_dependency dependency) (-> Dependency (-> Resolution Resolution)) (|>> dictionary.entries - (list.filter (|>> product.left (is? dependency) not)) - (dictionary.from_list ///dependency.hash))) + (list.only (|>> product.left (is? dependency) not)) + (dictionary.of_list ///dependency.hash))) (def: (compiler resolution compiler_dependency) (-> Resolution Dependency (Try [Resolution Compiler])) @@ -122,8 +122,8 @@ (def: (libraries fs home) (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.filter (|>> (get@ #///dependency.type) - (text\= ///artifact/type.lux_library))) + (list.only (|>> (get@ #///dependency.type) + (text\= ///artifact/type.lux_library))) (list\map (..path fs home)))) (def: version_separator @@ -157,9 +157,9 @@ (def: #export (host_dependencies fs home) (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.filter (|>> (get@ #///dependency.type) - (text\= ///artifact/type.lux_library) - not)) + (list.only (|>> (get@ #///dependency.type) + (text\= ///artifact/type.lux_library) + not)) (list\fold (function (_ dependency uniques) (let [artifact (get@ #///dependency.artifact dependency) identity [(get@ #///artifact.group artifact) diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index c2344ea80..a7db4af20 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -65,8 +65,8 @@ (list.sort (\ ///dependency.order <)) (exception.enumerate ..format))] ["Remote successes" (|> remote_successes - (set.from_list ///dependency.hash) - (set.difference (set.from_list ///dependency.hash local_successes)) + (set.of_list ///dependency.hash) + (set.difference (set.of_list ///dependency.hash local_successes)) set.to_list (list.sort (\ ///dependency.order <)) (exception.enumerate ..format))] diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 7939173dd..150055cf3 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -90,7 +90,7 @@ (-> Dependency Instant Metadata (Try Metadata)) (do try.monad [now (: (Try ///artifact/time.Time) - (///artifact/time.from_instant now)) + (///artifact/time.of_instant now)) #let [version_template (get@ #///artifact.version artifact) snapshot (|> snapshot (update@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] @@ -146,4 +146,4 @@ (|> (dictionary.entries resolution) (monad.map ! (function (_ [dependency package]) (..one repository dependency package))) - (\ ! map (set.from_list ///artifact.hash))))) + (\ ! map (set.of_list ///artifact.hash))))) diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 1ece2cf17..73b3c383b 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -27,7 +27,7 @@ ["#." project (#+ Project)] ["#." parser]]) -(def: (parse_lux source_code) +(def: (lux_parser source_code) (-> Text (Try Code)) (let [parse (syntax.parse "" syntax.no_aliases @@ -39,11 +39,11 @@ (#.Right [_ lux_code]) (#try.Success lux_code)))) -(def: parse_project +(def: project_parser (-> Binary (Try Project)) (|>> (do> try.monad [(\ utf8.codec decode)] - [..parse_lux] + [..lux_parser] [(list) (.run //parser.project)]))) (def: #export (read monad fs profile) @@ -52,5 +52,5 @@ (\ fs read) (\ monad map (|>> (do> try.monad [] - [..parse_project] + [..project_parser] [(//project.profile profile)]))))) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 0f8a5737c..524272559 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -138,7 +138,7 @@ (.embed (do <>.monad [date ..date_parser time ..time_parser] - (wrap (instant.from_date_time date time))) + (wrap (instant.of_date_time date time))) (..text ..))) (def: #export parser @@ -170,7 +170,7 @@ (def: epoch Instant - (instant.from_millis +0)) + (instant.of_millis +0)) (def: #export (read repository artifact) (-> (Repository Promise) Artifact (Promise (Try Metadata))) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index d0dd59133..ca5fe3be3 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -83,7 +83,7 @@ (Parser /.License) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (.record (<>.some (<>.and .local_tag .any))))] ($_ <>.and @@ -98,7 +98,7 @@ (Parser /.Organization) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (.record (<>.some (<>.and .local_tag .any))))] ($_ <>.and @@ -109,7 +109,7 @@ (Parser /.Developer) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (.record (<>.some (<>.and .local_tag .any))))] ($_ <>.and @@ -126,7 +126,7 @@ (Parser /.Info) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (.record (<>.some (<>.and .local_tag .any))))] ($_ <>.and @@ -182,7 +182,7 @@ (Parser /.Profile) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (.record (<>.some (<>.and .local_tag .any)))) #let [^parents (: (Parser (List /.Name)) @@ -196,20 +196,20 @@ (..singular input "info" ..info))) ^repositories (: (Parser (Set //repository.Address)) (|> (..plural input "repositories" ..repository) - (\ ! map (set.from_list text.hash)) + (\ ! map (set.of_list text.hash)) (<>.default (set.new text.hash)) (\ ! map (set.add /.default_repository)))) ^dependencies (: (Parser (Set //dependency.Dependency)) (|> (..plural input "dependencies" ..dependency) - (\ ! map (set.from_list //dependency.hash)) + (\ ! map (set.of_list //dependency.hash)) (<>.default (set.new //dependency.hash)))) ^compiler (|> ..dependency (..singular input "compiler") (<>.default /.default_compiler)) ^sources (: (Parser (Set /.Source)) (|> (..plural input "sources" ..source) - (\ ! map (set.from_list text.hash)) - (<>.default (set.from_list text.hash (list /.default_source))))) + (\ ! map (set.of_list text.hash)) + (<>.default (set.of_list text.hash (list /.default_source))))) ^target (: (Parser /.Target) (|> ..target (..singular input "target") @@ -221,7 +221,7 @@ (<>.maybe (..singular input "test" ..module))) ^deploy_repositories (: (Parser (Dictionary Text //repository.Address)) - (<| (\ ! map (dictionary.from_list text.hash)) + (<| (\ ! map (dictionary.of_list text.hash)) (<>.default (list)) (..singular input "deploy_repositories" ..deploy_repository))) ^java (|> ..runtime @@ -262,11 +262,11 @@ (Parser Project) (let [default_profile (: (Parser Project) (\ <>.monad map - (|>> [/.default] (list) (dictionary.from_list text.hash)) + (|>> [/.default] (list) (dictionary.of_list text.hash)) ..profile)) multi_profile (: (Parser Project) (\ <>.monad map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (.record (<>.many (<>.and .text ..profile)))))] (<>.either multi_profile diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index be03d36f5..b458c7a21 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -154,7 +154,7 @@ _ (exception.throw /.no_identity []))) -(def: parse_property +(def: property_parser (Parser [Tag Text]) (do {! <>.monad} [tag .tag] @@ -162,14 +162,14 @@ (\ ! map (|>> [tag])) .text))) -(def: (parse_dependency own_version parent_version) +(def: (dependency_parser own_version parent_version) (-> Text Text (Parser Dependency)) (do {! <>.monad} - [properties (\ ! map (dictionary.from_list name.hash) + [properties (\ ! map (dictionary.of_list name.hash) (<| (.node ["" ..dependency_tag]) - (<>.some ..parse_property)))] + (<>.some ..property_parser)))] (<| <>.lift - try.from_maybe + try.of_maybe (do maybe.monad [group (dictionary.get ["" ..group_tag] properties) artifact (dictionary.get ["" ..artifact_tag] properties)] @@ -184,21 +184,21 @@ (dictionary.get ["" "type"]) (maybe.default //artifact/type.jvm_library))}))))) -(def: (parse_dependencies own_version parent_version) +(def: (dependencies_parser own_version parent_version) (-> Text Text (Parser (List Dependency))) (<| (.node ["" ..dependencies_tag]) - (<>.some (..parse_dependency own_version parent_version)))) + (<>.some (..dependency_parser own_version parent_version)))) -(def: parse_repository +(def: repository_parser (Parser Address) (<| (.node ["" ..repository_tag]) (.node ["" ..url_tag]) .text)) -(def: parse_repositories +(def: repositories_parser (Parser (List Address)) (<| (.node ["" ..repositories_tag]) - (<>.some ..parse_repository))) + (<>.some ..repository_parser))) (def: own_version (Parser Text) @@ -217,10 +217,10 @@ parent_version (<>.default "" (.somewhere ..parent_version))] (<| (.node ["" ..project_tag]) (do ! - [dependencies (|> (..parse_dependencies own_version parent_version) + [dependencies (|> (..dependencies_parser own_version parent_version) .somewhere (<>.default (list))) - repositories (|> ..parse_repositories + repositories (|> ..repositories_parser .somewhere (<>.default (list))) _ (<>.some .ignore)] diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 321e86661..d845ed689 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -26,7 +26,7 @@ (def: #export (project name profile) (-> Name Profile Project) - (dictionary.from_list text.hash (list [name profile]))) + (dictionary.of_list text.hash (list [name profile]))) (def: #export equivalence (Equivalence Project) diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index e6b61d360..ea34fc0fe 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -28,7 +28,7 @@ [(def: #export Runtime {#program - #parameters (`` (list (~~ (template.splice ))))})] + #parameters (`` (list (~~ (template.spliced ))))})] [default_java "java" ["-jar"]] [default_js "node" ["--stack_size=8192"]] diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index aa3239de2..bb102224d 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- Module) - [type (#+ :share)] + [type (#+ :sharing)] ["@" target] ["." debug] [abstract @@ -137,20 +137,20 @@ (do (try.with promise.monad) [#let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation] import (/import.import (get@ #platform.&file_system platform) compilation_libraries) - [state archive] (:share [] - (Platform ) - platform - - (Promise (Try [(directive.State+ ) - Archive])) - (:assume (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender - import compilation_sources))) - [archive state] (:share [] - (Platform ) - platform - - (Promise (Try [Archive (directive.State+ )])) - (:assume (platform.compile import static expander platform compilation [archive state]))) + [state archive] (:sharing [] + (Platform ) + platform + + (Promise (Try [(directive.State+ ) + Archive])) + (:assume (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender + import compilation_sources))) + [archive state] (:sharing [] + (Platform ) + platform + + (Promise (Try [Archive (directive.State+ )])) + (:assume (platform.compile import static expander platform compilation [archive state]))) _ (ioW.freeze (get@ #platform.&file_system platform) static archive) program_context (promise\wrap ($/program.context archive)) host_dependencies (..load_host_dependencies (get@ #platform.&file_system platform) compilation_host_dependencies) @@ -178,6 +178,6 @@ ## (do {! promise.monad} ## [console (|> console.default ## promise.future - ## (\ ! map (|>> try.assume console.async)))] + ## (\ ! map (|>> try.assumed console.async)))] ## (interpreter.run (try.with promise.monad) console platform interpretation generation_bundle))) )))) diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index 9c2bdef52..9fe95684e 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -52,14 +52,14 @@ tar.path) source_code (tar.content source_code)] (wrap (#tar.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) ($_ tar.and tar.read_by_owner tar.write_by_owner tar.read_by_group tar.write_by_group tar.read_by_other) ..no_ownership source_code]))))) - (\ try.monad map row.from_list) + (\ try.monad map row.of_list) (\ promise.monad wrap)))) (def: #export (export fs [sources target]) diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index cdbdb0569..708db73dd 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -43,7 +43,7 @@ (-> Nat Text) (case (text.nth id ..name_options) (#.Some char) - (text.from_code char) + (text.of_code char) #.None (format (parameter_type_name (n./ name_options_count id)) @@ -76,8 +76,8 @@ _ (|> type_var_names - (sequence.filter (function (_ var_name) - (not (list.member? text.equivalence type_function_arguments var_name)))) + (sequence.only (function (_ var_name) + (not (list.member? text.equivalence type_function_arguments var_name)))) (sequence.nth arg_id)))) type_func_name)) @@ -116,7 +116,7 @@ (format "(primitive " (%.text name) " " (|> params (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) ")")) [_ (#.Sum _)] - (let [members (type.flatten_variant type)] + (let [members (type.flat_variant type)] (case tags #.Nil (format "(| " @@ -131,7 +131,7 @@ (list\map (function (_ [[_ t_name] type]) (case type (#.Product _) - (let [types (type.flatten_tuple type)] + (let [types (type.flat_tuple type)] (format "(#" t_name " " (|> types (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) @@ -143,7 +143,7 @@ (text.join_with text.new_line)))) [_ (#.Product _)] - (let [members (type.flatten_tuple type)] + (let [members (type.flat_tuple type)] (case tags #.Nil (format "[" (|> members (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) "]") @@ -161,7 +161,7 @@ (format "{" member_docs "}"))))) [_ (#.Function input output)] - (let [[ins out] (type.flatten_function type)] + (let [[ins out] (type.flat_function type)] (format "(-> " (|> ins (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) " " (pprint_type_definition level type_func_info #.None module signature? recursive_type? out) @@ -189,14 +189,14 @@ _ (format text.new_line (prefix_lines " " body_doc))) ")"))]) - ([#.UnivQ "All" type.flatten_univ_q] - [#.ExQ "Ex" type.flatten_ex_q]) + ([#.UnivQ "All" type.flat_univ_q] + [#.ExQ "Ex" type.flat_ex_q]) [true (#.Apply (#.Parameter 1) (#.Parameter 0))] (product.left type_func_info) [_ (#.Apply param fun)] - (let [[type_func type_arguments] (type.flatten_application type)] + (let [[type_func type_arguments] (type.flat_application type)] (format "(" (pprint_type_definition level type_func_info tags module signature? recursive_type? type_func) " " (|> type_arguments (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) ")")) [_ (#.Named [_module _name] type)] @@ -217,15 +217,15 @@ (format "(primitive " (%.text name) " " (|> params (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Sum _) - (let [members (type.flatten_variant type)] + (let [members (type.flat_variant type)] (format "(| " (|> members (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Product _) - (let [members (type.flatten_tuple type)] + (let [members (type.flat_tuple type)] (format "[" (|> members (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) "]")) (#.Function input output) - (let [[ins out] (type.flatten_function type)] + (let [[ins out] (type.flat_function type)] (format "(-> " (|> ins (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) " " @@ -249,11 +249,11 @@ (format "(" " " "[" (|> args (list.interpose " ") (text.join_with "")) "]" (format " " body_doc) ")"))]) - ([#.UnivQ "All" type.flatten_univ_q] - [#.ExQ "Ex" type.flatten_ex_q]) + ([#.UnivQ "All" type.flat_univ_q] + [#.ExQ "Ex" type.flat_ex_q]) (#.Apply param fun) - (let [[type_func type_arguments] (type.flatten_application type)] + (let [[type_func type_arguments] (type.flat_application type)] (format "(" (pprint_type level type_func_name module type_func) " " (|> type_arguments (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Named [_module _name] type) @@ -505,7 +505,7 @@ (do {! meta.monad} [all_modules meta.modules #let [lux_modules (|> all_modules - (list.filter (function.compose lux_module? product.left)) + (list.only (function.compose lux_module? product.left)) (list.sort name_sort))] lux_exports (monad.map ! (function.compose meta.exports product.left) lux_modules) -- cgit v1.2.3