diff options
Diffstat (limited to '')
56 files changed, 531 insertions, 475 deletions
diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index 9152a3d22..9a55ccb59 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -9,9 +9,6 @@ ["$." equivalence] ["$." order] ["$." hash]]] - [control - [concurrency - [promise (#+ Promise)]]] [data ["." text ("#\." equivalence)]] [math diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 2f52b1d7b..19fd23203 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -7,7 +7,7 @@ [control ["." try] [concurrency - ["." promise (#+ Promise)]] + ["." async (#+ Async)]] [parser ["." environment]]] [data @@ -104,10 +104,10 @@ [[dependency expected_package] ..package home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [fs (: (file.System Promise) + #let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do promise.monad + (wrap (do async.monad [wrote! (/.write_one program fs dependency expected_package) read! (/.read_one program fs dependency)] (_.cover' [/.write_one /.read_one] @@ -125,10 +125,10 @@ [expected ..resolution home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [fs (: (file.System Promise) + #let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do promise.monad + (wrap (do async.monad [wrote! (/.write_all program fs expected) read! (/.read_all program fs (dictionary.keys expected) //dependency/resolution.empty)] (_.cover' [/.write_all /.read_all] diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 4239644aa..6f83f5a11 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -48,7 +48,7 @@ ## #Auto ..compilation)) -(def: (format_compilation value) +(def: (compilation_format value) (-> /.Compilation (List Text)) (case value #/.Build (list "build") @@ -63,8 +63,8 @@ #/.Dependencies (list "deps") #/.Install (list "install") (#/.Deploy repository [user password]) (list "deploy" repository user password) - (#/.Compilation compilation) (..format_compilation compilation) - (#/.Auto compilation) (list& "auto" (..format_compilation compilation)))) + (#/.Compilation compilation) (..compilation_format compilation) + (#/.Auto compilation) (list& "auto" (..compilation_format compilation)))) (def: without_profile Test diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 474a8dd1f..27b12bc42 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -11,7 +11,7 @@ ["." environment]] [concurrency ["." atom (#+ Atom)] - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." binary] ["." text @@ -45,15 +45,15 @@ [resolution (#+ Resolution)]]]]]) (def: (command expected_runs end_signal fs dummy_file) - (-> Nat Text (file.System Promise) file.Path + (-> Nat Text (file.System Async) file.Path [(Atom Nat) - (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Any]))]) + (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any]))]) (let [@runs (: (Atom Nat) (atom.atom 0))] [@runs (function (_ console program fs shell resolution profile) - (do {! promise.monad} - [[_ actual_runs] (promise.future (atom.update inc @runs))] + (do {! async.monad} + [[_ actual_runs] (async.future (atom.update inc @runs))] (if (n.= expected_runs actual_runs) (wrap (#try.Failure end_signal)) (do (try.with !) @@ -95,13 +95,13 @@ ($_ _.and (_.cover [/.delay] (n.> 0 /.delay)) - (wrap (do promise.monad + (wrap (do async.monad [verdict (do ///action.monad [_ (\ fs make_directory source) _ (\ fs write (binary.create 0) dummy_path) #let [[@runs command] (..command expected_runs end_signal fs dummy_path)] _ (\ watcher poll [])] - (do {! promise.monad} + (do {! async.monad} [no_dangling_process! (|> profile (set@ #///.compiler compiler) ((/.do! 1 watcher command) @@ -117,7 +117,7 @@ false)))) correct_number_of_runs! (|> @runs atom.read - promise.future + async.future (\ ! map (n.= expected_runs)))] (wrap (#try.Success (and correct_number_of_runs! no_dangling_process!)))))] diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 4b0960d32..3bc7f86dc 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -10,7 +10,7 @@ ["." try] ["." exception] [concurrency - ["." promise (#+ Promise)]] + ["." async (#+ Async)]] [parser ["." environment]]] [data @@ -159,7 +159,7 @@ with_program with_target)]] ($_ _.and - (wrap (do promise.monad + (wrap (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty (with_target empty_profile))] (_.cover' [/.no_specified_program] @@ -169,7 +169,7 @@ (#try.Failure error) (exception.match? /.no_specified_program error))))) - (wrap (do promise.monad + (wrap (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] (_.cover' [/.Compiler /.no_available_compiler] (case outcome @@ -181,7 +181,7 @@ (do ! [#let [console (@version.echo "")] [compiler resolution] ..resolution] - (wrap (do promise.monad + (wrap (do async.monad [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs shell resolution @@ -203,7 +203,7 @@ (do ! [#let [console (@version.echo "")] [compiler resolution] ..resolution] - (wrap (do promise.monad + (wrap (do async.monad [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (..bad_shell [])) resolution @@ -224,7 +224,7 @@ shell (|> (list expected/0 expected/1 expected/2) (..reader_shell <error?>) shell.async)] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [verdict (do ///action.monad [process (shell [environment.empty working_directory "" (list "")]) _ (<log!> console process) diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index f0a5f4b58..568c6fb76 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -7,7 +7,7 @@ [control ["." try (#+ Try)] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data [binary (#+ Binary)] ["." product] @@ -46,32 +46,32 @@ [count (\ ! map (n.% 10) random.nat) names (random.set text.hash count ..node_name) contents (random.list count ($binary.random 100))] - (wrap (list.zip/2 (list\map (|>> (format prefix)) (set.to_list names)) - contents)))) + (wrap (list.zipped/2 (list\map (|>> (format prefix)) (set.to_list names)) + contents)))) (def: (create_file! fs [path content]) - (-> (file.System Promise) [Path Binary] (Promise (Try Any))) + (-> (file.System Async) [Path Binary] (Async (Try Any))) (\ fs write content path)) (def: (create_directory! fs path files) - (-> (file.System Promise) Path (List [Path Binary]) (Promise (Try Any))) - (do {! (try.with promise.monad)} - [_ (: (Promise (Try Any)) - (file.make_directories promise.monad fs path)) + (-> (file.System Async) Path (List [Path Binary]) (Async (Try Any))) + (do {! (try.with async.monad)} + [_ (: (Async (Try Any)) + (file.make_directories async.monad fs path)) _ (monad.map ! (..create_file! fs) files)] (wrap []))) (def: (directory_exists? fs) - (-> (file.System Promise) Path (Promise (Try Bit))) - (|>> (\ fs directory?) (try.lift promise.monad))) + (-> (file.System Async) Path (Async (Try Bit))) + (|>> (\ fs directory?) (try.lift async.monad))) (def: (file_exists? fs) - (-> (file.System Promise) Path (Promise (Try Bit))) - (|>> (\ fs file?) (try.lift promise.monad))) + (-> (file.System Async) Path (Async (Try Bit))) + (|>> (\ fs file?) (try.lift async.monad))) (def: (assets_exist? fs directory_path files) - (-> (file.System Promise) Path (List [Path Binary]) (Promise (Try Bit))) - (do {! (try.with promise.monad)} + (-> (file.System Async) Path (List [Path Binary]) (Async (Try Bit))) + (do {! (try.with async.monad)} [directory_exists? (..directory_exists? fs directory_path) files_exist? (: (Action (List Bit)) (|> files @@ -95,9 +95,9 @@ sub_files (..files (format sub_path /)) dummy @profile.random] - (wrap (do promise.monad + (wrap (do async.monad [#let [console (@version.echo "")] - verdict (do {! (try.with promise.monad)} + verdict (do {! (try.with async.monad)} [_ (..create_directory! fs target_path direct_files) _ (..create_directory! fs sub_path sub_files) context_exists!/pre (..directory_exists? fs context) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index d1b955c77..e2f7cfa4a 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -7,7 +7,7 @@ [control ["." try (#+ Try)] [concurrency - ["." promise (#+ Promise)]] + ["." async (#+ Async)]] [parser ["." environment]]] [data @@ -50,9 +50,9 @@ ["#/." extension]]]]]) (def: (execute! program repository fs artifact profile) - (-> (Program Promise) (Repository Promise) (file.System Promise) + (-> (Program Async) (Repository Async) (file.System Async) Artifact ///.Profile - (Promise (Try Text))) + (Async (Try Text))) (do ///action.monad [#let [console ($version.echo "")] _ ($install.make_sources! fs (get@ #///.sources profile)) @@ -77,7 +77,7 @@ $repository.empty) fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [verdict (do {! ///action.monad} [logging (..execute! program repository fs artifact profile) expected_library (|> profile @@ -89,12 +89,12 @@ actual_pom (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact ///artifact/extension.pom)) actual_library (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact ///artifact/extension.lux_library)) actual_sha-1 (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) - actual_sha-1 (\ promise.monad wrap + actual_sha-1 (\ async.monad wrap (do try.monad [actual_sha-1 (\ utf8.codec decode actual_sha-1)] (\ ///hash.sha-1_codec decode actual_sha-1))) actual_md5 (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) - actual_md5 (\ promise.monad wrap + actual_md5 (\ async.monad wrap (do try.monad [actual_md5 (\ utf8.codec decode actual_md5)] (\ ///hash.md5_codec decode actual_md5))) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 40645b731..1a54ae89d 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -8,7 +8,7 @@ [control ["." try] [concurrency - ["." promise]] + ["." async]] [parser ["." environment]]] [data @@ -95,7 +95,7 @@ fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do promise.monad + (wrap (do async.monad [verdict (do ///action.monad [#let [console (@version.echo "") local (///repository/local.repository program fs)] diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 70df9b7a3..3ba225206 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -8,7 +8,7 @@ ["." try (#+ Try) ("#\." functor)] ["." exception] [concurrency - ["." promise (#+ Promise)]] + ["." async (#+ Async)]] [parser ["." environment]]] [data @@ -40,20 +40,20 @@ ["#/." local]]]]]]) (def: #export (make_sources! fs sources) - (-> (file.System Promise) (Set file.Path) (Action (List Any))) + (-> (file.System Async) (Set file.Path) (Action (List Any))) (let [/ (\ fs separator) ! ///action.monad] (|> sources set.to_list (monad.map ! (function (_ head) (do ! - [_ (: (Promise (Try Any)) - (file.make_directories promise.monad fs head))] - (: (Promise (Try Any)) - (file.make_file promise.monad fs (binary.create 0) (format head / head ".lux"))))))))) + [_ (: (Async (Try Any)) + (file.make_directories async.monad fs head))] + (: (Async (Try Any)) + (file.make_file async.monad fs (binary.create 0) (format head / head ".lux"))))))))) (def: (execute! program fs sample) - (-> (Program Promise) (file.System Promise) ///.Profile (Promise (Try Text))) + (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text))) (do ///action.monad [#let [console ($version.echo "")] _ (..make_sources! fs (get@ #///.sources sample)) @@ -71,7 +71,7 @@ working_directory (random.ascii/alpha 5) #let [/ (\ file.default separator)]] ($_ _.and - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [#let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) @@ -84,17 +84,17 @@ library_exists! (|> library_path (format home /) (\ fs file?) - (\ promise.monad map exception.return)) + (\ async.monad map exception.return)) pom_exists! (|> pom_path (format home /) (\ fs file?) - (\ promise.monad map exception.return))] + (\ async.monad map exception.return))] (wrap (and succeeded! library_exists! pom_exists!)))] (_.cover' [/.do! /.success] (try.default false verdict)))) - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [#let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (set@ #///.identity #.None sample))] diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 624be95bd..4ee1c49f4 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -7,7 +7,7 @@ [control ["." try ("#\." functor)] [concurrency - ["." promise]]] + ["." async]]] [data ["." binary ("#\." equivalence)] ["." text ("#\." equivalence) @@ -36,7 +36,7 @@ (do random.monad [sample @profile.random #let [fs (file.mock (\ file.default separator))]] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [#let [console (@version.echo "")] outcome (/.do! console fs sample)] (case outcome diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index 4621028ae..5882992a9 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -8,7 +8,7 @@ ["." try] ["." exception] [concurrency - ["." promise]] + ["." async]] [parser ["." environment]]] [data @@ -61,7 +61,7 @@ ($_ _.and (let [fs (file.mock (\ file.default separator)) console (@version.echo "")] - (wrap (do promise.monad + (wrap (do async.monad [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (@build.good_shell [])) resolution @@ -79,7 +79,7 @@ (try.default false verdict))))) (let [fs (file.mock (\ file.default separator)) console (@version.echo "")] - (wrap (do promise.monad + (wrap (do async.monad [verdict (do ///action.monad [#let [bad_shell (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index d0d172a7a..739a02fef 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -8,7 +8,7 @@ ["." try] ["." exception (#+ exception:)] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." maybe] ["." text ("#\." equivalence) @@ -58,7 +58,7 @@ (exception.throw ..console_is_closed! [])))) (def: #export echo - (-> Text (Console Promise)) + (-> Text (Console Async)) (|>> [true] (console.mock ..mock) console.async)) @@ -68,9 +68,9 @@ (<| (_.covering /._) (do random.monad [profile @profile.random] - (wrap (do promise.monad + (wrap (do async.monad [#let [console (..echo "")] - verdict (do (try.with promise.monad) + verdict (do (try.with async.monad) [_ (/.do! console profile) logging (\ console read_line [])] (wrap (text\= (version.format language/lux.version) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index a99f37ca1..218bbaf07 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -10,7 +10,7 @@ ["." try ("#\." functor)] [concurrency ["." atom (#+ Atom)] - ["." promise]]] + ["." async]]] [data ["." product] ["." maybe ("#\." functor)] @@ -156,9 +156,9 @@ (atom.atom (dictionary.new text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] - (wrap (do promise.monad + (wrap (do async.monad [?outcome (/.one repository dependency package) - cache (promise.future (atom.read cache))] + cache (async.future (atom.read cache))] (_.cover' [/.one] (|> ?outcome (try\map (verify_one 1 address package cache expected_artifact)) @@ -179,9 +179,9 @@ (atom.atom (dictionary.new text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] - (wrap (do promise.monad + (wrap (do async.monad [?outcome (/.all repository resolution) - cache (promise.future (atom.read cache))] + cache (async.future (atom.read cache))] (_.cover' [/.all] (|> ?outcome (try\map (function (_ actual_artifacts) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 9d1f287c6..ea468f851 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -11,7 +11,7 @@ ["." try] ["." exception] [concurrency - ["." promise]]] + ["." async]]] [data [binary (#+ Binary)] ["." product] @@ -259,7 +259,7 @@ bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] (`` ($_ _.and (wrap - (do promise.monad + (do async.monad [actual_package (/.one (///repository.mock good []) {#///dependency.artifact expected_artifact #///dependency.type ///artifact/type.lux_library})] @@ -274,7 +274,7 @@ false)))) (~~ (template [<exception> <bad>] [(wrap - (do promise.monad + (do async.monad [actual_package (/.one (///repository.mock <bad> []) {#///dependency.artifact expected_artifact #///dependency.type ///artifact/type.lux_library})] @@ -306,7 +306,7 @@ bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] ($_ _.and (wrap - (do promise.monad + (do async.monad [#let [console ($///version.echo "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) @@ -324,7 +324,7 @@ (#try.Failure _) false)))) (wrap - (do promise.monad + (do async.monad [#let [console ($///version.echo "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) @@ -411,7 +411,7 @@ (..packages [dependee_artifact depender_artifact ignored_artifact])] ($_ _.and (wrap - (do promise.monad + (do async.monad [#let [console ($///version.echo "")] [successes failures resolution] (/.all console (list (///repository.mock (..single dependee_artifact dependee_package) []) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index 529185320..e7f02569f 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -7,7 +7,7 @@ [control ["." try (#+ Try)] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data [text ["%" format] @@ -46,17 +46,17 @@ (<| (_.covering /._) (do {! random.monad} [expected (\ ! map (set@ #//.parents (list)) $profile.random) - #let [fs (: (file.System Promise) + #let [fs (: (file.System Async) (file.mock (\ file.default separator)))]] - (wrap (do promise.monad + (wrap (do async.monad [verdict (do //action.monad [#let [profile (|> expected //format.profile %.code (\ utf8.codec encode))] _ (\ fs write profile //project.file) - actual (: (Promise (Try Profile)) - (/.read promise.monad fs //.default))] + actual (: (Async (Try Profile)) + (/.read async.monad fs //.default))] (wrap (\ //.equivalence = (|> expected (update@ #//.sources ..with_default_source) diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index cc2d78db7..6a2106ad3 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -12,7 +12,7 @@ ["." environment] ["<.>" xml]] [concurrency - ["." promise]]] + ["." async]]] [data ["." maybe] ["." text ("#\." equivalence)] @@ -100,7 +100,7 @@ #let [program (program.async (program.mock environment.empty home working_directory)) fs (file.mock (\ file.default separator)) repository (///repository/local.repository program fs)]] - (wrap (do promise.monad + (wrap (do async.monad [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] (_.cover' [/.write /.read] diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 48738522a..ea0a26a5a 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -12,7 +12,7 @@ ["." environment] ["<.>" xml]] [concurrency - ["." promise]]] + ["." async]]] [data ["." maybe] ["." text ("#\." equivalence)] @@ -112,7 +112,7 @@ #let [program (program.async (program.mock environment.empty home working_directory)) fs (file.mock (\ file.default separator)) repository (///repository/local.repository program fs)]] - (wrap (do promise.monad + (wrap (do async.monad [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] (_.cover' [/.write /.read] diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index 55bca8ce3..61201456a 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -7,9 +7,7 @@ [\\specification ["$." equivalence]]] [control - ["." try] - [concurrency - [promise (#+ Promise)]]] + ["." try]] [data ["." product] ["." text diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index 1bbf2f7bb..a40924dea 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -9,7 +9,7 @@ [parser ["." environment]] [concurrency - ["." promise]]] + ["." async]]] [data ["." binary ("#\." equivalence)] [text @@ -38,7 +38,7 @@ expected (\ ! map (\ utf8.codec encode) (random.ascii/lower 10))] ($_ _.and - (wrap (do promise.monad + (wrap (do async.monad [before_upload (\ repo download uri) _ (\ repo upload uri expected) actual (\ repo download uri)] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 8cd7a7695..cd77beb6f 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -445,39 +445,100 @@ (is? expected (..identity_macro expected))) )))) +(/.type: for_type/variant + #Case/0 + (#Case/1 Nat) + (#Case/2 Int Text)) + +(/.type: for_type/record + {#slot/0 Bit + #slot/1 Rev}) + +(/.type: (for_type/all parameter) + [parameter parameter]) + (def: for_type Test - (do random.monad + (do {! random.monad} [expected random.nat expected_left random.nat - expected_right random.nat] - ($_ _.and - (_.cover [/.:] - (|> expected - (/.: Any) - (is? (/.: Any expected)))) - (_.cover [/.:as] - (|> expected - (/.: Any) - (/.:as /.Nat) - (is? expected))) - (_.cover [/.:assume] - (|> expected - (/.: Any) - /.:assume - (/.: /.Nat) - (is? expected))) - (_.cover [/.:let] - (let [[actual_left actual_right] - (: (/.:let [side /.Nat] - (& side side)) - [expected_left expected_right])] - (and (is? expected_left actual_left) - (is? expected_right actual_right)))) - (_.cover [/.:of] - (is? /.Nat (/.:of expected))) - ))) + expected_right random.nat + + #let [existential_type (: (Random /.Type) + (\ ! map (|>> #.Ex) random.nat))] + expected/0 existential_type + expected/1 existential_type] + (<| (_.for [/.Type]) + ($_ _.and + (_.cover [/.:] + (|> expected + (/.: Any) + (is? (/.: Any expected)))) + (_.cover [/.:as] + (|> expected + (/.: Any) + (/.:as /.Nat) + (is? expected))) + (_.cover [/.:assume] + (|> expected + (/.: Any) + /.:assume + (/.: /.Nat) + (is? expected))) + (_.cover [/.:let] + (let [[actual_left actual_right] + (: (/.:let [side /.Nat] + (& side side)) + [expected_left expected_right])] + (and (is? expected_left actual_left) + (is? expected_right actual_right)))) + (_.cover [/.:of] + (is? /.Nat (/.:of expected))) + (_.cover [/.primitive] + (case (/.primitive "foo" [expected/0 expected/1]) + (^ (#.Primitive "foo" (list actual/0 actual/1))) + (and (is? expected/0 actual/0) + (is? expected/1 actual/1)) + + _ + false)) + (_.cover [/.type] + (and (case (/.type [expected/0 expected/1]) + (#.Product actual/0 actual/1) + (and (is? expected/0 actual/0) + (is? expected/1 actual/1)) + + _ + false) + (case (/.type (| expected/0 expected/1)) + (#.Sum actual/0 actual/1) + (and (is? expected/0 actual/0) + (is? expected/1 actual/1)) + + _ + false) + (case (/.type (-> expected/0 expected/1)) + (#.Function actual/0 actual/1) + (and (is? expected/0 actual/0) + (is? expected/1 actual/1)) + + _ + false) + (case (/.type (expected/0 expected/1)) + (#.Apply actual/1 actual/0) + (and (is? expected/0 actual/0) + (is? expected/1 actual/1)) + + _ + false))) + (_.cover [/.type:] + (exec + (: /.Type ..for_type/variant) + (: /.Type ..for_type/record) + (: /.Type ..for_type/all) + true)) + )))) (def: for_i64 Test diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 09ef32175..b5c39ad75 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -30,13 +30,13 @@ (<| (_.covering /._) ($_ _.and (_.cover [/.range] - (let [expected-size (|> end (n.- start) inc) - expected-start? (|> range list.head (maybe\map (n.= start)) (maybe.default false)) - expected-end? (|> range list.last (maybe\map (n.= end)) (maybe.default false)) - can-be-backwards? (\ (list.equivalence n.equivalence) = + (let [expected_size (|> end (n.- start) inc) + expected_start? (|> range list.head (maybe\map (n.= start)) (maybe.default false)) + expected_end? (|> range list.last (maybe\map (n.= end)) (maybe.default false)) + can_be_backwards? (\ (list.equivalence n.equivalence) = (/.range n.enum start end) (list.reverse (/.range n.enum end start))) - every-element-is-a-successor? (case range + every_element_is_a_successor? (case range (#.Cons head tail) (|> (list\fold (function (_ next [verdict prev]) [(and verdict @@ -48,9 +48,9 @@ #.Nil false)] - (and (n.= expected-size (list.size range)) - expected-start? - expected-end? - can-be-backwards? - every-element-is-a-successor?))) + (and (n.= expected_size (list.size range)) + expected_start? + expected_end? + can_be_backwards? + every_element_is_a_successor?))) ))))) diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux index e1ab4f5f1..a4bb2c5f2 100644 --- a/stdlib/source/test/lux/control.lux +++ b/stdlib/source/test/lux/control.lux @@ -9,7 +9,7 @@ ["#/." atom] ["#/." frp] ["#/." thread] - ["#/." promise] + ["#/." async] ["#/." semaphore] ["#/." stm]] ["#." continuation] @@ -36,7 +36,7 @@ /concurrency/atom.test /concurrency/frp.test /concurrency/thread.test - /concurrency/promise.test + /concurrency/async.test /concurrency/semaphore.test /concurrency/stm.test )) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 3ceac0c4b..5ca5d7659 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -22,7 +22,7 @@ ["." / (#+ actor: message:) [// ["." atom (#+ Atom)] - ["." promise (#+ Promise Resolver) ("#\." monad)] + ["." async (#+ Async Resolver) ("#\." monad)] ["." frp]]]]) (exception: got_wrecked) @@ -36,7 +36,7 @@ (message: (count! {increment Nat} state self) Nat (let [state' (n.+ increment state)] - (promise\wrap (#try.Success [state' state'])))) + (async\wrap (#try.Success [state' state'])))) ) (def: (mailed? outcome) @@ -52,7 +52,7 @@ #let [as_mail (: (All [a] (-> (-> a a) (/.Mail a))) (function (_ transform) (function (_ state actor) - (|> state transform #try.Success promise\wrap)))) + (|> state transform #try.Success async\wrap)))) inc! (: (/.Mail Nat) (as_mail inc)) dec! (: (/.Mail Nat) (as_mail dec))]] (<| (_.covering /._) @@ -82,27 +82,27 @@ (and poisoned_actors_die! cannot_poison_more_than_once!))) - (let [[read write] (: [(Promise Text) (Resolver Text)] - (promise.promise []))] - (wrap (do promise.monad - [_ (promise.future (do io.monad - [actor (/.spawn! (: (/.Behavior Any Any) - {#/.on_init (|>>) - #/.on_mail (function (_ message state self) - (do {! promise.monad} - [outcome (message state self)] - (case outcome - (#try.Failure cause) - (do ! - [_ (promise.future (write cause))] - (wrap outcome)) - - (#try.Success _) - (wrap outcome))))}) - [])] - (/.poison! actor))) - _ (promise.wait 100) - result (promise.future (promise.poll read))] + (let [[read write] (: [(Async Text) (Resolver Text)] + (async.async []))] + (wrap (do async.monad + [_ (async.future (do io.monad + [actor (/.spawn! (: (/.Behavior Any Any) + {#/.on_init (|>>) + #/.on_mail (function (_ message state self) + (do {! async.monad} + [outcome (message state self)] + (case outcome + (#try.Failure cause) + (do ! + [_ (async.future (write cause))] + (wrap outcome)) + + (#try.Success _) + (wrap outcome))))}) + [])] + (/.poison! actor))) + _ (async.wait 100) + result (async.future (async.poll read))] (_.cover' [/.poisoned] (case result (#.Some error) @@ -111,20 +111,20 @@ #.None false))))) - (wrap (do promise.monad - [sent? (promise.future (do io.monad - [actor (/.spawn! /.default 0) - sent? (/.mail! inc! actor)] - (wrap (..mailed? sent?))))] + (wrap (do async.monad + [sent? (async.future (do io.monad + [actor (/.spawn! /.default 0) + sent? (/.mail! inc! actor)] + (wrap (..mailed? sent?))))] (_.cover' [/.Behavior /.Mail /.default /.spawn! /.mail!] sent?))) - (wrap (do promise.monad - [result (promise.future (do io.monad - [counter (/.spawn! /.default 0) - _ (/.poison! counter)] - (/.mail! inc! counter)))] + (wrap (do async.monad + [result (async.future (do io.monad + [counter (/.spawn! /.default 0) + _ (/.poison! counter)] + (/.mail! inc! counter)))] (_.cover' [/.dead] (case result (#try.Success outcome) @@ -135,14 +135,14 @@ (let [die! (: (/.Mail Nat) (function (_ state actor) - (promise\wrap (exception.throw ..got_wrecked []))))] - (wrap (do promise.monad - [result (promise.future (do io.monad - [actor (/.spawn! /.default initial_state) - sent? (/.mail! die! actor) - alive? (/.alive? actor) - obituary (/.obituary actor)] - (wrap (#try.Success [actor sent? alive? obituary]))))] + (async\wrap (exception.throw ..got_wrecked []))))] + (wrap (do async.monad + [result (async.future (do io.monad + [actor (/.spawn! /.default initial_state) + sent? (/.mail! die! actor) + alive? (/.alive? actor) + obituary (/.obituary actor)] + (wrap (#try.Success [actor sent? alive? obituary]))))] (_.cover' [/.Obituary /.obituary] (case result (^ (#try.Success [actor sent? alive? (#.Some [error state (list single_pending_message)])])) @@ -155,9 +155,9 @@ _ false))))) - (wrap (do promise.monad - [counter (promise.future (/.spawn! ..counter 0)) - result (do (try.with promise.monad) + (wrap (do async.monad + [counter (async.future (/.spawn! ..counter 0)) + result (do (try.with async.monad) [output_1 (/.tell! (count! 1) counter) output_2 (/.tell! (count! 1) counter) output_3 (/.tell! (count! 1) counter)] @@ -172,8 +172,8 @@ (#try.Failure error) false)))) - (wrap (do promise.monad - [verdict (promise.future + (wrap (do async.monad + [verdict (async.future (do io.monad [anonymous (/.actor {Nat initial_state} @@ -204,13 +204,13 @@ #let [expected (list.take num_observations events) sink (: (Atom (Row Nat)) (atom.atom row.empty))]] - (wrap (do promise.monad - [agent (promise.future + (wrap (do async.monad + [agent (async.future (do {! io.monad} [agent (/.actor {Nat 0}) _ (/.observe (function (_ event stop) (function (_ events_seen self) - (promise.future + (async.future (if (n.< num_observations events_seen) (do ! [_ (atom.update (row.add event) sink)] @@ -222,7 +222,7 @@ agent)] (wrap agent))) _ (/.await agent) - actual (promise.future (atom.read sink))] + actual (async.future (atom.read sink))] (_.cover' [/.Stop /.observe /.await] (\ (list.equivalence n.equivalence) = expected (row.to_list actual)))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/promise.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 3cc1a42c9..1c7d075f4 100644 --- a/stdlib/source/test/lux/control/concurrency/promise.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -27,11 +27,11 @@ ["." atom (#+ Atom)]]]]) (def: injection - (Injection /.Promise) + (Injection /.Async) /.resolved) (def: comparison - (Comparison /.Promise) + (Comparison /.Async) (function (_ == left right) (io.run (do io.monad @@ -69,11 +69,11 @@ ($monad.spec ..injection ..comparison /.monad)) (wrap (do /.monad - [#let [[promise resolver] (: [(/.Promise Nat) (/.Resolver Nat)] - (/.promise []))] + [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] resolved? (/.future (resolver expected)) - actual promise] - (_.cover' [/.Promise /.Resolver /.promise] + actual async] + (_.cover' [/.Async /.Resolver /.async] (and resolved? (n.= expected actual))))) (wrap (do /.monad @@ -136,9 +136,9 @@ (n.+ leftA rightA))))) (wrap (do /.monad [?actual (/.future (/.poll (/.resolved expected))) - #let [[promise resolver] (: [(/.Promise Nat) (/.Resolver Nat)] - (/.promise []))] - ?never (/.future (/.poll promise))] + #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + ?never (/.future (/.poll async))] (_.cover' [/.poll] (case [?actual ?never] [(#.Some actual) #.None] @@ -148,9 +148,9 @@ false)))) (wrap (do /.monad [yep (/.future (/.resolved? (/.resolved expected))) - #let [[promise resolver] (: [(/.Promise Nat) (/.Resolver Nat)] - (/.promise []))] - nope (/.future (/.resolved? promise))] + #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + nope (/.future (/.resolved? async))] (_.cover' [/.resolved?] (and yep (not nope))))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 813ceb7ed..e9eabb5bc 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -23,21 +23,21 @@ [\\library ["." / [// - ["." promise (#+ Promise) ("#\." monad)] + ["." async (#+ Async) ("#\." monad)] ["." atom (#+ Atom atom)]]]]) (def: injection (Injection /.Channel) - (|>> promise.resolved - /.of_promise)) + (|>> async.resolved + /.of_async)) (def: comparison (Comparison /.Channel) (function (_ == left right) (io.run (do io.monad - [?left (promise.poll left) - ?right (promise.poll right)] + [?left (async.poll left) + ?right (async.poll right)] (wrap (case [?left ?right] [(#.Some (#.Some [left _])) (#.Some (#.Some [right _]))] @@ -47,12 +47,12 @@ false)))))) (def: (take_amount amount_of_polls [channel sink]) - (All [a] (-> Nat [(/.Channel a) (/.Sink a)] (Promise (List a)))) + (All [a] (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a)))) (case amount_of_polls - 0 (do promise.monad - [_ (promise.future (\ sink close))] + 0 (do async.monad + [_ (async.future (\ sink close))] (wrap #.Nil)) - _ (do {! promise.monad} + _ (do {! async.monad} [event channel] (case event #.None @@ -93,7 +93,7 @@ (#try.Success channel) (io.run (do io.monad - [?actual (promise.poll channel)] + [?actual (async.poll channel)] (wrap (case ?actual (#.Some (#.Some [actual _])) (n.= sample actual) @@ -114,22 +114,22 @@ (#try.Failure error) (exception.match? /.channel_is_already_closed error))) - (wrap (do promise.monad + (wrap (do async.monad [output (|> sample - promise.resolved - /.of_promise + async.resolved + /.of_async /.consume)] - (_.cover' [/.of_promise /.consume] + (_.cover' [/.of_async /.consume] (list\= (list sample) output)))) - (wrap (do promise.monad + (wrap (do async.monad [output (|> inputs (/.sequential 0) /.consume)] (_.cover' [/.sequential] (list\= inputs output)))) - (wrap (do promise.monad + (wrap (do async.monad [output (|> inputs (/.sequential 0) (/.only n.even?) @@ -137,48 +137,48 @@ (_.cover' [/.only] (list\= (list.only n.even? inputs) output)))) - (wrap (do {! promise.monad} - [#let [[?signal !signal] (: [(promise.Promise Any) (promise.Resolver Any)] - (promise.promise [])) + (wrap (do {! async.monad} + [#let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)] + (async.async [])) sink (: (Atom (Row Nat)) (atom.atom row.empty))] - _ (promise.future (/.subscribe (function (_ value) - (do {! io.monad} - [current (atom.read sink) - _ (atom.update (row.add value) sink)] - (if (n.< (list.size inputs) - (inc (row.size current))) - (wrap (#.Some [])) - (do ! - [_ (!signal [])] - (wrap #.None))))) - (/.sequential 0 (list\compose inputs inputs)))) + _ (async.future (/.subscribe (function (_ value) + (do {! io.monad} + [current (atom.read sink) + _ (atom.update (row.add value) sink)] + (if (n.< (list.size inputs) + (inc (row.size current))) + (wrap (#.Some [])) + (do ! + [_ (!signal [])] + (wrap #.None))))) + (/.sequential 0 (list\compose inputs inputs)))) _ ?signal listened (|> sink atom.read - promise.future + async.future (\ ! map row.to_list))] (_.cover' [/.Subscriber /.subscribe] (list\= inputs listened)))) - (wrap (do promise.monad + (wrap (do async.monad [actual (/.fold (function (_ input total) - (promise.resolved (n.+ input total))) + (async.resolved (n.+ input total))) 0 (/.sequential 0 inputs))] (_.cover' [/.fold] (n.= (list\fold n.+ 0 inputs) actual)))) - (wrap (do promise.monad + (wrap (do async.monad [actual (|> inputs (/.sequential 0) (/.folds (function (_ input total) - (promise.resolved (n.+ input total))) + (async.resolved (n.+ input total))) 0) /.consume)] (_.cover' [/.folds] (list\= (list.folds n.+ 0 inputs) actual)))) - (wrap (do promise.monad + (wrap (do async.monad [actual (|> (list distint/0 distint/0 distint/0 distint/1 distint/2 distint/2) @@ -192,7 +192,7 @@ [polling_delay (\ ! map (|>> (n.% 10) inc) random.nat) amount_of_polls (\ ! map (|>> (n.% 10) inc) random.nat)] ($_ _.and - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [actual (..take_amount amount_of_polls (/.poll polling_delay (: (IO Nat) (io.io sample)))) #let [correct_values! (list.every? (n.= sample) actual) @@ -202,15 +202,15 @@ (_.cover' [/.poll] (and correct_values! enough_polls!)))) - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [actual (..take_amount amount_of_polls (/.periodic polling_delay))] (_.cover' [/.periodic] (n.= amount_of_polls (list.size actual))))))) - (wrap (do promise.monad + (wrap (do async.monad [#let [max_iterations 10] actual (|> [0 sample] (/.iterate (function (_ [iterations current]) - (promise.resolved + (async.resolved (if (n.< max_iterations iterations) (#.Some [[(inc iterations) (n.+ shift current)] current]) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 38e152456..d1077ae53 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -11,7 +11,7 @@ ["." try] ["." exception (#+ exception:)] [concurrency - ["." promise (#+ Promise)] + ["." async (#+ Async)] ["." atom (#+ Atom)]]] [data ["." maybe] @@ -41,8 +41,8 @@ (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do promise.monad - [result (promise.time_out ..delay (/.wait semaphore))] + (wrap (do async.monad + [result (async.time_out ..delay (/.wait semaphore))] (_.cover' [/.semaphore] (case result (#.Some _) @@ -53,9 +53,9 @@ (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) - result (promise.time_out ..delay (/.wait semaphore))] + result (async.time_out ..delay (/.wait semaphore))] (_.cover' [/.wait] (case result (#.Some _) @@ -66,12 +66,12 @@ (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) #let [block (/.wait semaphore)] - result/0 (promise.time_out ..delay block) + result/0 (async.time_out ..delay block) open_positions (/.signal semaphore) - result/1 (promise.time_out ..delay block)] + result/1 (async.time_out ..delay block)] (_.cover' [/.signal] (case [result/0 result/1 open_positions] [#.None (#.Some _) (#try.Success +0)] @@ -82,7 +82,7 @@ (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do promise.monad + (wrap (do async.monad [outcome (/.signal semaphore)] (_.cover' [/.semaphore_is_maxed_out] (case outcome @@ -105,7 +105,7 @@ mutex (/.mutex []) processA (<| (/.synchronize mutex) io.io - promise.future + async.future (do {! io.monad} [_ (<| (monad.seq !) (list.repeat repetitions) @@ -113,13 +113,13 @@ (wrap []))) processB (<| (/.synchronize mutex) io.io - promise.future + async.future (do {! io.monad} [_ (<| (monad.seq !) (list.repeat repetitions) (atom.update (|>> (format "B")) resource))] (wrap [])))]] - (wrap (do promise.monad + (wrap (do async.monad [_ processA _ processB #let [outcome (io.run (atom.read resource))]] @@ -131,10 +131,10 @@ ))) (def: (waiter resource barrier id) - (-> (Atom Text) /.Barrier Nat (Promise Any)) - (do promise.monad + (-> (Atom Text) /.Barrier Nat (Async Any)) + (do async.monad [_ (/.block barrier) - _ (promise.future (atom.update (|>> (format (%.nat id))) resource))] + _ (async.future (atom.update (|>> (format (%.nat id))) resource))] (wrap []))) (def: barrier @@ -158,7 +158,7 @@ [limit (\ ! map (|>> (n.% 9) inc) random.nat) #let [barrier (/.barrier (maybe.assume (/.limit limit))) resource (atom.atom "")]] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [#let [suffix "_" expected_ending (|> suffix (list.repeat limit) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 23248f387..053cc7dd8 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -22,7 +22,7 @@ ["." / [// ["." atom (#+ Atom atom)] - ["." promise] + ["." async] ["." frp (#+ Channel)]]]]) (def: injection @@ -41,7 +41,7 @@ (do {! random.monad} [dummy random.nat expected random.nat - iterations-per-process (|> random.nat (\ ! map (n.% 100)))] + iterations_per_process (|> random.nat (\ ! map (n.% 100)))] ($_ _.and (_.for [/.functor] ($functor.spec ..injection ..comparison /.functor)) @@ -50,15 +50,15 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (wrap (do promise.monad + (wrap (do async.monad [actual (/.commit (\ /.monad wrap expected))] (_.cover' [/.commit] (n.= expected actual)))) - (wrap (do promise.monad + (wrap (do async.monad [actual (/.commit (/.read (/.var expected)))] (_.cover' [/.Var /.var /.read] (n.= expected actual)))) - (wrap (do promise.monad + (wrap (do async.monad [actual (let [box (/.var dummy)] (/.commit (do /.monad [_ (/.write expected box)] @@ -71,7 +71,7 @@ (_.cover' [/.write] (and (n.= expected actual) verdict)))) - (wrap (do promise.monad + (wrap (do async.monad [#let [box (/.var dummy)] output (/.commit (do /.monad [_ (/.update (n.+ expected) box)] @@ -79,12 +79,12 @@ (_.cover' [/.update] (n.= (n.+ expected dummy) output)))) - (wrap (do promise.monad + (wrap (do async.monad [#let [box (/.var dummy) [follower sink] (io.run (/.follow box))] _ (/.commit (/.write expected box)) _ (/.commit (/.update (n.* 2) box)) - _ (promise.future (\ sink close)) + _ (async.future (\ sink close)) _ (/.commit (/.update (n.* 3) box)) changes (frp.consume follower)] (_.cover' [/.follow] @@ -92,12 +92,12 @@ (list expected (n.* 2 expected)) changes)))) (wrap (let [var (/.var 0)] - (do {! promise.monad} - [_ (|> (list.repeat iterations-per-process []) + (do {! async.monad} + [_ (|> (list.repeat iterations_per_process []) (list\map (function (_ _) (/.commit (/.update inc var)))) (monad.seq !)) cummulative (/.commit (/.read var))] (_.cover' [/.STM] - (n.= iterations-per-process + (n.= iterations_per_process cummulative))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index 557b6a80b..cb4e7d889 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -18,7 +18,7 @@ ["." / [// ["." atom (#+ Atom)] - ["." promise]]]]) + ["." async]]]]) (def: #export test Test @@ -31,15 +31,15 @@ ($_ _.and (_.cover [/.parallelism] (n.> 0 /.parallelism)) - (wrap (do promise.monad - [reference_time (promise.future instant.now) + (wrap (do async.monad + [reference_time (async.future instant.now) #let [box (atom.atom [reference_time dummy])] - _ (promise.future + _ (async.future (/.schedule delay (do io.monad [execution_time instant.now] (atom.write [execution_time expected] box)))) - _ (promise.wait (n.* 2 delay)) - [execution_time actual] (promise.future (atom.read box))] + _ (async.wait (n.* 2 delay)) + [execution_time actual] (async.future (atom.read box))] (_.cover' [/.schedule] (let [expected_delay! (i.>= (.int delay) diff --git a/stdlib/source/test/lux/control/io.lux b/stdlib/source/test/lux/control/io.lux index e101459c2..05642a19f 100644 --- a/stdlib/source/test/lux/control/io.lux +++ b/stdlib/source/test/lux/control/io.lux @@ -32,7 +32,7 @@ (_.for [/.IO]) (do random.monad [sample random.nat - exit-code random.int] + exit_code random.int] ($_ _.and (_.for [/.functor] ($functor.spec ..injection ..comparison /.functor)) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 003024197..1fed0e4cb 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -249,7 +249,7 @@ (and (|> (/.run (/.default wrong (\ /.monad wrap expected)) (list)) (match actual (n.= expected actual))) (|> (/.run (/.default expected (: (Parser (List Code) Nat) - (/.fail "yolo"))) + (/.failure "yolo"))) (list)) (match actual (n.= expected actual))) )) @@ -362,9 +362,9 @@ (_.cover [/.run] (|> (/.run (\ /.monad wrap expected) (list)) (match actual (n.= expected actual)))) - (_.cover [/.fail] + (_.cover [/.failure] (|> (list) - (/.run (/.fail failure)) + (/.run (/.failure failure)) (should_fail failure))) (_.cover [/.lift] (and (|> (list) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index d49640f37..ebba6bc28 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -255,10 +255,10 @@ [/.code format.code random_code code.equivalence] [/.type format.type random_type type.equivalence] )) - (~~ (template [<parser_coverage> <parser> <format_coverage> <format> <random> <equivalence>] + (~~ (template [<parser_coverage> <parser> <coverage_format> <format> <random> <equivalence>] [(do {! random.monad} [expected <random>] - (_.cover [<parser_coverage> <format_coverage>] + (_.cover [<parser_coverage> <coverage_format>] (|> expected (format.run <format>) (/.run <parser>) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 142e0cd42..f0b63bfd5 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -150,13 +150,13 @@ [size (\ ! map (n.% 10) random.nat) keys (random.list size (random.unicode 1)) values (random.list size (random.unicode 1)) - #let [expected (dictionary.of_list text.hash (list.zip/2 keys values))]] + #let [expected (dictionary.of_list text.hash (list.zipped/2 keys values))]] (_.cover [/.dictionary] (|> (/.run (/.dictionary /.string) (#json.Object (|> values (list\map (|>> #json.String)) - (list.zip/2 keys) + (list.zipped/2 keys) (dictionary.of_list text.hash)))) (!expect (^multi (#try.Success actual) (\ (dictionary.equivalence text.equivalence) = expected actual)))))) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index bd6351ded..61e67e81f 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -114,7 +114,7 @@ (wrap (and (..success? outcome) (n.= expected_clean_ups actual_clean_ups)))))) - (_.cover [/.fail] + (_.cover [/.failure] (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) @@ -127,7 +127,7 @@ (do {! (/.monad !)} [_ (monad.map ! (/.acquire //@ count_clean_up) (enum.range n.enum 1 expected_clean_ups)) - _ (/.fail //@ (exception.construct ..oops []))] + _ (/.failure //@ (exception.construct ..oops []))] (wrap []))) actual_clean_ups (thread.read clean_up_counter)] (wrap (and (..throws? ..oops outcome) diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux index ec2d91d20..3547b27b1 100644 --- a/stdlib/source/test/lux/control/security/capability.lux +++ b/stdlib/source/test/lux/control/security/capability.lux @@ -7,7 +7,7 @@ [control ["." io (#+ IO)] [concurrency - ["." promise]]] + ["." async]]] [math ["." random] [number @@ -38,7 +38,7 @@ (and (is? pass_through untouched) (n.= expected actual)))) (wrap (let [capability (..can_io (function (_ _) (io.io expected)))] - (do promise.monad + (do async.monad [actual (/.use (/.async capability) [])] (_.cover' [/.async] (n.= expected actual))))) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index fb82ed6c9..d51067799 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -121,8 +121,8 @@ (_.cover [/.merge_with] (list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2)) - (list.zip/2 (/.values dict) - (/.values (/.merge_with n.+ dict dict))))) + (list.zipped/2 (/.values dict) + (/.values (/.merge_with n.+ dict dict))))) (_.cover [/.of_list] (let [(^open ".") (/.equivalence n.equivalence)] diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 6884c0e28..19c6bfde6 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -49,8 +49,8 @@ random.nat) extra_value random.nat shift random.nat - #let [pairs (list.zip/2 (set.to_list keys) - (set.to_list values)) + #let [pairs (list.zipped/2 (set.to_list keys) + (set.to_list values)) sample (/.of_list n.order pairs) sorted_pairs (list.sort (function (_ [left _] [right _]) (n.< left right)) @@ -97,7 +97,7 @@ sorted_pairs)) (_.cover [/.keys /.values] (list\= (/.entries sample) - (list.zip/2 (/.keys sample) (/.values sample)))) + (list.zipped/2 (/.keys sample) (/.values sample)))) (_.cover [/.of_list] (|> sample /.entries (/.of_list n.order) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index f86f4c13c..f7450e3d1 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -26,7 +26,7 @@ (do random.monad [keys (random.set text.hash size gen_key) values (random.list size gen_value)] - (wrap (list.zip/2 (set.to_list keys) values)))) + (wrap (list.zipped/2 (set.to_list keys) values)))) (def: #export test Test @@ -57,8 +57,8 @@ (_.cover [/.keys /.values] (\ (/.equivalence n.equivalence) = sample - (list.zip/2 (/.keys sample) - (/.values sample)))) + (list.zipped/2 (/.keys sample) + (/.values sample)))) (_.cover [/.contains?] (and (list.every? (function (_ key) (/.contains? key sample)) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index a19738802..f3175fbb5 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -147,9 +147,9 @@ expected_numbers! (/.every? (n.= (dec size)) - (/.zip_with/2 n.+ - indices - (/.sort n.> indices)))] + (/.zipped_with/2 n.+ + indices + (/.sort n.> indices)))] (and expected_amount! already_sorted! expected_numbers!))) @@ -283,8 +283,8 @@ (_.cover [/.as_pairs] (n.= (n./ 2 (/.size sample/0)) (/.size (/.as_pairs sample/0)))) - (_.cover [/.zip/2] - (let [zipped (/.zip/2 sample/0 sample/1) + (_.cover [/.zipped/2] + (let [zipped (/.zipped/2 sample/0 sample/1) zipped::size (/.size zipped) size_of_smaller_list! @@ -298,8 +298,8 @@ (/\map product.right zipped)))] (and size_of_smaller_list! can_extract_values!))) - (_.cover [/.zip/3] - (let [zipped (/.zip/3 sample/0 sample/1 sample/2) + (_.cover [/.zipped/3] + (let [zipped (/.zipped/3 sample/0 sample/1 sample/2) zipped::size (/.size zipped) size_of_smaller_list! @@ -318,29 +318,29 @@ (/\map (|>> product.right product.right) zipped)))] (and size_of_smaller_list! can_extract_values!))) - (_.cover [/.zip] + (_.cover [/.zipped] (and (\ (/.equivalence (product.equivalence n.equivalence n.equivalence)) = - (/.zip/2 sample/0 sample/1) - ((/.zip 2) sample/0 sample/1)) + (/.zipped/2 sample/0 sample/1) + ((/.zipped 2) sample/0 sample/1)) (\ (/.equivalence ($_ product.equivalence n.equivalence n.equivalence n.equivalence)) = - (/.zip/3 sample/0 sample/1 sample/2) - ((/.zip 3) sample/0 sample/1 sample/2)))) + (/.zipped/3 sample/0 sample/1 sample/2) + ((/.zipped 3) sample/0 sample/1 sample/2)))) - (_.cover [/.zip_with/2] + (_.cover [/.zipped_with/2] (/\= (/\map (function (_ [left right]) (+/2 left right)) - (/.zip/2 sample/0 sample/1)) - (/.zip_with/2 +/2 sample/0 sample/1))) - (_.cover [/.zip_with/3] + (/.zipped/2 sample/0 sample/1)) + (/.zipped_with/2 +/2 sample/0 sample/1))) + (_.cover [/.zipped_with/3] (/\= (/\map (function (_ [left mid right]) (+/3 left mid right)) - (/.zip/3 sample/0 sample/1 sample/2)) - (/.zip_with/3 +/3 sample/0 sample/1 sample/2))) - (_.cover [/.zip_with] - (and (/\= (/.zip_with/2 +/2 sample/0 sample/1) - ((/.zip_with 2) +/2 sample/0 sample/1)) - (/\= (/.zip_with/3 +/3 sample/0 sample/1 sample/2) - ((/.zip_with 3) +/3 sample/0 sample/1 sample/2)))) + (/.zipped/3 sample/0 sample/1 sample/2)) + (/.zipped_with/3 +/3 sample/0 sample/1 sample/2))) + (_.cover [/.zipped_with] + (and (/\= (/.zipped_with/2 +/2 sample/0 sample/1) + ((/.zipped_with 2) +/2 sample/0 sample/1)) + (/\= (/.zipped_with/3 +/3 sample/0 sample/1 sample/2) + ((/.zipped_with 3) +/3 sample/0 sample/1 sample/2)))) (_.cover [/.concat] (and (/\= (/\compose sample/0 sample/1) (/.concat (list sample/0 sample/1))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index aa85116f6..05752d6fa 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -33,8 +33,8 @@ (wrap (list\fold (function (_ [count element] set) (/.add count element set)) (/.new hash) - (list.zip/2 element_counts - (set.to_list elements)))))) + (list.zipped/2 element_counts + (set.to_list elements)))))) (def: signature Test diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index f92d75440..d14c4d27f 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -88,7 +88,7 @@ (let [tree (list\fold (function (_ [tag value] tree) (\ builder branch tree (\ builder leaf tag value))) (\ builder leaf tags/H values/H) - (list.zip/2 tags/T values/T))] + (list.zipped/2 tags/T values/T))] (and (\ tags_equivalence = (list& tags/H tags/T) (/.tags tree)) (\ values_equivalence = (list& values/H values/T) (/.values tree)))))) (_.cover [/.one] diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 2fe36607d..22dce27f1 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -90,8 +90,8 @@ (do random.monad [keys (random.set text.hash 3 (random.ascii/alpha 1)) values (random.set frac.hash 3 random.safe_frac) - #let [expected (list.zip/2 (set.to_list keys) - (list\map (|>> #/.Number) (set.to_list values))) + #let [expected (list.zipped/2 (set.to_list keys) + (list\map (|>> #/.Number) (set.to_list values))) object (/.object expected)]] ($_ _.and (_.cover [/.object /.fields] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index bbbf299d8..c55928c15 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -56,7 +56,7 @@ sample_nat random.nat sample_rev random.rev] (wrap (`` (and (~~ (template [<type> <format> <sample>] - [(|> (/.represent <type> <sample>) + [(|> (/.representation <type> <sample>) (try\map (text\= (<format> <sample>))) (try.default false))] @@ -74,8 +74,8 @@ [sample_bit random.bit sample_int random.int sample_frac random.frac] - (wrap (`` (and (case (/.represent (type [Bit Int Frac]) - [sample_bit sample_int sample_frac]) + (wrap (`` (and (case (/.representation (type [Bit Int Frac]) + [sample_bit sample_int sample_frac]) (#try.Success actual) (text\= (format "[" (%.bit sample_bit) " " (%.int sample_int) @@ -87,7 +87,7 @@ false) ## TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants ## (~~ (template [<lefts> <right?> <value> <format>] - ## [(|> (/.represent (type (| Bit Int Frac)) + ## [(|> (/.representation (type (| Bit Int Frac)) ## (: (| Bit Int Frac) ## (<lefts> <right?> <value>))) ## (try\map (text\= (format "(" (%.nat <lefts>) @@ -112,7 +112,7 @@ sample_xml $//xml.random sample_json $//json.random] (wrap (`` (and (~~ (template [<type> <format> <sample>] - [(|> (/.represent <type> <sample>) + [(|> (/.representation <type> <sample>) (try\map (text\= (<format> <sample>))) (try.default false))] @@ -135,7 +135,7 @@ sample_time random.time sample_day random.day] (wrap (`` (and (~~ (template [<type> <format> <sample>] - [(|> (/.represent <type> <sample>) + [(|> (/.representation <type> <sample>) (try\map (text\= (<format> <sample>))) (try.default false))] @@ -160,20 +160,20 @@ can_represent_complex_types! ..can_represent_complex_types can_represent_time_types! ..can_represent_time_types] ($_ _.and - (_.cover [/.represent] + (_.cover [/.representation] (`` (and can_represent_simple_types! can_represent_structure_types! can_represent_complex_types! can_represent_time_types! - (|> (/.represent .Any sample_frac) + (|> (/.representation .Any sample_frac) (try\map (text\= "[]")) (try.default false)) - (|> (/.represent (type (List Nat)) (: (List Nat) (list sample_nat))) + (|> (/.representation (type (List Nat)) (: (List Nat) (list sample_nat))) (try\map (text\= (%.list %.nat (list sample_nat)))) (try.default false)) (~~ (template [<sample>] - [(|> (/.represent (type (Maybe Nat)) (: (Maybe Nat) <sample>)) + [(|> (/.representation (type (Maybe Nat)) (: (Maybe Nat) <sample>)) (try\map (text\= (%.maybe %.nat <sample>))) (try.default false))] @@ -182,7 +182,7 @@ )) ))) (_.cover [/.cannot_represent_value] - (case (/.represent (-> Nat Nat) (|>>)) + (case (/.representation (-> Nat Nat) (|>>)) (#try.Success representation) false @@ -197,9 +197,9 @@ sample_int random.int sample_frac random.frac sample_text (random.ascii/upper 10)] - (_.cover [/.inspect] + (_.cover [/.inspection] (`` (and (~~ (template [<format> <sample>] - [(text\= (<format> <sample>) (/.inspect <sample>))] + [(text\= (<format> <sample>) (/.inspection <sample>))] [%.bit sample_bit] [%.int sample_int] @@ -208,10 +208,10 @@ )) (text\= (|> (list sample_bit sample_int sample_frac sample_text) (: (List Any)) - (list\map /.inspect) + (list\map /.inspection) (text.join_with " ") (text.enclose ["[" "]"])) - (/.inspect [sample_bit sample_int sample_frac sample_text])) + (/.inspection [sample_bit sample_int sample_frac sample_text])) ))))) (syntax: (macro_error macro) @@ -256,7 +256,7 @@ (_.cover [/.private] (exec (: (/.private /.Inspector) - /.inspect) + /.inspection) true)) (_.cover [/.log!] (exec diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 2ce231e61..1a99aae83 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -108,9 +108,9 @@ (do {! random.monad} [parts (..random_sequence replace_simulation)] (wrap [(/.record (let [parts' (list\map product.left parts)] - (list.zip/2 parts' parts'))) + (list.zipped/2 parts' parts'))) (/.record (let [parts' (list\map product.right parts)] - (list.zip/2 parts' parts')))])) + (list.zipped/2 parts' parts')))])) ))))) (def: for_format diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index cbe6f0e3a..65e8e62f5 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -49,7 +49,7 @@ (macro.with_gensyms [g!output] (do meta.monad [pop! (/.push (list [name (..constant constant)])) - [module short] (meta.normalize name) + [module short] (meta.normal name) _ (if pre_remove (let [remove_macro! (: (-> .Module .Module) (update@ #.definitions (plist.remove short)))] diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 67529dcca..4010b9ce1 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -114,8 +114,8 @@ #.extensions [] #.host []}]] ($_ _.and - (_.cover [/.fail] - (|> (/.fail expected_error) + (_.cover [/.failure] + (|> (/.failure expected_error) (: (Meta Any)) (/.run expected_lux) (!expect (^multi (#try.Failure actual_error) @@ -133,20 +133,20 @@ (_.cover [/.either] (and (|> (/.either (\ /.monad wrap expected) (: (Meta Nat) - (/.fail expected_error))) + (/.failure expected_error))) (/.run expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) (|> (/.either (: (Meta Nat) - (/.fail expected_error)) + (/.failure expected_error)) (\ /.monad wrap expected)) (/.run expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) (|> (/.either (: (Meta Nat) - (/.fail expected_error)) + (/.failure expected_error)) (: (Meta Nat) - (/.fail expected_error))) + (/.failure expected_error))) (/.run expected_lux) (!expect (^multi (#try.Failure actual_error) (text\= (location.with location.dummy expected_error) @@ -261,13 +261,13 @@ (|> (/.imported? imported_module_name) (/.run expected_lux) (try.default false))) - (_.cover [/.normalize] - (and (|> (/.normalize ["" expected_short]) + (_.cover [/.normal] + (and (|> (/.normal ["" expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success [actual_module actual_short]) (and (text\= expected_current_module actual_module) (is? expected_short actual_short))))) - (|> (/.normalize [dummy_module expected_short]) + (|> (/.normal [dummy_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success [actual_module actual_short]) (and (text\= dummy_module actual_module) diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 45dc68c97..95004b2c4 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -7,7 +7,7 @@ ["." io] ["." exception] [concurrency - ["." promise] + ["." async] ["." atom (#+ Atom)]]] [data ["." text ("#\." equivalence)] @@ -35,7 +35,7 @@ expected_message/1 (random.only (|>> (text\= expected_message/0) not) (random.ascii/lower 5))] ($_ /.and - (wrap (do promise.monad + (wrap (do async.monad [[success_tally success_message] (/.assert expected_message/0 true) [failure_tally failure_message] (/.assert expected_message/0 false)] (/.cover' [/.assert /.Tally] @@ -45,7 +45,7 @@ (n.= 0 (get@ #/.failures success_tally))) (and (n.= 0 (get@ #/.successes failure_tally)) (n.= 1 (get@ #/.failures failure_tally))))))) - (wrap (do promise.monad + (wrap (do async.monad [tt (/.and' (/.assert expected_message/0 true) (/.assert expected_message/1 true)) ff (/.and' (/.assert expected_message/0 false) @@ -65,8 +65,8 @@ /.Test (do {! random.monad} [seed random.nat - #let [[read write] (: [(promise.Promise Nat) (promise.Resolver Nat)] - (promise.promise []))] + #let [[read write] (: [(async.Async Nat) (async.Resolver Nat)] + (async.async []))] pre (<| (/.seed seed) (do ! [sample random.nat @@ -75,10 +75,10 @@ post (<| (/.seed seed) (do ! [actual random.nat] - (wrap (do promise.monad + (wrap (do async.monad [expected read] (/.assert "" (n.= expected actual))))))] - (wrap (do promise.monad + (wrap (do async.monad [[pre_tally pre_message] pre [post_tally post_message] post] (/.cover' [/.seed] @@ -92,7 +92,7 @@ ($_ /.and (do {! random.monad} [times_assertion (/.times 0 (/.test "" true))] - (wrap (do promise.monad + (wrap (do async.monad [[tally error] times_assertion] (/.cover' [/.must_try_test_at_least_once] (and (text.contains? (get@ #exception.label /.must_try_test_at_least_once) error) @@ -107,9 +107,9 @@ [_ (wrap []) #let [_ (io.run (atom.update inc counter))]] (/.test "" true)))] - (wrap (do promise.monad + (wrap (do async.monad [[tally error] times_assertion - actual (promise.future (atom.read counter))] + actual (async.future (atom.read counter))] (/.cover' [/.times] (and (n.= expected actual) (n.= 1 (get@ #/.successes tally)) @@ -130,9 +130,9 @@ [_ (wrap []) #let [_ (io.run (atom.update inc counter))]] (/.test "" true)))] - (wrap (do promise.monad + (wrap (do async.monad [[tally error] assertion - actual (promise.future (atom.read counter))] + actual (async.future (atom.read counter))] (/.cover' [/.in_parallel] (and (n.= expected actual) (n.= expected (get@ #/.successes tally)) @@ -149,9 +149,9 @@ #let [_ (undefined) _ (io.run (atom.update inc counter))]] (/.test "" true)))] - (wrap (do promise.monad + (wrap (do async.monad [[tally error] assertion - actual (promise.future (atom.read counter))] + actual (async.future (atom.read counter))] (/.cover' [/.error_during_execution] (let [correct_error! (text.contains? (get@ #exception.label /.error_during_execution) error) no_complete_run! (n.= 0 actual) @@ -172,7 +172,7 @@ (do random.monad [not_covering (/.test "" true) covering (/.covering .._ (/.test "" true))] - (wrap (do promise.monad + (wrap (do async.monad [[not_covering _] not_covering [covering _] covering] (/.cover' [/.covering] @@ -183,7 +183,7 @@ (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.cover [..dummy_target] true))] - (wrap (do promise.monad + (wrap (do async.monad [[not_covering _] not_covering [covering _] covering] (/.cover' [/.cover] @@ -194,7 +194,7 @@ (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (wrap (/.cover' [..dummy_target] true)))] - (wrap (do promise.monad + (wrap (do async.monad [[not_covering _] not_covering [covering _] covering] (/.cover' [/.cover'] @@ -205,7 +205,7 @@ (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))] - (wrap (do promise.monad + (wrap (do async.monad [[not_covering _] not_covering [covering _] covering] (/.cover' [/.for] @@ -233,7 +233,7 @@ (do ! [success_assertion (/.test expected_message/0 true) failure_assertion (/.test expected_message/0 false)] - (wrap (do promise.monad + (wrap (do async.monad [[success_tally success_message] success_assertion [failure_tally failure_message] failure_assertion] (/.cover' [/.test] @@ -252,7 +252,7 @@ (/.test expected_message/1 false)) ft (/.and (/.test expected_message/0 false) (/.test expected_message/1 true))] - (wrap (do promise.monad + (wrap (do async.monad [tt tt ff ff tf tf @@ -265,7 +265,7 @@ (do ! [success_assertion (/.context expected_context (/.test expected_message/0 true)) failure_assertion (/.context expected_context (/.test expected_message/0 false))] - (wrap (do promise.monad + (wrap (do async.monad [[success_tally success_message] success_assertion [failure_tally failure_message] failure_assertion] (/.cover' [/.context] @@ -278,17 +278,17 @@ (and (n.= 0 (get@ #/.successes failure_tally)) (n.= 1 (get@ #/.failures failure_tally)))))))) (do ! - [failure_assertion (/.fail expected_message/0)] - (wrap (do promise.monad + [failure_assertion (/.failure expected_message/0)] + (wrap (do async.monad [[failure_tally failure_message] failure_assertion] - (/.cover' [/.fail] + (/.cover' [/.failure] (and (text.contains? expected_message/0 failure_message) (and (n.= 0 (get@ #/.successes failure_tally)) (n.= 1 (get@ #/.failures failure_tally)))))))) (do ! [success_assertion (/.lift expected_message/0 (wrap true)) failure_assertion (/.lift expected_message/0 (wrap false))] - (wrap (do promise.monad + (wrap (do async.monad [[success_tally success_message] success_assertion [failure_tally failure_message] failure_assertion] (/.cover' [/.lift] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index 62330114a..31507f067 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -37,7 +37,7 @@ [meta ["." archive]]]]]]]]) -(def: (exhaustive-weaving branchings) +(def: (exhaustive_weaving branchings) (-> (List (List Code)) (List (List Code))) (case branchings #.Nil @@ -48,11 +48,11 @@ (#.Cons head+ tail++) (do list.monad - [tail+ (exhaustive-weaving tail++) + [tail+ (exhaustive_weaving tail++) head head+] (wrap (#.Cons head tail+))))) -(def: #export (exhaustive-branches allow-literals? variantTC inputC) +(def: #export (exhaustive_branches allow_literals? variantTC inputC) (-> Bit (List [Code Code]) Code (Random (List Code))) (case inputC [_ (#.Bit _)] @@ -60,13 +60,13 @@ (^template [<tag> <gen> <wrapper>] [[_ (<tag> _)] - (if allow-literals? + (if allow_literals? (do {! r.monad} [?sample (r.maybe <gen>)] (case ?sample (#.Some sample) (do ! - [else (exhaustive-branches allow-literals? variantTC inputC)] + [else (exhaustive_branches allow_literals? variantTC inputC)] (wrap (list& (<wrapper> sample) else))) #.None @@ -83,9 +83,9 @@ [_ (#.Tuple members)] (do {! r.monad} - [member-wise-patterns (monad.map ! (exhaustive-branches allow-literals? variantTC) members)] - (wrap (|> member-wise-patterns - exhaustive-weaving + [member_wise_patterns (monad.map ! (exhaustive_branches allow_literals? variantTC) members)] + (wrap (|> member_wise_patterns + exhaustive_weaving (list\map code.tuple)))) (^ [_ (#.Record (list))]) @@ -95,19 +95,19 @@ (do {! r.monad} [#let [ks (list\map product.left kvs) vs (list\map product.right kvs)] - member-wise-patterns (monad.map ! (exhaustive-branches allow-literals? variantTC) vs)] - (wrap (|> member-wise-patterns - exhaustive-weaving - (list\map (|>> (list.zip/2 ks) code.record))))) + member_wise_patterns (monad.map ! (exhaustive_branches allow_literals? variantTC) vs)] + (wrap (|> member_wise_patterns + exhaustive_weaving + (list\map (|>> (list.zipped/2 ks) code.record))))) (^ [_ (#.Form (list [_ (#.Tag _)] _))]) (do {! r.monad} [bundles (monad.map ! (function (_ [_tag _code]) (do ! - [v-branches (exhaustive-branches allow-literals? variantTC _code)] + [v_branches (exhaustive_branches allow_literals? variantTC _code)] (wrap (list\map (function (_ pattern) (` ((~ _tag) (~ pattern)))) - v-branches)))) + v_branches)))) variantTC)] (wrap (list\join bundles))) @@ -115,22 +115,22 @@ (r\wrap (list)) )) -(def: #export (input variant-tags record-tags primitivesC) +(def: #export (input variant_tags record_tags primitivesC) (-> (List Code) (List Code) (List Code) (Random Code)) (r.rec (function (_ input) ($_ r.either (r\map product.right _primitive.primitive) (do {! r.monad} - [choice (|> r.nat (\ ! map (n.% (list.size variant-tags)))) - #let [choiceT (maybe.assume (list.nth choice variant-tags)) + [choice (|> r.nat (\ ! map (n.% (list.size variant_tags)))) + #let [choiceT (maybe.assume (list.nth choice variant_tags)) choiceC (maybe.assume (list.nth choice primitivesC))]] (wrap (` ((~ choiceT) (~ choiceC))))) (do {! r.monad} [size (|> r.nat (\ ! map (n.% 3))) elems (r.list size input)] (wrap (code.tuple elems))) - (r\wrap (code.record (list.zip/2 record-tags primitivesC))) + (r\wrap (code.record (list.zipped/2 record_tags primitivesC))) )))) (def: (branch body pattern) @@ -138,71 +138,71 @@ [pattern body]) (def: #export test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) (do {! r.monad} - [module-name (r.unicode 5) - variant-name (r.unicode 5) - record-name (|> (r.unicode 5) (r.only (|>> (text\= variant-name) not))) + [module_name (r.unicode 5) + variant_name (r.unicode 5) + record_name (|> (r.unicode 5) (r.only (|>> (text\= variant_name) not))) size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - variant-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) - record-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) + variant_tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) + record_tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) primitivesTC (r.list size _primitive.primitive) #let [primitivesT (list\map product.left primitivesTC) primitivesC (list\map product.right primitivesTC) - code-tag (|>> [module-name] code.tag) - variant-tags+ (list\map code-tag variant-tags) - record-tags+ (list\map code-tag record-tags) - variantTC (list.zip/2 variant-tags+ primitivesC)] - inputC (input variant-tags+ record-tags+ primitivesC) + code_tag (|>> [module_name] code.tag) + variant_tags+ (list\map code_tag variant_tags) + record_tags+ (list\map code_tag record_tags) + variantTC (list.zipped/2 variant_tags+ primitivesC)] + inputC (input variant_tags+ record_tags+ primitivesC) [outputT outputC] (r.only (|>> product.left (is? Any) not) _primitive.primitive) - #let [analyse-pm (function (_ branches) + #let [analyse_pm (function (_ branches) (|> (/.case _primitive.phase branches archive.empty inputC) - (//type.with-type outputT) - ////analysis.with-scope + (//type.with_type outputT) + ////analysis.with_scope (do phase.monad - [_ (//module.declare-tags variant-tags false - (#.Named [module-name variant-name] + [_ (//module.declare_tags variant_tags false + (#.Named [module_name variant_name] (type.variant primitivesT))) - _ (//module.declare-tags record-tags false - (#.Named [module-name record-name] + _ (//module.declare_tags record_tags false + (#.Named [module_name record_name] (type.tuple primitivesT)))]) - (//module.with-module 0 module-name)))] - exhaustive-patterns (exhaustive-branches true variantTC inputC) - #let [exhaustive-branchesC (list\map (branch outputC) - exhaustive-patterns)]] + (//module.with_module 0 module_name)))] + exhaustive_patterns (exhaustive_branches true variantTC inputC) + #let [exhaustive_branchesC (list\map (branch outputC) + exhaustive_patterns)]] ($_ _.and (_.test "Will reject empty pattern-matching (no branches)." - (|> (analyse-pm (list)) - _structure.check-fails)) + (|> (analyse_pm (list)) + _structure.check_fails)) (_.test "Can analyse exhaustive pattern-matching." - (|> (analyse-pm exhaustive-branchesC) - _structure.check-succeeds)) - (let [non-exhaustive-branchesC (list.take (dec (list.size exhaustive-branchesC)) - exhaustive-branchesC)] + (|> (analyse_pm exhaustive_branchesC) + _structure.check_succeeds)) + (let [non_exhaustive_branchesC (list.take (dec (list.size exhaustive_branchesC)) + exhaustive_branchesC)] (_.test "Will reject non-exhaustive pattern-matching." - (|> (analyse-pm non-exhaustive-branchesC) - _structure.check-fails))) + (|> (analyse_pm non_exhaustive_branchesC) + _structure.check_fails))) (do ! - [redundant-patterns (exhaustive-branches false variantTC inputC) - redundancy-idx (|> r.nat (\ ! map (n.% (list.size redundant-patterns)))) - #let [redundant-branchesC (<| (list!map (branch outputC)) + [redundant_patterns (exhaustive_branches false variantTC inputC) + redundancy_idx (|> r.nat (\ ! map (n.% (list.size redundant_patterns)))) + #let [redundant_branchesC (<| (list!map (branch outputC)) list.concat - (list (list.take redundancy-idx redundant-patterns) - (list (maybe.assume (list.nth redundancy-idx redundant-patterns))) - (list.drop redundancy-idx redundant-patterns)))]] + (list (list.take redundancy_idx redundant_patterns) + (list (maybe.assume (list.nth redundancy_idx redundant_patterns))) + (list.drop redundancy_idx redundant_patterns)))]] (_.test "Will reject redundant pattern-matching." - (|> (analyse-pm redundant-branchesC) - _structure.check-fails))) + (|> (analyse_pm redundant_branchesC) + _structure.check_fails))) (do ! [[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.checks? outputT) not) _primitive.primitive) - heterogeneous-idx (|> r.nat (\ ! map (n.% (list.size exhaustive-patterns)))) - #let [heterogeneous-branchesC (list.concat (list (list.take heterogeneous-idx exhaustive-branchesC) - (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous-idx exhaustive-branchesC))] + heterogeneous_idx (|> r.nat (\ ! map (n.% (list.size exhaustive_patterns)))) + #let [heterogeneous_branchesC (list.concat (list (list.take heterogeneous_idx exhaustive_branchesC) + (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous_idx exhaustive_branchesC))] [_pattern heterogeneousC])) - (list.drop (inc heterogeneous-idx) exhaustive-branchesC)))]] + (list.drop (inc heterogeneous_idx) exhaustive_branchesC)))]] (_.test "Will reject pattern-matching if the bodies of the branches do not all have the same type." - (|> (analyse-pm heterogeneous-branchesC) - _structure.check-fails))) + (|> (analyse_pm heterogeneous_branchesC) + _structure.check_fails))) )))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 3782e861f..c4f35feea 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -140,9 +140,9 @@ (|> (do phase.monad [[_ varT] (//type.with_env check.var) _ (//type.with_env - (check.check varT variantT))] + (check.check varT variantT))] (//type.with_type varT - (/.sum _primitive.phase choice archive.empty valueC))) + (/.sum _primitive.phase choice archive.empty valueC))) (phase.run _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) (check_sum' choice size variant) @@ -153,18 +153,18 @@ (|> (do phase.monad [[_ varT] (//type.with_env check.var)] (//type.with_type varT - (/.sum _primitive.phase choice archive.empty valueC))) + (/.sum _primitive.phase choice archive.empty valueC))) check_fails)) (_.test "Can analyse through existential quantification." (|> (//type.with_type (type.ex_q 1 +variantT) - (/.sum _primitive.phase +choice archive.empty +valueC)) + (/.sum _primitive.phase +choice archive.empty +valueC)) check_succeeds)) (_.test "Can analyse through universal quantification." (let [check_outcome (if (not (n.= choice +choice)) check_succeeds check_fails)] (|> (//type.with_type (type.univ_q 1 +variantT) - (/.sum _primitive.phase +choice archive.empty +valueC)) + (/.sum _primitive.phase +choice archive.empty +valueC)) check_outcome))) )))) @@ -184,7 +184,7 @@ ($_ _.and (_.test "Can analyse." (|> (//type.with_type tupleT - (/.product archive.empty _primitive.phase (list\map product.right primitives))) + (/.product archive.empty _primitive.phase (list\map product.right primitives))) (phase.run _primitive.state) (case> (#try.Success tupleA) (correct_size? size tupleA) @@ -193,7 +193,7 @@ false))) (_.test "Can infer." (|> (//type.with_inference - (/.product archive.empty _primitive.phase (list\map product.right primitives))) + (/.product archive.empty _primitive.phase (list\map product.right primitives))) (phase.run _primitive.state) (case> (#try.Success [_type tupleA]) (and (check.checks? tupleT _type) @@ -203,15 +203,15 @@ false))) (_.test "Can analyse singleton." (|> (//type.with_type singletonT - (_primitive.phase archive.empty (` [(~ singletonC)]))) + (_primitive.phase archive.empty (` [(~ singletonC)]))) check_succeeds)) (_.test "Can analyse through bound type-vars." (|> (do phase.monad [[_ varT] (//type.with_env check.var) _ (//type.with_env - (check.check varT (type.tuple (list\map product.left primitives))))] + (check.check varT (type.tuple (list\map product.left primitives))))] (//type.with_type varT - (/.product archive.empty _primitive.phase (list\map product.right primitives)))) + (/.product archive.empty _primitive.phase (list\map product.right primitives)))) (phase.run _primitive.state) (case> (#try.Success tupleA) (correct_size? size tupleA) @@ -220,11 +220,11 @@ false))) (_.test "Can analyse through existential quantification." (|> (//type.with_type (type.ex_q 1 +tupleT) - (/.product archive.empty _primitive.phase (list\map product.right +primitives))) + (/.product archive.empty _primitive.phase (list\map product.right +primitives))) check_succeeds)) (_.test "Cannot analyse through universal quantification." (|> (//type.with_type (type.univ_q 1 +tupleT) - (/.product archive.empty _primitive.phase (list\map product.right +primitives))) + (/.product archive.empty _primitive.phase (list\map product.right +primitives))) check_fails)) )))) @@ -263,7 +263,7 @@ other_choice))) (_.test "Can specialize." (|> (//type.with_type monoT - (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC)) + (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC)) (check_variant module_name tags monoT (with_name polyT) other_choice))) @@ -287,7 +287,7 @@ primitivesT (list\map product.left primitives) primitivesC (list\map product.right primitives) monoT (#.Named [module_name type_name] (type.tuple primitivesT)) - recordC (list.zip/2 tagsC primitivesC) + recordC (list.zipped/2 tagsC primitivesC) polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 0a7a9d9c5..ae8292476 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -300,14 +300,14 @@ (wrap [(list\fold (function (_ left right) (#synthesis.Alt left right)) (path (inc mid-size) true value/last body/last) - (|> (list.zip/2 value/mid body/mid) + (|> (list.zipped/2 value/mid body/mid) (#.Cons [value/first body/first]) list.enumeration (list\map (function (_ [lefts' [value body]]) (path lefts' false value body))) list.reverse)) [(branch 0 false value/first body/first) - (list\compose (|> (list.zip/2 value/mid body/mid) + (list\compose (|> (list.zipped/2 value/mid body/mid) list.enumeration (list\map (function (_ [lefts' [value body]]) (branch (inc lefts') false value body)))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 841f941db..d07a63f00 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -448,7 +448,7 @@ (!expect (^multi (^ (#try.Success (synthesis.function/apply [funcS argsS]))) (and (//primitive.corresponds? funcA funcS) (list.every? (product.uncurry //primitive.corresponds?) - (list.zip/2 argsA argsS)))))) + (list.zipped/2 argsA argsS)))))) (|> (analysis.apply [funcA (list)]) (//.phase archive.empty) (phase.run [///bundle.empty synthesis.init]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux index 7a652d26c..7908da928 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux @@ -65,7 +65,7 @@ (list.size actual)) (list.every? (function (_ [expected actual]) (corresponds? expected actual)) - (list.zip/2 expected actual))) + (list.zipped/2 expected actual))) _ false))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index a3a476959..af665dd7a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -67,7 +67,7 @@ (case> (^ (#try.Success (////synthesis.tuple membersS))) (and (n.= size (list.size membersS)) (list.every? (product.uncurry //primitive.corresponds?) - (list.zip/2 membersA membersS))) + (list.zipped/2 membersA membersS))) _ false))))) diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 1807046e5..8ced5e3eb 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -121,10 +121,10 @@ ($_ _.and (do random.monad [expected (random.ascii/upper 10)] - (_.cover [/.fail] + (_.cover [/.failure] (case (/.run /.fresh_context (: (/.Check Any) - (/.fail expected))) + (/.failure expected))) (#try.Success _) false (#try.Failure actual) (is? expected actual)))) (do random.monad diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index 859e8ca3f..9e5da1d8a 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -11,7 +11,7 @@ ["." try] ["." exception (#+ Exception)] [concurrency - ["." promise]] + ["." async]] [parser ["<.>" code]]] [data @@ -114,7 +114,7 @@ (_.for [/.Linear /.async /.run_async] (`` ($_ _.and (~~ (template [<coverage> <bindings>] - [(wrap (monad.do promise.monad + [(wrap (monad.do async.monad [outcome (/.run_async (do /.async <bindings> @@ -143,8 +143,8 @@ right (/.read_async res|right) left (/.read_async res|left)]] [[/.lift_async] - [left (/.lift_async (promise.resolved pre)) - right (/.lift_async (promise.resolved post))]] + [left (/.lift_async (async.resolved pre)) + right (/.lift_async (async.resolved post))]] )) ))))) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index ebb9a374d..cb24e89b7 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -9,7 +9,7 @@ ["." try (#+ Try)] ["." exception] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." binary (#+ Binary) ("#\." equivalence)] ["." text ("#\." equivalence) @@ -71,7 +71,7 @@ [directory (random.ascii/alpha 5) #let [[fs watcher] (/.mock "/")]] ($_ _.and - (wrap (do promise.monad + (wrap (do async.monad [?concern (\ watcher concern directory) ?stop (\ watcher stop directory)] (_.cover' [/.not_being_watched] @@ -90,18 +90,18 @@ ))) (def: (no_events_prior_to_creation! fs watcher directory) - (-> (//.System Promise) (/.Watcher Promise) //.Path (Promise (Try Bit))) - (do {! (try.with promise.monad)} + (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit))) + (do {! (try.with async.monad)} [_ (\ fs make_directory directory) _ (\ watcher start /.all directory)] (|> (\ watcher poll []) (\ ! map list.empty?)))) (def: (after_creation! fs watcher expected_path) - (-> (//.System Promise) (/.Watcher Promise) //.Path (Promise (Try Bit))) - (do (try.with promise.monad) - [_ (: (Promise (Try Any)) - (//.make_file promise.monad fs (binary.create 0) expected_path)) + (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit))) + (do (try.with async.monad) + [_ (: (Async (Try Any)) + (//.make_file async.monad fs (binary.create 0) expected_path)) poll/pre (\ watcher poll []) poll/post (\ watcher poll [])] (wrap (and (case poll/pre @@ -116,9 +116,9 @@ (list.empty? poll/post))))) (def: (after_modification! fs watcher data expected_path) - (-> (//.System Promise) (/.Watcher Promise) Binary //.Path (Promise (Try Bit))) - (do (try.with promise.monad) - [_ (promise.delay 1 (#try.Success "Delay to make sure the over_write time-stamp always changes.")) + (-> (//.System Async) (/.Watcher Async) Binary //.Path (Async (Try Bit))) + (do (try.with async.monad) + [_ (async.delay 1 (#try.Success "Delay to make sure the over_write time-stamp always changes.")) _ (\ fs write data expected_path) poll/2 (\ watcher poll []) poll/2' (\ watcher poll [])] @@ -134,8 +134,8 @@ (list.empty? poll/2'))))) (def: (after_deletion! fs watcher expected_path) - (-> (//.System Promise) (/.Watcher Promise) //.Path (Promise (Try Bit))) - (do (try.with promise.monad) + (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit))) + (do (try.with async.monad) [_ (\ fs delete expected_path) poll/3 (\ watcher poll []) poll/3' (\ watcher poll [])] @@ -164,7 +164,7 @@ expected_path (\ ! map (|>> (format directory /)) (random.ascii/alpha 5)) data ($binary.random 10)] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [verdict (do (try.with !) [no_events_prior_to_creation! (..no_events_prior_to_creation! fs watcher directory) @@ -187,7 +187,7 @@ [directory (random.ascii/alpha 5) #let [/ "/" [fs watcher] (/.mock /)]] - (wrap (do promise.monad + (wrap (do async.monad [started? ( \ watcher start /.all directory)] (_.cover' [/.cannot_poll_a_non_existent_directory] (case started? diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index d86683c5f..1cd1473e8 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -9,7 +9,7 @@ ["." exception (#+ exception:)] ["." io (#+ IO)] [concurrency - ["." promise (#+ Promise)]] + ["." async (#+ Async)]] [parser ["." environment (#+ Environment)]]] [data @@ -96,7 +96,7 @@ destruction (random.ascii/alpha 5) exit random.int #let [shell (/.async (..io_shell command oops input destruction exit))]] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [verdict (do (try.with !) [process (\ shell execute [environment.empty "~" command (list)]) read (\ process read []) |