From 17e7566be51df5e428a6b10e6469201a8a9468da Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 7 Aug 2021 02:20:09 -0400 Subject: Made the be/de macros for (co)monadic expression extensible. --- stdlib/source/test/aedifex/cache.lux | 10 +++++----- stdlib/source/test/aedifex/command/auto.lux | 6 +++--- stdlib/source/test/aedifex/command/build.lux | 10 +++++----- stdlib/source/test/aedifex/command/clean.lux | 6 +++--- stdlib/source/test/aedifex/command/deploy.lux | 8 ++++---- stdlib/source/test/aedifex/command/deps.lux | 6 +++--- stdlib/source/test/aedifex/command/install.lux | 10 +++++----- stdlib/source/test/aedifex/command/pom.lux | 6 +++--- stdlib/source/test/aedifex/command/test.lux | 4 ++-- stdlib/source/test/aedifex/command/version.lux | 2 +- stdlib/source/test/aedifex/dependency/deployment.lux | 10 +++++----- stdlib/source/test/aedifex/dependency/resolution.lux | 12 ++++++------ stdlib/source/test/aedifex/input.lux | 4 ++-- stdlib/source/test/aedifex/metadata/artifact.lux | 4 ++-- stdlib/source/test/aedifex/metadata/snapshot.lux | 4 ++-- stdlib/source/test/aedifex/project.lux | 2 +- stdlib/source/test/aedifex/repository/local.lux | 2 +- 17 files changed, 53 insertions(+), 53 deletions(-) (limited to 'stdlib/source/test/aedifex') diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 614420fde..07d39f00f 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -54,7 +54,7 @@ (def: profile (Random [Artifact Profile XML]) (random.one (function (_ profile) - (try.to_maybe + (try.maybe (do try.monad [pom (//pom.write profile) identity (try.of_maybe (get@ #//.identity profile))] @@ -82,7 +82,7 @@ (do {! random.monad} [[main_dependency main_package] ..package dependencies (|> (//package.dependencies main_package) - (\ try.monad map set.to_list) + (\ try.monad map set.list) (try.else (list)) (monad.map ! (function (_ dependency) (do ! @@ -91,7 +91,7 @@ (set@ #//.dependencies (set.empty //dependency.hash)) (set@ #//.identity (#.Some (get@ #//dependency.artifact dependency))) //pom.write - try.to_maybe)) + try.maybe)) ..profile) content ..content] (in [dependency @@ -104,7 +104,7 @@ [[dependency expected_package] ..package home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [fs (: (file.System Async) + .let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad @@ -125,7 +125,7 @@ [expected ..resolution home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [fs (: (file.System Async) + .let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index fd08f541c..a5b598b11 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -68,13 +68,13 @@ (<| (_.covering /._) (do {! random.monad} [end_signal (random.ascii/alpha 5) - #let [/ (\ file.default separator) + .let [/ (\ file.default separator) [fs watcher] (watch.mock /)] program (random.ascii/alpha 5) target (random.ascii/alpha 5) source (random.ascii/alpha 5) - #let [empty_profile (: Profile + .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) (set@ #///.target target)) @@ -99,7 +99,7 @@ [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)] + .let [[@runs command] (..command expected_runs end_signal fs dummy_path)] _ (\ watcher poll [])] (do {! async.monad} [no_dangling_process! (|> profile diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 1a1ff7f60..be7c8b55e 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -109,7 +109,7 @@ (Random Dependency) (do random.monad [lux_version (random.ascii/alpha 5) - #let [js_compiler {#///dependency.artifact {#///artifact.group /.lux_group + .let [js_compiler {#///dependency.artifact {#///artifact.group /.lux_group #///artifact.name /.js_compiler_name #///artifact.version lux_version} #///dependency.type ///artifact/type.js_library}]] @@ -142,13 +142,13 @@ (do {! random.monad} [last_read (random.ascii/alpha 5) last_error (random.ascii/alpha 5) - #let [fs (file.mock (\ file.default separator)) + .let [fs (file.mock (\ file.default separator)) shell (shell.async (..good_shell []))] program (random.ascii/alpha 5) target (random.ascii/alpha 5) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [empty_profile (: Profile + .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) (set@ #///.target target)) @@ -179,7 +179,7 @@ (#try.Failure error) (exception.match? /.no_available_compiler error))))) (do ! - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] [compiler resolution] ..resolution] (in (do async.monad [verdict (do ///action.monad @@ -201,7 +201,7 @@ /.success] (try.else false verdict))))) (do ! - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] [compiler resolution] ..resolution] (in (do async.monad [verdict (do ///action.monad diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 36ed10b8e..523cf6ccc 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -46,7 +46,7 @@ [count (\ ! map (n.% 10) random.nat) names (random.set text.hash count ..node_name) contents (random.list count ($binary.random 100))] - (in (list.zipped/2 (list\map (|>> (format prefix)) (set.to_list names)) + (in (list.zipped/2 (list\map (|>> (format prefix)) (set.list names)) contents)))) (def: (create_file! fs [path content]) @@ -87,7 +87,7 @@ [context ..node_name target ..node_name sub ..node_name - #let [fs (file.mock (\ file.default separator)) + .let [fs (file.mock (\ file.default separator)) / (\ fs separator) target_path (format context / target) sub_path (format target_path / sub)] @@ -96,7 +96,7 @@ dummy @profile.random] (in (do async.monad - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] verdict (do {! (try.with async.monad)} [_ (..create_directory! fs target_path direct_files) _ (..create_directory! fs sub_path sub_files) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index b34584b19..d315c646c 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -54,7 +54,7 @@ Artifact ///.Profile (Async (Try Text))) (do ///action.monad - [#let [console ($version.echo "")] + [.let [console ($version.echo "")] _ ($install.make_sources! fs (get@ #///.sources profile)) _ (/.do! console repository fs artifact profile)] (\ console read_line []))) @@ -73,7 +73,7 @@ home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [repository (///repository.mock $repository.mock + .let [repository (///repository.mock $repository.mock $repository.empty) fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] @@ -82,7 +82,7 @@ [logging (..execute! program repository fs artifact profile) expected_library (|> profile (get@ #///.sources) - set.to_list + set.list (export.library fs) (\ ! map (format.run tar.writer))) @@ -99,7 +99,7 @@ [actual_md5 (\ utf8.codec decode actual_md5)] (\ ///hash.md5_codec decode actual_md5))) - #let [succeeded! + .let [succeeded! (text\= /.success logging) deployed_library! diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 165c859b8..0d816ec02 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -67,7 +67,7 @@ [_ dependee_package] $///package.random [_ depender_package] $///package.random - #let [dependee {#///dependency.artifact dependee_artifact + .let [dependee {#///dependency.artifact dependee_artifact #///dependency.type ///artifact/type.lux_library} depender {#///dependency.artifact depender_artifact #///dependency.type ///artifact/type.lux_library} @@ -97,7 +97,7 @@ program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad [verdict (do ///action.monad - [#let [console (@version.echo "") + [.let [console (@version.echo "") local (///repository/local.repository program fs)] pre (|> ///dependency/resolution.empty (dictionary.put dependee dependee_package) @@ -110,7 +110,7 @@ (function (_ url) (///repository.mock $///dependency/resolution.nope [])))) - #let [had_dependee_before! + .let [had_dependee_before! (set.member? pre dependee_artifact) lacked_depender_before! diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index f68fcb732..ed0a3a7d3 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -44,7 +44,7 @@ (let [/ (\ fs separator) ! ///action.monad] (|> sources - set.to_list + set.list (monad.map ! (function (_ head) (do ! [_ (: (Async (Try Any)) @@ -55,7 +55,7 @@ (def: (execute! program fs sample) (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text))) (do ///action.monad - [#let [console ($version.echo "")] + [.let [console ($version.echo "")] _ (..make_sources! fs (get@ #///.sources sample)) _ (/.do! console fs (///repository/local.repository program fs) sample)] (\ console read_line []))) @@ -69,10 +69,10 @@ $profile.random) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [/ (\ file.default separator)]] + .let [/ (\ file.default separator)]] ($_ _.and (in (do {! async.monad} - [#let [fs (file.mock /) + [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) artifact_path (///local.uri (get@ #///artifact.version identity) identity) @@ -95,7 +95,7 @@ (_.cover' [/.do! /.success] (try.else false verdict)))) (in (do {! async.monad} - [#let [fs (file.mock /) + [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (set@ #///.identity #.None sample))] (_.cover' [/.failure] diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 6578e793f..54a365468 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -35,9 +35,9 @@ (<| (_.covering /._) (do random.monad [sample @profile.random - #let [fs (file.mock (\ file.default separator))]] + .let [fs (file.mock (\ file.default separator))]] (in (do {! async.monad} - [#let [console (@version.echo "")] + [.let [console (@version.echo "")] outcome (/.do! console fs sample)] (case outcome (#try.Success _) @@ -53,7 +53,7 @@ (text\= /.success) (\ console read_line [])) - #let [expected_content! + .let [expected_content! (binary\= expected actual)]] (in (and logging! expected_content!)))] diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index b82a32678..52c167ee9 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -47,7 +47,7 @@ target (random.ascii/alpha 5) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - #let [empty_profile (: Profile + .let [empty_profile (: Profile (\ ///.monoid identity)) with_target (: (-> Profile Profile) (set@ #///.target target)) @@ -81,7 +81,7 @@ console (@version.echo "")] (in (do async.monad [verdict (do ///action.monad - [#let [bad_shell (shell.mock + [.let [bad_shell (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Mock []) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index b501573d7..aaf320c60 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -69,7 +69,7 @@ (do random.monad [profile @profile.random] (in (do async.monad - [#let [console (..echo "")] + [.let [console (..echo "")] verdict (do (try.with async.monad) [_ (/.do! console profile) logging (\ console read_line [])] diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 9c575ff53..8c1e2e61a 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -135,7 +135,7 @@ (Random [Dependency Artifact Package]) (do random.monad [[profile package] $///package.random - #let [artifact (|> profile + .let [artifact (|> profile (get@ #profile.identity) maybe.assume) dependency (: Dependency @@ -152,7 +152,7 @@ ($_ _.and (do {! random.monad} [[dependency expected_artifact package] ..bundle - #let [cache (: Cache + .let [cache (: Cache (atom.atom (dictionary.empty text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] @@ -164,14 +164,14 @@ (try\map (verify_one 1 address package cache expected_artifact)) (try.else false)))))) (do {! random.monad} - [#let [hash (: (Hash [Dependency Artifact Package]) + [.let [hash (: (Hash [Dependency Artifact Package]) (\ hash.functor map (|>> product.right product.left product.left) text.hash))] num_bundles (\ ! map (n.% 10) random.nat) bundles (|> ..bundle (random.set hash num_bundles) - (\ ! map set.to_list)) - #let [resolution (list\fold (function (_ [dependency expected_artifact package] resolution) + (\ ! map set.list)) + .let [resolution (list\fold (function (_ [dependency expected_artifact package] resolution) (dictionary.put dependency package resolution)) resolution.empty bundles) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index fa0391761..89e16691d 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -254,7 +254,7 @@ (\ ///package.equivalence = expected_package) not) $///package.random) - #let [good (..single expected_artifact expected_package) + .let [good (..single expected_artifact expected_package) bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] (`` ($_ _.and @@ -299,12 +299,12 @@ (\ ///package.equivalence = expected_package) not) $///package.random) - #let [good (..single expected_artifact expected_package) + .let [good (..single expected_artifact expected_package) bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] ($_ _.and (in (do async.monad - [#let [console ($///version.echo "")] + [.let [console ($///version.echo "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) (///repository.mock bad_md5 []) @@ -321,7 +321,7 @@ (#try.Failure _) false)))) (in (do async.monad - [#let [console ($///version.echo "")] + [.let [console ($///version.echo "")] actual_package (/.any console (list (///repository.mock bad_sha-1 []) (///repository.mock bad_md5 [])) @@ -358,7 +358,7 @@ [_ depender_package] $///package.random [_ ignored_package] $///package.random - #let [dependee {#///dependency.artifact dependee_artifact + .let [dependee {#///dependency.artifact dependee_artifact #///dependency.type ///artifact/type.lux_library} depender {#///dependency.artifact depender_artifact #///dependency.type ///artifact/type.lux_library} @@ -407,7 +407,7 @@ (..packages [dependee_artifact depender_artifact ignored_artifact])] ($_ _.and (in (do async.monad - [#let [console ($///version.echo "")] + [.let [console ($///version.echo "")] [successes failures resolution] (/.all console (list (///repository.mock (..single dependee_artifact dependee_package) []) (///repository.mock (..single depender_artifact depender_package) []) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index e86efa6dd..4b2ee9ea2 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -46,11 +46,11 @@ (<| (_.covering /._) (do {! random.monad} [expected (\ ! map (set@ #//.parents (list)) $profile.random) - #let [fs (: (file.System Async) + .let [fs (: (file.System Async) (file.mock (\ file.default separator)))]] (in (do async.monad [verdict (do //action.monad - [#let [profile (|> expected + [.let [profile (|> expected //format.profile %.code (\ utf8.codec encode))] diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 0d291d368..95897c212 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -72,7 +72,7 @@ (_.for [/.Metadata]) (do random.monad [expected ..random - #let [artifact {#///artifact.group (get@ #/.group expected) + .let [artifact {#///artifact.group (get@ #/.group expected) #///artifact.name (get@ #/.name expected) #///artifact.version (|> expected (get@ #/.versions) @@ -97,7 +97,7 @@ (do random.monad [home (random.ascii/lower 5) working_directory (random.ascii/lower 5) - #let [program (program.async (program.mock environment.empty home working_directory)) + .let [program (program.async (program.mock environment.empty home working_directory)) fs (file.mock (\ file.default separator)) repository (///repository/local.repository program fs)]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index ff11ff7ab..4dd751639 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -91,7 +91,7 @@ (_.for [/.Metadata]) (do random.monad [expected ..random - #let [artifact (get@ #/.artifact expected)]] + .let [artifact (get@ #/.artifact expected)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) @@ -109,7 +109,7 @@ (do random.monad [home (random.ascii/lower 5) working_directory (random.ascii/lower 5) - #let [program (program.async (program.mock environment.empty home working_directory)) + .let [program (program.async (program.mock environment.empty home working_directory)) fs (file.mock (\ file.default separator)) repository (///repository/local.repository program fs)]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 58ee8c577..809bea253 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -63,7 +63,7 @@ (not (text\= dummy_name name)) (not (text\= sub_name name)))) (random.ascii/alpha 1)) - #let [project ($_ (\ /.monoid compose) + .let [project ($_ (\ /.monoid compose) (/.project super_name super_profile) (/.project dummy_name dummy_profile) (/.project sub_name (set@ #//.parents (list super_name) sub_profile))) diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index eab07411f..a63f4c256 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -30,7 +30,7 @@ [/ (random.ascii/upper 1) home (random.ascii/lower 10) working_directory (random.ascii/lower 10) - #let [fs (file.mock /) + .let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) repo (/.repository program fs)] -- cgit v1.2.3