From 061fd8a209bbcaffc2bfb850ac6046752a567d50 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 27 Jul 2021 03:51:10 -0400 Subject: Re-named wrap => in && unwrap => out. --- stdlib/source/test/aedifex/artifact/snapshot.lux | 2 +- .../aedifex/artifact/snapshot/version/value.lux | 2 +- stdlib/source/test/aedifex/artifact/time.lux | 2 +- stdlib/source/test/aedifex/artifact/time/date.lux | 2 +- stdlib/source/test/aedifex/artifact/type.lux | 10 +- stdlib/source/test/aedifex/cache.lux | 66 ++--- stdlib/source/test/aedifex/cli.lux | 14 +- stdlib/source/test/aedifex/command/auto.lux | 58 ++-- stdlib/source/test/aedifex/command/build.lux | 166 +++++------ stdlib/source/test/aedifex/command/clean.lux | 58 ++-- stdlib/source/test/aedifex/command/deploy.lux | 88 +++--- stdlib/source/test/aedifex/command/deps.lux | 58 ++-- stdlib/source/test/aedifex/command/install.lux | 60 ++-- stdlib/source/test/aedifex/command/pom.lux | 58 ++-- stdlib/source/test/aedifex/command/test.lux | 98 +++---- stdlib/source/test/aedifex/command/version.lux | 30 +- .../source/test/aedifex/dependency/deployment.lux | 60 ++-- .../source/test/aedifex/dependency/resolution.lux | 167 ++++++----- stdlib/source/test/aedifex/dependency/status.lux | 2 +- stdlib/source/test/aedifex/input.lux | 32 +-- stdlib/source/test/aedifex/metadata/artifact.lux | 48 ++-- stdlib/source/test/aedifex/metadata/snapshot.lux | 50 ++-- stdlib/source/test/aedifex/package.lux | 8 +- stdlib/source/test/aedifex/profile.lux | 14 +- stdlib/source/test/aedifex/project.lux | 2 +- stdlib/source/test/aedifex/repository.lux | 8 +- stdlib/source/test/aedifex/repository/local.lux | 22 +- stdlib/source/test/aedifex/runtime.lux | 10 +- stdlib/source/test/lux.lux | 65 +++-- stdlib/source/test/lux/abstract/comonad.lux | 4 +- stdlib/source/test/lux/abstract/comonad/cofree.lux | 2 +- stdlib/source/test/lux/abstract/interval.lux | 6 +- stdlib/source/test/lux/abstract/monad.lux | 16 +- stdlib/source/test/lux/abstract/predicate.lux | 8 +- .../source/test/lux/control/concurrency/actor.lux | 268 +++++++++--------- .../source/test/lux/control/concurrency/async.lux | 216 +++++++------- .../source/test/lux/control/concurrency/atom.lux | 18 +- stdlib/source/test/lux/control/concurrency/frp.lux | 236 ++++++++-------- .../test/lux/control/concurrency/semaphore.lux | 132 ++++----- stdlib/source/test/lux/control/concurrency/stm.lux | 102 +++---- .../source/test/lux/control/concurrency/thread.lux | 34 +-- stdlib/source/test/lux/control/continuation.lux | 10 +- stdlib/source/test/lux/control/exception.lux | 16 +- stdlib/source/test/lux/control/function/memo.lux | 24 +- stdlib/source/test/lux/control/function/mixin.lux | 4 +- stdlib/source/test/lux/control/parser.lux | 16 +- stdlib/source/test/lux/control/parser/analysis.lux | 2 +- stdlib/source/test/lux/control/parser/binary.lux | 24 +- stdlib/source/test/lux/control/parser/code.lux | 4 +- .../source/test/lux/control/parser/environment.lux | 6 +- stdlib/source/test/lux/control/parser/text.lux | 38 +-- stdlib/source/test/lux/control/parser/type.lux | 4 +- stdlib/source/test/lux/control/parser/xml.lux | 18 +- stdlib/source/test/lux/control/reader.lux | 6 +- stdlib/source/test/lux/control/region.lux | 56 ++-- stdlib/source/test/lux/control/remember.lux | 46 +-- .../test/lux/control/security/capability.lux | 10 +- stdlib/source/test/lux/control/security/policy.lux | 3 +- stdlib/source/test/lux/control/state.lux | 8 +- stdlib/source/test/lux/control/thread.lux | 6 +- stdlib/source/test/lux/control/try.lux | 6 +- stdlib/source/test/lux/control/writer.lux | 6 +- stdlib/source/test/lux/data.lux | 2 +- stdlib/source/test/lux/data/binary.lux | 10 +- stdlib/source/test/lux/data/collection/bits.lux | 8 +- .../lux/data/collection/dictionary/ordered.lux | 4 +- .../test/lux/data/collection/dictionary/plist.lux | 2 +- stdlib/source/test/lux/data/collection/list.lux | 14 +- .../test/lux/data/collection/queue/priority.lux | 2 +- stdlib/source/test/lux/data/collection/row.lux | 12 +- .../source/test/lux/data/collection/set/multi.lux | 10 +- .../test/lux/data/collection/set/ordered.lux | 4 +- stdlib/source/test/lux/data/collection/tree.lux | 10 +- .../test/lux/data/collection/tree/zipper.lux | 38 +-- stdlib/source/test/lux/data/format/json.lux | 24 +- stdlib/source/test/lux/data/format/tar.lux | 132 ++++----- stdlib/source/test/lux/data/format/xml.lux | 2 +- stdlib/source/test/lux/data/maybe.lux | 12 +- stdlib/source/test/lux/data/text/encoding.lux | 2 +- stdlib/source/test/lux/data/text/escape.lux | 4 +- stdlib/source/test/lux/data/text/format.lux | 10 +- stdlib/source/test/lux/data/text/regex.lux | 12 +- stdlib/source/test/lux/data/text/unicode/block.lux | 2 +- stdlib/source/test/lux/data/text/unicode/set.lux | 2 +- stdlib/source/test/lux/debug.lux | 116 ++++---- stdlib/source/test/lux/extension.lux | 8 +- stdlib/source/test/lux/locale.lux | 14 +- stdlib/source/test/lux/locale/language.lux | 2 +- stdlib/source/test/lux/locale/territory.lux | 2 +- stdlib/source/test/lux/macro.lux | 92 +++--- stdlib/source/test/lux/macro/code.lux | 16 +- stdlib/source/test/lux/macro/local.lux | 4 +- stdlib/source/test/lux/macro/syntax.lux | 2 +- stdlib/source/test/lux/math/logic/fuzzy.lux | 4 +- stdlib/source/test/lux/math/modular.lux | 14 +- stdlib/source/test/lux/math/modulus.lux | 6 +- stdlib/source/test/lux/math/number/complex.lux | 6 +- stdlib/source/test/lux/math/number/ratio.lux | 2 +- stdlib/source/test/lux/meta.lux | 86 +++--- stdlib/source/test/lux/program.lux | 2 +- stdlib/source/test/lux/target/jvm.lux | 136 ++++----- stdlib/source/test/lux/test.lux | 306 ++++++++++---------- stdlib/source/test/lux/time/day.lux | 14 +- stdlib/source/test/lux/time/month.lux | 4 +- .../compiler/language/lux/phase/analysis/case.lux | 40 +-- .../language/lux/phase/analysis/primitive.lux | 6 +- .../language/lux/phase/analysis/reference.lux | 2 +- .../compiler/language/lux/phase/synthesis/case.lux | 124 ++++---- .../language/lux/phase/synthesis/function.lux | 312 ++++++++++----------- .../compiler/language/lux/phase/synthesis/loop.lux | 156 +++++------ .../language/lux/phase/synthesis/primitive.lux | 6 +- .../language/lux/phase/synthesis/variable.lux | 146 +++++----- .../test/lux/tool/compiler/language/lux/syntax.lux | 2 +- stdlib/source/test/lux/type.lux | 6 +- stdlib/source/test/lux/type/abstract.lux | 2 +- stdlib/source/test/lux/type/check.lux | 60 ++-- stdlib/source/test/lux/type/resource.lux | 22 +- stdlib/source/test/lux/world/console.lux | 22 +- stdlib/source/test/lux/world/file/watch.lux | 146 +++++----- stdlib/source/test/lux/world/input/keyboard.lux | 2 +- stdlib/source/test/lux/world/net/http/client.lux | 2 +- .../test/lux/world/output/video/resolution.lux | 2 +- stdlib/source/test/lux/world/program.lux | 18 +- stdlib/source/test/lux/world/shell.lux | 64 ++--- 124 files changed, 2456 insertions(+), 2453 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux index 5f29620c9..931fefd17 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot.lux @@ -22,7 +22,7 @@ (def: #export random (Random /.Snapshot) - (random.or (random\wrap []) + (random.or (random\in []) $/stamp.random)) (def: #export test diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux index c55b71cd1..cfd8a7f17 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux @@ -32,7 +32,7 @@ (Random /.Value) ($_ random.and (random.ascii/alpha 5) - (random.or (random\wrap []) + (random.or (random\in []) $///stamp.random) )) diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index 8873a7f1d..9ac9be6ae 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -27,7 +27,7 @@ (do random.monad [date /date.random time /time.random] - (wrap [date time]))) + (in [date time]))) (def: #export test Test diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index 35ae3a157..4d44b5358 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -25,7 +25,7 @@ (def: #export random (Random /.Date) (random.one (function (_ raw) - (try.to_maybe + (try.maybe (do try.monad [year (|> raw date.year year.value i.abs (i.% +9,000) (i.+ +1,000) year.year) raw (date.date year diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux index 017e417cb..b34db299c 100644 --- a/stdlib/source/test/aedifex/artifact/type.lux +++ b/stdlib/source/test/aedifex/artifact/type.lux @@ -20,12 +20,12 @@ (Random /.Type) ($_ random.either ($_ random.either - (random\wrap /.lux_library) - (random\wrap /.jvm_library)) + (random\in /.lux_library) + (random\in /.jvm_library)) ($_ random.either - (random\wrap /.pom) - (random\wrap /.md5) - (random\wrap /.sha-1)) + (random\in /.pom) + (random\in /.md5) + (random\in /.sha-1)) )) (def: #export test diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 19fd23203..2a2d3d2e4 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -48,8 +48,8 @@ (def: type (Random Type) ($_ random.either - (random\wrap //artifact/type.lux_library) - (random\wrap //artifact/type.jvm_library))) + (random\in //artifact/type.lux_library) + (random\in //artifact/type.jvm_library))) (def: profile (Random [Artifact Profile XML]) @@ -58,7 +58,7 @@ (do try.monad [pom (//pom.write profile) identity (try.of_maybe (get@ #//.identity profile))] - (wrap [identity profile pom])))) + (in [identity profile pom])))) @profile.random)) (def: content @@ -73,9 +73,9 @@ [[identity profile pom] ..profile type ..type content ..content] - (wrap [{#//dependency.artifact identity - #//dependency.type type} - (set@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))]))) + (in [{#//dependency.artifact identity + #//dependency.type type} + (set@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))]))) (def: resolution (Random Resolution) @@ -94,9 +94,9 @@ try.to_maybe)) ..profile) content ..content] - (wrap [dependency - (set@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))])))))] - (wrap (dictionary.of_list //dependency.hash (list& [main_dependency main_package] dependencies))))) + (in [dependency + (set@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))])))))] + (in (dictionary.of_list //dependency.hash (list& [main_dependency main_package] dependencies))))) (def: singular Test @@ -107,17 +107,17 @@ #let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do async.monad - [wrote! (/.write_one program fs dependency expected_package) - read! (/.read_one program fs dependency)] - (_.cover' [/.write_one /.read_one] - (<| (try.default false) - (do try.monad - [_ wrote! - actual_package read!] - (wrap (\ //package.equivalence = - (set@ #//package.origin (#//repository/origin.Local "") expected_package) - actual_package))))))))) + (in (do async.monad + [wrote! (/.write_one program fs dependency expected_package) + read! (/.read_one program fs dependency)] + (_.cover' [/.write_one /.read_one] + (<| (try.default false) + (do try.monad + [_ wrote! + actual_package read!] + (in (\ //package.equivalence = + (set@ #//package.origin (#//repository/origin.Local "") expected_package) + actual_package))))))))) (def: plural Test @@ -128,19 +128,19 @@ #let [fs (: (file.System Async) (file.mock (\ file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] - (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] - (<| (try.default false) - (do try.monad - [_ wrote! - actual read!] - (wrap (\ //dependency/resolution.equivalence = - (\ dictionary.functor map - (set@ #//package.origin (#//repository/origin.Local "")) - expected) - actual))))))))) + (in (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] + (<| (try.default false) + (do try.monad + [_ wrote! + actual read!] + (in (\ //dependency/resolution.equivalence = + (\ dictionary.functor map + (set@ #//package.origin (#//repository/origin.Local "")) + expected) + actual))))))))) (def: #export test Test diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 6f83f5a11..6c251b0a4 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -22,22 +22,22 @@ (def: compilation (Random /.Compilation) - (random.or (random\wrap []) - (random\wrap []))) + (random.or (random\in []) + (random\in []))) (def: command (Random /.Command) ($_ random.or ## #Version - (random\wrap []) + (random\in []) ## #Clean - (random\wrap []) + (random\in []) ## #POM - (random\wrap []) + (random\in []) ## #Dependencies - (random\wrap []) + (random\in []) ## #Install - (random\wrap []) + (random\in []) ## #Deploy ($_ random.and (random.ascii/alpha 1) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 27b12bc42..e27fd039a 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -55,13 +55,13 @@ (do {! async.monad} [[_ actual_runs] (async.future (atom.update inc @runs))] (if (n.= expected_runs actual_runs) - (wrap (#try.Failure end_signal)) + (in (#try.Failure end_signal)) (do (try.with !) [_ (\ fs write (\ utf8.codec encode (%.nat actual_runs)) dummy_file) _ (\ fs modify (|> actual_runs .int instant.of_millis) dummy_file)] - (wrap [shell.normal []])))))])) + (in [shell.normal []])))))])) (def: #export test Test @@ -95,32 +95,32 @@ ($_ _.and (_.cover [/.delay] (n.> 0 /.delay)) - (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 {! async.monad} - [no_dangling_process! (|> profile - (set@ #///.compiler compiler) - ((/.do! 1 watcher command) - ($version.echo "") - (program.async (program.mock environment.empty home working_directory)) - fs - (shell.async ($build.good_shell [])) - resolution) - (\ ! map (|>> (case> (#try.Failure error) - (is? end_signal error) + (in (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 {! async.monad} + [no_dangling_process! (|> profile + (set@ #///.compiler compiler) + ((/.do! 1 watcher command) + ($version.echo "") + (program.async (program.mock environment.empty home working_directory)) + fs + (shell.async ($build.good_shell [])) + resolution) + (\ ! map (|>> (case> (#try.Failure error) + (is? end_signal error) - (#try.Success _) - false)))) - correct_number_of_runs! (|> @runs - atom.read - async.future - (\ ! map (n.= expected_runs)))] - (wrap (#try.Success (and correct_number_of_runs! - no_dangling_process!)))))] - (_.cover' [/.do!] - (try.default false verdict)))) + (#try.Success _) + false)))) + correct_number_of_runs! (|> @runs + atom.read + async.future + (\ ! map (n.= expected_runs)))] + (in (#try.Success (and correct_number_of_runs! + no_dangling_process!)))))] + (_.cover' [/.do!] + (try.default false verdict)))) )))) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 3bc7f86dc..141573f6f 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -45,9 +45,9 @@ (: (shell.Mock []) (implementation (def: (on_read state) - (exception.throw shell.no_more_output [])) + (exception.except shell.no_more_output [])) (def: (on_error state) - (exception.throw shell.no_more_output [])) + (exception.except shell.no_more_output [])) (def: (on_write input state) (#try.Failure "on_write")) (def: (on_destroy state) @@ -63,9 +63,9 @@ (: (shell.Mock []) (implementation (def: (on_read state) - (exception.throw shell.no_more_output [])) + (exception.except shell.no_more_output [])) (def: (on_error state) - (exception.throw shell.no_more_output [])) + (exception.except shell.no_more_output [])) (def: (on_write input state) (#try.Failure "on_write")) (def: (on_destroy state) @@ -82,13 +82,13 @@ (implementation (def: (on_read state) (if error? - (exception.throw shell.no_more_output []) + (exception.except shell.no_more_output []) (case state (#.Cons head tail) (#try.Success [tail head]) #.Nil - (exception.throw shell.no_more_output [])))) + (exception.except shell.no_more_output [])))) (def: (on_error state) (if error? (case state @@ -96,8 +96,8 @@ (#try.Success [tail head]) #.Nil - (exception.throw shell.no_more_output [])) - (exception.throw shell.no_more_output []))) + (exception.except shell.no_more_output [])) + (exception.except shell.no_more_output []))) (def: (on_write input state) (#try.Failure "on_write")) (def: (on_destroy state) @@ -114,12 +114,12 @@ #///artifact.version lux_version} #///dependency.type ///artifact/type.js_library}]] (`` ($_ random.either - (wrap js_compiler) + (in js_compiler) (~~ (template [] - [(wrap {#///dependency.artifact {#///artifact.group /.lux_group - #///artifact.name - #///artifact.version lux_version} - #///dependency.type ///artifact/type.lux_library})] + [(in {#///dependency.artifact {#///artifact.group /.lux_group + #///artifact.name + #///artifact.version lux_version} + #///dependency.type ///artifact/type.lux_library})] [/.jvm_compiler_name] [/.python_compiler_name] @@ -132,9 +132,9 @@ (do random.monad [dependency ..compiler [_ package] $///package.random] - (wrap [dependency - (|> ///dependency/resolution.empty - (dictionary.put dependency package))]))) + (in [dependency + (|> ///dependency/resolution.empty + (dictionary.put dependency package))]))) (def: #export test Test @@ -159,61 +159,61 @@ with_program with_target)]] ($_ _.and - (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] - (case outcome - (#try.Success _) - false + (in (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] + (case outcome + (#try.Success _) + false - (#try.Failure error) - (exception.match? /.no_specified_program error))))) - (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 - (#try.Success _) - false + (#try.Failure error) + (exception.match? /.no_specified_program error))))) + (in (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 + (#try.Success _) + false - (#try.Failure error) - (exception.match? /.no_available_compiler error))))) + (#try.Failure error) + (exception.match? /.no_available_compiler error))))) (do ! [#let [console (@version.echo "")] [compiler resolution] ..resolution] - (wrap (do async.monad - [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) - fs shell resolution - (set@ #///.compiler compiler profile)) - start (\ console read_line []) - end (\ console read_line [])] - (wrap (and (text\= /.start start) - (text\= /.success end))))] - (_.cover' [/.do! - /.lux_group - /.jvm_compiler_name - /.js_compiler_name - /.python_compiler_name - /.lua_compiler_name - /.ruby_compiler_name - /.start - /.success] - (try.default false verdict))))) + (in (do async.monad + [verdict (do ///action.monad + [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) + fs shell resolution + (set@ #///.compiler compiler profile)) + start (\ console read_line []) + end (\ console read_line [])] + (in (and (text\= /.start start) + (text\= /.success end))))] + (_.cover' [/.do! + /.lux_group + /.jvm_compiler_name + /.js_compiler_name + /.python_compiler_name + /.lua_compiler_name + /.ruby_compiler_name + /.start + /.success] + (try.default false verdict))))) (do ! [#let [console (@version.echo "")] [compiler resolution] ..resolution] - (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 - (set@ #///.compiler compiler profile)) - start (\ console read_line []) - end (\ console read_line [])] - (wrap (and (text\= /.start start) - (text\= /.failure end))))] - (_.cover' [/.failure] - (try.default false verdict))))) + (in (do async.monad + [verdict (do ///action.monad + [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) + fs (shell.async (..bad_shell [])) resolution + (set@ #///.compiler compiler profile)) + start (\ console read_line []) + end (\ console read_line [])] + (in (and (text\= /.start start) + (text\= /.failure end))))] + (_.cover' [/.failure] + (try.default false verdict))))) (do ! [expected/0 (random.ascii/alpha 5) expected/1 (random.ascii/alpha 5) @@ -224,26 +224,26 @@ shell (|> (list expected/0 expected/1 expected/2) (..reader_shell ) shell.async)] - (wrap (do {! async.monad} - [verdict (do ///action.monad - [process (shell [environment.empty working_directory "" (list "")]) - _ ( console process) - actual/0 (\ console read_line []) - actual/1 (\ console read_line []) - actual/2 (\ console read_line []) - end! (|> (\ console read_line []) - (\ ! map (|>> (case> (#try.Failure error) - true - - (#try.Success _) - false) - #try.Success)))] - (wrap (and (text\= expected/0 actual/0) - (text\= expected/1 actual/1) - (text\= expected/2 actual/2) - end!)))] - (_.cover' [] - (try.default false verdict)))))] + (in (do {! async.monad} + [verdict (do ///action.monad + [process (shell [environment.empty working_directory "" (list "")]) + _ ( console process) + actual/0 (\ console read_line []) + actual/1 (\ console read_line []) + actual/2 (\ console read_line []) + end! (|> (\ console read_line []) + (\ ! map (|>> (case> (#try.Failure error) + true + + (#try.Success _) + false) + #try.Success)))] + (in (and (text\= expected/0 actual/0) + (text\= expected/1 actual/1) + (text\= expected/2 actual/2) + end!)))] + (_.cover' [] + (try.default false verdict)))))] [#0 /.log_output!] [#1 /.log_error!] diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 568c6fb76..238fa824b 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -46,8 +46,8 @@ [count (\ ! map (n.% 10) random.nat) names (random.set text.hash count ..node_name) contents (random.list count ($binary.random 100))] - (wrap (list.zipped/2 (list\map (|>> (format prefix)) (set.to_list names)) - contents)))) + (in (list.zipped/2 (list\map (|>> (format prefix)) (set.to_list names)) + contents)))) (def: (create_file! fs [path content]) (-> (file.System Async) [Path Binary] (Async (Try Any))) @@ -59,15 +59,15 @@ [_ (: (Async (Try Any)) (file.make_directories async.monad fs path)) _ (monad.map ! (..create_file! fs) files)] - (wrap []))) + (in []))) (def: (directory_exists? fs) (-> (file.System Async) Path (Async (Try Bit))) - (|>> (\ fs directory?) (try.lift async.monad))) + (|>> (\ fs directory?) (try.lifted async.monad))) (def: (file_exists? fs) (-> (file.System Async) Path (Async (Try Bit))) - (|>> (\ fs file?) (try.lift async.monad))) + (|>> (\ fs file?) (try.lifted async.monad))) (def: (assets_exist? fs directory_path files) (-> (file.System Async) Path (List [Path Binary]) (Async (Try Bit))) @@ -77,8 +77,8 @@ (|> files (list\map product.left) (monad.map ///action.monad (..file_exists? fs))))] - (wrap (and directory_exists? - (list.every? (|>>) files_exist?))))) + (in (and directory_exists? + (list.every? (|>>) files_exist?))))) (def: #export test Test @@ -95,25 +95,25 @@ sub_files (..files (format sub_path /)) dummy @profile.random] - (wrap (do async.monad - [#let [console (@version.echo "")] - 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) - target_exists!/pre (..assets_exist? fs target_path direct_files) - sub_exists!/pre (..assets_exist? fs sub_path sub_files) - _ (/.do! console fs (set@ #///.target target_path dummy)) - context_exists!/post (..directory_exists? fs context) - target_exists!/post (..assets_exist? fs target_path direct_files) - sub_exists!/post (..assets_exist? fs sub_path sub_files) - logging (\ console read_line [])] - (wrap (and (and context_exists!/pre - context_exists!/post) - (and target_exists!/pre - (not target_exists!/post)) - (and sub_exists!/pre - (not sub_exists!/post)) - (text\= (/.success target_path) logging))))] - (_.cover' [/.do! /.success] - (try.default false verdict))))))) + (in (do async.monad + [#let [console (@version.echo "")] + 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) + target_exists!/pre (..assets_exist? fs target_path direct_files) + sub_exists!/pre (..assets_exist? fs sub_path sub_files) + _ (/.do! console fs (set@ #///.target target_path dummy)) + context_exists!/post (..directory_exists? fs context) + target_exists!/post (..assets_exist? fs target_path direct_files) + sub_exists!/post (..assets_exist? fs sub_path sub_files) + logging (\ console read_line [])] + (in (and (and context_exists!/pre + context_exists!/post) + (and target_exists!/pre + (not target_exists!/post)) + (and sub_exists!/pre + (not sub_exists!/post)) + (text\= (/.success target_path) logging))))] + (_.cover' [/.do! /.success] + (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index e2f7cfa4a..41a997d6f 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -67,8 +67,8 @@ (random.one (function (_ profile) (do maybe.monad [artifact (get@ #///.identity profile) - expected_pom (try.to_maybe (///pom.write profile))] - (wrap [artifact expected_pom profile]))) + expected_pom (try.maybe (///pom.write profile))] + (in [artifact expected_pom profile]))) $profile.random) home (random.ascii/alpha 5) @@ -77,52 +77,52 @@ $repository.empty) fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do {! async.monad} - [verdict (do {! ///action.monad} - [logging (..execute! program repository fs artifact profile) - expected_library (|> profile - (get@ #///.sources) - set.to_list - (export.library fs) - (\ ! map (format.run tar.writer))) + (in (do {! async.monad} + [verdict (do {! ///action.monad} + [logging (..execute! program repository fs artifact profile) + expected_library (|> profile + (get@ #///.sources) + set.to_list + (export.library fs) + (\ ! map (format.run tar.writer))) - 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 (\ 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 (\ async.monad wrap + 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 (\ async.monad in (do try.monad - [actual_md5 (\ utf8.codec decode actual_md5)] - (\ ///hash.md5_codec decode actual_md5))) + [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 (\ async.monad in + (do try.monad + [actual_md5 (\ utf8.codec decode actual_md5)] + (\ ///hash.md5_codec decode actual_md5))) - #let [succeeded! - (text\= /.success logging) + #let [succeeded! + (text\= /.success logging) - deployed_library! - (binary\= expected_library - actual_library) + deployed_library! + (binary\= expected_library + actual_library) - deployed_pom! - (binary\= (|> expected_pom (\ xml.codec encode) (\ utf8.codec encode)) - actual_pom) + deployed_pom! + (binary\= (|> expected_pom (\ xml.codec encode) (\ utf8.codec encode)) + actual_pom) - deployed_sha-1! - (\ ///hash.equivalence = - (///hash.sha-1 expected_library) - actual_sha-1) + deployed_sha-1! + (\ ///hash.equivalence = + (///hash.sha-1 expected_library) + actual_sha-1) - deployed_md5! - (\ ///hash.equivalence = - (///hash.md5 expected_library) - actual_md5)]] - (wrap (and succeeded! - deployed_library! - deployed_pom! - deployed_sha-1! - deployed_md5!)))] - (_.cover' [/.do! /.success] - (try.default false verdict))))))) + deployed_md5! + (\ ///hash.equivalence = + (///hash.md5 expected_library) + actual_md5)]] + (in (and succeeded! + deployed_library! + deployed_pom! + deployed_sha-1! + deployed_md5!)))] + (_.cover' [/.do! /.success] + (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 1a54ae89d..c00c88078 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -95,36 +95,36 @@ fs (file.mock (\ file.default separator)) program (program.async (program.mock environment.empty home working_directory))]] - (wrap (do async.monad - [verdict (do ///action.monad - [#let [console (@version.echo "") - local (///repository/local.repository program fs)] - pre (|> ///dependency/resolution.empty - (dictionary.put dependee dependee_package) - (///dependency/deployment.all local)) - post (|> (\ ///.monoid identity) - (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee depender))) - (/.do! console local - (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) - [])) - (function (_ url) - (///repository.mock $///dependency/resolution.nope [])))) + (in (do async.monad + [verdict (do ///action.monad + [#let [console (@version.echo "") + local (///repository/local.repository program fs)] + pre (|> ///dependency/resolution.empty + (dictionary.put dependee dependee_package) + (///dependency/deployment.all local)) + post (|> (\ ///.monoid identity) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee depender))) + (/.do! console local + (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) + [])) + (function (_ url) + (///repository.mock $///dependency/resolution.nope [])))) - #let [had_dependee_before! - (set.member? pre dependee_artifact) + #let [had_dependee_before! + (set.member? pre dependee_artifact) - lacked_depender_before! - (not (set.member? pre depender_artifact)) + lacked_depender_before! + (not (set.member? pre depender_artifact)) - had_dependee_after! - (dictionary.key? post dependee) + had_dependee_after! + (dictionary.key? post dependee) + + had_depender_after! + (dictionary.key? post depender)]] + (in (and had_dependee_before! + lacked_depender_before! - had_depender_after! - (dictionary.key? post depender)]] - (wrap (and had_dependee_before! - lacked_depender_before! - - had_dependee_after! - had_depender_after!)))] - (_.cover' [/.do!] - (try.default false verdict))))))) + had_dependee_after! + had_depender_after!)))] + (_.cover' [/.do!] + (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 3ba225206..a9de141ff 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -71,35 +71,35 @@ working_directory (random.ascii/alpha 5) #let [/ (\ file.default separator)]] ($_ _.and - (wrap (do {! async.monad} - [#let [fs (file.mock /) - program (program.async (program.mock environment.empty home working_directory)) + (in (do {! async.monad} + [#let [fs (file.mock /) + program (program.async (program.mock environment.empty home working_directory)) - artifact_path (///local.uri (get@ #///artifact.version identity) identity) - library_path (format artifact_path ///artifact/extension.lux_library) - pom_path (format artifact_path ///artifact/extension.pom)] - verdict (do {! ///action.monad} - [succeeded! (\ ! map (text\= /.success) - (..execute! program fs sample)) - library_exists! (|> library_path - (format home /) - (\ fs file?) - (\ async.monad map exception.return)) - pom_exists! (|> pom_path - (format home /) - (\ fs file?) - (\ async.monad map exception.return))] - (wrap (and succeeded! - library_exists! - pom_exists!)))] - (_.cover' [/.do! /.success] - (try.default false verdict)))) - (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))] - (_.cover' [/.failure] - (|> logging - (try\map (text\= /.failure)) - (try.default false))))) + artifact_path (///local.uri (get@ #///artifact.version identity) identity) + library_path (format artifact_path ///artifact/extension.lux_library) + pom_path (format artifact_path ///artifact/extension.pom)] + verdict (do {! ///action.monad} + [succeeded! (\ ! map (text\= /.success) + (..execute! program fs sample)) + library_exists! (|> library_path + (format home /) + (\ fs file?) + (\ async.monad map exception.return)) + pom_exists! (|> pom_path + (format home /) + (\ fs file?) + (\ async.monad map exception.return))] + (in (and succeeded! + library_exists! + pom_exists!)))] + (_.cover' [/.do! /.success] + (try.default false verdict)))) + (in (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))] + (_.cover' [/.failure] + (|> logging + (try\map (text\= /.failure)) + (try.default false))))) )))) diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 4ee1c49f4..ebc0ae09e 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -36,35 +36,35 @@ (do random.monad [sample @profile.random #let [fs (file.mock (\ file.default separator))]] - (wrap (do {! async.monad} - [#let [console (@version.echo "")] - outcome (/.do! console fs sample)] - (case outcome - (#try.Success _) - (do ! - [verdict (do ///action.monad - [expected (|> (///pom.write sample) - (try\map (|>> (\ xml.codec encode) - (\ utf8.codec encode))) - (\ ! wrap)) - actual (\ fs read ///pom.file) + (in (do {! async.monad} + [#let [console (@version.echo "")] + outcome (/.do! console fs sample)] + (case outcome + (#try.Success _) + (do ! + [verdict (do ///action.monad + [expected (|> (///pom.write sample) + (try\map (|>> (\ xml.codec encode) + (\ utf8.codec encode))) + (\ ! in)) + actual (\ fs read ///pom.file) - logging! (\ ///action.monad map - (text\= /.success) - (\ console read_line [])) + logging! (\ ///action.monad map + (text\= /.success) + (\ console read_line [])) - #let [expected_content! - (binary\= expected actual)]] - (wrap (and logging! - expected_content!)))] - (_.cover' [/.do! /.success] - (try.default false verdict))) - - (#try.Failure error) - (_.cover' [/.do!] - (case (get@ #///.identity sample) - (#.Some _) - false + #let [expected_content! + (binary\= expected actual)]] + (in (and logging! + expected_content!)))] + (_.cover' [/.do! /.success] + (try.default false verdict))) + + (#try.Failure error) + (_.cover' [/.do!] + (case (get@ #///.identity sample) + (#.Some _) + false - #.None - true)))))))) + #.None + true)))))))) diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index 5882992a9..93c6642f7 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -61,55 +61,55 @@ ($_ _.and (let [fs (file.mock (\ file.default separator)) console (@version.echo "")] - (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 - (set@ #///.compiler compiler profile)) - build_start (\ console read_line []) - build_end (\ console read_line []) - test_start (\ console read_line []) - test_end (\ console read_line [])] - (wrap (and (and (text\= //build.start build_start) - (text\= //build.success build_end)) - (and (text\= /.start test_start) - (text\= /.success test_end)))))] - (_.cover' [/.do! - /.start /.success] - (try.default false verdict))))) + (in (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 + (set@ #///.compiler compiler profile)) + build_start (\ console read_line []) + build_end (\ console read_line []) + test_start (\ console read_line []) + test_end (\ console read_line [])] + (in (and (and (text\= //build.start build_start) + (text\= //build.success build_end)) + (and (text\= /.start test_start) + (text\= /.success test_end)))))] + (_.cover' [/.do! + /.start /.success] + (try.default false verdict))))) (let [fs (file.mock (\ file.default separator)) console (@version.echo "")] - (wrap (do async.monad - [verdict (do ///action.monad - [#let [bad_shell (shell.mock - (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) - (#try.Success - (: (shell.Mock []) - (implementation - (def: (on_read state) - (exception.throw shell.no_more_output [])) - (def: (on_error state) - (exception.throw shell.no_more_output [])) - (def: (on_write input state) - (#try.Failure "on_write")) - (def: (on_destroy state) - (#try.Failure "on_destroy")) - (def: (on_await state) - (#try.Success [state (if (list.any? (text\= "build") actual_arguments) - shell.normal - shell.error)])))))) - [])] - _ (/.do! console (program.async (program.mock environment.empty home working_directory)) - fs (shell.async bad_shell) resolution - (set@ #///.compiler compiler profile)) - build_start (\ console read_line []) - build_end (\ console read_line []) - test_start (\ console read_line []) - test_end (\ console read_line [])] - (wrap (and (and (text\= //build.start build_start) - (text\= //build.success build_end)) - (and (text\= /.start test_start) - (text\= /.failure test_end)))))] - (_.cover' [/.failure] - (try.default false verdict))))) + (in (do async.monad + [verdict (do ///action.monad + [#let [bad_shell (shell.mock + (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) + (#try.Success + (: (shell.Mock []) + (implementation + (def: (on_read state) + (exception.except shell.no_more_output [])) + (def: (on_error state) + (exception.except shell.no_more_output [])) + (def: (on_write input state) + (#try.Failure "on_write")) + (def: (on_destroy state) + (#try.Failure "on_destroy")) + (def: (on_await state) + (#try.Success [state (if (list.any? (text\= "build") actual_arguments) + shell.normal + shell.error)])))))) + [])] + _ (/.do! console (program.async (program.mock environment.empty home working_directory)) + fs (shell.async bad_shell) resolution + (set@ #///.compiler compiler profile)) + build_start (\ console read_line []) + build_end (\ console read_line []) + test_start (\ console read_line []) + test_end (\ console read_line [])] + (in (and (and (text\= //build.start build_start) + (text\= //build.success build_end)) + (and (text\= /.start test_start) + (text\= /.failure test_end)))))] + (_.cover' [/.failure] + (try.default false verdict))))) )))) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 739a02fef..30c7d3f80 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -39,23 +39,23 @@ (do maybe.monad [head (text.nth 0 state) [_ tail] (text.split 1 state)] - (wrap [[open? tail] head]))) - (exception.throw ..console_is_closed! []))) + (in [[open? tail] head]))) + (exception.except ..console_is_closed! []))) (def: (on_read_line [open? state]) (if open? (try.of_maybe (do maybe.monad [[output state] (text.split_with text.new_line state)] - (wrap [[open? state] output]))) - (exception.throw ..console_is_closed! []))) + (in [[open? state] output]))) + (exception.except ..console_is_closed! []))) (def: (on_write input [open? state]) (if open? (#try.Success [open? (format state input)]) - (exception.throw ..console_is_closed! []))) + (exception.except ..console_is_closed! []))) (def: (on_close [open? buffer]) (if open? (#try.Success [false buffer]) - (exception.throw ..console_is_closed! [])))) + (exception.except ..console_is_closed! [])))) (def: #export echo (-> Text (Console Async)) @@ -68,12 +68,12 @@ (<| (_.covering /._) (do random.monad [profile @profile.random] - (wrap (do async.monad - [#let [console (..echo "")] - verdict (do (try.with async.monad) - [_ (/.do! console profile) - logging (\ console read_line [])] - (wrap (text\= (version.format language/lux.version) - logging)))] - (_.cover' [/.do!] - (try.default false verdict))))))) + (in (do async.monad + [#let [console (..echo "")] + verdict (do (try.with async.monad) + [_ (/.do! console profile) + logging (\ console read_line [])] + (in (text\= (version.format language/lux.version) + logging)))] + (_.cover' [/.do!] + (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 218bbaf07..3688e56aa 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -72,8 +72,8 @@ (atom.update (dictionary.put url input) cache) _ - (wrap [])))] - (wrap (#try.Success ..good_upload)))))) + (in [])))] + (in (#try.Success ..good_upload)))))) (def: (verify_one expected_deployments address package cache expected_artifact actual_artifact) (-> Nat URL Package (Dictionary URL Binary) Artifact Artifact Bit) @@ -141,7 +141,7 @@ dependency (: Dependency [artifact artifact/type.lux_library])]] - (wrap [dependency artifact package]))) + (in [dependency artifact package]))) (def: #export test Test @@ -156,13 +156,13 @@ (atom.atom (dictionary.new text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] - (wrap (do async.monad - [?outcome (/.one repository dependency package) - cache (async.future (atom.read cache))] - (_.cover' [/.one] - (|> ?outcome - (try\map (verify_one 1 address package cache expected_artifact)) - (try.default false)))))) + (in (do async.monad + [?outcome (/.one repository dependency package) + cache (async.future (atom.read cache))] + (_.cover' [/.one] + (|> ?outcome + (try\map (verify_one 1 address package cache expected_artifact)) + (try.default false)))))) (do {! random.monad} [#let [hash (: (Hash [Dependency Artifact Package]) (\ hash.functor map (|>> product.right product.left product.left) @@ -179,26 +179,26 @@ (atom.atom (dictionary.new text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] - (wrap (do async.monad - [?outcome (/.all repository resolution) - cache (async.future (atom.read cache))] - (_.cover' [/.all] - (|> ?outcome - (try\map (function (_ actual_artifacts) - (let [expected_deployments! - (n.= num_bundles (set.size actual_artifacts)) + (in (do async.monad + [?outcome (/.all repository resolution) + cache (async.future (atom.read cache))] + (_.cover' [/.all] + (|> ?outcome + (try\map (function (_ actual_artifacts) + (let [expected_deployments! + (n.= num_bundles (set.size actual_artifacts)) - every_deployment_was_correct! - (list.every? (function (_ [dependency expected_artifact package]) - (let [deployed! - (set.member? actual_artifacts expected_artifact) + every_deployment_was_correct! + (list.every? (function (_ [dependency expected_artifact package]) + (let [deployed! + (set.member? actual_artifacts expected_artifact) - deployed_correctly! - (verify_one num_bundles address package cache expected_artifact expected_artifact)] - (and deployed! - deployed_correctly!))) - bundles)] - (and expected_deployments! - every_deployment_was_correct!)))) - (try.default false)))))) + deployed_correctly! + (verify_one num_bundles address package cache expected_artifact expected_artifact)] + (and deployed! + deployed_correctly!))) + bundles)] + (and expected_deployments! + every_deployment_was_correct!)))) + (try.default false)))))) )))) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index ea468f851..fa0391761 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -53,10 +53,10 @@ (do {! random.monad} [artifact $///artifact.random [_ package] $///package.random] - (wrap (dictionary.put {#///dependency.artifact artifact - #///dependency.type ///artifact/type.lux_library} - package - /.empty)))) + (in (dictionary.put {#///dependency.artifact artifact + #///dependency.type ///artifact/type.lux_library} + package + /.empty)))) (def: lux_sha-1 Text @@ -258,33 +258,31 @@ bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] (`` ($_ _.and - (wrap - (do async.monad - [actual_package (/.one (///repository.mock good []) - {#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library})] - (_.cover' [/.one] - (case actual_package - (#try.Success actual_package) - (\ ///package.equivalence = - (set@ #///package.origin (#///repository/origin.Remote "") expected_package) - actual_package) - - (#try.Failure _) - false)))) + (in (do async.monad + [actual_package (/.one (///repository.mock good []) + {#///dependency.artifact expected_artifact + #///dependency.type ///artifact/type.lux_library})] + (_.cover' [/.one] + (case actual_package + (#try.Success actual_package) + (\ ///package.equivalence = + (set@ #///package.origin (#///repository/origin.Remote "") expected_package) + actual_package) + + (#try.Failure _) + false)))) (~~ (template [ ] - [(wrap - (do async.monad - [actual_package (/.one (///repository.mock []) - {#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library})] - (_.cover' [] - (case actual_package - (#try.Failure error) - (exception.match? error) - - (#try.Success _) - false))))] + [(in (do async.monad + [actual_package (/.one (///repository.mock []) + {#///dependency.artifact expected_artifact + #///dependency.type ///artifact/type.lux_library})] + (_.cover' [] + (case actual_package + (#try.Failure error) + (exception.match? error) + + (#try.Success _) + false))))] [/.sha-1_does_not_match bad_sha-1] [/.md5_does_not_match bad_md5] @@ -305,39 +303,37 @@ bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] ($_ _.and - (wrap - (do async.monad - [#let [console ($///version.echo "")] - actual_package (/.any console - (list (///repository.mock bad_sha-1 []) - (///repository.mock bad_md5 []) - (///repository.mock good [])) - {#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library})] - (_.cover' [/.any] - (case actual_package - (#try.Success actual_package) - (\ ///package.equivalence = - (set@ #///package.origin (#///repository/origin.Remote "") expected_package) - actual_package) - - (#try.Failure _) - false)))) - (wrap - (do async.monad - [#let [console ($///version.echo "")] - actual_package (/.any console - (list (///repository.mock bad_sha-1 []) - (///repository.mock bad_md5 [])) - {#///dependency.artifact expected_artifact - #///dependency.type ///artifact/type.lux_library})] - (_.cover' [/.cannot_resolve] - (case actual_package - (#try.Failure error) - (exception.match? /.cannot_resolve error) - - (#try.Success _) - false)))) + (in (do async.monad + [#let [console ($///version.echo "")] + actual_package (/.any console + (list (///repository.mock bad_sha-1 []) + (///repository.mock bad_md5 []) + (///repository.mock good [])) + {#///dependency.artifact expected_artifact + #///dependency.type ///artifact/type.lux_library})] + (_.cover' [/.any] + (case actual_package + (#try.Success actual_package) + (\ ///package.equivalence = + (set@ #///package.origin (#///repository/origin.Remote "") expected_package) + actual_package) + + (#try.Failure _) + false)))) + (in (do async.monad + [#let [console ($///version.echo "")] + actual_package (/.any console + (list (///repository.mock bad_sha-1 []) + (///repository.mock bad_md5 [])) + {#///dependency.artifact expected_artifact + #///dependency.type ///artifact/type.lux_library})] + (_.cover' [/.cannot_resolve] + (case actual_package + (#try.Failure error) + (exception.match? /.cannot_resolve error) + + (#try.Success _) + false)))) ))) (def: artifacts @@ -351,7 +347,7 @@ (predicate.unite (\ ///artifact.equivalence = dependee_artifact) (\ ///artifact.equivalence = depender_artifact))) $///artifact.random)] - (wrap [dependee_artifact depender_artifact ignored_artifact]))) + (in [dependee_artifact depender_artifact ignored_artifact]))) (def: (packages [dependee_artifact depender_artifact ignored_artifact]) (-> [Artifact Artifact Artifact] @@ -398,8 +394,8 @@ (|> ignored_pom (\ xml.codec encode) (\ utf8.codec encode)) #///dependency/status.Unverified] ignored_package)]] - (wrap [[dependee depender ignored] - [dependee_package depender_package ignored_package]]))) + (in [[dependee depender ignored] + [dependee_package depender_package ignored_package]]))) (def: all Test @@ -410,26 +406,25 @@ [dependee_package depender_package ignored_package]] (..packages [dependee_artifact depender_artifact ignored_artifact])] ($_ _.and - (wrap - (do async.monad - [#let [console ($///version.echo "")] - [successes failures resolution] (/.all console - (list (///repository.mock (..single dependee_artifact dependee_package) []) - (///repository.mock (..single depender_artifact depender_package) []) - (///repository.mock (..single ignored_artifact ignored_package) [])) - (function (_ url) - (///repository.mock ..nope [])) - (list depender) - /.empty)] - (_.cover' [/.all] - (and (dictionary.key? resolution depender) - (list.any? (///dependency\= depender) successes) - - (dictionary.key? resolution dependee) - (list.any? (///dependency\= dependee) successes) - - (list.empty? failures) - (not (dictionary.key? resolution ignored)))))) + (in (do async.monad + [#let [console ($///version.echo "")] + [successes failures resolution] (/.all console + (list (///repository.mock (..single dependee_artifact dependee_package) []) + (///repository.mock (..single depender_artifact depender_package) []) + (///repository.mock (..single ignored_artifact ignored_package) [])) + (function (_ url) + (///repository.mock ..nope [])) + (list depender) + /.empty)] + (_.cover' [/.all] + (and (dictionary.key? resolution depender) + (list.any? (///dependency\= depender) successes) + + (dictionary.key? resolution dependee) + (list.any? (///dependency\= dependee) successes) + + (list.empty? failures) + (not (dictionary.key? resolution ignored)))))) ))) (def: #export test diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux index 64bb2f642..5b446d643 100644 --- a/stdlib/source/test/aedifex/dependency/status.lux +++ b/stdlib/source/test/aedifex/dependency/status.lux @@ -21,7 +21,7 @@ (def: #export random (Random /.Status) ($_ random.or - (random\wrap []) + (random\in []) (random.or ($///hash.random ///hash.sha-1) ($///hash.random ///hash.md5)) (random.and ($///hash.random ///hash.sha-1) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index e7f02569f..0cea854c4 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -48,19 +48,19 @@ [expected (\ ! map (set@ #//.parents (list)) $profile.random) #let [fs (: (file.System Async) (file.mock (\ file.default separator)))]] - (wrap (do async.monad - [verdict (do //action.monad - [#let [profile (|> expected - //format.profile - %.code - (\ utf8.codec encode))] - _ (\ fs write profile //project.file) - actual (: (Async (Try Profile)) - (/.read async.monad fs //.default))] - (wrap (\ //.equivalence = - (|> expected - (update@ #//.sources ..with_default_source) - (update@ #//.repositories ..with_default_repository)) - actual)))] - (_.cover' [/.read] - (try.default false verdict))))))) + (in (do async.monad + [verdict (do //action.monad + [#let [profile (|> expected + //format.profile + %.code + (\ utf8.codec encode))] + _ (\ fs write profile //project.file) + actual (: (Async (Try Profile)) + (/.read async.monad fs //.default))] + (in (\ //.equivalence = + (|> expected + (update@ #//.sources ..with_default_source) + (update@ #//.repositories ..with_default_repository)) + actual)))] + (_.cover' [/.read] + (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 6a2106ad3..acd0575a0 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -54,17 +54,17 @@ hour (\ ! map (n.% 24) random.nat) minute (\ ! map (n.% 60) random.nat) second (\ ! map (n.% 60) random.nat)] - (wrap (try.assumed - (do try.monad - [year (year.year year) - month (month.by_number month) - date (date.date year month day_of_month) - time (time.time - {#time.hour hour - #time.minute minute - #time.second second - #time.milli_second 0})] - (wrap (instant.of_date_time date time)))))))) + (in (try.assumed + (do try.monad + [year (year.year year) + month (month.by_number month) + date (date.date year month day_of_month) + time (time.time + {#time.hour hour + #time.minute minute + #time.second second + #time.milli_second 0})] + (in (instant.of_date_time date time)))))))) (def: #export test Test @@ -100,17 +100,17 @@ #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 async.monad - [wrote? (/.write repository artifact expected) - actual (/.read repository artifact)] - (_.cover' [/.write /.read] - (and (case wrote? - (#try.Success _) true - (#try.Failure _) false) - (case actual - (#try.Success actual) - (\ /.equivalence = expected actual) - - (#try.Failure _) - false)))))) + (in (do async.monad + [wrote? (/.write repository artifact expected) + actual (/.read repository artifact)] + (_.cover' [/.write /.read] + (and (case wrote? + (#try.Success _) true + (#try.Failure _) false) + (case actual + (#try.Success actual) + (\ /.equivalence = expected actual) + + (#try.Failure _) + false)))))) )))) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index ea0a26a5a..c9787d8bb 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -58,22 +58,22 @@ hour (\ ! map (n.% 24) random.nat) minute (\ ! map (n.% 60) random.nat) second (\ ! map (n.% 60) random.nat)] - (wrap (try.assumed - (do try.monad - [year (year.year year) - month (month.by_number month) - date (date.date year month day_of_month) - time (time.time - {#time.hour hour - #time.minute minute - #time.second second - #time.milli_second 0})] - (wrap (instant.of_date_time date time))))))) + (in (try.assumed + (do try.monad + [year (year.year year) + month (month.by_number month) + date (date.date year month day_of_month) + time (time.time + {#time.hour hour + #time.minute minute + #time.second second + #time.milli_second 0})] + (in (instant.of_date_time date time))))))) (def: random_versioning (Random Versioning) ($_ random.and - (random\wrap #///snapshot.Local) + (random\in #///snapshot.Local) $///artifact/time.random (random.list 5 $///artifact/snapshot/version.random) )) @@ -112,17 +112,17 @@ #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 async.monad - [wrote? (/.write repository artifact expected) - actual (/.read repository artifact)] - (_.cover' [/.write /.read] - (and (case wrote? - (#try.Success _) true - (#try.Failure _) false) - (case actual - (#try.Success actual) - (\ /.equivalence = expected actual) - - (#try.Failure _) - false)))))) + (in (do async.monad + [wrote? (/.write repository artifact expected) + actual (/.read repository artifact)] + (_.cover' [/.write /.read] + (and (case wrote? + (#try.Success _) true + (#try.Failure _) false) + (case actual + (#try.Success actual) + (\ /.equivalence = expected actual) + + (#try.Failure _) + false)))))) )))) diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index 61201456a..8896b731d 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -46,12 +46,12 @@ [content_size (\ ! map (n.% 100) random.nat) content ($binary.random content_size) [profile pom] (random.one (function (_ profile) - (try.to_maybe + (try.maybe (do try.monad [pom (//pom.write profile)] - (wrap [profile pom])))) + (in [profile pom])))) $profile.random)] - (wrap [profile (/.local pom content)]))) + (in [profile (/.local pom content)]))) (def: #export test Test @@ -94,7 +94,7 @@ (|> (do try.monad [xml_pom (\ utf8.codec decode binary_pom) decoded_pom (\ xml.codec decode xml_pom)] - (wrap (\ xml.equivalence = actual_pom decoded_pom))) + (in (\ xml.equivalence = actual_pom decoded_pom))) (try.default false)) (case pom_status (#//status.Verified actual_sha1 expected_md5) diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index f29ae7087..755c0e13a 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -36,8 +36,8 @@ (def: distribution (Random /.Distribution) - (random.or (random\wrap []) - (random\wrap []))) + (random.or (random\in []) + (random\in []))) (def: license (Random /.License) @@ -131,11 +131,11 @@ (random.maybe (random.ascii/alpha 1)) (random.maybe (random.ascii/alpha 1)) (..dictionary_of text.hash (random.ascii/alpha 1) ..repository) - (random\wrap //runtime.default_java) - (random\wrap //runtime.default_js) - (random\wrap //runtime.default_python) - (random\wrap //runtime.default_lua) - (random\wrap //runtime.default_ruby) + (random\in //runtime.default_java) + (random\in //runtime.default_js) + (random\in //runtime.default_python) + (random\in //runtime.default_lua) + (random\in //runtime.default_ruby) )) (def: #export test diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index d76d4afb3..4df06a337 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -34,7 +34,7 @@ (Random /.Project) (do random.monad [[name profile] ..profile] - (wrap (/.project name profile)))) + (in (/.project name profile)))) (def: #export test Test diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 67cc4c10f..a926db9a7 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -74,14 +74,14 @@ (case (dictionary.get uri state) (#.Some content) (case (binary.size content) - 0 (exception.throw ..not_found [uri]) + 0 (exception.except ..not_found [uri]) _ (exception.return [state content])) #.None - (exception.throw ..not_found [uri]))) + (exception.except ..not_found [uri]))) (def: (on_upload uri content state) (if (dictionary.key? state uri) - (exception.throw ..cannot_upload [uri]) + (exception.except ..cannot_upload [uri]) (exception.return (dictionary.put uri content state))))) (def: #export test @@ -90,7 +90,7 @@ ($_ _.and (_.for [/.mock /.Mock] (do random.monad - [_ (wrap [])] + [_ (in [])] ($/.spec (..artifact ..valid_version) (..artifact ..invalid_version) (/.mock ..mock diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index a40924dea..180ea404a 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -38,15 +38,15 @@ expected (\ ! map (\ utf8.codec encode) (random.ascii/lower 10))] ($_ _.and - (wrap (do async.monad - [before_upload (\ repo download uri) - _ (\ repo upload uri expected) - actual (\ repo download uri)] - (_.cover' [/.repository] - (and (case before_upload - (#try.Success _) false - (#try.Failure _) true) - (|> actual - (try\map (binary\= expected)) - (try.default false)))))) + (in (do async.monad + [before_upload (\ repo download uri) + _ (\ repo upload uri expected) + actual (\ repo download uri)] + (_.cover' [/.repository] + (and (case before_upload + (#try.Success _) false + (#try.Failure _) true) + (|> actual + (try\map (binary\= expected)) + (try.default false)))))) )))) diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index f9749c968..cb6d1a8fe 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -22,11 +22,11 @@ (def: #export random (Random /.Runtime) ($_ random.either - (random\wrap /.default_java) - (random\wrap /.default_js) - (random\wrap /.default_python) - (random\wrap /.default_lua) - (random\wrap /.default_ruby) + (random\in /.default_java) + (random\in /.default_js) + (random\in /.default_python) + (random\in /.default_lua) + (random\in /.default_ruby) )) (def: #export test diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index cd77beb6f..de99ee775 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -58,25 +58,9 @@ (template: (!bundle body) (: Test (do random.monad - [_ (wrap [])] + [_ (in [])] body))) -(def: prelude_macros - Test - ($_ _.and - (do random.monad - [factor (random\map (|>> (n.% 10) (n.max 1)) random.nat) - iterations (random\map (n.% 10) random.nat) - #let [expected (n.* factor iterations)]] - (_.test "Can write loops." - (n.= expected - (loop [counter 0 - value 0] - (if (n.< iterations counter) - (recur (inc counter) (n.+ factor value)) - value))))) - )) - (def: sub_tests Test (with_expansions [## TODO: Update & expand tests for this @@ -421,7 +405,7 @@ )))) (/.macro: (identity_macro tokens) - (\ meta.monad wrap tokens)) + (\ meta.monad in tokens)) (def: for_macro Test @@ -621,8 +605,8 @@ (def: for_static Test (do random.monad - [sample (random.either (wrap option/0) - (wrap option/1))] + [sample (random.either (in option/0) + (in option/1))] ($_ _.and (_.cover [/.static] (case sample @@ -862,12 +846,12 @@ (do {! random.monad} [expected_nat (\ ! map (n.% 1) random.nat) expected_int (\ ! map (i.% +1) random.int) - expected_rev (random.either (wrap .5) - (wrap .25)) - expected_frac (random.either (wrap +0.5) - (wrap +1.25)) - expected_text (random.either (wrap "+0.5") - (wrap "+1.25"))] + expected_rev (random.either (in .5) + (in .25)) + expected_frac (random.either (in +0.5) + (in +1.25)) + expected_text (random.either (in "+0.5") + (in "+1.25"))] ($_ _.and (_.cover [/.case] (and (/.case expected_nat @@ -963,13 +947,35 @@ (/.is? expected_int actual_right))))) ))) +(def: for_control_flow + Test + ($_ _.and + (do random.monad + [factor (random\map (|>> (n.% 10) (n.max 1)) random.nat) + iterations (random\map (n.% 10) random.nat) + #let [expected (n.* factor iterations)]] + (_.cover [/.loop] + (n.= expected + (/.loop [counter 0 + value 0] + (if (n.< iterations counter) + (recur (inc counter) (n.+ factor value)) + value))))) + (do random.monad + [pre random.nat + post (random.only (|>> (n.= pre) not) random.nat) + #let [box (atom.atom pre)]] + (_.cover [/.exec] + (and (is? pre (io.run (atom.read box))) + (/.exec + (io.run (atom.write post box)) + (is? post (io.run (atom.read box))))))) + )) + (def: test Test (<| (_.covering /._) ($_ _.and - (<| (_.context "Prelude macros.") - ..prelude_macros) - ..for_bit ..for_try ..for_list @@ -988,6 +994,7 @@ ..for_expansion ..for_value ..for_case + ..for_control_flow ..sub_tests ))) diff --git a/stdlib/source/test/lux/abstract/comonad.lux b/stdlib/source/test/lux/abstract/comonad.lux index 9b4d935d8..eb50c0f53 100644 --- a/stdlib/source/test/lux/abstract/comonad.lux +++ b/stdlib/source/test/lux/abstract/comonad.lux @@ -23,6 +23,6 @@ (n.= (inc sample) (: (Identity Nat) (/.be identity.comonad - [value (unwrap sample)] - (unwrap (inc value)))))) + [value (out sample)] + (out (inc value)))))) )))) diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/cofree.lux index d44c592d0..ecb90c77c 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/cofree.lux @@ -26,7 +26,7 @@ (def: (interpret [head tail]) (All [a] (-> (/.CoFree Sequence a) (Sequence a))) (|> tail - (sequence\map (\ (/.comonad sequence.functor) unwrap)) + (sequence\map (\ (/.comonad sequence.functor) out)) [head] //.pending)) diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index deab85fe1..60eeba3df 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -28,8 +28,8 @@ top (random.only (|>> (n.= bottom) not) random.nat)] (if ( top bottom) - (wrap (/.between n.enum bottom top)) - (wrap (/.between n.enum top bottom)))))] + (in (/.between n.enum bottom top)) + (in (/.between n.enum top bottom)))))] [inner n.<] [outer n.>] @@ -39,7 +39,7 @@ (Random (Interval Nat)) (do random.monad [point random.nat] - (wrap (/.singleton n.enum point)))) + (in (/.singleton n.enum point)))) (def: #export interval (Random (Interval Nat)) diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index 2c6fb3ac7..02264e013 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -24,19 +24,19 @@ (n.= (inc mono) (: (Identity Nat) (/.do identity.monad - [sample (wrap mono)] - (wrap (inc sample)))))) + [sample (in mono)] + (in (inc sample)))))) (_.cover [/.bind] (n.= (inc mono) (: (Identity Nat) (/.bind identity.monad - (|>> inc (\ identity.monad wrap)) - (\ identity.monad wrap mono))))) + (|>> inc (\ identity.monad in)) + (\ identity.monad in mono))))) (_.cover [/.seq] (\ (list.equivalence n.equivalence) = (list\map inc poly) (|> poly - (list\map (|>> inc (\ identity.monad wrap))) + (list\map (|>> inc (\ identity.monad in))) (: (List (Identity Nat))) (/.seq identity.monad) (: (Identity (List Nat)))))) @@ -44,20 +44,20 @@ (\ (list.equivalence n.equivalence) = (list\map inc poly) (|> poly - (/.map identity.monad (|>> inc (\ identity.monad wrap))) + (/.map identity.monad (|>> inc (\ identity.monad in))) (: (Identity (List Nat)))))) (_.cover [/.only] (\ (list.equivalence n.equivalence) = (list.only n.even? poly) (|> poly - (/.only identity.monad (|>> n.even? (\ identity.monad wrap))) + (/.only identity.monad (|>> n.even? (\ identity.monad in))) (: (Identity (List Nat)))))) (_.cover [/.fold] (n.= (list\fold n.+ 0 poly) (|> poly (/.fold identity.monad (function (_ part whole) - (\ identity.monad wrap + (\ identity.monad in (n.+ part whole))) 0) (: (Identity Nat))))) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index d66513b63..0e902fb40 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -57,12 +57,12 @@ (bit\= false (/.none sample))) (_.cover [/.all] (bit\= true (/.all sample))) - (_.cover [/.unite] + (_.cover [/.or] (bit\= (/.all sample) - ((/.unite /.none /.all) sample))) - (_.cover [/.intersect] + ((/.or /.none /.all) sample))) + (_.cover [/.and] (bit\= (/.none sample) - ((/.intersect /.none /.all) sample))) + ((/.and /.none /.all) sample))) (_.cover [/.complement] (and (not (bit\= (/.none sample) ((/.complement /.none) sample))) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 5ca5d7659..6ccc1a7b2 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -36,7 +36,7 @@ (message: (count! {increment Nat} state self) Nat (let [state' (n.+ increment state)] - (async\wrap (#try.Success [state' state'])))) + (async\in (#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 async\wrap)))) + (|> state transform #try.Success async\in)))) inc! (: (/.Mail Nat) (as_mail inc)) dec! (: (/.Mail Nat) (as_mail dec))]] (<| (_.covering /._) @@ -69,133 +69,133 @@ [actor (/.spawn! /.default 0) poisoned? (/.poison! actor) alive? (/.alive? actor)] - (wrap (and (..mailed? poisoned?) - (not alive?))))) + (in (and (..mailed? poisoned?) + (not alive?))))) cannot_poison_more_than_once! (io.run (do io.monad [actor (/.spawn! /.default 0) first_time? (/.poison! actor) second_time? (/.poison! actor)] - (wrap (and (..mailed? first_time?) - (not (..mailed? second_time?))))))] + (in (and (..mailed? first_time?) + (not (..mailed? second_time?))))))] (and poisoned_actors_die! cannot_poison_more_than_once!))) (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) - (exception.match? /.poisoned error) - - #.None - false))))) - - (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 async.monad - [result (async.future (do io.monad - [counter (/.spawn! /.default 0) - _ (/.poison! counter)] - (/.mail! inc! counter)))] - (_.cover' [/.dead] + (in (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))] + (in outcome)) + + (#try.Success _) + (in outcome))))}) + [])] + (/.poison! actor))) + _ (async.wait 100) + result (async.future (async.poll read))] + (_.cover' [/.poisoned] (case result - (#try.Success outcome) - false - - (#try.Failure error) - (exception.match? /.dead error))))) + (#.Some error) + (exception.match? /.poisoned error) + + #.None + false))))) + + (in (do async.monad + [sent? (async.future (do io.monad + [actor (/.spawn! /.default 0) + sent? (/.mail! inc! actor)] + (in (..mailed? sent?))))] + (_.cover' [/.Behavior /.Mail + /.default /.spawn! /.mail!] + sent?))) + + (in (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) + false + + (#try.Failure error) + (exception.match? /.dead error))))) (let [die! (: (/.Mail Nat) (function (_ state actor) - (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)])])) - (and (..mailed? sent?) - (not alive?) - (exception.match? ..got_wrecked error) - (n.= initial_state state) - (is? die! single_pending_message)) - - _ - false))))) - - (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)] - (wrap (and (n.= 1 output_1) - (n.= 2 output_2) - (n.= 3 output_3))))] - (_.cover' [/.Message /.actor: /.message: /.tell!] + (async\in (exception.except ..got_wrecked []))))] + (in (do async.monad + [result (async.future (do io.monad + [actor (/.spawn! /.default initial_state) + sent? (/.mail! die! actor) + alive? (/.alive? actor) + obituary (/.obituary actor)] + (in (#try.Success [actor sent? alive? obituary]))))] + (_.cover' [/.Obituary /.obituary] (case result - (#try.Success outcome) - outcome - - (#try.Failure error) - false)))) - - (wrap (do async.monad - [verdict (async.future - (do io.monad - [anonymous (/.actor {Nat - initial_state} - ((on_mail message state self) - (message (inc state) self))) - sent/inc? (/.mail! inc! anonymous) - sent/dec? (/.mail! dec! anonymous) - poisoned? (/.poison! anonymous) - obituary (/.obituary anonymous)] - (wrap (and (..mailed? sent/inc?) - (..mailed? sent/dec?) - (..mailed? poisoned?) - (case obituary - (^ (#.Some [error final_state (list poison_pill)])) - (and (exception.match? /.poisoned error) - (n.= (inc (inc initial_state)) - final_state)) - - _ - false)))))] - (_.cover' [/.actor] - verdict))) + (^ (#try.Success [actor sent? alive? (#.Some [error state (list single_pending_message)])])) + (and (..mailed? sent?) + (not alive?) + (exception.match? ..got_wrecked error) + (n.= initial_state state) + (is? die! single_pending_message)) + + _ + false))))) + + (in (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)] + (in (and (n.= 1 output_1) + (n.= 2 output_2) + (n.= 3 output_3))))] + (_.cover' [/.Message /.actor: /.message: /.tell!] + (case result + (#try.Success outcome) + outcome + + (#try.Failure error) + false)))) + + (in (do async.monad + [verdict (async.future + (do io.monad + [anonymous (/.actor {Nat + initial_state} + ((on_mail message state self) + (message (inc state) self))) + sent/inc? (/.mail! inc! anonymous) + sent/dec? (/.mail! dec! anonymous) + poisoned? (/.poison! anonymous) + obituary (/.obituary anonymous)] + (in (and (..mailed? sent/inc?) + (..mailed? sent/dec?) + (..mailed? poisoned?) + (case obituary + (^ (#.Some [error final_state (list poison_pill)])) + (and (exception.match? /.poisoned error) + (n.= (inc (inc initial_state)) + final_state)) + + _ + false)))))] + (_.cover' [/.actor] + verdict))) (do ! [num_events (\ ! map (|>> (n.% 10) inc) random.nat) @@ -204,25 +204,25 @@ #let [expected (list.take num_observations events) sink (: (Atom (Row Nat)) (atom.atom row.empty))]] - (wrap (do async.monad - [agent (async.future - (do {! io.monad} - [agent (/.actor {Nat 0}) - _ (/.observe (function (_ event stop) - (function (_ events_seen self) - (async.future - (if (n.< num_observations events_seen) - (do ! - [_ (atom.update (row.add event) sink)] - (wrap (#try.Success (inc events_seen)))) - (do ! - [_ stop] - (wrap (#try.Failure "YOLO"))))))) - (frp.sequential 0 events) - agent)] - (wrap agent))) - _ (/.await agent) - actual (async.future (atom.read sink))] - (_.cover' [/.Stop /.observe /.await] - (\ (list.equivalence n.equivalence) = expected (row.to_list actual)))))) + (in (do async.monad + [agent (async.future + (do {! io.monad} + [agent (/.actor {Nat 0}) + _ (/.observe (function (_ event stop) + (function (_ events_seen self) + (async.future + (if (n.< num_observations events_seen) + (do ! + [_ (atom.update (row.add event) sink)] + (in (#try.Success (inc events_seen)))) + (do ! + [_ stop] + (in (#try.Failure "YOLO"))))))) + (frp.sequential 0 events) + agent)] + (in agent))) + _ (/.await agent) + 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/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 1c7d075f4..5a92f595a 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -37,13 +37,13 @@ (do io.monad [?left (/.poll left) ?right (/.poll right)] - (wrap (case [?left ?right] - [(#.Some left) - (#.Some right)] - (== left right) - - _ - false)))))) + (in (case [?left ?right] + [(#.Some left) + (#.Some right)] + (== left right) + + _ + false)))))) (def: delay (for {@.js @@ -68,109 +68,109 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (wrap (do /.monad - [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] - resolved? (/.future (resolver expected)) - actual async] - (_.cover' [/.Async /.Resolver /.async] - (and resolved? - (n.= expected actual))))) - (wrap (do /.monad - [actual (/.resolved expected)] - (_.cover' [/.resolved] - (n.= expected actual)))) - (wrap (do /.monad - [actual (/.future (io.io expected))] - (_.cover' [/.future] - (n.= expected actual)))) - (wrap (do /.monad - [pre (/.future instant.now) - actual (/.schedule to_wait (io.io expected)) - post (/.future instant.now)] - (_.cover' [/.schedule] - (and (n.= expected actual) - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post))))))) - (wrap (do /.monad - [pre (/.future instant.now) - _ (/.wait to_wait) - post (/.future instant.now)] - (_.cover' [/.wait] - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post)))))) - (wrap (do /.monad - [[leftA rightA] (/.and (/.future (io.io leftE)) - (/.future (io.io rightE)))] - (_.cover' [/.and] + (in (do /.monad + [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + resolved? (/.future (resolver expected)) + actual async] + (_.cover' [/.Async /.Resolver /.async] + (and resolved? + (n.= expected actual))))) + (in (do /.monad + [actual (/.resolved expected)] + (_.cover' [/.resolved] + (n.= expected actual)))) + (in (do /.monad + [actual (/.future (io.io expected))] + (_.cover' [/.future] + (n.= expected actual)))) + (in (do /.monad + [pre (/.future instant.now) + actual (/.schedule to_wait (io.io expected)) + post (/.future instant.now)] + (_.cover' [/.schedule] + (and (n.= expected actual) + (i.>= (.int to_wait) + (duration.to_millis (instant.span pre post))))))) + (in (do /.monad + [pre (/.future instant.now) + _ (/.wait to_wait) + post (/.future instant.now)] + (_.cover' [/.wait] + (i.>= (.int to_wait) + (duration.to_millis (instant.span pre post)))))) + (in (do /.monad + [[leftA rightA] (/.and (/.future (io.io leftE)) + (/.future (io.io rightE)))] + (_.cover' [/.and] + (n.= (n.+ leftE rightE) + (n.+ leftA rightA))))) + (in (do /.monad + [pre (/.future instant.now) + actual (/.delay to_wait expected) + post (/.future instant.now)] + (_.cover' [/.delay] + (and (n.= expected actual) + (i.>= (.int to_wait) + (duration.to_millis (instant.span pre post))))))) + (in (do /.monad + [?left (/.or (in leftE) + (/.delay to_wait dummy)) + ?right (/.or (/.delay to_wait dummy) + (in rightE))] + (_.cover' [/.or] + (case [?left ?right] + [(#.Left leftA) (#.Right rightA)] (n.= (n.+ leftE rightE) - (n.+ leftA rightA))))) - (wrap (do /.monad - [pre (/.future instant.now) - actual (/.delay to_wait expected) - post (/.future instant.now)] - (_.cover' [/.delay] - (and (n.= expected actual) - (i.>= (.int to_wait) - (duration.to_millis (instant.span pre post))))))) - (wrap (do /.monad - [?left (/.or (wrap leftE) - (/.delay to_wait dummy)) - ?right (/.or (/.delay to_wait dummy) - (wrap rightE))] - (_.cover' [/.or] - (case [?left ?right] - [(#.Left leftA) (#.Right rightA)] - (n.= (n.+ leftE rightE) - (n.+ leftA rightA)) + (n.+ leftA rightA)) - _ - false)))) - (wrap (do /.monad - [leftA (/.either (wrap leftE) - (/.delay to_wait dummy)) - rightA (/.either (/.delay to_wait dummy) - (wrap rightE))] - (_.cover' [/.either] - (n.= (n.+ leftE rightE) - (n.+ leftA rightA))))) - (wrap (do /.monad - [?actual (/.future (/.poll (/.resolved expected))) - #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] - ?never (/.future (/.poll async))] - (_.cover' [/.poll] - (case [?actual ?never] - [(#.Some actual) #.None] - (n.= expected actual) + _ + false)))) + (in (do /.monad + [leftA (/.either (in leftE) + (/.delay to_wait dummy)) + rightA (/.either (/.delay to_wait dummy) + (in rightE))] + (_.cover' [/.either] + (n.= (n.+ leftE rightE) + (n.+ leftA rightA))))) + (in (do /.monad + [?actual (/.future (/.poll (/.resolved expected))) + #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + ?never (/.future (/.poll async))] + (_.cover' [/.poll] + (case [?actual ?never] + [(#.Some actual) #.None] + (n.= expected actual) - _ - false)))) - (wrap (do /.monad - [yep (/.future (/.resolved? (/.resolved expected))) - #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] - nope (/.future (/.resolved? async))] - (_.cover' [/.resolved?] - (and yep - (not nope))))) - (wrap (do /.monad - [?none (/.time_out 0 (/.delay to_wait dummy)) - ?actual (/.time_out to_wait (wrap expected))] - (_.cover' [/.time_out] - (case [?none ?actual] - [#.None (#.Some actual)] - (n.= expected actual) + _ + false)))) + (in (do /.monad + [yep (/.future (/.resolved? (/.resolved expected))) + #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] + nope (/.future (/.resolved? async))] + (_.cover' [/.resolved?] + (and yep + (not nope))))) + (in (do /.monad + [?none (/.time_out 0 (/.delay to_wait dummy)) + ?actual (/.time_out to_wait (in expected))] + (_.cover' [/.time_out] + (case [?none ?actual] + [#.None (#.Some actual)] + (n.= expected actual) - _ - false)))) - (wrap (do /.monad - [#let [box (: (Atom Nat) - (atom.atom dummy))] - _ (/.future (/.await (function (_ value) - (atom.write value box)) - (/.resolved expected))) - actual (/.future (atom.read box))] - (_.cover' [/.await] - (n.= expected actual)))) + _ + false)))) + (in (do /.monad + [#let [box (: (Atom Nat) + (atom.atom dummy))] + _ (/.future (/.await (function (_ value) + (atom.write value box)) + (/.resolved expected))) + actual (/.future (atom.read box))] + (_.cover' [/.await] + (n.= expected actual)))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index 567f1c40a..d51af0737 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -24,7 +24,7 @@ (io.run (do io.monad [actual (/.read box)] - (wrap (is? expected actual)))))) + (in (is? expected actual)))))) (do random.monad [target random.nat unknown (random.only (|>> (is? target) not) random.nat) @@ -36,9 +36,9 @@ [swapped_unknown? (/.compare_and_swap unknown expected box) swapped_target? (/.compare_and_swap target expected box) actual (/.read box)] - (wrap (and (not swapped_unknown?) - swapped_target? - (is? expected actual))))))) + (in (and (not swapped_unknown?) + swapped_target? + (is? expected actual))))))) (do random.monad [init random.nat shift random.nat @@ -47,9 +47,9 @@ (io.run (do io.monad [[pre post] (/.update (n.+ shift) box)] - (wrap (and (is? init pre) - (n.= (n.+ shift init) - post))))))) + (in (and (is? init pre) + (n.= (n.+ shift init) + post))))))) (do random.monad [pre random.nat post random.nat @@ -59,6 +59,6 @@ (do io.monad [old (/.write post box) new (/.read box)] - (wrap (and (is? pre old) - (is? post new))))))) + (in (and (is? pre old) + (is? post new))))))) ))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index e9eabb5bc..5c555ebfc 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -38,25 +38,25 @@ (do io.monad [?left (async.poll left) ?right (async.poll right)] - (wrap (case [?left ?right] - [(#.Some (#.Some [left _])) - (#.Some (#.Some [right _]))] - (== left right) - - _ - false)))))) + (in (case [?left ?right] + [(#.Some (#.Some [left _])) + (#.Some (#.Some [right _]))] + (== left right) + + _ + false)))))) (def: (take_amount amount_of_polls [channel sink]) (All [a] (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a)))) (case amount_of_polls 0 (do async.monad [_ (async.future (\ sink close))] - (wrap #.Nil)) + (in #.Nil)) _ (do {! async.monad} [event channel] (case event #.None - (wrap #.Nil) + (in #.Nil) (#.Some [head tail]) (\ ! map (|>> (#.Cons head)) @@ -89,17 +89,17 @@ [#let [[channel sink] (/.channel [])] _ (\ sink feed sample) _ (\ sink close)] - (wrap channel))) + (in channel))) (#try.Success channel) (io.run (do io.monad [?actual (async.poll channel)] - (wrap (case ?actual - (#.Some (#.Some [actual _])) - (n.= sample actual) - - _ - false)))) + (in (case ?actual + (#.Some (#.Some [actual _])) + (n.= sample actual) + + _ + false)))) (#try.Failure error) false)) @@ -114,110 +114,110 @@ (#try.Failure error) (exception.match? /.channel_is_already_closed error))) - (wrap (do async.monad - [output (|> sample - async.resolved - /.of_async - /.consume)] - (_.cover' [/.of_async /.consume] - (list\= (list sample) - output)))) - (wrap (do async.monad - [output (|> inputs - (/.sequential 0) - /.consume)] - (_.cover' [/.sequential] - (list\= inputs - output)))) - (wrap (do async.monad - [output (|> inputs - (/.sequential 0) - (/.only n.even?) - /.consume)] - (_.cover' [/.only] - (list\= (list.only n.even? inputs) - output)))) - (wrap (do {! async.monad} - [#let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)] - (async.async [])) - sink (: (Atom (Row Nat)) - (atom.atom row.empty))] - _ (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 - async.future - (\ ! map row.to_list))] - (_.cover' [/.Subscriber /.subscribe] - (list\= inputs listened)))) - (wrap (do async.monad - [actual (/.fold (function (_ input total) - (async.resolved (n.+ input total))) - 0 - (/.sequential 0 inputs))] - (_.cover' [/.fold] - (n.= (list\fold n.+ 0 inputs) - actual)))) - (wrap (do async.monad - [actual (|> inputs - (/.sequential 0) - (/.folds (function (_ input total) - (async.resolved (n.+ input total))) - 0) - /.consume)] - (_.cover' [/.folds] - (list\= (list.folds n.+ 0 inputs) - actual)))) - (wrap (do async.monad - [actual (|> (list distint/0 distint/0 distint/0 - distint/1 - distint/2 distint/2) - (/.sequential 0) - (/.distinct n.equivalence) - /.consume)] - (_.cover' [/.distinct] - (list\= (list distint/0 distint/1 distint/2) - actual)))) + (in (do async.monad + [output (|> sample + async.resolved + /.of_async + /.consume)] + (_.cover' [/.of_async /.consume] + (list\= (list sample) + output)))) + (in (do async.monad + [output (|> inputs + (/.sequential 0) + /.consume)] + (_.cover' [/.sequential] + (list\= inputs + output)))) + (in (do async.monad + [output (|> inputs + (/.sequential 0) + (/.only n.even?) + /.consume)] + (_.cover' [/.only] + (list\= (list.only n.even? inputs) + output)))) + (in (do {! async.monad} + [#let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)] + (async.async [])) + sink (: (Atom (Row Nat)) + (atom.atom row.empty))] + _ (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))) + (in (#.Some [])) + (do ! + [_ (!signal [])] + (in #.None))))) + (/.sequential 0 (list\compose inputs inputs)))) + _ ?signal + listened (|> sink + atom.read + async.future + (\ ! map row.to_list))] + (_.cover' [/.Subscriber /.subscribe] + (list\= inputs listened)))) + (in (do async.monad + [actual (/.fold (function (_ input total) + (async.resolved (n.+ input total))) + 0 + (/.sequential 0 inputs))] + (_.cover' [/.fold] + (n.= (list\fold n.+ 0 inputs) + actual)))) + (in (do async.monad + [actual (|> inputs + (/.sequential 0) + (/.folds (function (_ input total) + (async.resolved (n.+ input total))) + 0) + /.consume)] + (_.cover' [/.folds] + (list\= (list.folds n.+ 0 inputs) + actual)))) + (in (do async.monad + [actual (|> (list distint/0 distint/0 distint/0 + distint/1 + distint/2 distint/2) + (/.sequential 0) + (/.distinct n.equivalence) + /.consume)] + (_.cover' [/.distinct] + (list\= (list distint/0 distint/1 distint/2) + actual)))) (do ! [polling_delay (\ ! map (|>> (n.% 10) inc) random.nat) amount_of_polls (\ ! map (|>> (n.% 10) inc) random.nat)] ($_ _.and - (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) - - enough_polls! - (n.= amount_of_polls (list.size actual))]] - (_.cover' [/.poll] - (and correct_values! - enough_polls!)))) - (wrap (do {! async.monad} - [actual (..take_amount amount_of_polls (/.periodic polling_delay))] - (_.cover' [/.periodic] - (n.= amount_of_polls (list.size actual))))))) - (wrap (do async.monad - [#let [max_iterations 10] - actual (|> [0 sample] - (/.iterate (function (_ [iterations current]) - (async.resolved - (if (n.< max_iterations iterations) - (#.Some [[(inc iterations) (n.+ shift current)] - current]) - #.None)))) - /.consume)] - (_.cover' [/.iterate] - (and (n.= max_iterations (list.size actual)) - (list\= (list.folds n.+ sample (list.repeat (dec max_iterations) shift)) - actual))))) + (in (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) + + enough_polls! + (n.= amount_of_polls (list.size actual))]] + (_.cover' [/.poll] + (and correct_values! + enough_polls!)))) + (in (do {! async.monad} + [actual (..take_amount amount_of_polls (/.periodic polling_delay))] + (_.cover' [/.periodic] + (n.= amount_of_polls (list.size actual))))))) + (in (do async.monad + [#let [max_iterations 10] + actual (|> [0 sample] + (/.iterate (function (_ [iterations current]) + (async.resolved + (if (n.< max_iterations iterations) + (#.Some [[(inc iterations) (n.+ shift current)] + current]) + #.None)))) + /.consume)] + (_.cover' [/.iterate] + (and (n.= max_iterations (list.size actual)) + (list\= (list.folds n.+ sample (list.repeat (dec max_iterations) shift)) + actual))))) ))))) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index d1077ae53..1e6dd9a48 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -41,56 +41,56 @@ (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do async.monad - [result (async.time_out ..delay (/.wait semaphore))] - (_.cover' [/.semaphore] - (case result - (#.Some _) - true + (in (do async.monad + [result (async.time_out ..delay (/.wait semaphore))] + (_.cover' [/.semaphore] + (case result + (#.Some _) + true - #.None - false))))) + #.None + false))))) (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do {! async.monad} - [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) - result (async.time_out ..delay (/.wait semaphore))] - (_.cover' [/.wait] - (case result - (#.Some _) - false + (in (do {! async.monad} + [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) + result (async.time_out ..delay (/.wait semaphore))] + (_.cover' [/.wait] + (case result + (#.Some _) + false - #.None - true))))) + #.None + true))))) (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do {! async.monad} - [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) - #let [block (/.wait semaphore)] - result/0 (async.time_out ..delay block) - open_positions (/.signal semaphore) - result/1 (async.time_out ..delay block)] - (_.cover' [/.signal] - (case [result/0 result/1 open_positions] - [#.None (#.Some _) (#try.Success +0)] - true + (in (do {! async.monad} + [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) + #let [block (/.wait semaphore)] + result/0 (async.time_out ..delay block) + open_positions (/.signal semaphore) + result/1 (async.time_out ..delay block)] + (_.cover' [/.signal] + (case [result/0 result/1 open_positions] + [#.None (#.Some _) (#try.Success +0)] + true - _ - false))))) + _ + false))))) (do {! random.monad} [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) #let [semaphore (/.semaphore initial_open_positions)]] - (wrap (do async.monad - [outcome (/.signal semaphore)] - (_.cover' [/.semaphore_is_maxed_out] - (case outcome - (#try.Failure error) - (exception.match? /.semaphore_is_maxed_out error) + (in (do async.monad + [outcome (/.signal semaphore)] + (_.cover' [/.semaphore_is_maxed_out] + (case outcome + (#try.Failure error) + (exception.match? /.semaphore_is_maxed_out error) - _ - false))))) + _ + false))))) ))) (def: mutex @@ -110,7 +110,7 @@ [_ (<| (monad.seq !) (list.repeat repetitions) (atom.update (|>> (format "A")) resource))] - (wrap []))) + (in []))) processB (<| (/.synchronize mutex) io.io async.future @@ -118,16 +118,16 @@ [_ (<| (monad.seq !) (list.repeat repetitions) (atom.update (|>> (format "B")) resource))] - (wrap [])))]] - (wrap (do async.monad - [_ processA - _ processB - #let [outcome (io.run (atom.read resource))]] - (_.cover' [/.mutex /.synchronize] - (or (text\= (format expected_As expected_Bs) - outcome) - (text\= (format expected_Bs expected_As) - outcome)))))) + (in [])))]] + (in (do async.monad + [_ processA + _ processB + #let [outcome (io.run (atom.read resource))]] + (_.cover' [/.mutex /.synchronize] + (or (text\= (format expected_As expected_Bs) + outcome) + (text\= (format expected_Bs expected_As) + outcome)))))) ))) (def: (waiter resource barrier id) @@ -135,7 +135,7 @@ (do async.monad [_ (/.block barrier) _ (async.future (atom.update (|>> (format (%.nat id))) resource))] - (wrap []))) + (in []))) (def: barrier Test @@ -158,23 +158,23 @@ [limit (\ ! map (|>> (n.% 9) inc) random.nat) #let [barrier (/.barrier (maybe.assume (/.limit limit))) resource (atom.atom "")]] - (wrap (do {! async.monad} - [#let [suffix "_" - expected_ending (|> suffix - (list.repeat limit) - (text.join_with "")) - expected_ids (enum.range n.enum 0 (dec limit))] - _ (|> expected_ids - (list\map (function (_ id) - (exec (io.run (atom.update (|>> (format suffix)) resource)) - (waiter resource barrier id)))) - (monad.seq !)) - #let [outcome (io.run (atom.read resource))]] - (_.cover' [/.barrier /.block] - (and (text.ends_with? expected_ending outcome) - (list.every? (function (_ id) - (text.contains? (%.nat id) outcome)) - expected_ids)))))) + (in (do {! async.monad} + [#let [suffix "_" + expected_ending (|> suffix + (list.repeat limit) + (text.join_with "")) + expected_ids (enum.range n.enum 0 (dec limit))] + _ (|> expected_ids + (list\map (function (_ id) + (exec (io.run (atom.update (|>> (format suffix)) resource)) + (waiter resource barrier id)))) + (monad.seq !)) + #let [outcome (io.run (atom.read resource))]] + (_.cover' [/.barrier /.block] + (and (text.ends_with? expected_ending outcome) + (list.every? (function (_ id) + (text.contains? (%.nat id) outcome)) + expected_ids)))))) ))) (def: #export test diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 053cc7dd8..67d73d61e 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -27,7 +27,7 @@ (def: injection (Injection /.STM) - (\ /.monad wrap)) + (\ /.monad in)) (def: comparison (Comparison /.STM) @@ -50,54 +50,54 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (wrap (do async.monad - [actual (/.commit (\ /.monad wrap expected))] - (_.cover' [/.commit] - (n.= expected actual)))) - (wrap (do async.monad - [actual (/.commit (/.read (/.var expected)))] - (_.cover' [/.Var /.var /.read] - (n.= expected actual)))) - (wrap (do async.monad - [actual (let [box (/.var dummy)] - (/.commit (do /.monad - [_ (/.write expected box)] - (/.read box)))) - verdict (let [box (/.var dummy)] - (/.commit (do /.monad - [_ (/.write expected box) - actual (/.read box)] - (wrap (n.= expected actual)))))] - (_.cover' [/.write] - (and (n.= expected actual) - verdict)))) - (wrap (do async.monad - [#let [box (/.var dummy)] - output (/.commit (do /.monad - [_ (/.update (n.+ expected) box)] - (/.read box)))] - (_.cover' [/.update] - (n.= (n.+ expected dummy) - output)))) - (wrap (do async.monad - [#let [box (/.var dummy) - [follower sink] (io.run (/.follow box))] - _ (/.commit (/.write expected box)) - _ (/.commit (/.update (n.* 2) box)) - _ (async.future (\ sink close)) - _ (/.commit (/.update (n.* 3) box)) - changes (frp.consume follower)] - (_.cover' [/.follow] - (\ (list.equivalence n.equivalence) = - (list expected (n.* 2 expected)) - changes)))) - (wrap (let [var (/.var 0)] - (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 - cummulative))))) + (in (do async.monad + [actual (/.commit (\ /.monad in expected))] + (_.cover' [/.commit] + (n.= expected actual)))) + (in (do async.monad + [actual (/.commit (/.read (/.var expected)))] + (_.cover' [/.Var /.var /.read] + (n.= expected actual)))) + (in (do async.monad + [actual (let [box (/.var dummy)] + (/.commit (do /.monad + [_ (/.write expected box)] + (/.read box)))) + verdict (let [box (/.var dummy)] + (/.commit (do /.monad + [_ (/.write expected box) + actual (/.read box)] + (in (n.= expected actual)))))] + (_.cover' [/.write] + (and (n.= expected actual) + verdict)))) + (in (do async.monad + [#let [box (/.var dummy)] + output (/.commit (do /.monad + [_ (/.update (n.+ expected) box)] + (/.read box)))] + (_.cover' [/.update] + (n.= (n.+ expected dummy) + output)))) + (in (do async.monad + [#let [box (/.var dummy) + [follower sink] (io.run (/.follow box))] + _ (/.commit (/.write expected box)) + _ (/.commit (/.update (n.* 2) box)) + _ (async.future (\ sink close)) + _ (/.commit (/.update (n.* 3) box)) + changes (frp.consume follower)] + (_.cover' [/.follow] + (\ (list.equivalence n.equivalence) = + (list expected (n.* 2 expected)) + changes)))) + (in (let [var (/.var 0)] + (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 + cummulative))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index cb4e7d889..0758f48b3 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -31,22 +31,22 @@ ($_ _.and (_.cover [/.parallelism] (n.> 0 /.parallelism)) - (wrap (do async.monad - [reference_time (async.future instant.now) - #let [box (atom.atom [reference_time dummy])] - _ (async.future - (/.schedule delay (do io.monad - [execution_time instant.now] - (atom.write [execution_time expected] box)))) - _ (async.wait (n.* 2 delay)) - [execution_time actual] (async.future (atom.read box))] - (_.cover' [/.schedule] - (let [expected_delay! - (i.>= (.int delay) - (duration.to_millis (instant.span reference_time execution_time))) + (in (do async.monad + [reference_time (async.future instant.now) + #let [box (atom.atom [reference_time dummy])] + _ (async.future + (/.schedule delay (do io.monad + [execution_time instant.now] + (atom.write [execution_time expected] box)))) + _ (async.wait (n.* 2 delay)) + [execution_time actual] (async.future (atom.read box))] + (_.cover' [/.schedule] + (let [expected_delay! + (i.>= (.int delay) + (duration.to_millis (instant.span reference_time execution_time))) - correct_value! - (n.= expected actual)] - (and expected_delay! - correct_value!))))) + correct_value! + (n.= expected actual)] + (and expected_delay! + correct_value!))))) )))) diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index d13a3ee78..24944c49e 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -45,7 +45,7 @@ ($monad.spec ..injection ..comparison /.monad)) (_.cover [/.run] - (n.= sample (/.run (_\wrap sample)))) + (n.= sample (/.run (_\in sample)))) (_.cover [/.call/cc] (n.= (n.* 2 sample) (/.run (do {! /.monad} @@ -57,14 +57,14 @@ ## the output would be ## (n.* 4 sample) (k temp))))] - (wrap (n.* 2 value)))))) + (in (n.* 2 value)))))) (_.cover [/.portal] (n.= (n.+ 100 sample) (/.run (do /.monad [[restart [output idx]] (/.portal [sample 0])] (if (n.< 10 idx) (restart [(n.+ 10 output) (inc idx)]) - (wrap output)))))) + (in output)))))) (_.cover [/.shift /.reset] (let [(^open "_\.") /.monad (^open "list\.") (list.equivalence n.equivalence) @@ -73,14 +73,14 @@ (function (visit xs) (case xs #.Nil - (_\wrap #.Nil) + (_\in #.Nil) (#.Cons x xs') (do {! /.monad} [output (/.shift (function (_ k) (do ! [tail (k xs')] - (wrap (#.Cons x tail)))))] + (in (#.Cons x tail)))))] (visit output)))))] (list\= elems (/.run (/.reset (visit elems)))))) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 21d81f014..1ab4cf0e5 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -41,12 +41,12 @@ (case (/.return expected) (#try.Success actual) (n.= expected actual) (#try.Failure _) false)) - (_.cover [/.throw] - (case (/.throw ..an_exception []) + (_.cover [/.except] + (case (/.except ..an_exception []) (#try.Success _) false (#try.Failure _) true)) (_.cover [/.construct] - (case (/.throw ..an_exception []) + (case (/.except ..an_exception []) (#try.Success _) false @@ -65,17 +65,17 @@ (text\= message (/.construct ..an_exception []))))) (_.cover [/.catch] (and (n.= expected - (|> (/.throw ..an_exception []) + (|> (/.except ..an_exception []) (/.catch ..an_exception (function (_ ex) expected)) (/.otherwise (function (_ ex) wrong)))) (n.= expected - (|> (/.throw ..another_exception []) + (|> (/.except ..another_exception []) (/.catch ..an_exception (function (_ ex) wrong)) (/.catch ..another_exception (function (_ ex) expected)) (/.otherwise (function (_ ex) wrong)))))) (_.cover [/.otherwise] (n.= expected - (|> (/.throw ..another_exception []) + (|> (/.except ..another_exception []) (/.catch ..an_exception (function (_ ex) wrong)) (/.otherwise (function (_ ex) expected))))) (_.cover [/.report] @@ -100,7 +100,7 @@ (#try.Failure message) (text\= message (/.construct ..an_exception []))) (case (/.with ..an_exception [] (: (Try Nat) - (/.throw ..another_exception []))) + (/.except ..another_exception []))) (#try.Success _) false @@ -108,7 +108,7 @@ (and (text.contains? (/.construct ..an_exception []) message) (text.contains? (/.construct ..another_exception []) message))))) (_.cover [/.exception:] - (case (/.throw ..custom_exception [expected]) + (case (/.except ..custom_exception [expected]) (#try.Success _) false diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index 29c39dbdb..edc74a9c0 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -28,12 +28,12 @@ (def: (fibonacci recur input) (/.Memo Nat Nat) (case input - 0 (state\wrap 0) - 1 (state\wrap 1) + 0 (state\in 0) + 1 (state\in 1) _ (do state.monad [output_1 (recur (n.- 1 input)) output_2 (recur (n.- 2 input))] - (wrap (n.+ output_1 output_2))))) + (in (n.+ output_1 output_2))))) (def: (time function input) (All [i o] (-> (-> i o) i (IO [Duration o]))) @@ -41,8 +41,8 @@ [before instant.now #let [output (function input)] after instant.now] - (wrap [(instant.span before after) - output]))) + (in [(instant.span before after) + output]))) (def: milli_seconds (-> Duration Nat) @@ -75,8 +75,8 @@ memo_is_faster! (n.< (n.+ ..wiggle_room (milli_seconds slow_time)) (milli_seconds fast_time))]] - (wrap (and same_output! - memo_is_faster!))))) + (in (and same_output! + memo_is_faster!))))) (_.cover [/.open] (io.run (do io.monad @@ -97,19 +97,19 @@ incrementalism_is_faster! (n.< (n.+ ..wiggle_room (milli_seconds open_time)) (milli_seconds open_time/+1))]] - (wrap (and same_output! - memo_is_faster! - incrementalism_is_faster!))))) + (in (and same_output! + memo_is_faster! + incrementalism_is_faster!))))) (_.cover [/.memoization] (let [memo (<| //.mixin (//.inherit /.memoization) (: (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) (function (factorial delegate recur input) (case input - (^or 0 1) (\ state.monad wrap 1) + (^or 0 1) (\ state.monad in 1) _ (do state.monad [output' (recur (dec input))] - (wrap (n.* input output'))))))) + (in (n.* input output'))))))) expected (|> (list.indices input) (list\map inc) (list\fold n.* 1)) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 38ed0f982..1ebf38e79 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -36,8 +36,8 @@ generator (: (Random (/.Mixin Nat Nat)) (do ! [output random.nat] - (wrap (function (_ delegate recur input) - output)))) + (in (function (_ delegate recur input) + output)))) expected (|> (list.indices input) (list\map inc) (list\fold n.* 1))]]) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 1fed0e4cb..382d17063 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -77,12 +77,12 @@ #0)) (syntax: (match pattern then input) - (wrap (list (` (case (~ input) - (^ (#try.Success [(~' _) (~ pattern)])) - (~ then) + (in (list (` (case (~ input) + (^ (#try.Success [(~' _) (~ pattern)])) + (~ then) - (~' _) - #0))))) + (~' _) + #0))))) (def: combinators_0 Test @@ -246,7 +246,7 @@ (list\map code.nat expected+) actual)))) (_.cover [/.default] - (and (|> (/.run (/.default wrong (\ /.monad wrap expected)) (list)) + (and (|> (/.run (/.default wrong (\ /.monad in expected)) (list)) (match actual (n.= expected actual))) (|> (/.run (/.default expected (: (Parser (List Code) Nat) (/.failure "yolo"))) @@ -331,7 +331,7 @@ (def: injection (Injection (All [a i] (Parser i a))) - (\ /.monad wrap)) + (\ /.monad in)) (def: comparison (Comparison (All [a i] (Parser i a))) @@ -360,7 +360,7 @@ ($monad.spec ..injection ..comparison /.monad)) (_.cover [/.run] - (|> (/.run (\ /.monad wrap expected) (list)) + (|> (/.run (\ /.monad in expected) (list)) (match actual (n.= expected actual)))) (_.cover [/.failure] (|> (list) diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index 8be89e101..b16045572 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -108,7 +108,7 @@ (|> (/.run (do <>.monad [verdict /.end? _ /.bit] - (wrap verdict)) + (in verdict)) (list (analysis.bit dummy))) (!expect (#try.Success #0)))))) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index ebba6bc28..c494562bc 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -117,10 +117,10 @@ (Random Type) (let [(^open ".") random.monad] ($_ random.either - (wrap .Nat) - (wrap .List) - (wrap .Code) - (wrap .Type)))) + (in .Nat) + (in .List) + (in .Code) + (in .Type)))) (def: size Test @@ -351,8 +351,8 @@ [pre /.end? _ (/.segment ..segment_size) post /.end?] - (wrap (and (not pre) - post)))) + (in (and (not pre) + post)))) (!expect (#try.Success #1))))) (do {! random.monad} [to_read (\ ! map (n.% (inc ..segment_size)) random.nat) @@ -365,9 +365,9 @@ offset /.offset _ (/.segment (n.- to_read ..segment_size)) nothing_left /.offset] - (wrap (and (n.= 0 start) - (n.= to_read offset) - (n.= ..segment_size nothing_left))))) + (in (and (n.= 0 start) + (n.= to_read offset) + (n.= ..segment_size nothing_left))))) (!expect (#try.Success #1))))) (do {! random.monad} [to_read (\ ! map (n.% (inc ..segment_size)) random.nat) @@ -379,9 +379,9 @@ remaining /.remaining _ (/.segment (n.- to_read ..segment_size)) nothing_left /.remaining] - (wrap (and (n.= ..segment_size - (n.+ to_read remaining)) - (n.= 0 nothing_left))))) + (in (and (n.= ..segment_size + (n.+ to_read remaining)) + (n.= 0 nothing_left))))) (!expect (#try.Success #1))))) ..size ..binary diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index 38d915243..a9adeb507 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -121,8 +121,8 @@ [pre /.end? _ /.any post /.end?] - (wrap (and (not pre) - post))) + (in (and (not pre) + post))) (list dummy)) (!expect (^multi (#try.Success verdict) verdict))))) diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux index 68f98ea13..017795418 100644 --- a/stdlib/source/test/lux/control/parser/environment.lux +++ b/stdlib/source/test/lux/control/parser/environment.lux @@ -29,7 +29,7 @@ (do random.monad [expected random.nat] (_.cover [/.run] - (|> (/.run (//\wrap expected) /.empty) + (|> (/.run (//\in expected) /.empty) (\ try.functor map (n.= expected)) (try.default false)))) (do random.monad @@ -43,11 +43,11 @@ (try.default false)))) (do random.monad [property (random.ascii/alpha 1)] - (_.cover [/.unknown] + (_.cover [/.unknown_property] (case (/.run (/.property property) /.empty) (#try.Success _) false (#try.Failure error) - (exception.match? /.unknown error)))) + (exception.match? /.unknown_property error)))) ))) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 46e0d4bda..84758e83b 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -135,12 +135,12 @@ (..should_fail (text.of_code invalid) /.alpha_num)))) (do {! random.monad} [expected ($_ random.either - (wrap text.tab) - (wrap text.vertical_tab) - (wrap text.space) - (wrap text.new_line) - (wrap text.carriage_return) - (wrap text.form_feed)) + (in text.tab) + (in text.vertical_tab) + (in text.space) + (in text.new_line) + (in text.carriage_return) + (in text.form_feed)) invalid (|> (random.unicode 1) (random.only (function (_ char) (not (or (text\= text.tab char) (text\= text.vertical_tab char) @@ -354,21 +354,21 @@ [pre /.offset _ /.any post /.offset] - (wrap [pre post]))) + (in [pre post]))) (!expect (#try.Success [0 1]))))) (do {! random.monad} [left (random.unicode 1) right (random.unicode 1) #let [input (format left right)]] - (_.cover [/.get_input] + (_.cover [/.remaining] (|> input (/.run (do <>.monad - [pre /.get_input + [pre /.remaining _ /.any - post /.get_input + post /.remaining _ /.any] - (wrap (and (text\= input pre) - (text\= right post))))) + (in (and (text\= input pre) + (text\= right post))))) (!expect (#try.Success #1))))) (do {! random.monad} [left (random.unicode 1) @@ -380,19 +380,19 @@ (/.run (/.enclosed [left right] (/.this expected))) (!expect (#try.Success _))))) (do {! random.monad} - [in (random.unicode 1) - out (random.unicode 1)] + [input (random.unicode 1) + output (random.unicode 1)] (_.cover [/.local] - (|> out + (|> output (/.run (do <>.monad - [_ (/.local in (/.this in))] - (/.this out))) + [_ (/.local input (/.this input))] + (/.this output))) (!expect (#try.Success _))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] - (_.cover [/.embed] + (_.cover [/.then] (|> (list (code.text expected)) - (.run (/.embed /.octal .text)) + (.run (/.then /.octal .text)) (!expect (^multi (#try.Success actual) (text\= expected actual)))))) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 37be6989c..c4c1ed0fa 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -202,7 +202,7 @@ (and (|> (/.run (do //.monad [actual /.peek _ /.any] - (wrap actual)) + (in actual)) expected) (!expect (^multi (#try.Success actual) (type\= expected actual)))) @@ -229,7 +229,7 @@ (|> (/.run (do //.monad [env /.env _ /.any] - (wrap env)) + (in env)) expected) (!expect (^multi (#try.Success environment) (is? /.fresh environment)))))) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 46d80dcc3..a6e7e7c2e 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -66,7 +66,7 @@ (!expect (^multi (#try.Success actual) (text\= expected actual)))))) (!failure /.unconsumed_inputs - [[(//\wrap expected) + [[(//\in expected) (#xml.Text expected)]]) (do {! random.monad} [expected (random.ascii/alpha 1)] @@ -79,17 +79,17 @@ (|> (/.run (do //.monad [actual /.tag _ /.ignore] - (wrap (name\= expected actual))) + (in (name\= expected actual))) (list (#xml.Node expected (dictionary.new name.hash) (list)))) (!expect (#try.Success #1))))) (do {! random.monad} [expected ..random_tag] (_.cover [/.node] - (|> (/.run (/.node expected (//\wrap [])) + (|> (/.run (/.node expected (//\in [])) (list (#xml.Node expected (dictionary.new name.hash) (list)))) (!expect (#try.Success []))))) (!failure /.wrong_tag - [[(/.node ["" expected] (//\wrap [])) + [[(/.node ["" expected] (//\in [])) (#xml.Node [expected ""] (dictionary.new name.hash) (list))]]) (do {! random.monad} [expected_tag ..random_tag @@ -98,7 +98,7 @@ (_.cover [/.attribute] (|> (/.run (<| (/.node expected_tag) (//.after (/.attribute expected_attribute)) - (//\wrap [])) + (//\in [])) (list (#xml.Node expected_tag (|> (dictionary.new name.hash) (dictionary.put expected_attribute expected_value)) @@ -122,7 +122,7 @@ [(do //.monad [_ /.ignore] (/.node [expected expected] - (//\wrap []))) + (//\in []))) (#xml.Node [expected expected] (dictionary.new name.hash) (list))] @@ -138,7 +138,7 @@ [[/.text (#xml.Node [expected expected] (dictionary.new name.hash) (list))] [(/.node [expected expected] - (//\wrap [])) + (//\in [])) (#xml.Text expected)] [(/.node [expected expected] (/.attribute [expected expected])) @@ -155,9 +155,9 @@ (do //.monad [_ (<| /.somewhere (/.node right) - (//\wrap [])) + (//\in [])) _ (//.some /.ignore)] - (wrap [])))] + (in [])))] repetitions (\ ! map (n.% 10) random.nat)] ($_ _.and (_.cover [/.somewhere] diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index 47ddbd8b2..833399ba7 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -52,9 +52,9 @@ (_.cover [/.with /.lift] (|> (: (/.Reader Any (IO Nat)) (do (/.with io.monad) - [a (/.lift (io\wrap sample)) - b (wrap factor)] - (wrap (n.* b a)))) + [a (/.lift (io\in sample)) + b (in factor)] + (in (n.* b a)))) (/.run []) io.run (n.= (n.* factor sample))))))))) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 61e67e81f..9bd903d71 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -104,16 +104,16 @@ count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] - (wrap (#try.Success []))))] + (in (#try.Success []))))] outcome (/.run ! (do {! (/.monad !)} [_ (monad.map ! (/.acquire //@ count_clean_up) (enum.range n.enum 1 expected_clean_ups))] - (wrap []))) + (in []))) actual_clean_ups (thread.read clean_up_counter)] - (wrap (and (..success? outcome) - (n.= expected_clean_ups - actual_clean_ups)))))) + (in (and (..success? outcome) + (n.= expected_clean_ups + actual_clean_ups)))))) (_.cover [/.failure] (thread.run (do {! thread.monad} @@ -122,18 +122,18 @@ count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] - (wrap (#try.Success []))))] + (in (#try.Success []))))] outcome (/.run ! (do {! (/.monad !)} [_ (monad.map ! (/.acquire //@ count_clean_up) (enum.range n.enum 1 expected_clean_ups)) _ (/.failure //@ (exception.construct ..oops []))] - (wrap []))) + (in []))) actual_clean_ups (thread.read clean_up_counter)] - (wrap (and (..throws? ..oops outcome) - (n.= expected_clean_ups - actual_clean_ups)))))) - (_.cover [/.throw] + (in (and (..throws? ..oops outcome) + (n.= expected_clean_ups + actual_clean_ups)))))) + (_.cover [/.except] (thread.run (do {! thread.monad} [clean_up_counter (thread.box 0) @@ -141,17 +141,17 @@ count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] - (wrap (#try.Success []))))] + (in (#try.Success []))))] outcome (/.run ! (do {! (/.monad !)} [_ (monad.map ! (/.acquire //@ count_clean_up) (enum.range n.enum 1 expected_clean_ups)) - _ (/.throw //@ ..oops [])] - (wrap []))) + _ (/.except //@ ..oops [])] + (in []))) actual_clean_ups (thread.read clean_up_counter)] - (wrap (and (..throws? ..oops outcome) - (n.= expected_clean_ups - actual_clean_ups)))))) + (in (and (..throws? ..oops outcome) + (n.= expected_clean_ups + actual_clean_ups)))))) (_.cover [/.acquire /.clean_up_error] (thread.run (do {! thread.monad} @@ -160,18 +160,18 @@ count_clean_up (function (_ value) (do ! [_ (thread.update inc clean_up_counter)] - (wrap (: (Try Any) - (exception.throw ..oops [])))))] + (in (: (Try Any) + (exception.except ..oops [])))))] outcome (/.run ! (do {! (/.monad !)} [_ (monad.map ! (/.acquire //@ count_clean_up) (enum.range n.enum 1 expected_clean_ups))] - (wrap []))) + (in []))) actual_clean_ups (thread.read clean_up_counter)] - (wrap (and (or (n.= 0 expected_clean_ups) - (..throws? /.clean_up_error outcome)) - (n.= expected_clean_ups - actual_clean_ups)))))) + (in (and (or (n.= 0 expected_clean_ups) + (..throws? /.clean_up_error outcome)) + (n.= expected_clean_ups + actual_clean_ups)))))) (_.cover [/.lift] (thread.run (do {! thread.monad} @@ -180,9 +180,9 @@ outcome (/.run ! (do (/.monad !) [_ (/.lift //@ (thread.write expected_clean_ups clean_up_counter))] - (wrap []))) + (in []))) actual_clean_ups (thread.read clean_up_counter)] - (wrap (and (..success? outcome) - (n.= expected_clean_ups - actual_clean_ups)))))) + (in (and (..success? outcome) + (n.= expected_clean_ups + actual_clean_ups)))))) )))) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index a96f993c9..5f62bac4b 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -76,33 +76,33 @@ should_fail1 (..attempt (macro.expand (to_remember macro yesterday message (#.Some expected)))) should_succeed0 (..attempt (macro.expand (to_remember macro tomorrow message #.None))) should_succeed1 (..attempt (macro.expand (to_remember macro tomorrow message (#.Some expected))))] - (wrap (list (code.bit (and (case should_fail0 - (#try.Failure error) - (and (test_failure yesterday message #.None error) - (text.contains? extra error)) + (in (list (code.bit (and (case should_fail0 + (#try.Failure error) + (and (test_failure yesterday message #.None error) + (text.contains? extra error)) - _ - false) - (case should_fail1 - (#try.Failure error) - (and (test_failure yesterday message (#.Some expected) error) - (text.contains? extra error)) + _ + false) + (case should_fail1 + (#try.Failure error) + (and (test_failure yesterday message (#.Some expected) error) + (text.contains? extra error)) - _ - false) - (case should_succeed0 - (^ (#try.Success (list))) - true + _ + false) + (case should_succeed0 + (^ (#try.Success (list))) + true - _ - false) - (case should_succeed1 - (^ (#try.Success (list actual))) - (is? expected actual) + _ + false) + (case should_succeed1 + (^ (#try.Success (list actual))) + (is? expected actual) - _ - false) - ))))))) + _ + false) + ))))))) (def: #export test Test diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux index 3547b27b1..008d6e798 100644 --- a/stdlib/source/test/lux/control/security/capability.lux +++ b/stdlib/source/test/lux/control/security/capability.lux @@ -37,9 +37,9 @@ [untouched actual] (/.use capability [pass_through base])] (and (is? pass_through untouched) (n.= expected actual)))) - (wrap (let [capability (..can_io (function (_ _) (io.io expected)))] - (do async.monad - [actual (/.use (/.async capability) [])] - (_.cover' [/.async] - (n.= expected actual))))) + (in (let [capability (..can_io (function (_ _) (io.io expected)))] + (do async.monad + [actual (/.use (/.async capability) [])] + (_.cover' [/.async] + (n.= expected actual))))) ))))) diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 577439ab5..0f6266635 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -30,7 +30,8 @@ (== (can_reveal left) (can_reveal right)))) -(type: Password (Private Text)) +(type: Password + (Private Text)) (interface: (Policy %) (: (Hash (Password %)) diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index a037f8a91..d537ca4de 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -85,7 +85,7 @@ [limit (|> random.nat (\ ! map (n.% 10))) #let [condition (do /.monad [state /.get] - (wrap (n.< limit state)))]] + (in (n.< limit state)))]] ($_ _.and (_.cover [/.while /.run] (|> (/.while condition (/.update inc)) @@ -111,9 +111,9 @@ (_.cover [/.State' /.with /.lift /.run'] (|> (: (/.State' io.IO Nat Nat) (do (/.with io.monad) - [a (/.lift io.monad (io\wrap left)) - b (wrap right)] - (wrap (n.+ a b)))) + [a (/.lift io.monad (io\in left)) + b (in right)] + (in (n.+ a b)))) (/.run' state) io.run (let> [state' output'] diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux index 43d755145..b7af2183f 100644 --- a/stdlib/source/test/lux/control/thread.lux +++ b/stdlib/source/test/lux/control/thread.lux @@ -19,7 +19,7 @@ (def: (injection value) (Injection (All [a !] (Thread ! a))) - (\ /.monad wrap value)) + (\ /.monad in value)) (def: comparison (Comparison (All [a !] (Thread ! a))) @@ -38,12 +38,12 @@ (_.cover [/.run] (n.= sample (|> sample - (\ /.monad wrap) + (\ /.monad in) /.run))) (_.cover [/.io] (n.= sample (|> sample - (\ /.monad wrap) + (\ /.monad in) /.io io.run))) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 882864ffd..4fbf42fd2 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -82,9 +82,9 @@ (_.cover [/.with /.lifted] (let [lifted (/.lifted io.monad)] (|> (do (/.with io.monad) - [a (lifted (io\wrap expected)) - b (wrap alternative)] - (wrap (n.+ a b))) + [a (lifted (io\in expected)) + b (in alternative)] + (in (n.+ a b))) io.run (case> (#/.Success result) (n.= (n.+ expected alternative) diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index 51f2ea36d..ddf6ecc00 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -54,9 +54,9 @@ (let [lift (/.lift text.monoid io.monad) (^open "io\.") io.monad] (|> (io.run (do (/.with text.monoid io.monad) - [a (lift (io\wrap left)) - b (wrap right)] - (wrap (n.+ a b)))) + [a (lift (io\in left)) + b (in right)] + (in (n.+ a b)))) product.right (n.= (n.+ left right))))) )))) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index 95576f815..8f07c3ad5 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -29,7 +29,7 @@ (template: (!bundle body) (: Test (do random.monad - [_ (wrap [])] + [_ (in [])] body))) (def: format diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 2a8f519fa..b8775be48 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -40,7 +40,7 @@ [byte random.nat] (exec (try.assumed (/.write/8 idx byte output)) (recur (inc idx)))) - (\ random.monad wrap output))))) + (\ random.monad in output))))) (def: (throws? exception try) (All [e a] (-> (Exception e) (Try a) Bit)) @@ -64,8 +64,8 @@ [pre (read 0 binary) _ (write 0 value binary) post (read 0 binary)] - (wrap (and (n.= 0 pre) - (n.= capped_value post))))) + (in (and (n.= 0 pre) + (n.= capped_value post))))) (throws? /.index_out_of_bounds (read 1 binary)) (throws? /.index_out_of_bounds (write 1 value binary))))) @@ -158,6 +158,6 @@ copy (/.copy 1 0 sample 0 (/.create 2)) copy/0 (/.read/8 0 copy) copy/1 (/.read/8 1 copy)] - (wrap (and (n.= sample/0 copy/0) - (n.= 0 copy/1))))))) + (in (and (n.= sample/0 copy/0) + (n.= 0 copy/1))))))) ))))) diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux index 3e8b89d2a..402f52379 100644 --- a/stdlib/source/test/lux/data/collection/bits.lux +++ b/stdlib/source/test/lux/data/collection/bits.lux @@ -24,10 +24,10 @@ (do {! random.monad} [size (\ ! map (n.% 1,000) random.nat)] (case size - 0 (wrap /.empty) + 0 (in /.empty) _ (do {! random.monad} [idx (|> random.nat (\ ! map (n.% size)))] - (wrap (/.set idx /.empty)))))) + (in (/.set idx /.empty)))))) (def: #export test Test @@ -63,8 +63,8 @@ (and (n.= 0 (/.capacity /.empty)) (|> /.empty (/.set idx) /.capacity (n.- idx) - (predicate.unite (n.>= 0) - (n.< /.chunk_size))) + (predicate.or (n.>= 0) + (n.< /.chunk_size))) (let [grown (/.flip idx /.empty)] (and (n.> 0 (/.capacity grown)) (is? /.empty (/.flip idx grown)))))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 19c6bfde6..0b98204a9 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -27,7 +27,7 @@ (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) (case size 0 - (random\wrap (/.new order)) + (random\in (/.new order)) _ (do random.monad @@ -35,7 +35,7 @@ key (random.only (|>> (/.key? partial) not) gen_key) value gen_value] - (wrap (/.put key value partial))))) + (in (/.put key value partial))))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index f7450e3d1..7916da3eb 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.zipped/2 (set.to_list keys) values)))) + (in (list.zipped/2 (set.to_list keys) values)))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index f3175fbb5..207ba73d9 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -57,13 +57,13 @@ (_.for [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid ..random)) (_.for [/.fold] - ($fold.spec /\wrap /.equivalence /.fold)) + ($fold.spec /\in /.equivalence /.fold)) (_.for [/.functor] - ($functor.spec /\wrap /.equivalence /.functor)) + ($functor.spec /\in /.equivalence /.functor)) (_.for [/.apply] - ($apply.spec /\wrap /.equivalence /.apply)) + ($apply.spec /\in /.equivalence /.apply)) (_.for [/.monad] - ($monad.spec /\wrap /.equivalence /.monad)) + ($monad.spec /\in /.equivalence /.monad)) (do {! random.monad} [parameter random.nat @@ -73,9 +73,9 @@ expected (n.+ parameter subject)] (_.cover [/.with /.lift] (|> (io.run (do (/.with io.monad) - [a (lift (io\wrap parameter)) - b (wrap subject)] - (wrap (n.+ a b)))) + [a (lift (io\in parameter)) + b (in subject)] + (in (n.+ a b)))) (case> (^ (list actual)) (n.= expected actual) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index a43b0e278..06238c4c8 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -21,7 +21,7 @@ (monad.fold ! (function (_ head tail) (do ! [priority random.nat] - (wrap (/.push priority head tail)))) + (in (/.push priority head tail)))) /.empty inputs))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index fdd2c6276..407fcde8e 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -36,13 +36,13 @@ (_.for [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.row size random.nat))) (_.for [/.fold] - ($fold.spec /\wrap /.equivalence /.fold)) + ($fold.spec /\in /.equivalence /.fold)) (_.for [/.functor] - ($functor.spec /\wrap /.equivalence /.functor)) + ($functor.spec /\in /.equivalence /.functor)) (_.for [/.apply] - ($apply.spec /\wrap /.equivalence /.apply)) + ($apply.spec /\in /.equivalence /.apply)) (_.for [/.monad] - ($monad.spec /\wrap /.equivalence /.monad)) + ($monad.spec /\in /.equivalence /.monad)) ))) (def: whole @@ -103,14 +103,14 @@ (do try.monad [sample (/.put good_index non_member sample) actual (/.nth good_index sample)] - (wrap (is? non_member actual))))) + (in (is? non_member actual))))) (_.cover [/.update] (<| (try.default false) (do try.monad [sample (/.put good_index non_member sample) sample (/.update good_index inc sample) actual (/.nth good_index sample)] - (wrap (n.= (inc non_member) actual))))) + (in (n.= (inc non_member) actual))))) (_.cover [/.within_bounds?] (and (/.within_bounds? sample good_index) (not (/.within_bounds? sample bad_index)))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 05752d6fa..197f35e93 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -30,11 +30,11 @@ (do {! random.monad} [elements (random.set hash size element) element_counts (random.list size ..count)] - (wrap (list\fold (function (_ [count element] set) - (/.add count element set)) - (/.new hash) - (list.zipped/2 element_counts - (set.to_list elements)))))) + (in (list\fold (function (_ [count element] set) + (/.add count element set)) + (/.new hash) + (list.zipped/2 element_counts + (set.to_list elements)))))) (def: signature Test diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 260ab946f..0614a1938 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -27,14 +27,14 @@ (All [a] (-> Nat (Order a) (Random a) (Random (Set a)))) (case size 0 - (random\wrap (/.new &order)) + (random\in (/.new &order)) _ (do random.monad [partial (random (dec size) &order gen_value) value (random.only (|>> (/.member? partial) not) gen_value)] - (wrap (/.add value partial))))) + (in (/.add value partial))))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index a610fdef5..a263b2451 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -25,11 +25,11 @@ [value gen_value num_children (\ ! map (n.% 2) random.nat) children (random.list num_children (tree gen_value))] - (wrap [(|> children - (list\map product.left) - (list\fold n.+ 1)) - {#/.value value - #/.children (list\map product.right children)}]))) + (in [(|> children + (list\map product.left) + (list\fold n.+ 1)) + {#/.value value + #/.children (list\map product.right children)}]))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 6487e5685..35b55f4bf 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -36,7 +36,7 @@ /.zip (do> maybe.monad [/.down] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.up] (|> (tree.branch expected (list (tree.leaf dummy))) @@ -44,7 +44,7 @@ (do> maybe.monad [/.down] [/.up] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.right] (|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected))) @@ -52,7 +52,7 @@ (do> maybe.monad [/.down] [/.right] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.rightmost] (|> (tree.branch dummy @@ -64,7 +64,7 @@ (do> maybe.monad [/.down] [/.rightmost] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.left] (|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy))) @@ -73,7 +73,7 @@ [/.down] [/.right] [/.left] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.leftmost] (|> (tree.branch dummy @@ -86,7 +86,7 @@ [/.down] [/.rightmost] [/.leftmost] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.next] (and (|> (tree.branch dummy @@ -95,7 +95,7 @@ /.zip (do> maybe.monad [/.next] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false)) (|> (tree.branch dummy (list (tree.leaf dummy) @@ -104,7 +104,7 @@ (do> maybe.monad [/.next] [/.next] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false)))) (_.cover [/.end] (|> (tree.branch dummy @@ -115,7 +115,7 @@ /.zip (do> maybe.monad [/.end] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.start] (|> (tree.branch expected @@ -127,7 +127,7 @@ (do> maybe.monad [/.end] [/.start] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.previous] (and (|> (tree.branch expected @@ -137,7 +137,7 @@ (do> maybe.monad [/.next] [/.previous] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false)) (|> (tree.branch dummy (list (tree.leaf expected) @@ -147,7 +147,7 @@ [/.next] [/.next] [/.previous] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false)))) ))) @@ -207,13 +207,13 @@ (|> cursor (do> maybe.monad [/.down] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false)) (|> cursor (do> maybe.monad [/.down] [/.down] - [/.value (n.= dummy) wrap]) + [/.value (n.= dummy) in]) (maybe.default false))))) (_.cover [/.adopt] (let [cursor (|> (tree.branch dummy (list (tree.leaf dummy))) @@ -223,13 +223,13 @@ (|> cursor (do> maybe.monad [/.down] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false)) (|> cursor (do> maybe.monad [/.down] [/.right] - [/.value (n.= dummy) wrap]) + [/.value (n.= dummy) in]) (maybe.default false))))) (_.cover [/.insert_left] (|> (tree.branch dummy (list (tree.leaf dummy))) @@ -238,7 +238,7 @@ [/.down] [(/.insert_left expected)] [/.left] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.insert_right] (|> (tree.branch dummy (list (tree.leaf dummy))) @@ -247,7 +247,7 @@ [/.down] [(/.insert_right expected)] [/.right] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) (_.cover [/.remove] (|> (tree.branch dummy (list (tree.leaf dummy))) @@ -256,6 +256,6 @@ [/.down] [(/.insert_left expected)] [/.remove] - [/.value (n.= expected) wrap]) + [/.value (n.= expected) in]) (maybe.default false))) )))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 22dce27f1..e9acae043 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -38,7 +38,7 @@ (do {! random.monad} [size (\ ! map (n.% 2) random.nat)] ($_ random.or - (\ ! wrap []) + (\ ! in []) random.bit random.safe_frac (random.unicode size) @@ -49,17 +49,17 @@ (syntax: (boolean) (do meta.monad [value meta.count] - (wrap (list (code.bit (n.even? value)))))) + (in (list (code.bit (n.even? value)))))) (syntax: (number) (do meta.monad [value meta.count] - (wrap (list (code.frac (n.frac value)))))) + (in (list (code.frac (n.frac value)))))) (syntax: (string) (do meta.monad [value (macro.gensym "string")] - (wrap (list (code.text (%.code value)))))) + (in (list (code.text (%.code value)))))) (def: #export test Test @@ -132,8 +132,8 @@ (#try.Failure error) true)]] - (wrap (and can_find_known_key! - cannot_find_unknown_key!)))))) + (in (and can_find_known_key! + cannot_find_unknown_key!)))))) (~~ (template [ ] [(do random.monad [key (random.ascii/alpha 1) @@ -189,11 +189,11 @@ value4 (/.get object) value5 (/.get object) value6 (/.get value5)] - (wrap (and (\= #/.Null value0) - (\= (#/.Boolean ) value1) - (\= (#/.Number ) value2) - (\= (#/.String ) value3) - (\= (#/.Array ) value4) - (\= (#/.Number ) value6)))))) + (in (and (\= #/.Null value0) + (\= (#/.Boolean ) value1) + (\= (#/.Number ) value2) + (\= (#/.String ) value3) + (\= (#/.Array ) value4) + (\= (#/.Number ) value6)))))) ))) )))) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index fedcdd251..8dfe9635d 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -174,13 +174,13 @@ tar (|> (row.row ( expected_path)) (format.run /.writer) (.run /.parser))] - (wrap (case (row.to_list tar) - (^ (list ( actual_path))) - (text\= (/.from_path expected_path) - (/.from_path actual_path)) + (in (case (row.to_list tar) + (^ (list ( actual_path))) + (text\= (/.from_path expected_path) + (/.from_path actual_path)) - _ - false))) + _ + false))) (try.default false)))] [/.Symbolic_Link #/.Symbolic_Link] @@ -203,19 +203,19 @@ expected_content])) (format.run /.writer) (.run /.parser))] - (wrap (case (row.to_list tar) - (^ (list ( [actual_path actual_moment actual_mode actual_ownership actual_content]))) - (let [seconds (: (-> Instant Int) - (|>> instant.relative (duration.query duration.second)))] - (and (text\= (/.from_path expected_path) - (/.from_path actual_path)) - (i.= (seconds expected_moment) - (seconds actual_moment)) - (binary\= (/.data expected_content) - (/.data actual_content)))) - - _ - false))) + (in (case (row.to_list tar) + (^ (list ( [actual_path actual_moment actual_mode actual_ownership actual_content]))) + (let [seconds (: (-> Instant Int) + (|>> instant.relative (duration.query duration.second)))] + (and (text\= (/.from_path expected_path) + (/.from_path actual_path)) + (i.= (seconds expected_moment) + (seconds actual_moment)) + (binary\= (/.data expected_content) + (/.data actual_content)))) + + _ + false))) (try.default false)))] [/.Normal #/.Normal] @@ -226,18 +226,18 @@ (Random /.Mode) (do {! random.monad} [] - (random.either (random.either (random.either (wrap /.execute_by_other) - (wrap /.write_by_other)) - (random.either (wrap /.read_by_other) - (wrap /.execute_by_group))) - (random.either (random.either (random.either (wrap /.write_by_group) - (wrap /.read_by_group)) - (random.either (wrap /.execute_by_owner) - (wrap /.write_by_owner))) - (random.either (random.either (wrap /.read_by_owner) - (wrap /.save_text)) - (random.either (wrap /.set_group_id_on_execution) - (wrap /.set_user_id_on_execution))))))) + (random.either (random.either (random.either (in /.execute_by_other) + (in /.write_by_other)) + (random.either (in /.read_by_other) + (in /.execute_by_group))) + (random.either (random.either (random.either (in /.write_by_group) + (in /.read_by_group)) + (random.either (in /.execute_by_owner) + (in /.write_by_owner))) + (random.either (random.either (in /.read_by_owner) + (in /.save_text)) + (random.either (in /.set_group_id_on_execution) + (in /.set_user_id_on_execution))))))) (def: mode Test @@ -261,13 +261,13 @@ content])) (format.run /.writer) (.run /.parser))] - (wrap (case (row.to_list tar) - (^ (list (#/.Normal [_ _ actual_mode _ _]))) - (n.= (/.mode expected_mode) - (/.mode actual_mode)) + (in (case (row.to_list tar) + (^ (list (#/.Normal [_ _ actual_mode _ _]))) + (n.= (/.mode expected_mode) + (/.mode actual_mode)) - _ - false))) + _ + false))) (try.default false))) (~~ (template [] [(_.cover [] @@ -284,13 +284,13 @@ content])) (format.run /.writer) (.run /.parser))] - (wrap (case (row.to_list tar) - (^ (list (#/.Normal [_ _ actual_mode _ _]))) - (n.= (/.mode ) - (/.mode actual_mode)) + (in (case (row.to_list tar) + (^ (list (#/.Normal [_ _ actual_mode _ _]))) + (n.= (/.mode ) + (/.mode actual_mode)) - _ - false))) + _ + false))) (try.default false)))] [/.none] @@ -351,15 +351,15 @@ content])) (format.run /.writer) (.run /.parser))] - (wrap (case (row.to_list tar) - (^ (list (#/.Normal [_ _ _ actual_ownership _]))) - (and (text\= (/.from_name expected) - (/.from_name (get@ [#/.user #/.name] actual_ownership))) - (text\= (/.from_name /.anonymous) - (/.from_name (get@ [#/.group #/.name] actual_ownership)))) - - _ - false))) + (in (case (row.to_list tar) + (^ (list (#/.Normal [_ _ _ actual_ownership _]))) + (and (text\= (/.from_name expected) + (/.from_name (get@ [#/.user #/.name] actual_ownership))) + (text\= (/.from_name /.anonymous) + (/.from_name (get@ [#/.group #/.name] actual_ownership)))) + + _ + false))) (try.default false))) (_.cover [/.anonymous /.no_id] (|> (do try.monad @@ -375,19 +375,19 @@ content])) (format.run /.writer) (.run /.parser))] - (wrap (case (row.to_list tar) - (^ (list (#/.Normal [_ _ _ actual_ownership _]))) - (and (text\= (/.from_name /.anonymous) - (/.from_name (get@ [#/.user #/.name] actual_ownership))) - (n.= (/.from_small /.no_id) - (/.from_small (get@ [#/.user #/.id] actual_ownership))) - (text\= (/.from_name /.anonymous) - (/.from_name (get@ [#/.group #/.name] actual_ownership))) - (n.= (/.from_small /.no_id) - (/.from_small (get@ [#/.group #/.id] actual_ownership)))) - - _ - false))) + (in (case (row.to_list tar) + (^ (list (#/.Normal [_ _ _ actual_ownership _]))) + (and (text\= (/.from_name /.anonymous) + (/.from_name (get@ [#/.user #/.name] actual_ownership))) + (n.= (/.from_small /.no_id) + (/.from_small (get@ [#/.user #/.id] actual_ownership))) + (text\= (/.from_name /.anonymous) + (/.from_name (get@ [#/.group #/.name] actual_ownership))) + (n.= (/.from_small /.no_id) + (/.from_small (get@ [#/.group #/.id] actual_ownership)))) + + _ + false))) (try.default false))) )))) @@ -396,7 +396,7 @@ (<| (_.covering /._) (_.for [/.Tar]) (do random.monad - [_ (wrap [])] + [_ (in [])] ($_ _.and (_.cover [/.writer /.parser] (|> row.empty diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 7c9267b16..e73e4960a 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -37,7 +37,7 @@ (Random Nat) (do {! random.monad} [idx (|> random.nat (\ ! map (n.% (text.size char_range))))] - (wrap (maybe.assume (text.nth idx char_range))))) + (in (maybe.assume (text.nth idx char_range))))) (def: (size bottom top) (-> Nat Nat (Random Nat)) diff --git a/stdlib/source/test/lux/data/maybe.lux b/stdlib/source/test/lux/data/maybe.lux index 899541f37..c2baca4fa 100644 --- a/stdlib/source/test/lux/data/maybe.lux +++ b/stdlib/source/test/lux/data/maybe.lux @@ -39,11 +39,11 @@ (_.for [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) (_.for [/.functor] - ($functor.spec /\wrap /.equivalence /.functor)) + ($functor.spec /\in /.equivalence /.functor)) (_.for [/.apply] - ($apply.spec /\wrap /.equivalence /.apply)) + ($apply.spec /\in /.equivalence /.apply)) (_.for [/.monad] - ($monad.spec /\wrap /.equivalence /.monad)) + ($monad.spec /\in /.equivalence /.monad)) (do random.monad [left random.nat @@ -52,9 +52,9 @@ (let [lift (/.lift io.monad)] (_.cover [/.with /.lift] (|> (io.run (do (/.with io.monad) - [a (lift (io\wrap left)) - b (wrap right)] - (wrap (n.+ a b)))) + [a (lift (io\in left)) + b (in right)] + (in (n.+ a b)))) (case> (#.Some actual) (n.= expected actual) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 3b7f83b72..11a68ea33 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -215,7 +215,7 @@ (let [options (list.size ..all_encodings)] (do {! random.monad} [choice (\ ! map (n.% options) random.nat)] - (wrap (maybe.assume (list.nth choice ..all_encodings)))))) + (in (maybe.assume (list.nth choice ..all_encodings)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 203cf9b81..73f9455d7 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -74,10 +74,10 @@ [seed meta.count #let [[_ expected] (random.run (random.pcg32 [seed seed]) (random.ascii 10))]] - (wrap (list (code.text expected))))) + (in (list (code.text expected))))) (syntax: (static_escape {un_escaped .text}) - (wrap (list (code.text (/.escape un_escaped))))) + (in (list (code.text (/.escape un_escaped))))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index d339e0717..e8cdb1e67 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -62,11 +62,11 @@ (Random (Ex [a] [(/.Format a) (Random a)])) ($_ random.either - (random\wrap [/.bit random.bit]) - (random\wrap [/.nat random.nat]) - (random\wrap [/.int random.int]) - (random\wrap [/.rev random.rev]) - (random\wrap [/.frac random.frac]) + (random\in [/.bit random.bit]) + (random\in [/.nat random.nat]) + (random\in [/.int random.int]) + (random\in [/.rev random.rev]) + (random\in [/.frac random.frac]) )) (def: codec diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 50498f396..52053f108 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -53,13 +53,13 @@ (syntax: (should_check pattern regex input) (macro.with_gensyms [g!message g!_] - (wrap (list (` (|> (~ input) - (.run (~ regex)) - (case> (^ (#try.Success (~ pattern))) - true + (in (list (` (|> (~ input) + (.run (~ regex)) + (case> (^ (#try.Success (~ pattern))) + true - (~ g!_) - false))))))) + (~ g!_) + false))))))) (def: basics Test diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index b895df0de..d08f41fa8 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -27,7 +27,7 @@ (do random.monad [start random.nat end random.nat] - (wrap (/.block start end)))) + (in (/.block start end)))) (with_expansions [ (as_is [blocks/0 [/.basic_latin diff --git a/stdlib/source/test/lux/data/text/unicode/set.lux b/stdlib/source/test/lux/data/text/unicode/set.lux index e70816efe..054c6c6f7 100644 --- a/stdlib/source/test/lux/data/text/unicode/set.lux +++ b/stdlib/source/test/lux/data/text/unicode/set.lux @@ -28,7 +28,7 @@ (do {! random.monad} [left //block.random right //block.random] - (wrap (/.set [left (list right)])))) + (in (/.set [left (list right)])))) (def: #export test Test diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index c55928c15..638afd90f 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -55,18 +55,18 @@ sample_text (random.ascii/upper 10) sample_nat random.nat sample_rev random.rev] - (wrap (`` (and (~~ (template [ ] - [(|> (/.representation ) - (try\map (text\= ( ))) - (try.default false))] + (in (`` (and (~~ (template [ ] + [(|> (/.representation ) + (try\map (text\= ( ))) + (try.default false))] - [Bit %.bit sample_bit] - [Nat %.nat sample_nat] - [Int %.int sample_int] - [Rev %.rev sample_rev] - [Frac %.frac sample_frac] - [Text %.text sample_text])) - ))))) + [Bit %.bit sample_bit] + [Nat %.nat sample_nat] + [Int %.int sample_int] + [Rev %.rev sample_rev] + [Frac %.frac sample_frac] + [Text %.text sample_text])) + ))))) (def: can_represent_structure_types (Random Bit) @@ -74,32 +74,32 @@ [sample_bit random.bit sample_int random.int sample_frac random.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) - " " (%.frac sample_frac) - "]") - actual) + (in (`` (and (case (/.representation (type [Bit Int Frac]) + [sample_bit sample_int sample_frac]) + (#try.Success actual) + (text\= (format "[" (%.bit sample_bit) + " " (%.int sample_int) + " " (%.frac sample_frac) + "]") + actual) - (#try.Failure error) - false) - ## TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants - ## (~~ (template [ ] - ## [(|> (/.representation (type (| Bit Int Frac)) - ## (: (| Bit Int Frac) - ## ( ))) - ## (try\map (text\= (format "(" (%.nat ) - ## " " (%.bit ) - ## " " ( ) ")"))) - ## (try.default false))] + (#try.Failure error) + false) + ## TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants + ## (~~ (template [ ] + ## [(|> (/.representation (type (| Bit Int Frac)) + ## (: (| Bit Int Frac) + ## ( ))) + ## (try\map (text\= (format "(" (%.nat ) + ## " " (%.bit ) + ## " " ( ) ")"))) + ## (try.default false))] - ## [0 #0 sample_bit %.bit] - ## [1 #0 sample_int %.int] - ## [1 #1 sample_frac %.frac] - ## )) - ))))) + ## [0 #0 sample_bit %.bit] + ## [1 #0 sample_int %.int] + ## [1 #1 sample_frac %.frac] + ## )) + ))))) (def: can_represent_complex_types (Random Bit) @@ -111,19 +111,19 @@ sample_code $//code.random sample_xml $//xml.random sample_json $//json.random] - (wrap (`` (and (~~ (template [ ] - [(|> (/.representation ) - (try\map (text\= ( ))) - (try.default false))] + (in (`` (and (~~ (template [ ] + [(|> (/.representation ) + (try\map (text\= ( ))) + (try.default false))] - [Ratio %.ratio sample_ratio] - [Name %.name sample_name] - [Location %.location sample_location] - [Code %.code sample_code] - [Type %.type sample_type] - [XML %.xml sample_xml] - [JSON %.json sample_json])) - ))))) + [Ratio %.ratio sample_ratio] + [Name %.name sample_name] + [Location %.location sample_location] + [Code %.code sample_code] + [Type %.type sample_type] + [XML %.xml sample_xml] + [JSON %.json sample_json])) + ))))) (def: can_represent_time_types (Random Bit) @@ -134,18 +134,18 @@ sample_month random.month sample_time random.time sample_day random.day] - (wrap (`` (and (~~ (template [ ] - [(|> (/.representation ) - (try\map (text\= ( ))) - (try.default false))] + (in (`` (and (~~ (template [ ] + [(|> (/.representation ) + (try\map (text\= ( ))) + (try.default false))] - [Instant %.instant sample_instant] - [Duration %.duration sample_duration] - [Date %.date sample_date] - [Month %.month sample_month] - [Time %.time sample_time] - [Day %.day sample_day])) - ))))) + [Instant %.instant sample_instant] + [Duration %.duration sample_duration] + [Date %.date sample_date] + [Month %.month sample_month] + [Time %.time sample_time] + [Day %.day sample_day])) + ))))) (def: representation Test diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 39597a8a3..bab7b9007 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -89,13 +89,13 @@ (phase archive pass_through))) (analysis: (..dummy_generation self phase archive) - (\ phase.monad wrap (#analysis.Extension self (list)))) + (\ phase.monad in (#analysis.Extension self (list)))) (synthesis: (..dummy_generation self phase archive) - (\ phase.monad wrap (#synthesis.Extension self (list)))) + (\ phase.monad in (#synthesis.Extension self (list)))) (generation: (..dummy_generation self phase archive) - (\ phase.monad wrap + (\ phase.monad in (for {@.jvm (row.row (#jvm.Constant (#jvm.LDC (#jvm.String self)))) @@ -110,7 +110,7 @@ (directive: (..my_directive self phase archive {parameters (<>.some .any)}) (do phase.monad [#let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] - (wrap directive.no_requirements))) + (in directive.no_requirements))) (`` ((~~ (static ..my_directive)))) )) diff --git a/stdlib/source/test/lux/locale.lux b/stdlib/source/test/lux/locale.lux index 3bb0be6ab..298b4cf7d 100644 --- a/stdlib/source/test/lux/locale.lux +++ b/stdlib/source/test/lux/locale.lux @@ -24,18 +24,18 @@ (def: random_language (Random Language) - (random.either (random\wrap language.afar) - (random\wrap language.zaza))) + (random.either (random\in language.afar) + (random\in language.zaza))) (def: random_territory (Random Territory) - (random.either (random\wrap territory.afghanistan) - (random\wrap territory.zimbabwe))) + (random.either (random\in territory.afghanistan) + (random\in territory.zimbabwe))) (def: random_encoding (Random Encoding) - (random.either (random\wrap encoding.ascii) - (random\wrap encoding.koi8_u))) + (random.either (random\in encoding.ascii) + (random\in encoding.koi8_u))) (def: random_locale (Random /.Locale) @@ -43,7 +43,7 @@ [language ..random_language territory ..random_territory encoding ..random_encoding] - (wrap (/.locale language (#.Some territory) (#.Some encoding))))) + (in (/.locale language (#.Some territory) (#.Some encoding))))) (def: #export test Test diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index df8f798c6..3bbae852f 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -282,7 +282,7 @@ (do {! random.monad} [choice (\ ! map (n.% (list.size options)) random.nat)] - (wrap (maybe.assume (list.nth choice options)))))) + (in (maybe.assume (list.nth choice options)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 381c8f673..10619ea9f 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -208,7 +208,7 @@ (do {! random.monad} [choice (\ ! map (n.% (list.size options)) random.nat)] - (wrap (maybe.assume (list.nth choice options)))))) + (in (maybe.assume (list.nth choice options)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 98d3ead2b..20db9b265 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -43,18 +43,18 @@ [(template.text []) (#.Definition [true .Macro (' []) ])])) (syntax: (pow/2 number) - (wrap (list (` (nat.* (~ number) (~ number)))))) + (in (list (` (nat.* (~ number) (~ number)))))) (syntax: (pow/4 number) - (wrap (list (` (..pow/2 (..pow/2 (~ number))))))) + (in (list (` (..pow/2 (..pow/2 (~ number))))))) (syntax: (repeat {times .nat} token) - (wrap (list.repeat times token))) + (in (list.repeat times token))) (syntax: (fresh_identifier) (do meta.monad [g!fresh (/.gensym "fresh")] - (wrap (list g!fresh)))) + (in (list g!fresh)))) (def: random_lux (Random [Nat Text .Lux]) @@ -63,47 +63,47 @@ gensym_prefix (random.ascii/upper 1) #let [macro_module (name.module (name_of /._)) current_module (name.module (name_of .._))]] - (wrap [seed - gensym_prefix - {#.info {#.target "" - #.version "" - #.mode #.Build} - #.source [location.dummy 0 ""] - #.location location.dummy - #.current_module (#.Some current_module) - #.modules (list [macro_module - {#.module_hash 0 - #.module_aliases (list) - #.definitions (: (List [Text .Global]) - (list (!global /.log_expand_once!) - (!global /.log_expand!) - (!global /.log_expand_all!))) - #.imports (list) - #.tags (list) - #.types (list) - #.module_annotations #.None - #.module_state #.Active}] - [current_module - {#.module_hash 0 - #.module_aliases (list) - #.definitions (: (List [Text .Global]) - (list (!global ..pow/2) - (!global ..pow/4) - (!global ..repeat))) - #.imports (list) - #.tags (list) - #.types (list) - #.module_annotations #.None - #.module_state #.Active}]) - #.scopes (list) - #.type_context {#.ex_counter 0 - #.var_counter 0 - #.var_bindings (list)} - #.expected #.None - #.seed seed - #.scope_type_vars (list) - #.extensions [] - #.host []}]))) + (in [seed + gensym_prefix + {#.info {#.target "" + #.version "" + #.mode #.Build} + #.source [location.dummy 0 ""] + #.location location.dummy + #.current_module (#.Some current_module) + #.modules (list [macro_module + {#.module_hash 0 + #.module_aliases (list) + #.definitions (: (List [Text .Global]) + (list (!global /.log_expand_once!) + (!global /.log_expand!) + (!global /.log_expand_all!))) + #.imports (list) + #.tags (list) + #.types (list) + #.module_annotations #.None + #.module_state #.Active}] + [current_module + {#.module_hash 0 + #.module_aliases (list) + #.definitions (: (List [Text .Global]) + (list (!global ..pow/2) + (!global ..pow/4) + (!global ..repeat))) + #.imports (list) + #.tags (list) + #.types (list) + #.module_annotations #.None + #.module_state #.Active}]) + #.scopes (list) + #.type_context {#.ex_counter 0 + #.var_counter 0 + #.var_bindings (list)} + #.expected #.None + #.seed seed + #.scope_type_vars (list) + #.extensions [] + #.host []}]))) (def: expander Test @@ -171,7 +171,7 @@ (_.cover [/.with_gensyms] (with_expansions [ (fresh_identifier)] (|> (/.with_gensyms [] - (\ meta.monad wrap )) + (\ meta.monad in )) (meta.run lux) (!expect (^multi (#try.Success [_ (#.Identifier ["" actual])]) (text.contains? (template.text []) diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 1a99aae83..5d5f9121a 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -87,10 +87,10 @@ (function (_ to_code) (do {! random.monad} [parts (..random_sequence replace_simulation)] - (wrap [(to_code (list\map product.left parts)) - (to_code (list\map product.right parts))]))))] + (in [(to_code (list\map product.left parts)) + (to_code (list\map product.right parts))]))))] ($_ random.either - (random\wrap [original substitute]) + (random\in [original substitute]) (do {! random.monad} [sample (random.only (|>> (\ /.equivalence = original) not) ($_ random.either @@ -102,15 +102,15 @@ (random\map /.text ..random_text) (random\map /.identifier ..random_name) (random\map /.tag ..random_name)))] - (wrap [sample sample])) + (in [sample sample])) (for_sequence /.form) (for_sequence /.tuple) (do {! random.monad} [parts (..random_sequence replace_simulation)] - (wrap [(/.record (let [parts' (list\map product.left parts)] - (list.zipped/2 parts' parts'))) - (/.record (let [parts' (list\map product.right parts)] - (list.zipped/2 parts' parts')))])) + (in [(/.record (let [parts' (list\map product.left parts)] + (list.zipped/2 parts' parts'))) + (/.record (let [parts' (list\map product.right 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 65e8e62f5..37b718a8e 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -56,13 +56,13 @@ (function (_ lux) (#try.Success [(update@ #.modules (plist.update module remove_macro!) lux) []]))) - (wrap []))] + (in []))] (let [pre_expansion (` (let [(~ g!output) (~ body)] (exec (~ pop!) (~ g!output))))] (if pre_remove (macro.expand_all pre_expansion) - (wrap (list pre_expansion))))))) + (in (list pre_expansion))))))) (def: #export test Test diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux index 35d680974..49ba85da7 100644 --- a/stdlib/source/test/lux/macro/syntax.lux +++ b/stdlib/source/test/lux/macro/syntax.lux @@ -21,7 +21,7 @@ ["#/." variable]]]) (/.syntax: (+/3 a b c) - (wrap (list (` ($_ n.+ (~ a) (~ b) (~ c)))))) + (in (list (` ($_ n.+ (~ a) (~ b) (~ c)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 9c7cca0ee..0beb03ada 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -314,8 +314,8 @@ #let [bottom (r.min threshold_0 threshold_1) top (r.max threshold_0 threshold_1)]] - (wrap [[bottom top] - (/.gradient bottom top)]))) + (in [[bottom top] + (/.gradient bottom top)]))) (def: threshold Test diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 3f313bd12..e8865d207 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -42,8 +42,8 @@ [param\\% ($//.random +1,000,000) param (..random param\\%) - subject\\% (random.only (predicate.intersect (|>> //.divisor (i.> +2)) - (|>> (//.= param\\%) not)) + subject\\% (random.only (predicate.and (|>> //.divisor (i.> +2)) + (|>> (//.= param\\%) not)) ($//.random +1,000,000)) subject (..random subject\\%) another (..random subject\\%)] @@ -109,11 +109,11 @@ (do try.monad [copy\\% (//.modulus (//.divisor subject\\%)) adapt (/.adapter subject\\% copy\\%)] - (wrap (|> subject - /.value - (/.modular copy\\%) - adapt - (/.= subject)))))) + (in (|> subject + /.value + (/.modular copy\\%) + adapt + (/.= subject)))))) (_.cover [/.moduli_are_not_equal] (case (/.adapter subject\\% param\\%) (#try.Failure error) diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 8679cdb70..16fcdba76 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -21,9 +21,9 @@ (syntax: (|divisor|) (do meta.monad [divisor meta.count] - (wrap (list (code.int (case divisor - 0 +1 - _ (.int divisor))))))) + (in (list (code.int (case divisor + 0 +1 + _ (.int divisor))))))) (def: #export (random range) (Ex [%] (-> Int (Random (/.Modulus %)))) diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index a1ebf331d..e5f43c47d 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -30,15 +30,15 @@ (do {! random.monad} [factor (|> random.nat (\ ! map (|>> (n.% 1000) (n.max 1)))) measure (|> random.safe_frac (random.only (f.> +0.0)))] - (wrap (f.* (|> factor .int int.frac) - measure)))) + (in (f.* (|> factor .int int.frac) + measure)))) (def: #export random (Random /.Complex) (do random.monad [real ..dimension imaginary ..dimension] - (wrap (/.complex real imaginary)))) + (in (/.complex real imaginary)))) (def: angle (Random /.Complex) diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index c78db2b86..b4c9799cc 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -31,7 +31,7 @@ [numerator ..part denominator (random.only (|>> (n.= 0) not) ..part)] - (wrap (/.ratio numerator denominator)))) + (in (/.ratio numerator denominator)))) (def: #export test Test diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 4010b9ce1..43a7ec41a 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -68,12 +68,12 @@ #.host []}]] ($_ _.and (_.cover [/.run] - (|> (\ /.monad wrap expected) + (|> (\ /.monad in expected) (/.run expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual))))) (_.cover [/.run'] - (|> (\ /.monad wrap expected) + (|> (\ /.monad in expected) (/.run' expected_lux) (!expect (^multi (#try.Success [actual_lux actual]) (and (is? expected_lux actual_lux) @@ -131,7 +131,7 @@ (!expect (^multi (#try.Failure actual_error) (text\= expected_error actual_error)))))) (_.cover [/.either] - (and (|> (/.either (\ /.monad wrap expected) + (and (|> (/.either (\ /.monad in expected) (: (Meta Nat) (/.failure expected_error))) (/.run expected_lux) @@ -139,7 +139,7 @@ (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) - (\ /.monad wrap expected)) + (\ /.monad in expected)) (/.run expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) @@ -151,8 +151,8 @@ (!expect (^multi (#try.Failure actual_error) (text\= (location.with location.dummy expected_error) actual_error)))) - (|> (/.either (\ /.monad wrap expected) - (\ /.monad wrap dummy)) + (|> (/.either (\ /.monad in expected) + (\ /.monad in dummy)) (/.run expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) @@ -225,8 +225,8 @@ (/.run expected_lux) (!expect (^multi (#try.Success actual_module) (is? expected_module actual_module))))) - (_.cover [/.find_module] - (|> (/.find_module expected_current_module) + (_.cover [/.module] + (|> (/.module expected_current_module) (/.run expected_lux) (!expect (^multi (#try.Success actual_module) (is? expected_module actual_module))))) @@ -316,7 +316,7 @@ (|> (do /.monad [pre /.count post /.count] - (wrap [pre post])) + (in [pre post])) (/.run expected_lux) (!expect (^multi (#try.Success [actual_pre actual_post]) (and (n.= expected_seed actual_pre) @@ -348,8 +348,8 @@ expected_type (\ ! map (function (_ name) (#.Primitive name (list))) (random.ascii/upper 1)) - expected_value (random.either (wrap .def:) - (wrap .macro:)) + expected_value (random.either (in .def:) + (in .macro:)) #let [expected_lux (: (-> Bit (Maybe Type) [(List [Text .Global]) @@ -469,8 +469,8 @@ (#.Primitive name (list))) (random.ascii/upper 1)) #let [expected_annotations (' [])] - expected_value (random.either (wrap .def:) - (wrap .macro:)) + expected_value (random.either (in .def:) + (in .macro:)) #let [expected_lux (: (-> Bit (Maybe Type) [(List [Text .Global]) @@ -524,22 +524,22 @@ #.extensions [] #.host []}])))]] ($_ _.and - (_.cover [/.find_export] + (_.cover [/.export] (and (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some expected_type))] - (|> (/.find_export [expected_macro_module expected_short]) + (|> (/.export [expected_macro_module expected_short]) (/.run expected_lux) (!expect (#try.Success _)))) (let [[current_globals macro_globals expected_lux] (expected_lux false (#.Some expected_type))] - (|> (/.find_export [expected_macro_module expected_short]) + (|> (/.export [expected_macro_module expected_short]) (/.run expected_lux) (!expect (#try.Failure _)))))) - (_.cover [/.find_macro] + (_.cover [/.macro] (let [same_module! (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] - (|> (/.find_macro [expected_macro_module expected_short]) + (|> (/.macro [expected_macro_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success (#.Some actual_value)) (is? expected_value actual_value))))) @@ -547,21 +547,21 @@ not_macro! (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some expected_type))] - (|> (/.find_macro [expected_macro_module expected_short]) + (|> (/.macro [expected_macro_module expected_short]) (/.run expected_lux) (!expect (#try.Success #.None)))) not_found! (let [[current_globals macro_globals expected_lux] (expected_lux true #.None)] - (|> (/.find_macro [expected_macro_module expected_short]) + (|> (/.macro [expected_macro_module expected_short]) (/.run expected_lux) (!expect (#try.Success #.None)))) aliasing! (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] - (|> (/.find_macro [expected_current_module expected_short]) + (|> (/.macro [expected_current_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success (#.Some actual_value)) (is? expected_value actual_value)))))] @@ -580,12 +580,12 @@ (/.run expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.default false))))) - (_.cover [/.find_def] + (_.cover [/.definition] (let [[current_globals macro_globals expected_lux] (expected_lux expected_exported? (#.Some expected_type)) definition! - (|> (/.find_def [expected_macro_module expected_short]) + (|> (/.definition [expected_macro_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success (#.Definition [actual_exported? actual_type actual_annotations actual_value])) (and (bit\= expected_exported? actual_exported?) @@ -594,42 +594,42 @@ (is? (:as Any expected_value) actual_value))))) alias! - (|> (/.find_def [expected_current_module expected_short]) + (|> (/.definition [expected_current_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success (#.Alias [actual_module actual_short])) (and (is? expected_macro_module actual_module) (is? expected_short actual_short)))))] (and definition! alias!))) - (_.cover [/.find_def_type] + (_.cover [/.definition_type] (let [[current_globals macro_globals expected_lux] (expected_lux expected_exported? (#.Some expected_type)) definition! - (|> (/.find_def_type [expected_macro_module expected_short]) + (|> (/.definition_type [expected_macro_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type)))) alias! - (|> (/.find_def_type [expected_current_module expected_short]) + (|> (/.definition_type [expected_current_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type))))] (and definition! alias!))) - (_.cover [/.find_type_def] + (_.cover [/.type_definition] (let [[current_globals macro_globals expected_lux] (expected_lux expected_exported? (#.Some .Type)) definition! - (|> (/.find_type_def [expected_macro_module expected_short]) + (|> (/.type_definition [expected_macro_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success actual_value) (is? (:as .Type expected_value) actual_value)))) alias! - (|> (/.find_type_def [expected_current_module expected_short]) + (|> (/.type_definition [expected_current_module expected_short]) (/.run expected_lux) (!expect (^multi (#try.Success actual_value) (is? (:as .Type expected_value) actual_value))))] @@ -827,45 +827,45 @@ (list [name_1 type_1] [name_2 type_2])))) (try.default false)))) - (_.cover [/.find_var_type] - (and (|> (/.find_var_type name_0) + (_.cover [/.var_type] + (and (|> (/.var_type name_0) (/.run expected_lux) (try\map (\ type.equivalence = type_0)) (try.default false)) - (|> (/.find_var_type name_1) + (|> (/.var_type name_1) (/.run expected_lux) (try\map (\ type.equivalence = type_1)) (try.default false)) - (|> (/.find_var_type name_2) + (|> (/.var_type name_2) (/.run expected_lux) (try\map (\ type.equivalence = type_2)) (try.default false)) - (|> (/.find_var_type name_3) + (|> (/.var_type name_3) (/.run expected_lux) (try\map (\ type.equivalence = type_3)) (try.default false)))) - (_.cover [/.find_type] - (and (|> (/.find_type ["" name_0]) + (_.cover [/.type] + (and (|> (/.type ["" name_0]) (/.run expected_lux) (try\map (\ type.equivalence = type_0)) (try.default false)) - (|> (/.find_type ["" name_1]) + (|> (/.type ["" name_1]) (/.run expected_lux) (try\map (\ type.equivalence = type_1)) (try.default false)) - (|> (/.find_type ["" name_2]) + (|> (/.type ["" name_2]) (/.run expected_lux) (try\map (\ type.equivalence = type_2)) (try.default false)) - (|> (/.find_type ["" name_3]) + (|> (/.type ["" name_3]) (/.run expected_lux) (try\map (\ type.equivalence = type_3)) (try.default false)) - (|> (/.find_type [current_module name_4]) + (|> (/.type [current_module name_4]) (/.run expected_lux) (try\map (\ type.equivalence = type_4)) (try.default false)) - (|> (/.find_type ["" name_4]) + (|> (/.type ["" name_4]) (/.run expected_lux) (try\map (\ type.equivalence = type_4)) (try.default false)))) @@ -873,7 +873,7 @@ (def: injection (Injection Meta) - (\ /.monad wrap)) + (\ /.monad in)) (def: (comparison init) (-> Lux (Comparison Meta)) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index ec605af3b..15c7f2215 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -24,7 +24,7 @@ (syntax: (actual_program {actual_program (<| .form (<>.after (.text! "lux def program")) .any)}) - (wrap (list actual_program))) + (in (list actual_program))) (def: #export test Test diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 5e96a2e02..fbbcc2414 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -90,9 +90,9 @@ [super_package (random.ascii/lower 10) package (random.ascii/lower 10) name (random.ascii/upper 10)] - (wrap (format super_package - /name.external_separator package - /name.external_separator name)))) + (in (format super_package + /name.external_separator package + /name.external_separator name)))) (def: (get_method name class) (-> Text (java/lang/Class java/lang/Object) java/lang/reflect/Method) @@ -107,31 +107,31 @@ (do random.monad [class_name ..class_name method_name (random.ascii/upper 10)] - (wrap (case (do try.monad - [class (/class.class /version.v6_0 /class.public - (/name.internal class_name) - (/name.internal "java.lang.Object") - (list) - (list) - (list (/method.method ..method_modifier - method_name - (/type.method [(list) (list) ..$Object (list)]) - (list) - (#.Some (do /.monad - [_ bytecode] - /.areturn)))) - (row.row)) - #let [bytecode (format.run /class.writer class) - loader (/loader.memory (/loader.new_library []))] - _ (/loader.define class_name bytecode loader) - class (io.run (/loader.load class_name loader)) - method (try (get_method method_name class))] - (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) - (#try.Success actual) - (test actual) - - (#try.Failure error) - false)))) + (in (case (do try.monad + [class (/class.class /version.v6_0 /class.public + (/name.internal class_name) + (/name.internal "java.lang.Object") + (list) + (list) + (list (/method.method ..method_modifier + method_name + (/type.method [(list) (list) ..$Object (list)]) + (list) + (#.Some (do /.monad + [_ bytecode] + /.areturn)))) + (row.row)) + #let [bytecode (format.run /class.writer class) + loader (/loader.memory (/loader.new_library []))] + _ (/loader.define class_name bytecode loader) + class (io.run (/loader.load class_name loader)) + method (try (get_method method_name class))] + (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) + (#try.Success actual) + (test actual) + + (#try.Failure error) + false)))) (type: (Primitive a) {#unboxed (Type category.Return) @@ -895,7 +895,7 @@ class (io.run (/loader.load class_name loader)) method (try (get_method static_method class)) output (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)] - (wrap (:as Int output))) + (in (:as Int output))) (#try.Success actual) (i.= (:as Int expected) (:as Int actual)) @@ -1326,46 +1326,46 @@ (random.only (|>> (text\= primitive_method_name) not))) expected (get@ #random primitive) #let [$Self (/type.class class_name (list))]] - (wrap (case (do try.monad - [class (/class.class /version.v6_0 /class.public - (/name.internal class_name) - (/name.internal "java.lang.Object") - (list) - (list) - (list (/method.method ..method_modifier - primitive_method_name - primitive_method_type - (list) - (#.Some (do /.monad - [_ ((get@ #literal primitive) expected)] - return))) - (/method.method ..method_modifier - object_method_name - (/type.method [(list) (list) (get@ #boxed primitive) (list)]) - (list) - (#.Some (do /.monad - [_ (/.invokestatic $Self primitive_method_name primitive_method_type) - _ (case substitute - #.None - (wrap []) + (in (case (do try.monad + [class (/class.class /version.v6_0 /class.public + (/name.internal class_name) + (/name.internal "java.lang.Object") + (list) + (list) + (list (/method.method ..method_modifier + primitive_method_name + primitive_method_type + (list) + (#.Some (do /.monad + [_ ((get@ #literal primitive) expected)] + return))) + (/method.method ..method_modifier + object_method_name + (/type.method [(list) (list) (get@ #boxed primitive) (list)]) + (list) + (#.Some (do /.monad + [_ (/.invokestatic $Self primitive_method_name primitive_method_type) + _ (case substitute + #.None + (in []) - (#.Some substitute) - (substitute expected)) - _ (get@ #wrap primitive)] - /.areturn)))) - (row.row)) - #let [bytecode (format.run /class.writer class) - loader (/loader.memory (/loader.new_library []))] - _ (/loader.define class_name bytecode loader) - class (io.run (/loader.load class_name loader)) - method (try (get_method object_method_name class))] - (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) - (#try.Success actual) - (test expected actual) + (#.Some substitute) + (substitute expected)) + _ (get@ #wrap primitive)] + /.areturn)))) + (row.row)) + #let [bytecode (format.run /class.writer class) + loader (/loader.memory (/loader.new_library []))] + _ (/loader.define class_name bytecode loader) + class (io.run (/loader.load class_name loader)) + method (try (get_method object_method_name class))] + (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) + (#try.Success actual) + (test expected actual) - (#try.Failure error) - false) - ))))] + (#try.Failure error) + false) + ))))] ($_ _.and (_.lift "IRETURN" (primitive_return ..$Integer::primitive /.ireturn #.None (!::= java/lang/Integer "jvm ieq" "jvm int ="))) (_.lift "LRETURN" (primitive_return ..$Long::primitive /.lreturn #.None (!::= java/lang/Long "jvm leq" "jvm long ="))) @@ -1712,7 +1712,7 @@ class (io.run (/loader.load concrete_class loader)) method (try (get_method static_method class)) output (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)] - (wrap (:as Int output))) + (in (:as Int output))) (#try.Success actual) (i.= (:as Int expected) (:as Int actual)) diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 95004b2c4..e938dafd6 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -35,30 +35,30 @@ expected_message/1 (random.only (|>> (text\= expected_message/0) not) (random.ascii/lower 5))] ($_ /.and - (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] - (and (text.ends_with? expected_message/0 success_message) - (text.ends_with? expected_message/0 failure_message) - (and (n.= 1 (get@ #/.successes success_tally)) - (n.= 0 (get@ #/.failures success_tally))) - (and (n.= 0 (get@ #/.successes failure_tally)) - (n.= 1 (get@ #/.failures failure_tally))))))) - (wrap (do async.monad - [tt (/.and' (/.assert expected_message/0 true) - (/.assert expected_message/1 true)) - ff (/.and' (/.assert expected_message/0 false) - (/.assert expected_message/1 false)) - tf (/.and' (/.assert expected_message/0 true) - (/.assert expected_message/1 false)) - ft (/.and' (/.assert expected_message/0 false) - (/.assert expected_message/1 true))] - (/.cover' [/.and'] - (and (..verify expected_message/0 expected_message/1 2 0 tt) - (..verify expected_message/0 expected_message/1 0 2 ff) - (..verify expected_message/0 expected_message/1 1 1 tf) - (..verify expected_message/0 expected_message/1 1 1 ft))))) + (in (do async.monad + [[success_tally success_message] (/.assert expected_message/0 true) + [failure_tally failure_message] (/.assert expected_message/0 false)] + (/.cover' [/.assert /.Tally] + (and (text.ends_with? expected_message/0 success_message) + (text.ends_with? expected_message/0 failure_message) + (and (n.= 1 (get@ #/.successes success_tally)) + (n.= 0 (get@ #/.failures success_tally))) + (and (n.= 0 (get@ #/.successes failure_tally)) + (n.= 1 (get@ #/.failures failure_tally))))))) + (in (do async.monad + [tt (/.and' (/.assert expected_message/0 true) + (/.assert expected_message/1 true)) + ff (/.and' (/.assert expected_message/0 false) + (/.assert expected_message/1 false)) + tf (/.and' (/.assert expected_message/0 true) + (/.assert expected_message/1 false)) + ft (/.and' (/.assert expected_message/0 false) + (/.assert expected_message/1 true))] + (/.cover' [/.and'] + (and (..verify expected_message/0 expected_message/1 2 0 tt) + (..verify expected_message/0 expected_message/1 0 2 ff) + (..verify expected_message/0 expected_message/1 1 1 tf) + (..verify expected_message/0 expected_message/1 1 1 ft))))) ))) (def: seed @@ -75,45 +75,45 @@ post (<| (/.seed seed) (do ! [actual random.nat] - (wrap (do async.monad - [expected read] - (/.assert "" (n.= expected actual))))))] - (wrap (do async.monad - [[pre_tally pre_message] pre - [post_tally post_message] post] - (/.cover' [/.seed] - (and (and (n.= 1 (get@ #/.successes pre_tally)) - (n.= 0 (get@ #/.failures pre_tally))) - (and (n.= 1 (get@ #/.successes post_tally)) - (n.= 0 (get@ #/.failures post_tally))))))))) + (in (do async.monad + [expected read] + (/.assert "" (n.= expected actual))))))] + (in (do async.monad + [[pre_tally pre_message] pre + [post_tally post_message] post] + (/.cover' [/.seed] + (and (and (n.= 1 (get@ #/.successes pre_tally)) + (n.= 0 (get@ #/.failures pre_tally))) + (and (n.= 1 (get@ #/.successes post_tally)) + (n.= 0 (get@ #/.failures post_tally))))))))) (def: times /.Test ($_ /.and (do {! random.monad} [times_assertion (/.times 0 (/.test "" true))] - (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) - (n.= 0 (get@ #/.successes tally)) - (n.= 1 (get@ #/.failures tally))))))) + (in (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) + (n.= 0 (get@ #/.successes tally)) + (n.= 1 (get@ #/.failures tally))))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 10) inc) random.nat) #let [counter (: (Atom Nat) (atom.atom 0))] times_assertion (<| (/.times expected) (do ! - [_ (wrap []) + [_ (in []) #let [_ (io.run (atom.update inc counter))]] (/.test "" true)))] - (wrap (do async.monad - [[tally error] times_assertion - actual (async.future (atom.read counter))] - (/.cover' [/.times] - (and (n.= expected actual) - (n.= 1 (get@ #/.successes tally)) - (n.= 0 (get@ #/.failures tally))))))) + (in (do async.monad + [[tally error] times_assertion + actual (async.future (atom.read counter))] + (/.cover' [/.times] + (and (n.= expected actual) + (n.= 1 (get@ #/.successes tally)) + (n.= 0 (get@ #/.failures tally))))))) )) (def: in_parallel @@ -127,16 +127,16 @@ (list.repeat expected) (: /.Test) (do ! - [_ (wrap []) + [_ (in []) #let [_ (io.run (atom.update inc counter))]] (/.test "" true)))] - (wrap (do async.monad - [[tally error] assertion - actual (async.future (atom.read counter))] - (/.cover' [/.in_parallel] - (and (n.= expected actual) - (n.= expected (get@ #/.successes tally)) - (n.= 0 (get@ #/.failures tally))))))) + (in (do async.monad + [[tally error] assertion + actual (async.future (atom.read counter))] + (/.cover' [/.in_parallel] + (and (n.= expected actual) + (n.= expected (get@ #/.successes tally)) + (n.= 0 (get@ #/.failures tally))))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 10) inc) random.nat) #let [counter (: (Atom Nat) @@ -145,22 +145,22 @@ (list.repeat expected) (: /.Test) (do ! - [_ (wrap []) + [_ (in []) #let [_ (undefined) _ (io.run (atom.update inc counter))]] (/.test "" true)))] - (wrap (do async.monad - [[tally error] assertion - 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) - no_successes! (n.= 0 (get@ #/.successes tally)) - ran_all_tests! (n.= expected (get@ #/.failures tally))] - (and correct_error! - no_complete_run! - no_successes! - ran_all_tests!)))))) + (in (do async.monad + [[tally error] assertion + 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) + no_successes! (n.= 0 (get@ #/.successes tally)) + ran_all_tests! (n.= expected (get@ #/.failures tally))] + (and correct_error! + no_complete_run! + no_successes! + ran_all_tests!)))))) )) (def: #export dummy_target @@ -172,47 +172,47 @@ (do random.monad [not_covering (/.test "" true) covering (/.covering .._ (/.test "" true))] - (wrap (do async.monad - [[not_covering _] not_covering - [covering _] covering] - (/.cover' [/.covering] - (and (and (set.empty? (get@ #/.expected_coverage not_covering)) - (set.empty? (get@ #/.actual_coverage not_covering))) - (and (not (set.empty? (get@ #/.expected_coverage covering))) - (set.empty? (get@ #/.actual_coverage covering)))))))) + (in (do async.monad + [[not_covering _] not_covering + [covering _] covering] + (/.cover' [/.covering] + (and (and (set.empty? (get@ #/.expected_coverage not_covering)) + (set.empty? (get@ #/.actual_coverage not_covering))) + (and (not (set.empty? (get@ #/.expected_coverage covering))) + (set.empty? (get@ #/.actual_coverage covering)))))))) (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.cover [..dummy_target] true))] - (wrap (do async.monad - [[not_covering _] not_covering - [covering _] covering] - (/.cover' [/.cover] - (and (and (not (set.empty? (get@ #/.expected_coverage not_covering))) - (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) - (and (not (set.empty? (get@ #/.expected_coverage covering))) - (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) + (in (do async.monad + [[not_covering _] not_covering + [covering _] covering] + (/.cover' [/.cover] + (and (and (not (set.empty? (get@ #/.expected_coverage not_covering))) + (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) + (and (not (set.empty? (get@ #/.expected_coverage covering))) + (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) (do random.monad [not_covering (/.covering .._ (/.test "" true)) - covering (/.covering .._ (wrap (/.cover' [..dummy_target] true)))] - (wrap (do async.monad - [[not_covering _] not_covering - [covering _] covering] - (/.cover' [/.cover'] - (and (and (not (set.empty? (get@ #/.expected_coverage not_covering))) - (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) - (and (not (set.empty? (get@ #/.expected_coverage covering))) - (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) + covering (/.covering .._ (in (/.cover' [..dummy_target] true)))] + (in (do async.monad + [[not_covering _] not_covering + [covering _] covering] + (/.cover' [/.cover'] + (and (and (not (set.empty? (get@ #/.expected_coverage not_covering))) + (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) + (and (not (set.empty? (get@ #/.expected_coverage covering))) + (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) (do random.monad [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))] - (wrap (do async.monad - [[not_covering _] not_covering - [covering _] covering] - (/.cover' [/.for] - (and (and (not (set.empty? (get@ #/.expected_coverage not_covering))) - (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) - (and (not (set.empty? (get@ #/.expected_coverage covering))) - (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) + (in (do async.monad + [[not_covering _] not_covering + [covering _] covering] + (/.cover' [/.for] + (and (and (not (set.empty? (get@ #/.expected_coverage not_covering))) + (not (set.member? (get@ #/.actual_coverage not_covering) (name_of ..dummy_target)))) + (and (not (set.empty? (get@ #/.expected_coverage covering))) + (set.member? (get@ #/.actual_coverage covering) (name_of ..dummy_target)))))))) )) (def: #export test @@ -233,16 +233,16 @@ (do ! [success_assertion (/.test expected_message/0 true) failure_assertion (/.test expected_message/0 false)] - (wrap (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.cover' [/.test] - (and (text.ends_with? expected_message/0 success_message) - (text.ends_with? expected_message/0 failure_message) - (and (n.= 1 (get@ #/.successes success_tally)) - (n.= 0 (get@ #/.failures success_tally))) - (and (n.= 0 (get@ #/.successes failure_tally)) - (n.= 1 (get@ #/.failures failure_tally)))))))) + (in (do async.monad + [[success_tally success_message] success_assertion + [failure_tally failure_message] failure_assertion] + (/.cover' [/.test] + (and (text.ends_with? expected_message/0 success_message) + (text.ends_with? expected_message/0 failure_message) + (and (n.= 1 (get@ #/.successes success_tally)) + (n.= 0 (get@ #/.failures success_tally))) + (and (n.= 0 (get@ #/.successes failure_tally)) + (n.= 1 (get@ #/.failures failure_tally)))))))) (do ! [tt (/.and (/.test expected_message/0 true) (/.test expected_message/1 true)) @@ -252,52 +252,52 @@ (/.test expected_message/1 false)) ft (/.and (/.test expected_message/0 false) (/.test expected_message/1 true))] - (wrap (do async.monad - [tt tt - ff ff - tf tf - ft ft] - (/.cover' [/.and] - (and (..verify expected_message/0 expected_message/1 2 0 tt) - (..verify expected_message/0 expected_message/1 0 2 ff) - (..verify expected_message/0 expected_message/1 1 1 tf) - (..verify expected_message/0 expected_message/1 1 1 ft)))))) + (in (do async.monad + [tt tt + ff ff + tf tf + ft ft] + (/.cover' [/.and] + (and (..verify expected_message/0 expected_message/1 2 0 tt) + (..verify expected_message/0 expected_message/1 0 2 ff) + (..verify expected_message/0 expected_message/1 1 1 tf) + (..verify expected_message/0 expected_message/1 1 1 ft)))))) (do ! [success_assertion (/.context expected_context (/.test expected_message/0 true)) failure_assertion (/.context expected_context (/.test expected_message/0 false))] - (wrap (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.cover' [/.context] - (and (and (text.contains? expected_context success_message) - (text.contains? expected_message/0 success_message)) - (and (text.contains? expected_context failure_message) - (text.contains? expected_message/0 failure_message)) - (and (n.= 1 (get@ #/.successes success_tally)) - (n.= 0 (get@ #/.failures success_tally))) - (and (n.= 0 (get@ #/.successes failure_tally)) - (n.= 1 (get@ #/.failures failure_tally)))))))) + (in (do async.monad + [[success_tally success_message] success_assertion + [failure_tally failure_message] failure_assertion] + (/.cover' [/.context] + (and (and (text.contains? expected_context success_message) + (text.contains? expected_message/0 success_message)) + (and (text.contains? expected_context failure_message) + (text.contains? expected_message/0 failure_message)) + (and (n.= 1 (get@ #/.successes success_tally)) + (n.= 0 (get@ #/.failures success_tally))) + (and (n.= 0 (get@ #/.successes failure_tally)) + (n.= 1 (get@ #/.failures failure_tally)))))))) (do ! [failure_assertion (/.failure expected_message/0)] - (wrap (do async.monad - [[failure_tally failure_message] failure_assertion] - (/.cover' [/.failure] - (and (text.contains? expected_message/0 failure_message) - (and (n.= 0 (get@ #/.successes failure_tally)) - (n.= 1 (get@ #/.failures failure_tally)))))))) + (in (do async.monad + [[failure_tally failure_message] failure_assertion] + (/.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 async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.cover' [/.lift] - (and (text.contains? expected_message/0 success_message) - (text.contains? expected_message/0 failure_message) - (and (n.= 1 (get@ #/.successes success_tally)) - (n.= 0 (get@ #/.failures success_tally))) - (and (n.= 0 (get@ #/.successes failure_tally)) - (n.= 1 (get@ #/.failures failure_tally)))))))) + [success_assertion (/.lift expected_message/0 (in true)) + failure_assertion (/.lift expected_message/0 (in false))] + (in (do async.monad + [[success_tally success_message] success_assertion + [failure_tally failure_message] failure_assertion] + (/.cover' [/.lift] + (and (text.contains? expected_message/0 success_message) + (text.contains? expected_message/0 failure_message) + (and (n.= 1 (get@ #/.successes success_tally)) + (n.= 0 (get@ #/.failures success_tally))) + (and (n.= 0 (get@ #/.successes failure_tally)) + (n.= 1 (get@ #/.failures failure_tally)))))))) ..times ..in_parallel ..coverage diff --git a/stdlib/source/test/lux/time/day.lux b/stdlib/source/test/lux/time/day.lux index 03544b180..000b5d6e7 100644 --- a/stdlib/source/test/lux/time/day.lux +++ b/stdlib/source/test/lux/time/day.lux @@ -19,13 +19,13 @@ (def: #export random (Random /.Day) - (random.either (random.either (random.either (random\wrap #/.Sunday) - (random\wrap #/.Monday)) - (random.either (random\wrap #/.Tuesday) - (random\wrap #/.Wednesday))) - (random.either (random.either (random\wrap #/.Thursday) - (random\wrap #/.Friday)) - (random\wrap #/.Saturday)))) + (random.either (random.either (random.either (random\in #/.Sunday) + (random\in #/.Monday)) + (random.either (random\in #/.Tuesday) + (random\in #/.Wednesday))) + (random.either (random.either (random\in #/.Thursday) + (random\in #/.Friday)) + (random\in #/.Saturday)))) (def: #export test Test diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index 317783047..3e2a8b451 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -52,8 +52,8 @@ (do random.monad [expected ..random - invalid (random.only (predicate.unite (n.< (/.number #/.January)) - (n.> (/.number #/.December))) + invalid (random.only (predicate.or (n.< (/.number #/.January)) + (n.> (/.number #/.December))) random.nat)] ($_ _.and (_.cover [/.number /.by_number] 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 31507f067..0c1d1a712 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 @@ -50,13 +50,13 @@ (do list.monad [tail+ (exhaustive_weaving tail++) head head+] - (wrap (#.Cons head tail+))))) + (in (#.Cons head tail+))))) (def: #export (exhaustive_branches allow_literals? variantTC inputC) (-> Bit (List [Code Code]) Code (Random (List Code))) (case inputC [_ (#.Bit _)] - (r\wrap (list (' #0) (' #1))) + (r\in (list (' #0) (' #1))) (^template [ ] [[_ ( _)] @@ -67,11 +67,11 @@ (#.Some sample) (do ! [else (exhaustive_branches allow_literals? variantTC inputC)] - (wrap (list& ( sample) else))) + (in (list& ( sample) else))) #.None - (wrap (list (' _))))) - (r\wrap (list (' _))))]) + (in (list (' _))))) + (r\in (list (' _))))]) ([#.Nat r.nat code.nat] [#.Int r.int code.int] [#.Rev r.rev code.rev] @@ -79,26 +79,26 @@ [#.Text (r.unicode 5) code.text]) (^ [_ (#.Tuple (list))]) - (r\wrap (list (' []))) + (r\in (list (' []))) [_ (#.Tuple members)] (do {! r.monad} [member_wise_patterns (monad.map ! (exhaustive_branches allow_literals? variantTC) members)] - (wrap (|> member_wise_patterns - exhaustive_weaving - (list\map code.tuple)))) + (in (|> member_wise_patterns + exhaustive_weaving + (list\map code.tuple)))) (^ [_ (#.Record (list))]) - (r\wrap (list (' {}))) + (r\in (list (' {}))) [_ (#.Record kvs)] (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.zipped/2 ks) code.record))))) + (in (|> member_wise_patterns + exhaustive_weaving + (list\map (|>> (list.zipped/2 ks) code.record))))) (^ [_ (#.Form (list [_ (#.Tag _)] _))]) (do {! r.monad} @@ -106,13 +106,13 @@ (function (_ [_tag _code]) (do ! [v_branches (exhaustive_branches allow_literals? variantTC _code)] - (wrap (list\map (function (_ pattern) (` ((~ _tag) (~ pattern)))) - v_branches)))) + (in (list\map (function (_ pattern) (` ((~ _tag) (~ pattern)))) + v_branches)))) variantTC)] - (wrap (list\join bundles))) + (in (list\join bundles))) _ - (r\wrap (list)) + (r\in (list)) )) (def: #export (input variant_tags record_tags primitivesC) @@ -125,12 +125,12 @@ [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))))) + (in (` ((~ 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.zipped/2 record_tags primitivesC))) + (in (code.tuple elems))) + (r\in (code.record (list.zipped/2 record_tags primitivesC))) )))) (def: (branch body pattern) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index e3b4ad9ad..7fb549845 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -54,9 +54,9 @@ (Random [Type Code]) (`` ($_ r.either (~~ (template [ ] - [(r.and (r\wrap ) (r\map ))] + [(r.and (r\in ) (r\map ))] - [Any code.tuple (r.list 0 (r\wrap (' [])))] + [Any code.tuple (r.list 0 (r\in (' [])))] [Bit code.bit r.bit] [Nat code.nat r.nat] [Int code.int r.int] @@ -78,7 +78,7 @@ (case> (#try.Success [inferred_type output]) (if (is? expected_type inferred_type) (#try.Success output) - (exception.throw wrong_inference [expected_type inferred_type])) + (exception.except wrong_inference [expected_type inferred_type])) (#try.Failure error) (#try.Failure error)))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux index d854d5677..e1f52e584 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -56,7 +56,7 @@ (do ! [_ (if import? (//module.import def_module) - (wrap []))] + (in []))] (//type.with_inference (_primitive.phase archive.empty (code.identifier [def_module var_name])))))) (phase.run _primitive.state) 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 ae8292476..8eed2d440 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 @@ -112,9 +112,9 @@ (do {! random.monad} [lefts (|> random.nat (\ ! map (n.% 10))) right? random.bit] - (wrap (if right? - (#.Right lefts) - (#.Left lefts))))) + (in (if right? + (#.Right lefts) + (#.Left lefts))))) (def: random-path (Random (analysis.Tuple synthesis.Member)) @@ -127,20 +127,20 @@ (Random [analysis.Pattern Register])) (do random.monad [@member random.nat] - (wrap [(list\fold (function (_ member inner) - (case member - (#.Left lefts) - (analysis.pattern/tuple - (list\compose (list.repeat lefts (analysis.pattern/unit)) - (list inner (analysis.pattern/unit)))) - - (#.Right lefts) - (analysis.pattern/tuple - (list\compose (list.repeat (inc lefts) (analysis.pattern/unit)) - (list inner))))) - (#analysis.Bind @member) - (list.reverse path)) - @member]))) + (in [(list\fold (function (_ member inner) + (case member + (#.Left lefts) + (analysis.pattern/tuple + (list\compose (list.repeat lefts (analysis.pattern/unit)) + (list inner (analysis.pattern/unit)))) + + (#.Right lefts) + (analysis.pattern/tuple + (list\compose (list.repeat (inc lefts) (analysis.pattern/unit)) + (list inner))))) + (#analysis.Bind @member) + (list.reverse path)) + @member]))) (def: get-test Test @@ -171,14 +171,14 @@ [test random.bit then random.nat else random.nat] - (wrap [(#synthesis.Alt (#synthesis.Seq (synthesis.path/bit test) - (#synthesis.Then (synthesis.i64 (.i64 then)))) - (#synthesis.Seq (synthesis.path/bit (not test)) - (#synthesis.Then (synthesis.i64 (.i64 else))))) - [{#analysis.when (analysis.pattern/bit test) - #analysis.then (analysis.nat then)} - (list {#analysis.when (analysis.pattern/bit (not test)) - #analysis.then (analysis.nat else)})]]))) + (in [(#synthesis.Alt (#synthesis.Seq (synthesis.path/bit test) + (#synthesis.Then (synthesis.i64 (.i64 then)))) + (#synthesis.Seq (synthesis.path/bit (not test)) + (#synthesis.Then (synthesis.i64 (.i64 else))))) + [{#analysis.when (analysis.pattern/bit test) + #analysis.then (analysis.nat then)} + (list {#analysis.when (analysis.pattern/bit (not test)) + #analysis.then (analysis.nat else)})]]))) (def: (random-five hash random-element) (All [a] (-> (Hash a) (Random a) (Random [a a a a a]))) @@ -197,17 +197,17 @@ (do {! random.monad} [[test/0 test/1 test/2 test/3 test/4] (random-five ) [body/0 body/1 body/2 body/3 body/4] (random-five )] - (wrap [($_ #synthesis.Alt - (#synthesis.Seq ( test/0) (#synthesis.Then ( body/0))) - (#synthesis.Seq ( test/1) (#synthesis.Then ( body/1))) - (#synthesis.Seq ( test/2) (#synthesis.Then ( body/2))) - (#synthesis.Seq ( test/3) (#synthesis.Then ( body/3))) - (#synthesis.Seq ( test/4) (#synthesis.Then ( body/4)))) - [{#analysis.when ( test/0) #analysis.then ( body/0)} - (list {#analysis.when ( test/1) #analysis.then ( body/1)} - {#analysis.when ( test/2) #analysis.then ( body/2)} - {#analysis.when ( test/3) #analysis.then ( body/3)} - {#analysis.when ( test/4) #analysis.then ( body/4)})]])))] + (in [($_ #synthesis.Alt + (#synthesis.Seq ( test/0) (#synthesis.Then ( body/0))) + (#synthesis.Seq ( test/1) (#synthesis.Then ( body/1))) + (#synthesis.Seq ( test/2) (#synthesis.Then ( body/2))) + (#synthesis.Seq ( test/3) (#synthesis.Then ( body/3))) + (#synthesis.Seq ( test/4) (#synthesis.Then ( body/4)))) + [{#analysis.when ( test/0) #analysis.then ( body/0)} + (list {#analysis.when ( test/1) #analysis.then ( body/1)} + {#analysis.when ( test/2) #analysis.then ( body/2)} + {#analysis.when ( test/3) #analysis.then ( body/3)} + {#analysis.when ( test/4) #analysis.then ( body/4)})]])))] [random-nat n.hash random.nat (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/nat analysis.nat] [random-int int.hash random.int (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/int analysis.int] @@ -247,17 +247,17 @@ #analysis.right? right? #analysis.value (analysis.pattern/text value)}) #analysis.then (analysis.frac body)}))]] - (wrap [($_ #synthesis.Alt - (path lefts/0 false value/0 body/0) - (path lefts/1 false value/1 body/1) - (path lefts/2 false value/2 body/2) - (path lefts/3 false value/3 body/3) - (path lefts/4 last-is-right? value/4 body/4)) - [(branch lefts/0 false value/0 body/0) - (list (branch lefts/1 false value/1 body/1) - (branch lefts/2 false value/2 body/2) - (branch lefts/3 false value/3 body/3) - (branch lefts/4 last-is-right? value/4 body/4))]]))) + (in [($_ #synthesis.Alt + (path lefts/0 false value/0 body/0) + (path lefts/1 false value/1 body/1) + (path lefts/2 false value/2 body/2) + (path lefts/3 false value/3 body/3) + (path lefts/4 last-is-right? value/4 body/4)) + [(branch lefts/0 false value/0 body/0) + (list (branch lefts/1 false value/1 body/1) + (branch lefts/2 false value/2 body/2) + (branch lefts/3 false value/3 body/3) + (branch lefts/4 last-is-right? value/4 body/4))]]))) (def: random-tuple (Random [Path Match]) @@ -297,21 +297,21 @@ (list (analysis.pattern/text value) (analysis.pattern/unit))))) #analysis.then (analysis.frac body)}))]] - (wrap [(list\fold (function (_ left right) - (#synthesis.Alt left right)) - (path (inc mid-size) true value/last body/last) - (|> (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.zipped/2 value/mid body/mid) - list.enumeration - (list\map (function (_ [lefts' [value body]]) - (branch (inc lefts') false value body)))) - (list (branch (inc mid-size) true value/last body/last)))]]))) + (in [(list\fold (function (_ left right) + (#synthesis.Alt left right)) + (path (inc mid-size) true value/last body/last) + (|> (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.zipped/2 value/mid body/mid) + list.enumeration + (list\map (function (_ [lefts' [value body]]) + (branch (inc lefts') false value body)))) + (list (branch (inc mid-size) true value/last body/last)))]]))) (def: random-complex ($_ random.either 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 d07a63f00..63d9d9d20 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 @@ -80,7 +80,7 @@ (def: (random-unit output?) Scenario - (\ random.monad wrap + (\ random.monad in [true (synthesis.text synthesis.unit) (analysis.unit)])) @@ -90,9 +90,9 @@ Scenario (do {! random.monad} [value ] - (wrap [true - ( value) - ( value)])))] + (in [true + ( value) + ( value)])))] [random-bit random.bit synthesis.bit analysis.bit] [random-nat random.nat (|>> .i64 synthesis.i64) analysis.nat] @@ -118,25 +118,25 @@ [lefts random.nat right? random.bit [loop? expected-value actual-value] (random-value false)] - (wrap [loop? - (synthesis.variant - {#analysis.lefts lefts - #analysis.right? right? - #analysis.value expected-value}) - (analysis.variant - {#analysis.lefts lefts - #analysis.right? right? - #analysis.value actual-value})]))) + (in [loop? + (synthesis.variant + {#analysis.lefts lefts + #analysis.right? right? + #analysis.value expected-value}) + (analysis.variant + {#analysis.lefts lefts + #analysis.right? right? + #analysis.value actual-value})]))) (def: (random-tuple random-value output?) (-> Scenario Scenario) (do {! random.monad} [[loop?-left expected-left actual-left] (random-value false) [loop?-right expected-right actual-right] (random-value false)] - (wrap [(and loop?-left - loop?-right) - (synthesis.tuple (list expected-left expected-right)) - (analysis.tuple (list actual-left actual-right))]))) + (in [(and loop?-left + loop?-right) + (synthesis.tuple (list expected-left expected-right)) + (analysis.tuple (list actual-left actual-right))]))) (def: (random-structure random-value output?) (-> Scenario Scenario) @@ -148,20 +148,20 @@ (-> Arity Scenario) (do {! random.monad} [register (\ ! map (|>> (n.% arity) inc) random.nat)] - (wrap [(not (n.= 0 register)) - (synthesis.variable/local register) - (if (n.= arity register) - (#analysis.Reference (reference.local 1)) - (#analysis.Reference (reference.foreign register)))]))) + (in [(not (n.= 0 register)) + (synthesis.variable/local register) + (if (n.= arity register) + (#analysis.Reference (reference.local 1)) + (#analysis.Reference (reference.foreign register)))]))) (def: (random-constant output?) Scenario (do {! random.monad} [module (random.unicode 1) short (random.unicode 1)] - (wrap [true - (synthesis.constant [module short]) - (#analysis.Reference (reference.constant [module short]))]))) + (in [true + (synthesis.constant [module short]) + (#analysis.Reference (reference.constant [module short]))]))) (def: (random-reference arity output?) (-> Arity Scenario) @@ -182,74 +182,74 @@ #let [side|member (if right? (#.Right lefts) (#.Left lefts))]] - (wrap [(and loop?-input - loop?-output) - (synthesis.branch/case [expected-input - ($_ synthesis.path/alt - (synthesis.path/then expected-output) - (synthesis.path/seq (synthesis.path/bit bit-test) - (synthesis.path/then expected-output)) - (synthesis.path/seq (synthesis.path/i64 (.i64 i64-test)) - (synthesis.path/then expected-output)) - (synthesis.path/seq (synthesis.path/f64 f64-test) - (synthesis.path/then expected-output)) - (synthesis.path/seq (synthesis.path/text text-test) - (synthesis.path/then expected-output)) - (synthesis.path/seq (synthesis.path/bind (inc arity)) - (synthesis.path/then expected-output)) + (in [(and loop?-input + loop?-output) + (synthesis.branch/case [expected-input + ($_ synthesis.path/alt + (synthesis.path/then expected-output) + (synthesis.path/seq (synthesis.path/bit bit-test) + (synthesis.path/then expected-output)) + (synthesis.path/seq (synthesis.path/i64 (.i64 i64-test)) + (synthesis.path/then expected-output)) + (synthesis.path/seq (synthesis.path/f64 f64-test) + (synthesis.path/then expected-output)) + (synthesis.path/seq (synthesis.path/text text-test) + (synthesis.path/then expected-output)) + (synthesis.path/seq (synthesis.path/bind (inc arity)) + (synthesis.path/then expected-output)) + ($_ synthesis.path/seq + (synthesis.path/side side|member) + (synthesis.path/bind (inc arity)) + (synthesis.path/then expected-output)) + (if right? ($_ synthesis.path/seq - (synthesis.path/side side|member) + (synthesis.path/member side|member) (synthesis.path/bind (inc arity)) - (synthesis.path/then expected-output)) - (if right? - ($_ synthesis.path/seq - (synthesis.path/member side|member) - (synthesis.path/bind (inc arity)) - (synthesis.path/then expected-output)) - ($_ synthesis.path/seq - (synthesis.path/member side|member) - (synthesis.path/bind (inc arity)) - synthesis.path/pop - (synthesis.path/then expected-output))))]) - (#analysis.Case actual-input - [{#analysis.when (analysis.pattern/unit) - #analysis.then actual-output} - (list {#analysis.when (analysis.pattern/bit bit-test) - #analysis.then actual-output} - {#analysis.when (analysis.pattern/nat (.nat i64-test)) - #analysis.then actual-output} - {#analysis.when (analysis.pattern/frac f64-test) - #analysis.then actual-output} - {#analysis.when (analysis.pattern/text text-test) - #analysis.then actual-output} - {#analysis.when (#analysis.Bind 2) - #analysis.then actual-output} - {#analysis.when (analysis.pattern/variant - {#analysis.lefts lefts - #analysis.right? right? - #analysis.value (#analysis.Bind 2)}) - #analysis.then actual-output} - {#analysis.when (analysis.pattern/tuple - (list\compose (list.repeat lefts (analysis.pattern/unit)) - (if right? - (list (analysis.pattern/unit) (#analysis.Bind 2)) - (list (#analysis.Bind 2) (analysis.pattern/unit))))) - #analysis.then actual-output})])]))) + (synthesis.path/then expected-output)) + ($_ synthesis.path/seq + (synthesis.path/member side|member) + (synthesis.path/bind (inc arity)) + synthesis.path/pop + (synthesis.path/then expected-output))))]) + (#analysis.Case actual-input + [{#analysis.when (analysis.pattern/unit) + #analysis.then actual-output} + (list {#analysis.when (analysis.pattern/bit bit-test) + #analysis.then actual-output} + {#analysis.when (analysis.pattern/nat (.nat i64-test)) + #analysis.then actual-output} + {#analysis.when (analysis.pattern/frac f64-test) + #analysis.then actual-output} + {#analysis.when (analysis.pattern/text text-test) + #analysis.then actual-output} + {#analysis.when (#analysis.Bind 2) + #analysis.then actual-output} + {#analysis.when (analysis.pattern/variant + {#analysis.lefts lefts + #analysis.right? right? + #analysis.value (#analysis.Bind 2)}) + #analysis.then actual-output} + {#analysis.when (analysis.pattern/tuple + (list\compose (list.repeat lefts (analysis.pattern/unit)) + (if right? + (list (analysis.pattern/unit) (#analysis.Bind 2)) + (list (#analysis.Bind 2) (analysis.pattern/unit))))) + #analysis.then actual-output})])]))) (def: (random-let arity random-value output?) (-> Arity Scenario Scenario) (do {! random.monad} [[loop?-input expected-input actual-input] (random-value false) [loop?-output expected-output actual-output] (random-value output?)] - (wrap [(and loop?-input - loop?-output) - (synthesis.branch/let [expected-input - (inc arity) - expected-output]) - (#analysis.Case actual-input - [{#analysis.when (#analysis.Bind 2) - #analysis.then actual-output} - (list)])]))) + (in [(and loop?-input + loop?-output) + (synthesis.branch/let [expected-input + (inc arity) + expected-output]) + (#analysis.Case actual-input + [{#analysis.when (#analysis.Bind 2) + #analysis.then actual-output} + (list)])]))) (def: (random-if random-value output?) (-> Scenario Scenario) @@ -258,23 +258,23 @@ [loop?-then expected-then actual-then] (random-value output?) [loop?-else expected-else actual-else] (random-value output?) flip? random.bit] - (wrap [(and loop?-test - loop?-then - loop?-else) - (synthesis.branch/if [expected-test - expected-then - expected-else]) - (if flip? - (#analysis.Case actual-test - [{#analysis.when (analysis.pattern/bit false) - #analysis.then actual-else} - (list {#analysis.when (analysis.pattern/bit true) - #analysis.then actual-then})]) - (#analysis.Case actual-test - [{#analysis.when (analysis.pattern/bit true) - #analysis.then actual-then} - (list {#analysis.when (analysis.pattern/bit false) - #analysis.then actual-else})]))]))) + (in [(and loop?-test + loop?-then + loop?-else) + (synthesis.branch/if [expected-test + expected-then + expected-else]) + (if flip? + (#analysis.Case actual-test + [{#analysis.when (analysis.pattern/bit false) + #analysis.then actual-else} + (list {#analysis.when (analysis.pattern/bit true) + #analysis.then actual-then})]) + (#analysis.Case actual-test + [{#analysis.when (analysis.pattern/bit true) + #analysis.then actual-then} + (list {#analysis.when (analysis.pattern/bit false) + #analysis.then actual-else})]))]))) (def: (random-get random-value output?) (-> Scenario Scenario) @@ -282,19 +282,19 @@ [lefts (|> random.nat (\ ! map (n.% 10))) right? random.bit [loop?-record expected-record actual-record] (random-value false)] - (wrap [loop?-record - (synthesis.branch/get [(list (if right? - (#.Right lefts) - (#.Left lefts))) - expected-record]) - (#analysis.Case actual-record - [{#analysis.when (analysis.pattern/tuple - (list\compose (list.repeat lefts (analysis.pattern/unit)) - (if right? - (list (analysis.pattern/unit) (#analysis.Bind 2)) - (list (#analysis.Bind 2) (analysis.pattern/unit))))) - #analysis.then (#analysis.Reference (reference.local 2))} - (list)])]))) + (in [loop?-record + (synthesis.branch/get [(list (if right? + (#.Right lefts) + (#.Left lefts))) + expected-record]) + (#analysis.Case actual-record + [{#analysis.when (analysis.pattern/tuple + (list\compose (list.repeat lefts (analysis.pattern/unit)) + (if right? + (list (analysis.pattern/unit) (#analysis.Bind 2)) + (list (#analysis.Bind 2) (analysis.pattern/unit))))) + #analysis.then (#analysis.Reference (reference.local 2))} + (list)])]))) (def: (random-branch arity random-value output?) (-> Arity Scenario Scenario) @@ -307,28 +307,28 @@ (-> Arity Scenario Scenario) (do {! random.monad} [resets (random.list arity (random-value false))] - (wrap [true - (synthesis.loop/recur (list\map (|>> product.right product.left) resets)) - (analysis.apply [(#analysis.Reference (case arity - 1 (reference.local 0) - _ (reference.foreign 0))) - (list\map (|>> product.right product.right) resets)])]))) + (in [true + (synthesis.loop/recur (list\map (|>> product.right product.left) resets)) + (analysis.apply [(#analysis.Reference (case arity + 1 (reference.local 0) + _ (reference.foreign 0))) + (list\map (|>> product.right product.right) resets)])]))) (def: (random-scope arity output?) (-> Arity Scenario) (do {! random.monad} [resets (random.list arity (..random-variable arity output?)) [_ expected-output actual-output] (..random-nat output?)] - (wrap [(list\fold (function (_ new old) - (and new old)) - true - (list\map product.left resets)) - (synthesis.loop/scope - {#synthesis.start (inc arity) - #synthesis.inits (list\map (|>> product.right product.left) resets) - #synthesis.iteration expected-output}) - (analysis.apply [(..n-abstraction arity actual-output) - (list\map (|>> product.right product.right) resets)])]))) + (in [(list\fold (function (_ new old) + (and new old)) + true + (list\map product.left resets)) + (synthesis.loop/scope + {#synthesis.start (inc arity) + #synthesis.inits (list\map (|>> product.right product.left) resets) + #synthesis.iteration expected-output}) + (analysis.apply [(..n-abstraction arity actual-output) + (list\map (|>> product.right product.right) resets)])]))) (def: (random-loop arity random-value output?) (-> Arity Scenario Scenario) @@ -348,16 +348,16 @@ (list\map (|>> #variable.Foreign) (list.indices arity)) (list (#variable.Local 1)))]] - (wrap [true - (synthesis.function/abstraction - {#synthesis.environment environment - #synthesis.arity 1 - #synthesis.body (synthesis.loop/scope - {#synthesis.start 1 - #synthesis.inits (list) - #synthesis.iteration expected-output})}) - (#analysis.Function environment - actual-output)]))) + (in [true + (synthesis.function/abstraction + {#synthesis.environment environment + #synthesis.arity 1 + #synthesis.body (synthesis.loop/scope + {#synthesis.start 1 + #synthesis.inits (list) + #synthesis.iteration expected-output})}) + (#analysis.Function environment + actual-output)]))) (def: (random-apply random-value output?) (-> Scenario Scenario) @@ -365,14 +365,14 @@ [[loop?-abstraction expected-abstraction actual-abstraction] (..random-nat output?) arity (|> random.nat (\ ! map (|>> (n.% 5) inc))) inputs (random.list arity (random-value false))] - (wrap [(list\fold (function (_ new old) - (and new old)) - loop?-abstraction - (list\map product.left inputs)) - (synthesis.function/apply [expected-abstraction - (list\map (|>> product.right product.left) inputs)]) - (analysis.apply [actual-abstraction - (list\map (|>> product.right product.right) inputs)])]))) + (in [(list\fold (function (_ new old) + (and new old)) + loop?-abstraction + (list\map product.left inputs)) + (synthesis.function/apply [expected-abstraction + (list\map (|>> product.right product.left) inputs)]) + (analysis.apply [actual-abstraction + (list\map (|>> product.right product.right) inputs)])]))) (def: (random-function random-value output?) (-> Scenario Scenario) @@ -398,11 +398,11 @@ [loop?-first expected-first actual-first] (random-value false) [loop?-second expected-second actual-second] (random-value false) [loop?-third expected-third actual-third] (random-value false)] - (wrap [(and loop?-first - loop?-second - loop?-third) - (#synthesis.Extension name (list expected-first expected-second expected-third)) - (#analysis.Extension name (list actual-first actual-second actual-third))]))) + (in [(and loop?-first + loop?-second + loop?-third) + (#synthesis.Extension name (list expected-first expected-second expected-third)) + (#analysis.Extension name (list actual-first actual-second actual-third))]))) (def: (random-body arity) (-> Arity Scenario) @@ -421,8 +421,8 @@ (do {! random.monad} [arity (|> random.nat (\ ! map (|>> (n.% 5) inc))) [loop? expected-body actual-body] (random-body arity true)] - (wrap [(..n-function loop? arity expected-body) - (..n-abstraction arity actual-body)]))) + (in [(..n-function loop? arity expected-body) + (..n-abstraction arity actual-body)]))) (def: abstraction Test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 7e1ebf587..3598bbf7c 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -32,9 +32,9 @@ (~~ (template [ ] [(do {! random.monad} [example (\ ! map (|>> ) )] - (wrap [next - [example - example]]))] + (in [next + [example + example]]))] [//.bit random.bit] [//.i64 (\ ! map .i64 random.nat)] @@ -48,26 +48,26 @@ (do random.monad [name (random.and (random.unicode 1) (random.unicode 1))] - (wrap [next - [name - name]]))) + (in [next + [name + name]]))) (def: (variable offset arity next) (Scenario Variable) (let [local (do {! random.monad} [register (\ ! map (|>> (n.% arity) inc) random.nat)] - (wrap [next - [(#variable.Local (/.register_optimization offset register)) - (#variable.Local register)]]))] + (in [next + [(#variable.Local (/.register_optimization offset register)) + (#variable.Local register)]]))] (case offset 0 local _ ($_ random.either local (do {! random.monad} [foreign (\ ! map (n.% offset) random.nat)] - (wrap [next - [(#variable.Local foreign) - (#variable.Foreign foreign)]])))))) + (in [next + [(#variable.Local foreign) + (#variable.Foreign foreign)]])))))) (def: (reference offset arity next) (Scenario Synthesis) @@ -75,9 +75,9 @@ (~~ (template [ ] [(do {! random.monad} [[next [exampleE exampleA]] ( offset arity next)] - (wrap [next - [( exampleE) - ( exampleA)]]))] + (in [next + [( exampleE) + ( exampleA)]]))] [//.constant ..constant] [//.variable ..variable] @@ -90,21 +90,21 @@ [lefts random.nat right? random.bit [next [valueE valueA]] (..reference offset arity next)] - (wrap [next - [(//.variant - {#analysis.lefts lefts - #analysis.right? right? - #analysis.value valueE}) - (//.variant - {#analysis.lefts lefts - #analysis.right? right? - #analysis.value valueA})]])) + (in [next + [(//.variant + {#analysis.lefts lefts + #analysis.right? right? + #analysis.value valueE}) + (//.variant + {#analysis.lefts lefts + #analysis.right? right? + #analysis.value valueA})]])) (do {! random.monad} [[next [leftE leftA]] (..reference offset arity next) [next [rightE rightA]] (..reference offset arity next)] - (wrap [next - [(//.tuple (list leftE rightE)) - (//.tuple (list leftA rightA))]])) + (in [next + [(//.tuple (list leftE rightE)) + (//.tuple (list leftA rightA))]])) )) (def: path @@ -112,15 +112,15 @@ (let [pattern (: (Scenario Path) (.function (recur offset arity next) (`` ($_ random.either - (random\wrap [next - [//.path/pop - //.path/pop]]) + (random\in [next + [//.path/pop + //.path/pop]]) (~~ (template [ ] [(do {! random.monad} [example (\ ! map (|>> ) )] - (wrap [next - [example - example]]))] + (in [next + [example + example]]))] [//.path/bit random.bit] [//.path/i64 (\ ! map .i64 random.nat)] @@ -132,32 +132,32 @@ [example (\ ! map (|>> ) (random.or random.nat random.nat))] - (wrap [next - [example - example]]))] + (in [next + [example + example]]))] [//.path/side] [//.path/member] )) - (random\wrap [(inc next) - [(//.path/bind (/.register_optimization offset next)) - (//.path/bind next)]]) + (random\in [(inc next) + [(//.path/bind (/.register_optimization offset next)) + (//.path/bind next)]]) )))) sequential (: (Scenario Path) (.function (recur offset arity next) (do random.monad [[next [patternE patternA]] (pattern offset arity next) [next [bodyE bodyA]] (..reference offset arity next)] - (wrap [next - [(//.path/seq patternE (//.path/then bodyE)) - (//.path/seq patternA (//.path/then bodyA))]]))))] + (in [next + [(//.path/seq patternE (//.path/then bodyE)) + (//.path/seq patternA (//.path/then bodyA))]]))))] (.function (recur offset arity next) (do random.monad [[next [leftE leftA]] (sequential offset arity next) [next [rightE rightA]] (sequential offset arity next)] - (wrap [next - [(//.path/alt leftE rightE) - (//.path/alt leftA rightA)]]))))) + (in [next + [(//.path/alt leftE rightE) + (//.path/alt leftA rightA)]]))))) (def: (branch offset arity next) (Scenario Synthesis) @@ -169,30 +169,30 @@ (do {! random.monad} [[next [inputE inputA]] (..reference offset arity next) [next [bodyE bodyA]] (..reference offset arity next)] - (wrap [next - [(//.branch/let [inputE (/.register_optimization offset next) bodyE]) - (//.branch/let [inputA next bodyA])]])) + (in [next + [(//.branch/let [inputE (/.register_optimization offset next) bodyE]) + (//.branch/let [inputA next bodyA])]])) (do {! random.monad} [[next [testE testA]] (..reference offset arity next) [next [thenE thenA]] (..reference offset arity next) [next [elseE elseA]] (..reference offset arity next)] - (wrap [next - [(//.branch/if [testE thenE elseE]) - (//.branch/if [testA thenA elseA])]]))) + (in [next + [(//.branch/if [testE thenE elseE]) + (//.branch/if [testA thenA elseA])]]))) ($_ random.either (do {! random.monad} [[next [recordE recordA]] (..reference offset arity next) path_length (\ ! map (|>> (n.% 5) inc) random.nat) path (random.list path_length random_member)] - (wrap [next - [(//.branch/get [path recordE]) - (//.branch/get [path recordA])]])) + (in [next + [(//.branch/get [path recordE]) + (//.branch/get [path recordA])]])) (do {! random.monad} [[next [inputE inputA]] (..reference offset arity next) [next [pathE pathA]] (..path offset arity next)] - (wrap [next - [(//.branch/case [inputE pathE]) - (//.branch/case [inputA pathA])]]))) + (in [next + [(//.branch/case [inputE pathE]) + (//.branch/case [inputA pathA])]]))) ))) (def: (loop offset arity next) @@ -202,15 +202,15 @@ [[next [firstE firstA]] (..reference offset arity next) [next [secondE secondA]] (..reference offset arity next) [next [iterationE iterationA]] (..reference offset arity next)] - (wrap [next - [(//.loop/scope - {#//.start (/.register_optimization offset next) - #//.inits (list firstE secondE) - #//.iteration iterationE}) - (//.loop/scope - {#//.start next - #//.inits (list firstA secondA) - #//.iteration iterationA})]])) + (in [next + [(//.loop/scope + {#//.start (/.register_optimization offset next) + #//.inits (list firstE secondE) + #//.iteration iterationE}) + (//.loop/scope + {#//.start next + #//.inits (list firstA secondA) + #//.iteration iterationA})]])) )) (def: (function offset arity next) @@ -221,15 +221,15 @@ [next [secondE secondA]] (..variable offset arity next) arity (\ ! map (n.max 1) random.nat) [next [bodyE bodyA]] (..primitive 0 arity next)] - (wrap [next - [(//.function/abstraction - {#//.environment (list firstE secondE) - #//.arity arity - #//.body bodyE}) - (//.function/abstraction - {#//.environment (list firstA secondA) - #//.arity arity - #//.body bodyA})]])) + (in [next + [(//.function/abstraction + {#//.environment (list firstE secondE) + #//.arity arity + #//.body bodyE}) + (//.function/abstraction + {#//.environment (list firstA secondA) + #//.arity arity + #//.body bodyA})]])) )) (def: (control offset arity next) @@ -247,9 +247,9 @@ [next [firstE firstA]] (..reference offset arity next) [next [secondE secondA]] (..reference offset arity next) [next [thirdE thirdA]] (..reference offset arity next)] - (wrap [next - [(#//.Extension name (list firstE secondE thirdE)) - (#//.Extension name (list firstA secondA thirdA))]]))) + (in [next + [(#//.Extension name (list firstE secondE thirdE)) + (#//.Extension name (list firstA secondA thirdA))]]))) (def: (scenario offset arity next) (Scenario Synthesis) 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 7908da928..e46960793 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 @@ -32,14 +32,14 @@ (do r.monad [primitive (: (Random ////analysis.Primitive) ($_ r.or - (wrap []) + (in []) r.bit r.nat r.int r.rev r.frac (r.unicode 5)))] - (wrap (#////analysis.Primitive primitive)))) + (in (#////analysis.Primitive primitive)))) (def: #export (corresponds? analysis synthesis) (-> Analysis Synthesis Bit) @@ -87,7 +87,7 @@ _ false))))] - [#////analysis.Unit #////synthesis.Text (r\wrap ////synthesis.unit)] + [#////analysis.Unit #////synthesis.Text (r\in ////synthesis.unit)] [#////analysis.Bit #////synthesis.Bit r.bit] [#////analysis.Nat #////synthesis.I64 (r\map .i64 r.nat)] [#////analysis.Int #////synthesis.I64 (r\map .i64 r.int)] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index f50a196b6..8fa9ad158 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -46,8 +46,8 @@ (Scenario Synthesis) (do {! random.monad} [value ] - (wrap [( value) - ( value)])))] + (in [( value) + ( value)])))] [bit-scenario synthesis.bit random.bit] [i64-scenario synthesis.i64 (\ ! map .i64 random.nat)] @@ -73,15 +73,15 @@ #let [fake-register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] [expected-output actual-output] (scenario (update@ #redundants inc context))] - (wrap [(synthesis.branch/case [expected-input - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then expected-output))]) - (if let? - (synthesis.branch/let [actual-input fake-register actual-output]) - (synthesis.branch/case [actual-input - (#synthesis.Seq (#synthesis.Bind fake-register) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then actual-output)))]))])) + (in [(synthesis.branch/case [expected-input + (#synthesis.Seq #synthesis.Pop + (#synthesis.Then expected-output))]) + (if let? + (synthesis.branch/let [actual-input fake-register actual-output]) + (synthesis.branch/case [actual-input + (#synthesis.Seq (#synthesis.Bind fake-register) + (#synthesis.Seq #synthesis.Pop + (#synthesis.Then actual-output)))]))])) (scenario context)))) (def: (variant-scenario scenario context) @@ -90,13 +90,13 @@ [lefts random.nat right? random.bit [expected input] (scenario context)] - (wrap [(synthesis.variant [lefts right? expected]) - (synthesis.variant [lefts right? input])]))) + (in [(synthesis.variant [lefts right? expected]) + (synthesis.variant [lefts right? input])]))) (def: (tuple-scenario context) (Scenario Synthesis) (let [registers (dictionary.entries (get@ #necessary context))] - (\ random.monad wrap + (\ random.monad in [(synthesis.tuple (list\map (|>> product.left synthesis.variable/local) registers)) (synthesis.tuple (list\map (|>> product.right synthesis.variable/local) registers))]))) @@ -108,37 +108,37 @@ (def: (let-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do random.monad - [_ (wrap []) + [_ (in []) [expected-input actual-input] (scenario context) #let [real-register (dictionary.size (get@ #necessary context)) fake-register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] [expected-output actual-output] (scenario (update@ #necessary (dictionary.put real-register fake-register) context))] - (wrap [(synthesis.branch/let [expected-input real-register expected-output]) - (synthesis.branch/let [actual-input fake-register actual-output])]))) + (in [(synthesis.branch/let [expected-input real-register expected-output]) + (synthesis.branch/let [actual-input fake-register actual-output])]))) (def: (if-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do random.monad - [_ (wrap []) + [_ (in []) [expected-test actual-test] (scenario context) [expected-then actual-then] (scenario context) [expected-else actual-else] (scenario context)] - (wrap [(synthesis.branch/if [expected-test - expected-then - expected-else]) - (synthesis.branch/if [actual-test - actual-then - actual-else])]))) + (in [(synthesis.branch/if [expected-test + expected-then + expected-else]) + (synthesis.branch/if [actual-test + actual-then + actual-else])]))) (def: random-member (Random Member) (do random.monad [lefts random.nat right? random.bit] - (wrap (if right? - (#.Right lefts) - (#.Left lefts))))) + (in (if right? + (#.Right lefts) + (#.Left lefts))))) (def: (get-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -146,8 +146,8 @@ [length (\ ! map (|>> (n.% 5) inc) random.nat) path (random.list length ..random-member) [expected-record actual-record] (scenario context)] - (wrap [(synthesis.branch/get [path expected-record]) - (synthesis.branch/get [path actual-record])]))) + (in [(synthesis.branch/get [path expected-record]) + (synthesis.branch/get [path actual-record])]))) (def: random-side (Random Side) @@ -158,33 +158,33 @@ (`` ($_ random.either ($_ random.either (do {! random.monad} - [_ (wrap []) + [_ (in []) [expected-then actual-then] (scenario context)] - (wrap [(#synthesis.Seq #synthesis.Pop - (#synthesis.Then expected-then)) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then actual-then))])) + (in [(#synthesis.Seq #synthesis.Pop + (#synthesis.Then expected-then)) + (#synthesis.Seq #synthesis.Pop + (#synthesis.Then actual-then))])) (do {! random.monad} - [_ (wrap []) + [_ (in []) #let [real-register (dictionary.size (get@ #necessary context)) fake-register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] [expected-then actual-then] (scenario (update@ #necessary (dictionary.put real-register fake-register) context))] - (wrap [(#synthesis.Seq (#synthesis.Bind real-register) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then expected-then))) - (#synthesis.Seq (#synthesis.Bind fake-register) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then actual-then)))]))) + (in [(#synthesis.Seq (#synthesis.Bind real-register) + (#synthesis.Seq #synthesis.Pop + (#synthesis.Then expected-then))) + (#synthesis.Seq (#synthesis.Bind fake-register) + (#synthesis.Seq #synthesis.Pop + (#synthesis.Then actual-then)))]))) ($_ random.either (~~ (template [ ] [(do {! random.monad} [test [expected-then actual-then] (scenario context)] - (wrap [(#synthesis.Seq (#synthesis.Test ( test)) - (#synthesis.Then expected-then)) - (#synthesis.Seq (#synthesis.Test ( test)) - (#synthesis.Then actual-then))]))] + (in [(#synthesis.Seq (#synthesis.Test ( test)) + (#synthesis.Then expected-then)) + (#synthesis.Seq (#synthesis.Test ( test)) + (#synthesis.Then actual-then))]))] [#synthesis.Bit random.bit] [#synthesis.I64 (\ ! map .i64 random.nat)] @@ -195,33 +195,33 @@ (do {! random.monad} [side ..random-side [expected-next actual-next] (path-scenario scenario context)] - (wrap [(#synthesis.Seq (#synthesis.Access (#synthesis.Side side)) - expected-next) - (#synthesis.Seq (#synthesis.Access (#synthesis.Side side)) - actual-next)])) + (in [(#synthesis.Seq (#synthesis.Access (#synthesis.Side side)) + expected-next) + (#synthesis.Seq (#synthesis.Access (#synthesis.Side side)) + actual-next)])) (do {! random.monad} [member ..random-member [expected-next actual-next] (path-scenario scenario context)] - (wrap [(#synthesis.Seq (#synthesis.Access (#synthesis.Member member)) - expected-next) - (#synthesis.Seq (#synthesis.Access (#synthesis.Member member)) - actual-next)]))) + (in [(#synthesis.Seq (#synthesis.Access (#synthesis.Member member)) + expected-next) + (#synthesis.Seq (#synthesis.Access (#synthesis.Member member)) + actual-next)]))) (do {! random.monad} - [_ (wrap []) + [_ (in []) [expected-left actual-left] (path-scenario scenario context) [expected-right actual-right] (path-scenario scenario context)] - (wrap [(#synthesis.Alt expected-left expected-right) - (#synthesis.Alt actual-left actual-right)])) + (in [(#synthesis.Alt expected-left expected-right) + (#synthesis.Alt actual-left actual-right)])) ))) (def: (case-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do {! random.monad} - [_ (wrap []) + [_ (in []) [expected-input actual-input] (scenario context) [expected-path actual-path] (..path-scenario scenario context)] - (wrap [(synthesis.branch/case [expected-input expected-path]) - (synthesis.branch/case [actual-input actual-path])]))) + (in [(synthesis.branch/case [expected-input expected-path]) + (synthesis.branch/case [actual-input actual-path])]))) (def: (branch-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -237,7 +237,7 @@ (def: (scope-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do {! random.monad} - [_ (wrap []) + [_ (in []) #let [real-start (dictionary.size (get@ #necessary context)) fake-start (n.+ (get@ #redundants context) real-start)] @@ -251,16 +251,16 @@ necessary (list.enumeration inits))) context))] - (wrap [(synthesis.loop/scope [real-start (list\map product.left inits) expected-iteration]) - (synthesis.loop/scope [fake-start (list\map product.right inits) actual-iteration])]))) + (in [(synthesis.loop/scope [real-start (list\map product.left inits) expected-iteration]) + (synthesis.loop/scope [fake-start (list\map product.right inits) actual-iteration])]))) (def: (recur-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do {! random.monad} - [_ (wrap []) + [_ (in []) resets (random.list ..scope-arity (scenario context))] - (wrap [(synthesis.loop/recur (list\map product.left resets)) - (synthesis.loop/recur (list\map product.right resets))]))) + (in [(synthesis.loop/recur (list\map product.left resets)) + (synthesis.loop/recur (list\map product.right resets))]))) (def: (loop-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -272,13 +272,13 @@ (def: (abstraction-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do {! random.monad} - [_ (wrap []) + [_ (in []) #let [registers (dictionary.entries (get@ #necessary context)) expected-environment (list\map (|>> product.left #variable.Local) registers) actual-environment (list\map (|>> product.right #variable.Local) registers)] [expected-body actual-body] (..primitive-scenario context)] - (wrap [(synthesis.function/abstraction [expected-environment 1 expected-body]) - (synthesis.function/abstraction [actual-environment 1 actual-body])]))) + (in [(synthesis.function/abstraction [expected-environment 1 expected-body]) + (synthesis.function/abstraction [actual-environment 1 actual-body])]))) (def: (apply-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -287,8 +287,8 @@ (random.and (random.unicode 1) (random.unicode 1))) inputs (random.list ..scope-arity (scenario context))] - (wrap [(synthesis.function/apply [abstraction (list\map product.left inputs)]) - (synthesis.function/apply [abstraction (list\map product.right inputs)])]))) + (in [(synthesis.function/apply [abstraction (list\map product.left inputs)]) + (synthesis.function/apply [abstraction (list\map product.right inputs)])]))) (def: (function-scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -311,9 +311,9 @@ (..primitive-scenario context) (..structure-scenario context) (..control-scenario (..with-redundancy - (..control-scenario - (..with-redundancy - ..structure-scenario))) + (..control-scenario + (..with-redundancy + ..structure-scenario))) context) )) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux index 8a71ed224..4e4968462 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -117,7 +117,7 @@ (Random Text) (do r.monad [comment comment-text^] - (wrap (format "## " comment text.new-line)))) + (in (format "## " comment text.new-line)))) (def: comments Test diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 65c02256b..521ca4851 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -47,9 +47,9 @@ (function (_ recur) (let [pairG (random.and recur recur) idG random.nat - quantifiedG (random.and (random\wrap (list)) recur)] + quantifiedG (random.and (random\in (list)) recur)] ($_ random.or - (random.and ..short (random\wrap (list))) + (random.and ..short (random\in (list))) pairG pairG pairG @@ -113,7 +113,7 @@ (do maybe.monad [partial (/.applied (list Bit) Ann) full (/.applied (list Int) partial)] - (wrap (\ /.equivalence = full (#.Product Bit Int))))) + (in (\ /.equivalence = full (#.Product Bit Int))))) (|> (/.applied (list Bit) Text) (case> #.None #1 _ #0)))) (do {! random.monad} diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux index 47d478f3f..aaeb6f1b6 100644 --- a/stdlib/source/test/lux/type/abstract.lux +++ b/stdlib/source/test/lux/type/abstract.lux @@ -26,7 +26,7 @@ [(syntax: () (do meta.monad [frame ] - (wrap (list (code.text (get@ #/.name frame))))))] + (in (list (code.text (get@ #/.name frame))))))] [current /.current] [specific (/.specific (template.text [g!Foo]))] diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 8ced5e3eb..982234fb1 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -44,7 +44,7 @@ (random.rec (function (_ recur) (let [pairG (random.and recur recur) - quantifiedG (random.and (random\wrap (list)) (type' (inc num_vars))) + quantifiedG (random.and (random\in (list)) (type' (inc num_vars))) random_pair (random.either (random.either (random\map (|>> #.Sum) pairG) (random\map (|>> #.Product) pairG)) (random.either (random\map (|>> #.Function) pairG) @@ -58,7 +58,7 @@ random_quantified (random.either (random\map (|>> #.UnivQ) quantifiedG) (random\map (|>> #.ExQ) quantifiedG))] ($_ random.either - (random\map (|>> #.Primitive) (random.and ..short (random\wrap (list)))) + (random\map (|>> #.Primitive) (random.and ..short (random\in (list)))) random_pair random_id random_quantified @@ -91,7 +91,7 @@ (def: injection (Injection (All [a] (/.Check a))) - (\ /.monad wrap)) + (\ /.monad in)) (def: comparison (Comparison (All [a] (/.Check a))) @@ -138,10 +138,10 @@ (case (/.run /.fresh_context (/.assert expected false)) (#try.Success _) false (#try.Failure actual) (is? expected actual))))) - (_.cover [/.throw] + (_.cover [/.except] (case (/.run /.fresh_context (: (/.Check Any) - (/.throw ..yolo []))) + (/.except ..yolo []))) (#try.Success _) false (#try.Failure error) (exception.match? ..yolo error))) )) @@ -154,7 +154,7 @@ (case (/.run /.fresh_context (do /.monad [[var_id var_type] /.var] - (wrap (type\= var_type (#.Var var_id))))) + (in (type\= var_type (#.Var var_id))))) (#try.Success verdict) verdict (#try.Failure error) false)) (do random.monad @@ -165,7 +165,7 @@ [[var_id var_type] /.var _ (/.bind (#.Primitive nominal (list)) var_id)] - (wrap true))) + (in true))) (#try.Success _) true (#try.Failure error) false))) (do random.monad @@ -177,8 +177,8 @@ _ (/.bind (#.Primitive nominal (list)) var_id) post (/.bound? var_id)] - (wrap (and (not pre) - post))) + (in (and (not pre) + post))) (/.run /.fresh_context) (try.default false)) (|> (do /.monad @@ -187,8 +187,8 @@ [_ var/1] /.var _ (/.check var/0 var/1) post (/.bound? var_id)] - (wrap (and (not pre) - (not post)))) + (in (and (not pre) + (not post)))) (/.run /.fresh_context) (try.default false))))) (do random.monad @@ -332,14 +332,14 @@ (Random Type) (do random.monad [name (random.ascii/upper 10)] - (wrap (#.Primitive name (list))))) + (in (#.Primitive name (list))))) (def: (non_twins = random) (All [a] (-> (-> a a Bit) (Random a) (Random [a a]))) (do random.monad [left random right (random.only (|>> (= left) not) random)] - (wrap [left right]))) + (in [left right]))) (type: Super (Ex [sub] [Text sub])) @@ -420,16 +420,16 @@ var/tail+ (monad.map ! (function (_ _) (do ! [[id/T var/tail] /.var] - (wrap var/tail))) + (in var/tail))) (list.repeat tail_size /.var)) var/last (monad.fold ! (function (_ var/next var/prev) (do ! [_ (/.check var/prev var/next)] - (wrap var/next))) + (in var/next))) var/head var/tail+) _ (/.check var/last var/head)] - (wrap [var/head var/tail+ var/last]))) + (in [var/head var/tail+ var/last]))) (def: (handles_var_rings! tail_size nominal/0 nominal/1) (-> Nat Type Type Bit) @@ -644,14 +644,14 @@ [module (random.ascii/upper 10) short (random.ascii/upper 10) anonymousT dirty_type] - (wrap (function (_ holeT) - (#.Named [module short] (anonymousT holeT))))) + (in (function (_ holeT) + (#.Named [module short] (anonymousT holeT))))) (~~ (template [] [(do random.monad [leftT dirty_type rightT dirty_type] - (wrap (function (_ holeT) - ( (leftT holeT) (rightT holeT)))))] + (in (function (_ holeT) + ( (leftT holeT) (rightT holeT)))))] [#.Sum] [#.Product] @@ -661,16 +661,16 @@ (do {! random.monad} [name (random.ascii/upper 10) parameterT dirty_type] - (wrap (function (_ holeT) - (#.Primitive name (list (parameterT holeT)))))) + (in (function (_ holeT) + (#.Primitive name (list (parameterT holeT)))))) (~~ (template [] [(do {! random.monad} [funcT dirty_type argT dirty_type body random.nat] - (wrap (function (_ holeT) - ( (list (funcT holeT) (argT holeT)) - (#.Parameter body)))))] + (in (function (_ holeT) + ( (list (funcT holeT) (argT holeT)) + (#.Parameter body)))))] [#.UnivQ] [#.ExQ] @@ -685,8 +685,8 @@ (and (|> (do /.monad [[var_id varT] /.var cleanedT (/.clean (type_shape varT))] - (wrap (type\= (type_shape varT) - cleanedT))) + (in (type\= (type_shape varT) + cleanedT))) (/.run /.fresh_context) (try.default false)) (|> (do /.monad @@ -694,8 +694,8 @@ [_ replacementT] /.existential _ (/.check varT replacementT) cleanedT (/.clean (type_shape varT))] - (wrap (type\= (type_shape replacementT) - cleanedT))) + (in (type\= (type_shape replacementT) + cleanedT))) (/.run /.fresh_context) (try.default false)) )))) @@ -710,7 +710,7 @@ [expected random.nat] (_.cover [/.run] (case (/.run /.fresh_context - (\ /.monad wrap expected)) + (\ /.monad in expected)) (#try.Success actual) (is? expected actual) (#try.Failure error) false))) ..error_handling diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index 9e5da1d8a..cd6f78096 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -38,7 +38,7 @@ /.run_pure (do /.pure - (wrap (format left right)))))] + (in (format left right)))))] [[/.Affine /.Key /.Res /.Ordered /.ordered_pure /.Relevant /.read_pure] @@ -79,7 +79,7 @@ /.run_sync (do /.sync - (wrap (format left right)))))] + (in (format left right)))))] [[/.Affine /.Key /.Res /.Ordered /.ordered_sync /.Relevant /.read_sync] @@ -114,14 +114,14 @@ (_.for [/.Linear /.async /.run_async] (`` ($_ _.and (~~ (template [ ] - [(wrap (monad.do async.monad - [outcome (/.run_async - (do /.async - - (wrap (format left right))))] - (_.cover' - (text\= (format pre post) - outcome))))] + [(in (monad.do async.monad + [outcome (/.run_async + (do /.async + + (in (format left right))))] + (_.cover' + (text\= (format pre post) + outcome))))] [[/.Affine /.Key /.Res /.Ordered /.ordered_async /.Relevant /.read_async] @@ -150,7 +150,7 @@ (syntax: (with_error {exception .identifier} to_expand) (monad.do meta.monad - [[_ _ _ exception] (meta.find_export exception)] + [[_ _ _ exception] (meta.export exception)] (function (_ compiler) (#.Right [compiler (list (code.bit (case ((macro.expand_once to_expand) compiler) diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index e7fd9f42b..c007b3ea8 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -28,24 +28,24 @@ [char (try.of_maybe (text.nth 0 content)) [_ content] (try.of_maybe (text.split 1 content))] (if dead? - (exception.throw ..dead []) - (wrap [[dead? content] char])))) + (exception.except ..dead []) + (in [[dead? content] char])))) (def: (on_read_line [dead? content]) (do try.monad [[line content] (try.of_maybe (text.split_with text.new_line content))] (if dead? - (exception.throw ..dead []) - (wrap [[dead? content] line])))) + (exception.except ..dead []) + (in [[dead? content] line])))) (def: (on_write message [dead? content]) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (#try.Success [dead? (format content message)]))) (def: (on_close [dead? content]) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (#try.Success [true content]))))) (def: #export test @@ -62,9 +62,9 @@ (do io.monad [?_ (/.write_line expected console) ?actual (\ console read_line [])] - (wrap (<| (try.default false) - (do try.monad - [_ ?_ - actual ?actual] - (wrap (text\= expected actual))))))))) + (in (<| (try.default false) + (do try.monad + [_ ?_ + actual ?actual] + (in (text\= expected actual))))))))) ))) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index cb24e89b7..7d09023cf 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -28,9 +28,9 @@ (def: concern (Random [/.Concern (Predicate /.Concern)]) ($_ random.either - (random\wrap [/.creation /.creation?]) - (random\wrap [/.modification /.modification?]) - (random\wrap [/.deletion /.deletion?]) + (random\in [/.creation /.creation?]) + (random\in [/.modification /.modification?]) + (random\in [/.deletion /.deletion?]) )) (def: concern\\test @@ -71,22 +71,22 @@ [directory (random.ascii/alpha 5) #let [[fs watcher] (/.mock "/")]] ($_ _.and - (wrap (do async.monad - [?concern (\ watcher concern directory) - ?stop (\ watcher stop directory)] - (_.cover' [/.not_being_watched] - (and (case ?concern - (#try.Failure error) - (exception.match? /.not_being_watched error) - - (#try.Success _) - false) - (case ?stop - (#try.Failure error) - (exception.match? /.not_being_watched error) - - (#try.Success _) - false))))) + (in (do async.monad + [?concern (\ watcher concern directory) + ?stop (\ watcher stop directory)] + (_.cover' [/.not_being_watched] + (and (case ?concern + (#try.Failure error) + (exception.match? /.not_being_watched error) + + (#try.Success _) + false) + (case ?stop + (#try.Failure error) + (exception.match? /.not_being_watched error) + + (#try.Success _) + false))))) ))) (def: (no_events_prior_to_creation! fs watcher directory) @@ -104,16 +104,16 @@ (//.make_file async.monad fs (binary.create 0) expected_path)) poll/pre (\ watcher poll []) poll/post (\ watcher poll [])] - (wrap (and (case poll/pre - (^ (list [concern actual_path])) - (and (text\= expected_path actual_path) - (and (/.creation? concern) - (not (/.modification? concern)) - (not (/.deletion? concern)))) + (in (and (case poll/pre + (^ (list [concern actual_path])) + (and (text\= expected_path actual_path) + (and (/.creation? concern) + (not (/.modification? concern)) + (not (/.deletion? concern)))) - _ - false) - (list.empty? poll/post))))) + _ + false) + (list.empty? poll/post))))) (def: (after_modification! fs watcher data expected_path) (-> (//.System Async) (/.Watcher Async) Binary //.Path (Async (Try Bit))) @@ -122,16 +122,16 @@ _ (\ fs write data expected_path) poll/2 (\ watcher poll []) poll/2' (\ watcher poll [])] - (wrap (and (case poll/2 - (^ (list [concern actual_path])) - (and (text\= expected_path actual_path) - (and (not (/.creation? concern)) - (/.modification? concern) - (not (/.deletion? concern)))) + (in (and (case poll/2 + (^ (list [concern actual_path])) + (and (text\= expected_path actual_path) + (and (not (/.creation? concern)) + (/.modification? concern) + (not (/.deletion? concern)))) - _ - false) - (list.empty? poll/2'))))) + _ + false) + (list.empty? poll/2'))))) (def: (after_deletion! fs watcher expected_path) (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit))) @@ -139,15 +139,15 @@ [_ (\ fs delete expected_path) poll/3 (\ watcher poll []) poll/3' (\ watcher poll [])] - (wrap (and (case poll/3 - (^ (list [concern actual_path])) - (and (not (/.creation? concern)) - (not (/.modification? concern)) - (/.deletion? concern)) + (in (and (case poll/3 + (^ (list [concern actual_path])) + (and (not (/.creation? concern)) + (not (/.modification? concern)) + (/.deletion? concern)) - _ - false) - (list.empty? poll/3'))))) + _ + false) + (list.empty? poll/3'))))) (def: #export test Test @@ -164,36 +164,36 @@ expected_path (\ ! map (|>> (format directory /)) (random.ascii/alpha 5)) data ($binary.random 10)] - (wrap (do {! async.monad} - [verdict (do (try.with !) - [no_events_prior_to_creation! - (..no_events_prior_to_creation! fs watcher directory) - - after_creation! - (..after_creation! fs watcher expected_path) - - after_modification! - (..after_modification! fs watcher data expected_path) - - after_deletion! - (..after_deletion! fs watcher expected_path)] - (wrap (and no_events_prior_to_creation! - after_creation! - after_modification! - after_deletion!)))] - (_.cover' [/.mock /.polling] - (try.default false verdict))))) + (in (do {! async.monad} + [verdict (do (try.with !) + [no_events_prior_to_creation! + (..no_events_prior_to_creation! fs watcher directory) + + after_creation! + (..after_creation! fs watcher expected_path) + + after_modification! + (..after_modification! fs watcher data expected_path) + + after_deletion! + (..after_deletion! fs watcher expected_path)] + (in (and no_events_prior_to_creation! + after_creation! + after_modification! + after_deletion!)))] + (_.cover' [/.mock /.polling] + (try.default false verdict))))) (do random.monad [directory (random.ascii/alpha 5) #let [/ "/" [fs watcher] (/.mock /)]] - (wrap (do async.monad - [started? ( \ watcher start /.all directory)] - (_.cover' [/.cannot_poll_a_non_existent_directory] - (case started? - (#try.Success _) - false - - (#try.Failure error) - (exception.match? /.cannot_poll_a_non_existent_directory error)))))) + (in (do async.monad + [started? ( \ watcher start /.all directory)] + (_.cover' [/.cannot_poll_a_non_existent_directory] + (case started? + (#try.Success _) + false + + (#try.Failure error) + (exception.match? /.cannot_poll_a_non_existent_directory error)))))) ))) diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 89c559bb5..24b657f0d 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -140,7 +140,7 @@ (let [count (list.size ..listing)] (do {! random.monad} [choice (\ ! map (n.% count) random.nat)] - (wrap (maybe.assume (list.nth choice ..listing)))))) + (in (maybe.assume (list.nth choice ..listing)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index c784d9cbe..1979003f0 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -73,7 +73,7 @@ [product.right (get@ #//.body) (function.apply #.None) io.run] [product.right (\ utf8.codec decode)] [(\ nat.decimal decode)] - [(nat.= ) wrap]) + [(nat.= ) in]) (try.default false)))] [/.post on_post] diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux index 851214fb8..411ae288d 100644 --- a/stdlib/source/test/lux/world/output/video/resolution.lux +++ b/stdlib/source/test/lux/world/output/video/resolution.lux @@ -47,7 +47,7 @@ (let [count (list.size ..listing)] (do {! random.monad} [choice (\ ! map (n.% count) random.nat)] - (wrap (maybe.assume (list.nth choice ..listing)))))) + (in (maybe.assume (list.nth choice ..listing)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux index 0028cfe9c..6760865e7 100644 --- a/stdlib/source/test/lux/world/program.lux +++ b/stdlib/source/test/lux/world/program.lux @@ -56,15 +56,15 @@ (io.run (do io.monad [actual (/.environment io.monad program)] - (wrap (and (n.= (dictionary.size environment) - (dictionary.size actual)) - (|> actual - dictionary.entries - (list.every? (function (_ [key value]) - (|> environment - (dictionary.get key) - (maybe\map (text\= value)) - (maybe.default false))))))))))) + (in (and (n.= (dictionary.size environment) + (dictionary.size actual)) + (|> actual + dictionary.entries + (list.every? (function (_ [key value]) + (|> environment + (dictionary.get key) + (maybe\map (text\= value)) + (maybe.default false))))))))))) (_.cover [/.unknown_environment_variable] (let [program (/.mock environment home directory)] (|> unknown diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 1cd1473e8..4008c4c5a 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -36,29 +36,29 @@ (implementation (def: (on_read dead?) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (do try.monad [to_echo (try.of_maybe (list.head arguments))] - (wrap [dead? to_echo])))) + (in [dead? to_echo])))) (def: (on_error dead?) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (exception.return [dead? ""]))) (def: (on_write message dead?) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (#try.Success dead?))) (def: (on_destroy dead?) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (#try.Success true))) (def: (on_await dead?) (if dead? - (exception.throw ..dead []) + (exception.except ..dead []) (#try.Success [true /.normal]))))) (def: (io_shell command oops input destruction exit) @@ -96,33 +96,33 @@ destruction (random.ascii/alpha 5) exit random.int #let [shell (/.async (..io_shell command oops input destruction exit))]] - (wrap (do {! async.monad} - [verdict (do (try.with !) - [process (\ shell execute [environment.empty "~" command (list)]) - read (\ process read []) - error (\ process error []) - wrote! (do ! - [write (\ process write input)] - (wrap (#try.Success (case write + (in (do {! async.monad} + [verdict (do (try.with !) + [process (\ shell execute [environment.empty "~" command (list)]) + read (\ process read []) + error (\ process error []) + wrote! (do ! + [write (\ process write input)] + (in (#try.Success (case write + (#try.Success _) + false + + (#try.Failure write) + (text\= input write))))) + destroyed! (do ! + [destroy (\ process destroy [])] + (in (#try.Success (case destroy (#try.Success _) false - (#try.Failure write) - (text\= input write))))) - destroyed! (do ! - [destroy (\ process destroy [])] - (wrap (#try.Success (case destroy - (#try.Success _) - false - - (#try.Failure destroy) - (text\= destruction destroy))))) - await (\ process await [])] - (wrap (and (text\= command read) - (text\= oops error) - wrote! - destroyed! - (i.= exit await))))] - (_.cover' [/.Shell] - (try.default false verdict))))) + (#try.Failure destroy) + (text\= destruction destroy))))) + await (\ process await [])] + (in (and (text\= command read) + (text\= oops error) + wrote! + destroyed! + (i.= exit await))))] + (_.cover' [/.Shell] + (try.default false verdict))))) ))) -- cgit v1.2.3