diff options
Diffstat (limited to 'stdlib/source/test')
147 files changed, 735 insertions, 750 deletions
diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index e50626c79..5efc00d4e 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -60,7 +60,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.year_is_out_of_range] - (case (/.date candidate) + (when (/.date candidate) {try.#Success date} (same? candidate (/.value date)) diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index a27e90074..b388866c6 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -53,13 +53,13 @@ (def (compilation_format value) (-> /.Compilation (List Text)) - (case value + (when value {/.#Build} (list "build") {/.#Test} (list "test"))) (def (format value) (-> /.Command (List Text)) - (case value + (when value {/.#Version} (list "version") {/.#Clean} (list "clean") {/.#POM} (list "pom") @@ -77,7 +77,7 @@ (|> expected ..format (cli.result /.command) - (pipe.case + (pipe.when {try.#Success [names actual]} (and (at (list.equivalence text.equivalence) = (list //.default) names) (at /.equivalence = expected actual)) @@ -95,7 +95,7 @@ ..format (list.partial "with" expected_profile) (cli.result /.command) - (pipe.case + (pipe.when {try.#Success [actual_profile actual_command]} (and (at (list.equivalence text.equivalence) = (list expected_profile //.default) actual_profile) (at /.equivalence = expected_command actual_command)) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 5dc092327..b202af97f 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -110,7 +110,7 @@ fs (shell.async ($build.good_shell [])) resolution) - (at ! each (|>> (pipe.case + (at ! each (|>> (pipe.when {try.#Failure error} (same? end_signal error) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 9aea4828c..c039b6e9c 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -85,7 +85,7 @@ (def (on_read state) (if error? (exception.except shell.no_more_output []) - (case state + (when state {.#Item head tail} {try.#Success [tail head]} @@ -93,7 +93,7 @@ (exception.except shell.no_more_output [])))) (def (on_fail state) (if error? - (case state + (when state {.#Item head tail} {try.#Success [tail head]} @@ -165,7 +165,7 @@ [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty (with_target empty_profile))] (unit.coverage [/.no_specified_program] - (case outcome + (when outcome {try.#Success _} false @@ -174,7 +174,7 @@ (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] (unit.coverage [/.Lux /.no_available_lux] - (case outcome + (when outcome {try.#Success _} false @@ -234,7 +234,7 @@ actual/1 (at console read_line []) actual/2 (at console read_line []) end! (|> (at console read_line []) - (at ! each (|>> (pipe.case + (at ! each (|>> (pipe.when {try.#Failure error} true diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 32a10f8a3..0d304f19d 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -41,7 +41,7 @@ (in (do [! async.monad] [.let [console (@version.echo "")] outcome (/.do! console fs sample)] - (case outcome + (when outcome {try.#Success _} (do ! [verdict (do ///action.monad @@ -64,7 +64,7 @@ {try.#Failure error} (unit.coverage [/.do!] - (case (the ///.#identity sample) + (when (the ///.#identity sample) {.#Some _} false diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index dbc458897..f94ef4421 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -69,7 +69,7 @@ (def (request method url headers input) (do io.monad [_ (is (IO Any) - (case [method input] + (when [method input] [{@http.#Put} {.#Some input}] (atom.update! (dictionary.has url input) cache) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 6bc81298e..0f353d828 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -265,7 +265,7 @@ [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] (unit.coverage [/.one] - (case actual_package + (when actual_package {try.#Success actual_package} (at ///package.equivalence = (has ///package.#origin {///repository/origin.#Remote ""} expected_package) @@ -279,7 +279,7 @@ [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] (unit.coverage [<exception>] - (case actual_package + (when actual_package {try.#Failure error} (exception.match? <exception> error) @@ -314,7 +314,7 @@ [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] (unit.coverage [/.any] - (case actual_package + (when actual_package {try.#Success actual_package} (at ///package.equivalence = (has ///package.#origin {///repository/origin.#Remote ""} expected_package) @@ -330,7 +330,7 @@ [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] (unit.coverage [/.cannot_resolve] - (case actual_package + (when actual_package {try.#Failure error} (exception.match? /.cannot_resolve error) diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux index b61d35630..85edbdbf8 100644 --- a/stdlib/source/test/aedifex/dependency/status.lux +++ b/stdlib/source/test/aedifex/dependency/status.lux @@ -40,7 +40,7 @@ (do random.monad [payload (binaryT.random 1)] (_.coverage [/.verified] - (case (/.verified payload) + (when (/.verified payload) {/.#Verified sha1 md5} true diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index 61cb569fa..7271458b9 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -50,13 +50,13 @@ [(do random.monad [expected (..random <hash>)] (_.coverage [<hash> <constructor> <exception>] - (and (case (<constructor> (/.data expected)) + (and (when (<constructor> (/.data expected)) {try.#Success actual} (at /.equivalence = expected actual) {try.#Failure error} false) - (case (<constructor> (at binary.monoid composite + (when (<constructor> (at binary.monoid composite (/.data expected) (/.data expected))) {try.#Success actual} @@ -81,7 +81,7 @@ [(do random.monad [expected (..random <hash>)] (_.coverage [<codec>] - (case (at <codec> decoded + (when (at <codec> decoded (format (at <codec> encoded expected) "AABBCC")) {try.#Success actual} diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index f67d1e130..f2d430fb2 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -108,10 +108,10 @@ [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] (unit.coverage [/.write /.read] - (and (case wrote? + (and (when wrote? {try.#Success _} true {try.#Failure _} false) - (case actual + (when actual {try.#Success actual} (at /.equivalence = expected actual) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index b41a6ce15..34965c98a 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -120,10 +120,10 @@ [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] (unit.coverage [/.write /.read] - (and (case wrote? + (and (when wrote? {try.#Success _} true {try.#Failure _} false) - (case actual + (when actual {try.#Success actual} (at /.equivalence = expected actual) diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index 035765b17..dc03b1671 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -76,13 +76,13 @@ [actual_pom binary_pom pom_status] (the /.#pom local) [actual_library library_status] (the /.#library local)] - (and (case (the /.#origin local) + (and (when (the /.#origin local) {//origin.#Local ""} true _ false) (let [expected_sha1 (//hash.sha-1 expected_library) expected_md5 (//hash.md5 expected_library)] (and (same? expected_library actual_library) - (case library_status + (when library_status {//status.#Verified actual_sha1 expected_md5} (and (//hash#= expected_sha1 actual_sha1) (//hash#= expected_md5 expected_md5)) @@ -97,7 +97,7 @@ decoded_pom (at xml.codec decoded xml_pom)] (in (at xml.equivalence = actual_pom decoded_pom))) (try.else false)) - (case pom_status + (when pom_status {//status.#Verified actual_sha1 expected_md5} (and (//hash#= expected_sha1 actual_sha1) (//hash#= expected_md5 expected_md5)) @@ -106,7 +106,7 @@ false)))))) (_.coverage [/.dependencies] (let [expected (the //.#dependencies profile)] - (case (/.dependencies package) + (when (/.dependencies package) {try.#Success actual} (at set.equivalence = expected actual) @@ -114,7 +114,7 @@ false))) (_.coverage [/.repositories] (let [expected (the //.#repositories profile)] - (case (/.repositories package) + (when (/.repositories package) {try.#Success actual} (at set.equivalence = expected actual) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index fb2852701..54cdbc17a 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -84,7 +84,7 @@ //format.project list (<code>.result /.project) - (pipe.case + (pipe.when {try.#Success actual} (|> expected ..with_empty_profile diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux index c6283f30d..0484599e0 100644 --- a/stdlib/source/test/aedifex/pom.lux +++ b/stdlib/source/test/aedifex/pom.lux @@ -34,11 +34,11 @@ (do random.monad [expected @profile.random] (_.coverage [/.write /.parser] - (case [(/.write expected) + (when [(/.write expected) (the //.#identity expected)] [{try.#Success pom} {.#Some _}] - (case (<xml>.result /.parser (list pom)) + (when (<xml>.result /.parser (list pom)) {try.#Success actual} (at //.equivalence = (|> (at //.monoid identity) diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 2db5873e8..29f8b1215 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -84,14 +84,14 @@ (try#each (at //.equivalence = (at //.monoid composite sub_profile super_profile))) (try.else false)))) (_.coverage [/.unknown_profile] - (case (/.profile project fake_name) + (when (/.profile project fake_name) {try.#Success _} false {try.#Failure error} (exception.match? /.unknown_profile error))) (_.coverage [/.circular_dependency] - (case (/.profile circular sub_name) + (when (/.profile circular sub_name) {try.#Success _} false diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 72c36f74b..fbb3ef01b 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -72,9 +72,9 @@ (def the_description "@") (def (on_download uri state) - (case (dictionary.value uri state) + (when (dictionary.value uri state) {.#Some content} - (case (binary.size content) + (when (binary.size content) 0 (exception.except ..not_found [uri]) _ {try.#Success [state content]}) diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index 52a91bea6..96a07f678 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -45,7 +45,7 @@ _ (at repo upload uri expected) actual (at repo download uri)] (unit.coverage [/.repository] - (and (case before_upload + (and (when before_upload {try.#Success _} false {try.#Failure _} true) (|> actual diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux index a5380ddec..5a1c21316 100644 --- a/stdlib/source/test/aedifex/repository/remote.lux +++ b/stdlib/source/test/aedifex/repository/remote.lux @@ -51,7 +51,7 @@ (dictionary.value "User-Agent") (maybe#each (same? /.user_agent)) (maybe.else false)) - (case [method input] + (when [method input] [{@http.#Get} {.#None}] [http/status.ok [@http.#headers (http.headers (list)) @@ -113,7 +113,7 @@ (let [repo (/.repository (..good_http user password) {.#None} address)] - (case (io.run! (at repo upload uri content)) + (when (io.run! (at repo upload uri content)) {try.#Failure error} (exception.match? /.upload_failure error) @@ -123,7 +123,7 @@ (let [repo (/.repository ..bad_http {.#None} address)] - (case (io.run! (at repo download uri)) + (when (io.run! (at repo download uri)) {try.#Failure error} (exception.match? /.download_failure error) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 4d7a695e8..53d699818 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -129,21 +129,21 @@ expected random.nat] (all _.and (_.coverage [/.try] - (case (/.try expected) + (when (/.try expected) {.#Left _} false {.#Right actual} (n.= expected actual))) (_.coverage [/.undefined] - (case (/.try (/.undefined)) + (when (/.try (/.undefined)) {.#Left _} true {.#Right _} false)) (_.coverage [/.panic!] - (case (/.try (/.panic! expected_error)) + (when (/.try (/.panic! expected_error)) {.#Left actual_error} (text.contains? expected_error actual_error) @@ -160,7 +160,7 @@ e/3 random.nat] (all _.and (_.coverage [/.list] - (case (/.list e/0 e/1) + (when (/.list e/0 e/1) (/.list a/0 a/1) (and (n.= e/0 a/0) (n.= e/1 a/1)) @@ -411,7 +411,7 @@ ... (let [scenario (is (-> Any Bit) ... (function (_ _) ... ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. - ... (`` (for @.python (case (' [<input>']) + ... (`` (for @.python (when (' [<input>']) ... (^.` [<module> ... ("lux def" (, [_ {.#Symbol ["" _]}]) [] #0) ... (,, (template.spliced <referrals>))]) @@ -419,7 +419,7 @@ ... _ ... false) - ... (case (' [<input>']) + ... (when (' [<input>']) ... (^.` [<module> (,, (template.spliced <referrals>))]) ... true @@ -537,7 +537,7 @@ (_.coverage [/.type_of] (same? /.Nat (/.type_of expected))) (_.coverage [/.Primitive] - (case (/.Primitive "foo" [expected/0 expected/1]) + (when (/.Primitive "foo" [expected/0 expected/1]) {.#Primitive "foo" (list actual/0 actual/1)} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) @@ -545,28 +545,28 @@ _ false)) (_.coverage [/.type_literal] - (and (case (/.type_literal [expected/0 expected/1]) + (and (when (/.type_literal [expected/0 expected/1]) {.#Product actual/0 actual/1} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) _ false) - (case (/.type_literal (/.Or expected/0 expected/1)) + (when (/.type_literal (/.Or expected/0 expected/1)) {.#Sum actual/0 actual/1} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) _ false) - (case (/.type_literal (-> expected/0 expected/1)) + (when (/.type_literal (-> expected/0 expected/1)) {.#Function actual/0 actual/1} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) _ false) - (case (/.type_literal (expected/0 expected/1)) + (when (/.type_literal (expected/0 expected/1)) {.#Apply actual/1 actual/0} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) @@ -668,7 +668,7 @@ (in option/1))] (all _.and (_.coverage [/.static] - (case sample + (when sample (/.static option/0) true (/.static option/1) true _ false)) @@ -906,7 +906,7 @@ {.#Some [item/1 {.#Some [item/2 {.#None}]}]}]})] - (case list + (when list {.#Some [actual/0 {.#Some [actual/1 {.#Some [actual/2 {.#None}]}]}]} (and (same? item/0 actual/0) (same? item/1 actual/1) @@ -926,7 +926,7 @@ [[..#left <left> ..#right <right>]])) -(def for_case +(def for_when Test (do [! random.monad] [expected_nat (at ! each (n.% 1) random.nat) @@ -938,40 +938,40 @@ expected_text (random.either (in "+0.5") (in "+1.25"))] (all _.and - (_.coverage [/.case] - (and (/.case expected_nat + (_.coverage [/.when] + (and (/.when expected_nat 0 true _ false) - (/.case expected_int + (/.when expected_int +0 true _ false) - (/.case expected_rev + (/.when expected_rev .5 true .25 true _ false) - (/.case expected_frac + (/.when expected_frac +0.5 true +1.25 true _ false) - (/.case expected_text + (/.when expected_text "+0.5" true "+1.25" true _ false) - (/.case [expected_nat expected_int] + (/.when [expected_nat expected_int] [0 +0] true _ false) - (/.case [..#left expected_nat ..#right expected_int] + (/.when [..#left expected_nat ..#right expected_int] [..#left 0 ..#right +0] true _ false) - (/.case (is (Either Nat Int) {.#Left expected_nat}) + (/.when (is (Either Nat Int) {.#Left expected_nat}) {.#Left 0} true _ false) - (/.case (is (Either Nat Int) {.#Right expected_int}) + (/.when (is (Either Nat Int) {.#Right expected_int}) {.#Right +0} true _ false) )) ... (_.coverage [/.pattern] - ... (/.case [..#left expected_nat ..#right expected_int] + ... (/.when [..#left expected_nat ..#right expected_int] ... (!pair 0 +0) ... true @@ -1046,7 +1046,7 @@ (set.member? ..possible_targets (the .#target info)) compiling! - (case (the .#mode info) + (when (the .#mode info) {.#Build} true _ false)] {.#Right [lux (list (code.bit (and conforming_target! @@ -1056,7 +1056,7 @@ (syntax (_ []) (do meta.monad [prelude (meta.module .prelude)] - (in (list (code.bit (case (the .#module_state prelude) + (in (list (code.bit (when (the .#module_state prelude) {.#Active} false _ true))))))) @@ -1095,7 +1095,7 @@ let/2 <code>.local let/3 <code>.local]) - (in (list (code.bit (case (the .#scopes lux_state) + (in (list (code.bit (when (the .#scopes lux_state) (list.partial scope/2 _) (let [locals/2 (the .#locals scope/2) expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2 @@ -1114,7 +1114,7 @@ local? (is (-> Ref Bit) (function (_ ref) - (case ref + (when ref {.#Local _} true {.#Captured _} false))) captured? (is (-> Ref Bit) @@ -1181,7 +1181,7 @@ ..for_associative ..for_expansion ..for_value - ..for_case + ..for_when ..for_control_flow ..for_def ..for_meta diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux index bc48cff4e..8544e5de6 100644 --- a/stdlib/source/test/lux/abstract/apply.lux +++ b/stdlib/source/test/lux/abstract/apply.lux @@ -26,7 +26,7 @@ (all _.and (_.coverage [/.composite] (let [expected (n.+ left right)] - (case (at (/.composite maybe.monad maybe.apply list.apply) on + (when (at (/.composite maybe.monad maybe.apply list.apply) on {.#Some (list right)} {.#Some (list (n.+ left))}) {.#Some (list actual)} diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux index c55c7e311..3f07c30cb 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -40,7 +40,7 @@ [expected random.bit] (<| (_.covering /._) (_.coverage [/.composite] - (case (|> expected (at ..codec encoded) (at ..codec decoded)) + (when (|> expected (at ..codec encoded) (at ..codec decoded)) {try.#Success actual} (bit#= expected actual) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index fc50c636a..0f575f3e6 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -38,7 +38,7 @@ can_be_backwards? (at (list.equivalence n.equivalence) = (/.range n.enum start end) (list.reversed (/.range n.enum end start))) - every_element_is_a_successor? (case range + every_element_is_a_successor? (when range {.#Item head tail} (|> (list#mix (function (_ next [verdict prev]) [(and verdict diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 14d22ae5f..0689009f6 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -29,9 +29,9 @@ (type Variant (.Variant - {#Case0 Bit} - {#Case1 Int} - {#Case2 Frac})) + {#Case_0 Bit} + {#Case_1 Int} + {#Case_2 Frac})) (type Recursive (Rec Recursive @@ -119,7 +119,7 @@ (/.rec (function (_ equivalence) (implementation (def (= left right) - (case [left right] + (when [left right] [{.#End} {.#End}] true diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux index c2e5f18eb..b3eee1741 100644 --- a/stdlib/source/test/lux/abstract/functor.lux +++ b/stdlib/source/test/lux/abstract/functor.lux @@ -54,7 +54,7 @@ (<| (_.covering /._) (all _.and (_.coverage [/.Or /.sum] - (and (case (at (/.sum maybe.functor list.functor) each + (and (when (at (/.sum maybe.functor list.functor) each (n.+ shift) {.#Left {.#Some left}}) {.#Left {.#Some actual}} @@ -62,7 +62,7 @@ _ false) - (case (at (/.sum maybe.functor list.functor) each + (when (at (/.sum maybe.functor list.functor) each (n.+ shift) {.#Right (list right)}) {.#Right (list actual)} @@ -71,7 +71,7 @@ _ false))) (_.coverage [/.And /.product] - (case (at (/.product maybe.functor list.functor) each + (when (at (/.product maybe.functor list.functor) each (n.+ shift) [{.#Some left} (list right)]) [{.#Some actualL} (list actualR)] @@ -81,7 +81,7 @@ _ false)) (_.coverage [/.Then /.composite] - (case (at (/.composite maybe.functor list.functor) each + (when (at (/.composite maybe.functor list.functor) each (n.+ shift) {.#Some (list left)}) {.#Some (list actual)} diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 8270a88b3..9f43008b2 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -142,7 +142,7 @@ [[l m r] (|> (random.set n.hash 3 random.nat) (at ! each (|>> set.list (list.sorted n.<) - (pipe.case + (pipe.when (list b t1 t2) [b t1 t2] @@ -165,7 +165,7 @@ [[b t1 t2] (|> (random.set n.hash 3 random.nat) (at ! each (|>> set.list (list.sorted n.<) - (pipe.case + (pipe.when (list b t1 t2) [b t1 t2] @@ -193,7 +193,7 @@ [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) (at ! each (|>> set.list (list.sorted n.<) - (pipe.case + (pipe.when (list x0 x1 x2 x3) [x0 x1 x2 x3] @@ -227,7 +227,7 @@ [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) (at ! each (|>> set.list (list.sorted n.<) - (pipe.case + (pipe.when (list x0 x1 x2 x3) [x0 x1 x2 x3] diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 7a4375c27..eb67429b2 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -25,7 +25,7 @@ (def (interpret free) (All (_ a) (-> (/.Free List a) (List a))) - (case free + (when free {/.#Pure value} (list value) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index aec54bebe..b49761269 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -280,14 +280,6 @@ (/.push (/.apply_2 n.+)) /.partial /.call)))) - (_.coverage [/.when] - (n.= (if choice - (++ sample) - sample) - (/.value (|>> (/.push sample) - (/.push choice) - (/.push (/.apply_1 ++)) - /.when)))) (_.coverage [/.?] (n.= (if choice (++ sample) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 35fbb8027..d11016a4b 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -42,7 +42,7 @@ (def (mailed? outcome) (-> (Try Any) Bit) - (case outcome + (when outcome {try.#Success _} true {try.#Failure _} false)) @@ -91,7 +91,7 @@ (function (_ message state self) (do [! async.monad] [outcome (message state self)] - (case outcome + (when outcome {try.#Failure cause} (do ! [_ (async.future (write cause))] @@ -104,7 +104,7 @@ _ (async.delay 100) result (async.future (async.value read))] (unit.coverage [/.poisoned] - (case result + (when result {.#Some error} (exception.match? /.poisoned error) @@ -126,7 +126,7 @@ _ (/.poison! counter)] (/.mail! ++! counter)))] (unit.coverage [/.dead] - (case result + (when result {try.#Success outcome} false @@ -144,7 +144,7 @@ obituary (/.obituary' actor)] (in {try.#Success [actor sent? alive? obituary]})))] (unit.coverage [/.Obituary /.obituary'] - (case result + (when result {try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]} (and (..mailed? sent?) (not alive?) @@ -165,7 +165,7 @@ (n.= 2 output_2) (n.= 3 output_3))))] (unit.coverage [/.Message /.tell!] - (case result + (when result {try.#Success outcome} outcome diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 5ca8704ff..36aba9dfd 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -40,7 +40,7 @@ (do io.monad [?left (/.value left) ?right (/.value right)] - (in (case [?left ?right] + (in (when [?left ?right] [{.#Some left} {.#Some right}] (== left right) @@ -121,7 +121,7 @@ ?right (/.or (/.after waiting_time dummy) (in rightE))] (unit.coverage [/.or] - (case [?left ?right] + (when [?left ?right] [{.#Left leftA} {.#Right rightA}] (n.= (n.+ leftE rightE) (n.+ leftA rightA)) @@ -142,7 +142,7 @@ (/.async []))] ?never (/.future (/.value async))] (unit.coverage [/.value] - (case [?actual ?never] + (when [?actual ?never] [{.#Some actual} {.#None}] (n.= expected actual) @@ -160,7 +160,7 @@ [?none (/.within 0 (/.after waiting_time dummy)) ?actual (/.within waiting_time (in expected))] (unit.coverage [/.within] - (case [?none ?actual] + (when [?none ?actual] [{.#None} {.#Some actual}] (n.= expected actual) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index a3fe7263c..16cae30d8 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -40,7 +40,7 @@ (do io.monad [?left (async.value left) ?right (async.value right)] - (in (case [?left ?right] + (in (when [?left ?right] [{.#Some {.#Some [left _]}} {.#Some {.#Some [right _]}}] (== left right) @@ -50,13 +50,13 @@ (def (take_amount amount_of_polls [channel sink]) (All (_ a) (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a)))) - (case amount_of_polls + (when amount_of_polls 0 (do async.monad [_ (async.future (at sink close))] (in {.#End})) _ (do [! async.monad] [event channel] - (case event + (when event {.#None} (in {.#End}) @@ -86,7 +86,7 @@ ($monad.spec ..injection ..comparison /.monad)) (_.coverage [/.Channel /.Sink /.channel] - (case (io.run! + (when (io.run! (do (try.with io.monad) [.let [[channel sink] (is [(/.Channel Nat) (/.Sink Nat)] (/.channel []))] @@ -97,7 +97,7 @@ (io.run! (do io.monad [?actual (async.value channel)] - (in (case ?actual + (in (when ?actual {.#Some {.#Some [actual _]}} (n.= sample actual) @@ -107,7 +107,7 @@ {try.#Failure error} false)) (_.coverage [/.already_closed] - (case (io.run! + (when (io.run! (do (try.with io.monad) [.let [[channel sink] (is [(/.Channel Nat) (/.Sink Nat)] (/.channel []))] diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 19a99f55d..54143c345 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -46,7 +46,7 @@ (in (do async.monad [result (async.within ..delay (/.wait! semaphore))] (unit.coverage [/.semaphore] - (case result + (when result {.#Some _} true @@ -59,7 +59,7 @@ [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore)) result (async.within ..delay (/.wait! semaphore))] (unit.coverage [/.wait!] - (case result + (when result {.#Some _} false @@ -75,7 +75,7 @@ open_positions (/.signal! semaphore) result/1 (async.within ..delay block)] (unit.coverage [/.signal!] - (case [result/0 result/1 open_positions] + (when [result/0 result/1 open_positions] [{.#None} {.#Some _} {try.#Success +0}] true @@ -87,7 +87,7 @@ (in (do async.monad [outcome (/.signal! semaphore)] (unit.coverage [/.semaphore_is_maxed_out] - (case outcome + (when outcome {try.#Failure error} (exception.match? /.semaphore_is_maxed_out error) @@ -146,7 +146,7 @@ (do random.monad [raw random.nat] (_.coverage [/.Limit /.limit] - (case [raw (/.limit raw)] + (when [raw (/.limit raw)] [0 {.#None}] true diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 8f57a99dc..ce7b9d985 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -72,7 +72,7 @@ visit (is (-> (List Nat) (/.Cont (List Nat) (List Nat))) (function (visit xs) - (case xs + (when xs {.#End} (_#in {.#End}) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 1021d8522..d90494bd9 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -39,11 +39,11 @@ (_.for [/.Exception]) (all _.and (_.coverage [/.except] - (case (/.except ..an_exception []) + (when (/.except ..an_exception []) {try.#Success _} false {try.#Failure _} true)) (_.coverage [/.error] - (case (/.except ..an_exception []) + (when (/.except ..an_exception []) {try.#Success _} false @@ -53,7 +53,7 @@ (/.match? ..an_exception (/.error ..an_exception []))) (_.coverage [/.assertion] - (case (/.assertion ..an_exception [] assertion_succeeded?) + (when (/.assertion ..an_exception [] assertion_succeeded?) {try.#Success _} assertion_succeeded? @@ -89,13 +89,13 @@ (text.contains? field1 enumeration) (text.contains? value1 enumeration)))) (_.coverage [/.with] - (and (case (/.with ..an_exception [] {try.#Success expected}) + (and (when (/.with ..an_exception [] {try.#Success expected}) {try.#Success actual} (n.= expected actual) {try.#Failure _} false) - (case (/.with ..an_exception [] {try.#Failure ""}) + (when (/.with ..an_exception [] {try.#Failure ""}) {try.#Success _} false {try.#Failure message} (text#= message (/.error ..an_exception []))) - (case (/.with ..an_exception [] + (when (/.with ..an_exception [] (is (Try Nat) (/.except ..another_exception []))) {try.#Success _} @@ -105,7 +105,7 @@ (and (text.contains? (/.error ..an_exception []) message) (text.contains? (/.error ..another_exception []) message))))) (_.coverage [/.exception] - (case (/.except ..custom_exception [expected]) + (when (/.except ..custom_exception [expected]) {try.#Success _} false diff --git a/stdlib/source/test/lux/control/function/contract.lux b/stdlib/source/test/lux/control/function/contract.lux index 312e7070f..44666a08d 100644 --- a/stdlib/source/test/lux/control/function/contract.lux +++ b/stdlib/source/test/lux/control/function/contract.lux @@ -24,7 +24,7 @@ [expected random.nat]) (all _.and (_.coverage [/.pre /.pre_condition_failed] - (case (try (/.pre (n.even? expected) + (when (try (/.pre (n.even? expected) true)) {try.#Success output} output @@ -34,7 +34,7 @@ error) (not (n.even? expected))))) (_.coverage [/.post /.post_condition_failed] - (case (try (/.post n.odd? + (when (try (/.post n.odd? expected)) {try.#Success actual} (same? expected actual) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index d1ab63220..8c024ff60 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -32,7 +32,7 @@ (def (fibonacci again input) (/.Memo Nat Nat) - (case input + (when input 0 (state#in 0) 1 (state#in 1) _ (do state.monad @@ -110,7 +110,7 @@ (//.mixed /.memoization) (is (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) (function (factorial delegate again input) - (case input + (when input (^.or 0 1) (at state.monad in 1) _ (do state.monad [output' (again (-- input))] diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 9fce7f116..9d403e17d 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -55,7 +55,7 @@ (_.coverage [/.fixed] (let [factorial (/.fixed (function (_ delegate again input) - (case input + (when input (^.or 0 1) 1 _ (n.* input (again (-- input))))))] (n.= expected @@ -63,7 +63,7 @@ (_.coverage [/.mixed] (let [bottom (is (/.Mixin Nat Nat) (function (_ delegate again input) - (case input + (when input (^.or 0 1) 1 _ (delegate input)))) multiplication (is (/.Mixin Nat Nat) @@ -75,7 +75,7 @@ (_.coverage [/.nothing] (let [loop (is (/.Mixin Nat Nat) (function (_ delegate again input) - (case input + (when input (^.or 0 1) 1 _ (n.* input (delegate (-- input)))))) left (/.fixed (/.mixed /.nothing loop)) @@ -90,7 +90,7 @@ 1)) bottom? (is (Predicate Nat) (function (_ input) - (case input + (when input (^.or 0 1) true _ false))) multiplication (is (/.Mixin Nat Nat) @@ -132,7 +132,7 @@ (let [factorial (/.fixed (/.of_recursive (function (_ again input) - (case input + (when input (^.or 0 1) 1 _ (n.* input (again (-- input)))))))] (n.= expected diff --git a/stdlib/source/test/lux/control/function/mutual.lux b/stdlib/source/test/lux/control/function/mutual.lux index a4bfed417..8f6a7069d 100644 --- a/stdlib/source/test/lux/control/function/mutual.lux +++ b/stdlib/source/test/lux/control/function/mutual.lux @@ -24,13 +24,13 @@ (<| (_.coverage [/.let]) (/.let [(even? number) (-> Nat Bit) - (case number + (when number 0 true _ (odd? (-- number))) (odd? number) (-> Nat Bit) - (case number + (when number 0 false _ (even? (-- number)))] (and (bit#= expected (even? sample)) @@ -39,13 +39,13 @@ (/.def [(even? number) (-> Nat Bit) - (case number + (when number 0 true _ (odd? (-- number)))] [(odd? number) (-> Nat Bit) - (case number + (when number 0 false _ (even? (-- number)))]) diff --git a/stdlib/source/test/lux/control/function/predicate.lux b/stdlib/source/test/lux/control/function/predicate.lux index 6855a1b2d..9a016094c 100644 --- a/stdlib/source/test/lux/control/function/predicate.lux +++ b/stdlib/source/test/lux/control/function/predicate.lux @@ -25,7 +25,7 @@ (def (multiple? factor) (-> Nat (/.Predicate Nat)) - (case factor + (when factor 0 (function.constant false) _ (|>> (n.% factor) (n.= 0)))) @@ -80,7 +80,7 @@ any_even? (is (/.Predicate (List Nat)) (/.rec (function (_ again) (function (_ values) - (case values + (when values {.#End} false diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index e4efb58b0..d99622737 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -56,7 +56,7 @@ [a (lifted (io#in left)) b (in right)] (in (n.+ a b)))) - (pipe.case + (pipe.when {.#Some actual} (n.= expected actual) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 9922a79dc..10e897f03 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -31,7 +31,7 @@ (def (should_fail expected input) (All (_ a) (-> Text (Try a) Bit)) - (case input + (when input {try.#Failure actual} (text#= expected actual) @@ -40,7 +40,7 @@ (def (enforced? parser input) (All (_ s) (-> (Parser s Any) s Bit)) - (case (/.result parser input) + (when (/.result parser input) {try.#Success [_ []]} true @@ -49,7 +49,7 @@ (def (found? parser input) (All (_ s) (-> (Parser s Bit) s Bit)) - (case (/.result parser input) + (when (/.result parser input) {try.#Success [_ .true]} true @@ -58,7 +58,7 @@ (def (fails? input) (All (_ a) (-> (Try a) Bit)) - (case input + (when input {try.#Failure _} true @@ -69,7 +69,7 @@ (syntax (_ [pattern <code>.any then <code>.any input <code>.any]) - (in (list (` (case (, input) + (in (list (` (when (, input) {try.#Success [(,' _) (, pattern)]} (, then) @@ -327,7 +327,7 @@ (def comparison (Comparison (All (_ a i) (Parser i a))) (function (_ == left right) - (case [(/.result left []) (/.result right [])] + (when [(/.result left []) (/.result right [])] [{try.#Success [_ left]} {try.#Success [_ right]}] (== left right) diff --git a/stdlib/source/test/lux/control/pipe.lux b/stdlib/source/test/lux/control/pipe.lux index 50d5bb67f..5f367ab9b 100644 --- a/stdlib/source/test/lux/control/pipe.lux +++ b/stdlib/source/test/lux/control/pipe.lux @@ -51,13 +51,6 @@ (/.if [n.even?] [(/.new "even" [])] [(/.new "odd" [])])))) - (_.coverage [/.when] - (n.= (if (n.even? sample) - (n.* 2 sample) - sample) - (|> sample - (/.when [n.even?] - [(n.* 2)])))) (_.coverage [/.while] (n.= (n.* 10 sample) (|> sample @@ -83,8 +76,8 @@ (and (n.= (++ sample) left) (n.= (-- sample) middle) (text#= (%.nat sample) right)))) - (_.coverage [/.case] - (text#= (case (n.% 10 sample) + (_.coverage [/.when] + (text#= (when (n.% 10 sample) 0 "zero" 1 "one" 2 "two" @@ -98,7 +91,7 @@ _ "???") (|> sample (n.% 10) - (/.case + (/.when 0 "zero" 1 "one" 2 "two" diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index b409a7d24..54e22f811 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -34,7 +34,7 @@ (def (success? result) (All (_ a) (-> (Try a) Bit)) - (case result + (when result {try.#Success _} true @@ -43,7 +43,7 @@ (def (throws? exception result) (All (_ e a) (-> (Exception e) (Try a) Bit)) - (case result + (when result {try.#Success _} false @@ -60,7 +60,7 @@ (def comparison (Comparison (All (_ a) (All (_ ! r) (Region r (Thread !) a)))) (function (_ == left right) - (case [(sharing [a] + (when [(sharing [a] (is (Equivalence a) ==) (is (Try a) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 9e75c00e6..963b3fbc1 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -39,14 +39,14 @@ (` ((, (code.symbol macro)) (, (code.text (%.date deadline))) (, (code.text message)) - (,* (case focus + (,* (when focus {.#None} (list) {.#Some focus} (list focus)))))) (def (attempt computation) (All (_ a) (-> (Meta a) (Meta (Try a)))) (function (_ compiler) - (case (computation compiler) + (when (computation compiler) {try.#Success [compiler output]} {try.#Success [compiler {try.#Success output}]} @@ -57,7 +57,7 @@ (-> Date Text (Maybe Code) Text Bit) (and (text.contains? (%.date deadline) failure) (text.contains? message failure) - (case focus + (when focus {.#None} true @@ -80,27 +80,27 @@ should_fail1 (..attempt (expansion.complete (..memory macro yesterday message {.#Some expected}))) should_succeed0 (..attempt (expansion.complete (..memory macro tomorrow message {.#None}))) should_succeed1 (..attempt (expansion.complete (..memory macro tomorrow message {.#Some expected})))] - (in (list (code.bit (and (case should_fail0 + (in (list (code.bit (and (when should_fail0 {try.#Failure error} (and (test_failure yesterday message {.#None} error) (text.contains? extra error)) _ false) - (case should_fail1 + (when should_fail1 {try.#Failure error} (and (test_failure yesterday message {.#Some expected} error) (text.contains? extra error)) _ false) - (case should_succeed0 + (when should_succeed0 {try.#Success (list)} true _ false) - (case should_succeed1 + (when should_succeed1 {try.#Success (list actual)} (same? expected actual) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 857d67ac5..00aac612f 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -60,7 +60,7 @@ (n.= expected (/.trusted {/.#Success expected}))) (_.coverage [/.of_maybe] - (case [(/.of_maybe {.#Some expected}) + (when [(/.of_maybe {.#Some expected}) (/.of_maybe {.#None})] [{/.#Success actual} {/.#Failure _}] (n.= expected actual) @@ -68,7 +68,7 @@ _ false)) (_.coverage [/.maybe] - (case [(/.maybe {/.#Success expected}) + (when [(/.maybe {/.#Success expected}) (/.maybe (is (/.Try Nat) {/.#Failure error}))] [{.#Some actual} {.#None}] (n.= expected actual) @@ -87,7 +87,7 @@ b (in alternative)] (in (n.+ a b))) io.run! - (pipe.case + (pipe.when {/.#Success result} (n.= (n.+ expected alternative) result) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 296867c13..05c3c2c6a 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -54,7 +54,7 @@ (def !expect (template (_ <expectation> <computation>) - [(case <computation> + [(when <computation> <expectation> true @@ -68,7 +68,7 @@ (|> value (at utf8.codec encoded) (at utf8.codec decoded) - (pipe.case + (pipe.when {try.#Success converted} (text#= value converted) @@ -423,7 +423,7 @@ (def (succeed result) (-> (Try Bit) Bit) - (case result + (when result {try.#Failure _} false @@ -443,7 +443,7 @@ (def (throws? exception try) (All (_ e a) (-> (Exception e) (Try a) Bit)) - (case try + (when try {try.#Failure error} (exception.match? exception error) @@ -454,7 +454,7 @@ (-> Nat (-> Nat /.Binary (Try Nat)) (-> Nat Nat /.Binary (Try Any)) Nat Bit) (let [bytes (i64.left_shifted power 1) binary (/.empty bytes) - cap (case bytes + cap (when bytes 8 (-- 0) _ (|> 1 (i64.left_shifted (n.* 8 bytes)) --)) capped_value (i64.and cap value)] @@ -499,7 +499,7 @@ [(_.coverage [<bytes/?> <has/?>] (let [bytes (i64.left_shifted <power> 1) binary (!.empty bytes) - cap (case bytes + cap (when bytes 8 (-- 0) _ (|> 1 (i64.left_shifted (n.* 8 bytes)) --)) capped_value (i64.and cap value) @@ -517,7 +517,7 @@ (_.coverage [!.slice] (let [random_slice (!.slice offset length sample) idxs (is (List Nat) - (case length + (when length 0 (list) _ (enum.range n.enum 0 (-- length)))) reader (function (_ binary idx) @@ -578,13 +578,13 @@ (_.coverage [/.slice] (let [random_slice (try.trusted (/.slice offset length sample)) idxs (is (List Nat) - (case length + (when length 0 (list) _ (enum.range n.enum 0 (-- length)))) reader (function (_ binary idx) (/.bits_8 idx binary))] (and (n.= length (/.size random_slice)) - (case [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs) + (when [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs) (monad.each try.monad (reader random_slice) idxs)] [{try.#Success binary_vals} {try.#Success slice_vals}] (at (list.equivalence n.equivalence) = binary_vals slice_vals) @@ -594,14 +594,14 @@ (_.coverage [/.slice_out_of_bounds] (and (throws? /.slice_out_of_bounds (/.slice size size sample)) (let [verdict (throws? /.slice_out_of_bounds (/.slice offset size sample))] - (case offset + (when offset 0 (not verdict) _ verdict)))) (_.coverage [/.after] (and (at /.equivalence = sample (/.after 0 sample)) (at /.equivalence = (/.empty 0) (/.after size sample)) (n.= (n.- offset size) (/.size (/.after offset sample))) - (case (list.reversed (..as_list sample)) + (when (list.reversed (..as_list sample)) {.#End} false @@ -609,7 +609,7 @@ (n.= (list.mix n.+ 0 tail) (/.mix n.+ 0 (/.after 1 sample)))))) (_.coverage [/.copy!] - (and (case (/.copy! size 0 sample 0 (/.empty size)) + (and (when (/.copy! size 0 sample 0 (/.empty size)) {try.#Success output} (and (not (same? sample output)) (at /.equivalence = sample output)) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index f12014f24..b13c77f6b 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -70,7 +70,7 @@ {.#Some (at n.decimal encoded value)} {.#None})))] (_.coverage [/.one] - (case [(|> evens + (when [(|> evens (/#each (at n.decimal encoded)) (/.item 0)) (/.one choose evens)] @@ -87,12 +87,12 @@ (/.example n.even? the_array) (list.example n.even? (/.list {.#None} the_array)))) (_.coverage [/.example'] - (case [(/.example n.even? the_array) + (when [(/.example n.even? the_array) (/.example' (function (_ idx member) (n.even? member)) the_array)] [{.#Some expected} {.#Some [idx actual]}] - (case (/.item idx the_array) + (when (/.item idx the_array) {.#Some again} (and (n.= expected actual) (n.= actual again)) @@ -156,7 +156,7 @@ (n.= size (!.size (is (Array Nat) (!.empty size))))) (_.coverage [!.primitive] - (case !.Array + (when !.Array (<| {.#Named (symbol !.Array)} {.#UnivQ (list)} {.#Primitive nominal_type (list {.#Parameter 1})}) @@ -281,7 +281,7 @@ (!.example n.even? the_array) (list.example n.even? (!.list {.#None} the_array)))) (_.coverage [!.example'] - (case [(!.example n.even? the_array) + (when [(!.example n.even? the_array) (!.example' (function (_ idx member) (n.even? member)) the_array)] @@ -324,7 +324,7 @@ (n.= size (/.size (is (Array Nat) (/.empty size))))) (_.coverage [/.primitive] - (case /.Array + (when /.Array (<| {.#Named (symbol /.Array)} {.#Named (symbol !.Array)} {.#UnivQ (list)} @@ -337,7 +337,7 @@ (let [the_array (|> (/.empty 2) (is (Array Nat)) (/.has! 0 expected))] - (case [(/.item 0 the_array) + (when [(/.item 0 the_array) (/.item 1 the_array)] [{.#Some actual} {.#None}] (n.= expected actual) @@ -348,7 +348,7 @@ (let [the_array (|> (/.empty 1) (is (Array Nat)) (/.has! 0 expected))] - (case [(/.item 0 the_array) + (when [(/.item 0 the_array) (/.item 0 (/.lacks! 0 the_array))] [{.#Some actual} {.#None}] (n.= expected actual) @@ -372,7 +372,7 @@ (is (Array Nat)) (/.has! 0 base) (/.revised! 0 (n.+ shift)))] - (case (/.item 0 the_array) + (when (/.item 0 the_array) {.#Some actual} (n.= expected actual) @@ -384,7 +384,7 @@ (/.has! 0 base) (/.upsert! 0 dummy (n.+ shift)) (/.upsert! 1 base (n.+ shift)))] - (case [(/.item 0 the_array) + (when [(/.item 0 the_array) (/.item 1 the_array)] [{.#Some actual/0} {.#Some actual/1}] (and (n.= expected actual/0) diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux index 379cfd131..2a134ab17 100644 --- a/stdlib/source/test/lux/data/collection/bits.lux +++ b/stdlib/source/test/lux/data/collection/bits.lux @@ -26,7 +26,7 @@ (Random Bits) (do [! random.monad] [size (at ! each (n.% 1,000) random.nat)] - (case size + (when size 0 (in /.empty) _ (do [! random.monad] [idx (|> random.nat (at ! each (n.% size)))] diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 369bddd2d..d02d9f3a4 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -44,7 +44,7 @@ (n.= size (/.size dict))) (_.coverage [/.empty?] - (case size + (when size 0 (/.empty? dict) _ (not (/.empty? dict)))) @@ -147,26 +147,26 @@ (/.keys dict))) (_.coverage [/.value] - (and (list.every? (function (_ key) (case (/.value key dict) + (and (list.every? (function (_ key) (when (/.value key dict) {.#Some _} true _ false)) (/.keys dict)) - (case (/.value non_key dict) + (when (/.value non_key dict) {.#Some _} false _ true))) (_.coverage [/.has] (and (n.= (++ (/.size dict)) (/.size (/.has non_key test_val dict))) - (case (/.value non_key (/.has non_key test_val dict)) + (when (/.value non_key (/.has non_key test_val dict)) {.#Some v} (n.= test_val v) _ true))) (_.coverage [/.has' /.key_already_exists] (let [can_put_new_keys! - (case (/.has' non_key test_val dict) + (when (/.has' non_key test_val dict) {try.#Success dict} - (case (/.value non_key dict) + (when (/.value non_key dict) {.#Some v} (n.= test_val v) _ true) @@ -176,7 +176,7 @@ cannot_put_old_keys! (or (n.= 0 size) (let [first_key (|> dict /.keys list.head maybe.trusted)] - (case (/.has' first_key test_val dict) + (when (/.has' first_key test_val dict) {try.#Success _} false @@ -189,7 +189,7 @@ (and (let [base (/.has non_key test_val dict)] (and (/.key? base non_key) (not (/.key? (/.lacks non_key base) non_key)))) - (case (list.head (/.keys dict)) + (when (list.head (/.keys dict)) {.#None} true @@ -200,7 +200,7 @@ (_.coverage [/.revised] (let [base (/.has non_key test_val dict) updt (/.revised non_key ++ base)] - (case [(/.value non_key base) (/.value non_key updt)] + (when [(/.value non_key base) (/.value non_key updt)] [{.#Some x} {.#Some y}] (n.= (++ x) y) @@ -209,7 +209,7 @@ (_.coverage [/.revised'] (let [can_upsert_new_key! - (case (/.value non_key (/.revised' non_key test_val ++ dict)) + (when (/.value non_key (/.revised' non_key test_val ++ dict)) {.#Some inserted} (n.= (++ test_val) inserted) @@ -217,12 +217,12 @@ false) can_upsert_old_key! - (case (list.head (/.entries dict)) + (when (list.head (/.entries dict)) {.#None} true {.#Some [known_key known_value]} - (case (/.value known_key (/.revised' known_key test_val ++ dict)) + (when (/.value known_key (/.revised' known_key test_val ++ dict)) {.#Some updated} (n.= (++ known_value) updated) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 7736202d0..951d6c891 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -27,7 +27,7 @@ (def .public (dictionary order gen_key gen_value size) (All (_ k v) (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) - (case size + (when size 0 (random#in (/.empty order)) @@ -75,7 +75,7 @@ (_.coverage [/.empty] (/.empty? (/.empty n.order))) (_.coverage [/.min] - (case [(/.min sample) (list.head sorted_values)] + (when [(/.min sample) (list.head sorted_values)] [{.#None} {.#None}] true @@ -85,7 +85,7 @@ _ false)) (_.coverage [/.max] - (case [(/.max sample) (list.last sorted_values)] + (when [(/.max sample) (list.last sorted_values)] [{.#None} {.#None}] true @@ -116,7 +116,7 @@ (/.size sample+)))))) (_.coverage [/.value] (let [sample+ (/.has extra_key extra_value sample)] - (case [(/.value extra_key sample) + (when [(/.value extra_key sample) (/.value extra_key sample+)] [{.#None} {.#Some actual}] (n.= extra_value actual) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 6bb1808f7..bd1e684d7 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -77,7 +77,7 @@ [a (lifted (io#in parameter)) b (in subject)] (in (n.+ a b)))) - (pipe.case + (pipe.when (list actual) (n.= expected actual) @@ -169,7 +169,7 @@ has_correct_values!))) (_.coverage [/.item] (/.every? (function (_ [index expected]) - (case (/.item index sample) + (when (/.item index sample) {.#Some actual} (n.= expected actual) @@ -177,13 +177,13 @@ false)) (/.enumeration sample))) (do ! - [index (case size + [index (when size 0 random.nat _ (at ! each (n.% size) random.nat)) .let [changed? (/#= sample (/.revised index ++ sample)) same? (/#= sample (/.revised size ++ sample))]] (_.coverage [/.revised] - (case size + (when size 0 (and changed? same?) _ (not changed?)))) @@ -250,7 +250,7 @@ (,, (with_template [<head> <tail> <pre>] [(all _.and (_.coverage [<head>] - (case [(<pre> sample) (<head> sample)] + (when [(<pre> sample) (<head> sample)] [{.#Item expected _} {.#Some actual}] (n.= expected actual) @@ -260,7 +260,7 @@ _ false)) (_.coverage [<tail>] - (case [(<pre> sample) (<tail> sample)] + (when [(<pre> sample) (<tail> sample)] [{.#Item _ expected} {.#Some actual}] (/#= (<pre> expected) actual) @@ -298,7 +298,7 @@ /.size (n.% 2) (n.= 0))] - (case (/.pairs sample/0) + (when (/.pairs sample/0) {.#Some pairs/0} (and even_sized? (n.= (n./ 2 (/.size sample/0)) @@ -384,7 +384,7 @@ [sample ..random] (all _.and (_.coverage [/.one] - (case [(|> sample + (when [(|> sample (/.only n.even?) (/#each (at n.decimal encoded)) /.head) @@ -404,7 +404,7 @@ (/#each (at n.decimal encoded))) (/.all choice sample))) (_.coverage [/.example] - (case (/.example n.even? sample) + (when (/.example n.even? sample) {.#Some found} (n.even? found) diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index b1889edc9..99511bab5 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -60,7 +60,7 @@ (and empty_is_empty! all_empty_queues_look_the_same!))) (_.coverage [/.front] - (case [members (/.front sample)] + (when [members (/.front sample)] [{.#Item head tail} {.#Some first}] (n.= head first) @@ -95,7 +95,7 @@ new_member_is_identified! has_expected_order!))) (_.coverage [/.next] - (case members + (when members {.#Item target expected} (let [popped (/.next sample) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index b0ca6a4f9..b7a1028fe 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -49,14 +49,14 @@ (_.coverage [/.empty] (/.empty? /.empty)) (_.coverage [/.front] - (case (/.front sample) + (when (/.front sample) {.#Some first} (n.> 0 (/.size sample)) {.#None} (/.empty? sample))) (_.coverage [/.member?] - (case (/.front sample) + (when (/.front sample) {.#Some first} (/.member? n.equivalence sample first) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index dac8c85a5..a24d05ed6 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -94,7 +94,7 @@ .let [sample (|> sample set.list /.of_list)]] (all _.and (_.coverage [/.item] - (case (/.item good_index sample) + (when (/.item good_index sample) {try.#Success member} (/.member? n.equivalence sample member) @@ -119,7 +119,7 @@ (_.coverage [/.index_out_of_bounds] (let [fails! (is (All (_ a) (-> (Try a) Bit)) (function (_ situation) - (case situation + (when situation {try.#Success member} false @@ -201,7 +201,7 @@ (if (n.even? value) {.#Some (at n.decimal encoded value)} {.#None})))] - (case [(|> sample + (when [(|> sample (/.only n.even?) (/#each (at n.decimal encoded)) (/.item 0)) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index cc68dbb85..cedc2db15 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -26,7 +26,7 @@ (def .public (random size order gen_value) (All (_ a) (-> Nat (Order a) (Random a) (Random (Set a)))) - (case size + (when size 0 (random#in (/.empty order)) @@ -74,7 +74,7 @@ (/#= setL))) (,, (with_template [<coverage> <comparison>] [(_.coverage [<coverage>] - (case (<coverage> setL) + (when (<coverage> setL) {.#Some value} (|> setL /.list (list.every? (<comparison> value))) diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index 51357230f..22935a5f9 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -45,14 +45,14 @@ (_.coverage [/.empty] (/.empty? /.empty)) (_.coverage [/.value] - (case (/.value sample) + (when (/.value sample) {.#None} (/.empty? sample) {.#Some _} (not (/.empty? sample)))) (_.coverage [/.next] - (case (/.next sample) + (when (/.next sample) {.#None} (/.empty? sample) @@ -61,7 +61,7 @@ sample (/.top top remaining)))) (_.coverage [/.top] - (case (/.next (/.top expected_top sample)) + (when (/.next (/.top expected_top sample)) {.#Some [actual_top actual_sample]} (and (same? expected_top actual_top) (same? sample actual_sample)) diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index 1193c4e9e..8f7ef89da 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -31,7 +31,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index f291a6e51..ff6e1b62f 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -51,20 +51,20 @@ (at ..builder leaf tag_left expected_left) (at ..builder leaf tag_right expected_right)))))) (_.coverage [/.root] - (and (case (/.root (at ..builder leaf tag_left expected_left)) + (and (when (/.root (at ..builder leaf tag_left expected_left)) {.#Left actual} (n.= expected_left actual) {.#Right _} false) - (case (/.root (at ..builder branch + (when (/.root (at ..builder branch (at ..builder leaf tag_left expected_left) (at ..builder leaf tag_right expected_right))) {.#Left _} false {.#Right [left right]} - (case [(/.root left) + (when [(/.root left) (/.root right)] [{.#Left actual_left} {.#Left actual_right}] (and (n.= expected_left actual_left) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index d39552093..0b5dca612 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -54,7 +54,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true @@ -152,7 +152,7 @@ expected_string (random.unicode 1) [boolean_field number_field string_field] (|> (random.set text.hash 3 (random.unicode 3)) (at ! each (|>> set.list - (pipe.case + (pipe.when (list boolean_field number_field string_field) [boolean_field number_field string_field] @@ -312,7 +312,7 @@ (_.coverage [/.Null /.null?] (at bit.equivalence = (/.null? sample) - (case sample + (when sample {/.#Null} true _ false)))) (do random.monad @@ -331,7 +331,7 @@ object (/.object expected)]] (all _.and (_.coverage [/.object /.fields] - (case (/.fields object) + (when (/.fields object) {try.#Success actual} (at (list.equivalence text.equivalence) = (list#each product.left expected) @@ -362,7 +362,7 @@ (try.else false)) cannot_find_unknown_key! - (case (/.field unknown object) + (when (/.field unknown object) {try.#Success _} false diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 1101f9ca1..a858db473 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -47,7 +47,7 @@ /.path_size)] (`` (all _.and (_.coverage [/.path /.from_path] - (case (/.path expected) + (when (/.path expected) {try.#Success actual} (text#= expected (/.from_path actual)) @@ -57,14 +57,14 @@ (_.coverage [/.no_path] (text#= "" (/.from_path /.no_path))) (_.coverage [/.path_size /.path_is_too_long] - (case (/.path invalid) + (when (/.path invalid) {try.#Success _} false {try.#Failure error} (exception.match? /.path_is_too_long error))) (_.coverage [/.not_ascii] - (case (/.path not_ascii) + (when (/.path not_ascii) {try.#Success actual} false @@ -82,7 +82,7 @@ /.name_size)] (`` (all _.and (_.coverage [/.name /.from_name] - (case (/.name expected) + (when (/.name expected) {try.#Success actual} (text#= expected (/.from_name actual)) @@ -90,14 +90,14 @@ {try.#Failure error} false)) (_.coverage [/.name_size /.name_is_too_long] - (case (/.name invalid) + (when (/.name invalid) {try.#Success _} false {try.#Failure error} (exception.match? /.name_is_too_long error))) (_.coverage [/.not_ascii] - (case (/.name not_ascii) + (when (/.name not_ascii) {try.#Success actual} false @@ -113,7 +113,7 @@ invalid (|> random.nat (at ! each (n.max /.small_limit)))] (`` (all _.and (_.coverage [/.small /.from_small] - (case (/.small expected) + (when (/.small expected) {try.#Success actual} (n.= expected (/.from_small actual)) @@ -121,7 +121,7 @@ {try.#Failure error} false)) (_.coverage [/.small_limit /.not_a_small_number] - (case (/.small invalid) + (when (/.small invalid) {try.#Success actual} false @@ -137,7 +137,7 @@ invalid (|> random.nat (at ! each (n.max /.big_limit)))] (`` (all _.and (_.coverage [/.big /.from_big] - (case (/.big expected) + (when (/.big expected) {try.#Success actual} (n.= expected (/.from_big actual)) @@ -145,7 +145,7 @@ {try.#Failure error} false)) (_.coverage [/.big_limit /.not_a_big_number] - (case (/.big invalid) + (when (/.big invalid) {try.#Success actual} false @@ -175,7 +175,7 @@ tar (|> (sequence.sequence {<tag> expected_path}) (\\format.result /.format) (<b>.result /.parser))] - (in (case (sequence.list tar) + (in (when (sequence.list tar) (list {<tag> actual_path}) (text#= (/.from_path expected_path) (/.from_path actual_path)) @@ -204,7 +204,7 @@ expected_content]}) (\\format.result /.format) (<b>.result /.parser))] - (in (case (sequence.list tar) + (in (when (sequence.list tar) (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]}) (let [seconds (is (-> Instant Int) (|>> instant.relative (duration.ticks duration.second)))] @@ -262,7 +262,7 @@ content]}) (\\format.result /.format) (<b>.result /.parser))] - (in (case (sequence.list tar) + (in (when (sequence.list tar) (list {/.#Normal [_ _ actual_mode _ _]}) (n.= (/.mode expected_mode) (/.mode actual_mode)) @@ -285,7 +285,7 @@ content]}) (\\format.result /.format) (<b>.result /.parser))] - (in (case (sequence.list tar) + (in (when (sequence.list tar) (list {/.#Normal [_ _ actual_mode _ _]}) (n.= (/.mode <expected_mode>) (/.mode actual_mode)) @@ -324,14 +324,14 @@ (_.for [/.Ownership /.Owner /.ID] (all _.and (_.coverage [/.name_size /.name_is_too_long] - (case (/.name invalid) + (when (/.name invalid) {try.#Success _} false {try.#Failure error} (exception.match? /.name_is_too_long error))) (_.coverage [/.not_ascii] - (case (/.name not_ascii) + (when (/.name not_ascii) {try.#Success actual} false @@ -352,7 +352,7 @@ content]}) (\\format.result /.format) (<b>.result /.parser))] - (in (case (sequence.list tar) + (in (when (sequence.list tar) (list {/.#Normal [_ _ _ actual_ownership _]}) (and (text#= (/.from_name expected) (/.from_name (the [/.#user /.#name] actual_ownership))) @@ -376,7 +376,7 @@ content]}) (\\format.result /.format) (<b>.result /.parser))] - (in (case (sequence.list tar) + (in (when (sequence.list tar) (list {/.#Normal [_ _ _ actual_ownership _]}) (and (text#= (/.from_name /.anonymous) (/.from_name (the [/.#user /.#name] actual_ownership))) @@ -407,7 +407,7 @@ (try.else false))) (_.coverage [/.invalid_end_of_archive] (let [dump (\\format.result /.format sequence.empty)] - (case (<b>.result /.parser (binary#composite dump dump)) + (when (<b>.result /.parser (binary#composite 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 c4cccc987..44e3c2553 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -35,7 +35,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 11430bb32..b0956f5ba 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -40,13 +40,13 @@ (_.coverage [/.left] (|> (/.left expected) (is (Or Nat Nat)) - (pipe.case + (pipe.when {0 #0 actual} (n.= expected actual) _ false))) (_.coverage [/.right] (|> (/.right expected) (is (Or Nat Nat)) - (pipe.case + (pipe.when {0 #1 actual} (n.= expected actual) _ false))) (_.coverage [/.either] @@ -62,11 +62,11 @@ (and (|> (/.left expected) (is (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) - (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false)) + (pipe.when {0 #0 actual} (n.= (n.+ shift expected) actual) _ false)) (|> (/.right expected) (is (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) - (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false)))) + (pipe.when {0 #1 actual} (n.= (n.- shift expected) actual) _ false)))) (do ! [size (at ! each (n.% 5) random.nat) expected (random.list size random.nat)] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index dca84b015..97fe18d59 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -195,7 +195,7 @@ (do random.monad [sample (random.maybe random.nat)] (_.coverage [\\format.maybe] - (case sample + (when sample {.#None} true @@ -215,7 +215,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true @@ -224,7 +224,7 @@ (def (should_fail' sample parser exception) (All (_ a e) (-> Text (\\parser.Parser a) (Exception e) Bit)) - (case (\\parser.result parser sample) + (when (\\parser.result parser sample) {try.#Failure error} (exception.match? exception error) @@ -233,7 +233,7 @@ (def (should_fail sample parser) (All (_ a) (-> Text (\\parser.Parser a) Bit)) - (case (\\parser.result parser sample) + (when (\\parser.result parser sample) {try.#Failure _} true @@ -259,7 +259,7 @@ range (at ! each (|>> (nat.% 50) (nat.+ 10)) random.nat) .let [limit (nat.+ offset range)] expected (at ! each (|>> (nat.% range) (nat.+ offset) /.of_char) random.nat) - out_of_range (case offset + out_of_range (when offset 0 (at ! each (|>> (nat.% 10) ++ (nat.+ limit) /.of_char) random.nat) _ (at ! each (|>> (nat.% offset) /.of_char) random.nat))] (_.coverage [\\parser.range] @@ -745,9 +745,9 @@ .let [sample (|> characters set.list /.together)] expected (at ! each (nat.% size) random.nat)] (_.coverage [/.char] - (case (/.char expected sample) + (when (/.char expected sample) {.#Some char} - (case (/.index (/.of_char char) sample) + (when (/.index (/.of_char char) sample) {.#Some actual} (nat.= expected actual) @@ -803,7 +803,7 @@ (at /.monoid composite post static) (/.replaced_once pre post (at /.monoid composite pre static)))) (_.coverage [/.split_by] - (case (/.split_by static (all (at /.monoid composite) pre static post)) + (when (/.split_by static (all (at /.monoid composite) pre static post)) {.#Some [left right]} (and (at /.equivalence = pre left) (at /.equivalence = post right)) @@ -883,7 +883,7 @@ (all _.and (_.coverage [/.split_at] (|> (/.split_at sizeL sample) - (pipe.case + (pipe.when {.#Right [_l _r]} (and (/#= sampleL _l) (/#= sampleR _r) @@ -896,7 +896,7 @@ (/.clip sizeL (nat.- sizeL (/.size sample)) sample) (/.clip_since sizeL sample) (/.clip_since 0 sample)] - (pipe.case + (pipe.when [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}] (and (/#= sampleL _l) (/#= sampleR _r) diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 1ac4b1904..554aaa16f 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -107,7 +107,7 @@ (if (or (/.escapable? left) (/.escapable? right)) (let [escaped (/.escaped expected)] - (case (/.un_escaped escaped) + (when (/.un_escaped escaped) {try.#Success un_escaped} (and (not (text#= escaped expected)) (text#= un_escaped expected)) @@ -119,7 +119,7 @@ [dummy (|> (random.char unicode.character) (at ! each text.of_char))] (_.coverage [/.dangling_escape] - (case (/.un_escaped (format (/.escaped dummy) "\")) + (when (/.un_escaped (format (/.escaped dummy) "\")) {try.#Success _} false @@ -130,7 +130,7 @@ (random.only (|>> (set.member? ..valid_sigils) not)) (at ! each text.of_char))] (_.coverage [/.invalid_escape] - (case (/.un_escaped (format "\" dummy)) + (when (/.un_escaped (format "\" dummy)) {try.#Success _} false @@ -141,12 +141,12 @@ (at ! each (n.% (hex "1000")))) code (|> (random.unicode 4) (random.only (function (_ code) - (case (at n.hex decoded code) + (when (at n.hex decoded code) {try.#Failure error} true {try.#Success _} false))))] (_.coverage [/.invalid_unicode_escape] (template.let [(!invalid <code>) - [(case (/.un_escaped (format "\u" <code>)) + [(when (/.un_escaped (format "\u" <code>)) {try.#Success _} false diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index d5be70ce1..1b1b8ec95 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -28,7 +28,7 @@ (-> (Parser Text) Text Bit) (|> input (<text>.result regex) - (pipe.case + (pipe.when {try.#Success parsed} (text#= parsed input) @@ -39,7 +39,7 @@ (-> Text (Parser Text) Text Bit) (|> input (<text>.result regex) - (pipe.case + (pipe.when {try.#Success parsed} (text#= test parsed) @@ -50,7 +50,7 @@ (All (_ a) (-> (Parser a) Text Bit)) (|> input (<text>.result regex) - (pipe.case + (pipe.when {try.#Failure _} true @@ -64,7 +64,7 @@ (macro.with_symbols [g!message g!_] (in (list (` (|> (, input) (<text>.result (, regex)) - (pipe.case + (pipe.when {try.#Success (, pattern)} true @@ -282,7 +282,7 @@ (def expands? (syntax (_ [form <code>.any]) (function (_ lux) - {try.#Success [lux (list (code.bit (case (expansion.single form lux) + {try.#Success [lux (list (code.bit (when (expansion.single form lux) {try.#Success _} true @@ -310,7 +310,7 @@ sample2 (random.unicode 3) sample3 (random.unicode 4)] (_.coverage [/.pattern] - (case (format sample1 "-" sample2 "-" sample3) + (when (format sample1 "-" sample2 "-" sample3) (/.pattern "(.{3})-(.{3})-(.{4})" [_ match1 match2 match3]) (and (text#= sample1 match1) diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 6332cfa59..1612f17b4 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -78,7 +78,7 @@ [sample_bit random.bit sample_int random.int sample_frac random.frac] - (in (`` (and (case (/.representation (type_literal [Bit Int Frac]) + (in (`` (and (when (/.representation (type_literal [Bit Int Frac]) [sample_bit sample_int sample_frac]) {try.#Success actual} (text#= (format "[" (%.bit sample_bit) @@ -186,7 +186,7 @@ )) ))) (_.coverage [/.cannot_represent_value] - (case (/.representation (-> Nat Nat) (|>>)) + (when (/.representation (-> Nat Nat) (|>>)) {try.#Success representation} false @@ -221,7 +221,7 @@ (def macro_error (syntax (_ [macro <code>.any]) (function (_ compiler) - (case ((expansion.complete macro) compiler) + (when ((expansion.complete macro) compiler) {try.#Failure error} {try.#Success [compiler (list (code.text error))]} diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 2d162fb2a..f691453e1 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -25,7 +25,7 @@ (def macro_error (syntax (_ [macro <code>.any]) (function (_ compiler) - {try.#Success [compiler (list (code.bit (case ((expansion.complete macro) compiler) + {try.#Success [compiler (list (code.bit (when ((expansion.complete macro) compiler) {try.#Failure error} true diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 5b3e2bb80..d7d05321d 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -78,7 +78,7 @@ (function (_ lux) (|> (expansion.single expression) (meta.result lux) - (pipe.case + (pipe.when {try.#Success expansion} {try.#Failure "OOPS!"} @@ -169,10 +169,10 @@ bit/0 random.bit] (all _.and (_.coverage [/.as] - (and (case (/.as java/lang/String sample) {.#Some _} true {.#None} false) - (case (/.as java/lang/Long sample) {.#Some _} false {.#None} true) - (case (/.as java/lang/Object sample) {.#Some _} true {.#None} false) - (case (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true))) + (and (when (/.as java/lang/String sample) {.#Some _} true {.#None} false) + (when (/.as java/lang/Long sample) {.#Some _} false {.#None} true) + (when (/.as java/lang/Object sample) {.#Some _} true {.#None} false) + (when (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true))) (_.coverage [/.synchronized] (/.synchronized sample true)) (_.coverage [/.class_for] @@ -183,7 +183,7 @@ (_.coverage [/.???] (and (|> (/.??? (/.null)) (is (Maybe java/lang/Object)) - (pipe.case + (pipe.when {.#None} true @@ -191,7 +191,7 @@ false)) (|> (/.??? sample) (is (Maybe java/lang/Object)) - (pipe.case + (pipe.when {.#Some _} true @@ -331,14 +331,14 @@ (/.as_long (.int expected)) (panic! "YOLO")))) example/1! - (and (case (test/TestInterface1::actual1 (/.as_boolean false) object/1) + (and (when (test/TestInterface1::actual1 (/.as_boolean false) object/1) {try.#Success actual} (same? (is Any expected) (is Any actual)) {try.#Failure error} false) - (case (test/TestInterface1::actual1 (/.as_boolean true) object/1) + (when (test/TestInterface1::actual1 (/.as_boolean true) object/1) {try.#Success actual} false @@ -572,14 +572,14 @@ object/1 (test/TestClass1::new (/.as_long (.int expected))) example/1! - (and (case (test/TestInterface1::actual1 (/.as_boolean false) object/1) + (and (when (test/TestInterface1::actual1 (/.as_boolean false) object/1) {try.#Success actual} (n.= expected (.nat (/.of_long actual))) {try.#Failure error} false) - (case (test/TestInterface1::actual1 (/.as_boolean true) object/1) + (when (test/TestInterface1::actual1 (/.as_boolean true) object/1) {try.#Success actual} false @@ -680,7 +680,7 @@ (function (_ lux) (|> (expansion.single expression) (meta.result lux) - (pipe.case + (pipe.when {try.#Success expansion} true @@ -720,7 +720,7 @@ (try.else false)) (|> (list (code.local var/2)) (<code>.result type_variable) - (pipe.case + (pipe.when {try.#Failure error} (exception.match? /.unknown_type_variable error) diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index a3a036d34..d2d81a6b3 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -58,7 +58,7 @@ (is (Ex (_ a) (/.Object a)))) true)) (_.coverage [/.import] - (case (io.run! (..os/getenv string)) + (when (io.run! (..os/getenv string)) {.#Some _} true {.#None} true)) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index ce7164514..5feb469ec 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -184,14 +184,14 @@ (not (/.null? sample)))) (_.coverage [/.???] (and (|> (is (Maybe java/lang/Object) (/.??? (/.null))) - (pipe.case + (pipe.when {.#None} true _ false)) (|> (is (Maybe java/lang/Object) (/.??? sample)) - (pipe.case + (pipe.when {.#Some _} true @@ -210,10 +210,10 @@ increase random.int] (all _.and (_.coverage [/.as] - (and (case (/.as java/lang/String sample) {.#Some _} true {.#None} false) - (case (/.as java/lang/Long sample) {.#Some _} false {.#None} true) - (case (/.as java/lang/Object sample) {.#Some _} true {.#None} false) - (case (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true))) + (and (when (/.as java/lang/String sample) {.#Some _} true {.#None} false) + (when (/.as java/lang/Long sample) {.#Some _} false {.#None} true) + (when (/.as java/lang/Object sample) {.#Some _} true {.#None} false) + (when (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true))) (_.coverage [/.synchronized] (/.synchronized sample true)) (_.coverage [/.class_for /.import] diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index dd2f7d00a..345578ead 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -92,7 +92,7 @@ (random.set r.hash 4) (at ! each (|>> set.list (list.sorted r.<))) (random.one (function (_ thresholds) - (case thresholds + (when thresholds (list threshold_0 threshold_1 threshold_2 threshold_3) {.#Some [threshold_0 threshold_1 threshold_2 threshold_3]} @@ -176,7 +176,7 @@ (random.set r.hash 4) (at ! each (|>> set.list (list.sorted r.<))) (random.one (function (_ thresholds) - (case thresholds + (when thresholds (list threshold_0 threshold_1 threshold_2 threshold_3) {.#Some [threshold_0 threshold_1 threshold_2 threshold_3]} diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 2e959b428..44610bd3c 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -66,7 +66,7 @@ ($codec.spec /.equivalence (/.codec subject::%) (..random subject::%))) (_.coverage [/.incorrect_modulus] - (case (|> param + (when (|> param (at (/.codec param::%) encoded) (at (/.codec subject::%) decoded)) {try.#Failure error} @@ -98,7 +98,7 @@ (let [one (/.modular (/.modulus subject) +1) co_prime? (i.co_prime? (//.divisor (/.modulus subject)) (/.value subject))] - (case (/.inverse subject) + (when (/.inverse subject) {.#Some subject^-1} (and co_prime? (|> subject @@ -118,7 +118,7 @@ adapt (/.= subject)))))) (_.coverage [/.moduli_are_not_equal] - (case (/.adapter subject::% param::%) + (when (/.adapter subject::% param::%) {try.#Failure error} (exception.match? /.moduli_are_not_equal error) diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index c1f61a289..49c406b9b 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -23,7 +23,7 @@ (syntax (_ []) (do meta.monad [divisor meta.seed] - (in (list (code.int (case divisor + (in (list (code.int (when divisor 0 +1 _ (.int divisor)))))))) @@ -43,14 +43,14 @@ dividend random.int] (all _.and (_.coverage [/.modulus /.divisor] - (case (/.modulus divisor) + (when (/.modulus divisor) {try.#Success modulus} (i.= divisor (/.divisor modulus)) {try.#Failure error} (i.= +0 divisor))) (_.coverage [/.zero_cannot_be_a_modulus] - (case (/.modulus +0) + (when (/.modulus +0) {try.#Failure error} (exception.match? /.zero_cannot_be_a_modulus error) diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux index d5d9fb557..536448d48 100644 --- a/stdlib/source/test/lux/math/number.lux +++ b/stdlib/source/test/lux/math/number.lux @@ -35,7 +35,7 @@ (all _.and (_.coverage [/.bin] (`` (and (,, (with_template [<=> <codec> <number>] - [(case (at <codec> decoded (..clean_commas <number>)) + [(when (at <codec> decoded (..clean_commas <number>)) {try.#Success actual} (<=> (/.bin <number>) actual) @@ -54,7 +54,7 @@ ))))) (_.coverage [/.oct] (`` (and (,, (with_template [<=> <codec> <number>] - [(case (at <codec> decoded (..clean_commas <number>)) + [(when (at <codec> decoded (..clean_commas <number>)) {try.#Success actual} (<=> (/.oct <number>) actual) @@ -73,7 +73,7 @@ ))))) (_.coverage [/.hex] (`` (and (,, (with_template [<=> <codec> <number>] - [(case (at <codec> decoded (..clean_commas <number>)) + [(when (at <codec> decoded (..clean_commas <number>)) {try.#Success actual} (<=> (/.hex <number>) actual) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 6b4081342..025c41346 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -103,7 +103,7 @@ .let [spare (n.- size /.width)] offset (at ! each (n.% spare) random.nat)] (_.coverage [/.region] - (case size + (when size 0 (/#= /.false (/.region offset size)) _ (/#= (|> pattern ... NNNNYYYYNNNN @@ -124,7 +124,7 @@ (_.for [/.Sub] (do [! random.monad] [size (at ! each (n.% /.width) random.nat)] - (case (/.sub size) + (when (/.sub size) {.#None} (_.coverage [/.sub] (n.= 0 size)) diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index b81cc91c6..74c9a9ca7 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -79,7 +79,7 @@ (maybe.else false)) with_denominator! - (case (/.nat (/.ratio numerator denominator)) + (when (/.nat (/.ratio numerator denominator)) {.#Some factor} (and (n.= 0 (n.% denominator numerator)) (n.= numerator (n.* factor denominator))) @@ -111,7 +111,7 @@ div (|> right (/.- rem) (/./ left))] (and (/.= right (|> div (/.* left) (/.+ rem))) - (case (/.nat div) + (when (/.nat div) {.#Some _} true {.#None} false))))) (do random.monad diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 98081de7f..fa3fd7f7a 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -77,7 +77,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true _ false)])) @@ -432,7 +432,7 @@ (list [expected_short {.#Alias [expected_macro_module expected_short]}])) macro_globals (is (List [Text .Global]) - (case def_type + (when def_type {.#Some def_type} (list [expected_short {.#Definition [exported? def_type expected_value]}]) @@ -548,7 +548,7 @@ (list [expected_short {.#Alias [expected_macro_module expected_short]}])) macro_globals (is (List [Text .Global]) - (case def_type + (when def_type {.#Some def_type} (list [expected_short {.#Definition [exported? def_type expected_value]}]) @@ -846,7 +846,7 @@ (random.set text.hash 5) (at ! each set.list) (random.one (function (_ values) - (case values + (when values (list name_0 name_1 name_2 name_3 name_4) {.#Some [name_0 name_1 name_2 name_3 name_4]} @@ -971,7 +971,7 @@ (def (comparison init) (-> Lux (Comparison Meta)) (function (_ == left right) - (case [(/.result init left) + (when [(/.result init left) (/.result init right)] [{try.#Success left} {try.#Success right}] (== left right) diff --git a/stdlib/source/test/lux/meta/code.lux b/stdlib/source/test/lux/meta/code.lux index 80c1bbe65..7e35b1c9f 100644 --- a/stdlib/source/test/lux/meta/code.lux +++ b/stdlib/source/test/lux/meta/code.lux @@ -39,7 +39,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true @@ -207,7 +207,7 @@ (text.size source_code)) start (is Source [location.dummy 0 source_code])] - (case (parse start) + (when (parse start) {.#Left [end error]} {try.#Failure error} @@ -250,7 +250,7 @@ [(do [! random.monad] [expected <random>] (_.coverage [<coverage>] - (and (case (..read (/.format (<coverage> expected))) + (and (when (..read (/.format (<coverage> expected))) {try.#Success actual} (at /.equivalence = actual @@ -276,7 +276,7 @@ [(do [! random.monad] [expected <random>] (_.coverage [<coverage>] - (and (case (..read (/.format (<coverage> expected))) + (and (when (..read (/.format (<coverage> expected))) {try.#Success actual} (at /.equivalence = actual diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux index 4fdb983a1..69e3885f8 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux @@ -67,7 +67,7 @@ (def !expect (template (_ <expectation> <computation>) - [(case <computation> + [(when <computation> <expectation> true @@ -91,7 +91,7 @@ (_.coverage [\\parser.result \\parser.any] (|> (list expected) (\\parser.result \\parser.any) - (pipe.case + (pipe.when {try.#Success actual} (at /.equivalence = expected actual) @@ -103,7 +103,7 @@ (_.coverage [<query>] (|> (list (<analysis> expected)) (\\parser.result <query>) - (pipe.case + (pipe.when {try.#Success actual} (<=> expected actual) @@ -131,7 +131,7 @@ (_.coverage [\\parser.tuple] (|> (list (/.tuple (list (/.bit expected)))) (\\parser.result (\\parser.tuple \\parser.bit)) - (pipe.case + (pipe.when {try.#Success actual} (bit#= expected actual) @@ -160,7 +160,7 @@ (_.coverage [\\parser.cannot_parse] (and (|> (list (/.bit expected)) (\\parser.result \\parser.nat) - (pipe.case + (pipe.when {try.#Success _} false @@ -168,7 +168,7 @@ (exception.match? \\parser.cannot_parse error))) (|> (list) (\\parser.result \\parser.bit) - (pipe.case + (pipe.when {try.#Success _} false @@ -179,7 +179,7 @@ (_.coverage [\\parser.unconsumed_input] (|> (list (/.bit expected) (/.bit expected)) (\\parser.result \\parser.bit) - (pipe.case + (pipe.when {try.#Success _} false @@ -205,7 +205,7 @@ (-> Nat (Random /.Analysis)) (<| random.rec (function (_ random)) - (let [random|case (all random.and + (let [random|when (all random.and random (..random_match multiplicity random) ) @@ -225,7 +225,7 @@ /simple.random (/complex.random multiplicity random) /reference.random - random|case + random|when random|function random|apply random|extension @@ -242,7 +242,7 @@ text (random.lower_case 1)] (`` (all _.and (_.coverage [/.unit] - (case (/.unit) + (when (/.unit) (/.unit) true @@ -250,7 +250,7 @@ false)) (,, (with_template [<tag> <expected>] [(_.coverage [<tag>] - (case (<tag> <expected>) + (when (<tag> <expected>) (<tag> actual) (same? <expected> actual) @@ -277,7 +277,7 @@ (let [expected (if expected_right? expected_right expected_left)] - (case (/.variant [expected_lefts expected_right? expected]) + (when (/.variant [expected_lefts expected_right? expected]) (/.variant [actual_lefts actual_right? actual]) (and (same? expected_lefts actual_lefts) (same? expected_right? actual_right?) @@ -286,7 +286,7 @@ _ false))) (_.coverage [/.tuple] - (case (/.tuple (list expected_left expected_right)) + (when (/.tuple (list expected_left expected_right)) (/.tuple (list actual_left actual_right)) (and (same? expected_left actual_left) (same? expected_right actual_right)) @@ -304,7 +304,7 @@ (`` (all _.and (,, (with_template [<tag> <expected>] [(_.coverage [<tag>] - (case (<tag> <expected>) + (when (<tag> <expected>) (<tag> actual) (same? <expected> actual) @@ -320,7 +320,7 @@ (def tagged? (template (_ <tag> <it>) - [(case <it> + [(when <it> {<tag> _} true @@ -336,7 +336,7 @@ expected_parameter/1 (..random 2)] (all _.and (_.coverage [/.reified /.reification] - (case (|> [expected_abstraction (list expected_parameter/0 expected_parameter/1)] + (when (|> [expected_abstraction (list expected_parameter/0 expected_parameter/1)] /.reified /.reification) [actual_abstraction (list actual_parameter/0 actual_parameter/1)] @@ -347,7 +347,7 @@ _ false)) (_.coverage [/.no_op] - (case (/.no_op expected_parameter/0) + (when (/.no_op expected_parameter/0) (/.no_op actual) (same? expected_parameter/0 actual) @@ -355,15 +355,15 @@ false)) ))) -(def test|case +(def test|when Test (do random.monad [expected_input (..random 2) expected_match (random_match 2 (..random 2))] (all _.and - (_.coverage [/.case] - (case (/.case [expected_input expected_match]) - (/.case [actual_input actual_match]) + (_.coverage [/.when] + (when (/.when [expected_input expected_match]) + (/.when [actual_input actual_match]) (and (same? expected_input actual_input) (same? expected_match actual_match)) @@ -405,7 +405,7 @@ (|> (/.failure expected_error) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (pipe.case + (pipe.when {try.#Failure actual_error} (and (text.contains? expected_error actual_error) (text.contains? (location.format location/0) actual_error)) @@ -416,7 +416,7 @@ (|> (/.except <exception> []) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (pipe.case + (pipe.when {try.#Failure actual_error} (and (text.contains? (exception.error <exception> []) actual_error) (text.contains? (location.format location/0) actual_error)) @@ -428,7 +428,7 @@ (/.with_exception <exception> []) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (pipe.case + (pipe.when {try.#Failure actual_error} (and (text.contains? expected_error actual_error) (text.contains? (exception.error <exception> []) actual_error) @@ -440,7 +440,7 @@ (and (|> (/.assertion <exception> [] false) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (pipe.case + (pipe.when {try.#Failure actual_error} (and (text.contains? (exception.error <exception> []) actual_error) (text.contains? (location.format location/0) actual_error)) @@ -450,7 +450,7 @@ (|> (/.assertion <exception> [] true) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (pipe.case + (pipe.when {try.#Success _} true @@ -496,7 +496,7 @@ (list.empty? (the .#modules it)) (list.empty? (the .#scopes it)) (list.empty? (the [.#type_context .#var_bindings] it)) - (case (the .#source it) + (when (the .#source it) [location 0 ""] (same? location.dummy location) @@ -508,7 +508,7 @@ (extension.read (|>> (the .#current_module) (maybe.else "")))) (phase.result [extension.#bundle extension.empty extension.#state state]) - (pipe.case + (pipe.when {try.#Success actual} (same? expected_module actual) @@ -535,7 +535,7 @@ (extension.read (the .#location))) (phase.result [extension.#bundle extension.empty extension.#state state]) - (pipe.case + (pipe.when {try.#Success actual} (same? expected actual) @@ -564,7 +564,7 @@ (extension.read (the .#source))) (phase.result [extension.#bundle extension.empty extension.#state state]) - (pipe.case + (pipe.when {try.#Success actual} (same? expected actual) @@ -605,7 +605,7 @@ (_.for [/.Reification] ..test|reification) (_.for [/.Branch /.Branch' /.Match /.Match'] - ..test|case) + ..test|when) (_.for [/.Operation /.Phase /.Handler /.Bundle] ..test|phase) (_.for [/.State+] diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux index 7272d6c98..0268893df 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux @@ -60,11 +60,11 @@ (all random.and (random.maybe (random#in ..spread)) (do [! random.monad] - [cases ..random_tag - cases (random.set n.hash cases ..random_tag)] - (|> cases + [whens ..random_tag + whens (random.set n.hash whens ..random_tag)] + (|> whens set.list - (monad.each ! (function (_ case) (at ! each (|>> [case]) again))) + (monad.each ! (function (_ when) (at ! each (|>> [when]) again))) (at ! each (dictionary.of_list n.hash)))) ) (random.and again again) @@ -121,7 +121,7 @@ (in [(|> coverages (list.only (|>> /.exhaustive? not)) list.reversed - (pipe.case + (pipe.when {.#End} {/.#Exhaustive} @@ -140,7 +140,7 @@ (def (failure? exception it) (All (_ a) (-> (Exception a) (Try /.Coverage) Bit)) - (case it + (when it {try.#Failure error} (exception.match? exception error) @@ -212,22 +212,22 @@ .let [random_tag (random#each (n.% expected_maximum) random.nat)] tag/0 random_tag tag/1 (random.only (|>> (n.= tag/0) not) random_tag) - .let [cases (dictionary.of_list n.hash (list [tag/0 expected/0] + .let [whens (dictionary.of_list n.hash (list [tag/0 expected/0] [tag/1 expected/1])) expected_minimum (++ (n.max tag/0 tag/1))]] (all _.and (_.coverage [/.minimum] - (and (n.= expected_minimum (/.minimum [{.#None} cases])) - (n.= expected_maximum (/.minimum [{.#Some expected_maximum} cases])))) + (and (n.= expected_minimum (/.minimum [{.#None} whens])) + (n.= expected_maximum (/.minimum [{.#Some expected_maximum} whens])))) (_.coverage [/.maximum] - (and (n.= n#top (/.maximum [{.#None} cases])) - (n.= expected_maximum (/.maximum [{.#Some expected_maximum} cases])))) + (and (n.= n#top (/.maximum [{.#None} whens])) + (n.= expected_maximum (/.maximum [{.#Some expected_maximum} whens])))) )))) (def random_value_pattern (Random [/.Coverage Pattern]) (random.only (function (_ [coverage pattern]) - (case coverage + (when coverage (^.or {/.#Alt _} {/.#Seq _}) false @@ -245,7 +245,7 @@ [expected/2 pattern/2] (random.only (all predicate.and (|>> product.left (/#= expected/0) not) (|>> product.left (/#= expected/1) not) - (|>> product.left (pipe.case {/.#Variant _} false _ true))) + (|>> product.left (pipe.when {/.#Variant _} false _ true))) ..random_value_pattern) bit random.bit diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux index 127af213b..9fa7c48ba 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux @@ -75,7 +75,7 @@ (def (fails? exception try) (All (_ e a) (-> (Exception e) (Try a) Bit)) - (case try + (when try {try.#Success _} false @@ -239,7 +239,7 @@ [inferT (/.variant lefts right? variant) [_ [it _]] (|> (/.general archive.empty ..analysis inferT (list term)) //type.inferring)] - (case inferred + (when inferred {.#Some inferred} (//type.check (do check.monad @@ -339,7 +339,7 @@ [inference (/.record arity record) [_ [it _]] (|> (/.general archive.empty ..analysis inference terms) //type.inferring)] - (case expected + (when expected {.#Some expected} (//type.check (do check.monad diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux index 2d29df1d8..8c93097e9 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux @@ -65,7 +65,7 @@ .let [singular (<| (as Macro) (is Macro') (function (_ inputs state) - (case (list.item choice inputs) + (when (list.item choice inputs) {.#Some it} {try.#Success [state (list it)]} @@ -87,7 +87,7 @@ (_.coverage [/.expansion_failed] (|> (/.expansion ..expander name singular (list)) (meta.result lux) - (pipe.case + (pipe.when {try.#Failure it} (and (text.contains? expected_error it) (text.contains? (the exception.#label /.expansion_failed) it)) @@ -102,7 +102,7 @@ (_.coverage [/.must_have_single_expansion] (|> (/.single_expansion ..expander name multiple (list mono)) (meta.result lux) - (pipe.case + (pipe.when {try.#Failure it} (text.contains? (the exception.#label /.must_have_single_expansion) it) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux index 4bb9269cf..58a2e03fa 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux @@ -51,7 +51,7 @@ (list.empty? (the .#module_aliases it)) (list.empty? (the .#definitions it)) (list.empty? (the .#imports it)) - (case (the .#module_state it) + (when (the .#module_state it) {.#Active} true @@ -122,7 +122,7 @@ (in it)) (/phase.result state) (try#each (|>> (the .#module_aliases) - (pipe.case + (pipe.when (list [actual_alias actual_import]) (and (same? expected_alias actual_alias) (same? expected_import actual_import)) @@ -166,7 +166,7 @@ [_ (<pre> name)] (<post> name))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false @@ -184,7 +184,7 @@ (and (,, (with_template [<set>] [(|> (<set> name) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false @@ -225,7 +225,7 @@ [(|> (/.with hash module_name (/.define def_name <global>)) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure _} false))] @@ -239,7 +239,7 @@ [_ (/.define def_name definition)] (/.define alias_name alias))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure _} false))))) (_.coverage [/.cannot_define_more_than_once] @@ -249,7 +249,7 @@ [_ (/.define def_name <global>)] (/.define def_name <global>))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false {try.#Failure _} true))] @@ -264,7 +264,7 @@ _ (/.define alias_name alias)] (/.define alias_name alias))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false {try.#Failure _} true))))) ))) @@ -299,7 +299,7 @@ (monad.each ! (|>> [module_name] <query> /extension.lifted) (list.partial labels|head labels|tail)))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} <on_success> {try.#Failure _} (not <on_success>)))] @@ -315,7 +315,7 @@ _ (/.define def_name {.#Type [public? it {<side> [labels|head labels|tail]}]})] (/.declare_labels <record?> (list.partial labels|head labels|tail) public? it))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false @@ -332,7 +332,7 @@ _ (/.define def_name {.#Type [public? it {<side> [labels|head labels|tail]}]})] (/.declare_labels <record?> (list.partial labels|head labels|tail) public? it))) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux index 74faec932..a228e3fd3 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux @@ -56,7 +56,7 @@ (bit#= (at /.equivalence = left right) (text#= (/.format left) (/.format right)))) (_.coverage [/.unit] - (case (/.unit) + (when (/.unit) (/.unit) true @@ -64,7 +64,7 @@ false)) (,, (with_template [<tag> <value>] [(_.coverage [<tag>] - (case (<tag> <value>) + (when (<tag> <value>) (<tag> actual) (same? <value> actual) @@ -80,7 +80,7 @@ [/.text expected_text] )) (_.coverage [/.variant] - (case (/.variant [expected_lefts expected_right? (/.text expected_text)]) + (when (/.variant [expected_lefts expected_right? (/.text expected_text)]) (/.variant [actual_lefts actual_right? (/.text actual_text)]) (and (same? expected_lefts actual_lefts) (same? expected_right? actual_right?) @@ -89,7 +89,7 @@ _ false)) (_.coverage [/.tuple] - (case (/.tuple (list (/.bit expected_bit) + (when (/.tuple (list (/.bit expected_bit) (/.nat expected_nat) (/.int expected_int) (/.rev expected_rev) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux index bc2c63519..fe46fa6ae 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux @@ -38,7 +38,7 @@ [(def (<name> expected_type expected_register [actual_type actual_var]) (-> Type Register [Type Variable] Bit) (and (same? expected_type actual_type) - (case actual_var + (when actual_var {<tag> actual_register} (n.= expected_register actual_register) @@ -66,7 +66,7 @@ /.with (//phase.result state) (try#each (|>> product.right - (pipe.case + (pipe.when {.#None} true {.#Some _} false))) (try.else false))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux index 8afc7c8fc..c360ea593 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux @@ -59,7 +59,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure _} false)) (|> (/.inference dummy) @@ -67,7 +67,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false {try.#Failure _} true)) (|> (/.inference expected) @@ -75,7 +75,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false {try.#Failure _} true)))) (_.coverage [/.inferring] @@ -96,7 +96,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure _} false))) (_.coverage [/.existential /.existential?] @@ -117,7 +117,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure _} false)) (|> (do /phase.monad @@ -130,7 +130,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (pipe.case + (pipe.when {try.#Success _} false {try.#Failure _} true)))) )))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux index 7595b7a87..06fc6be98 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux @@ -46,7 +46,7 @@ ["[1][0]" complex] ["[1][0]" reference] ["[1][0]" function] - ["[1][0]" case]]) + ["[1][0]" when]]) (def (eval archive type term) Eval @@ -65,7 +65,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Any :it:) - (case it + (when it (//.unit) true @@ -88,7 +88,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= <type> :it:) - (case it + (when it (<analysis> it) (same? <expected> it) @@ -129,7 +129,7 @@ [it (|> (code.variant (list (code.nat 0) (code.bit false) (` []))) (/.phase ..expander archive.empty) (//type.expecting :variant:))] - (in (case it + (in (when it (//.variant [0 .false (//.unit)]) true @@ -145,7 +145,7 @@ [it (|> (code.variant (list (code.nat <lefts>) (code.bit <right>) (<code> <expected>))) (/.phase ..expander archive.empty) (//type.expecting :variant:))] - (in (case it + (in (when it (//.variant [<lefts> <right> (<analysis> actual)]) (same? <expected> actual) @@ -171,7 +171,7 @@ it (|> (code.variant (list (code.nat 0) (code.bit false))) (/.phase ..expander archive.empty) (//type.expecting :either:))] - (in (case it + (in (when it (//.variant [0 .false (//.unit)]) true @@ -197,7 +197,7 @@ (code.text text/0))) (/.phase ..expander archive.empty) (//type.expecting :either:))] - (in (case it + (in (when it (//.variant [0 #1 (//.tuple (list (//.unit) (//.bit bit/?) (//.nat nat/?) @@ -243,7 +243,7 @@ //type.inferring)] (in (and (type#= :variant: :it:) - (case it + (when it (//.variant [0 .false (//.unit)]) true @@ -262,7 +262,7 @@ //type.inferring)] (in (and (type#= :variant: :it:) - (case it + (when it (//.variant [<lefts> <right> (<analysis> actual)]) (same? <expected> actual) @@ -293,7 +293,7 @@ //type.inferring)] (in (and (type#= :either: :it:) - (case it + (when it (//.variant [0 .false (//.unit)]) true @@ -323,7 +323,7 @@ //type.inferring)] (in (and (type#= :either: :it:) - (case it + (when it (//.variant [0 #1 (//.tuple (list (//.unit) (//.bit bit/?) (//.nat nat/?) @@ -365,7 +365,7 @@ //type.inferring)] (in (and (type#= (type_literal [.Any .Bit .Nat .Int .Rev .Frac .Text]) :it:) - (case it + (when it (//.tuple (list (//.unit) (//.bit bit/?) (//.nat nat/?) @@ -408,7 +408,7 @@ //type.inferring)] (in (and (type#= :record: :it:) - (case it + (when it (//.tuple (list (//.unit) (//.bit bit/?) (//.nat nat/?) @@ -443,7 +443,7 @@ //type.inferring)] (in (and (type#= (All (_ a) (-> a .Nat)) :it:) - (case it + (when it {//.#Function (list) (//.nat nat/?)} (same? nat/0 nat/?) @@ -464,7 +464,7 @@ //type.inferring)] (in (and (type#= (All (_ a) (-> a (All (_ b) (-> b .Nat)))) :it:) - (case it + (when it {//.#Function (list) {//.#Function (list) (//.nat nat/?)}} (same? nat/0 nat/?) @@ -485,7 +485,7 @@ //type.inferring)] (in (and (type#= (All (_ a) (-> a (All (_ b) (-> b b)))) :it:) - (case it + (when it {//.#Function (list) {//.#Function (list) (//.local 1)}} true @@ -504,7 +504,7 @@ (, $parameter/0)))) (/.phase ..expander archive.empty) //type.inferring)] - (in (and (case it + (in (and (when it {//.#Function (list) {//.#Function (list (//.local 1)) (//.foreign 0)}} true @@ -530,7 +530,7 @@ ... (, $abstraction/1)))) ... (/.phase ..expander archive.empty) ... //type.inferring)] - ... (in (case it + ... (in (when it ... {//.#Function (list) {//.#Function (list) (//.local 0)}} ... true @@ -548,7 +548,7 @@ ... (, $abstraction/0)))) ... (/.phase ..expander archive.empty) ... //type.inferring)] - ... (in (case it + ... (in (when it ... {//.#Function (list) {//.#Function (list (//.local 0)) (//.foreign 0)}} ... true @@ -573,7 +573,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Bit :it:) - (case it + (when it {//.#Apply (//.nat nat/?) {//.#Function (list) (//.bit bit/?)}} (and (same? bit/0 bit/?) @@ -594,7 +594,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Nat :it:) - (case it + (when it {//.#Apply (//.nat nat/?) {//.#Function (list) (//.local 1)}} (same? nat/0 nat/?) @@ -616,7 +616,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (check.subsumes? (All (_ a) (-> a Bit)) :it:) - (case it + (when it {//.#Apply (//.nat nat/?) {//.#Function (list) {//.#Function (list) (//.bit bit/?)}}} @@ -643,7 +643,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Text :it:) - (case it + (when it {//.#Extension "lux text concat" (list (//.text left) (//.text right))} (and (same? text/0 left) (same? text/0 right)) @@ -676,8 +676,8 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Frac :it:) - (case it - {//.#Case (<analysis> input/?) + (when it + {//.#When (<analysis> input/?) [[//.#when (//pattern.bind 0) //.#then (//.frac frac/?)] (list)]} @@ -701,8 +701,8 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Frac :it:) - (case it - {//.#Case (<analysis> input/?) + (when it + {//.#When (<analysis> input/?) [[//.#when (<pattern> pattern/?) //.#then (//.frac frac/?)] (list [//.#when (//pattern.bind 0) @@ -738,8 +738,8 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Frac :it:) - (case it - {//.#Case (//.bit bit/?) + (when it + {//.#When (//.bit bit/?) [[//.#when (//pattern.bit .false) //.#then (//.frac false/?)] (list [//.#when (//pattern.bit .true) @@ -769,8 +769,8 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Frac :it:) - (case it - {//.#Case (//.variant [<lefts> <right?> (<analysis> analysis/?)]) + (when it + {//.#When (//.variant [<lefts> <right?> (<analysis> analysis/?)]) [[//.#when (//pattern.variant [<lefts> <right?> (<pattern> pattern/?)]) //.#then (//.frac match/?)] (list [//.#when (//pattern.bind 0) @@ -808,8 +808,8 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Frac :it:) - (case it - {//.#Case (//.tuple (list (//.bit bit/?) (//.nat nat/?))) + (when it + {//.#When (//.tuple (list (//.bit bit/?) (//.nat nat/?))) [[//.#when (//pattern.tuple (list (//pattern.bit .false) (//pattern.bind 0))) //.#then (//.frac false/?)] (list [//.#when (//pattern.tuple (list (//pattern.bit .true) (//pattern.bind 0))) @@ -851,8 +851,8 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (type#= .Frac :it:) - (case it - {//.#Case (//.tuple (list (//.unit) + (when it + {//.#When (//.tuple (list (//.unit) (//.bit bit/?) (//.nat nat/?) (//.int int/?) @@ -964,5 +964,5 @@ /complex.test /reference.test /function.test - /case.test + /when.test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux index 294251023..6586ac1db 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux @@ -81,7 +81,7 @@ (def (failure? exception try) (All (_ e a) (-> (Exception e) (Try a) Bit)) - (case try + (when try {try.#Success _} false @@ -105,7 +105,7 @@ (def (analysed? expected actual) (-> Code Analysis Bit) - (case [expected actual] + (when [expected actual] [[_ {.#Tuple (list)}] (//analysis.unit)] true @@ -150,7 +150,7 @@ (|> (do //phase.monad [analysis (|> (/.sum ..analysis lefts right? archive.empty code) (//type.expecting type))] - (in (case analysis + (in (when analysis (//analysis.variant [lefts' right?' analysis]) (and (n.= lefts lefts') (bit#= right? right?') @@ -169,7 +169,7 @@ _ (//type.check (check.check varT variantT)) analysis (|> (/.sum ..analysis lefts right? archive.empty tagC) (//type.expecting varT))] - (in (case analysis + (in (when analysis (//analysis.variant [lefts' right?' it]) (and (n.= lefts lefts') (bit#= right? right?') @@ -242,7 +242,7 @@ [_ (//module.declare_labels false tags false variantT) analysis (|> (/.variant ..analysis tag archive.empty tagC) (//type.expecting variantT))] - (in (case analysis + (in (when analysis (//analysis.variant [lefts' right?' analysis]) (and (n.= lefts lefts') (bit#= right? right?') @@ -260,7 +260,7 @@ [_ (//module.declare_labels false tags false variantT) [actualT analysis] (|> (/.variant ..analysis tag archive.empty tagC) //type.inferring)] - (in (case analysis + (in (when analysis (//analysis.variant [lefts' right?' analysis]) (and (n.= lefts lefts') (bit#= right? right?') @@ -307,7 +307,7 @@ [analysis (|> expected (/.product ..analysis archive.empty) (//type.expecting type))] - (in (case analysis + (in (when analysis (//analysis.tuple actual) (and (n.= (list.size expected) (list.size actual)) @@ -332,7 +332,7 @@ analysis (|> expected (/.product ..analysis archive.empty) (//type.expecting varT))] - (in (case analysis + (in (when analysis (//analysis.tuple actual) (and (n.= (list.size expected) (list.size actual)) @@ -350,7 +350,7 @@ [[:inferred: analysis] (|> expected (/.product ..analysis archive.empty) //type.inferring)] - (in (case analysis + (in (when analysis (//analysis.tuple actual) (and (n.= (list.size expected) (list.size actual)) @@ -373,7 +373,7 @@ (/.product ..analysis archive.empty (list term/0 term/1 term/2 term/2 term/2)))) :inferred: (//type.check (check.clean (list @var) :inferred:))] - (in (case analysis + (in (when analysis (//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4)))) (and (type#= (Tuple type/0 type/1 type/2 type/2 type/2) :inferred:) @@ -393,7 +393,7 @@ [analysis (|> (list term/0 term/1 (code.tuple (list term/2 term/2 term/2))) (/.product ..analysis archive.empty) (//type.expecting (Tuple type/0 type/1 type/2 type/2 type/2)))] - (in (case analysis + (in (when analysis (//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4)))) (and (..analysed? term/0 analysis/0) (..analysed? term/1 analysis/1) @@ -465,7 +465,7 @@ head_slot/0 (|> slots/0 list.head maybe.trusted) head_term/0 (|> types/*,terms/* list.head maybe.trusted product.right) head_slot/1 (|> slots/1 list.head maybe.trusted) - slots/01 (case slots/1 + slots/01 (when slots/1 {.#Item _ tail} {.#Item head_slot/0 tail} @@ -481,7 +481,7 @@ (//module.with 0 module) (//phase#each product.right) (//phase.result state) - (pipe.case + (pipe.when {try.#Success {.#Some actual}} (let [(open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))] (list#= expected (list.reversed actual))) @@ -493,7 +493,7 @@ (normal? expected_record local_record) (|> (/.normal false tuple) (//phase.result state) - (pipe.case + (pipe.when {try.#Success {.#None}} true @@ -511,7 +511,7 @@ (//module.with 0 module) (//phase#each (|>> product.right product.right)) (//phase.result state) - (pipe.case + (pipe.when {try.#Success {.#Some [actual_arity actual_tuple actual_type]}} (and (n.= arity actual_arity) (at code.equivalence = (code.tuple tuple) (code.tuple actual_tuple)) @@ -523,7 +523,7 @@ (function (_ pattern_matching?) (|> (/.order false (list)) (//phase.result state) - (pipe.case + (pipe.when {try.#Success {.#Some [0 (list) actual_type]}} (same? .Any actual_type) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux index 41d0ff3f1..ad9af9331 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux @@ -89,7 +89,7 @@ [analysis (|> (/.function ..analysis function/0 argument/0 archive.empty output_term) (//type.expecting function_type))] - (in (case analysis + (in (when analysis {//analysis.#Function it} (? it) @@ -108,7 +108,7 @@ [[:actual: analysis] (|> (/.function ..analysis function/0 argument/0 archive.empty term) //type.inferring)] - (in (case analysis + (in (when analysis {//analysis.#Function [actual_env actual_body]} (type#= :expected: :actual:) @@ -138,7 +138,7 @@ (function?' (-> input/0 input/1 input/0) (` ([(, $function/1) (, $argument/1)] (, $argument/0))) (function (_ [outer body]) (and (list.empty? outer) - (case body + (when body {//analysis.#Function [inner body]} (n.= 1 (list.size inner)) @@ -147,7 +147,7 @@ (function?' (-> input/0 input/1 input/1) (` ([(, $function/1) (, $argument/1)] (, $argument/1))) (function (_ [outer body]) (and (list.empty? outer) - (case body + (when body {//analysis.#Function [inner body]} (n.= 0 (list.size inner)) @@ -160,7 +160,7 @@ analysis (|> (/.function ..analysis function/0 argument/0 archive.empty term/0) (//type.expecting :var:))] - (in (case analysis + (in (when analysis {//analysis.#Function [actual_env actual_body]} true @@ -182,7 +182,7 @@ [analysis (|> (/.function ..analysis function/0 argument/0 archive.empty term/1) (//type.expecting (-> input/0 output/0)))] - (in (case analysis + (in (when analysis {//analysis.#Function [actual_env actual_body]} true @@ -217,7 +217,7 @@ (' [])) //type.inferring)] (in (and (check.subsumes? :expected: :actual:) - (case analysis + (when analysis {//analysis.#Apply _} true diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux index 060f7cbd1..613cfb643 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux @@ -55,7 +55,7 @@ (//phase#each product.right) (//phase.result state) (try#each (|>> product.right - (pipe.case + (pipe.when [actual_type (//analysis.local 0)] (type#= expected_type actual_type) @@ -74,7 +74,7 @@ (//phase.result state) (try#each (|>> product.right product.right - (pipe.case + (pipe.when [actual_type (//analysis.foreign 0)] (type#= expected_type actual_type) @@ -90,7 +90,7 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (pipe.case + (pipe.when [actual_type (//analysis.constant [actual_module actual_name])] (and (type#= expected_type actual_type) (same? expected_module actual_module) @@ -110,7 +110,7 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (pipe.case + (pipe.when [actual_type (//analysis.constant [actual_module actual_name])] (and (type#= expected_type actual_type) (same? import actual_module) @@ -131,7 +131,7 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (pipe.case + (pipe.when [actual_type (//analysis.constant [actual_module actual_name])] (and (type#= expected_type actual_type) (same? import actual_module) @@ -152,7 +152,7 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (pipe.case + (pipe.when [actual_type (//analysis.constant [actual_module actual_name])] (and (type#= .Type actual_type) (same? expected_module actual_module) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux index d4b76212d..f8adedaa1 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux @@ -35,7 +35,7 @@ (/phase#each product.right) (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) - (pipe.case + (pipe.when {try.#Success analysis} (? analysis) @@ -47,7 +47,7 @@ (/phase#each product.right) (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) - (pipe.case + (pipe.when {try.#Failure error} true @@ -59,7 +59,7 @@ (/phase#each product.right) (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) - (pipe.case + (pipe.when {try.#Success [inferred analysis]} (and (type#= type inferred) (? analysis)) @@ -71,7 +71,7 @@ (template (_ <type> <tag>) [(is (-> <type> Analysis Bit) (function (_ expected) - (|>> (pipe.case + (|>> (pipe.when (<tag> actual) (same? expected actual) @@ -89,7 +89,7 @@ (`` (all _.and (_.coverage [/.unit] (..analysis state module .Any /.unit - (|>> (pipe.case + (|>> (pipe.when (/analysis.unit) true diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/when.lux index 16d10e01a..03b491fa7 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/when.lux @@ -142,14 +142,14 @@ (exception.otherwise (text.contains? (the exception.#label /.non_tuple)))))) ))) -(def (test|case lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0]) +(def (test|when lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0]) (-> Lux Symbol [Type Code] [Type Code] [Type Code] [Code Code Code] [Type Code] [Type Code] [Bit Nat] Bit) (let [state [//extension.#bundle (//extension/analysis.bundle ..eval) //extension.#state lux] - case? (is (-> Code (List [Code Code]) Bit) + when? (is (-> Code (List [Code Code]) Bit) (function (_ input branches) (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty input) + [analysis (|> (/.when ..analysis branches archive.empty input) (//type.expecting output/0))] (in true)) //scope.with @@ -159,28 +159,28 @@ (try.else false)))) body_types_mismatch! - (and (not (case? (code.bit bit/0) (list [(` #0) body/1] + (and (not (when? (code.bit bit/0) (list [(` #0) body/1] [(` #1) body/1]))) - (not (case? (code.bit bit/0) (list [(` #0) body/0] + (not (when? (code.bit bit/0) (list [(` #0) body/0] [(` #1) body/1])))) input_types_mismatch! - (and (not (case? (code.nat nat/0) (list [(` #0) body/0] + (and (not (when? (code.nat nat/0) (list [(` #0) body/0] [(` #1) body/0]))) - (not (case? (code.bit bit/0) (list [(code.nat nat/0) body/0] + (not (when? (code.bit bit/0) (list [(code.nat nat/0) body/0] [$binding/0 body/0])))) handles_singletons! - (and (case? simple/0 (list [(` [(, $binding/0)]) body/0])) - (case? simple/0 (list [(` [(, simple/0)]) body/0] + (and (when? simple/0 (list [(` [(, $binding/0)]) body/0])) + (when? simple/0 (list [(` [(, simple/0)]) body/0] [(` [(, $binding/0)]) body/0])) - (case? (code.bit bit/0) (list [(` [#0]) body/0] + (when? (code.bit bit/0) (list [(` [#0]) body/0] [(` [#1]) body/0]))) can_infer_body! (|> (do //phase.monad [[:actual: analysis] (|> (code.bit bit/0) - (/.case ..analysis + (/.when ..analysis (list [(` #0) body/0] [(` #1) body/0]) archive.empty) @@ -195,7 +195,7 @@ ensures_consistent_bodies! (|> (do //phase.monad [[:actual: analysis] (|> (code.bit bit/0) - (/.case ..analysis + (/.when ..analysis (list [(` #0) body/0] [(` #1) body/1]) archive.empty) @@ -212,25 +212,25 @@ can_infer_body! ensures_consistent_bodies! - (case? (` []) + (when? (` []) (list [(` []) body/0])) - (case? (` []) + (when? (` []) (list [$binding/0 body/0])) - (case? (code.bit bit/0) (list [(` #0) body/0] + (when? (code.bit bit/0) (list [(` #0) body/0] [(` #1) body/0])) - (case? (code.bit bit/0) (list [(` #1) body/0] + (when? (code.bit bit/0) (list [(` #1) body/0] [(` #0) body/0])) - (case? simple/0 (list [$binding/0 body/0])) - (case? simple/0 (list [simple/0 body/0] + (when? simple/0 (list [$binding/0 body/0])) + (when? simple/0 (list [simple/0 body/0] [$binding/0 body/0])) - (case? (` [(, simple/0) (, simple/1) (, simple/2)]) + (when? (` [(, simple/0) (, simple/1) (, simple/2)]) (list [$binding/0 body/0])) - (case? (` [(, simple/0) (, simple/1) (, simple/2)]) + (when? (` [(, simple/0) (, simple/1) (, simple/2)]) (list [(` [(, $binding/0) (, $binding/1)]) body/0])) - (case? (` [(, simple/0) (, simple/1) (, simple/2)]) + (when? (` [(, simple/0) (, simple/1) (, simple/2)]) (list [(` [(, simple/0) (, simple/1) (, simple/2)]) body/0] ... 000 [(` [(, $binding/0) (, simple/1) (, simple/2)]) body/0] @@ -256,7 +256,7 @@ redundant? (is (-> Code (List [Code Code]) Bit) (function (_ input branches) (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty input) + [analysis (|> (/.when ..analysis branches archive.empty input) (//type.expecting output/0))] (in true)) //scope.with @@ -319,7 +319,7 @@ (function (_ input branches) (|> (do //phase.monad [_ (//module.declare_labels false tags/* false :variant:) - analysis (|> (/.case ..analysis branches archive.empty input) + analysis (|> (/.when ..analysis branches archive.empty input) (//type.expecting output/0))] (in true)) //scope.with @@ -390,7 +390,7 @@ (function (_ input branches) (|> (do //phase.monad [_ (//module.declare_labels true slots/* false :record:) - analysis (|> (/.case ..analysis branches archive.empty input) + analysis (|> (/.when ..analysis branches archive.empty input) (//type.expecting output/0))] (in true)) //scope.with @@ -517,14 +517,14 @@ bit/0 random.bit nat/0 random.nat] (all _.and - (_.coverage [/.case] - (and (test|case lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0]) + (_.coverage [/.when] + (and (test|when lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0]) (test|redundancy lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/1] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [bit/0]) (test|variant lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0]) (test|record lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0]))) (_.coverage [/.empty_branches] (|> (do //phase.monad - [analysis (|> (/.case ..analysis (list) archive.empty simple/0) + [analysis (|> (/.when ..analysis (list) archive.empty simple/0) (//type.expecting output/0))] (in false)) //scope.with @@ -536,7 +536,7 @@ (let [non_exhaustive? (is (-> (List [Code Code]) Bit) (function (_ branches) (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty simple/0) + [analysis (|> (/.when ..analysis branches archive.empty simple/0) (//type.expecting output/0))] (in false)) //scope.with @@ -551,7 +551,7 @@ (let [invalid? (is (-> (List [Code Code]) Bit) (function (_ branches) (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty simple/0) + [analysis (|> (/.when ..analysis branches archive.empty simple/0) (//type.expecting output/0))] (in false)) //scope.with @@ -579,7 +579,7 @@ (|> (do //phase.monad [_ (//module.declare_labels false tags/* false :variant:) analysis (|> (` {(, tag/0) (, simple/0)}) - (/.case ..analysis + (/.when ..analysis (list [(` {0 #0 (, $binding/0)}) body/0] [(` {1 #0 (, $binding/1)}) body/0] [(` {2 #0 (, $binding/2)}) body/0] @@ -605,7 +605,7 @@ slot/2 (code.symbol [module/0 slot/2])] (and (|> (do //phase.monad [analysis (|> (` (, simple/0)) - (/.case ..analysis + (/.when ..analysis (list [(` {0 #0 (, $binding/0)}) body/0] [(` {1 #0 (, $binding/1)}) body/0] [(` {1 #1 (, $binding/2)}) body/0]) @@ -620,7 +620,7 @@ (|> (do //phase.monad [_ (//module.declare_labels true slots/* false :record:) analysis (|> (` (, simple/0)) - (/.case ..analysis + (/.when ..analysis (list [(` [(, slot/0) (, $binding/0) (, slot/1) (, $binding/1) (, slot/2) (, $binding/2)]) body/0]) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux index 8daf0cd19..e884cd858 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux @@ -123,7 +123,7 @@ (/.install extender extension handler/1)) (phase.result [/.#bundle /.empty /.#state state]) - (pipe.case + (pipe.when {try.#Failure error} (exception.match? /.cannot_overwrite error) @@ -135,7 +135,7 @@ [extension (list left right)]) (phase.result [/.#bundle /.empty /.#state state]) - (pipe.case + (pipe.when {try.#Failure error} (exception.match? /.unknown error) @@ -200,7 +200,7 @@ (/.apply archive.empty phase [extension (list)])) (phase.result [/.#bundle /.empty /.#state state]) - (pipe.case + (pipe.when {try.#Failure error} (exception.match? /.incorrect_arity error) @@ -215,7 +215,7 @@ (/.apply archive.empty phase [extension (list left right)])) (phase.result [/.#bundle /.empty /.#state state]) - (pipe.case + (pipe.when {try.#Failure error} (exception.match? /.invalid_syntax error) @@ -257,7 +257,7 @@ (/.lifted (phase.lifted {try.#Failure expected_error}))) (phase.result [/.#bundle /.empty /.#state state]) - (pipe.case + (pipe.when {try.#Failure actual_error} (same? expected_error actual_error) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux index 5eff1f2b9..f100c1e07 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux @@ -41,7 +41,7 @@ (////type.with_type output_type (_primitive.phase archive.empty (` ((, (code.text procedure)) (,* params)))))) (phase.result _primitive.state) - (pipe.case + (pipe.when {try.#Success _} <success> diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux index 35acd02b6..33b02eaf7 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux @@ -56,7 +56,7 @@ (def (n_abstraction arity body) (-> Arity Analysis Analysis) (list#mix (function (_ arity_1 body) - (case arity_1 + (when arity_1 0 {analysis.#Function (list) body} _ {analysis.#Function (all list#composite (list#each (|>> {variable.#Foreign}) @@ -68,7 +68,7 @@ (def !expect (template (_ <pattern> <value>) - (case <value> + (when <value> <pattern> true @@ -174,7 +174,7 @@ (random.either (..random_variable arity output?) (..random_constant output?))) -(def (random_case arity random_value output?) +(def (random_when arity random_value output?) (-> Arity Scenario Scenario) (do [! random.monad] [bit_test random.bit @@ -190,7 +190,7 @@ {.#Left lefts})]] (in [(and loop?_input loop?_output) - (synthesis.branch/case [expected_input + (synthesis.branch/when [expected_input (all synthesis.path/alt (synthesis.path/then expected_output) (synthesis.path/seq (synthesis.path/bit bit_test) @@ -217,7 +217,7 @@ (synthesis.path/bind (++ arity)) synthesis.path/pop (synthesis.path/then expected_output))))]) - {analysis.#Case actual_input + {analysis.#When actual_input [[analysis.#when (analysis.pattern/unit) analysis.#then actual_output] (list [analysis.#when (analysis.pattern/bit bit_test) @@ -252,7 +252,7 @@ (synthesis.branch/let [expected_input (++ arity) expected_output]) - {analysis.#Case actual_input + {analysis.#When actual_input [[analysis.#when {analysis.#Bind 2} analysis.#then actual_output] (list)]}]))) @@ -271,12 +271,12 @@ expected_then expected_else]) (if flip? - {analysis.#Case actual_test + {analysis.#When actual_test [[analysis.#when (analysis.pattern/bit false) analysis.#then actual_else] (list [analysis.#when (analysis.pattern/bit true) analysis.#then actual_then])]} - {analysis.#Case actual_test + {analysis.#When actual_test [[analysis.#when (analysis.pattern/bit true) analysis.#then actual_then] (list [analysis.#when (analysis.pattern/bit false) @@ -293,7 +293,7 @@ {.#Right lefts} {.#Left lefts})) expected_record]) - {analysis.#Case actual_record + {analysis.#When actual_record [[analysis.#when (analysis.pattern/tuple (list#composite (list.repeated lefts (analysis.pattern/unit)) (if right? @@ -304,7 +304,7 @@ (def (random_branch arity random_value output?) (-> Arity Scenario Scenario) - (random.either (random.either (..random_case arity random_value output?) + (random.either (random.either (..random_when arity random_value output?) (..random_let arity random_value output?)) (random.either (..random_if random_value output?) (..random_get random_value output?)))) @@ -315,7 +315,7 @@ [resets (random.list arity (random_value false))] (in [true (synthesis.loop/again (list#each (|>> product.right product.left) resets)) - (analysis.apply [{analysis.#Reference (case arity + (analysis.apply [{analysis.#Reference (when arity 1 (reference.local 0) _ (reference.foreign 0))} (list#each (|>> product.right product.right) resets)])]))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux index d2fa415a0..2fa13fdb7 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux @@ -61,7 +61,7 @@ (in [next [{variable.#Local (/.register_optimization offset register)} {variable.#Local register}]]))] - (case offset + (when offset 0 local _ (all random.either local @@ -193,8 +193,8 @@ [[next [inputE inputA]] (..reference offset arity next) [next [pathE pathA]] (..path offset arity next)] (in [next - [(//.branch/case [inputE pathE]) - (//.branch/case [inputA pathA])]]))) + [(//.branch/when [inputE pathE]) + (//.branch/when [inputA pathA])]]))) ))) (def (loop offset arity next) @@ -275,7 +275,7 @@ (random.list arity)) [_ [expected iteration]] (..scenario expected_offset arity 0)] (_.coverage [/.Transform /.optimization /.register_optimization] - (case (/.optimization true expected_offset expected_inits + (when (/.optimization true expected_offset expected_inits [//.#environment (|> expected_offset list.indices (list#each (|>> {variable.#Local}))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux index e9d5451ef..a12f284a3 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux @@ -46,7 +46,7 @@ (def .public (corresponds? analysis synthesis) (-> Analysis Synthesis Bit) - (`` (case [analysis synthesis] + (`` (when [analysis synthesis] (,, (with_template [<analysis> <post_analysis> <synthesis> <post_synthesis>] [[{////analysis.#Primitive {<analysis> expected}} {////synthesis.#Primitive {<synthesis> actual}}] @@ -84,7 +84,7 @@ (|> {////analysis.#Primitive {<analysis> expected}} (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (pipe.case + (pipe.when {try.#Success {////synthesis.#Primitive {<synthesis> actual}}} (same? expected actual) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux index 904f98b43..055f1440a 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux @@ -50,7 +50,7 @@ (|> (////analysis.variant [lefts right? memberA]) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (pipe.case + (pipe.when {try.#Success (////synthesis.variant [leftsS right?S valueS])} (let [tagS (if right?S (++ leftsS) leftsS)] (and (n.= tagA tagS) @@ -69,7 +69,7 @@ (|> (////analysis.tuple membersA) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (pipe.case + (pipe.when {try.#Success (////synthesis.tuple membersS)} (and (n.= size (list.size membersS)) (list.every? (product.uncurried //primitive.corresponds?) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux index fe6ec126b..ff011a319 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux @@ -32,7 +32,7 @@ (def !expect (template (_ <pattern> <value>) - (case <value> + (when <value> <pattern> true @@ -78,12 +78,12 @@ .let [fake_register (n.+ (the #redundants context) (dictionary.size (the #necessary context)))] [expected_output actual_output] (scenario (revised #redundants ++ context))] - (in [(synthesis.branch/case [expected_input + (in [(synthesis.branch/when [expected_input {synthesis.#Seq {synthesis.#Pop} {synthesis.#Then expected_output}}]) (if let? (synthesis.branch/let [actual_input fake_register actual_output]) - (synthesis.branch/case [actual_input + (synthesis.branch/when [actual_input {synthesis.#Seq {synthesis.#Bind fake_register} {synthesis.#Seq {synthesis.#Pop} {synthesis.#Then actual_output}}}]))])) @@ -219,14 +219,14 @@ {synthesis.#Alt actual_left actual_right}])) ))) -(def (case_scenario scenario context) +(def (when_scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) (do [! random.monad] [_ (in []) [expected_input actual_input] (scenario context) [expected_path actual_path] (..path_scenario scenario context)] - (in [(synthesis.branch/case [expected_input expected_path]) - (synthesis.branch/case [actual_input actual_path])]))) + (in [(synthesis.branch/when [expected_input expected_path]) + (synthesis.branch/when [actual_input actual_path])]))) (def (branch_scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -234,7 +234,7 @@ (..let_scenario scenario context) (..if_scenario scenario context) (..get_scenario scenario context) - (..case_scenario scenario context) + (..when_scenario scenario context) )) (def scope_arity 5) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/when.lux index 8df7f087c..65350ce95 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/when.lux @@ -46,7 +46,7 @@ (do [! random.monad] [maskedA //primitive.primitive temp (|> random.nat (at ! each (n.% 100))) - .let [maskA (analysis.case + .let [maskA (analysis.when [maskedA [[{analysis.#Bind temp} {analysis.#Reference (////reference.local temp)}] @@ -64,7 +64,7 @@ [registerA random.nat inputA //primitive.primitive outputA //primitive.primitive - .let [letA (analysis.case + .let [letA (analysis.when [inputA [[{analysis.#Bind registerA} outputA] @@ -73,7 +73,7 @@ (|> letA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (pipe.case + (pipe.when {try.#Success (synthesis.branch/let [inputS registerS outputS])} (and (n.= registerA registerS) (//primitive.corresponds? inputA inputS) @@ -96,13 +96,13 @@ [{analysis.#Simple {analysis.#Bit false}} elseA]) ifA (if then|else - (analysis.case [inputA [thenB (list elseB)]]) - (analysis.case [inputA [elseB (list thenB)]]))]] + (analysis.when [inputA [thenB (list elseB)]]) + (analysis.when [inputA [elseB (list thenB)]]))]] (_.coverage [/.synthesize_if] (|> ifA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (pipe.case + (pipe.when {try.#Success (synthesis.branch/if [inputS thenS elseS])} (and (//primitive.corresponds? inputA inputS) (//primitive.corresponds? thenA thenS) @@ -132,7 +132,7 @@ (do random.monad [@member random.nat] (in [(list#mix (function (_ member inner) - (case member + (when member {.#Left lefts} (analysis.pattern/tuple (list#composite (list.repeated lefts (analysis.pattern/unit)) @@ -155,14 +155,14 @@ (at ! each (|>> analysis.tuple))) pathA ..random_path [pattern @member] (get_pattern pathA) - .let [getA (analysis.case [recordA [[pattern + .let [getA (analysis.when [recordA [[pattern {analysis.#Reference (////reference.local @member)}] (list)]])]] (_.coverage [/.synthesize_get] (|> getA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (pipe.case + (pipe.when {try.#Success (synthesis.branch/get [pathS recordS])} (and (at (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS) (//primitive.corresponds? recordA recordS)) @@ -190,7 +190,7 @@ (|> random_element (random.set hash 5) (at random.monad each (|>> set.list - (pipe.case + (pipe.when (list s0 s1 s2 s3 s4) [s0 s1 s2 s3 s4] @@ -325,22 +325,22 @@ ..random_tuple )) -(def random_case +(def random_when (all random.either ..random_simple ..random_complex )) -(def case_test +(def when_test Test (do [! random.monad] [expected_input (at ! each (|>> .i64 synthesis.i64) random.nat) - [expected_path match] ..random_case] - (_.coverage [/.synthesize_case] - (|> (/.synthesize_case //.phase archive.empty expected_input match) + [expected_path match] ..random_when] + (_.coverage [/.synthesize_when] + (|> (/.synthesize_when //.phase archive.empty expected_input match) (phase.result [///bundle.empty synthesis.init]) - (pipe.case - {try.#Success (synthesis.branch/case [actual_input actual_path])} + (pipe.when + {try.#Success (synthesis.branch/when [actual_input actual_path])} (and (at synthesis.equivalence = expected_input actual_input) (at synthesis.path_equivalence = expected_path actual_path)) @@ -356,5 +356,5 @@ ..let_test ..if_test ..get_test - ..case_test + ..when_test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux index d2c6a2a1f..ea75c4274 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux @@ -77,7 +77,7 @@ [sample code^] (all _.and (_.test "Can parse Lux code." - (case (let [source_code (%.code sample)] + (when (let [source_code (%.code sample)] (/.parse "" (dictionary.empty text.hash) (text.size source_code) [location.dummy 0 source_code])) {.#Left error} @@ -90,13 +90,13 @@ (_.test "Can parse multiple Lux code nodes." (let [source_code (format (%.code sample) " " (%.code other)) source_code//size (text.size source_code)] - (case (/.parse "" (dictionary.empty text.hash) source_code//size + (when (/.parse "" (dictionary.empty text.hash) source_code//size [location.dummy 0 source_code]) {.#Left error} false {.#Right [remaining =sample]} - (case (/.parse "" (dictionary.empty text.hash) source_code//size + (when (/.parse "" (dictionary.empty text.hash) source_code//size remaining) {.#Left error} false @@ -126,7 +126,7 @@ comment comment^] (all _.and (_.test "Can handle comments." - (case (let [source_code (format comment (%.code sample)) + (when (let [source_code (format comment (%.code sample)) source_code//size (text.size source_code)] (/.parse "" (dictionary.empty text.hash) source_code//size [location.dummy 0 source_code])) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux index 151567041..f1c85f69d 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux @@ -38,7 +38,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive.lux b/stdlib/source/test/lux/meta/compiler/meta/archive.lux index 8195a009a..0f1db62b4 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/archive.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/archive.lux @@ -150,7 +150,7 @@ /.#registry /registry.empty]] archive (/.has module/0 entry archive)] (in (and (list.empty? pre) - (case (/.entries archive) + (when (/.entries archive) (list [module/0' @module/0' entry']) (and (same? module/0 module/0') (same? @module/0 @module/0') diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux b/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux index 4bd52fa23..3f31abaf7 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux @@ -52,20 +52,20 @@ (and (|> expected (/.document key/0) (/.marked? key/0) - (pipe.case + (pipe.when {try.#Success it} true {try.#Failure error} false)) (|> expected (/.document key/0) (/.marked? key/1) - (pipe.case + (pipe.when {try.#Success it} false {try.#Failure error} true)))) (_.coverage [/.invalid_signature] (and (|> expected (/.document key/0) (/.content key/1) - (pipe.case + (pipe.when {try.#Success it} false @@ -74,7 +74,7 @@ (|> expected (/.document key/0) (/.marked? key/1) - (pipe.case + (pipe.when {try.#Success it} false @@ -85,7 +85,7 @@ (/.document key/0) (binaryF.result (/.format binaryF.nat)) (<binary>.result (/.parser key/0 <binary>.nat)) - (pipe.case + (pipe.when {try.#Success it} (and (/signature#= signature/0 (/.signature it)) (|> it diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux index b7e4e73b3..5cfb94750 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux @@ -31,7 +31,7 @@ (def tagged? (template (_ <tag> <it>) - [(case <it> + [(when <it> {<tag> _} true @@ -70,7 +70,7 @@ (n.= 0))) (_.coverage [/.resource] (let [[@it registry] (/.resource mandatory? expected_dependencies /.empty)] - (case (sequence.list (/.artifacts registry)) + (when (sequence.list (/.artifacts registry)) (list [artifact actual_dependencies]) (and (same? @it (the artifact.#id artifact)) (same? mandatory? (the artifact.#mandatory? artifact)) @@ -84,17 +84,17 @@ (let [<expected> <expected>' <wrong_expected> <wrong_expected>'] (and (let [[@it registry] (<new> <expected> mandatory? expected_dependencies /.empty)] - (and (case (<query> registry) + (and (when (<query> registry) (list actual_name) (same? <expected> actual_name) _ false) - (case (sequence.list (/.artifacts registry)) + (when (sequence.list (/.artifacts registry)) (list [artifact actual_dependencies]) (and (same? @it (the artifact.#id artifact)) (same? mandatory? (the artifact.#mandatory? artifact)) - (case (the artifact.#category artifact) + (when (the artifact.#category artifact) {<tag> actual_name} (same? <expected> actual_name) @@ -105,7 +105,7 @@ _ false))) (let [[@it registry] (<wrong_new> <wrong_expected> mandatory? expected_dependencies /.empty)] - (case (<query> registry) + (when (<query> registry) (list) true diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache.lux b/stdlib/source/test/lux/meta/compiler/meta/cache.lux index fbff46fd2..53e8cd328 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache.lux @@ -42,7 +42,7 @@ (and (not pre/0) (not pre/1) - (case outcome + (when outcome {try.#Success _} true {try.#Failure _} false) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux index 29a5f85b5..bf0faa128 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux @@ -45,11 +45,11 @@ read! (/.cache fs context @module @artifact)] (unit.coverage [/.path /.cache! /.cache] (and (not pre) - (case write! + (when write! {try.#Success _} true {try.#Failure _} false) post - (case read! + (when read! {try.#Success actual} (binary#= expected actual) {try.#Failure _} false))))) )))) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux index dbfb86c7f..243d395fc 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux @@ -66,7 +66,7 @@ (and (not pre/0) (not pre/1) - (case outcome + (when outcome {try.#Success _} true {try.#Failure _} false) @@ -84,7 +84,7 @@ (and (not pre/0) (not pre/1) - (case outcome + (when outcome {try.#Success _} false diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux index 25d61d664..2a97eef8a 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux @@ -133,7 +133,7 @@ (in (and (at set.equivalence = (set.of_list text.hash pre) (set.of_list text.hash (list file/0 file/1))) - (case post + (when post {try.#Failure error} (exception.match? file.cannot_find_directory error) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cli.lux b/stdlib/source/test/lux/meta/compiler/meta/cli.lux index b30db36b6..099f0344d 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cli.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cli.lux @@ -62,7 +62,7 @@ [(_.coverage [<type>] (|> (list.partial "build" compilation') (<program>.result /.service) - (try#each (|>> (pipe.case + (try#each (|>> (pipe.when {/.#Compilation it} (|> it (the <slot>) @@ -85,7 +85,7 @@ (`` (and (,, (with_template [<slot> <?>] [(|> (list.partial "repl" compilation') (<program>.result /.service) - (try#each (|>> (pipe.case + (try#each (|>> (pipe.when {/.#Interpretation it} (|> it (the <slot>) @@ -107,7 +107,7 @@ (`` (and (,, (with_template [<side> <?>] [(|> (list.partial "export" export) (<program>.result /.service) - (try#each (|>> (pipe.case + (try#each (|>> (pipe.when {/.#Export it} (|> it <side> diff --git a/stdlib/source/test/lux/meta/compiler/meta/export.lux b/stdlib/source/test/lux/meta/compiler/meta/export.lux index 484a411b1..ac3841ecc 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/export.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/export.lux @@ -80,7 +80,7 @@ (|> it (try#each (|>> product.left sequence.list - (pipe.case + (pipe.when (list {tar.#Normal [actual_path/0 when/0 mode/0 ownership/0 actual_content/0]} {tar.#Normal [actual_path/1 when/1 mode/1 ownership/1 actual_content/1]}) (with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0)) @@ -103,7 +103,7 @@ (|> it (try#each (|>> product.right sequence.list - (pipe.case + (pipe.when (list {tar.#Normal [actual_path/0 _ _ _ actual_content/0]} {tar.#Normal [actual_path/1 _ _ _ actual_content/1]}) (with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0)) diff --git a/stdlib/source/test/lux/meta/compiler/phase.lux b/stdlib/source/test/lux/meta/compiler/phase.lux index b4ace0f20..18cad7805 100644 --- a/stdlib/source/test/lux/meta/compiler/phase.lux +++ b/stdlib/source/test/lux/meta/compiler/phase.lux @@ -34,7 +34,7 @@ (def (comparison init) (All (_ s) (-> s (Comparison (/.Operation s)))) (function (_ == left right) - (case [(/.result init left) + (when [(/.result init left) (/.result init right)] [{try.#Success left} {try.#Success right}] @@ -55,7 +55,7 @@ (_.coverage [/.failure] (|> (/.failure expected_error) (/.result state) - (pipe.case {try.#Failure actual_error} + (pipe.when {try.#Failure actual_error} (same? expected_error actual_error) _ @@ -63,7 +63,7 @@ (_.coverage [/.lifted] (and (|> (/.lifted {try.#Failure expected_error}) (/.result state) - (pipe.case {try.#Failure actual_error} + (pipe.when {try.#Failure actual_error} (same? expected_error actual_error) _ @@ -75,7 +75,7 @@ (_.coverage [/.except] (|> (/.except ..oops []) (/.result state) - (pipe.case {try.#Failure error} + (pipe.when {try.#Failure error} (exception.match? ..oops error) _ @@ -83,14 +83,14 @@ (_.coverage [/.assertion] (and (|> (/.assertion ..oops [] false) (/.result state) - (pipe.case {try.#Failure error} + (pipe.when {try.#Failure error} (exception.match? ..oops error) _ false)) (|> (/.assertion ..oops [] true) (/.result state) - (pipe.case {try.#Success _} + (pipe.when {try.#Success _} true _ @@ -126,7 +126,7 @@ (at n.hex encoded) (text#= state/hex))))) (/.result' state) - (pipe.case {try.#Success [state' verdict]} + (pipe.when {try.#Success [state' verdict]} (and verdict (n.= state state')) @@ -148,7 +148,7 @@ (_.coverage [/.result] (|> (at /.monad in expected) (/.result state) - (pipe.case {try.#Success actual} + (pipe.when {try.#Success actual} (same? expected actual) _ @@ -156,7 +156,7 @@ (_.coverage [/.result'] (|> (at /.monad in expected) (/.result' state) - (pipe.case {try.#Success [state' actual]} + (pipe.when {try.#Success [state' actual]} (and (same? state state') (same? expected actual)) @@ -187,7 +187,7 @@ (at /.monad in (%.frac input)))))] (|> (phase archive.empty expected) (/.result' [state/0 state/1]) - (pipe.case {try.#Success [[state/0' state/1'] actual]} + (pipe.when {try.#Success [[state/0' state/1'] actual]} (and (text#= (%.frac (i.frac expected)) actual) (same? state/0 state/0') (same? state/1 state/1')) diff --git a/stdlib/source/test/lux/meta/compiler/reference.lux b/stdlib/source/test/lux/meta/compiler/reference.lux index 9cbd38424..139ee891e 100644 --- a/stdlib/source/test/lux/meta/compiler/reference.lux +++ b/stdlib/source/test/lux/meta/compiler/reference.lux @@ -52,7 +52,7 @@ (,, (with_template [<tag>] [(_.coverage [<tag>] - (case (<tag> expected_register) + (when (<tag> expected_register) (<tag> actual_register) (n.= expected_register actual_register) @@ -65,20 +65,20 @@ (_.coverage [/.variable /.self] (and (at /.equivalence = (/.self) (/.variable (variable.self))) - (case (/.self) + (when (/.self) (/.self) true _ false) - (case (/.variable (variable.self)) + (when (/.variable (variable.self)) (/.self) true _ false))) (_.coverage [/.constant] - (case (/.constant expected_constant) + (when (/.constant expected_constant) (/.constant actual_constant) (symbol#= expected_constant actual_constant) diff --git a/stdlib/source/test/lux/meta/compiler/reference/variable.lux b/stdlib/source/test/lux/meta/compiler/reference/variable.lux index 6cb7c7c10..9fe14eec1 100644 --- a/stdlib/source/test/lux/meta/compiler/reference/variable.lux +++ b/stdlib/source/test/lux/meta/compiler/reference/variable.lux @@ -34,7 +34,7 @@ (_.for [/.hash] ($hash.spec /.hash ..random)) (_.coverage [/.self] - (case (/.self) + (when (/.self) (/.self) true _ false)) (_.coverage [/.self?] diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux index e8ebe4980..8bc88d2d7 100644 --- a/stdlib/source/test/lux/meta/configuration.lux +++ b/stdlib/source/test/lux/meta/configuration.lux @@ -30,7 +30,7 @@ (def .public (random amount) (-> Nat (Random /.Configuration)) - (case amount + (when amount 0 (random#in /.empty) _ (do [! random.monad] [feature (random.upper_case amount) @@ -41,7 +41,7 @@ (def failure (syntax (_ [it <code>.any]) (function (_ lux) - (case (expansion.complete it lux) + (when (expansion.complete it lux) {try.#Failure error} {try.#Success [lux (list (code.text error))]} diff --git a/stdlib/source/test/lux/meta/macro.lux b/stdlib/source/test/lux/meta/macro.lux index 792ed49eb..29f993f3a 100644 --- a/stdlib/source/test/lux/meta/macro.lux +++ b/stdlib/source/test/lux/meta/macro.lux @@ -38,7 +38,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true _ false)])) @@ -114,7 +114,7 @@ (def iterated (syntax (_ [cycle <code>.nat it <code>.any]) - (in (list (case cycle + (in (list (when cycle 0 it _ (` (..iterated (, (code.nat (-- cycle))) (, it)))))))) @@ -164,7 +164,7 @@ <cycles> (static.random code.nat (random#each (|>> (n.% 5) ++) random.nat)) <actual> (/.final (..iterated <cycles> <expected>))] - (case (' <actual>) + (when (' <actual>) [_ {.#Nat actual}] (n.= <expected> actual) @@ -178,7 +178,7 @@ (random#each (|>> (n.% <max>) ++) random.nat)) <actual> (/.times <cycles> (..iterated <max> <expected>))] (let [expected_remaining (n.- <cycles> <max>)] - (case (` <actual>) + (when (` <actual>) (^.` (..iterated (^., [_ {.#Nat actual_remaining}]) (^., [_ {.#Nat actual}]))) (and (n.= expected_remaining actual_remaining) (n.= <expected> actual)) @@ -191,7 +191,7 @@ (macro (_ tokens) (loop (again [tokens tokens output 0]) - (case tokens + (when tokens {.#End} (at meta.monad in (list (code.nat output))) diff --git a/stdlib/source/test/lux/meta/macro/local.lux b/stdlib/source/test/lux/meta/macro/local.lux index eb58f416b..244c8ddd7 100644 --- a/stdlib/source/test/lux/meta/macro/local.lux +++ b/stdlib/source/test/lux/meta/macro/local.lux @@ -37,7 +37,7 @@ (def macro_error (syntax (_ [macro <code>.any]) (function (_ compiler) - (case ((expansion.complete macro) compiler) + (when ((expansion.complete macro) compiler) {try.#Failure error} {try.#Success [compiler (list (code.text error))]} diff --git a/stdlib/source/test/lux/meta/macro/pattern.lux b/stdlib/source/test/lux/meta/macro/pattern.lux index 0b443cfd6..362cf42ba 100644 --- a/stdlib/source/test/lux/meta/macro/pattern.lux +++ b/stdlib/source/test/lux/meta/macro/pattern.lux @@ -44,7 +44,7 @@ (do [! random.monad] [sample (at ! each (n.% 5) random.nat)] (_.coverage [/.with_template] - (case sample + (when sample (/.with_template [<case>] [<case> true]) ([0] [1] [2] [3] [4]) @@ -52,19 +52,19 @@ _ false))) (_.coverage [/.or] - (and (/.case expected_rev + (and (/.when expected_rev (/.or .5 .25) true _ false) - (/.case expected_frac + (/.when expected_frac (/.or +0.5 +1.25) true _ false) - (/.case expected_text + (/.when expected_text (/.or "+0.5" "+1.25") true _ false))) (_.coverage [/.let] (let [expected_pair (is (Pair Nat Int) [..#left expected_nat ..#right expected_int])] - (/.case expected_pair + (/.when expected_pair (/.let actual_pair (!pair actual_left actual_right)) (and (/.same? expected_pair actual_pair) (/.same? expected_nat actual_left) @@ -72,7 +72,7 @@ (_.coverage [/.multi] (let [expected_pair (is (Pair Nat Int) [..#left expected_nat ..#right expected_int])] - (and (/.case expected_pair + (and (/.when expected_pair (/.multi (!pair 0 actual_right) [actual_right +0]) @@ -80,7 +80,7 @@ _ false) - (/.case expected_pair + (/.when expected_pair (/.multi (!pair 0 actual_right) (i.= +0 actual_right)) true @@ -88,12 +88,12 @@ _ false)))) (_.coverage [/.|>] - (case expected_frac + (when expected_frac (/.|> actual_frac [(f.* +2.0) (f.* +2.0)]) (f.= (f.* +4.0 expected_frac) actual_frac))) (_.coverage [/.`] - (case (code.text expected_text) + (when (code.text expected_text) (/.` "+0.5") true (/.` "+1.25") true _ false)) diff --git a/stdlib/source/test/lux/meta/macro/syntax/check.lux b/stdlib/source/test/lux/meta/macro/syntax/check.lux index 72a8753f1..aac4bc781 100644 --- a/stdlib/source/test/lux/meta/macro/syntax/check.lux +++ b/stdlib/source/test/lux/meta/macro/syntax/check.lux @@ -38,7 +38,7 @@ (do random.monad [[type value] ..random] (_.coverage [/.format /.parser] - (case (<code>.result /.parser + (when (<code>.result /.parser (list (/.format [/.#type type /.#value value]))) {try.#Failure _} diff --git a/stdlib/source/test/lux/meta/macro/syntax/declaration.lux b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux index 9a06513ed..090518338 100644 --- a/stdlib/source/test/lux/meta/macro/syntax/declaration.lux +++ b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux @@ -40,7 +40,7 @@ (do random.monad [expected ..random] (_.coverage [/.format /.parser] - (case (<code>.result /.parser + (when (<code>.result /.parser (list (/.format expected))) {try.#Failure _} false diff --git a/stdlib/source/test/lux/meta/macro/syntax/definition.lux b/stdlib/source/test/lux/meta/macro/syntax/definition.lux index 28aa3653d..929f841d6 100644 --- a/stdlib/source/test/lux/meta/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/meta/macro/syntax/definition.lux @@ -68,7 +68,7 @@ untyped_value $////code.random] (all _.and (_.coverage [/.format /.parser] - (case (<code>.result (/.parser compiler) + (when (<code>.result (/.parser compiler) (list (/.format expected))) {try.#Failure error} false @@ -77,7 +77,7 @@ (at /.equivalence = expected actual))) (_.coverage [/.typed] (let [expected (has /.#value {.#Left [type untyped_value]} expected)] - (case (<code>.result (/.typed compiler) + (when (<code>.result (/.typed compiler) (list (/.format expected))) {try.#Failure error} false @@ -86,7 +86,7 @@ (at /.equivalence = expected actual)))) (_.coverage [/.lacks_type] (let [expected (has /.#value {.#Right untyped_value} expected)] - (case (<code>.result (/.typed compiler) + (when (<code>.result (/.typed compiler) (list (/.format expected))) {try.#Failure error} (exception.match? /.lacks_type error) diff --git a/stdlib/source/test/lux/meta/macro/syntax/export.lux b/stdlib/source/test/lux/meta/macro/syntax/export.lux index b8109c5b6..e074f64ae 100644 --- a/stdlib/source/test/lux/meta/macro/syntax/export.lux +++ b/stdlib/source/test/lux/meta/macro/syntax/export.lux @@ -32,7 +32,7 @@ (do random.monad [[expected_export_policy expected_un_exported] ..export] (_.coverage [/.parser /.default_policy] - (|> (case expected_export_policy + (|> (when expected_export_policy {.#Some expected_export_policy} (list expected_export_policy (code.nat expected_un_exported)) diff --git a/stdlib/source/test/lux/meta/macro/syntax/input.lux b/stdlib/source/test/lux/meta/macro/syntax/input.lux index fffc345da..7f84d403d 100644 --- a/stdlib/source/test/lux/meta/macro/syntax/input.lux +++ b/stdlib/source/test/lux/meta/macro/syntax/input.lux @@ -42,7 +42,7 @@ (do random.monad [expected ..random] (_.coverage [/.format /.parser] - (case (<code>.result /.parser (list (/.format (list expected)))) + (when (<code>.result /.parser (list (/.format (list expected)))) {try.#Failure _} false diff --git a/stdlib/source/test/lux/meta/macro/template.lux b/stdlib/source/test/lux/meta/macro/template.lux index c9edbd035..655c52d73 100644 --- a/stdlib/source/test/lux/meta/macro/template.lux +++ b/stdlib/source/test/lux/meta/macro/template.lux @@ -33,7 +33,7 @@ (def macro_error (syntax (_ [macro <code>.any]) (function (_ compiler) - (case ((expansion.complete macro) compiler) + (when ((expansion.complete macro) compiler) {try.#Failure error} {try.#Success [compiler (list (code.text error))]} @@ -57,18 +57,18 @@ (list left mid right) (`` (list (,, (/.spliced [left mid right])))))) (_.coverage [/.amount] - (case (/.amount [left mid right]) + (when (/.amount [left mid right]) 3 true _ false)) (_.coverage [/.text] - (case (/.text <short>) + (when (/.text <short>) <short>' true _ false)) (_.coverage [/.symbol] - (and (case (`` (symbol (,, (/.symbol <short>)))) + (and (when (`` (symbol (,, (/.symbol <short>)))) ["" <short>'] true _ false) - (case (`` (symbol (,, (/.symbol <module> <short>)))) + (when (`` (symbol (,, (/.symbol <module> <short>)))) [<module>' <short>'] true _ false) )) diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux index e030d74ac..a7169d6af 100644 --- a/stdlib/source/test/lux/meta/static.lux +++ b/stdlib/source/test/lux/meta/static.lux @@ -32,7 +32,7 @@ (with_expansions [<left> (<random>) <right> (<random>) <l+r> (<static> (<+> <left> <right>))] - (case (' <l+r>) + (when (' <l+r>) [_ {<tag> l+r}] (<=> l+r (<+> <left> <right>)) @@ -47,7 +47,7 @@ (with_expansions [<left> (/.random_frac) <right> (/.random_frac) <l+r> (/.frac (f.+ <left> <right>))] - (case (' <l+r>) + (when (' <l+r>) [_ {.#Frac l+r}] (or (f.= l+r (f.+ <left> <right>)) (and (f.not_a_number? l+r) @@ -61,7 +61,7 @@ (with_expansions [<left> (/.random code.text (random.alpha_numeric 1)) <right> (/.random code.text (random.alpha_numeric 1)) <l+r> (/.text (format <left> <right>))] - (case (' <l+r>) + (when (' <l+r>) [_ {.#Text l+r}] (text#= l+r (format <left> <right>)) @@ -78,7 +78,7 @@ (with_expansions [<left> (/.random code.text (random.alpha_numeric 1)) <right> (/.random code.text (random.alpha_numeric 1)) <l+r> (/.literal code.text (format <left> <right>))] - (case (' <l+r>) + (when (' <l+r>) [_ {.#Text l+r}] (text#= l+r (format <left> <right>)) diff --git a/stdlib/source/test/lux/meta/target/js.lux b/stdlib/source/test/lux/meta/target/js.lux index 759e0af3c..9867d5085 100644 --- a/stdlib/source/test/lux/meta/target/js.lux +++ b/stdlib/source/test/lux/meta/target/js.lux @@ -80,7 +80,7 @@ (|> /.null ..eval (try#each (function (_ it) - (case it + (when it {.#None} true {.#Some _} false))) (try.else false))) @@ -471,7 +471,7 @@ (/.while (/.< (/.int (.int full_inner_iterations)) $inner_index) (all /.then (/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index) - /.break) + /.break) (/.set $output (/.+ $input $output)) (/.set $inner_index (/.+ (/.int +1) $inner_index)) )) @@ -488,7 +488,7 @@ (all /.then (/.set $inner_index (/.+ (/.int +1) $inner_index)) (/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index) - /.continue) + /.continue) (/.set $output (/.+ $input $output)) )) (/.return $output))) @@ -511,9 +511,9 @@ (/.while (/.< (/.int (.int full_inner_iterations)) $inner_index) (all /.then (/.when (/.= (/.int (.int expected_outer_iterations)) $outer_index) - (/.break_at @outer)) + (/.break_at @outer)) (/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index) - /.break) + /.break) (/.set $output (/.+ $input $output)) (/.set $inner_index (/.+ (/.int +1) $inner_index)) )) @@ -539,9 +539,9 @@ (all /.then (/.set $inner_index (/.+ (/.int +1) $inner_index)) (/.when (/.<= (/.int (.int expected_outer_iterations)) $outer_index) - (/.continue_at @outer)) + (/.continue_at @outer)) (/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index) - /.continue) + /.continue) (/.set $output (/.+ $input $output)) )) ) @@ -733,7 +733,7 @@ (/.apply (/.closure (list) (all /.then (/.when (/.boolean ???) - (/.return (/.number number/0))) + (/.return (/.number number/0))) (/.return (/.number number/1)))) (list)))) (_.coverage [/.switch] @@ -819,7 +819,7 @@ (/.return $arg/0))) (list)) ..eval - (pipe.case + (pipe.when {try.#Success it} false diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux index 0e0da91da..b7c487680 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/target/jvm.lux @@ -125,7 +125,7 @@ (do random.monad [class_name ..class_name method_name (random.upper_case 10)] - (in (case (do try.monad + (in (when (do try.monad [class (/class.class /version.v6_0 /class.public (/name.internal class_name) {.#None} @@ -914,7 +914,7 @@ (binary.result /class.format)) loader (/loader.memory (/loader.new_library []))]] (_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" - (case (do try.monad + (when (do try.monad [_ (/loader.define class_name bytecode loader) class (io.run! (/loader.load class_name loader)) method (try (get_method static_method class)) @@ -1047,7 +1047,7 @@ .let [type (loop (again [dimensions dimensions type (is (Type Object) ..$Object)]) - (case dimensions + (when dimensions 0 type _ (again (-- dimensions) (/type.array type))))]] (<| (_.lifted "MULTIANEWARRAY") @@ -1351,7 +1351,7 @@ (random.only (|>> (text#= primitive_method_name) not))) expected (the #random primitive) .let [$Self (/type.class class_name (list))]] - (in (case (do try.monad + (in (when (do try.monad [class (/class.class /version.v6_0 /class.public (/name.internal class_name) {.#None} @@ -1371,7 +1371,7 @@ (list) {.#Some (do /.monad [_ (/.invokestatic $Self primitive_method_name primitive_method_type) - _ (case substitute + _ (when substitute {.#None} (in []) @@ -1734,7 +1734,7 @@ (binary.result /class.format)) loader (/loader.memory (/loader.new_library []))]] (_.test "Class & interface inheritance" - (case (do try.monad + (when (do try.monad [_ (/loader.define abstract_class abstract_bytecode loader) _ (/loader.define interface_class interface_bytecode loader) _ (/loader.define concrete_class concrete_bytecode loader) diff --git a/stdlib/source/test/lux/meta/target/lua.lux b/stdlib/source/test/lux/meta/target/lua.lux index 9b2cd6642..6d1ba7cb3 100644 --- a/stdlib/source/test/lux/meta/target/lua.lux +++ b/stdlib/source/test/lux/meta/target/lua.lux @@ -58,7 +58,7 @@ (|> /.nil /.code ..load - (pipe.case + (pipe.when {.#None} true {.#Some _} false))) (_.coverage [/.boolean] @@ -432,7 +432,7 @@ (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated full_iterations $input))) (all /.then (/.when (/.> expected_iterations $index) - /.break) + /.break) (/.set (list $output) (/.+ $input $output)))) (/.return $output)) (/.closure (list $input)) @@ -446,7 +446,7 @@ (/.while (/.< full_iterations $index) (all /.then (/.when (/.= expected_iterations $index) - /.break) + /.break) (/.set (list $output) (/.+ $input $output)) (/.set (list $index) (/.+ (/.int +1) $index)) )) @@ -460,7 +460,7 @@ (/.repeat (/.= full_iterations $index) (all /.then (/.when (/.= expected_iterations $index) - /.break) + /.break) (/.set (list $output) (/.+ $input $output)) (/.set (list $index) (/.+ (/.int +1) $index)) )) @@ -473,7 +473,7 @@ (/.for_step $index (/.int +0) full_iterations (/.int +1) (all /.then (/.when (/.= expected_iterations $index) - /.break) + /.break) (/.set (list $output) (/.+ $input $output)))) (/.return $output)) (/.closure (list $input)) @@ -660,7 +660,7 @@ (expression (|>> (as Frac) (f.= (if ??? float/0 float/1))) (|> (all /.then (/.when (/.boolean ???) - (/.return (/.float float/0))) + (/.return (/.float float/0))) (/.return (/.float float/1))) (/.closure (list)) (/.apply (list))))) diff --git a/stdlib/source/test/lux/meta/target/python.lux b/stdlib/source/test/lux/meta/target/python.lux index fdc5ef219..b346cb53a 100644 --- a/stdlib/source/test/lux/meta/target/python.lux +++ b/stdlib/source/test/lux/meta/target/python.lux @@ -57,7 +57,7 @@ /.code ..eval (try#each (function (_ it) - (case it + (when it {.#None} true {.#Some _} false))) (try.else false))) @@ -364,7 +364,7 @@ keyword/0 (keyword 0) keyword/1 (keyword 1) keyword_choice (keyword poly_choice)] - .let [expected/? (case poly_choice + .let [expected/? (when poly_choice 0 expected/0 _ expected/1)] $var (at ! each (|>> %.nat (format "v") /.var) random.nat) @@ -602,7 +602,7 @@ $ex (at ! each (|>> %.nat (format "ex_") /.var) random.nat)] (all _.and (_.coverage [/.raise /.Exception/1] - (case (try (..statement + (when (try (..statement (function (_ $output) (all /.then (/.raise (/.Exception/1 (/.string expected_error))) @@ -623,7 +623,7 @@ /.#handler (/.set (list $output) (/.float expected))])))) (as Frac) (f.= expected)) - (case (try (..statement + (when (try (..statement (function (_ $output) (/.try (all /.then (/.raise (/.Exception/1 (/.string expected_error))) @@ -781,7 +781,7 @@ (/.def $def (list) (all /.then (/.when (/.bool test) - (/.return (/.float then))) + (/.return (/.float then))) (/.return (/.float else)))) (/.set (list $output) (/.apply (list) $def))))) (as Frac) diff --git a/stdlib/source/test/lux/meta/target/ruby.lux b/stdlib/source/test/lux/meta/target/ruby.lux index 37395eeb2..779af9f0b 100644 --- a/stdlib/source/test/lux/meta/target/ruby.lux +++ b/stdlib/source/test/lux/meta/target/ruby.lux @@ -53,7 +53,7 @@ (-> /.Expression Bit) (|>> /.code ..eval - (try#each (|>> (pipe.case + (try#each (|>> (pipe.when {.#None} true {.#Some _} false))) (try.else false))) @@ -739,7 +739,7 @@ (/.while (/.< (/.int (.int full_inner_iterations)) $inner_index) (all /.then (/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index) - /.break) + /.break) (/.set (list $output) (/.+ $input $output)) (/.set (list $inner_index) (/.+ (/.int +1) $inner_index)) )) @@ -756,7 +756,7 @@ (all /.then (/.set (list $inner_index) (/.+ (/.int +1) $inner_index)) (/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index) - /.next) + /.next) (/.set (list $output) (/.+ $input $output)) )) (/.return $output)) @@ -772,7 +772,7 @@ (all /.then (/.set (list $inner_index) (/.+ (/.int +1) $inner_index)) (/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index) - /.redo) + /.redo) (/.set (list $output) (/.+ $input $output)) )) (/.return $output)) @@ -981,7 +981,7 @@ (expression (|>> (as Frac) (f.= (if ??? float/0 float/1))) (|> (all /.then (/.when (/.bool ???) - (/.return (/.float float/0))) + (/.return (/.float float/0))) (/.return (/.float float/1))) [(list)] (/.lambda {.#None}) (/.apply_lambda (list))))) diff --git a/stdlib/source/test/lux/meta/type.lux b/stdlib/source/test/lux/meta/type.lux index 226533dd1..3c6872d26 100644 --- a/stdlib/source/test/lux/meta/type.lux +++ b/stdlib/source/test/lux/meta/type.lux @@ -45,7 +45,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true @@ -364,7 +364,7 @@ (random#each (|>> {.#Product}) pairG) (random#each (|>> {.#Function}) pairG) ))] - (case parameters + (when parameters 0 un_parameterized _ (|> random.nat (random#each (|>> (n.% parameters) {.#Parameter})) @@ -385,7 +385,7 @@ ($equivalence.spec /.equivalence (..random 0))) (do [! random.monad] - [anonymousT (random.only (|>> (pipe.case {.#Named _ _} false + [anonymousT (random.only (|>> (pipe.when {.#Named _ _} false _ true)) (..random 0)) symbol/0 ..symbol @@ -401,7 +401,7 @@ [size (|> random.nat (at ! each (n.% 3))) members (|> (..random 0) (random.only (function (_ type) - (case type + (when type (^.or {.#Sum _} {.#Product _}) false @@ -430,7 +430,7 @@ full (/.applied (list Int) partial)] (in (at /.equivalence = full {.#Product Bit Int})))) (|> (/.applied (list Bit) Text) - (pipe.case + (pipe.when {.#None} true @@ -441,7 +441,7 @@ members (monad.all ! (list.repeated size (..random 0))) extra (|> (..random 0) (random.only (function (_ type) - (case type + (when type (^.or {.#Function _} {.#Apply _}) false @@ -462,7 +462,7 @@ [size (|> random.nat (at ! each (|>> (n.% 3) ++))) body_type (|> (..random 0) (random.only (function (_ type) - (case type + (when type (^.or {.#UnivQ _} {.#ExQ _}) false @@ -488,7 +488,7 @@ [depth (|> random.nat (at ! each (|>> (n.% 3) ++))) element_type (|> (..random 0) (random.only (function (_ type) - (case type + (when type {.#Primitive name (list element_type)} (not (text#= array.primitive name)) diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index f6874ae5f..b6459169f 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -54,7 +54,7 @@ (random#each (|>> {.#Apply}) pairG))) random_id (let [random_id (random.either (random#each (|>> {.#Var}) random.nat) (random#each (|>> {.#Ex}) random.nat))] - (case num_vars + (when num_vars 0 random_id _ (random.either (random#each (|>> (n.% num_vars) (n.* 2) ++ {.#Parameter}) random.nat) random_id))) @@ -74,7 +74,7 @@ (def (valid_type? type) (-> Type Bit) - (case type + (when type {.#Primitive name params} (list.every? valid_type? params) @@ -100,7 +100,7 @@ (def comparison (Comparison (All (_ a) (/.Check a))) (function (_ == left right) - (case [(/.result /.fresh_context left) (/.result /.fresh_context right)] + (when [(/.result /.fresh_context left) (/.result /.fresh_context right)] [{try.#Success left} {try.#Success right}] (== left right) @@ -141,7 +141,7 @@ (do random.monad [expected (random.upper_case 10)] (_.coverage [/.failure] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (is (/.Check Any) (/.failure expected))) {try.#Success _} false @@ -149,16 +149,16 @@ (do random.monad [expected (random.upper_case 10)] (_.coverage [/.assertion] - (and (case (/.result /.fresh_context + (and (when (/.result /.fresh_context (is (/.Check Any) (/.assertion expected true))) {try.#Success _} true {try.#Failure actual} false) - (case (/.result /.fresh_context (/.assertion expected false)) + (when (/.result /.fresh_context (/.assertion expected false)) {try.#Success _} false {try.#Failure actual} (same? expected actual))))) (_.coverage [/.except] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (is (/.Check Any) (/.except ..yolo []))) {try.#Success _} false @@ -168,12 +168,12 @@ (and (|> (/.check <left> <right>) (is (/.Check Any)) (/.result /.fresh_context) - (pipe.case {try.#Failure error} (? error) + (pipe.when {try.#Failure error} (? error) {try.#Success _} false)) (|> (/.check <right> <left>) (is (/.Check Any)) (/.result /.fresh_context) - (pipe.case {try.#Failure error} (? error) + (pipe.when {try.#Failure error} (? error) {try.#Success _} false)))))] (all _.and (_.coverage [/.type_check_failed] @@ -202,7 +202,7 @@ (<| (_.for [/.Var]) (all _.and (_.coverage [/.var] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var] (in (//#= var_type {.#Var var_id})))) @@ -211,7 +211,7 @@ (do random.monad [nominal (random.upper_case 10)] (_.coverage [/.bind] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var _ (/.bind {.#Primitive nominal (list)} @@ -245,7 +245,7 @@ (do random.monad [nominal (random.upper_case 10)] (_.coverage [/.cannot_rebind_var] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var _ (/.bind {.#Primitive nominal (list)} @@ -261,7 +261,7 @@ [nominal (random.upper_case 10) var_id random.nat] (_.coverage [/.unknown_type_var] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (/.bind {.#Primitive nominal (list)} var_id)) {try.#Success _} @@ -277,7 +277,7 @@ [[var_id var_type] /.var] (/.peek var_id)) (/.result /.fresh_context) - (pipe.case {try.#Success {.#None}} true + (pipe.when {try.#Success {.#None}} true _ false)) (|> (do /.monad [[var_id var/0] /.var @@ -285,14 +285,14 @@ _ (/.check var/0 var/1)] (/.peek var_id)) (/.result /.fresh_context) - (pipe.case {try.#Success {.#None}} true + (pipe.when {try.#Success {.#None}} true _ false)) (|> (do /.monad [[var_id var_type] /.var _ (/.bind expected var_id)] (/.peek var_id)) (/.result /.fresh_context) - (pipe.case {try.#Success {.#Some actual}} + (pipe.when {try.#Success {.#Some actual}} (same? expected actual) _ @@ -301,7 +301,7 @@ [nominal (random.upper_case 10) .let [expected {.#Primitive nominal (list)}]] (_.coverage [/.read] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var _ (/.bind expected var_id)] @@ -315,7 +315,7 @@ [nominal (random.upper_case 10) .let [expected {.#Primitive nominal (list)}]] (_.coverage [/.unbound_type_var] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var] (/.read var_id))) @@ -334,13 +334,13 @@ (n.= 0 (the .#ex_counter /.fresh_context)) (list.empty? (the .#var_bindings /.fresh_context)))) (_.coverage [/.context] - (and (case (/.result /.fresh_context /.context) + (and (when (/.result /.fresh_context /.context) {try.#Success actual} (same? /.fresh_context actual) {try.#Failure error} false) - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [_ /.var] /.context)) @@ -352,7 +352,7 @@ {try.#Failure error} false))) (_.coverage [/.existential] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (do /.monad [_ /.existential] /.context)) @@ -368,7 +368,7 @@ (def succeeds? (All (_ a) (-> (/.Check a) Bit)) (|>> (/.result /.fresh_context) - (pipe.case {try.#Success _} + (pipe.when {try.#Success _} true {try.#Failure error} @@ -457,7 +457,7 @@ (def (verdict check) (All (_ _) (-> (/.Check _) (/.Check Bit))) (function (_ context) - {try.#Success [context (case (check context) + {try.#Success [context (when (check context) {try.#Success _} true @@ -889,7 +889,7 @@ (do random.monad [expected random.nat] (_.coverage [/.result] - (case (/.result /.fresh_context + (when (/.result /.fresh_context (at /.monad in expected)) {try.#Success actual} (same? expected actual) {try.#Failure error} false))) diff --git a/stdlib/source/test/lux/meta/type/dynamic.lux b/stdlib/source/test/lux/meta/type/dynamic.lux index 78382883f..d14bbbb19 100644 --- a/stdlib/source/test/lux/meta/type/dynamic.lux +++ b/stdlib/source/test/lux/meta/type/dynamic.lux @@ -26,21 +26,21 @@ [expected random.nat] (all _.and (_.coverage [/.dynamic /.static] - (case (/.static Nat (/.dynamic expected)) + (when (/.static Nat (/.dynamic expected)) {try.#Success actual} (n.= expected actual) {try.#Failure _} false)) (_.coverage [/.wrong_type] - (case (/.static Text (/.dynamic expected)) + (when (/.static Text (/.dynamic expected)) {try.#Success actual} false {try.#Failure error} (exception.match? /.wrong_type error))) (_.coverage [/.format] - (case (/.format (/.dynamic expected)) + (when (/.format (/.dynamic expected)) {try.#Success actual} (text#= (%.nat expected) actual) diff --git a/stdlib/source/test/lux/meta/type/refinement.lux b/stdlib/source/test/lux/meta/type/refinement.lux index 845c878fd..2921ff8c2 100644 --- a/stdlib/source/test/lux/meta/type/refinement.lux +++ b/stdlib/source/test/lux/meta/type/refinement.lux @@ -40,7 +40,7 @@ (_.for [/.Refiner] (all _.and (_.coverage [/.refiner] - (case (/.refiner predicate raw) + (when (/.refiner predicate raw) {.#Some refined} (predicate raw) diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux index 25c44d81a..33859dd4e 100644 --- a/stdlib/source/test/lux/meta/type/resource.lux +++ b/stdlib/source/test/lux/meta/type/resource.lux @@ -164,7 +164,7 @@ [[_ _ exception] (meta.export exception)] (function (_ compiler) {.#Right [compiler - (list (code.bit (case ((expansion.single to_expand) compiler) + (list (code.bit (when ((expansion.single to_expand) compiler) {try.#Success _} false diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux index 999e2f2e1..2182f3197 100644 --- a/stdlib/source/test/lux/meta/version.lux +++ b/stdlib/source/test/lux/meta/version.lux @@ -27,7 +27,7 @@ (def failure (syntax (_ [it <code>.any]) (function (_ lux) - (case (expansion.complete it lux) + (when (expansion.complete it lux) {try.#Failure error} {try.#Success [lux (list (code.text error))]} diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index 62ab2204e..a4382595d 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -29,7 +29,7 @@ (def !expect (template (_ <pattern> <value>) - [(case <value> + [(when <value> <pattern> true @@ -122,7 +122,7 @@ inputs)] (list#= inputs (as (List Text) (io.run! outcome)))) - (case (try ((is /.Program + (when (try ((is /.Program (/.program [arg/0 \\parser.any arg/1 \\parser.any arg/2 \\parser.any diff --git a/stdlib/source/test/lux/world/environment.lux b/stdlib/source/test/lux/world/environment.lux index c2a9ac384..df434f657 100644 --- a/stdlib/source/test/lux/world/environment.lux +++ b/stdlib/source/test/lux/world/environment.lux @@ -54,7 +54,7 @@ (do random.monad [property (random.alphabetic 1)] (_.coverage [\\parser.unknown_property] - (case (\\parser.result (\\parser.property property) \\parser.empty) + (when (\\parser.result (\\parser.property property) \\parser.empty) {try.#Success _} false @@ -104,7 +104,7 @@ (|> unknown (at it variable) io.run! - (pipe.case {try.#Success _} + (pipe.when {try.#Success _} false {try.#Failure error} diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 3eec4fa19..477b09110 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -41,7 +41,7 @@ (-> (Atom Disk) (-> /.Path (IO Bit))) (do io.monad [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#None} false {.#Some {.#Left _}} true {.#Some {.#Right _}} false)))) @@ -50,7 +50,7 @@ (-> (Atom Disk) (-> /.Path (IO Bit))) (do io.monad [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#None} false {.#Some {.#Left _}} false {.#Some {.#Right _}} true)))) @@ -61,7 +61,7 @@ (-> /.Path (IO (Try Any)))) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right siblings}} (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Right (alert siblings)} disk') disk)] @@ -75,12 +75,12 @@ (do [! io.monad] [now instant.now disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') (^.or {.#None} {.#Some {.#Left _}}) (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [now it]} disk') disk)] - (case (/.parent fs @) + (when (/.parent fs @) {.#Some parent} (alert_parent! disk (|>> (list.partial @)) parent) @@ -94,7 +94,7 @@ (-> (Atom Disk) (-> /.Path (IO (Try Binary)))) (do io.monad [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left [_ it]}} {try.#Success it} @@ -106,7 +106,7 @@ (-> /.Path (IO (Try Any)))) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right children}} (if (list.empty? children) (do ! @@ -117,7 +117,7 @@ {.#Some {.#Left [_ data]}} (do ! [_ (atom.compare_and_swap! disk' (dictionary.lacks @ disk') disk)] - (case (/.parent fs @) + (when (/.parent fs @) {.#Some parent} (alert_parent! disk (list.only (|>> (text#= @) not)) parent) @@ -144,7 +144,7 @@ (def (file_size @) (do [! io.monad] [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left [_ it]}} {try.#Success (binary.size it)} @@ -153,7 +153,7 @@ (def (last_modified @) (do [! io.monad] [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left [it _]}} {try.#Success it} @@ -162,7 +162,7 @@ (def (can_execute? @) (do [! io.monad] [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left _}} {try.#Success false} @@ -172,11 +172,11 @@ (def (make_directory @) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#None} (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Right (list)} disk') disk)] - (case (/.parent mock @) + (when (/.parent mock @) {.#Some parent} (alert_parent! disk (|>> (list.partial @)) parent) @@ -188,7 +188,7 @@ (def (directory_files @) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right children}} (|> children (monad.only ! (..file? disk)) @@ -199,7 +199,7 @@ (def (sub_directories @) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right children}} (|> children (monad.only ! (..directory? disk)) @@ -211,7 +211,7 @@ (do [! io.monad] [now instant.now disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#None} (..write mock disk @ it) @@ -227,7 +227,7 @@ (def (modify @ it) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Left [_ data]}} (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [it data]} disk') disk)] @@ -258,7 +258,7 @@ [.let [fs (/.mock /)] ? (at fs delete file)] (unit.coverage [/.cannot_delete] - (case ? + (when ? {try.#Failure error} (exception.match? /.cannot_delete error) @@ -268,7 +268,7 @@ [.let [fs (/.mock /)] ? (at fs read file)] (unit.coverage [/.cannot_find_file] - (case ? + (when ? {try.#Failure error} (exception.match? /.cannot_find_file error) @@ -279,7 +279,7 @@ ?/0 (at fs directory_files file) ?/1 (at fs sub_directories file)] (unit.coverage [/.cannot_find_directory] - (case [?/0 ?/1] + (when [?/0 ?/1] [{try.#Failure error/0} {try.#Failure error/1}] (and (exception.match? /.cannot_find_directory error/0) (exception.match? /.cannot_find_directory error/1)) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index 73f7755ca..e8ce8182e 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -77,13 +77,13 @@ [?concern (at watcher concern directory) ?stop (at watcher stop directory)] (unit.coverage [/.not_being_watched] - (and (case ?concern + (and (when ?concern {try.#Failure error} (exception.match? /.not_being_watched error) {try.#Success _} false) - (case ?stop + (when ?stop {try.#Failure error} (exception.match? /.not_being_watched error) @@ -106,7 +106,7 @@ (//.make_file async.monad fs (binary.empty 0) expected_path)) poll/pre (at watcher poll []) poll/post (at watcher poll [])] - (in (and (case poll/pre + (in (and (when poll/pre (list [concern actual_path]) (and (text#= expected_path actual_path) (and (/.creation? concern) @@ -124,7 +124,7 @@ _ (at fs write expected_path data) poll/2 (at watcher poll []) poll/2' (at watcher poll [])] - (in (and (case poll/2 + (in (and (when poll/2 (list [concern actual_path]) (and (text#= expected_path actual_path) (and (not (/.creation? concern)) @@ -141,7 +141,7 @@ [_ (at fs delete expected_path) poll/3 (at watcher poll []) poll/3' (at watcher poll [])] - (in (and (case poll/3 + (in (and (when poll/3 (list [concern actual_path]) (and (not (/.creation? concern)) (not (/.modification? concern)) @@ -193,7 +193,7 @@ (in (do async.monad [started? (at watcher start /.all directory)] (unit.coverage [/.cannot_poll_a_non_existent_directory] - (case started? + (when started? {try.#Success _} false diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 01bd03616..aa8ed3b58 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -37,7 +37,7 @@ (! Bit))) (do ! [response response] - (case response + (when response {try.#Success response} (|> response product.right @@ -72,7 +72,7 @@ .let [mock (is (/.Client IO) (implementation (def (request method url headers data) - (io.io (let [value (case method + (io.io (let [value (when method {//.#Post} on_post {//.#Get} on_get {//.#Put} on_put diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 8b3da3a10..ce6b1b984 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -105,7 +105,7 @@ failure (at process fail []) wrote! (do ! [write (at process write input)] - (in {try.#Success (case write + (in {try.#Success (when write {try.#Success _} false @@ -113,7 +113,7 @@ (text#= input write))})) destroyed! (do ! [destroy (at process destroy [])] - (in {try.#Success (case destroy + (in {try.#Success (when destroy {try.#Success _} false diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux index 6e3bbff5b..4ca58afca 100644 --- a/stdlib/source/test/lux/world/time.lux +++ b/stdlib/source/test/lux/world/time.lux @@ -76,7 +76,7 @@ (text.prefix <prefix>) (text.suffix <suffix>) (at /.codec decoded) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure error} false)) @@ -86,7 +86,7 @@ (text.prefix <prefix>) (text.suffix <suffix>) (at /.codec decoded) - (pipe.case + (pipe.when {try.#Success _} false @@ -104,7 +104,7 @@ %.nat (format "00:00:00.") (at /.codec decoded) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure error} false))) )))) @@ -129,7 +129,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.time_exceeds_a_day] - (case (/.of_millis out_of_bounds) + (when (/.of_millis out_of_bounds) {try.#Success _} false diff --git a/stdlib/source/test/lux/world/time/date.lux b/stdlib/source/test/lux/world/time/date.lux index e6887f9e0..3dd22343b 100644 --- a/stdlib/source/test/lux/world/time/date.lux +++ b/stdlib/source/test/lux/world/time/date.lux @@ -50,7 +50,7 @@ (do random.monad [expected random.date] (_.coverage [/.invalid_day] - (case (/.date (/.year expected) + (when (/.date (/.year expected) (/.month expected) (n.+ 31 (/.day_of_month expected))) {try.#Failure error} @@ -87,7 +87,7 @@ "-" (%.nat month) "-" (%.nat day))]] (_.coverage [/.invalid_month] - (case (<text>.result /.parser input) + (when (<text>.result /.parser input) {try.#Failure error} (exception.match? /.invalid_month error) diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux index f69727234..c6471ffae 100644 --- a/stdlib/source/test/lux/world/time/day.lux +++ b/stdlib/source/test/lux/world/time/day.lux @@ -61,7 +61,7 @@ (do random.monad [not_a_day (random.upper_case 1)] (_.coverage [/.not_a_day_of_the_week] - (case (at /.codec decoded not_a_day) + (when (at /.codec decoded not_a_day) {try.#Failure error} (exception.match? /.not_a_day_of_the_week error) @@ -74,7 +74,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.invalid_day] - (case (/.by_number invalid) + (when (/.by_number invalid) {try.#Failure error} (exception.match? /.invalid_day error) diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux index cebba07ff..32b4c71f3 100644 --- a/stdlib/source/test/lux/world/time/instant.lux +++ b/stdlib/source/test/lux/world/time/instant.lux @@ -98,7 +98,7 @@ (apply duration.inverse day#pred 6) (apply duration.inverse day#pred 7))))) (_.coverage [/.now] - (case (try (io.run! /.now)) + (when (try (io.run! /.now)) {try.#Success _} true diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux index e7b5f09a2..29117b8d3 100644 --- a/stdlib/source/test/lux/world/time/month.lux +++ b/stdlib/source/test/lux/world/time/month.lux @@ -65,7 +65,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.invalid_month] - (case (/.by_number invalid) + (when (/.by_number invalid) {try.#Failure error} (exception.match? /.invalid_month error) @@ -93,7 +93,7 @@ (do random.monad [not_a_month (random.upper_case 1)] (_.coverage [/.not_a_month_of_the_year] - (case (at /.codec decoded not_a_month) + (when (at /.codec decoded not_a_month) {try.#Failure error} (exception.match? /.not_a_month_of_the_year error) diff --git a/stdlib/source/test/lux/world/time/year.lux b/stdlib/source/test/lux/world/time/year.lux index 32c19dccf..ec4638abd 100644 --- a/stdlib/source/test/lux/world/time/year.lux +++ b/stdlib/source/test/lux/world/time/year.lux @@ -49,14 +49,14 @@ (all _.and (_.coverage [/.year] (bit#= (i.= +0 expected) - (case (/.year expected) + (when (/.year expected) {try.#Success _} false {try.#Failure _} true))) (_.coverage [/.value] - (case (/.year expected) + (when (/.year expected) {try.#Success year} (i.= expected (/.value year)) @@ -64,7 +64,7 @@ (i.= +0 expected))) )) (_.coverage [/.there_is_no_year_0] - (case (/.year +0) + (when (/.year +0) {try.#Success _} false |