From e64b6d0114c26a455e19a416b5f02a4d19dd711f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 26 Jul 2021 01:45:57 -0400 Subject: Re-named Promise to Async. --- stdlib/source/program/aedifex/command/auto.lux | 18 ++++---- stdlib/source/program/aedifex/command/build.lux | 56 +++++++++++------------ stdlib/source/program/aedifex/command/clean.lux | 8 ++-- stdlib/source/program/aedifex/command/deploy.lux | 6 +-- stdlib/source/program/aedifex/command/deps.lux | 6 +-- stdlib/source/program/aedifex/command/install.lux | 6 +-- stdlib/source/program/aedifex/command/pom.lux | 6 +-- stdlib/source/program/aedifex/command/test.lux | 8 ++-- stdlib/source/program/aedifex/command/version.lux | 4 +- 9 files changed, 59 insertions(+), 59 deletions(-) (limited to 'stdlib/source/program/aedifex/command') diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index 2460215b4..a80193663 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -6,7 +6,7 @@ [control ["." try (#+ Try)] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data [collection ["." list] @@ -26,8 +26,8 @@ [resolution (#+ Resolution)]]]]) (def: (targets fs path) - (-> (file.System Promise) file.Path (Promise (List file.Path))) - (let [! promise.monad] + (-> (file.System Async) file.Path (Async (List file.Path))) + (let [! async.monad] (|> path (\ fs sub_directories) (\ ! map (|>> (try.default (list)) @@ -40,18 +40,18 @@ 1,000) (def: (pause delay) - (-> Nat (Promise (Try Any))) - (promise.delay delay (#try.Success []))) + (-> Nat (Async (Try Any))) + (async.delay delay (#try.Success []))) (def: #export (do! delay watcher command) (All [a] - (-> Nat (Watcher Promise) - (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit a])) - (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Any])))) + (-> Nat (Watcher Async) + (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) + (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])))) (function (_ console program fs shell resolution) (function (_ profile) (with_expansions [ ((command console program fs shell resolution) profile)] - (do {! promise.monad} + (do {! async.monad} [targets (|> profile (get@ #///.sources) set.to_list diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 52804be43..b5df31411 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -10,7 +10,7 @@ ["." exception (#+ exception:)] ["." io (#+ IO)] [concurrency - ["." promise (#+ Promise) ("#\." monad)]]] + ["." async (#+ Async) ("#\." monad)]]] [data ["." product] ["." maybe] @@ -192,32 +192,32 @@ (template [ ] [(def: #export ( console process) - (-> (Console Promise) (Process Promise) (Promise (Try Any))) + (-> (Console Async) (Process Async) (Async (Try Any))) ## This is a very odd way of implementing this function. - ## But it's written this way because the more straightforward way (i.e. by using (try.with promise.monad)) + ## But it's written this way because the more straightforward way (i.e. by using (try.with async.monad)) ## eventually led to the function hanging/freezing. ## I'm not sure why it happened, but I got this weirder implementation to work. - (let [[read! write!] (: [(Promise (Try Any)) - (promise.Resolver (Try Any))] - (promise.promise [])) + (let [[read! write!] (: [(Async (Try Any)) + (async.Resolver (Try Any))] + (async.async [])) _ (|> (\ process []) - (promise.await (function (recur ?line) - (case ?line - (#try.Failure error) - (if (exception.match? shell.no_more_output error) - (write! (#try.Success [])) - (promise.await write! (console.write_line error console))) - - (#try.Success line) - (promise.await (function (_ outcome) - (case outcome - (#try.Failure error) - (write! (#try.Failure error)) - - (#try.Success _) - (promise.await recur - (\ process [])))) - (console.write_line line console))))) + (async.await (function (recur ?line) + (case ?line + (#try.Failure error) + (if (exception.match? shell.no_more_output error) + (write! (#try.Success [])) + (async.await write! (console.write_line error console))) + + (#try.Success line) + (async.await (function (_ outcome) + (case outcome + (#try.Failure error) + (write! (#try.Failure error)) + + (#try.Success _) + (async.await recur + (\ process [])))) + (console.write_line line console))))) io.run)] read!))] @@ -261,20 +261,20 @@ runtime))) (def: #export (do! console program fs shell resolution) - (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Compiler Path])) + (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Compiler Path])) (function (_ profile) (let [target (get@ #///.target profile)] (case (get@ #///.program profile) #.None - (promise\wrap (exception.throw ..no_specified_program [])) + (async\wrap (exception.throw ..no_specified_program [])) (#.Some program_module) - (do promise.monad - [environment (program.environment promise.monad program) + (do async.monad + [environment (program.environment async.monad program) #let [home (\ program home) working_directory (\ program directory)]] (do ///action.monad - [[resolution compiler] (promise\wrap (..compiler resolution (get@ #///.compiler profile))) + [[resolution compiler] (async\wrap (..compiler resolution (get@ #///.compiler profile))) #let [host_dependencies (..host_dependencies fs home resolution) [[command compiler_params] output] (case compiler (#JVM dependency) diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index 3a27e400a..2ff701d2b 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -6,7 +6,7 @@ [control [try (#+ Try)] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data [text ["%" format (#+ format)]]] @@ -19,7 +19,7 @@ ["#." action (#+ Action)]]) (def: (clean_files! fs root) - (-> (file.System Promise) Path (Promise (Try Any))) + (-> (file.System Async) Path (Async (Try Any))) (let [! ///action.monad] (|> root (\ fs directory_files) @@ -31,8 +31,8 @@ (|>> (format "Successfully cleaned target directory: "))) (def: #export (do! console fs profile) - (-> (Console Promise) (file.System Promise) (Command Any)) - (do {! promise.monad} + (-> (Console Async) (file.System Async) (Command Any)) + (do {! async.monad} [#let [target (get@ #///.target profile)] ? (\ fs directory? target) _ (let [! ///action.monad] diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index e70e6f762..79f6e4f2f 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -7,7 +7,7 @@ [pipe (#+ do>)] ["." try (#+ Try)] [concurrency - ["." promise (#+ Promise) ("#\." monad)]] + ["." async (#+ Async) ("#\." monad)]] ["<>" parser ["<.>" xml]]] [data @@ -57,14 +57,14 @@ "Successfully deployed the project.") (def: #export (do! console repository fs artifact profile) - (-> (Console Promise) (Repository Promise) (file.System Promise) Artifact (Command Any)) + (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do {! ///action.monad} [library (|> profile (get@ #/.sources) set.to_list (export.library fs) (\ ! map (binary.run tar.writer))) - pom (\ promise.monad wrap (///pom.write profile)) + pom (\ async.monad wrap (///pom.write profile)) _ (///dependency/deployment.one repository [artifact ///artifact/type.lux_library] diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index a7db4af20..7e0d655e9 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -6,7 +6,7 @@ [control ["." exception] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data [collection ["." set (#+ Set)] @@ -38,8 +38,8 @@ %.text)) (def: #export (do! console local remotes new_repository profile) - (-> (Console Promise) (Repository Promise) (List (Repository Promise)) (-> URL (Repository Promise)) (Command Resolution)) - (do promise.monad + (-> (Console Async) (Repository Async) (List (Repository Async)) (-> URL (Repository Async)) (Command Resolution)) + (do async.monad [#let [dependencies (|> (get@ #///.dependencies profile) set.to_list (#.Cons (get@ #///.compiler profile)))] diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 4cc4ede68..142829a8c 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -7,7 +7,7 @@ ["." try (#+ Try)] ["." exception] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data [binary (#+ Binary)] [text @@ -50,7 +50,7 @@ "Failure: No 'identity' defined for the project.") (def: #export (do! console fs repository profile) - (-> (Console Promise) (file.System Promise) (Repository Promise) (Command Any)) + (-> (Console Async) (file.System Async) (Repository Async) (Command Any)) (case (get@ #/.identity profile) (#.Some identity) (do ///action.monad @@ -60,7 +60,7 @@ (export.library fs)) pom (|> profile ///pom.write - (\ promise.monad wrap)) + (\ async.monad wrap)) _ (///dependency/deployment.one repository [identity ///artifact/type.lux_library] (let [pom_data (|> pom diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux index 6d26f4792..73e10f0fc 100644 --- a/stdlib/source/program/aedifex/command/pom.lux +++ b/stdlib/source/program/aedifex/command/pom.lux @@ -6,7 +6,7 @@ [control ["." try ("#\." functor)] [concurrency - ["." promise (#+ Promise) ("#\." monad)]]] + ["." async (#+ Async) ("#\." monad)]]] [data [text ["%" format (#+ format)] @@ -26,11 +26,11 @@ (format "Successfully created POM file: " ///pom.file)) (def: #export (do! console fs profile) - (-> (Console Promise) (file.System Promise) (Command Any)) + (-> (Console Async) (file.System Async) (Command Any)) (do ///action.monad [content (|> (///pom.write profile) (try\map (|>> (\ xml.codec encode) (\ utf8.codec encode))) - promise\wrap) + async\wrap) _ (\ fs write content ///pom.file)] (console.write_line ..success console))) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 1f32b2fc2..e159a48f2 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -5,7 +5,7 @@ [monad (#+ do)]] [control [concurrency - ["." promise (#+ Promise) ("#\." monad)]]] + ["." async (#+ Async) ("#\." monad)]]] [math [number ["i" int]]] @@ -29,9 +29,9 @@ (def: #export failure "[TEST FAILED]") (def: #export (do! console program fs shell resolution profile) - (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Any])) - (do promise.monad - [environment (program.environment promise.monad program) + (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) + (do async.monad + [environment (program.environment async.monad program) #let [working_directory (\ program directory)]] (do {! ///action.monad} [#let [home (\ program home)] diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux index cd724843c..0c5c944b5 100644 --- a/stdlib/source/program/aedifex/command/version.lux +++ b/stdlib/source/program/aedifex/command/version.lux @@ -3,7 +3,7 @@ [lux #* [control [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [tool [compiler ["." version] @@ -16,6 +16,6 @@ [command (#+ Command)]]) (def: #export (do! console profile) - (-> (Console Promise) (Command Any)) + (-> (Console Async) (Command Any)) (console.write_line (version.format language/lux.version) console)) -- cgit v1.2.3