From a62ce3f9c2b605e0033f4772b0f64c4525de4d86 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 11 Aug 2021 02:38:59 -0400 Subject: Relocated maybe and lazy from data to control. --- stdlib/source/test/aedifex/artifact/snapshot.lux | 2 +- .../test/aedifex/artifact/snapshot/build.lux | 2 +- .../test/aedifex/artifact/snapshot/stamp.lux | 2 +- .../source/test/aedifex/artifact/snapshot/time.lux | 2 +- .../test/aedifex/artifact/snapshot/version.lux | 2 +- stdlib/source/test/aedifex/artifact/time.lux | 2 +- stdlib/source/test/aedifex/artifact/time/date.lux | 2 +- stdlib/source/test/aedifex/artifact/time/time.lux | 2 +- stdlib/source/test/aedifex/artifact/versioning.lux | 4 +- stdlib/source/test/aedifex/cli.lux | 4 +- stdlib/source/test/aedifex/command/auto.lux | 2 +- stdlib/source/test/aedifex/command/deploy.lux | 4 +- stdlib/source/test/aedifex/command/install.lux | 2 +- stdlib/source/test/aedifex/command/version.lux | 2 +- .../source/test/aedifex/dependency/deployment.lux | 4 +- stdlib/source/test/aedifex/metadata/artifact.lux | 4 +- stdlib/source/test/aedifex/metadata/snapshot.lux | 4 +- stdlib/source/test/aedifex/parser.lux | 4 +- stdlib/source/test/aedifex/pom.lux | 2 +- stdlib/source/test/aedifex/repository.lux | 2 +- stdlib/source/test/aedifex/repository/remote.lux | 10 +- stdlib/source/test/aedifex/runtime.lux | 3 +- stdlib/source/test/lux.lux | 48 +++---- stdlib/source/test/lux/abstract/apply.lux | 3 +- stdlib/source/test/lux/abstract/enum.lux | 3 +- stdlib/source/test/lux/abstract/functor.lux | 3 +- stdlib/source/test/lux/abstract/interval.lux | 8 +- stdlib/source/test/lux/control.lux | 4 + .../source/test/lux/control/concurrency/actor.lux | 30 ++--- .../source/test/lux/control/concurrency/async.lux | 2 +- .../source/test/lux/control/concurrency/atom.lux | 8 +- stdlib/source/test/lux/control/concurrency/frp.lux | 8 +- .../test/lux/control/concurrency/semaphore.lux | 9 +- stdlib/source/test/lux/control/concurrency/stm.lux | 2 +- stdlib/source/test/lux/control/continuation.lux | 38 +++--- stdlib/source/test/lux/control/function/memo.lux | 8 +- stdlib/source/test/lux/control/function/mixin.lux | 24 ++-- stdlib/source/test/lux/control/io.lux | 6 +- stdlib/source/test/lux/control/lazy.lux | 67 ++++++++++ stdlib/source/test/lux/control/maybe.lux | 88 +++++++++++++ stdlib/source/test/lux/control/parser.lux | 138 ++++++++++---------- stdlib/source/test/lux/control/parser/analysis.lux | 32 ++--- stdlib/source/test/lux/control/parser/binary.lux | 132 +++++++++---------- stdlib/source/test/lux/control/parser/cli.lux | 34 ++--- stdlib/source/test/lux/control/parser/code.lux | 48 +++---- .../source/test/lux/control/parser/environment.lux | 8 +- stdlib/source/test/lux/control/parser/json.lux | 64 ++++----- .../source/test/lux/control/parser/synthesis.lux | 60 ++++----- stdlib/source/test/lux/control/parser/text.lux | 70 +++++----- stdlib/source/test/lux/control/parser/tree.lux | 20 +-- stdlib/source/test/lux/control/parser/type.lux | 144 ++++++++++----------- stdlib/source/test/lux/control/parser/xml.lux | 75 +++++------ stdlib/source/test/lux/control/reader.lux | 12 +- stdlib/source/test/lux/control/region.lux | 68 +++++----- stdlib/source/test/lux/control/remember.lux | 6 +- stdlib/source/test/lux/control/state.lux | 18 +-- stdlib/source/test/lux/control/thread.lux | 36 +++--- stdlib/source/test/lux/control/try.lux | 2 +- stdlib/source/test/lux/control/writer.lux | 9 +- stdlib/source/test/lux/data.lux | 4 - stdlib/source/test/lux/data/binary.lux | 18 +-- stdlib/source/test/lux/data/collection/array.lux | 3 +- .../source/test/lux/data/collection/dictionary.lux | 2 +- .../lux/data/collection/dictionary/ordered.lux | 9 +- .../test/lux/data/collection/dictionary/plist.lux | 3 +- stdlib/source/test/lux/data/collection/list.lux | 36 +++--- .../test/lux/data/collection/queue/priority.lux | 3 +- .../test/lux/data/collection/set/ordered.lux | 2 +- stdlib/source/test/lux/data/collection/stack.lux | 3 +- .../test/lux/data/collection/tree/finger.lux | 3 +- .../test/lux/data/collection/tree/zipper.lux | 4 +- stdlib/source/test/lux/data/format/json.lux | 2 +- stdlib/source/test/lux/data/format/tar.lux | 42 +++--- stdlib/source/test/lux/data/format/xml.lux | 2 +- stdlib/source/test/lux/data/lazy.lux | 67 ---------- stdlib/source/test/lux/data/maybe.lux | 88 ------------- stdlib/source/test/lux/data/product.lux | 14 +- stdlib/source/test/lux/data/text.lux | 8 +- stdlib/source/test/lux/data/text/encoding.lux | 4 +- stdlib/source/test/lux/data/text/escape.lux | 4 +- stdlib/source/test/lux/data/text/regex.lux | 10 +- stdlib/source/test/lux/ffi.jvm.lux | 8 +- stdlib/source/test/lux/ffi.lua.lux | 2 +- stdlib/source/test/lux/locale/language.lux | 3 +- stdlib/source/test/lux/locale/territory.lux | 3 +- stdlib/source/test/lux/macro.lux | 38 +++--- stdlib/source/test/lux/macro/local.lux | 2 +- stdlib/source/test/lux/macro/poly.lux | 1 + stdlib/source/test/lux/macro/poly/equivalence.lux | 3 +- stdlib/source/test/lux/macro/poly/json.lux | 1 - .../source/test/lux/macro/syntax/annotations.lux | 4 +- stdlib/source/test/lux/macro/syntax/check.lux | 6 +- .../source/test/lux/macro/syntax/declaration.lux | 4 +- stdlib/source/test/lux/macro/syntax/definition.lux | 12 +- stdlib/source/test/lux/macro/syntax/export.lux | 5 +- stdlib/source/test/lux/macro/syntax/input.lux | 4 +- .../source/test/lux/macro/syntax/type/variable.lux | 2 +- stdlib/source/test/lux/math/logic/fuzzy.lux | 4 +- stdlib/source/test/lux/math/number/i64.lux | 14 +- stdlib/source/test/lux/math/number/ratio.lux | 5 +- stdlib/source/test/lux/meta.lux | 138 ++++++++++---------- stdlib/source/test/lux/program.lux | 6 +- stdlib/source/test/lux/target/jvm.lux | 22 ++-- stdlib/source/test/lux/test.lux | 8 +- stdlib/source/test/lux/time.lux | 2 +- stdlib/source/test/lux/time/date.lux | 4 +- stdlib/source/test/lux/time/instant.lux | 2 +- .../compiler/language/lux/phase/analysis/case.lux | 6 +- .../language/lux/phase/analysis/function.lux | 4 +- .../language/lux/phase/analysis/primitive.lux | 2 +- .../language/lux/phase/analysis/reference.lux | 6 +- .../language/lux/phase/analysis/structure.lux | 20 +-- .../language/lux/phase/extension/analysis/lux.lux | 2 +- .../compiler/language/lux/phase/synthesis/case.lux | 10 +- .../language/lux/phase/synthesis/function.lux | 9 +- .../language/lux/phase/synthesis/primitive.lux | 2 +- .../language/lux/phase/synthesis/structure.lux | 6 +- stdlib/source/test/lux/type.lux | 4 +- stdlib/source/test/lux/type/check.lux | 121 +++++++++-------- stdlib/source/test/lux/type/refinement.lux | 3 +- stdlib/source/test/lux/type/resource.lux | 14 +- stdlib/source/test/lux/type/variance.lux | 16 +-- stdlib/source/test/lux/world/console.lux | 2 +- stdlib/source/test/lux/world/file/watch.lux | 2 +- stdlib/source/test/lux/world/input/keyboard.lux | 3 +- stdlib/source/test/lux/world/net/http/client.lux | 4 +- .../test/lux/world/output/video/resolution.lux | 3 +- stdlib/source/test/lux/world/program.lux | 6 +- 128 files changed, 1149 insertions(+), 1132 deletions(-) create mode 100644 stdlib/source/test/lux/control/lazy.lux create mode 100644 stdlib/source/test/lux/control/maybe.lux delete mode 100644 stdlib/source/test/lux/data/lazy.lux delete mode 100644 stdlib/source/test/lux/data/maybe.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux index f196586ac..c4ebdfc66 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot.lux @@ -39,7 +39,7 @@ (|> expected /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/build.lux b/stdlib/source/test/aedifex/artifact/snapshot/build.lux index e613c2f92..d207053c9 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/build.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/build.lux @@ -33,7 +33,7 @@ (|> expected /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) )))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux index 2a2c19e4f..ed77767cb 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/stamp.lux @@ -40,7 +40,7 @@ (_.cover [/.format /.parser] (|> expected /.format - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) ))) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/time.lux b/stdlib/source/test/aedifex/artifact/snapshot/time.lux index a658d3e29..7f33a9e86 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/time.lux @@ -35,7 +35,7 @@ (_.cover [/.format /.parser] (|> expected /.format - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false))) )) diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version.lux b/stdlib/source/test/aedifex/artifact/snapshot/version.lux index c5ec63398..3976d7054 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version.lux @@ -42,7 +42,7 @@ (|> expected /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index ed60f6389..8270969fd 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -42,7 +42,7 @@ (_.cover [/.format /.parser] (|> expected /.format - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) (do random.monad diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index e58ed00f9..212aa01dd 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -48,7 +48,7 @@ (_.cover [/.format /.parser] (|> expected /.format - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false))) (_.cover [/.value /.date] diff --git a/stdlib/source/test/aedifex/artifact/time/time.lux b/stdlib/source/test/aedifex/artifact/time/time.lux index 9358e7bab..4dcdac3cc 100644 --- a/stdlib/source/test/aedifex/artifact/time/time.lux +++ b/stdlib/source/test/aedifex/artifact/time/time.lux @@ -32,7 +32,7 @@ (_.cover [/.format /.parser] (|> expected /.format - (.run /.parser) + (.result /.parser) (try\map (\ time.equivalence = expected)) (try.else false)))) ))) diff --git a/stdlib/source/test/aedifex/artifact/versioning.lux b/stdlib/source/test/aedifex/artifact/versioning.lux index 5a0b2df20..aa90619cb 100644 --- a/stdlib/source/test/aedifex/artifact/versioning.lux +++ b/stdlib/source/test/aedifex/artifact/versioning.lux @@ -41,14 +41,14 @@ (|> expected /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) (_.cover [/.init] (|> /.init /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = /.init)) (try.else false))) ))) diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 4b5e79ac5..45ec92f4e 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -73,7 +73,7 @@ (_.test "Without profile." (|> expected ..format - (cli.run /.command) + (cli.result /.command) (case> (#try.Success [name actual]) (and (text\= //.default name) (\ /.equivalence = expected actual)) @@ -90,7 +90,7 @@ (|> expected_command ..format (list& "with" expected_profile) - (cli.run /.command) + (cli.result /.command) (case> (#try.Success [actual_profile actual_command]) (and (text\= expected_profile actual_profile) (\ /.equivalence = expected_command actual_command)) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 074eeab5e..934810e0c 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -98,7 +98,7 @@ (in (do async.monad [verdict (do ///action.monad [_ (\ fs make_directory source) - _ (\ fs write (binary.create 0) dummy_path) + _ (\ fs write (binary.empty 0) dummy_path) .let [[@runs command] (..command expected_runs end_signal fs dummy_path)] _ (\ watcher poll [])] (do {! async.monad} diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 4bdbafd59..4d11234bd 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -5,13 +5,13 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["." try (#+ Try)] [concurrency ["." async (#+ Async)]] [parser ["." environment]]] [data - ["." maybe] ["." binary ("#\." equivalence)] ["." text ("#\." equivalence) ["%" format (#+ format)] @@ -84,7 +84,7 @@ (get@ #///.sources) set.list (export.library fs) - (\ ! map (format.run tar.writer))) + (\ ! map (format.result 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)) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index a3cd99edd..86fe5ebea 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -50,7 +50,7 @@ [_ (: (Async (Try Any)) (file.make_directories async.monad fs head))] (: (Async (Try Any)) - (file.make_file async.monad fs (binary.create 0) (format head / head ".lux"))))))))) + (file.make_file async.monad fs (binary.empty 0) (format head / head ".lux"))))))))) (def: (execute! program fs sample) (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text))) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index f1c424289..0400cbc58 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -5,12 +5,12 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["." try] ["." exception (#+ exception:)] [concurrency ["." async (#+ Async)]]] [data - ["." maybe] ["." text ("#\." equivalence) ["%" format (#+ format)]]] [math diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 0add3a487..7352de63a 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -7,13 +7,13 @@ ["." hash (#+ Hash)]] [control ["." io (#+ IO)] + ["." maybe ("#\." functor)] ["." try ("#\." functor)] [concurrency ["." atom (#+ Atom)] ["." async]]] [data ["." product] - ["." maybe ("#\." functor)] ["." binary (#+ Binary) ("#\." equivalence)] ["." text ["%" format (#+ format)]] @@ -54,7 +54,7 @@ [http/status.created {#@http.headers (http.headers (list)) #@http.body (function (_ _) - (|> [0 (binary.create 0)] + (|> [0 (binary.empty 0)] #try.Success io.io))}]) diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 2e6a8e10f..7bcb0bd91 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -7,6 +7,7 @@ [\\specification ["$." equivalence]]] [control + ["." maybe] ["." try ("#\." functor)] [parser ["." environment] @@ -14,7 +15,6 @@ [concurrency ["." async]]] [data - ["." maybe] ["." text ("#\." equivalence)] [collection ["." list]]] @@ -88,7 +88,7 @@ (|> expected /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) (_.cover [/.uri] diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 7b375d42c..5683178c4 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -7,6 +7,7 @@ [\\specification ["$." equivalence]]] [control + ["." maybe] ["." try ("#\." functor)] [parser ["." environment] @@ -14,7 +15,6 @@ [concurrency ["." async]]] [data - ["." maybe] ["." text ("#\." equivalence)] [collection ["." list]]] @@ -100,7 +100,7 @@ (|> expected /.format list - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false))) (_.cover [/.uri] diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 4c882ea4a..354352d6a 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -74,7 +74,7 @@ (|> expected //format.profile list - (.run /.project) + (.result /.project) (case> (#try.Success actual) (|> expected ..with_default_sources @@ -99,7 +99,7 @@ (|> expected //format.project list - (.run /.project) + (.result /.project) (case> (#try.Success actual) (|> expected ..with_empty_profile diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux index 657c6192d..f51ac9abc 100644 --- a/stdlib/source/test/aedifex/pom.lux +++ b/stdlib/source/test/aedifex/pom.lux @@ -37,7 +37,7 @@ (get@ #//.identity expected)] [(#try.Success pom) (#.Some _)] - (case (.run /.parser (list pom)) + (case (.result /.parser (list pom)) (#try.Success actual) (\ //.equivalence = (|> (\ //.monoid identity) diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 478f02d7e..33f719efc 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -98,7 +98,7 @@ (dictionary.put (remote.uri ..invalid_version (..artifact ..invalid_version) //artifact/extension.lux_library) - (binary.create 0))))))) + (binary.empty 0))))))) /identity.test /origin.test diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux index 0ff764bdd..8cca4aee8 100644 --- a/stdlib/source/test/aedifex/repository/remote.lux +++ b/stdlib/source/test/aedifex/repository/remote.lux @@ -6,12 +6,12 @@ [monad (#+ do)]] [control ["." io (#+ IO)] + ["." maybe ("#\." functor)] ["." try ("#\." monad)] ["." exception] ["." function]] [data ["." binary ("#\." equivalence)] - ["." maybe ("#\." functor)] ["." text ("#\." equivalence) ["%" format (#+ format)] [encoding @@ -99,20 +99,20 @@ #//identity.password password}) address)] (and (|> (\ repo download uri) - io.run + io.run! (try\map (\ utf8.codec decode)) try\join (try\map (text\= (format address uri))) (try.else false)) (|> (\ repo upload uri content) - io.run + io.run! (try\map (function.constant true)) (try.else false))))) (_.cover [/.upload_failure] (let [repo (/.repository (..good_http user password) #.None address)] - (case (io.run (\ repo upload uri content)) + (case (io.run! (\ repo upload uri content)) (#try.Failure error) (exception.match? /.upload_failure error) @@ -122,7 +122,7 @@ (let [repo (/.repository ..bad_http #.None address)] - (case (io.run (\ repo download uri)) + (case (io.run! (\ repo download uri)) (#try.Failure error) (exception.match? /.download_failure error) diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index 7508239ad..c9e61b017 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -6,8 +6,9 @@ [monad (#+ do)] [\\specification ["$." equivalence]]] + [control + ["." maybe ("#\." functor)]] [data - ["." maybe ("#\." functor)] ["." text ("#\." equivalence)] [collection ["." list ("#\." functor)] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index a659b6523..e8af74a92 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -179,8 +179,8 @@ (#.Right _) false)) - (_.cover [/.error!] - (case (/.try (/.error! expected_error)) + (_.cover [/.panic!] + (case (/.try (/.panic! expected_error)) (#.Left actual_error) (text.contains? expected_error actual_error) @@ -287,7 +287,7 @@ ((/.<<| (n.* factor) inc) start))) ))) -(def: example "YOLO") +(def: example_identifier "YOLO") (def: i8 8) (def: current_module @@ -305,12 +305,12 @@ (code\= (code.rev .2) (/.' .2)) (code\= (code.frac +3.4) (/.' +3.4)) (code\= (code.text "5") (/.' "5")) - (code\= (code.identifier ["" "example"]) - (/.' example)) - (code\= (code.identifier [/.prelude_module "example"]) - (/.' .example)) - (code\= (code.identifier [..current_module "example"]) - (/.' ..example)) + (code\= (code.identifier ["" "example_identifier"]) + (/.' example_identifier)) + (code\= (code.identifier [/.prelude_module "example_identifier"]) + (/.' .example_identifier)) + (code\= (code.identifier [..current_module "example_identifier"]) + (/.' ..example_identifier)) (code\= (code.tag ["" "example"]) (/.' #example)) (code\= (code.tag [/.prelude_module "example"]) @@ -340,12 +340,12 @@ (code\= (code.rev .2) (/.` .2)) (code\= (code.frac +3.4) (/.` +3.4)) (code\= (code.text "5") (/.` "5")) - (code\= (code.identifier [..current_module "example"]) - (/.` example)) - (code\= (code.identifier [/.prelude_module "example"]) - (/.` .example)) - (code\= (code.identifier [..current_module "example"]) - (/.` ..example)) + (code\= (code.identifier [..current_module "example_identifier"]) + (/.` example_identifier)) + (code\= (code.identifier [/.prelude_module "example_identifier"]) + (/.` .example_identifier)) + (code\= (code.identifier [..current_module "example_identifier"]) + (/.` ..example_identifier)) (code\= (code.tag [..current_module "example"]) (/.` #example)) (code\= (code.tag [/.prelude_module "example"]) @@ -374,12 +374,12 @@ (code\= (code.rev .2) (/.`' .2)) (code\= (code.frac +3.4) (/.`' +3.4)) (code\= (code.text "5") (/.`' "5")) - (code\= (code.identifier ["" "example"]) - (/.`' example)) - (code\= (code.identifier [/.prelude_module "example"]) - (/.`' .example)) - (code\= (code.identifier [..current_module "example"]) - (/.`' ..example)) + (code\= (code.identifier ["" "example_identifier"]) + (/.`' example_identifier)) + (code\= (code.identifier [/.prelude_module "example_identifier"]) + (/.`' .example_identifier)) + (code\= (code.identifier [..current_module "example_identifier"]) + (/.`' ..example_identifier)) (code\= (code.tag ["" "example"]) (/.`' #example)) (code\= (code.tag [/.prelude_module "example"]) @@ -1007,10 +1007,10 @@ post (random.only (|>> (n.= pre) not) random.nat) .let [box (atom.atom pre)]] (_.cover [/.exec] - (and (is? pre (io.run (atom.read! box))) + (and (is? pre (io.run! (atom.read! box))) (/.exec - (io.run (atom.write! post box)) - (is? post (io.run (atom.read! box))))))) + (io.run! (atom.write! post box)) + (is? post (io.run! (atom.read! box))))))) )) (def: identity/constant diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux index 7a940adb3..26bb2cc7e 100644 --- a/stdlib/source/test/lux/abstract/apply.lux +++ b/stdlib/source/test/lux/abstract/apply.lux @@ -3,8 +3,9 @@ [lux #* [abstract [monad (#+ do)]] + [control + ["." maybe]] [data - ["." maybe] [collection ["." list]]] [math diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 8de8d659f..88d4cc732 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -4,9 +4,10 @@ ["_" test (#+ Test)] [abstract [monad (#+ do)]] + [control + ["." maybe ("#\." functor)]] [data ["." product] - ["." maybe ("#\." functor)] [collection ["." list ("#\." fold)]]] [math diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux index 178f33273..252e9b999 100644 --- a/stdlib/source/test/lux/abstract/functor.lux +++ b/stdlib/source/test/lux/abstract/functor.lux @@ -4,8 +4,9 @@ ["_" test (#+ Test)] [abstract [monad (#+ do)]] + [control + ["." maybe]] [data - ["." maybe] [collection ["." list]]] [math diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 2b588f309..76b45ddce 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -140,7 +140,7 @@ (do {! random.monad} [[l m r] (|> (random.set n.hash 3 random.nat) (\ ! map (|>> set.list - (list.sort n.<) + (list.sorted n.<) (case> (^ (list b t1 t2)) [b t1 t2] @@ -162,7 +162,7 @@ (do {! random.monad} [[b t1 t2] (|> (random.set n.hash 3 random.nat) (\ ! map (|>> set.list - (list.sort n.<) + (list.sorted n.<) (case> (^ (list b t1 t2)) [b t1 t2] @@ -189,7 +189,7 @@ [some_interval ..interval [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) (\ ! map (|>> set.list - (list.sort n.<) + (list.sorted n.<) (case> (^ (list x0 x1 x2 x3)) [x0 x1 x2 x3] @@ -222,7 +222,7 @@ [some_interval ..interval [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) (\ ! map (|>> set.list - (list.sort n.<) + (list.sorted n.<) (case> (^ (list x0 x1 x2 x3)) [x0 x1 x2 x3] diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux index 4ac09ca39..1c7f71963 100644 --- a/stdlib/source/test/lux/control.lux +++ b/stdlib/source/test/lux/control.lux @@ -16,6 +16,8 @@ ["#." exception] ["#." function] ["#." io] + ["#." lazy] + ["#." maybe] ["#." parser] ["#." pipe] ["#." reader] @@ -57,6 +59,8 @@ /exception.test /function.test /io.test + /lazy.test + /maybe.test /parser.test /pipe.test /reader.test diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index b97f6498f..b7458e8c8 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -61,26 +61,26 @@ (_.for [/.Actor]) ($_ _.and (_.cover [/.alive?] - (io.run (do io.monad - [actor (/.spawn! /.default 0)] - (/.alive? actor)))) + (io.run! (do io.monad + [actor (/.spawn! /.default 0)] + (/.alive? actor)))) (_.cover [/.poison!] (let [poisoned_actors_die! - (io.run (do io.monad - [actor (/.spawn! /.default 0) - poisoned? (/.poison! actor) - alive? (/.alive? actor)] - (in (and (..mailed? poisoned?) - (not alive?))))) + (io.run! (do io.monad + [actor (/.spawn! /.default 0) + poisoned? (/.poison! actor) + alive? (/.alive? actor)] + (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)] - (in (and (..mailed? first_time?) - (not (..mailed? second_time?))))))] + (io.run! (do io.monad + [actor (/.spawn! /.default 0) + first_time? (/.poison! actor) + second_time? (/.poison! actor)] + (in (and (..mailed? first_time?) + (not (..mailed? second_time?))))))] (and poisoned_actors_die! cannot_poison_more_than_once!))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index f4353bc4f..23cb61056 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -33,7 +33,7 @@ (def: comparison (Comparison /.Async) (function (_ == left right) - (io.run + (io.run! (do io.monad [?left (/.poll left) ?right (/.poll right)] diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index e3c5a9b89..939fe7d9f 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -21,7 +21,7 @@ [expected random.nat .let [box (/.atom expected)]] (_.cover [/.Atom /.atom /.read!] - (io.run + (io.run! (do io.monad [actual (/.read! box)] (in (is? expected actual)))))) @@ -31,7 +31,7 @@ expected random.nat .let [box (/.atom target)]] (_.cover [/.compare_and_swap!] - (io.run + (io.run! (do io.monad [swapped_unknown? (/.compare_and_swap! unknown expected box) swapped_target? (/.compare_and_swap! target expected box) @@ -44,7 +44,7 @@ shift random.nat .let [box (/.atom init)]] (_.cover [/.update!] - (io.run + (io.run! (do io.monad [[pre post] (/.update! (n.+ shift) box)] (in (and (is? init pre) @@ -55,7 +55,7 @@ post random.nat .let [box (/.atom pre)]] (_.cover [/.write!] - (io.run + (io.run! (do io.monad [old (/.write! post box) new (/.read! box)] diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 675eabfa3..8bb5a33fd 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -34,7 +34,7 @@ (def: comparison (Comparison /.Channel) (function (_ == left right) - (io.run + (io.run! (do io.monad [?left (async.poll left) ?right (async.poll right)] @@ -84,14 +84,14 @@ ($monad.spec ..injection ..comparison /.monad)) (_.cover [/.Channel /.Sink /.channel] - (case (io.run + (case (io.run! (do (try.with io.monad) [.let [[channel sink] (/.channel [])] _ (\ sink feed sample) _ (\ sink close)] (in channel))) (#try.Success channel) - (io.run + (io.run! (do io.monad [?actual (async.poll channel)] (in (case ?actual @@ -104,7 +104,7 @@ (#try.Failure error) false)) (_.cover [/.channel_is_already_closed] - (case (io.run + (case (io.run! (do (try.with io.monad) [.let [[channel sink] (/.channel [])] _ (\ sink close)] diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 58492c733..94017a803 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -8,13 +8,13 @@ ["." enum]] [control ["." io] + ["." maybe] ["." try] ["." exception (#+ exception:)] [concurrency ["." async (#+ Async)] ["." atom (#+ Atom)]]] [data - ["." maybe] ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection @@ -122,7 +122,7 @@ (in (do async.monad [_ processA _ processB - .let [outcome (io.run (atom.read! resource))]] + .let [outcome (io.run! (atom.read! resource))]] (_.cover' [/.mutex /.synchronize] (or (text\= (format expected_As expected_Bs) outcome) @@ -166,10 +166,11 @@ expected_ids (enum.range n.enum 0 (dec limit))] _ (|> expected_ids (list\map (function (_ id) - (exec (io.run (atom.update! (|>> (format suffix)) resource)) + (exec + (io.run! (atom.update! (|>> (format suffix)) resource)) (waiter resource barrier id)))) (monad.seq !)) - .let [outcome (io.run (atom.read! resource))]] + .let [outcome (io.run! (atom.read! resource))]] (_.cover' [/.barrier /.block] (and (text.ends_with? expected_ending outcome) (list.every? (function (_ id) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 7c9b3137d..3b0b5cf72 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -81,7 +81,7 @@ output)))) (in (do async.monad [.let [box (/.var dummy) - [follower sink] (io.run (/.follow box))] + [follower sink] (io.run! (/.follow box))] _ (/.commit (/.write expected box)) _ (/.commit (/.update (n.* 2) box)) _ (async.future (\ sink close)) diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index a0dcec237..357c87d61 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -25,7 +25,7 @@ (def: comparison (Comparison /.Cont) (function (_ == left right) - (== (/.run left) (/.run right)))) + (== (/.result left) (/.result right)))) (def: .public test Test @@ -44,27 +44,27 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.run] - (n.= sample (/.run (_\in sample)))) + (_.cover [/.result] + (n.= sample (/.result (_\in sample)))) (_.cover [/.call/cc] (n.= (n.* 2 sample) - (/.run (do {! /.monad} - [value (/.call/cc - (function (_ k) - (do ! - [temp (k sample)] - ... If this code where to run, - ... the output would be - ... (n.* 4 sample) - (k temp))))] - (in (n.* 2 value)))))) + (/.result (do {! /.monad} + [value (/.call/cc + (function (_ k) + (do ! + [temp (k sample)] + ... If this code where to run, + ... the output would be + ... (n.* 4 sample) + (k temp))))] + (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)]) - (in output)))))) + (/.result (do /.monad + [[restart [output idx]] (/.portal [sample 0])] + (if (n.< 10 idx) + (restart [(n.+ 10 output) (inc idx)]) + (in output)))))) (_.cover [/.shift /.reset] (let [(^open "_\.") /.monad (^open "list\.") (list.equivalence n.equivalence) @@ -83,7 +83,7 @@ (in (#.Item x tail)))))] (visit output)))))] (list\= elems - (/.run (/.reset (visit elems)))))) + (/.result (/.reset (visit elems)))))) (_.cover [/.continue] (/.continue (is? sample) (: (/.Cont Nat Bit) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index b5bea4224..a91f2a69a 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -62,7 +62,7 @@ (_.for [/.Memo]) ($_ _.and (_.cover [/.closed /.none] - (io.run + (io.run! (do io.monad [.let [slow (/.none n.hash ..fibonacci) fast (/.closed n.hash fibonacci)] @@ -78,7 +78,7 @@ (in (and same_output! memo_is_faster!))))) (_.cover [/.open] - (io.run + (io.run! (do io.monad [.let [none (/.none n.hash ..fibonacci) memory (dictionary.empty n.hash) @@ -102,7 +102,7 @@ incrementalism_is_faster!))))) (_.cover [/.memoization] (let [memo (<| //.mixin - (//.inherit /.memoization) + (//.with /.memoization) (: (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) (function (factorial delegate recur input) (case input @@ -114,7 +114,7 @@ (list\map inc) (list\fold n.* 1)) actual (|> (memo input) - (state.run (dictionary.empty n.hash)) + (state.result (dictionary.empty n.hash)) product.right)] (n.= expected actual))) ))) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 5cd283eaa..19e67b7aa 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -55,7 +55,7 @@ _ (n.* input (recur (dec input))))))] (n.= expected (factorial input)))) - (_.cover [/.inherit] + (_.cover [/.with] (let [bottom (: (/.Mixin Nat Nat) (function (_ delegate recur input) (case input @@ -64,7 +64,7 @@ multiplication (: (/.Mixin Nat Nat) (function (_ delegate recur input) (n.* input (recur (dec input))))) - factorial (/.mixin (/.inherit bottom multiplication))] + factorial (/.mixin (/.with bottom multiplication))] (n.= expected (factorial input)))) (_.cover [/.nothing] @@ -73,8 +73,8 @@ (case input (^or 0 1) 1 _ (n.* input (delegate (dec input)))))) - left (/.mixin (/.inherit /.nothing loop)) - right (/.mixin (/.inherit loop /.nothing))] + left (/.mixin (/.with /.nothing loop)) + right (/.mixin (/.with loop /.nothing))] (and (n.= expected (left input)) (n.= expected @@ -91,8 +91,8 @@ multiplication (: (/.Mixin Nat Nat) (function (_ delegate recur input) (n.* input (recur (dec input))))) - factorial (/.mixin (/.inherit (/.advice bottom? bottom) - multiplication))] + factorial (/.mixin (/.with (/.advice bottom? bottom) + multiplication))] (n.= expected (factorial input)))) (_.cover [/.before] @@ -104,10 +104,10 @@ (function (_ delegate recur input) (function (_ state) [state (n.+ state input)]))) - function (/.mixin (/.inherit (/.before state.monad implant) - meld))] + function (/.mixin (/.with (/.before state.monad implant) + meld))] (n.= (n.+ shift input) - (|> input function (state.run dummy) product.right)))) + (|> input function (state.result dummy) product.right)))) (_.cover [/.after] (let [implant (: (-> Nat Nat (State Nat [])) (function (_ input output) @@ -117,10 +117,10 @@ (function (_ delegate recur input) (function (_ state) [state (n.+ state input)]))) - function (/.mixin (/.inherit (/.after state.monad implant) - meld))] + function (/.mixin (/.with (/.after state.monad implant) + meld))] (n.= (n.+ dummy input) - (|> input function (state.run dummy) product.right)))) + (|> input function (state.result dummy) product.right)))) )) (_.for [/.Recursive] (_.cover [/.of_recursive] diff --git a/stdlib/source/test/lux/control/io.lux b/stdlib/source/test/lux/control/io.lux index 43d891a61..51b5864ae 100644 --- a/stdlib/source/test/lux/control/io.lux +++ b/stdlib/source/test/lux/control/io.lux @@ -24,7 +24,7 @@ (def: comparison (Comparison IO) (function (_ == left right) - (== (/.run left) (/.run right)))) + (== (/.run! left) (/.run! right)))) (def: .public test Test @@ -41,7 +41,7 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.run /.io] + (_.cover [/.run! /.io] (n.= sample - (/.run (/.io sample)))) + (/.run! (/.io sample)))) )))) diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux new file mode 100644 index 000000000..c9de9cb25 --- /dev/null +++ b/stdlib/source/test/lux/control/lazy.lux @@ -0,0 +1,67 @@ +(.module: + [library + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + [\\specification + ["$." functor (#+ Injection Comparison)] + ["$." apply] + ["$." monad] + ["$." equivalence]]] + [data + ["." product]] + [math + ["." random (#+ Random)] + [number + ["n" nat]]]]] + [\\library + ["." / (#+ Lazy)]]) + +(def: injection + (Injection Lazy) + (|>> /.lazy)) + +(def: comparison + (Comparison Lazy) + (function (_ ==) + (\ (/.equivalence ==) =))) + +(def: .public lazy + (All [a] (-> (Random a) (Random (Lazy a)))) + (\ random.functor map (|>> /.lazy))) + +(def: .public test + Test + (with_expansions [ (: [Nat Nat] + [(n.+ left right) + (n.* left right)])] + (<| (_.covering /._) + (do random.monad + [left random.nat + right random.nat + .let [expected ]] + (_.for [/.Lazy] + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec (/.equivalence n.equivalence) (..lazy random.nat))) + (_.for [/.functor] + ($functor.spec ..injection ..comparison /.functor)) + (_.for [/.apply] + ($apply.spec ..injection ..comparison /.apply)) + (_.for [/.monad] + ($monad.spec ..injection ..comparison /.monad)) + + (_.cover [/.lazy] + (let [lazy (/.lazy ) + (^open "\=") (product.equivalence n.equivalence n.equivalence)] + (\= expected + (/.value lazy)))) + + (_.cover [/.value] + (let [lazy (/.lazy )] + (and (not (is? expected + (/.value lazy))) + (is? (/.value lazy) + (/.value lazy))))) + )))))) diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux new file mode 100644 index 000000000..a2a85eae1 --- /dev/null +++ b/stdlib/source/test/lux/control/maybe.lux @@ -0,0 +1,88 @@ +(.module: + [library + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + [\\specification + ["$." equivalence] + ["$." hash] + ["$." monoid] + ["$." functor] + ["$." apply] + ["$." monad]]] + [control + ["." io ("#\." monad)] + pipe] + [data + ["." text] + [collection + ["." list]]] + [math + ["." random (#+ Random)] + [number + ["n" nat]]]]] + [\\library + ["." / ("#\." monoid monad)]]) + +(def: .public test + Test + (<| (_.covering /._) + (_.for [.Maybe]) + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec (/.equivalence n.equivalence) (random.maybe random.nat))) + (_.for [/.hash] + (|> random.nat + (\ random.monad map (|>> #.Some)) + ($hash.spec (/.hash n.hash)))) + (_.for [/.monoid] + ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) + (_.for [/.functor] + ($functor.spec /\in /.equivalence /.functor)) + (_.for [/.apply] + ($apply.spec /\in /.equivalence /.apply)) + (_.for [/.monad] + ($monad.spec /\in /.equivalence /.monad)) + + (do random.monad + [left random.nat + right random.nat + .let [expected (n.+ left right)]] + (let [lift (/.lift io.monad)] + (_.cover [/.with /.lift] + (|> (io.run! (do (/.with io.monad) + [a (lift (io\in left)) + b (in right)] + (in (n.+ a b)))) + (case> (#.Some actual) + (n.= expected actual) + + _ + false))))) + (do random.monad + [default random.nat + value random.nat] + (_.cover [/.else] + (and (is? default (/.else default + #.None)) + + (is? value (/.else default + (#.Some value)))))) + (do random.monad + [value random.nat] + (_.cover [/.assume] + (is? value (/.assume (#.Some value))))) + (do random.monad + [value random.nat] + (_.cover [/.list] + (\ (list.equivalence n.equivalence) = + (list value) + (/.list (#.Some value))))) + (do random.monad + [expected random.nat + .let [(^open "/\.") (/.equivalence n.equivalence)]] + (_.cover [/.when] + (and (/\= (#.Some expected) (/.when true (#.Some expected))) + (/\= #.None (/.when false (#.Some expected)))))) + ))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 7b183db51..224943369 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -51,7 +51,7 @@ (def: (enforced? parser input) (All [s] (-> (Parser s Any) s Bit)) - (case (/.run parser input) + (case (/.result parser input) (#try.Success [_ []]) #1 @@ -60,7 +60,7 @@ (def: (found? parser input) (All [s] (-> (Parser s Bit) s Bit)) - (case (/.run parser input) + (case (/.result parser input) (#try.Success [_ #1]) #1 @@ -96,82 +96,82 @@ ($_ _.and (_.cover [/.maybe] (and (|> (list (code.nat expected0)) - (/.run (/.maybe .nat)) + (/.result (/.maybe .nat)) (match (#.Some actual) (n.= expected0 actual))) (|> (list (code.int (.int expected0))) - (/.run (/.maybe .nat)) + (/.result (/.maybe .nat)) (match #.None #1)))) (_.cover [/.some] (and (|> (list\map code.nat expected+) - (/.run (/.some .nat)) + (/.result (/.some .nat)) (match actual (\ (list.equivalence n.equivalence) = expected+ actual))) (|> (list\map (|>> .int code.int) expected+) - (/.run (/.some .nat)) + (/.result (/.some .nat)) (match #.End #1)))) (_.cover [/.many] (and (|> (list\map code.nat expected+) - (/.run (/.many .nat)) + (/.result (/.many .nat)) (match actual (\ (list.equivalence n.equivalence) = expected+ actual))) (|> (list (code.nat expected0)) - (/.run (/.many .nat)) + (/.result (/.many .nat)) (match (list actual) (n.= expected0 actual))) (|> (list\map (|>> .int code.int) expected+) - (/.run (/.many .nat)) + (/.result (/.many .nat)) fails?))) (_.cover [/.only] (and (|> (list (code.nat even0)) - (/.run (/.only n.even? .nat)) + (/.result (/.only n.even? .nat)) (match actual (n.= even0 actual))) (|> (list (code.nat odd0)) - (/.run (/.only n.even? .nat)) + (/.result (/.only n.even? .nat)) fails?))) (_.cover [/.and] (let [even (/.only n.even? .nat) odd (/.only n.odd? .nat)] (and (|> (list (code.nat even0) (code.nat odd0)) - (/.run (/.and even odd)) + (/.result (/.and even odd)) (match [left right] (and (n.= even0 left) (n.= odd0 right)))) (|> (list (code.nat odd0) (code.nat even0)) - (/.run (/.and even odd)) + (/.result (/.and even odd)) fails?)))) (_.cover [/.or] (let [even (/.only n.even? .nat) odd (/.only n.odd? .nat)] (and (|> (list (code.nat even0)) - (/.run (/.or even odd)) + (/.result (/.or even odd)) (match (#.Left actual) (n.= even0 actual))) (|> (list (code.nat odd0)) - (/.run (/.or even odd)) + (/.result (/.or even odd)) (match (#.Right actual) (n.= odd0 actual))) (|> (list (code.bit not0)) - (/.run (/.or even odd)) + (/.result (/.or even odd)) fails?)))) (_.cover [/.either] (let [even (/.only n.even? .nat) odd (/.only n.odd? .nat)] (and (|> (list (code.nat even0)) - (/.run (/.either even odd)) + (/.result (/.either even odd)) (match actual (n.= even0 actual))) (|> (list (code.nat odd0)) - (/.run (/.either even odd)) + (/.result (/.either even odd)) (match actual (n.= odd0 actual))) (|> (list (code.bit not0)) - (/.run (/.either even odd)) + (/.result (/.either even odd)) fails?)))) (_.cover [/.not] (and (|> (list (code.nat expected0)) - (/.run (/.not .nat)) + (/.result (/.not .nat)) fails?) (|> (list (code.bit not0)) - (/.run (/.not .nat)) + (/.result (/.not .nat)) (match [] #1)))) ))) @@ -187,70 +187,70 @@ ($_ _.and (_.cover [/.exactly] (and (|> (list\map code.nat expected+) - (/.run (/.exactly times .nat)) + (/.result (/.exactly times .nat)) (match actual (\ (list.equivalence n.equivalence) = (list.take times expected+) actual))) (|> (list\map code.nat expected+) - (/.run (/.exactly (inc variadic) .nat)) + (/.result (/.exactly (inc variadic) .nat)) fails?))) (_.cover [/.at_least] (and (|> (list\map code.nat expected+) - (/.run (/.at_least times .nat)) + (/.result (/.at_least times .nat)) (match actual (\ (list.equivalence n.equivalence) = expected+ actual))) (|> (list\map code.nat expected+) - (/.run (/.at_least (inc variadic) .nat)) + (/.result (/.at_least (inc variadic) .nat)) fails?))) (_.cover [/.at_most] (and (|> (list\map code.nat expected+) - (/.run (/.at_most times .nat)) + (/.result (/.at_most times .nat)) (match actual (\ (list.equivalence n.equivalence) = (list.take times expected+) actual))) (|> (list\map code.nat expected+) - (/.run (/.at_most (inc variadic) .nat)) + (/.result (/.at_most (inc variadic) .nat)) (match actual (\ (list.equivalence n.equivalence) = expected+ actual))))) (_.cover [/.between] (and (|> (list\map code.nat expected+) - (/.run (/.between times (n.- times variadic) .nat)) + (/.result (/.between times (n.- times variadic) .nat)) (match actual (\ (list.equivalence n.equivalence) = expected+ actual))) (|> (list\map code.nat (list.take times expected+)) - (/.run (/.between times (n.- times variadic) .nat)) + (/.result (/.between times (n.- times variadic) .nat)) (match actual (\ (list.equivalence n.equivalence) = (list.take times expected+) actual))))) (_.cover [/.separated_by] - (|> (list.interpose (code.text separator) (list\map code.nat expected+)) - (/.run (/.separated_by (.this! (code.text separator)) .nat)) + (|> (list.interposed (code.text separator) (list\map code.nat expected+)) + (/.result (/.separated_by (.this! (code.text separator)) .nat)) (match actual (\ (list.equivalence n.equivalence) = expected+ actual)))) (_.cover [/.remaining] (|> (list\map code.nat expected+) - (/.run /.remaining) + (/.result /.remaining) (match actual (\ (list.equivalence code.equivalence) = (list\map code.nat expected+) actual)))) (_.cover [/.else] - (and (|> (/.run (/.else wrong (\ /.monad in expected)) (list)) + (and (|> (/.result (/.else wrong (\ /.monad in expected)) (list)) (match actual (n.= expected actual))) - (|> (/.run (/.else expected (: (Parser (List Code) Nat) - (/.failure "yolo"))) - (list)) + (|> (/.result (/.else expected (: (Parser (List Code) Nat) + (/.failure "yolo"))) + (list)) (match actual (n.= expected actual))) )) ))) @@ -273,59 +273,59 @@ level_up (: (-> Code Code) (|>> list code.tuple))] (and (|> (list level_0) - (/.run parser) + (/.result parser) (match actual (n.= expected actual))) (|> (list (level_up level_0)) - (/.run parser) + (/.result parser) (match actual (n.= expected actual))) (|> (list (level_up (level_up level_0))) - (/.run parser) + (/.result parser) (match actual (n.= expected actual)))))) (_.cover [/.after] - (and (|> (/.run (/.after even^ .nat) - (list (code.nat even) (code.nat expected))) + (and (|> (/.result (/.after even^ .nat) + (list (code.nat even) (code.nat expected))) (match actual (n.= expected actual))) - (|> (/.run (/.after even^ .nat) - (list (code.nat odd) (code.nat expected))) + (|> (/.result (/.after even^ .nat) + (list (code.nat odd) (code.nat expected))) fails?))) (_.cover [/.before] - (and (|> (/.run (/.before even^ .nat) - (list (code.nat expected) (code.nat even))) + (and (|> (/.result (/.before even^ .nat) + (list (code.nat expected) (code.nat even))) (match actual (n.= expected actual))) - (|> (/.run (/.before even^ .nat) - (list (code.nat expected) (code.nat odd))) + (|> (/.result (/.before even^ .nat) + (list (code.nat expected) (code.nat odd))) fails?))) (_.cover [/.parses?] - (and (|> (/.run (/.parses? even^) - (list (code.nat even))) + (and (|> (/.result (/.parses? even^) + (list (code.nat even))) (match verdict verdict)) - (|> (/.run (/.parses? even^) - (list (code.nat odd))) + (|> (/.result (/.parses? even^) + (list (code.nat odd))) (match verdict (not verdict))))) (_.cover [/.parses] - (and (|> (/.run (/.parses even^) - (list (code.nat even))) + (and (|> (/.result (/.parses even^) + (list (code.nat even))) (match [] true)) - (|> (/.run (/.parses even^) - (list (code.nat odd))) + (|> (/.result (/.parses even^) + (list (code.nat odd))) fails?))) (_.cover [/.speculative] (let [happy_path! - (|> (/.run (/.and (/.speculative even^) nat^) - (list (code.nat even))) + (|> (/.result (/.and (/.speculative even^) nat^) + (list (code.nat even))) (match [speculation actual] (and (n.= speculation actual) (n.= even actual)))) sad_path! - (|> (/.run (/.and (/.speculative even^) nat^) - (list (code.nat odd))) + (|> (/.result (/.and (/.speculative even^) nat^) + (list (code.nat odd))) fails?)] (and happy_path! sad_path!))) (_.cover [/.codec] - (|> (/.run (/.codec n.decimal .text) - (list (code.text (%.nat expected)))) + (|> (/.result (/.codec n.decimal .text) + (list (code.text (%.nat expected)))) (match actual (n.= expected actual)))) ))) @@ -336,7 +336,7 @@ (def: comparison (Comparison (All [a i] (Parser i a))) (function (_ == left right) - (case [(/.run left []) (/.run right [])] + (case [(/.result left []) (/.result right [])] [(#try.Success [_ left]) (#try.Success [_ right])] (== left right) @@ -359,26 +359,26 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.run] - (|> (/.run (\ /.monad in expected) (list)) + (_.cover [/.result] + (|> (/.result (\ /.monad in expected) (list)) (match actual (n.= expected actual)))) (_.cover [/.failure] (|> (list) - (/.run (/.failure failure)) + (/.result (/.failure failure)) (should_fail failure))) (_.cover [/.lift] (and (|> (list) - (/.run (/.lift (#try.Success expected))) + (/.result (/.lift (#try.Success expected))) (match actual (n.= expected actual))) (|> (list) - (/.run (/.lift (#try.Failure failure))) + (/.result (/.lift (#try.Failure failure))) (should_fail failure)))) (_.cover [/.assertion] (and (|> (list (code.bit #1) (code.int +123)) - (/.run (/.assertion assertion #1)) + (/.result (/.assertion assertion #1)) (match [] true)) (|> (list (code.bit #1) (code.int +123)) - (/.run (/.assertion assertion #0)) + (/.result (/.assertion assertion #0)) fails?))) ..combinators_0 ..combinators_1 diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index 8b7f6405f..85ab04863 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -54,9 +54,9 @@ (`` ($_ _.and (do {! random.monad} [expected (\ ! map (|>> analysis.bit) random.bit)] - (_.cover [/.run /.any] + (_.cover [/.result /.any] (|> (list expected) - (/.run /.any) + (/.result /.any) (case> (#try.Success actual) (\ analysis.equivalence = expected actual) @@ -67,7 +67,7 @@ [expected ] (_.cover [] (|> (list ( expected)) - (/.run ) + (/.result ) (case> (#try.Success actual) (<=> expected actual) @@ -77,7 +77,7 @@ [expected ] (_.cover [] (|> (list ( expected)) - (/.run ( expected)) + (/.result ( expected)) (!expect (#try.Success _)))))] [/.bit /.bit! random.bit analysis.bit bit\=] @@ -94,7 +94,7 @@ [expected random.bit] (_.cover [/.tuple] (|> (list (analysis.tuple (list (analysis.bit expected)))) - (/.run (/.tuple /.bit)) + (/.result (/.tuple /.bit)) (case> (#try.Success actual) (bit\= expected actual) @@ -103,33 +103,33 @@ (do {! random.monad} [dummy random.bit] (_.cover [/.end?] - (and (|> (/.run /.end? (list)) + (and (|> (/.result /.end? (list)) (!expect (#try.Success #1))) - (|> (/.run (do <>.monad - [verdict /.end? - _ /.bit] - (in verdict)) - (list (analysis.bit dummy))) + (|> (/.result (do <>.monad + [verdict /.end? + _ /.bit] + (in verdict)) + (list (analysis.bit dummy))) (!expect (#try.Success #0)))))) (do {! random.monad} [dummy random.bit] (_.cover [/.end!] - (and (|> (/.run /.end! (list)) + (and (|> (/.result /.end! (list)) (!expect (#try.Success _))) - (|> (/.run /.end! (list (analysis.bit dummy))) + (|> (/.result /.end! (list (analysis.bit dummy))) (!expect (#try.Failure _)))))) (do {! random.monad} [expected random.bit] (_.cover [/.cannot_parse] (and (|> (list (analysis.bit expected)) - (/.run /.nat) + (/.result /.nat) (case> (#try.Success _) false (#try.Failure error) (exception.match? /.cannot_parse error))) (|> (list) - (/.run /.bit) + (/.result /.bit) (case> (#try.Success _) false @@ -139,7 +139,7 @@ [expected random.bit] (_.cover [/.unconsumed_input] (|> (list (analysis.bit expected) (analysis.bit expected)) - (/.run /.bit) + (/.result /.bit) (case> (#try.Success _) false diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index e86718715..50233ba6e 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -9,13 +9,13 @@ [monad (#+ do)]] [control [pipe (#+ case>)] - ["<>" parser] + ["." maybe] ["." try] - ["." exception]] + ["." exception] + ["<>" parser]] [data ["." binary] ["." sum] - ["." maybe] ["." bit] ["." name] ["." text ("#\." equivalence) @@ -131,8 +131,8 @@ [expected (\ ! map (i64.and (i64.mask )) random.nat)] (_.cover [ ] - (|> (format.run expected) - (/.run ) + (|> (format.result expected) + (/.result ) (!expect (^multi (#try.Success actual) (n.= (.nat expected) (.nat actual)))))))] @@ -150,8 +150,8 @@ [(do {! random.monad} [expected (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))] (_.cover [ ] - (|> (format.run expected) - (/.run ) + (|> (format.result expected) + (/.result ) (!expect (^multi (#try.Success actual) (\ binary.equivalence = expected actual))))))] @@ -168,8 +168,8 @@ [(do {! random.monad} [expected (random.ascii ..segment_size)] (_.cover [ ] - (|> (format.run expected) - (/.run ) + (|> (format.result expected) + (/.result ) (!expect (^multi (#try.Success actual) (\ text.equivalence = expected actual))))))] @@ -188,8 +188,8 @@ [expected (random.row ..segment_size random.nat)] (_.cover [ ] (|> expected - (format.run ( format.nat)) - (/.run ( /.nat)) + (format.result ( format.nat)) + (/.result ( /.nat)) (!expect (^multi (#try.Success actual) (\ (row.equivalence n.equivalence) = expected actual))))))] @@ -207,8 +207,8 @@ [expected ] (_.cover [ ] (|> expected - (format.run ) - (/.run ) + (format.result ) + (/.result ) (!expect (^multi (#try.Success actual) (\ = expected actual))))))] @@ -220,8 +220,8 @@ [expected random.frac] (_.cover [/.frac format.frac] (|> expected - (format.run format.frac) - (/.run /.frac) + (format.result format.frac) + (/.result /.frac) (!expect (^multi (#try.Success actual) (or (\ frac.equivalence = expected actual) (and (frac.not_a_number? expected) @@ -232,8 +232,8 @@ random.nat)] (_.cover [/.not_a_bit] (|> expected - (format.run format.bits/8) - (/.run /.bit) + (format.result format.bits/8) + (/.result /.bit) (!expect (^multi (#try.Failure error) (exception.match? /.not_a_bit error)))))) ))) @@ -246,8 +246,8 @@ [expected ] (_.cover [ ] (|> expected - (format.run ) - (/.run ) + (format.result ) + (/.result ) (!expect (^multi (#try.Success actual) (\ = expected actual))))))] @@ -260,8 +260,8 @@ [expected ] (_.cover [ ] (|> expected - (format.run ) - (/.run ) + (format.result ) + (/.result ) (!expect (^multi (#try.Success actual) (\ = expected actual))))))] @@ -273,17 +273,17 @@ [expected (\ ! map (list.repeated ..segment_size) random.nat)] (_.cover [/.set_elements_are_not_unique] (|> expected - (format.run (format.list format.nat)) - (/.run (/.set n.hash /.nat)) + (format.result (format.list format.nat)) + (/.result (/.set n.hash /.nat)) (!expect (^multi (#try.Failure error) (exception.match? /.set_elements_are_not_unique error)))))) (do {! random.monad} [expected (random.or random.bit random.nat)] (_.cover [/.or format.or] (|> expected - (format.run (format.or format.bit format.nat)) - (/.run (: (/.Parser (Either Bit Nat)) - (/.or /.bit /.nat))) + (format.result (format.or format.bit format.nat)) + (/.result (: (/.Parser (Either Bit Nat)) + (/.or /.bit /.nat))) (!expect (^multi (#try.Success actual) (\ (sum.equivalence bit.equivalence n.equivalence) = expected @@ -295,23 +295,23 @@ value random.bit] (_.cover [/.invalid_tag] (|> [tag value] - (format.run (format.and format.bits/8 format.bit)) - (/.run (: (/.Parser (Either Bit Nat)) - (/.or /.bit /.nat))) + (format.result (format.and format.bits/8 format.bit)) + (/.result (: (/.Parser (Either Bit Nat)) + (/.or /.bit /.nat))) (!expect (^multi (#try.Failure error) (exception.match? /.invalid_tag error)))))) (do {! random.monad} [expected (random.list ..segment_size random.nat)] (_.cover [/.rec format.rec format.and format.any] (|> expected - (format.run (format.rec (|>> (format.and format.nat) - (format.or format.any)))) - (/.run (: (/.Parser (List Nat)) - (/.rec - (function (_ recur) - (/.or /.any - (<>.and /.nat - recur)))))) + (format.result (format.rec (|>> (format.and format.nat) + (format.or format.any)))) + (/.result (: (/.Parser (List Nat)) + (/.rec + (function (_ recur) + (/.or /.any + (<>.and /.nat + recur)))))) (!expect (^multi (#try.Success actual) (\ (list.equivalence n.equivalence) = expected @@ -323,65 +323,65 @@ (<| (_.covering /._) (_.for [/.Parser]) (`` ($_ _.and - (_.cover [/.run /.any + (_.cover [/.result /.any format.no_op format.instance] (|> (format.instance format.no_op) - (/.run /.any) + (/.result /.any) (!expect (#try.Success _)))) (do {! random.monad} [data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))] (_.cover [/.binary_was_not_fully_read] (|> data - (/.run /.any) + (/.result /.any) (!expect (^multi (#try.Failure error) (exception.match? /.binary_was_not_fully_read error)))))) (do {! random.monad} [expected (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))] - (_.cover [/.segment format.segment format.run] + (_.cover [/.segment format.segment format.result] (|> expected - (format.run (format.segment ..segment_size)) - (/.run (/.segment ..segment_size)) + (format.result (format.segment ..segment_size)) + (/.result (/.segment ..segment_size)) (!expect (^multi (#try.Success actual) (\ binary.equivalence = expected actual)))))) (do {! random.monad} [data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))] (_.cover [/.end?] (|> data - (/.run (do <>.monad - [pre /.end? - _ (/.segment ..segment_size) - post /.end?] - (in (and (not pre) - post)))) + (/.result (do <>.monad + [pre /.end? + _ (/.segment ..segment_size) + post /.end?] + (in (and (not pre) + post)))) (!expect (#try.Success #1))))) (do {! random.monad} [to_read (\ ! map (n.% (inc ..segment_size)) random.nat) data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))] (_.cover [/.Offset /.offset] (|> data - (/.run (do <>.monad - [start /.offset - _ (/.segment to_read) - offset /.offset - _ (/.segment (n.- to_read ..segment_size)) - nothing_left /.offset] - (in (and (n.= 0 start) - (n.= to_read offset) - (n.= ..segment_size nothing_left))))) + (/.result (do <>.monad + [start /.offset + _ (/.segment to_read) + offset /.offset + _ (/.segment (n.- to_read ..segment_size)) + nothing_left /.offset] + (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) data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))] (_.cover [/.remaining] (|> data - (/.run (do <>.monad - [_ (/.segment to_read) - remaining /.remaining - _ (/.segment (n.- to_read ..segment_size)) - nothing_left /.remaining] - (in (and (n.= ..segment_size - (n.+ to_read remaining)) - (n.= 0 nothing_left))))) + (/.result (do <>.monad + [_ (/.segment to_read) + remaining /.remaining + _ (/.segment (n.- to_read ..segment_size)) + nothing_left /.remaining] + (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/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 33476e15a..ffe943eb6 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -40,44 +40,44 @@ pre_ignore (random.list 5 random_dummy) post_ignore (random.list 5 random_dummy)] ($_ _.and - (_.cover [/.run /.any] - (|> (/.run /.any (list expected)) + (_.cover [/.result /.any] + (|> (/.result /.any (list expected)) (!expect (^multi (#try.Success actual) (text\= expected actual))))) (_.cover [/.parse] - (|> (/.run (/.parse n\decode) (list expected)) + (|> (/.result (/.parse n\decode) (list expected)) (!expect (^multi (#try.Success actual) (text\= expected (n\encode actual)))))) (_.cover [/.this] - (and (|> (/.run (/.this expected) (list expected)) + (and (|> (/.result (/.this expected) (list expected)) (!expect (#try.Success _))) - (|> (/.run (/.this expected) (list dummy)) + (|> (/.result (/.this expected) (list dummy)) (!expect (#try.Failure _))))) (_.cover [/.somewhere] - (|> (/.run (|> (/.somewhere (/.this expected)) - (<>.before (<>.some /.any))) - (list.concat (list pre_ignore (list expected) post_ignore))) + (|> (/.result (|> (/.somewhere (/.this expected)) + (<>.before (<>.some /.any))) + (list.concat (list pre_ignore (list expected) post_ignore))) (!expect (#try.Success _)))) (_.cover [/.end] - (and (|> (/.run /.end (list)) + (and (|> (/.result /.end (list)) (!expect (#try.Success _))) - (|> (/.run (<>.not /.end) (list expected)) + (|> (/.result (<>.not /.end) (list expected)) (!expect (#try.Failure _))))) (_.cover [/.named] - (|> (/.run (/.named dummy /.any) (list dummy expected)) + (|> (/.result (/.named dummy /.any) (list dummy expected)) (!expect (^multi (#try.Success actual) (text\= expected actual))))) (_.cover [/.parameter] - (and (|> (/.run (/.parameter [short long] /.any) - (list short expected)) + (and (|> (/.result (/.parameter [short long] /.any) + (list short expected)) (!expect (^multi (#try.Success actual) (text\= expected actual)))) - (|> (/.run (/.parameter [short long] /.any) - (list long expected)) + (|> (/.result (/.parameter [short long] /.any) + (list long expected)) (!expect (^multi (#try.Success actual) (text\= expected actual)))) - (|> (/.run (/.parameter [short long] /.any) - (list dummy expected)) + (|> (/.result (/.parameter [short long] /.any) + (list dummy expected)) (!expect (#try.Failure _))))) )))) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index d2168122a..b6a3768d4 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -46,10 +46,10 @@ (`` ($_ _.and (do {! random.monad} [expected (\ ! map code.bit random.bit)] - (_.cover [/.run] - (and (|> (/.run /.any (list expected)) + (_.cover [/.result] + (and (|> (/.result /.any (list expected)) (!expect (#try.Success _))) - (|> (/.run /.any (list)) + (|> (/.result /.any (list)) (!expect (#try.Failure _)))))) (~~ (template [ ] [(do {! random.monad} @@ -57,13 +57,13 @@ dummy (|> (random.only (|>> (\ = expected) not)))] ($_ _.and (_.cover [] - (|> (/.run (list ( expected))) + (|> (/.result (list ( expected))) (!expect (^multi (#try.Success actual) (\ = expected actual))))) (_.cover [] - (and (|> (/.run ( expected) (list ( expected))) + (and (|> (/.result ( expected) (list ( expected))) (!expect (#try.Success []))) - (|> (/.run ( expected) (list ( dummy))) + (|> (/.result ( expected) (list ( dummy))) (!expect (#try.Failure _))))) ))] @@ -84,9 +84,9 @@ [expected_left random.nat expected_right random.int] (_.cover [] - (|> (/.run ( (<>.and /.nat /.int)) - (list ( (list (code.nat expected_left) - (code.int expected_right))))) + (|> (/.result ( (<>.and /.nat /.int)) + (list ( (list (code.nat expected_left) + (code.int expected_right))))) (!expect (^multi (#try.Success [actual_left actual_right]) (and (\ nat.equivalence = expected_left actual_left) (\ int.equivalence = expected_right actual_right)))))))] @@ -98,9 +98,9 @@ [expected_left random.nat expected_right random.int] (_.cover [/.record] - (|> (/.run (/.record (<>.and /.nat /.int)) - (list (code.record (list [(code.nat expected_left) - (code.int expected_right)])))) + (|> (/.result (/.record (<>.and /.nat /.int)) + (list (code.record (list [(code.nat expected_left) + (code.int expected_right)])))) (!expect (^multi (#try.Success [actual_left actual_right]) (and (\ nat.equivalence = expected_left actual_left) (\ int.equivalence = expected_right actual_right))))))) @@ -108,29 +108,29 @@ [expected_local random.nat expected_global random.int] (_.cover [/.local] - (|> (/.run (<>.and (/.local (list (code.nat expected_local)) /.nat) - /.int) - (list (code.int expected_global))) + (|> (/.result (<>.and (/.local (list (code.nat expected_local)) /.nat) + /.int) + (list (code.int expected_global))) (!expect (^multi (#try.Success [actual_local actual_global]) (and (\ nat.equivalence = expected_local actual_local) (\ int.equivalence = expected_global actual_global))))))) (do {! random.monad} [dummy (\ ! map code.bit random.bit)] (_.cover [/.end?] - (|> (/.run (do <>.monad - [pre /.end? - _ /.any - post /.end?] - (in (and (not pre) - post))) - (list dummy)) + (|> (/.result (do <>.monad + [pre /.end? + _ /.any + post /.end?] + (in (and (not pre) + post))) + (list dummy)) (!expect (^multi (#try.Success verdict) verdict))))) (do {! random.monad} [dummy (\ ! map code.bit random.bit)] (_.cover [/.end!] - (and (|> (/.run /.end! (list)) + (and (|> (/.result /.end! (list)) (!expect (#try.Success []))) - (|> (/.run /.end! (list dummy)) + (|> (/.result /.end! (list dummy)) (!expect (#try.Failure _)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux index 215213e59..b7a889bbe 100644 --- a/stdlib/source/test/lux/control/parser/environment.lux +++ b/stdlib/source/test/lux/control/parser/environment.lux @@ -28,8 +28,8 @@ (dictionary.empty? /.empty)) (do random.monad [expected random.nat] - (_.cover [/.run] - (|> (/.run (//\in expected) /.empty) + (_.cover [/.result] + (|> (/.result (//\in expected) /.empty) (\ try.functor map (n.= expected)) (try.else false)))) (do random.monad @@ -38,13 +38,13 @@ (_.cover [/.Property /.property] (|> /.empty (dictionary.put property expected) - (/.run (/.property property)) + (/.result (/.property property)) (\ try.functor map (text\= expected)) (try.else false)))) (do random.monad [property (random.ascii/alpha 1)] (_.cover [/.unknown_property] - (case (/.run (/.property property) /.empty) + (case (/.result (/.property property) /.empty) (#try.Success _) false diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 3a77b3c3e..a87396228 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -6,11 +6,11 @@ [monad (#+ do)]] [control [pipe (#+ case>)] + ["." maybe] ["." try] ["." exception] ["<>" parser]] [data - ["." maybe] ["." bit] ["." text] [collection @@ -47,12 +47,12 @@ (`` ($_ _.and (do {! random.monad} [expected (\ ! map (|>> #json.String) (random.unicode 1))] - (_.cover [/.run /.any] - (|> (/.run /.any expected) + (_.cover [/.result /.any] + (|> (/.result /.any expected) (!expect (^multi (#try.Success actual) (\ json.equivalence = expected actual)))))) (_.cover [/.null] - (|> (/.run /.null #json.Null) + (|> (/.result /.null #json.Null) (!expect (#try.Success _)))) (~~ (template [ ] [(do {! random.monad} @@ -60,18 +60,18 @@ dummy (|> (random.only (|>> (\ = expected) not)))] ($_ _.and (_.cover [] - (|> (/.run ( expected)) + (|> (/.result ( expected)) (!expect (^multi (#try.Success actual) (\ = expected actual))))) (_.cover [] - (and (|> (/.run ( expected) ( expected)) + (and (|> (/.result ( expected) ( expected)) (!expect (#try.Success #1))) - (|> (/.run ( expected) ( dummy)) + (|> (/.result ( expected) ( dummy)) (!expect (#try.Success #0))))) (_.cover [] - (and (|> (/.run ( expected) ( expected)) + (and (|> (/.result ( expected) ( expected)) (!expect (#try.Success _))) - (|> (/.run ( expected) ( dummy)) + (|> (/.result ( expected) ( dummy)) (!expect (#try.Failure _)))))))] [/.boolean /.boolean? /.boolean! random.bit #json.Boolean bit.equivalence] @@ -82,23 +82,23 @@ [expected (random.unicode 1) dummy random.bit] (_.cover [/.unexpected_value] - (|> (/.run /.string (#json.Boolean dummy)) + (|> (/.result /.string (#json.Boolean dummy)) (!expect (^multi (#try.Failure error) (exception.match? /.unexpected_value error)))))) (do {! random.monad} [expected (random.unicode 1) dummy (|> (random.unicode 1) (random.only (|>> (\ text.equivalence = expected) not)))] (_.cover [/.value_mismatch] - (|> (/.run (/.string! expected) (#json.String dummy)) + (|> (/.result (/.string! expected) (#json.String dummy)) (!expect (^multi (#try.Failure error) (exception.match? /.value_mismatch error)))))) (do {! random.monad} [expected (random.unicode 1)] (_.cover [/.nullable] - (and (|> (/.run (/.nullable /.string) #json.Null) + (and (|> (/.result (/.nullable /.string) #json.Null) (!expect (^multi (#try.Success actual) (\ (maybe.equivalence text.equivalence) = #.None actual)))) - (|> (/.run (/.nullable /.string) (#json.String expected)) + (|> (/.result (/.nullable /.string) (#json.String expected)) (!expect (^multi (#try.Success actual) (\ (maybe.equivalence text.equivalence) = (#.Some expected) actual))))))) (do {! random.monad} @@ -107,18 +107,18 @@ (random.list size) (\ ! map row.of_list))] (_.cover [/.array] - (|> (/.run (/.array (<>.some /.string)) - (#json.Array (row\map (|>> #json.String) expected))) + (|> (/.result (/.array (<>.some /.string)) + (#json.Array (row\map (|>> #json.String) expected))) (!expect (^multi (#try.Success actual) (\ (row.equivalence text.equivalence) = expected (row.of_list actual))))))) (do {! random.monad} [expected (\ ! map (|>> #json.String) (random.unicode 1))] (_.cover [/.unconsumed_input] - (|> (/.run (/.array /.any) (#json.Array (row expected expected))) + (|> (/.result (/.array /.any) (#json.Array (row expected expected))) (!expect (^multi (#try.Failure error) (exception.match? /.unconsumed_input error)))))) (_.cover [/.empty_input] - (|> (/.run (/.array /.any) (#json.Array (row))) + (|> (/.result (/.array /.any) (#json.Array (row))) (!expect (^multi (#try.Failure error) (exception.match? /.empty_input error))))) (do {! random.monad} @@ -133,15 +133,15 @@ _ (undefined)))))] (_.cover [/.object /.field] - (|> (/.run (/.object ($_ <>.and - (/.field boolean_field /.boolean) - (/.field number_field /.number) - (/.field string_field /.string))) - (#json.Object - (dictionary.of_list text.hash - (list [boolean_field (#json.Boolean expected_boolean)] - [number_field (#json.Number expected_number)] - [string_field (#json.String expected_string)])))) + (|> (/.result (/.object ($_ <>.and + (/.field boolean_field /.boolean) + (/.field number_field /.number) + (/.field string_field /.string))) + (#json.Object + (dictionary.of_list text.hash + (list [boolean_field (#json.Boolean expected_boolean)] + [number_field (#json.Number expected_number)] + [string_field (#json.String expected_string)])))) (!expect (^multi (#try.Success [actual_boolean actual_number actual_string]) (and (\ bit.equivalence = expected_boolean actual_boolean) (\ frac.equivalence = expected_number actual_number) @@ -152,12 +152,12 @@ values (random.list size (random.unicode 1)) .let [expected (dictionary.of_list text.hash (list.zipped/2 keys values))]] (_.cover [/.dictionary] - (|> (/.run (/.dictionary /.string) - (#json.Object - (|> values - (list\map (|>> #json.String)) - (list.zipped/2 keys) - (dictionary.of_list text.hash)))) + (|> (/.result (/.dictionary /.string) + (#json.Object + (|> values + (list\map (|>> #json.String)) + (list.zipped/2 keys) + (dictionary.of_list text.hash)))) (!expect (^multi (#try.Success actual) (\ (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 753091e27..068ba1235 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -67,13 +67,13 @@ dummy (|> (random.only (|>> (\ = expected) not)))] ($_ _.and (_.cover [] - (|> (/.run (list ( expected))) + (|> (/.result (list ( expected))) (!expect (^multi (#try.Success actual) (\ = expected actual))))) (_.cover [] - (and (|> (/.run ( expected) (list ( expected))) + (and (|> (/.result ( expected) (list ( expected))) (!expect (#try.Success _))) - (|> (/.run ( expected) (list ( dummy))) + (|> (/.result ( expected) (list ( dummy))) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_parse error)))))) ))] @@ -97,18 +97,18 @@ expected_f64 random.safe_frac expected_text (random.unicode 1)] (_.cover [/.tuple] - (and (|> (/.run (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) - (list (synthesis.tuple (list (synthesis.bit expected_bit) - (synthesis.i64 expected_i64) - (synthesis.f64 expected_f64) - (synthesis.text expected_text))))) + (and (|> (/.result (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) + (list (synthesis.tuple (list (synthesis.bit expected_bit) + (synthesis.i64 expected_i64) + (synthesis.f64 expected_f64) + (synthesis.text expected_text))))) (!expect (^multi (#try.Success [actual_bit actual_i64 actual_f64 actual_text]) (and (\ bit.equivalence = expected_bit actual_bit) (\ i64.equivalence = expected_i64 actual_i64) (\ frac.equivalence = expected_f64 actual_f64) (\ text.equivalence = expected_text actual_text))))) - (|> (/.run (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) - (list (synthesis.text expected_text))) + (|> (/.result (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) + (list (synthesis.text expected_text))) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_parse error))))))) (do {! random.monad} @@ -116,15 +116,15 @@ expected_environment ..random_environment expected_body (random.unicode 1)] (_.cover [/.function] - (and (|> (/.run (/.function arity /.text) - (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) + (and (|> (/.result (/.function arity /.text) + (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) (!expect (^multi (#try.Success [actual_environment actual_body]) (and (\ (list.equivalence synthesis.equivalence) = expected_environment actual_environment) (\ text.equivalence = expected_body actual_body))))) - (|> (/.run (/.function arity /.text) - (list (synthesis.text expected_body))) + (|> (/.result (/.function arity /.text) + (list (synthesis.text expected_body))) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_parse error))))))) (do {! random.monad} @@ -132,8 +132,8 @@ expected_environment ..random_environment expected_body (random.unicode 1)] (_.cover [/.wrong_arity] - (|> (/.run (/.function (inc arity) /.text) - (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) + (|> (/.result (/.function (inc arity) /.text) + (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) (!expect (^multi (#try.Failure error) (exception.match? /.wrong_arity error)))))) (do {! random.monad} @@ -142,18 +142,18 @@ expected_inits (random.list arity random.bit) expected_body (random.unicode 1)] (_.cover [/.loop] - (and (|> (/.run (/.loop (<>.many /.bit) /.text) - (list (synthesis.loop/scope [expected_offset - (list\map (|>> synthesis.bit) expected_inits) - (synthesis.text expected_body)]))) + (and (|> (/.result (/.loop (<>.many /.bit) /.text) + (list (synthesis.loop/scope [expected_offset + (list\map (|>> synthesis.bit) expected_inits) + (synthesis.text expected_body)]))) (!expect (^multi (#try.Success [actual_offset actual_inits actual_body]) (and (\ n.equivalence = expected_offset actual_offset) (\ (list.equivalence bit.equivalence) = expected_inits actual_inits) (\ text.equivalence = expected_body actual_body))))) - (|> (/.run (/.loop (<>.many /.bit) /.text) - (list (synthesis.text expected_body))) + (|> (/.result (/.loop (<>.many /.bit) /.text) + (list (synthesis.text expected_body))) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_parse error))))))) )) @@ -165,34 +165,34 @@ ($_ _.and (do {! random.monad} [expected (\ ! map (|>> synthesis.i64) random.nat)] - (_.cover [/.run /.any] - (|> (/.run /.any (list expected)) + (_.cover [/.result /.any] + (|> (/.result /.any (list expected)) (!expect (^multi (#try.Success actual) (\ synthesis.equivalence = expected actual)))))) (_.cover [/.empty_input] - (|> (/.run /.any (list)) + (|> (/.result /.any (list)) (!expect (^multi (#try.Failure error) (exception.match? /.empty_input error))))) (do {! random.monad} [expected (\ ! map (|>> synthesis.i64) random.nat)] (_.cover [/.unconsumed_input] - (|> (/.run /.any (list expected expected)) + (|> (/.result /.any (list expected expected)) (!expect (^multi (#try.Failure error) (exception.match? /.unconsumed_input error)))))) (do {! random.monad} [dummy (\ ! map (|>> synthesis.i64) random.nat)] (_.cover [/.end! /.expected_empty_input] - (and (|> (/.run /.end! (list)) + (and (|> (/.result /.end! (list)) (!expect (#try.Success _))) - (|> (/.run /.end! (list dummy)) + (|> (/.result /.end! (list dummy)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_empty_input error))))))) (do {! random.monad} [dummy (\ ! map (|>> synthesis.i64) random.nat)] (_.cover [/.end?] - (and (|> (/.run /.end? (list)) + (and (|> (/.result /.end? (list)) (!expect (#try.Success #1))) - (|> (/.run (<>.before /.any /.end?) (list dummy)) + (|> (/.result (<>.before /.any /.end?) (list dummy)) (!expect (#try.Success #0)))))) (_.for [/.cannot_parse] ($_ _.and diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 878b82fa9..a7bbfda92 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -5,11 +5,11 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["." try (#+ Try)] ["." exception (#+ Exception)] ["." function]] [data - ["." maybe] ["." text ("#\." equivalence) ["%" format (#+ format)] ["." unicode #_ @@ -41,7 +41,7 @@ (def: (should_fail' sample parser exception) (All [a e] (-> Text (/.Parser a) (Exception e) Bit)) - (case (/.run parser sample) + (case (/.result parser sample) (#try.Failure error) (exception.match? exception error) @@ -50,7 +50,7 @@ (def: (should_fail sample parser) (All [a] (-> Text (/.Parser a) Bit)) - (case (/.run parser sample) + (case (/.result parser sample) (#try.Failure _) true @@ -60,7 +60,7 @@ (def: (should_pass expected parser) (-> Text (/.Parser Text) Bit) (|> expected - (/.run parser) + (/.result parser) (\ try.functor map (text\= expected)) (try.else false))) @@ -298,12 +298,12 @@ ($_ _.and (do {! random.monad} [sample (random.unicode 1)] - (_.cover [/.run /.end!] - (and (|> (/.run /.end! - "") + (_.cover [/.result /.end!] + (and (|> (/.result /.end! + "") (!expect (#try.Success _))) - (|> (/.run /.end! - sample) + (|> (/.result /.end! + sample) (!expect (#try.Failure _)))))) (do {! random.monad} [.let [size 10] @@ -311,16 +311,16 @@ dummy (|> (random.unicode size) (random.only (|>> (text\= expected) not)))] (_.cover [/.this /.cannot_match] - (and (|> (/.run (/.this expected) - expected) + (and (|> (/.result (/.this expected) + expected) (!expect (#try.Success []))) - (|> (/.run (/.this expected) - dummy) + (|> (/.result (/.this expected) + dummy) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_match error))))))) (_.cover [/.Slice /.slice /.cannot_slice] (|> "" - (/.run (/.slice /.any!)) + (/.result (/.slice /.any!)) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_slice error))))) (do {! random.monad} @@ -336,25 +336,25 @@ (_.cover [/.peek /.cannot_parse] (and (..should_pass expected (<>.before /.any /.peek)) (|> "" - (/.run (<>.before /.any /.peek)) + (/.result (<>.before /.any /.peek)) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_parse error))))))) (do {! random.monad} [dummy (random.unicode 1)] (_.cover [/.unconsumed_input] (|> (format dummy dummy) - (/.run /.any) + (/.result /.any) (!expect (^multi (#try.Failure error) (exception.match? /.unconsumed_input error)))))) (do {! random.monad} [sample (random.unicode 1)] (_.cover [/.Offset /.offset] (|> sample - (/.run (do <>.monad - [pre /.offset - _ /.any - post /.offset] - (in [pre post]))) + (/.result (do <>.monad + [pre /.offset + _ /.any + post /.offset] + (in [pre post]))) (!expect (#try.Success [0 1]))))) (do {! random.monad} [left (random.unicode 1) @@ -362,13 +362,13 @@ .let [input (format left right)]] (_.cover [/.remaining] (|> input - (/.run (do <>.monad - [pre /.remaining - _ /.any - post /.remaining - _ /.any] - (in (and (text\= input pre) - (text\= right post))))) + (/.result (do <>.monad + [pre /.remaining + _ /.any + post /.remaining + _ /.any] + (in (and (text\= input pre) + (text\= right post))))) (!expect (#try.Success #1))))) (do {! random.monad} [left (random.unicode 1) @@ -377,22 +377,22 @@ (random.unicode 1))] (_.cover [/.enclosed] (|> (format left expected right) - (/.run (/.enclosed [left right] (/.this expected))) + (/.result (/.enclosed [left right] (/.this expected))) (!expect (#try.Success _))))) (do {! random.monad} [input (random.unicode 1) output (random.unicode 1)] (_.cover [/.local] (|> output - (/.run (do <>.monad - [_ (/.local input (/.this input))] - (/.this output))) + (/.result (do <>.monad + [_ (/.local input (/.this input))] + (/.this output))) (!expect (#try.Success _))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] (_.cover [/.then] (|> (list (code.text expected)) - (.run (/.then /.octal .text)) + (.result (/.then /.octal .text)) (!expect (^multi (#try.Success actual) (text\= expected actual)))))) (do {! random.monad} @@ -404,13 +404,13 @@ (_.cover [/.not /.not! /.expected_to_fail] (and (..should_pass (text.of_char expected) (/.not /.upper)) (|> invalid - (/.run (/.not /.upper)) + (/.result (/.not /.upper)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error)))) (..should_pass! (text.of_char expected) (/.not! upper!)) (|> invalid - (/.run (/.not! upper!)) + (/.result (/.not! upper!)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error))))))) (do {! random.monad} diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index 0d1cc090e..996a16aa2 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -32,8 +32,8 @@ [dummy random.nat expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover - (|> (/.run - ) + (|> (/.result + ) (!expect (^multi (#try.Success actual) (n.= expected actual))))))]) @@ -42,10 +42,10 @@ [dummy random.nat expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover - (and (|> (/.run ) + (and (|> (/.result ) (!expect (^multi (#try.Success actual) (n.= expected actual)))) - (|> (/.run ) + (|> (/.result ) (!expect (^multi (#try.Success actual) (n.= expected actual)))))))]) @@ -54,14 +54,14 @@ (<| (_.covering /._) (_.for [/.Parser]) ($_ _.and - (!cover [/.run /.value] + (!cover [/.result /.value] /.value (tree.leaf expected)) (do {! random.monad} [expected random.nat] - (_.cover [/.run'] - (|> (/.run' /.value - (zipper.zipper (tree.leaf expected))) + (_.cover [/.result'] + (|> (/.result' /.value + (zipper.zipper (tree.leaf expected))) (!expect (^multi (#try.Success actual) (n.= expected actual)))))) (!cover [/.down] @@ -161,8 +161,8 @@ [dummy random.nat] (_.cover [/.cannot_move_further] (`` (and (~~ (template [] - [(|> (/.run - (tree.leaf dummy)) + [(|> (/.result + (tree.leaf dummy)) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_move_further error))))] diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 971ccd5db..55398c22e 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -43,29 +43,29 @@ ..primitive)]) ($_ _.and (_.cover [/.exactly] - (and (|> (/.run (/.exactly expected) expected) + (and (|> (/.result (/.exactly expected) expected) (!expect (#try.Success []))) - (|> (/.run (/.exactly expected) dummy) + (|> (/.result (/.exactly expected) dummy) (!expect (^multi (#try.Failure error) (exception.match? /.types_do_not_match error)))))) (_.cover [/.sub] - (and (|> (/.run (/.sub expected) expected) + (and (|> (/.result (/.sub expected) expected) (!expect (#try.Success []))) - (|> (/.run (/.sub Any) expected) + (|> (/.result (/.sub Any) expected) (!expect (#try.Success []))) - (|> (/.run (/.sub expected) Nothing) + (|> (/.result (/.sub expected) Nothing) (!expect (#try.Success []))) - (|> (/.run (/.sub expected) dummy) + (|> (/.result (/.sub expected) dummy) (!expect (^multi (#try.Failure error) (exception.match? /.types_do_not_match error)))))) (_.cover [/.super] - (and (|> (/.run (/.super expected) expected) + (and (|> (/.result (/.super expected) expected) (!expect (#try.Success []))) - (|> (/.run (/.super expected) Any) + (|> (/.result (/.super expected) Any) (!expect (#try.Success []))) - (|> (/.run (/.super Nothing) expected) + (|> (/.result (/.super Nothing) expected) (!expect (#try.Success []))) - (|> (/.run (/.super expected) dummy) + (|> (/.result (/.super expected) dummy) (!expect (^multi (#try.Failure error) (exception.match? /.types_do_not_match error)))))) ))) @@ -79,14 +79,14 @@ (`` ($_ _.and (~~ (template [ ] [(_.cover [ ] - (and (|> (/.run ( ($_ //.and /.any /.any /.any)) - ( (list expected_left expected_middle expected_right))) + (and (|> (/.result ( ($_ //.and /.any /.any /.any)) + ( (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Success [actual_left actual_middle actual_right]) (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) - (|> (/.run ( ($_ //.and /.any /.any /.any)) - ( (list expected_left expected_middle expected_right))) + (|> (/.result ( ($_ //.and /.any /.any /.any)) + ( (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? error))))))] @@ -95,25 +95,25 @@ )) (_.cover [/.function /.not_function] - (and (|> (/.run (/.function ($_ //.and /.any /.any) /.any) - (type.function (list expected_left expected_middle) expected_right)) + (and (|> (/.result (/.function ($_ //.and /.any /.any) /.any) + (type.function (list expected_left expected_middle) expected_right)) (!expect (^multi (#try.Success [[actual_left actual_middle] actual_right]) (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) - (|> (/.run (/.function ($_ //.and /.any /.any) /.any) - (type.variant (list expected_left expected_middle expected_right))) + (|> (/.result (/.function ($_ //.and /.any /.any) /.any) + (type.variant (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? /.not_function error)))))) (_.cover [/.applied /.not_application] - (and (|> (/.run (/.applied ($_ //.and /.any /.any /.any)) - (type.application (list expected_middle expected_right) expected_left)) + (and (|> (/.result (/.applied ($_ //.and /.any /.any /.any)) + (type.application (list expected_middle expected_right) expected_left)) (!expect (^multi (#try.Success [actual_left actual_middle actual_right]) (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) - (|> (/.run (/.applied ($_ //.and /.any /.any /.any)) - (type.variant (list expected_left expected_middle expected_right))) + (|> (/.result (/.applied ($_ //.and /.any /.any /.any)) + (type.variant (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? /.not_application error)))))) )))) @@ -127,38 +127,38 @@ parameter random.nat] ($_ _.and (_.cover [/.not_parameter] - (|> (/.run /.parameter not_parameter) + (|> (/.result /.parameter not_parameter) (!expect (^multi (#try.Failure error) (exception.match? /.not_parameter error))))) (_.cover [/.unknown_parameter] - (|> (/.run /.parameter (#.Parameter parameter)) + (|> (/.result /.parameter (#.Parameter parameter)) (!expect (^multi (#try.Failure error) (exception.match? /.unknown_parameter error))))) (_.cover [/.with_extension] - (|> (/.run (<| (/.with_extension quantification) - (/.with_extension argument) - /.any) - not_parameter) + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + /.any) + not_parameter) (!expect (^multi (#try.Success [quantification\\binding argument\\binding actual]) (is? not_parameter actual))))) (_.cover [/.parameter] - (|> (/.run (<| (/.with_extension quantification) - (/.with_extension argument) - /.parameter) - (#.Parameter 0)) + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + /.parameter) + (#.Parameter 0)) (!expect (#try.Success [quantification\\binding argument\\binding _])))) (_.cover [/.wrong_parameter] - (|> (/.run (<| (/.with_extension quantification) - (/.with_extension argument) - (/.parameter! 1)) - (#.Parameter 0)) + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + (/.parameter! 1)) + (#.Parameter 0)) (!expect (^multi (#try.Failure error) (exception.match? /.wrong_parameter error))))) (_.cover [/.parameter!] - (|> (/.run (<| (/.with_extension quantification) - (/.with_extension argument) - (/.parameter! 0)) - (#.Parameter 0)) + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + (/.parameter! 0)) + (#.Parameter 0)) (!expect (#try.Success [quantification\\binding argument\\binding _])))) ))) @@ -169,17 +169,17 @@ expected_inputs (\ ! map (|>> (n.% 10) inc) random.nat)] ($_ _.and (_.cover [/.not_polymorphic] - (and (|> (/.run (/.polymorphic /.any) - not_polymorphic) + (and (|> (/.result (/.polymorphic /.any) + not_polymorphic) (!expect (^multi (#try.Failure error) (exception.match? /.not_polymorphic error)))) - (|> (/.run (/.polymorphic /.any) - (type.univ_q 0 not_polymorphic)) + (|> (/.result (/.polymorphic /.any) + (type.univ_q 0 not_polymorphic)) (!expect (^multi (#try.Failure error) (exception.match? /.not_polymorphic error)))))) (_.cover [/.polymorphic] - (|> (/.run (/.polymorphic /.any) - (type.univ_q expected_inputs not_polymorphic)) + (|> (/.result (/.polymorphic /.any) + (type.univ_q expected_inputs not_polymorphic)) (!expect (^multi (#try.Success [g!poly actual_inputs bodyT]) (and (n.= expected_inputs (list.size actual_inputs)) (is? not_polymorphic bodyT)))))) @@ -192,31 +192,31 @@ ($_ _.and (do {! random.monad} [expected ..primitive] - (_.cover [/.run /.any] - (|> (/.run /.any expected) + (_.cover [/.result /.any] + (|> (/.result /.any expected) (!expect (^multi (#try.Success actual) (type\= expected actual)))))) (do {! random.monad} [expected ..primitive] (_.cover [/.peek /.unconsumed_input] - (and (|> (/.run (do //.monad - [actual /.peek - _ /.any] - (in actual)) - expected) + (and (|> (/.result (do //.monad + [actual /.peek + _ /.any] + (in actual)) + expected) (!expect (^multi (#try.Success actual) (type\= expected actual)))) - (|> (/.run /.peek expected) + (|> (/.result /.peek expected) (!expect (^multi (#try.Failure error) (exception.match? /.unconsumed_input error))))))) (do {! random.monad} [expected ..primitive] (_.cover [/.empty_input] (`` (and (~~ (template [] - [(|> (/.run (do //.monad - [_ /.any] - ) - expected) + [(|> (/.result (do //.monad + [_ /.any] + ) + expected) (!expect (^multi (#try.Failure error) (exception.match? /.empty_input error))))] @@ -226,11 +226,11 @@ (do {! random.monad} [expected ..primitive] (_.cover [/.Env /.env /.fresh] - (|> (/.run (do //.monad - [env /.env - _ /.any] - (in env)) - expected) + (|> (/.result (do //.monad + [env /.env + _ /.any] + (in env)) + expected) (!expect (^multi (#try.Success environment) (is? /.fresh environment)))))) (do {! random.monad} @@ -238,18 +238,18 @@ dummy (random.only (|>> (type\= expected) not) ..primitive)] (_.cover [/.local] - (|> (/.run (do //.monad - [_ /.any] - (/.local (list expected) - /.any)) - dummy) + (|> (/.result (do //.monad + [_ /.any] + (/.local (list expected) + /.any)) + dummy) (!expect (^multi (#try.Success actual) (type\= expected actual)))))) (do {! random.monad} [expected random.nat] (_.cover [/.existential /.not_existential] - (|> (/.run /.existential - (#.Ex expected)) + (|> (/.result /.existential + (#.Ex expected)) (!expect (^multi (#try.Success actual) (n.= expected actual)))))) (do {! random.monad} @@ -257,8 +257,8 @@ (random.ascii/alpha_num 1)) expected_type ..primitive] (_.cover [/.named /.not_named] - (|> (/.run /.named - (#.Named expected_name expected_type)) + (|> (/.result /.named + (#.Named expected_name expected_type)) (!expect (^multi (#try.Success [actual_name actual_type]) (and (name\= expected_name actual_name) (type\= expected_type actual_type))))))) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 81c4da80d..d4cb4c50c 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -6,13 +6,13 @@ [abstract [monad (#+ do)]] [control - ["." try] + ["." try ("#\." functor)] ["." exception]] [data ["." text ("#\." equivalence)] ["." name ("#\." equivalence)] [format - ["." xml]] + ["." xml ("#\." equivalence)]] [collection ["." dictionary] ["." list]]] @@ -40,7 +40,7 @@ [expected (random.ascii/alpha 1)] (_.cover [] (`` (and (~~ (template [ ] - [(|> (/.run (list )) + [(|> (/.result (list )) (!expect (^multi (#try.Failure error) (exception.match? error))))] @@ -61,32 +61,33 @@ ($_ _.and (do {! random.monad} [expected (random.ascii/alpha 1)] - (_.cover [/.run /.text] - (|> (/.run /.text (list (#xml.Text expected))) + (_.cover [/.result /.text] + (|> (/.result /.text (list (#xml.Text expected))) (!expect (^multi (#try.Success actual) (text\= expected actual)))))) (!failure /.unconsumed_inputs [[(//\in expected) (#xml.Text expected)]]) (do {! random.monad} - [expected (random.ascii/alpha 1)] - (_.cover [/.ignore] - (|> (/.run /.ignore (list (#xml.Text expected))) - (!expect (#try.Success []))))) + [expected (\ ! map (|>> #xml.Text) (random.ascii/alpha 1))] + (_.cover [/.any] + (|> (/.result /.any (list expected)) + (try\map (xml\= expected)) + (try.else false)))) (do {! random.monad} [expected ..random_tag] (_.cover [/.tag] - (|> (/.run (do //.monad - [actual /.tag - _ /.ignore] - (in (name\= expected actual))) - (list (#xml.Node expected (dictionary.empty name.hash) (list)))) + (|> (/.result (do //.monad + [actual /.tag + _ /.any] + (in (name\= expected actual))) + (list (#xml.Node expected (dictionary.empty name.hash) (list)))) (!expect (#try.Success #1))))) (do {! random.monad} [expected ..random_tag] (_.cover [/.node] - (|> (/.run (/.node expected (//\in [])) - (list (#xml.Node expected (dictionary.empty name.hash) (list)))) + (|> (/.result (/.node expected (//\in [])) + (list (#xml.Node expected (dictionary.empty name.hash) (list)))) (!expect (#try.Success []))))) (!failure /.wrong_tag [[(/.node ["" expected] (//\in [])) @@ -96,13 +97,13 @@ expected_attribute ..random_attribute expected_value (random.ascii/alpha 1)] (_.cover [/.attribute] - (|> (/.run (<| (/.node expected_tag) - (//.after (/.attribute expected_attribute)) - (//\in [])) - (list (#xml.Node expected_tag - (|> (dictionary.empty name.hash) - (dictionary.put expected_attribute expected_value)) - (list)))) + (|> (/.result (<| (/.node expected_tag) + (//.after (/.attribute expected_attribute)) + (//\in [])) + (list (#xml.Node expected_tag + (|> (dictionary.empty name.hash) + (dictionary.put expected_attribute expected_value)) + (list)))) (!expect (#try.Success []))))) (!failure /.unknown_attribute [[(/.attribute ["" expected]) @@ -112,22 +113,22 @@ (list))]]) (!failure /.empty_input [[(do //.monad - [_ /.ignore] - /.ignore) + [_ /.any] + /.any) (#xml.Text expected)] [(do //.monad - [_ /.ignore] + [_ /.any] /.text) (#xml.Text expected)] [(do //.monad - [_ /.ignore] + [_ /.any] (/.node [expected expected] (//\in []))) (#xml.Node [expected expected] (dictionary.empty name.hash) (list))] [(do //.monad - [_ /.ignore] + [_ /.any] (/.node [expected expected] (/.attribute [expected expected]))) (#xml.Node [expected expected] @@ -156,21 +157,21 @@ [_ (<| /.somewhere (/.node right) (//\in [])) - _ (//.some /.ignore)] + _ (//.some /.any)] (in [])))] repetitions (\ ! map (n.% 10) random.nat)] ($_ _.and (_.cover [/.somewhere] - (|> (/.run parser - (list (node parent - (list.concat (list (list.repeated repetitions (node wrong (list))) - (list (node right (list))) - (list.repeated repetitions (node wrong (list)))))))) + (|> (/.result parser + (list (node parent + (list.concat (list (list.repeated repetitions (node wrong (list))) + (list (node right (list))) + (list.repeated repetitions (node wrong (list)))))))) (!expect (#try.Success [])))) (_.cover [/.nowhere] - (|> (/.run parser - (list (node parent - (list.repeated repetitions (node wrong (list)))))) + (|> (/.result parser + (list (node parent + (list.repeated repetitions (node wrong (list)))))) (!expect (^multi (#try.Failure error) (exception.match? /.nowhere error))))) )) diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index 08d5d82b2..c89d0e3eb 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -25,7 +25,7 @@ (def: comparison (Comparison (All [a r] (Reader r a))) (function (_ == left right) - (== (/.run [] left) (/.run [] right)))) + (== (/.result [] left) (/.result [] right)))) (def: .public test Test @@ -42,12 +42,12 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.run /.ask] + (_.cover [/.result /.ask] (n.= sample - (/.run sample /.ask))) + (/.result sample /.ask))) (_.cover [/.local] (n.= (n.* factor sample) - (/.run sample (/.local (n.* factor) /.ask)))) + (/.result sample (/.local (n.* factor) /.ask)))) (let [(^open "io\.") io.monad] (_.cover [/.with /.lift] (|> (: (/.Reader Any (IO Nat)) @@ -55,6 +55,6 @@ [a (/.lift (io\in sample)) b (in factor)] (in (n.* b a)))) - (/.run []) - io.run + (/.result []) + 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 477f42a47..4fbb71916 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -63,13 +63,13 @@ == (Try a) - (thread.run (:assume (/.run thread.monad left)))) + (thread.result (:assume (/.run! thread.monad left)))) (:sharing [a] (Equivalence a) == (Try a) - (thread.run (:assume (/.run thread.monad right))))] + (thread.result (:assume (/.run! thread.monad right))))] [(#try.Success left) (#try.Success right)] (== left right) @@ -96,8 +96,8 @@ (Monad (Region r (thread.Thread !)))) (/.monad thread.monad)))) - (_.cover [/.run] - (thread.run + (_.cover [/.run!] + (thread.result (do {! thread.monad} [clean_up_counter (thread.box 0) .let [//@ ! @@ -105,17 +105,17 @@ (do ! [_ (thread.update inc clean_up_counter)] (in (#try.Success []))))] - outcome (/.run ! - (do {! (/.monad !)} - [_ (monad.map ! (/.acquire //@ count_clean_up) - (enum.range n.enum 1 expected_clean_ups))] - (in []))) + outcome (/.run! ! + (do {! (/.monad !)} + [_ (monad.map ! (/.acquire //@ count_clean_up) + (enum.range n.enum 1 expected_clean_ups))] + (in []))) actual_clean_ups (thread.read clean_up_counter)] (in (and (..success? outcome) (n.= expected_clean_ups actual_clean_ups)))))) (_.cover [/.failure] - (thread.run + (thread.result (do {! thread.monad} [clean_up_counter (thread.box 0) .let [//@ ! @@ -123,18 +123,18 @@ (do ! [_ (thread.update inc clean_up_counter)] (in (#try.Success []))))] - outcome (/.run ! - (do {! (/.monad !)} - [_ (monad.map ! (/.acquire //@ count_clean_up) - (enum.range n.enum 1 expected_clean_ups)) - _ (/.failure //@ (exception.error ..oops []))] - (in []))) + outcome (/.run! ! + (do {! (/.monad !)} + [_ (monad.map ! (/.acquire //@ count_clean_up) + (enum.range n.enum 1 expected_clean_ups)) + _ (/.failure //@ (exception.error ..oops []))] + (in []))) actual_clean_ups (thread.read clean_up_counter)] (in (and (..throws? ..oops outcome) (n.= expected_clean_ups actual_clean_ups)))))) (_.cover [/.except] - (thread.run + (thread.result (do {! thread.monad} [clean_up_counter (thread.box 0) .let [//@ ! @@ -142,18 +142,18 @@ (do ! [_ (thread.update inc clean_up_counter)] (in (#try.Success []))))] - outcome (/.run ! - (do {! (/.monad !)} - [_ (monad.map ! (/.acquire //@ count_clean_up) - (enum.range n.enum 1 expected_clean_ups)) - _ (/.except //@ ..oops [])] - (in []))) + outcome (/.run! ! + (do {! (/.monad !)} + [_ (monad.map ! (/.acquire //@ count_clean_up) + (enum.range n.enum 1 expected_clean_ups)) + _ (/.except //@ ..oops [])] + (in []))) actual_clean_ups (thread.read clean_up_counter)] (in (and (..throws? ..oops outcome) (n.= expected_clean_ups actual_clean_ups)))))) (_.cover [/.acquire /.clean_up_error] - (thread.run + (thread.result (do {! thread.monad} [clean_up_counter (thread.box 0) .let [//@ ! @@ -162,25 +162,25 @@ [_ (thread.update inc clean_up_counter)] (in (: (Try Any) (exception.except ..oops [])))))] - outcome (/.run ! - (do {! (/.monad !)} - [_ (monad.map ! (/.acquire //@ count_clean_up) - (enum.range n.enum 1 expected_clean_ups))] - (in []))) + outcome (/.run! ! + (do {! (/.monad !)} + [_ (monad.map ! (/.acquire //@ count_clean_up) + (enum.range n.enum 1 expected_clean_ups))] + (in []))) actual_clean_ups (thread.read clean_up_counter)] (in (and (or (n.= 0 expected_clean_ups) (..throws? /.clean_up_error outcome)) (n.= expected_clean_ups actual_clean_ups)))))) (_.cover [/.lift] - (thread.run + (thread.result (do {! thread.monad} [clean_up_counter (thread.box 0) .let [//@ !] - outcome (/.run ! - (do (/.monad !) - [_ (/.lift //@ (thread.write expected_clean_ups clean_up_counter))] - (in []))) + outcome (/.run! ! + (do (/.monad !) + [_ (/.lift //@ (thread.write expected_clean_ups clean_up_counter))] + (in []))) actual_clean_ups (thread.read clean_up_counter)] (in (and (..success? outcome) (n.= expected_clean_ups diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 24e483420..33f91e26f 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -63,14 +63,14 @@ (text.contains? (%.code focus) failure)))) (syntax: (test_macro {macro .identifier} {extra .text}) - (let [now (io.run instant.now) + (let [now (io.run! instant.now) today (instant.date now) yesterday (instant.date (instant.after (duration.inverse duration.week) now)) tomorrow (instant.date (instant.after duration.week now)) prng (random.pcg_32 [(hex "0123456789ABCDEF") (instant.millis now)]) - message (product.right (random.run prng ..message)) - expected (product.right (random.run prng ..focus))] + message (product.right (random.result prng ..message)) + expected (product.right (random.result prng ..focus))] (do meta.monad [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message #.None))) should_fail1 (..attempt (macro.expansion (..memory macro yesterday message (#.Some expected)))) diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index d7555e7aa..3f2123211 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -23,7 +23,7 @@ (def: (with_conditions [state output] computation) (-> [Nat Nat] (State Nat Nat) Bit) (|> computation - (/.run state) + (/.result state) product.right (n.= output))) @@ -62,8 +62,8 @@ (def: (comparison init) (All [s] (-> s (Comparison (State s)))) (function (_ == left right) - (== (product.right (/.run init left)) - (product.right (/.run init right))))) + (== (product.right (/.result init left)) + (product.right (/.result init right))))) (def: structures Test @@ -87,14 +87,14 @@ [state /.get] (in (n.< limit state)))]] ($_ _.and - (_.cover [/.while /.run] + (_.cover [/.while /.result] (|> (/.while condition (/.update inc)) - (/.run 0) + (/.result 0) (let> [state' output'] (n.= limit state')))) (_.cover [/.do_while] (|> (/.do_while condition (/.update inc)) - (/.run 0) + (/.result 0) (let> [state' output'] (or (n.= limit state') (and (n.= 0 limit) @@ -108,14 +108,14 @@ left random.nat right random.nat] (let [(^open "io\.") io.monad] - (_.cover [/.+State /.with /.lift /.run'] + (_.cover [/.+State /.with /.lift /.result'] (|> (: (/.+State io.IO Nat Nat) (do (/.with io.monad) [a (/.lift io.monad (io\in left)) b (in right)] (in (n.+ a b)))) - (/.run' state) - io.run + (/.result' state) + io.run! (let> [state' output'] (and (n.= state state') (n.= (n.+ left right) output'))))) diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux index e396a613f..4f71c7203 100644 --- a/stdlib/source/test/lux/control/thread.lux +++ b/stdlib/source/test/lux/control/thread.lux @@ -24,7 +24,7 @@ (def: comparison (Comparison (All [a !] (Thread ! a))) (function (_ == left right) - (== (/.run left) (/.run right)))) + (== (/.result left) (/.result right)))) (def: .public test Test @@ -35,17 +35,17 @@ ($_ _.and (_.for [/.Thread] ($_ _.and - (_.cover [/.run] + (_.cover [/.result] (n.= sample (|> sample (\ /.monad in) - /.run))) + /.result))) (_.cover [/.io] (n.= sample (|> sample (\ /.monad in) /.io - io.run))) + io.run!))) (_.for [/.functor] ($functor.spec ..injection ..comparison /.functor)) @@ -59,24 +59,24 @@ ($_ _.and (_.cover [/.read] (n.= sample - (/.run (: (All [!] (Thread ! Nat)) - (do /.monad - [box (/.box sample)] - (/.read box)))))) + (/.result (: (All [!] (Thread ! Nat)) + (do /.monad + [box (/.box sample)] + (/.read box)))))) (_.cover [/.write] (n.= factor - (/.run (: (All [!] (Thread ! Nat)) - (do /.monad - [box (/.box sample) - _ (/.write factor box)] - (/.read box)))))) + (/.result (: (All [!] (Thread ! Nat)) + (do /.monad + [box (/.box sample) + _ (/.write factor box)] + (/.read box)))))) (_.cover [/.update] (n.= (n.* factor sample) - (/.run (: (All [!] (Thread ! Nat)) - (do /.monad - [box (/.box sample) - old (/.update (n.* factor) box)] - (/.read box)))))))) + (/.result (: (All [!] (Thread ! Nat)) + (do /.monad + [box (/.box sample) + old (/.update (n.* factor) box)] + (/.read box)))))))) )))) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 0e2fa479e..3c030bdcc 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -85,7 +85,7 @@ [a (lifted (io\in expected)) b (in alternative)] (in (n.+ a b))) - io.run + io.run! (case> (#/.Success result) (n.= (n.+ expected alternative) result) diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index de65f2d47..9d43ef5f8 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -53,10 +53,11 @@ (_.cover [/.with /.lift] (let [lift (/.lift text.monoid io.monad) (^open "io\.") io.monad] - (|> (io.run (do (/.with text.monoid io.monad) - [a (lift (io\in left)) - b (in right)] - (in (n.+ a b)))) + (|> (do (/.with text.monoid io.monad) + [a (lift (io\in left)) + b (in right)] + (in (n.+ a b))) + io.run! product.right (n.= (n.+ left right))))) )))) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index beb1ee201..71fb38097 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -12,8 +12,6 @@ ["#." color ["#/." named]] ["#." identity] - ["#." lazy] - ["#." maybe] ["#." name] ["#." product] ["#." sum] @@ -53,8 +51,6 @@ Test ($_ _.and /identity.test - /lazy.test - /maybe.test /name.test)) (def: test/2 diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index b7ae6bba4..3270e17a7 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -33,7 +33,7 @@ (def: .public (random size) (-> Nat (Random Binary)) - (let [output (/.create size)] + (let [output (/.empty size)] (loop [idx 0] (if (n.< size idx) (do random.monad @@ -54,7 +54,7 @@ (def: (binary_io power read write value) (-> Nat (-> Nat Binary (Try Nat)) (-> Nat Nat Binary (Try Any)) Nat Bit) (let [bytes (i64.left_shifted power 1) - binary (/.create bytes) + binary (/.empty bytes) cap (case bytes 8 (dec 0) _ (|> 1 (i64.left_shifted (n.* 8 bytes)) dec)) @@ -96,12 +96,12 @@ (n.= (\ list.fold fold n.+ 0 (..as_list sample)) (/.fold n.+ 0 sample))) - (_.cover [/.create] + (_.cover [/.empty] (\ /.equivalence = - (/.create size) - (/.create size))) + (/.empty size) + (/.empty size))) (_.cover [/.size] - (|> (/.create size) /.size (n.= size))) + (|> (/.empty size) /.size (n.= size))) (_.for [/.index_out_of_bounds] ($_ _.and (_.cover [/.read/8! /.write/8!] @@ -136,7 +136,7 @@ _ verdict)))) (_.cover [/.drop] (and (\ /.equivalence = sample (/.drop 0 sample)) - (\ /.equivalence = (/.create 0) (/.drop size sample)) + (\ /.equivalence = (/.empty 0) (/.drop size sample)) (case (list.reversed (..as_list sample)) #.End false @@ -145,7 +145,7 @@ (n.= (list.fold n.+ 0 tail) (/.fold n.+ 0 (/.drop 1 sample)))))) (_.cover [/.copy] - (and (case (/.copy size 0 sample 0 (/.create size)) + (and (case (/.copy size 0 sample 0 (/.empty size)) (#try.Success output) (and (not (is? sample output)) (\ /.equivalence = sample output)) @@ -155,7 +155,7 @@ (succeed (do try.monad [sample/0 (/.read/8! 0 sample) - copy (/.copy 1 0 sample 0 (/.create 2)) + copy (/.copy 1 0 sample 0 (/.empty 2)) copy/0 (/.read/8! 0 copy) copy/1 (/.read/8! 1 copy)] (in (and (n.= sample/0 copy/0) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index 9925fccec..64e0f4268 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -9,9 +9,10 @@ ["$." monoid] ["$." fold] ["$." functor (#+ Injection)]]] + [control + ["." maybe]] [data ["." bit] - ["." maybe] [collection ["." list] ["." set]]] diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index aafa848b4..ad8a63d28 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -9,11 +9,11 @@ ["$." equivalence] ["$." functor (#+ Injection)]]] [control + ["." maybe ("#\." functor)] ["." try] ["." exception]] [data ["." product] - ["." maybe ("#\." functor)] [collection ["." list ("#\." functor)] ["." set]]] diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 13971ad88..adce56dc3 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -8,10 +8,11 @@ [order (#+ Order)] [\\specification ["$." equivalence]]] + [control + ["." maybe ("#\." monad)]] [data ["." product] ["." bit ("#\." equivalence)] - ["." maybe ("#\." monad)] [collection ["." set] ["." list ("#\." functor)]]] @@ -52,9 +53,9 @@ .let [pairs (list.zipped/2 (set.list keys) (set.list values)) sample (/.of_list n.order pairs) - sorted_pairs (list.sort (function (_ [left _] [right _]) - (n.< left right)) - pairs) + sorted_pairs (list.sorted (function (_ [left _] [right _]) + (n.< left right)) + pairs) sorted_values (list\map product.right sorted_pairs) (^open "list\.") (list.equivalence (: (Equivalence [Nat Nat]) (function (_ [kr vr] [ks vs]) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index fdbcccc06..ad74dc0a0 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -6,9 +6,10 @@ [monad (#+ do)] [\\specification ["$." equivalence]]] + [control + ["." maybe ("#\." monad)]] [data ["." bit ("#\." equivalence)] - ["." maybe ("#\." monad)] ["." text] [collection ["." set] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index abf61aef3..426b556b8 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -16,11 +16,11 @@ [control pipe ["." io] + ["." maybe] ["." function]] [data ["." bit] ["." product] - ["." maybe] ["." text ("#\." equivalence)] [collection ["." set]]] @@ -72,10 +72,10 @@ (^open "io\.") io.monad expected (n.+ parameter subject)] (_.cover [/.with /.lift] - (|> (io.run (do (/.with io.monad) - [a (lift (io\in parameter)) - b (in subject)] - (in (n.+ a b)))) + (|> (io.run! (do (/.with io.monad) + [a (lift (io\in parameter)) + b (in subject)] + (in (n.+ a b)))) (case> (^ (list actual)) (n.= expected actual) @@ -113,16 +113,16 @@ (if (/.every? n.even? sample) (not (/.any? (bit.complement n.even?) sample)) (/.any? (bit.complement n.even?) sample))) - (_.cover [/.sort] + (_.cover [/.sorted] (let [<<< n.< size_preservation! (n.= (/.size sample) - (/.size (/.sort <<< sample))) + (/.size (/.sorted <<< sample))) symmetry! - (/\= (/.sort <<< sample) - (/.reversed (/.sort (function.flip <<<) sample)))] + (/\= (/.sorted <<< sample) + (/.reversed (/.sorted (function.flip <<<) sample)))] (and size_preservation! symmetry!))) ))) @@ -143,13 +143,13 @@ already_sorted! (/\= indices - (/.sort n.< indices)) + (/.sorted n.< indices)) expected_numbers! (/.every? (n.= (dec size)) (/.zipped_with/2 n.+ indices - (/.sort n.> indices)))] + (/.sorted n.> indices)))] (and expected_amount! already_sorted! expected_numbers!))) @@ -185,7 +185,7 @@ ..random) .let [size (/.size sample)] idx (\ ! map (n.% size) random.nat) - chunk_size (\ ! map (|>> (n.% size) inc) random.nat)] + sub_size (\ ! map (|>> (n.% size) inc) random.nat)] ($_ _.and (_.cover [/.only] (let [positives (/.only n.even? sample) @@ -218,11 +218,11 @@ (/\= sample (/\compose (/.take_while n.even? sample) (/.drop_while n.even? sample)))) - (_.cover [/.chunk] - (let [chunks (/.chunk chunk_size sample)] - (and (/.every? (|>> /.size (n.<= chunk_size)) chunks) + (_.cover [/.sub] + (let [subs (/.sub sub_size sample)] + (and (/.every? (|>> /.size (n.<= sub_size)) subs) (/\= sample - (/.concat chunks))))) + (/.concat subs))))) )))) (def: member @@ -407,9 +407,9 @@ ..grouping ..search - (_.cover [/.interpose] + (_.cover [/.interposed] (or (/.empty? sample) - (let [sample+ (/.interpose separator sample)] + (let [sample+ (/.interposed separator sample)] (and (n.= (|> (/.size sample) (n.* 2) dec) (/.size sample+)) (|> sample+ /.pairs (/.every? (|>> product.right (n.= separator)))))))) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 42ec9677e..20579c5b6 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -4,8 +4,9 @@ ["_" test (#+ Test)] [abstract ["." monad (#+ do)]] + [control + ["." maybe ("#\." functor)]] [data - ["." maybe ("#\." functor)] ["." bit ("#\." equivalence)]] [math ["." random (#+ Random)] diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 260d6ee39..d5ff02472 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -66,7 +66,7 @@ (_.cover [/.list] (\ (list.equivalence n.equivalence) = (/.list (/.of_list n.order listL)) - (list.sort (\ n.order <) listL))) + (list.sorted (\ n.order <) listL))) (_.cover [/.of_list] (|> setL /.list (/.of_list n.order) diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index 082609904..1cb75755f 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -7,8 +7,9 @@ [\\specification ["$." equivalence] ["$." functor (#+ Injection)]]] + [control + ["." maybe]] [data - ["." maybe] ["." bit ("#\." equivalence)]] [math ["." random] diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index 79140887d..370a39a53 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -4,8 +4,9 @@ ["_" test (#+ Test)] [abstract [monad (#+ do)]] + [control + ["." maybe ("#\." functor)]] [data - ["." maybe ("#\." functor)] ["." text ("#\." equivalence monoid)] [collection ["." list ("#\." fold)]]] diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 60c18d514..a4e73fb03 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -9,10 +9,10 @@ ["$." functor] ["$." comonad]]] [control - pipe] + pipe + ["." maybe ("#\." functor)]] [data ["." product] - ["." maybe ("#\." functor)] ["." text] [collection ["." list]]] diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 6ff253a73..0444588e1 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -58,7 +58,7 @@ (syntax: (string) (do meta.monad - [value (macro.gensym "string")] + [value (macro.identifier "string")] (in (list (code.text (%.code value)))))) (def: .public test diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index c951382ba..0c43ada46 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -5,13 +5,13 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["." try] ["." exception] ["<>" parser ["" binary]]] [data ["." product] - ["." maybe] ["." binary ("#\." equivalence monoid)] ["." text ("#\." equivalence) ["%" format (#+ format)] @@ -172,8 +172,8 @@ (|> (do try.monad [expected_path (/.path expected_path) tar (|> (row.row ( expected_path)) - (format.run /.writer) - (.run /.parser))] + (format.result /.writer) + (.result /.parser))] (in (case (row.list tar) (^ (list ( actual_path))) (text\= (/.from_path expected_path) @@ -201,8 +201,8 @@ #/.group {#/.name /.anonymous #/.id /.no_id}} expected_content])) - (format.run /.writer) - (.run /.parser))] + (format.result /.writer) + (.result /.parser))] (in (case (row.list tar) (^ (list ( [actual_path actual_moment actual_mode actual_ownership actual_content]))) (let [seconds (: (-> Instant Int) @@ -250,7 +250,7 @@ (_.cover [/.and] (|> (do try.monad [path (/.path path) - content (/.content (binary.create 0)) + content (/.content (binary.empty 0)) tar (|> (row.row (#/.Normal [path (instant.of_millis +0) expected_mode @@ -259,8 +259,8 @@ #/.group {#/.name /.anonymous #/.id /.no_id}} content])) - (format.run /.writer) - (.run /.parser))] + (format.result /.writer) + (.result /.parser))] (in (case (row.list tar) (^ (list (#/.Normal [_ _ actual_mode _ _]))) (n.= (/.mode expected_mode) @@ -273,7 +273,7 @@ [(_.cover [] (|> (do try.monad [path (/.path path) - content (/.content (binary.create 0)) + content (/.content (binary.empty 0)) tar (|> (row.row (#/.Normal [path (instant.of_millis +0) @@ -282,8 +282,8 @@ #/.group {#/.name /.anonymous #/.id /.no_id}} content])) - (format.run /.writer) - (.run /.parser))] + (format.result /.writer) + (.result /.parser))] (in (case (row.list tar) (^ (list (#/.Normal [_ _ actual_mode _ _]))) (n.= (/.mode ) @@ -339,7 +339,7 @@ (_.cover [/.Name /.name /.from_name] (|> (do try.monad [path (/.path path) - content (/.content (binary.create 0)) + content (/.content (binary.empty 0)) expected (/.name expected) tar (|> (row.row (#/.Normal [path (instant.of_millis +0) @@ -349,8 +349,8 @@ #/.group {#/.name /.anonymous #/.id /.no_id}} content])) - (format.run /.writer) - (.run /.parser))] + (format.result /.writer) + (.result /.parser))] (in (case (row.list tar) (^ (list (#/.Normal [_ _ _ actual_ownership _]))) (and (text\= (/.from_name expected) @@ -364,7 +364,7 @@ (_.cover [/.anonymous /.no_id] (|> (do try.monad [path (/.path path) - content (/.content (binary.create 0)) + content (/.content (binary.empty 0)) tar (|> (row.row (#/.Normal [path (instant.of_millis +0) /.none @@ -373,8 +373,8 @@ #/.group {#/.name /.anonymous #/.id /.no_id}} content])) - (format.run /.writer) - (.run /.parser))] + (format.result /.writer) + (.result /.parser))] (in (case (row.list tar) (^ (list (#/.Normal [_ _ _ actual_ownership _]))) (and (text\= (/.from_name /.anonymous) @@ -400,13 +400,13 @@ ($_ _.and (_.cover [/.writer /.parser] (|> row.empty - (format.run /.writer) - (.run /.parser) + (format.result /.writer) + (.result /.parser) (\ try.monad map row.empty?) (try.else false))) (_.cover [/.invalid_end_of_archive] - (let [dump (format.run /.writer row.empty)] - (case (.run /.parser (binary\compose dump dump)) + (let [dump (format.result /.writer row.empty)] + (case (.result /.parser (binary\compose dump dump)) (#try.Success _) false diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 3ec5618a3..4fef01a10 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -9,12 +9,12 @@ ["$." codec]]] [control pipe + ["." maybe] ["." try] ["p" parser ["" xml]]] [data ["." name] - ["." maybe] ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection diff --git a/stdlib/source/test/lux/data/lazy.lux b/stdlib/source/test/lux/data/lazy.lux deleted file mode 100644 index c9de9cb25..000000000 --- a/stdlib/source/test/lux/data/lazy.lux +++ /dev/null @@ -1,67 +0,0 @@ -(.module: - [library - [lux #* - ["_" test (#+ Test)] - [abstract - [monad (#+ do)] - [\\specification - ["$." functor (#+ Injection Comparison)] - ["$." apply] - ["$." monad] - ["$." equivalence]]] - [data - ["." product]] - [math - ["." random (#+ Random)] - [number - ["n" nat]]]]] - [\\library - ["." / (#+ Lazy)]]) - -(def: injection - (Injection Lazy) - (|>> /.lazy)) - -(def: comparison - (Comparison Lazy) - (function (_ ==) - (\ (/.equivalence ==) =))) - -(def: .public lazy - (All [a] (-> (Random a) (Random (Lazy a)))) - (\ random.functor map (|>> /.lazy))) - -(def: .public test - Test - (with_expansions [ (: [Nat Nat] - [(n.+ left right) - (n.* left right)])] - (<| (_.covering /._) - (do random.monad - [left random.nat - right random.nat - .let [expected ]] - (_.for [/.Lazy] - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec (/.equivalence n.equivalence) (..lazy random.nat))) - (_.for [/.functor] - ($functor.spec ..injection ..comparison /.functor)) - (_.for [/.apply] - ($apply.spec ..injection ..comparison /.apply)) - (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) - - (_.cover [/.lazy] - (let [lazy (/.lazy ) - (^open "\=") (product.equivalence n.equivalence n.equivalence)] - (\= expected - (/.value lazy)))) - - (_.cover [/.value] - (let [lazy (/.lazy )] - (and (not (is? expected - (/.value lazy))) - (is? (/.value lazy) - (/.value lazy))))) - )))))) diff --git a/stdlib/source/test/lux/data/maybe.lux b/stdlib/source/test/lux/data/maybe.lux deleted file mode 100644 index dd32c20db..000000000 --- a/stdlib/source/test/lux/data/maybe.lux +++ /dev/null @@ -1,88 +0,0 @@ -(.module: - [library - [lux #* - ["_" test (#+ Test)] - [abstract - [monad (#+ do)] - [\\specification - ["$." equivalence] - ["$." hash] - ["$." monoid] - ["$." functor] - ["$." apply] - ["$." monad]]] - [control - ["." io ("#\." monad)] - pipe] - [data - ["." text] - [collection - ["." list]]] - [math - ["." random (#+ Random)] - [number - ["n" nat]]]]] - [\\library - ["." / ("#\." monoid monad)]]) - -(def: .public test - Test - (<| (_.covering /._) - (_.for [.Maybe]) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec (/.equivalence n.equivalence) (random.maybe random.nat))) - (_.for [/.hash] - (|> random.nat - (\ random.monad map (|>> #.Some)) - ($hash.spec (/.hash n.hash)))) - (_.for [/.monoid] - ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) - (_.for [/.functor] - ($functor.spec /\in /.equivalence /.functor)) - (_.for [/.apply] - ($apply.spec /\in /.equivalence /.apply)) - (_.for [/.monad] - ($monad.spec /\in /.equivalence /.monad)) - - (do random.monad - [left random.nat - right random.nat - .let [expected (n.+ left right)]] - (let [lift (/.lift io.monad)] - (_.cover [/.with /.lift] - (|> (io.run (do (/.with io.monad) - [a (lift (io\in left)) - b (in right)] - (in (n.+ a b)))) - (case> (#.Some actual) - (n.= expected actual) - - _ - false))))) - (do random.monad - [default random.nat - value random.nat] - (_.cover [/.else] - (and (is? default (/.else default - #.None)) - - (is? value (/.else default - (#.Some value)))))) - (do random.monad - [value random.nat] - (_.cover [/.assume] - (is? value (/.assume (#.Some value))))) - (do random.monad - [value random.nat] - (_.cover [/.list] - (\ (list.equivalence n.equivalence) = - (list value) - (/.list (#.Some value))))) - (do random.monad - [expected random.nat - .let [(^open "/\.") (/.equivalence n.equivalence)]] - (_.cover [/.when] - (and (/\= (#.Some expected) (/.when true (#.Some expected))) - (/\= #.None (/.when false (#.Some expected)))))) - ))) diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux index 3b846940f..9d9b9e248 100644 --- a/stdlib/source/test/lux/data/product.lux +++ b/stdlib/source/test/lux/data/product.lux @@ -50,18 +50,18 @@ [left random.nat right random.nat] ($_ _.and - (<| (_.cover [/.swap]) + (<| (_.cover [/.swapped]) (let [pair [left right]] (and (n.= (/.left pair) - (/.right (/.swap pair))) + (/.right (/.swapped pair))) (n.= (/.right pair) - (/.left (/.swap pair)))))) - (<| (_.cover [/.uncurry]) + (/.left (/.swapped pair)))))) + (<| (_.cover [/.uncurried]) (n.= (n.+ left right) - ((/.uncurry n.+) [left right]))) - (<| (_.cover [/.curry]) + ((/.uncurried n.+) [left right]))) + (<| (_.cover [/.curried]) (n.= (n.+ left right) - ((/.curry (/.uncurry n.+)) left right))) + ((/.curried (/.uncurried n.+)) left right))) (<| (_.cover [/.apply]) (let [[left' right'] (/.apply (n.+ shift) (n.- shift) [left right])] (and (n.= (n.+ shift left) left') diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 4ff904116..3c70075d1 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -10,9 +10,9 @@ ["$." order] ["$." monoid]]] [control - pipe] + pipe + ["." maybe]] [data - ["." maybe] [collection ["." list] ["." set]]] @@ -323,8 +323,8 @@ .let [part_gen (|> (random.text normal_char_gen sizeP) (random.only (|>> (/.contains? sep1) not)))] parts (random.list sizeL part_gen) - .let [sample1 (/.concat (list.interpose sep1 parts)) - sample2 (/.concat (list.interpose sep2 parts)) + .let [sample1 (/.concat (list.interposed sep1 parts)) + sample2 (/.concat (list.interposed sep2 parts)) (^open "/\.") /.equivalence]] (_.cover [/.replaced] (/\= sample2 diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 662643d3c..126cb6556 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -7,9 +7,9 @@ [\\specification ["$." codec]]] [control + ["." maybe] ["." try]] [data - ["." maybe] ["." text ("#\." equivalence)] [collection ["." list ("#\." fold)] @@ -29,7 +29,7 @@ [/.ascii]] [all/ibm<700 - [/.ibm_37 + [/.ibm_037 /.ibm_273 /.ibm_277 /.ibm_278 diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 35dfaf1cf..8e8c4b1df 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -72,8 +72,8 @@ (syntax: (static_sample) (do meta.monad [seed meta.seed - .let [[_ expected] (random.run (random.pcg_32 [seed seed]) - (random.ascii 10))]] + .let [[_ expected] (random.result (random.pcg_32 [seed seed]) + (random.ascii 10))]] (in (list (code.text expected))))) (syntax: (static_escaped {un_escaped .text}) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 263c6cb50..c0b1f9183 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -24,7 +24,7 @@ (def: (should_pass regex input) (-> (Parser Text) Text Bit) (|> input - (.run regex) + (.result regex) (case> (#try.Success parsed) (text\= parsed input) @@ -34,7 +34,7 @@ (def: (text_should_pass test regex input) (-> Text (Parser Text) Text Bit) (|> input - (.run regex) + (.result regex) (case> (#try.Success parsed) (text\= test parsed) @@ -44,7 +44,7 @@ (def: (should_fail regex input) (All [a] (-> (Parser a) Text Bit)) (|> input - (.run regex) + (.result regex) (case> (#try.Failure _) true @@ -52,9 +52,9 @@ false))) (syntax: (should_check pattern regex input) - (macro.with_gensyms [g!message g!_] + (macro.with_identifiers [g!message g!_] (in (list (` (|> (~ input) - (.run (~ regex)) + (.result (~ regex)) (case> (^ (#try.Success (~ pattern))) true diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 6b03ebc15..e49e08476 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -59,7 +59,7 @@ (syntax: (macro_error expression) (function (_ lux) (|> (macro.single_expansion expression) - (meta.run lux) + (meta.result lux) (case> (#try.Success expansion) (#try.Failure "OOPS!") @@ -280,7 +280,7 @@ java/lang/Long #throws [java/lang/Throwable] (if (:as Bit throw?) - (error! "YOLO") + (panic! "YOLO") (:as java/lang/Long expected)))) example/1! @@ -361,7 +361,7 @@ ... Methods (test/TestInterface1 [] (actual1 self {throw? java/lang/Boolean}) java/lang/Long #throws [java/lang/Throwable] (if (:as Bit throw?) - (error! "YOLO") + (panic! "YOLO") ::value))) (/.import: test/TestClass1 @@ -576,7 +576,7 @@ (syntax: (expands? expression) (function (_ lux) (|> (macro.single_expansion expression) - (meta.run lux) + (meta.result lux) (case> (#try.Success expansion) true diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 43757eedf..9b81d303b 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -53,7 +53,7 @@ (: (Ex [a] (/.Object a)))) true)) (_.cover [/.import:] - (case (io.run (..os/getenv string)) + (case (io.run! (..os/getenv string)) (#.Some _) true #.None true)) ))))) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index d40c628c7..dacff0557 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -7,8 +7,9 @@ [hash (#+ Hash)] [\\specification ["$." hash]]] + [control + ["." maybe]] [data - ["." maybe] ["." text] [collection ["." set (#+ Set)] diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index a5b5c4f61..1dec09208 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -7,8 +7,9 @@ [hash (#+ Hash)] [\\specification ["$." hash]]] + [control + ["." maybe]] [data - ["." maybe] ["." text] [collection ["." set (#+ Set)] diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 7ff37ea43..73a725528 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -53,18 +53,18 @@ (syntax: (fresh_identifier) (do meta.monad - [g!fresh (/.gensym "fresh")] + [g!fresh (/.identifier "fresh")] (in (list g!fresh)))) (def: random_lux (Random [Nat Text .Lux]) (do {! random.monad} [seed random.nat - gensym_prefix (random.ascii/upper 1) + identifier_prefix (random.ascii/upper 1) .let [macro_module (name.module (name_of /._)) current_module (name.module (name_of .._))]] (in [seed - gensym_prefix + identifier_prefix {#.info {#.target "" #.version "" #.mode #.Build} @@ -108,7 +108,7 @@ (def: expander Test (do {! random.monad} - [[seed gensym_prefix lux] ..random_lux + [[seed identifier_prefix lux] ..random_lux pow/1 (\ ! map code.nat random.nat) @@ -122,18 +122,18 @@ (~~ (template [ ] [(_.cover [] (|> ( (` (..pow/4 (~ pow/1)))) - (meta.run lux) + (meta.result lux) (try\map (\ (list.equivalence code.equivalence) = (list ))) (try.else false))) (_.cover [] (and (|> (/.single_expansion (` ( (~' #omit) (..pow/4 (~ pow/1))))) - (meta.run lux) + (meta.result lux) (try\map (\ (list.equivalence code.equivalence) = (list))) (try.else false)) (|> (/.single_expansion (` ( (..pow/4 (~ pow/1))))) - (meta.run lux) + (meta.result lux) (try\map (\ (list.equivalence code.equivalence) = (list ))) (try.else false))))] @@ -144,7 +144,7 @@ (_.cover [/.one_expansion] (bit\= (not (nat.= 1 repetitions)) (|> (/.one_expansion (` (..repeated (~ (code.nat repetitions)) (~ pow/1)))) - (meta.run lux) + (meta.result lux) (!expect (#try.Failure _))))) )))) @@ -153,26 +153,26 @@ (<| (_.covering /._) ($_ _.and (do {! random.monad} - [[seed gensym_prefix lux] ..random_lux] + [[seed identifier_prefix lux] ..random_lux] ($_ _.and - (_.cover [/.gensym] - (|> (/.gensym gensym_prefix) + (_.cover [/.identifier] + (|> (/.identifier identifier_prefix) (\ meta.monad map %.code) - (meta.run lux) - (!expect (^multi (#try.Success actual_gensym) - (and (text.contains? gensym_prefix actual_gensym) - (text.contains? (%.nat seed) actual_gensym)))))) + (meta.result lux) + (!expect (^multi (#try.Success actual_identifier) + (and (text.contains? identifier_prefix actual_identifier) + (text.contains? (%.nat seed) actual_identifier)))))) (_.cover [/.wrong_syntax_error] (|> (/.single_expansion (` (/.log_single_expansion!))) - (meta.run lux) + (meta.result lux) (!expect (^multi (#try.Failure error) (text.contains? (/.wrong_syntax_error (name_of /.log_single_expansion!)) error))))) - (_.cover [/.with_gensyms] + (_.cover [/.with_identifiers] (with_expansions [ (fresh_identifier)] - (|> (/.with_gensyms [] + (|> (/.with_identifiers [] (\ meta.monad in )) - (meta.run lux) + (meta.result lux) (!expect (^multi (#try.Success [_ (#.Identifier ["" actual])]) (text.contains? (template.text []) actual)))))) diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index 6102295d4..38f25c013 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -46,7 +46,7 @@ constant {pre_remove .bit} body) - (macro.with_gensyms [g!output] + (macro.with_identifiers [g!output] (do meta.monad [pop! (/.push (list [name (..constant constant)])) [module short] (meta.normal name) diff --git a/stdlib/source/test/lux/macro/poly.lux b/stdlib/source/test/lux/macro/poly.lux index 41eb81b4f..1ffe2cf61 100644 --- a/stdlib/source/test/lux/macro/poly.lux +++ b/stdlib/source/test/lux/macro/poly.lux @@ -12,6 +12,7 @@ (def: .public test Test (<| (_.covering /._) + (_.for [/.poly: /.derived: /.code]) ($_ _.and /equivalence.test /functor.test diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index 6bad7436a..6de4e4019 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -10,9 +10,10 @@ ["." /]]] [\\specification ["$." equivalence]]] + [control + ["." maybe]] [data ["." bit] - ["." maybe] ["." text] [collection ["." list]]] diff --git a/stdlib/source/test/lux/macro/poly/json.lux b/stdlib/source/test/lux/macro/poly/json.lux index b1b9883cb..d99b3364e 100644 --- a/stdlib/source/test/lux/macro/poly/json.lux +++ b/stdlib/source/test/lux/macro/poly/json.lux @@ -19,7 +19,6 @@ [json (#+)]]] [data ["." bit] - ["." maybe] ["." text ["%" format (#+ format)]] [format diff --git a/stdlib/source/test/lux/macro/syntax/annotations.lux b/stdlib/source/test/lux/macro/syntax/annotations.lux index be74194b9..3fd71b7a3 100644 --- a/stdlib/source/test/lux/macro/syntax/annotations.lux +++ b/stdlib/source/test/lux/macro/syntax/annotations.lux @@ -43,8 +43,8 @@ (do random.monad [expected ..random] (_.cover [/.format /.parser] - (case (.run /.parser - (list (/.format expected))) + (case (|> (list (/.format expected)) + (.result /.parser)) (#try.Failure _) false diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux index e5f3e310e..f9cbab99e 100644 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ b/stdlib/source/test/lux/macro/syntax/check.lux @@ -37,9 +37,9 @@ (do random.monad [[type value] ..random] (_.cover [/.format /.parser] - (case (.run /.parser - (list (/.format {#/.type type - #/.value value}))) + (case (.result /.parser + (list (/.format {#/.type type + #/.value value}))) (#try.Failure _) false diff --git a/stdlib/source/test/lux/macro/syntax/declaration.lux b/stdlib/source/test/lux/macro/syntax/declaration.lux index a260f84be..8301899bd 100644 --- a/stdlib/source/test/lux/macro/syntax/declaration.lux +++ b/stdlib/source/test/lux/macro/syntax/declaration.lux @@ -38,8 +38,8 @@ (do random.monad [expected ..random] (_.cover [/.format /.parser] - (case (.run /.parser - (list (/.format expected))) + (case (.result /.parser + (list (/.format expected))) (#try.Failure _) false diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux index 855a44545..ae7d5d3e5 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -68,8 +68,8 @@ untyped_value $///code.random] ($_ _.and (_.cover [/.format /.parser] - (case (.run (/.parser compiler) - (list (/.format expected))) + (case (.result (/.parser compiler) + (list (/.format expected))) (#try.Failure error) false @@ -77,8 +77,8 @@ (\ /.equivalence = expected actual))) (_.cover [/.typed] (let [expected (set@ #/.value (#.Left [type untyped_value]) expected)] - (case (.run (/.typed compiler) - (list (/.format expected))) + (case (.result (/.typed compiler) + (list (/.format expected))) (#try.Failure error) false @@ -86,8 +86,8 @@ (\ /.equivalence = expected actual)))) (_.cover [/.lacks_type!] (let [expected (set@ #/.value (#.Right untyped_value) expected)] - (case (.run (/.typed compiler) - (list (/.format expected))) + (case (.result (/.typed compiler) + (list (/.format expected))) (#try.Failure error) (exception.match? /.lacks_type! error) diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux index 58d8b50a5..1653dc4b4 100644 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ b/stdlib/source/test/lux/macro/syntax/export.lux @@ -5,11 +5,10 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["." try ("#\." functor)] [parser ["<.>" code]]] - [data - ["." maybe]] [macro ["." code ("#\." equivalence)]] [math @@ -39,7 +38,7 @@ #.None (list (code.nat expected_un_exported))) - (.run (/.parser .nat)) + (.result (/.parser .nat)) (try\map (function (_ [actual_export_policy actual_un_exported]) (|> expected_export_policy (maybe.else /.default_policy) diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux index fe01ab496..77fd87b58 100644 --- a/stdlib/source/test/lux/macro/syntax/input.lux +++ b/stdlib/source/test/lux/macro/syntax/input.lux @@ -37,8 +37,8 @@ (do random.monad [expected ..random] (_.cover [/.format /.parser] - (case (.run /.parser - (list (/.format expected))) + (case (.result /.parser + (list (/.format expected))) (#try.Failure _) false diff --git a/stdlib/source/test/lux/macro/syntax/type/variable.lux b/stdlib/source/test/lux/macro/syntax/type/variable.lux index af57cc222..cf8d65157 100644 --- a/stdlib/source/test/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/test/lux/macro/syntax/type/variable.lux @@ -31,7 +31,7 @@ [expected ..random] (_.cover [/.format /.parser] (|> (list (/.format expected)) - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) ))) diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index f97ffb24f..4b1a6919a 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -89,7 +89,7 @@ [bottom middle_bottom middle_top top] (|> random.rev (random.set r.hash 4) - (\ ! map (|>> set.list (list.sort r.<))) + (\ ! map (|>> set.list (list.sorted r.<))) (random.one (function (_ thresholds) (case thresholds (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) @@ -173,7 +173,7 @@ [bottom middle_bottom middle_top top] (|> random.rev (random.set r.hash 4) - (\ ! map (|>> set.list (list.sort r.<))) + (\ ! map (|>> set.list (list.sorted r.<))) (random.one (function (_ thresholds) (case thresholds (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 9e9228ab6..5eedd7f9d 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -173,12 +173,12 @@ (n.= /.bits_per_byte (n./ /.bytes_per_i64 /.width)))) (_.cover [/.false] - (n.= 0 (/.count /.false))) + (n.= 0 (/.ones /.false))) (_.cover [/.or] (and (\= /.true (/.or /.true pattern)) (\= pattern (/.or /.false pattern)))) (_.cover [/.true] - (n.= /.width (/.count /.true))) + (n.= /.width (/.ones /.true))) (_.cover [/.and] (and (\= pattern (/.and /.true pattern)) (\= /.false (/.and /.false pattern)))) @@ -196,16 +196,16 @@ (\= /.false (/.xor pattern pattern)))) - (_.cover [/.count] + (_.cover [/.ones] (let [clear&set! (if (/.set? idx pattern) - (n.= (dec (/.count pattern)) (/.count (/.clear idx pattern))) - (n.= (inc (/.count pattern)) (/.count (/.set idx pattern)))) + (n.= (dec (/.ones pattern)) (/.ones (/.clear idx pattern))) + (n.= (inc (/.ones pattern)) (/.ones (/.set idx pattern)))) complementarity! (n.= /.width - (n.+ (/.count pattern) - (/.count (/.not pattern))))] + (n.+ (/.ones pattern) + (/.ones (/.not pattern))))] (and clear&set! complementarity!))) (_.cover [/.left_rotated /.right_rotated] diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index baf9f23a1..27da768f8 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -9,9 +9,10 @@ ["$." order] ["$." monoid] ["$." codec]]] - [data - ["." bit ("#\." equivalence)] + [control ["." maybe ("#\." functor)]] + [data + ["." bit ("#\." equivalence)]] [math ["." random (#+ Random)]]]] [\\library diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 9684fd3f6..2d7198c46 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -11,10 +11,10 @@ ["$." apply] ["$." monad]]] [control + ["." maybe] ["." try (#+ Try) ("#\." functor)]] [data ["." product] - ["." maybe] ["." bit ("#\." equivalence)] ["." name ("#\." equivalence)] ["." text ("#\." equivalence) @@ -67,20 +67,20 @@ #.extensions [] #.host []}]] ($_ _.and - (_.cover [/.run] + (_.cover [/.result] (|> (\ /.monad in expected) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual))))) - (_.cover [/.run'] + (_.cover [/.result'] (|> (\ /.monad in expected) - (/.run' expected_lux) + (/.result' expected_lux) (!expect (^multi (#try.Success [actual_lux actual]) (and (is? expected_lux actual_lux) (n.= expected actual)))))) (_.cover [/.get_compiler] (|> /.get_compiler - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_lux) (is? expected_lux actual_lux))))) ))) @@ -117,43 +117,43 @@ (_.cover [/.failure] (|> (/.failure expected_error) (: (Meta Any)) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Failure actual_error) (text\= (location.with location.dummy expected_error) actual_error))))) (_.cover [/.assertion] (and (|> (/.assertion expected_error true) (: (Meta Any)) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Success []))) (|> (/.assertion expected_error false) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Failure actual_error) (text\= expected_error actual_error)))))) (_.cover [/.either] (and (|> (/.either (\ /.monad in expected) (: (Meta Nat) (/.failure expected_error))) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) (\ /.monad in expected)) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) (: (Meta Nat) (/.failure expected_error))) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Failure actual_error) (text\= (location.with location.dummy expected_error) actual_error)))) (|> (/.either (\ /.monad in expected) (\ /.monad in dummy)) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual) (n.= expected actual)))) )) @@ -217,58 +217,58 @@ ($_ _.and (_.cover [/.current_module_name] (|> /.current_module_name - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_current_module) (text\= expected_current_module actual_current_module))))) (_.cover [/.current_module] (|> /.current_module - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_module) (is? expected_module actual_module))))) (_.cover [/.module] (|> (/.module expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_module) (is? expected_module actual_module))))) (_.cover [/.module_exists?] (and (|> (/.module_exists? expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Success #1))) (|> (/.module_exists? dummy_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Success #0))))) (_.cover [/.modules] (|> /.modules - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_modules) (is? expected_modules actual_modules))))) (_.cover [/.imported_modules] (and (|> (/.imported_modules expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ (list.equivalence text.equivalence) = (list imported_module_name))) (try.else false)) (|> (/.imported_modules imported_module_name) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ (list.equivalence text.equivalence) = (list))) (try.else false)))) (_.cover [/.imported_by?] (|> (/.imported_by? imported_module_name expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (try.else false))) (_.cover [/.imported?] (|> (/.imported? imported_module_name) - (/.run expected_lux) + (/.result expected_lux) (try.else false))) (_.cover [/.normal] (and (|> (/.normal ["" expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success [actual_module actual_short]) (and (text\= expected_current_module actual_module) (is? expected_short actual_short))))) (|> (/.normal [dummy_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success [actual_module actual_short]) (and (text\= dummy_module actual_module) (is? expected_short actual_short))))))) @@ -317,23 +317,23 @@ [pre /.seed post /.seed] (in [pre post])) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success [actual_pre actual_post]) (and (n.= expected_seed actual_pre) (n.= (inc expected_seed) actual_post)))))) (_.cover [/.location] (|> /.location - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_location) (is? expected_location actual_location))))) (_.cover [/.expected_type] (|> /.expected_type - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type))))) (_.cover [.Type_Context /.type_context] (|> /.type_context - (/.run expected_lux) + (/.result expected_lux) (try\map (is? type_context)) (try.else false))) ))) @@ -409,13 +409,13 @@ current_globals! (|> (/.globals expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_globals) (is? current_globals actual_globals)))) macro_globals! (|> (/.globals expected_macro_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_globals) (is? macro_globals actual_globals))))] (and current_globals! @@ -424,11 +424,11 @@ (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (and (|> (/.definitions expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_definitions) (n.= 0 (list.size actual_definitions))))) (|> (/.definitions expected_macro_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_definitions) (n.= 1 (list.size actual_definitions))))) ))) @@ -436,22 +436,22 @@ (and (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (and (|> (/.exports expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_definitions) (n.= 0 (list.size actual_definitions))))) (|> (/.exports expected_macro_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_definitions) (n.= 1 (list.size actual_definitions))))) )) (let [[current_globals macro_globals expected_lux] (expected_lux false (#.Some .Macro))] (and (|> (/.exports expected_current_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_definitions) (n.= 0 (list.size actual_definitions))))) (|> (/.exports expected_macro_module) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_definitions) (n.= 0 (list.size actual_definitions))))) )))) @@ -528,19 +528,19 @@ (and (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some expected_type))] (|> (/.export [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Success _)))) (let [[current_globals macro_globals expected_lux] (expected_lux false (#.Some expected_type))] (|> (/.export [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Failure _)))))) (_.cover [/.macro] (let [same_module! (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (|> (/.macro [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success (#.Some actual_value)) (is? expected_value actual_value))))) @@ -548,21 +548,21 @@ (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some expected_type))] (|> (/.macro [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Success #.None)))) not_found! (let [[current_globals macro_globals expected_lux] (expected_lux true #.None)] (|> (/.macro [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (#try.Success #.None)))) aliasing! (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (|> (/.macro [expected_current_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success (#.Some actual_value)) (is? expected_value actual_value)))))] (and same_module! @@ -573,11 +573,11 @@ (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (and (|> (/.de_aliased [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.else false)) (|> (/.de_aliased [expected_current_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.else false))))) (_.cover [/.definition] @@ -586,7 +586,7 @@ definition! (|> (/.definition [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success (#.Definition [actual_exported? actual_type actual_annotations actual_value])) (and (bit\= expected_exported? actual_exported?) (is? expected_type actual_type) @@ -595,7 +595,7 @@ alias! (|> (/.definition [expected_current_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success (#.Alias [actual_module actual_short])) (and (is? expected_macro_module actual_module) (is? expected_short actual_short)))))] @@ -607,13 +607,13 @@ definition! (|> (/.definition_type [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type)))) alias! (|> (/.definition_type [expected_current_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type))))] (and definition! @@ -624,13 +624,13 @@ definition! (|> (/.type_definition [expected_macro_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_value) (is? (:as .Type expected_value) actual_value)))) alias! (|> (/.type_definition [expected_current_module expected_short]) - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual_value) (is? (:as .Type expected_value) actual_value))))] (and definition! @@ -711,12 +711,12 @@ (list.equivalence name.equivalence) type.equivalence))] (|> (/.tag_lists tag_module) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ equivalence = (list [tags_1 type_1]))) (try.else false)))) (_.cover [/.tags_of] (|> (/.tags_of [tag_module name_1]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ (maybe.equivalence (list.equivalence name.equivalence)) = (#.Some tags_1))) (try.else false))) (_.cover [/.tag] @@ -725,7 +725,7 @@ (list.every? (function (_ [expected_index tag]) (|> tag /.tag - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (^ (#try.Success [actual_index actual_tags actual_type])) (let [correct_index! (n.= expected_index @@ -822,51 +822,51 @@ text.equivalence type.equivalence))))] (|> /.locals - (/.run expected_lux) + (/.result expected_lux) (try\map (\ equivalence = (list (list [name_3 type_3]) (list [name_1 type_1] [name_2 type_2])))) (try.else false)))) (_.cover [/.var_type] (and (|> (/.var_type name_0) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_0)) (try.else false)) (|> (/.var_type name_1) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_1)) (try.else false)) (|> (/.var_type name_2) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_2)) (try.else false)) (|> (/.var_type name_3) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_3)) (try.else false)))) (_.cover [/.type] (and (|> (/.type ["" name_0]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_0)) (try.else false)) (|> (/.type ["" name_1]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_1)) (try.else false)) (|> (/.type ["" name_2]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_2)) (try.else false)) (|> (/.type ["" name_3]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_3)) (try.else false)) (|> (/.type [current_module name_4]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_4)) (try.else false)) (|> (/.type ["" name_4]) - (/.run expected_lux) + (/.result expected_lux) (try\map (\ type.equivalence = type_4)) (try.else false)))) ))) @@ -878,8 +878,8 @@ (def: (comparison init) (-> Lux (Comparison Meta)) (function (_ == left right) - (case [(/.run init left) - (/.run init right)] + (case [(/.result init left) + (/.result init right)] [(#try.Success left) (#try.Success right)] (== left right) @@ -935,7 +935,7 @@ #try.Failure (: (Try Nat)) /.lift - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Failure actual) (text\= (location.with expected_location expected_error) actual)))) @@ -943,7 +943,7 @@ #try.Success (: (Try Nat)) /.lift - (/.run expected_lux) + (/.result expected_lux) (!expect (^multi (#try.Success actual) (is? expected_value actual))))))) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index df55e17f4..0321a5441 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -38,21 +38,21 @@ (let [outcome ((: (-> (List Text) (io.IO Any)) (..actual_program )) inputs)] - (is? (: Any inputs) (io.run outcome)))) + (is? (: Any inputs) (io.run! outcome)))) (with_expansions [ (/.program: [arg/0 arg/1 arg/2 arg/3 arg/4] (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))] (let [outcome ((: (-> (List Text) (io.IO Any)) (..actual_program )) inputs)] (list\= (list.reversed inputs) - (:as (List Text) (io.run outcome))))) + (:as (List Text) (io.run! outcome))))) (with_expansions [ (/.program: [{all_arguments (<>.many .any)}] (io.io all_arguments))] (let [outcome ((: (-> (List Text) (io.IO Any)) (..actual_program )) inputs)] (list\= inputs - (:as (List Text) (io.run outcome))))) + (:as (List Text) (io.run! outcome))))) (with_expansions [ (/.program: [arg/0 arg/1 arg/2 arg/3] (io.io []))] (case (try ((: (-> (List Text) (io.IO Any)) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index dfe6180ab..f503c8779 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -8,11 +8,11 @@ [control ["." function] ["." io] + ["." maybe] ["." try] [concurrency ["." atom]]] [data - ["." maybe] ["." bit ("#\." equivalence)] ["." text ("#\." equivalence) ["%" format (#+ format)]] @@ -121,10 +121,10 @@ [_ bytecode] /.areturn)))) (row.row)) - .let [bytecode (format.run /class.writer class) + .let [bytecode (format.result /class.writer class) loader (/loader.memory (/loader.new_library []))] _ (/loader.define class_name bytecode loader) - class (io.run (/loader.load class_name 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) @@ -887,12 +887,12 @@ /.areturn)))) (row.row)) try.assumed - (format.run /class.writer)) + (format.result /class.writer)) loader (/loader.memory (/loader.new_library []))]] (_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" (case (do try.monad [_ (/loader.define class_name bytecode loader) - class (io.run (/loader.load class_name loader)) + 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)] (in (:as Int output))) @@ -1354,10 +1354,10 @@ _ (get@ #wrap primitive)] /.areturn)))) (row.row)) - .let [bytecode (format.run /class.writer class) + .let [bytecode (format.result /class.writer class) loader (/loader.memory (/loader.new_library []))] _ (/loader.define class_name bytecode loader) - class (io.run (/loader.load class_name 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) @@ -1635,7 +1635,7 @@ interface_method method::type (list) #.None)) (row.row)) try.assumed - (format.run /class.writer)) + (format.result /class.writer)) abstract_bytecode (|> (/class.class /version.v6_0 ($_ /modifier\compose /class.public /class.abstract) (/name.internal abstract_class) (/name.internal "java.lang.Object") @@ -1655,7 +1655,7 @@ abstract_method method::type (list) #.None)) (row.row)) try.assumed - (format.run /class.writer)) + (format.result /class.writer)) invoke (: (-> (Type Class) Text (Bytecode Any)) (function (_ class method) (do /.monad @@ -1702,14 +1702,14 @@ /.areturn)))) (row.row)) try.assumed - (format.run /class.writer)) + (format.result /class.writer)) loader (/loader.memory (/loader.new_library []))]] (_.test "Class & interface inheritance" (case (do try.monad [_ (/loader.define abstract_class abstract_bytecode loader) _ (/loader.define interface_class interface_bytecode loader) _ (/loader.define concrete_class concrete_bytecode loader) - class (io.run (/loader.load concrete_class loader)) + 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)] (in (:as Int output))) diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 0df2e43d3..fe60e832c 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -70,7 +70,7 @@ pre (<| (/.seed seed) (do ! [sample random.nat - .let [wrote? (io.run (write sample))]] + .let [wrote? (io.run! (write sample))]] (/.test "" wrote?))) post (<| (/.seed seed) (do ! @@ -105,7 +105,7 @@ times_assertion (<| (/.times expected) (do ! [_ (in []) - .let [_ (io.run (atom.update! inc counter))]] + .let [_ (io.run! (atom.update! inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] times_assertion @@ -128,7 +128,7 @@ (: /.Test) (do ! [_ (in []) - .let [_ (io.run (atom.update! inc counter))]] + .let [_ (io.run! (atom.update! inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] assertion @@ -147,7 +147,7 @@ (do ! [_ (in []) .let [_ (undefined) - _ (io.run (atom.update! inc counter))]] + _ (io.run! (atom.update! inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] assertion diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index e87761302..671afe39d 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -139,7 +139,7 @@ (_.cover [/.parser] (|> expected (\ /.codec encode) - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false))) ..for_ranges diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index 10c44e678..872e7f2ce 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -73,7 +73,7 @@ [expected random.date] (_.cover [/.parser] (|> (\ /.codec encode expected) - (.run /.parser) + (.result /.parser) (try\map (\ /.equivalence = expected)) (try.else false)))) (do {! random.monad} @@ -87,7 +87,7 @@ "-" (%.nat month) "-" (%.nat day))]] (_.cover [/.invalid_month] - (case (.run /.parser input) + (case (.result /.parser input) (#try.Failure error) (exception.match? /.invalid_month error) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index 6e7c90821..a7659421a 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -97,7 +97,7 @@ (apply duration.inverse day\pred 6) (apply duration.inverse day\pred 7))))) (_.cover [/.now] - (case (try (io.run /.now)) + (case (try (io.run! /.now)) (#try.Success _) true 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 ac408d71d..beaf1169e 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 @@ -8,10 +8,10 @@ ["r" math/random (#+ Random) ("#\." monad)] ["_" test (#+ Test)] [control - pipe] + pipe + ["." maybe]] [data ["." product] - ["." maybe] ["." text ("#\." equivalence)] [number ["n" nat]] @@ -196,7 +196,7 @@ (|> (analyse_pm redundant_branchesC) _structure.check_fails))) (do ! - [[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.checks? outputT) not) + [[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.subsumes? outputT) not) _primitive.primitive) heterogeneous_idx (|> r.nat (\ ! map (n.% (list.size exhaustive_patterns)))) .let [heterogeneous_branchesC (list.concat (list (list.take heterogeneous_idx exhaustive_branchesC) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 7981f1422..3e97c0dbd 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -9,9 +9,9 @@ ["_" test (#+ Test)] [control pipe + ["." maybe] ["." try]] [data - ["." maybe] ["." product] ["." text ("#\." equivalence)] [number @@ -42,7 +42,7 @@ (-> Type Nat (Operation Analysis) Bit) (|> analysis (//type.with_type expectedT) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (#try.Success applyA) (let [[funcA argsA] (////analysis.application applyA)] (n.= num_args (list.size argsA))) 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 3b93ae562..8df54a276 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 @@ -74,7 +74,7 @@ (-> Type (Operation Analysis) (Try Analysis)) (|> analysis //type.with_inference - (phase.run ..state) + (phase.result ..state) (case> (#try.Success [inferred_type output]) (if (is? expected_type inferred_type) (#try.Success output) 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 2d1a34d1b..ef7be9dcd 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 @@ -59,7 +59,7 @@ (in []))] (//type.with_inference (_primitive.phase archive.empty (code.identifier [def_module var_name])))))) - (phase.run _primitive.state) + (phase.result _primitive.state) check!)) (def: .public test @@ -77,7 +77,7 @@ (//scope.with_local [var_name expectedT] (//type.with_inference (_primitive.phase archive.empty (code.local_identifier var_name))))) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (^ (#try.Success [inferredT (#////analysis.Reference (////reference.local var))])) (and (type\= expectedT inferredT) (n.= 0 var)) @@ -91,7 +91,7 @@ (//type.with_inference (_primitive.phase archive.empty (code.identifier def_name)))) (//module.with_module 0 def_module) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (^ (#try.Success [_ inferredT (#////analysis.Reference (////reference.constant constant_name))])) (and (type\= expectedT inferredT) (name\= def_name constant_name)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 9bc61107b..fcb23d771 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -8,11 +8,11 @@ ["_" test (#+ Test)] [control pipe + ["." maybe] ["." try]] [data ["." bit ("#\." equivalence)] ["." product] - ["." maybe] ["." text] [number ["n" nat]] @@ -41,7 +41,7 @@ (template [ ] [(def: .public (All [a] (-> (Operation a) Bit)) - (|>> (phase.run _primitive.state) + (|>> (phase.result _primitive.state) (case> (#try.Success _) @@ -69,7 +69,7 @@ (-> Type Tag Nat (Operation Analysis) Bit) (|> analysis (//type.with_type type) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) (check_sum' tag size variant) @@ -87,7 +87,7 @@ (|> analysis (with_tags module tags variantT) (//type.with_type expectedT) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (^ (#try.Success [_ (////analysis.variant variant)])) (check_sum' tag (list.size tags) variant) @@ -109,7 +109,7 @@ (|> analysis (with_tags module tags recordT) (//type.with_type expectedT) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (#try.Success [_ productA]) (correct_size? size productA) @@ -143,7 +143,7 @@ (check.check varT variantT))] (//type.with_type varT (/.sum _primitive.phase choice archive.empty valueC))) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) (check_sum' choice size variant) @@ -185,7 +185,7 @@ (_.test "Can analyse." (|> (//type.with_type tupleT (/.product archive.empty _primitive.phase (list\map product.right primitives))) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (#try.Success tupleA) (correct_size? size tupleA) @@ -194,9 +194,9 @@ (_.test "Can infer." (|> (//type.with_inference (/.product archive.empty _primitive.phase (list\map product.right primitives))) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (#try.Success [_type tupleA]) - (and (check.checks? tupleT _type) + (and (check.subsumes? tupleT _type) (correct_size? size tupleA)) _ @@ -212,7 +212,7 @@ (check.check varT (type.tuple (list\map product.left primitives))))] (//type.with_type varT (/.product archive.empty _primitive.phase (list\map product.right primitives)))) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (#try.Success tupleA) (correct_size? size tupleA) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 508eed47f..30ad64e34 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -38,7 +38,7 @@ (|> (////scope.with_scope "" (////type.with_type output_type (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) - (phase.run _primitive.state) + (phase.result _primitive.state) (case> (#try.Success _) 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 6d83f1fa7..224349569 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 @@ -52,7 +52,7 @@ (_.cover [/.synthesize_masking] (|> maskA (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (try\map (//primitive.corresponds? maskedA)) (try.default false))))) @@ -70,7 +70,7 @@ (_.cover [/.synthesize_let] (|> letA (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (case> (^ (#try.Success (synthesis.branch/let [inputS registerS outputS]))) (and (n.= registerA registerS) (//primitive.corresponds? inputA inputS) @@ -98,7 +98,7 @@ (_.cover [/.synthesize_if] (|> ifA (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (case> (^ (#try.Success (synthesis.branch/if [inputS thenS elseS]))) (and (//primitive.corresponds? inputA inputS) (//primitive.corresponds? thenA thenS) @@ -157,7 +157,7 @@ (_.cover [/.synthesize_get] (|> getA (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (case> (^ (#try.Success (synthesis.branch/get [pathS recordS]))) (and (\ (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS) (//primitive.corresponds? recordA recordS)) @@ -332,7 +332,7 @@ [expected_path match] ..random_case] (_.cover [/.synthesize_case] (|> (/.synthesize_case //.phase archive.empty expected_input match) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (case> (^ (#try.Success (synthesis.branch/case [actual_input actual_path]))) (and (\ synthesis.equivalence = expected_input actual_input) (\ synthesis.path_equivalence = expected_path actual_path)) 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 31e5e3422..692a2fab9 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 @@ -7,7 +7,6 @@ ["." try]] [data ["." product] - ["." maybe] ["." text ["%" format (#+ format)]] [number @@ -431,7 +430,7 @@ (_.cover [/.abstraction] (|> input (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (!expect (^multi (#try.Success actual) (\ synthesis.equivalence = expected actual))))))) @@ -444,14 +443,14 @@ (_.cover [/.apply] (and (|> (analysis.apply [funcA argsA]) (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (!expect (^multi (^ (#try.Success (synthesis.function/apply [funcS argsS]))) (and (//primitive.corresponds? funcA funcS) - (list.every? (product.uncurry //primitive.corresponds?) + (list.every? (product.uncurried //primitive.corresponds?) (list.zipped/2 argsA argsS)))))) (|> (analysis.apply [funcA (list)]) (//.phase archive.empty) - (phase.run [///bundle.empty synthesis.init]) + (phase.result [///bundle.empty synthesis.init]) (!expect (^multi (#try.Success funcS) (//primitive.corresponds? funcA funcS)))))))) 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 25524e590..529db21df 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 @@ -80,7 +80,7 @@ (_.test (%.name (name_of )) (|> (#////analysis.Primitive ( expected)) (//.phase archive.empty) - (phase.run [///bundle.empty ////synthesis.init]) + (phase.result [///bundle.empty ////synthesis.init]) (case> (#try.Success (#////synthesis.Primitive ( actual))) (is? expected actual) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index 4db00f1f2..a7fa786fb 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -45,7 +45,7 @@ (_.test "Can synthesize variants." (|> (////analysis.variant [lefts right? memberA]) (//.phase archive.empty) - (phase.run [///bundle.empty ////synthesis.init]) + (phase.result [///bundle.empty ////synthesis.init]) (case> (^ (#try.Success (////synthesis.variant [leftsS right?S valueS]))) (let [tagS (if right?S (inc leftsS) leftsS)] (and (n.= tagA tagS) @@ -63,10 +63,10 @@ (_.test "Can synthesize tuple." (|> (////analysis.tuple membersA) (//.phase archive.empty) - (phase.run [///bundle.empty ////synthesis.init]) + (phase.result [///bundle.empty ////synthesis.init]) (case> (^ (#try.Success (////synthesis.tuple membersS))) (and (n.= size (list.size membersS)) - (list.every? (product.uncurry //primitive.corresponds?) + (list.every? (product.uncurried //primitive.corresponds?) (list.zipped/2 membersA membersS))) _ diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 5b2327dc4..46adc6884 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -7,9 +7,9 @@ [\\specification ["$." equivalence]]] [control - [pipe (#+ case>)]] + [pipe (#+ case>)] + ["." maybe]] [data - ["." maybe] ["." bit ("#\." equivalence)] ["." text ("#\." equivalence)] [collection diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 57df78e84..ef086d142 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -16,7 +16,6 @@ [data ["." bit ("#\." equivalence)] ["." product] - ["." maybe] ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection @@ -96,7 +95,7 @@ (def: comparison (Comparison (All [a] (/.Check a))) (function (_ == left right) - (case [(/.run /.fresh_context left) (/.run /.fresh_context right)] + (case [(/.result /.fresh_context left) (/.result /.fresh_context right)] [(#try.Success left) (#try.Success right)] (== left right) @@ -122,26 +121,26 @@ (do random.monad [expected (random.ascii/upper 10)] (_.cover [/.failure] - (case (/.run /.fresh_context - (: (/.Check Any) - (/.failure expected))) + (case (/.result /.fresh_context + (: (/.Check Any) + (/.failure expected))) (#try.Success _) false (#try.Failure actual) (is? expected actual)))) (do random.monad [expected (random.ascii/upper 10)] (_.cover [/.assertion] - (and (case (/.run /.fresh_context - (: (/.Check Any) - (/.assertion expected true))) + (and (case (/.result /.fresh_context + (: (/.Check Any) + (/.assertion expected true))) (#try.Success _) true (#try.Failure actual) false) - (case (/.run /.fresh_context (/.assertion expected false)) + (case (/.result /.fresh_context (/.assertion expected false)) (#try.Success _) false (#try.Failure actual) (is? expected actual))))) (_.cover [/.except] - (case (/.run /.fresh_context - (: (/.Check Any) - (/.except ..yolo []))) + (case (/.result /.fresh_context + (: (/.Check Any) + (/.except ..yolo []))) (#try.Success _) false (#try.Failure error) (exception.match? ..yolo error))) )) @@ -151,21 +150,21 @@ (<| (_.for [/.Var]) ($_ _.and (_.cover [/.var] - (case (/.run /.fresh_context - (do /.monad - [[var_id var_type] /.var] - (in (type\= var_type (#.Var var_id))))) + (case (/.result /.fresh_context + (do /.monad + [[var_id var_type] /.var] + (in (type\= var_type (#.Var var_id))))) (#try.Success verdict) verdict (#try.Failure error) false)) (do random.monad [nominal (random.ascii/upper 10)] (_.cover [/.bind] - (case (/.run /.fresh_context - (do /.monad - [[var_id var_type] /.var - _ (/.bind (#.Primitive nominal (list)) - var_id)] - (in true))) + (case (/.result /.fresh_context + (do /.monad + [[var_id var_type] /.var + _ (/.bind (#.Primitive nominal (list)) + var_id)] + (in true))) (#try.Success _) true (#try.Failure error) false))) (do random.monad @@ -179,7 +178,7 @@ post (/.bound? var_id)] (in (and (not pre) post))) - (/.run /.fresh_context) + (/.result /.fresh_context) (try.else false)) (|> (do /.monad [[var_id var/0] /.var @@ -189,18 +188,18 @@ post (/.bound? var_id)] (in (and (not pre) (not post)))) - (/.run /.fresh_context) + (/.result /.fresh_context) (try.else false))))) (do random.monad [nominal (random.ascii/upper 10)] (_.cover [/.cannot_rebind_var] - (case (/.run /.fresh_context - (do /.monad - [[var_id var_type] /.var - _ (/.bind (#.Primitive nominal (list)) - var_id)] - (/.bind (#.Primitive nominal (list)) - var_id))) + (case (/.result /.fresh_context + (do /.monad + [[var_id var_type] /.var + _ (/.bind (#.Primitive nominal (list)) + var_id)] + (/.bind (#.Primitive nominal (list)) + var_id))) (#try.Success _) false @@ -210,9 +209,9 @@ [nominal (random.ascii/upper 10) var_id random.nat] (_.cover [/.unknown_type_var] - (case (/.run /.fresh_context - (/.bind (#.Primitive nominal (list)) - var_id)) + (case (/.result /.fresh_context + (/.bind (#.Primitive nominal (list)) + var_id)) (#try.Success _) false @@ -225,7 +224,7 @@ (and (|> (do /.monad [[var_id var_type] /.var] (/.read var_id)) - (/.run /.fresh_context) + (/.result /.fresh_context) (case> (#try.Success #.None) true _ false)) (|> (do /.monad @@ -233,14 +232,14 @@ [_ var/1] /.var _ (/.check var/0 var/1)] (/.read var_id)) - (/.run /.fresh_context) + (/.result /.fresh_context) (case> (#try.Success #.None) true _ false)) (|> (do /.monad [[var_id var_type] /.var _ (/.bind expected var_id)] (/.read var_id)) - (/.run /.fresh_context) + (/.result /.fresh_context) (case> (#try.Success (#.Some actual)) (is? expected actual) @@ -250,11 +249,11 @@ [nominal (random.ascii/upper 10) .let [expected (#.Primitive nominal (list))]] (_.cover [/.read!] - (case (/.run /.fresh_context - (do /.monad - [[var_id var_type] /.var - _ (/.bind expected var_id)] - (/.read! var_id))) + (case (/.result /.fresh_context + (do /.monad + [[var_id var_type] /.var + _ (/.bind expected var_id)] + (/.read! var_id))) (#try.Success actual) (is? expected actual) @@ -264,10 +263,10 @@ [nominal (random.ascii/upper 10) .let [expected (#.Primitive nominal (list))]] (_.cover [/.unbound_type_var] - (case (/.run /.fresh_context - (do /.monad - [[var_id var_type] /.var] - (/.read! var_id))) + (case (/.result /.fresh_context + (do /.monad + [[var_id var_type] /.var] + (/.read! var_id))) (#try.Failure error) (exception.match? /.unbound_type_var error) @@ -283,16 +282,16 @@ (n.= 0 (get@ #.ex_counter /.fresh_context)) (list.empty? (get@ #.var_bindings /.fresh_context)))) (_.cover [/.context] - (and (case (/.run /.fresh_context /.context) + (and (case (/.result /.fresh_context /.context) (#try.Success actual) (is? /.fresh_context actual) (#try.Failure error) false) - (case (/.run /.fresh_context - (do /.monad - [_ /.var] - /.context)) + (case (/.result /.fresh_context + (do /.monad + [_ /.var] + /.context)) (#try.Success actual) (and (n.= 1 (get@ #.var_counter actual)) (n.= 0 (get@ #.ex_counter actual)) @@ -301,10 +300,10 @@ (#try.Failure error) false))) (_.cover [/.existential] - (case (/.run /.fresh_context - (do /.monad - [_ /.existential] - /.context)) + (case (/.result /.fresh_context + (do /.monad + [_ /.existential] + /.context)) (#try.Success actual) (and (n.= 0 (get@ #.var_counter actual)) (n.= 1 (get@ #.ex_counter actual)) @@ -316,7 +315,7 @@ (def: succeeds? (All [a] (-> (/.Check a) Bit)) - (|>> (/.run /.fresh_context) + (|>> (/.result /.fresh_context) (case> (#try.Success _) true @@ -687,7 +686,7 @@ cleanedT (/.clean (type_shape varT))] (in (type\= (type_shape varT) cleanedT))) - (/.run /.fresh_context) + (/.result /.fresh_context) (try.else false)) (|> (do /.monad [[var_id varT] /.var @@ -696,7 +695,7 @@ cleanedT (/.clean (type_shape varT))] (in (type\= (type_shape replacementT) cleanedT))) - (/.run /.fresh_context) + (/.result /.fresh_context) (try.else false)) )))) @@ -708,9 +707,9 @@ ..polymorphism (do random.monad [expected random.nat] - (_.cover [/.run] - (case (/.run /.fresh_context - (\ /.monad in expected)) + (_.cover [/.result] + (case (/.result /.fresh_context + (\ /.monad in expected)) (#try.Success actual) (is? expected actual) (#try.Failure error) false))) ..error_handling diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index 2c99f3163..369a2de9a 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -5,8 +5,9 @@ [abstract [predicate (#+ Predicate)] [monad (#+ do)]] + [control + ["." maybe ("#\." monad)]] [data - ["." maybe ("#\." monad)] [collection ["." list ("#\." functor)]]] [math diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index 18ee0164d..df66d6f74 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -32,13 +32,13 @@ [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) .let [! identity.monad]] - (_.for [/.Linear /.run /.monad] + (_.for [/.Linear /.run! /.monad] (`` ($_ _.and (~~ (template [ ] [(_.cover (<| (text\= (format pre post)) (: (Identity Text)) - (/.run !) + (/.run! !) (do (/.monad !) (in (format left right)))))] @@ -74,14 +74,14 @@ [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) .let [! io.monad]] - (_.for [/.Linear /.run /.monad] + (_.for [/.Linear /.run! /.monad] (`` ($_ _.and (~~ (template [ ] [(_.cover (<| (text\= (format pre post)) - io.run + io.run! (: (IO Text)) - (/.run !) + (/.run! !) (do (/.monad !) (in (format left right)))))] @@ -117,12 +117,12 @@ [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) .let [! async.monad]] - (_.for [/.Linear /.run /.monad] + (_.for [/.Linear /.run! /.monad] (`` ($_ _.and (~~ (template [ ] [(in (monad.do ! [outcome (<| (: (Async Text)) - (/.run !) + (/.run! !) (do (/.monad !) (in (format left right))))] diff --git a/stdlib/source/test/lux/type/variance.lux b/stdlib/source/test/lux/type/variance.lux index e683b1f64..b2a16a221 100644 --- a/stdlib/source/test/lux/type/variance.lux +++ b/stdlib/source/test/lux/type/variance.lux @@ -22,14 +22,14 @@ (<| (_.covering /._) ($_ _.and (_.cover [/.Co] - (and (//check.checks? (type (/.Co Super)) (type (/.Co Sub))) - (not (//check.checks? (type (/.Co Sub)) (type (/.Co Super)))))) + (and (//check.subsumes? (type (/.Co Super)) (type (/.Co Sub))) + (not (//check.subsumes? (type (/.Co Sub)) (type (/.Co Super)))))) (_.cover [/.Contra] - (and (//check.checks? (type (/.Contra Sub)) (type (/.Contra Super))) - (not (//check.checks? (type (/.Contra Super)) (type (/.Contra Sub)))))) + (and (//check.subsumes? (type (/.Contra Sub)) (type (/.Contra Super))) + (not (//check.subsumes? (type (/.Contra Super)) (type (/.Contra Sub)))))) (_.cover [/.In] - (and (//check.checks? (type (/.In Super)) (type (/.In Super))) - (//check.checks? (type (/.In Sub)) (type (/.In Sub))) - (not (//check.checks? (type (/.In Sub)) (type (/.In Super)))) - (not (//check.checks? (type (/.In Super)) (type (/.In Sub)))))) + (and (//check.subsumes? (type (/.In Super)) (type (/.In Super))) + (//check.subsumes? (type (/.In Sub)) (type (/.In Sub))) + (not (//check.subsumes? (type (/.In Sub)) (type (/.In Super)))) + (not (//check.subsumes? (type (/.In Super)) (type (/.In Sub)))))) ))) diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index c358ca699..945dfc352 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -58,7 +58,7 @@ [expected (random.ascii/alpha 10) .let [console (/.mock ..mock [false ""])]] (_.cover [/.write_line] - (io.run + (io.run! (do io.monad [?_ (/.write_line expected console) ?actual (\ console read_line [])] diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index f3e0d7968..98f589439 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -101,7 +101,7 @@ (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit))) (do (try.with async.monad) [_ (: (Async (Try Any)) - (//.make_file async.monad fs (binary.create 0) expected_path)) + (//.make_file async.monad fs (binary.empty 0) expected_path)) poll/pre (\ watcher poll []) poll/post (\ watcher poll [])] (in (and (case poll/pre diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index c9c6cfee3..28c2849be 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -4,9 +4,10 @@ ["_" test (#+ Test)] [abstract [monad (#+ do)]] + [control + ["." maybe]] [data ["." bit ("#\." equivalence)] - ["." maybe] [collection ["." list] ["." set (#+ Set)]]] diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index d1726c7e0..24ece9d1e 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -69,8 +69,8 @@ [(_.cover [] (|> ( "" //.empty #.None mock) (do> try.monad - [io.run] - [product.right (get@ #//.body) (function.apply #.None) io.run] + [io.run!] + [product.right (get@ #//.body) (function.apply #.None) io.run!] [product.right (\ utf8.codec decode)] [(\ nat.decimal decode)] [(nat.= ) in]) diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux index 0775b263e..543dcb3f7 100644 --- a/stdlib/source/test/lux/world/output/video/resolution.lux +++ b/stdlib/source/test/lux/world/output/video/resolution.lux @@ -7,8 +7,9 @@ [\\specification ["$." equivalence] ["$." hash]]] + [control + ["." maybe]] [data - ["." maybe] [collection ["." list] ["." set (#+ Set)]]] diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux index 50e1b4ffd..f2643a3b7 100644 --- a/stdlib/source/test/lux/world/program.lux +++ b/stdlib/source/test/lux/world/program.lux @@ -7,12 +7,12 @@ [control [pipe (#+ case>)] ["." io] + ["." maybe ("#\." functor)] ["." try] ["." exception] [parser [environment (#+ Environment)]]] [data - ["." maybe ("#\." functor)] ["." text ("#\." equivalence)] [collection ["." dictionary] @@ -53,7 +53,7 @@ ($/.spec (/.async (/.mock environment home directory)))) (_.cover [/.environment] (let [program (/.mock environment home directory)] - (io.run + (io.run! (do io.monad [actual (/.environment io.monad program)] (in (and (n.= (dictionary.size environment) @@ -69,7 +69,7 @@ (let [program (/.mock environment home directory)] (|> unknown (\ program variable) - io.run + io.run! (case> (#try.Success _) false -- cgit v1.2.3