aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/meta
diff options
context:
space:
mode:
authorEduardo Julian2022-08-11 04:15:07 -0400
committerEduardo Julian2022-08-11 04:15:07 -0400
commit065e8a4d8122d4616b570496915d2c0e2c78cd6b (patch)
treef2bbdc3e40b796b34026ab04c9a478d8a3f082d5 /stdlib/source/library/lux/meta
parent68d78235694c633c956bb9e8a007cad7d65370bc (diff)
Re-named the "case" macro to "when".
Diffstat (limited to 'stdlib/source/library/lux/meta')
-rw-r--r--stdlib/source/library/lux/meta/code.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/default/init.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/default/platform.lux30
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux26
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/complex.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux28
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux22
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/macro.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux18
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/pattern.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/scope.lux20
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/simple.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/generation.lux18
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux20
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux46
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/case.lux)44
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux142
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux34
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux22
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/common_lisp/common.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/common.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/host.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/common.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux62
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/common.lux20
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/host.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/php/common.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/common.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/host.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/r/common.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/ruby/common.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/scheme/common.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/loop.lux10
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/runtime.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/case.lux)32
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/extension.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/loop.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/case.lux)24
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm.lux18
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/debug.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/loop.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/primitive.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/reference.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/structure.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/case.lux)14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/loop.lux14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/case.lux)24
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php.lux22
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/loop.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/runtime.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/case.lux)38
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python.lux14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/loop.lux18
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/runtime.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/case.lux)40
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/function.lux10
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/loop.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/common.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/host.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/runtime.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/case.lux)12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby.lux14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/function.lux10
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/loop.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux16
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/case.lux)30
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/function.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/loop.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/runtime.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/structure.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/case.lux)12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux14
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux42
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/loop.lux22
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/variable.lux56
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux)58
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/program.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/syntax.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux64
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/synthesis/access.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/synthesis/simple.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/archive.lux18
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/archive/artifact/category.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/archive/module/descriptor.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/cache/dependency/artifact.lux26
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/cache/dependency/module.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/cache/module.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/cli.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/import.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/io/archive.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/io/context.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/packager/jvm.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/phase.lux4
-rw-r--r--stdlib/source/library/lux/meta/compiler/reference.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/reference/variable.lux8
-rw-r--r--stdlib/source/library/lux/meta/configuration.lux4
-rw-r--r--stdlib/source/library/lux/meta/extension.lux2
-rw-r--r--stdlib/source/library/lux/meta/location.lux2
-rw-r--r--stdlib/source/library/lux/meta/macro.lux8
-rw-r--r--stdlib/source/library/lux/meta/macro/context.lux8
-rw-r--r--stdlib/source/library/lux/meta/macro/expansion.lux18
-rw-r--r--stdlib/source/library/lux/meta/macro/local.lux12
-rw-r--r--stdlib/source/library/lux/meta/macro/pattern.lux44
-rw-r--r--stdlib/source/library/lux/meta/macro/syntax.lux14
-rw-r--r--stdlib/source/library/lux/meta/macro/syntax/declaration.lux2
-rw-r--r--stdlib/source/library/lux/meta/macro/syntax/definition.lux4
-rw-r--r--stdlib/source/library/lux/meta/macro/syntax/export.lux2
-rw-r--r--stdlib/source/library/lux/meta/macro/template.lux10
-rw-r--r--stdlib/source/library/lux/meta/static.lux2
-rw-r--r--stdlib/source/library/lux/meta/symbol.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/common_lisp.lux6
-rw-r--r--stdlib/source/library/lux/meta/target/js.lux6
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/attribute.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/bytecode.lux60
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/bytecode/environment.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux8
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/class.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/constant.lux6
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/constant/pool.lux12
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/field.lux2
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/loader.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/method.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/reflection.lux34
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/type/lux.lux6
-rw-r--r--stdlib/source/library/lux/meta/target/jvm/type/signature.lux4
-rw-r--r--stdlib/source/library/lux/meta/target/lua.lux6
-rw-r--r--stdlib/source/library/lux/meta/target/php.lux8
-rw-r--r--stdlib/source/library/lux/meta/target/python.lux10
-rw-r--r--stdlib/source/library/lux/meta/target/r.lux6
-rw-r--r--stdlib/source/library/lux/meta/target/ruby.lux10
-rw-r--r--stdlib/source/library/lux/meta/target/scheme.lux12
-rw-r--r--stdlib/source/library/lux/meta/type.lux48
-rw-r--r--stdlib/source/library/lux/meta/type/check.lux80
-rw-r--r--stdlib/source/library/lux/meta/type/implicit.lux38
-rw-r--r--stdlib/source/library/lux/meta/type/poly.lux6
-rw-r--r--stdlib/source/library/lux/meta/type/primitive.lux2
-rw-r--r--stdlib/source/library/lux/meta/type/quotient.lux2
-rw-r--r--stdlib/source/library/lux/meta/type/refinement.lux10
-rw-r--r--stdlib/source/library/lux/meta/type/resource.lux2
-rw-r--r--stdlib/source/library/lux/meta/version.lux2
172 files changed, 1160 insertions, 1156 deletions
diff --git a/stdlib/source/library/lux/meta/code.lux b/stdlib/source/library/lux/meta/code.lux
index 68d5327b1..0bec080e7 100644
--- a/stdlib/source/library/lux/meta/code.lux
+++ b/stdlib/source/library/lux/meta/code.lux
@@ -62,7 +62,7 @@
(Equivalence Code)
(implementation
(def (= x y)
- (case [x y]
+ (when [x y]
(,, (with_template [<tag> <eq>]
[[[_ {<tag> x'}] [_ {<tag> y'}]]
(at <eq> = x' y')]
@@ -88,7 +88,7 @@
(`` (def .public (format ast)
(-> Code Text)
- (case ast
+ (when ast
(,, (with_template [<tag> <struct>]
[[_ {<tag> value}]
(at <struct> encoded value)]
@@ -125,7 +125,7 @@
(-> Code Code Code Code)
(if (at ..equivalence = original ast)
substitute
- (case ast
+ (when ast
(,, (with_template [<tag>]
[[location {<tag> parts}]
[location {<tag> (list#each (replaced original substitute) parts)}]]
diff --git a/stdlib/source/library/lux/meta/compiler/default/init.lux b/stdlib/source/library/lux/meta/compiler/default/init.lux
index 019edf1c5..7cf349a43 100644
--- a/stdlib/source/library/lux/meta/compiler/default/init.lux
+++ b/stdlib/source/library/lux/meta/compiler/default/init.lux
@@ -103,7 +103,7 @@
(def (read source reader)
(-> Source Reader (///analysis.Operation [Source Code]))
(function (_ [bundle compiler])
- (case (reader source)
+ (when (reader source)
{.#Left [source' error]}
{try.#Failure error}
@@ -211,7 +211,7 @@
[reader (///declaration.lifted_analysis
(..reader module aliases source))]
(function (_ state)
- (case (///phase.result' state (..iteration' wrapper archive expander reader source pre_payload))
+ (when (///phase.result' state (..iteration' wrapper archive expander reader source pre_payload))
{try.#Success [state source&requirements&buffer]}
{try.#Success [state {.#Some source&requirements&buffer}]}
@@ -266,14 +266,14 @@
(..iteration wrapper archive expander module source buffer ///syntax.no_aliases))])
(do !
[[state ?source&requirements&temporary_payload] iteration]
- (case ?source&requirements&temporary_payload
+ (when ?source&requirements&temporary_payload
{.#None}
(do !
[[state [analysis_module [final_buffer final_registry]]]
(<| (///phase.result' state)
(do [! ///phase.monad]
[_ (if (text#= program_module module)
- (case program_definition
+ (when program_definition
{.#Some program_definition}
(///declaration.lifted_generation
(define_program! archive program global program_module program_definition))
diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux
index b0ce99018..12b6c63f1 100644
--- a/stdlib/source/library/lux/meta/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux
@@ -426,7 +426,7 @@
(monad.mix try.monad
(function (_ [extension expected] output)
(with_expansions [<inherited> (dictionary.has extension expected output)]
- (case (dictionary.value extension output)
+ (when (dictionary.value extension output)
{.#None}
{try.#Success <inherited>}
@@ -519,7 +519,7 @@
(do !
[[_ dependence] (stm.update (..depend importer module) dependence)]
(in dependence)))]
- (case (..verify_dependencies importer module dependence)
+ (when (..verify_dependencies importer module dependence)
{try.#Failure error}
(in [(async.resolved {try.#Failure error})
{.#None}])
@@ -532,13 +532,13 @@
{.#None}])
(do !
[@pending (stm.read pending)]
- (case (dictionary.value module @pending)
+ (when (dictionary.value module @pending)
{.#Some [return signal]}
(in [return
{.#None}])
{.#None}
- (case (if (archive.reserved? archive module)
+ (when (if (archive.reserved? archive module)
(do try.monad
[@module (archive.id module archive)]
(in [@module archive]))
@@ -560,14 +560,14 @@
{try.#Failure error}
(in [(async#in {try.#Failure error})
{.#None}]))))))))))))
- _ (case signal
+ _ (when signal
{.#None}
(in [])
{.#Some [context @module resolver]}
(do !
[result (compile customs importer import! @module context module)
- result (case result
+ result (when result
{try.#Failure error}
(in result)
@@ -652,7 +652,7 @@
(do [! (try.with async.monad)]
[]
(if (set.empty? duplicates)
- (case new_dependencies
+ (when new_dependencies
{.#End}
(in [archive (list)])
@@ -672,7 +672,7 @@
(-> (List ///.Custom) Lux_Importer descriptor.Module (Set descriptor.Module) (List descriptor.Module) Lux_Context Lux_Return))
(do (try.with async.monad)
[[archive state/*] (any|after_imports customs import! module duplicates new_dependencies archive)]
- (in [archive (case state/*
+ (in [archive (when state/*
{.#End}
state
@@ -717,9 +717,9 @@
[.let [new_dependencies (the ///.#dependencies compilation)
[all_dependencies duplicates] (with_new_dependencies new_dependencies all_dependencies)]
[archive _] (any|after_imports customs import! module duplicates new_dependencies archive)]
- (case ((the ///.#process compilation) state archive)
+ (when ((the ///.#process compilation) state archive)
{try.#Success [state more|done]}
- (case more|done
+ (when more|done
{.#Left more}
(let [continue! (sharing [state document object]
(is (///.Compilation state document object)
@@ -756,9 +756,9 @@
[.let [new_dependencies (the ///.#dependencies compilation)
[all_dependencies duplicates] (with_new_dependencies new_dependencies all_dependencies)]
[archive state] (lux|after_imports customs import! module duplicates new_dependencies [archive state])]
- (case (next_compilation module [archive state] compilation)
+ (when (next_compilation module [archive state] compilation)
{try.#Success [state more|done]}
- (case more|done
+ (when more|done
{.#Left more}
(let [continue! (sharing [<type_vars>]
(is <Platform>
@@ -773,7 +773,7 @@
[_ (let [report (..module_compilation_log module state)]
(with_expansions [<else> (in (debug.log! report))]
(for @.js (is (Async (Try Any))
- (case console.default
+ (when console.default
{.#None}
<else>
@@ -820,13 +820,13 @@
(loop (again [customs (for @.old (as (List (///.Custom Fake_State Fake_Document Fake_Object))
all_customs)
all_customs)])
- (case customs
+ (when customs
{.#End}
((..lux_compiler import context platform compilation_sources compiler (compiler input))
all_customs importer import! @module [archive lux_state] module)
{.#Item [custom_state custom_key custom_format custom_parser custom_compiler] tail}
- (case (custom_compiler input)
+ (when (custom_compiler input)
{try.#Failure _}
(again tail)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux
index 4a1b68582..7df0d6232 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Tuple Variant Pattern nat int rev case local except)
+ [lux (.except Tuple Variant Pattern nat int rev when local except)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]
@@ -61,7 +61,7 @@
{#Simple Simple}
{#Structure (Complex Analysis)}
{#Reference Reference}
- {#Case Analysis (Match' Analysis)}
+ {#When Analysis (Match' Analysis)}
{#Function (Environment Analysis) Analysis}
{#Apply Analysis Analysis}
{#Extension (Extension Analysis)})))
@@ -83,7 +83,7 @@
(Equivalence Analysis)
(implementation
(def (= reference sample)
- (.case [reference sample]
+ (.when [reference sample]
[{#Simple reference} {#Simple sample}]
(at /simple.equivalence = reference sample)
@@ -93,8 +93,8 @@
[{#Reference reference} {#Reference sample}]
(at reference.equivalence = reference sample)
- [{#Case [reference_analysis reference_match]}
- {#Case [sample_analysis sample_match]}]
+ [{#When [reference_analysis reference_match]}
+ {#When [sample_analysis sample_match]}]
(and (= reference_analysis sample_analysis)
(at (list.equivalence (branch_equivalence =)) = {.#Item reference_match} {.#Item sample_match}))
@@ -119,7 +119,7 @@
(template (<name> content)
[{<tag> content}]))]
- [case ..#Case]
+ [when ..#When]
)
(def .public unit
@@ -166,7 +166,7 @@
(loop (again [abstraction analysis
inputs (is (List Analysis)
(list))])
- (.case abstraction
+ (.when abstraction
{#Apply input next}
(again next {.#Item input inputs})
@@ -200,7 +200,7 @@
(def .public (format analysis)
(Format Analysis)
- (.case analysis
+ (.when analysis
{#Simple it}
(/simple.format it)
@@ -210,7 +210,7 @@
{#Reference reference}
(reference.format reference)
- {#Case analysis match}
+ {#When analysis match}
(%.format "({"
(|> {.#Item match}
(list#each (function (_ [when then])
@@ -259,7 +259,7 @@
(All (_ a) (-> Source (Operation a) (Operation a)))
(function (_ [bundle state])
(let [old_source (the .#source state)]
- (.case (action [bundle (has .#source source state)])
+ (.when (action [bundle (has .#source source state)])
{try.#Success [[bundle' state'] output]}
{try.#Success [[bundle' (has .#source old_source state')]
output]}
@@ -279,7 +279,7 @@
action
(function (_ [bundle state])
(let [old_location (the .#location state)]
- (.case (action [bundle (has .#location location state)])
+ (.when (action [bundle (has .#location location state)])
{try.#Success [[bundle' state'] output]}
{try.#Success [[bundle' (has .#location old_location state')]
output]}
@@ -300,7 +300,7 @@
(def .public (of_try it)
(All (_ a) (-> (Try a) (Operation a)))
(function (_ [bundle state])
- (.case it
+ (.when it
{try.#Failure error}
{try.#Failure (located (the .#location state) error)}
@@ -320,7 +320,7 @@
(def .public (with_exception exception message action)
(All (_ e o) (-> (Exception e) e (Operation o) (Operation o)))
(function (_ bundle,state)
- (.case (exception.with exception message
+ (.when (exception.with exception message
(action bundle,state))
{try.#Failure error}
(let [[bundle state] bundle,state]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/complex.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/complex.lux
index 0d00367b9..40d90f729 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/complex.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/complex.lux
@@ -53,7 +53,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Complex a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Variant [reference_lefts reference_right? reference_value]}
{#Variant [sample_lefts sample_right? sample_value]}]
(and (n.= reference_lefts sample_lefts)
@@ -73,7 +73,7 @@
(..equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (when value
{#Variant [lefts right? value]}
(all n.* 2
(at n.hash hash lefts)
@@ -87,7 +87,7 @@
(def .public (format %it it)
(All (_ a) (-> (Format a) (Format (Complex a))))
- (case it
+ (when it
{#Variant [lefts right? it]}
(%.format "{" (%.nat lefts) " " (%.bit right?) " " (%it it) "}")
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux
index 45097d4a5..3403461fb 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/coverage.lux
@@ -73,7 +73,7 @@
(def (alternatives coverage)
(-> Coverage (List Coverage))
- (case coverage
+ (when coverage
{#Alt left right}
(list.partial left (alternatives right))
@@ -84,7 +84,7 @@
(Equivalence Coverage)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Exhaustive} {#Exhaustive}]
true
@@ -123,7 +123,7 @@
(def .public (format value)
(%.Format Coverage)
- (case value
+ (when value
{#Bit it}
(%.bit it)
@@ -165,7 +165,7 @@
(def .public (coverage pattern)
(-> Pattern (Try Coverage))
- (case pattern
+ (when pattern
(^.or {//pattern.#Simple {//simple.#Unit}}
{//pattern.#Bind _})
{try.#Success {#Exhaustive}}
@@ -190,7 +190,7 @@
... Tuple patterns can be exhaustive if there is exhaustiveness for all of
... their sub-patterns.
{//pattern.#Complex {//complex.#Tuple membersP+}}
- (case (list.reversed membersP+)
+ (when (list.reversed membersP+)
(^.or (list)
(list _))
(exception.except ..invalid_tuple [(list.size membersP+)])
@@ -202,7 +202,7 @@
(function (_ leftP rightC)
(do !
[leftC (coverage leftP)]
- (case rightC
+ (when rightC
{#Exhaustive}
(in leftC)
@@ -249,7 +249,7 @@
(def .public (exhaustive? coverage)
(-> Coverage Bit)
- (case coverage
+ (when coverage
{#Exhaustive}
true
@@ -269,7 +269,7 @@
<redundancy>
... There are now 2 alternative paths.
<alternatively>)]
- (case [addition so_far]
+ (when [addition so_far]
... 2 bit coverages are exhaustive if they complement one another.
[{#Bit sideA} {#Bit sideSF}]
(if (xor sideA sideSF)
@@ -307,7 +307,7 @@
(do [! try.monad]
[casesM (monad.mix !
(function (_ [tagA coverageA] casesSF')
- (case (dictionary.value tagA casesSF')
+ (when (dictionary.value tagA casesSF')
{.#Some coverageSF}
(do !
[coverageM (composite coverageA coverageSF)]
@@ -324,7 +324,7 @@
{#Variant (maybe#composite allA allSF) casesM})))))
[{#Seq leftA rightA} {#Seq leftSF rightSF}]
- (case [(/#= leftSF leftA) (/#= rightSF rightA)]
+ (when [(/#= leftSF leftA) (/#= rightSF rightA)]
... Same prefix
[.true .false]
(do try.monad
@@ -374,14 +374,14 @@
(List Coverage)]))
(function (_ coverageA possibilitiesSF)
(loop (again [altsSF possibilitiesSF])
- (case altsSF
+ (when altsSF
{.#End}
(in [{.#None} (list coverageA)])
{.#Item altSF altsSF'}
(do !
[altMSF (composite coverageA altSF)]
- (case altMSF
+ (when altMSF
{#Alt _}
(do !
[[success altsSF+] (again altsSF')]
@@ -393,12 +393,12 @@
possibilitiesSF (alternatives so_far)])
(do !
[[addition' possibilitiesSF'] (fuse_once addition possibilitiesSF)]
- (case addition'
+ (when addition'
{.#Some addition'}
(again addition' possibilitiesSF')
{.#None}
- (case (list.reversed possibilitiesSF')
+ (when (list.reversed possibilitiesSF')
{.#Item last prevs}
(in (list#mix (function (_ left right) {#Alt left right})
last
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux
index 5bbf38167..d85a576cd 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux
@@ -56,7 +56,7 @@
(def .public (quantified @var @parameter :it:)
(-> check.Var Nat Type Type)
- (case :it:
+ (when :it:
{.#Primitive name co_variant}
{.#Primitive name (list#each (quantified @var @parameter) co_variant)}
@@ -95,7 +95,7 @@
... as a function type, this method of inference should work.
(def (general' vars archive analyse inferT args)
(-> (List check.Var) Archive Phase Type (List Code) (Operation [Type_Context (List check.Var) Type (List Analysis)]))
- (case args
+ (when args
{.#End}
(do phase.monad
[just_before (/type.check check.context)
@@ -103,7 +103,7 @@
(in [just_before vars inferT (list)]))
{.#Item argC args'}
- (case inferT
+ (when inferT
{.#Named name unnamedT}
(general' vars archive analyse unnamedT args)
@@ -118,7 +118,7 @@
(general' vars archive analyse (maybe.trusted (type.applied (list :ex:) inferT)) args))
{.#Apply inputT transT}
- (case (type.applied (list inputT) transT)
+ (when (type.applied (list inputT) transT)
{.#Some outputT}
(general' vars archive analyse outputT args)
@@ -143,7 +143,7 @@
{.#Var infer_id}
(do phase.monad
[?inferT' (/type.check (check.peek infer_id))]
- (case ?inferT'
+ (when ?inferT'
{.#Some inferT'}
(general' vars archive analyse inferT' args)
@@ -159,7 +159,7 @@
(do [! phase.monad]
[[just_before vars :inference: terms] (general' (list) archive analyse inferT args)]
(in [:inference: terms])
- ... (case vars
+ ... (when vars
... (list)
... (in [:inference: terms])
@@ -170,7 +170,7 @@
... [quantifications (monad.mix ! (function (_ @var level)
... (do !
... [:var: (check.try (check.identity vars @var))]
- ... (case :var:
+ ... (when :var:
... {try.#Success _}
... (in level)
@@ -191,7 +191,7 @@
(def (with_recursion @self recursion)
(-> Nat Type Type Type)
(function (again it)
- (case it
+ (when it
(^.or {.#Parameter index}
{.#Apply {.#Primitive "" {.#End}}
{.#Parameter index}})
@@ -227,7 +227,7 @@
(-> (,, (template.spliced <types>)) Type (Operation Type))
(loop (again [depth 0
it complex])
- (case it
+ (when it
{.#Named name it}
(again depth it)
@@ -239,7 +239,7 @@
[.#ExQ])
{.#Apply parameter abstraction}
- (case (type.applied (list parameter) abstraction)
+ (when (type.applied (list parameter) abstraction)
{.#Some it}
(again depth it)
@@ -266,7 +266,7 @@
(|> it
type.flat_variant
(list.after lefts)
- (pipe.case
+ (pipe.when
{.#Item [head tail]}
(let [case (if right?
(type.variant tail)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/macro.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/macro.lux
index cf6ede122..b8bf793ec 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/macro.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/macro.lux
@@ -37,7 +37,7 @@
(function (_ state)
(do try.monad
[output (expander macro inputs state)]
- (case output
+ (when output
{try.#Failure error}
((meta.failure (exception.error ..expansion_failed [name inputs error])) state)
@@ -48,7 +48,7 @@
(-> Expander Symbol Macro (List Code) (Meta Code))
(do meta.monad
[expansion (..expansion expander name macro inputs)]
- (case expansion
+ (when expansion
(list single)
(in single)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux
index 8284b0301..b7a808dbf 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux
@@ -43,7 +43,7 @@
already_existing Global])
(exception.report
(list ["Definition" (%.symbol name)]
- ["Original" (case already_existing
+ ["Original" (when already_existing
{.#Alias alias}
(format "alias " (%.symbol alias))
@@ -63,7 +63,7 @@
state Module_State])
(exception.report
(list ["Module" module]
- ["Desired state" (case state
+ ["Desired state" (when state
{.#Active} "Active"
{.#Compiled} "Compiled"
{.#Cached} "Cached")])))
@@ -110,7 +110,7 @@
(|> state
(the .#modules)
(property.value module)
- (pipe.case
+ (pipe.when
{.#Some _}
true
@@ -126,7 +126,7 @@
[self_name meta.current_module_name
self meta.current_module]
(function (_ state)
- (case (property.value name (the .#definitions self))
+ (when (property.value name (the .#definitions self))
{.#None}
{try.#Success [(revised .#modules
(property.has self_name
@@ -164,9 +164,9 @@
(-> Text (Operation Any))
(///extension.lifted
(function (_ state)
- (case (|> state (the .#modules) (property.value module_name))
+ (when (|> state (the .#modules) (property.value module_name))
{.#Some module}
- (let [active? (case (the .#module_state module)
+ (let [active? (when (the .#module_state module)
{.#Active}
true
@@ -188,10 +188,10 @@
(-> Text (Operation Bit))
(///extension.lifted
(function (_ state)
- (case (|> state (the .#modules) (property.value module_name))
+ (when (|> state (the .#modules) (property.value module_name))
{.#Some module}
{try.#Success [state
- (case (the .#module_state module)
+ (when (the .#module_state module)
{<tag>}
true
@@ -211,7 +211,7 @@
(-> Bit (List Label) Bit Type (Operation Any))
(do [! ///.monad]
[self_name (///extension.lifted meta.current_module_name)
- [type_module type_name] (case type
+ [type_module type_name] (when type
{.#Named type_name _}
(in type_name)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/pattern.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/pattern.lux
index daf608222..836c7c30d 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/pattern.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/pattern.lux
@@ -27,7 +27,7 @@
(Equivalence Pattern)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Simple reference} {#Simple sample}]
(at //simple.equivalence = reference sample)
@@ -42,7 +42,7 @@
(def .public (format it)
(%.Format Pattern)
- (case it
+ (when it
{#Simple it}
(//simple.format it)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/scope.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/scope.lux
index 538874881..c7d17b9cb 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/scope.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/scope.lux
@@ -52,7 +52,7 @@
(-> Text Scope (Maybe [Type Variable]))
(loop (again [idx 0
mappings (the [.#captured .#mappings] scope)])
- (case mappings
+ (when mappings
{.#Item [_name [_source_type _source_ref]] mappings'}
(if (text#= name _name)
{.#Some [_source_type {variable.#Foreign idx}]}
@@ -68,7 +68,7 @@
(def (reference name scope)
(-> Text Scope (Maybe [Type Variable]))
- (case (..local name scope)
+ (when (..local name scope)
{.#Some type}
{.#Some type}
@@ -82,7 +82,7 @@
(let [[inner outer] (|> state
(the .#scopes)
(list.split_when (|>> (reference? name))))]
- (case outer
+ (when outer
{.#End}
{.#Right [state {.#None}]}
@@ -111,7 +111,7 @@
(def .public (with_local [name type] action)
(All (_ a) (-> [Text Type] (Operation a) (Operation a)))
(function (_ [bundle state])
- (case (the .#scopes state)
+ (when (the .#scopes state)
{.#Item head tail}
(let [old_mappings (the [.#locals .#mappings] head)
new_var_id (the [.#locals .#counter] head)
@@ -120,10 +120,10 @@
(|>> (revised .#counter ++)
(revised .#mappings (property.has name [type new_var_id]))))
head)]
- (case (phase.result' [bundle (has .#scopes {.#Item new_head tail} state)]
+ (when (phase.result' [bundle (has .#scopes {.#Item new_head tail} state)]
action)
{try.#Success [[bundle' state'] output]}
- (case (the .#scopes state')
+ (when (the .#scopes state')
{.#Item head' tail'}
(let [scopes' {.#Item (has .#locals (the .#locals head) head')
tail'}]
@@ -152,7 +152,7 @@
(def .public (reset action)
(All (_ a) (-> (Operation a) (Operation a)))
(function (_ [bundle state])
- (case (action [bundle (has .#scopes (list ..empty) state)])
+ (when (action [bundle (has .#scopes (list ..empty) state)])
{try.#Success [[bundle' state'] output]}
{try.#Success [[bundle' (has .#scopes (the .#scopes state) state')]
output]}
@@ -163,9 +163,9 @@
(def .public (with action)
(All (_ a) (-> (Operation a) (Operation [Scope a])))
(function (_ [bundle state])
- (case (action [bundle (revised .#scopes (|>> {.#Item ..empty}) state)])
+ (when (action [bundle (revised .#scopes (|>> {.#Item ..empty}) state)])
{try.#Success [[bundle' state'] output]}
- (case (the .#scopes state')
+ (when (the .#scopes state')
{.#Item head tail}
{try.#Success [[bundle' (has .#scopes tail state')]
[head output]]}
@@ -180,7 +180,7 @@
(Operation Register)
(extension.lifted
(function (_ state)
- (case (the .#scopes state)
+ (when (the .#scopes state)
{.#Item top _}
{try.#Success [state (the [.#locals .#counter] top)]}
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/simple.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/simple.lux
index 4b092ad00..239bb848c 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/simple.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/simple.lux
@@ -31,7 +31,7 @@
(Equivalence Simple)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Unit} {#Unit}]
true
@@ -50,7 +50,7 @@
(def .public (format it)
(Format Simple)
- (case it
+ (when it
{#Unit}
"[]"
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux
index b534b616a..85f275a67 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux
@@ -29,7 +29,7 @@
(def .public (check action)
(All (_ a) (-> (Check a) (Operation a)))
(function (_ (^.let stateE [bundle state]))
- (case (action (the .#type_context state))
+ (when (action (the .#type_context state))
{try.#Success [context' output]}
{try.#Success [[bundle (has .#type_context context' state)]
output]}
@@ -42,7 +42,7 @@
(def .public (existential? type)
(-> Type Bit)
- (case type
+ (when type
{.#Primitive actual {.#End}}
(text.starts_with? ..prefix actual)
@@ -95,7 +95,7 @@
... _ (monad.each ! (function (_ @new)
... (do !
... [:new: (check.try (check.identity new_vars @new))]
- ... (case :new:
+ ... (when :new:
... {try.#Success :new:}
... (in :new:)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/generation.lux b/stdlib/source/library/lux/meta/compiler/language/lux/generation.lux
index 2e1252dec..1b9dbb961 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/generation.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/generation.lux
@@ -125,7 +125,7 @@
(All (_ anchor expression declaration output) <with_type>)
(function (_ body)
(function (_ [bundle state])
- (case (body [bundle (has <tag> {.#Some <with_value>} state)])
+ (when (body [bundle (has <tag> {.#Some <with_value>} state)])
{try.#Success [[bundle' state'] output]}
{try.#Success [[bundle' (has <tag> (the <tag> state) state')]
output]}
@@ -137,7 +137,7 @@
(All (_ anchor expression declaration)
(Operation anchor expression declaration <get_type>))
(function (_ (^.let stateE [bundle state]))
- (case (the <tag> state)
+ (when (the <tag> state)
{.#Some output}
{try.#Success [stateE output]}
@@ -206,7 +206,7 @@
(All (_ anchor expression declaration)
(-> unit.ID [(Maybe unit.ID) expression] (Operation anchor expression declaration Any)))
(function (_ (^.let state+ [bundle state]))
- (case (at (the #host state) evaluate label code)
+ (when (at (the #host state) evaluate label code)
{try.#Success output}
{try.#Success [state+ output]}
@@ -217,7 +217,7 @@
(All (_ anchor expression declaration)
(-> declaration (Operation anchor expression declaration Any)))
(function (_ (^.let state+ [bundle state]))
- (case (at (the #host state) execute code)
+ (when (at (the #host state) execute code)
{try.#Success output}
{try.#Success [state+ output]}
@@ -228,7 +228,7 @@
(All (_ anchor expression declaration)
(-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Operation anchor expression declaration [Text Any declaration])))
(function (_ (^.let stateE [bundle state]))
- (case (at (the #host state) define context custom code)
+ (when (at (the #host state) define context custom code)
{try.#Success output}
{try.#Success [stateE output]}
@@ -240,7 +240,7 @@
(-> artifact.ID (Maybe Text) declaration (Operation anchor expression declaration Any)))
(do [! phase.monad]
[?buffer (extension.read (the #buffer))]
- (case ?buffer
+ (when ?buffer
{.#Some buffer}
... TODO: Optimize by no longer checking for overwrites...
(if (sequence.any? (|>> product.left (n.= artifact_id)) buffer)
@@ -286,7 +286,7 @@
(do try.monad
[[_module output registry] (archive.find _module archive)]
{try.#Success registry}))]
- (case (registry.id _name registry)
+ (when (registry.id _name registry)
{.#None}
(exception.except ..unknown_definition [name (registry.definitions registry)])
@@ -305,7 +305,7 @@
(do try.monad
[[_module output registry] (archive.find _module archive)]
{try.#Success registry}))]
- (case (registry.find_definition _name registry)
+ (when (registry.find_definition _name registry)
{.#None}
(exception.except ..unknown_definition [name (registry.definitions registry)])
@@ -326,7 +326,7 @@
(All (_ anchor expression declaration)
(-> Archive (Operation anchor expression declaration unit.ID)))
(function (_ (^.let stateE [bundle state]))
- (case (the #context state)
+ (when (the #context state)
{.#None}
(exception.except ..no_context [])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux
index a65940d6b..9ea79eab0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux
@@ -22,7 +22,7 @@
["[1][0]" simple]
["[1][0]" complex]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" function]
["/[1]" //
["[1][0]" extension]
@@ -43,7 +43,7 @@
(def variant_analysis
(template (_ analysis archive tag values)
... (-> Phase Archive Symbol (List Code) (Operation Analysis))
- [(case values
+ [(when values
(list value)
(/complex.variant analysis tag archive value)
@@ -53,19 +53,19 @@
(def sum_analysis
(template (_ analysis archive lefts right? values)
... (-> Phase Archive Nat Bit (List Code) (Operation Analysis))
- [(case values
+ [(when values
(list value)
(/complex.sum analysis lefts right? archive value)
_
(/complex.sum analysis lefts right? archive (code.tuple values)))]))
-(def case_analysis
+(def when_analysis
(template (_ analysis archive input branches code)
... (-> Phase Archive Code (List Code) Code (Operation Analysis))
- [(case (list.pairs branches)
+ [(when (list.pairs branches)
{.#Some branches}
- (/case.case analysis branches archive input)
+ (/when.when analysis branches archive input)
{.#None}
(//.except ..invalid [code]))]))
@@ -76,11 +76,11 @@
[(do [! //.monad]
[[functionT functionA] (/type.inferring
(analysis archive functionC))]
- (case functionA
+ (when functionA
(/.constant def_name)
(do !
[?macro (//extension.lifted (meta.macro def_name))]
- (case ?macro
+ (when ?macro
{.#Some macro}
(do !
[expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
@@ -99,7 +99,7 @@
... The location must be set in the state for the sake
... of having useful error messages.
(/.with_location location)
- (case code
+ (when code
(^.with_template [<tag> <analyser>]
[[_ {<tag> value}]
(<analyser> value)])
@@ -120,7 +120,7 @@
(..variant_analysis analysis archive tag values)
(^.` ({(^.,* branches)} (^., input)))
- (..case_analysis analysis archive input branches code)
+ (..when_analysis analysis archive input branches code)
(^.` ([(^., [_ {.#Symbol ["" function_name]}]) (^., [_ {.#Symbol ["" arg_name]}])] (^., body)))
(/function.function analysis function_name arg_name archive body)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux
index ec4a32d05..42d01ad16 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux
@@ -113,7 +113,7 @@
[expectedT (///extension.lifted meta.expected_type)
expectedT' (/type.check (check.clean (list) expectedT))]
(/.with_exception ..cannot_analyse_sum [expectedT' lefts right? valueC]
- (case expectedT
+ (when expectedT
{.#Sum _}
(|> (analyse archive valueC)
(at ! each (|>> [lefts right?] /.variant))
@@ -129,7 +129,7 @@
{.#Var id}
(do !
[?expectedT' (/type.check (check.peek id))]
- (case ?expectedT'
+ (when ?expectedT'
{.#Some expectedT'}
(<| (/type.expecting expectedT')
(again valueC))
@@ -152,11 +152,11 @@
(again valueC))
{.#Apply inputT funT}
- (case funT
+ (when funT
{.#Var funT_id}
(do !
[?funT' (/type.check (check.peek funT_id))]
- (case ?funT'
+ (when ?funT'
{.#Some funT'}
(<| (/type.expecting {.#Apply inputT funT'})
(again valueC))
@@ -165,7 +165,7 @@
(/.except ..invalid_variant_type [expectedT lefts right? valueC])))
_
- (case (type.applied (list inputT) funT)
+ (when (type.applied (list inputT) funT)
{.#Some outputT}
(<| (/type.expecting outputT)
(again valueC))
@@ -184,7 +184,7 @@
.let [case_size (list.size group)
[lefts right?] (/complex.choice case_size idx)]
expectedT (///extension.lifted meta.expected_type)]
- (case expectedT
+ (when expectedT
{.#Var _}
(do !
[inferenceT (/inference.variant lefts right? variantT)
@@ -202,7 +202,7 @@
(is (Operation (List Analysis)))
(loop (again [membersT+ (type.flat_tuple expectedT)
membersC+ members])
- (case [membersT+ membersC+]
+ (when [membersT+ membersC+]
[{.#Item memberT {.#End}} {.#Item memberC {.#End}}]
(<| (at ! each (|>> list))
(/type.expecting memberT)
@@ -231,7 +231,7 @@
(do [! ///.monad]
[expectedT (///extension.lifted meta.expected_type)]
(/.with_exception ..cannot_analyse_tuple [expectedT membersC]
- (case expectedT
+ (when expectedT
{.#Product _}
(..typed_product analyse expectedT archive membersC)
@@ -242,7 +242,7 @@
{.#Var id}
(do !
[?expectedT' (/type.check (check.peek id))]
- (case ?expectedT'
+ (when ?expectedT'
{.#Some expectedT'}
(<| (/type.expecting expectedT')
(product analyse archive membersC))
@@ -268,11 +268,11 @@
(product analyse archive membersC))
{.#Apply inputT funT}
- (case funT
+ (when funT
{.#Var funT_id}
(do !
[?funT' (/type.check (check.peek funT_id))]
- (case ?funT'
+ (when ?funT'
{.#Some funT'}
(<| (/type.expecting {.#Apply inputT funT'})
(product analyse archive membersC))
@@ -281,7 +281,7 @@
(/.except ..invalid_tuple_type [expectedT membersC])))
_
- (case (type.applied (list inputT) funT)
+ (when (type.applied (list inputT) funT)
{.#Some outputT}
(<| (/type.expecting outputT)
(product analyse archive membersC))
@@ -302,7 +302,7 @@
(loop (again [input record
output (is (List [Symbol Code])
{.#End})])
- (case input
+ (when input
(list.partial [_ {.#Symbol ["" slotH]}] valueH tail)
(if pattern_matching?
(///#in {.#None})
@@ -337,7 +337,7 @@
(do meta.monad
[head_k (meta.normal head_k)]
(meta.try (meta.slot head_k))))]
- (case slotH'
+ (when slotH'
{try.#Success [_ slot_set recordT]}
(do !
[.let [size_record (list.size record)
@@ -351,7 +351,7 @@
(function (_ [key val] idx->val)
(do !
[key (///extension.lifted (meta.normal key))]
- (case (dictionary.value key tag->idx)
+ (when (dictionary.value key tag->idx)
{.#Some idx}
(if (dictionary.key? idx->val idx)
(/.except ..cannot_repeat_slot [key record])
@@ -372,13 +372,13 @@
(def .public (order pattern_matching? record)
(-> Bit (List [Symbol Code]) (Operation (Maybe [Nat (List Code) Type])))
- (case record
+ (when record
... empty_record = empty_tuple = unit/any = []
{.#End}
(///#in {.#Some [0 (list) .Any]})
{.#Item [head_k head_v] _}
- (case head_k
+ (when head_k
["" head_k']
(if pattern_matching?
(///#in {.#None})
@@ -394,7 +394,7 @@
(def .public (record analyse archive members)
(-> Phase Archive (List Code) (Operation Analysis))
- (case members
+ (when members
(list)
//simple.unit
@@ -405,9 +405,9 @@
(do [! ///.monad]
[head_k (///extension.lifted (meta.normal pseudo_slot))
slot (///extension.lifted (meta.try (meta.slot head_k)))]
- (case slot
+ (when slot
{try.#Success [_ slot_set recordT]}
- (case (list.size slot_set)
+ (when (list.size slot_set)
1 (analyse archive singletonC)
_ (..product analyse archive members))
@@ -417,21 +417,21 @@
_
(do [! ///.monad]
[?members (..normal false members)]
- (case ?members
+ (when ?members
{.#None}
(..product analyse archive members)
{.#Some slots}
(do !
[record_size,membersC,recordT (..order false slots)]
- (case record_size,membersC,recordT
+ (when record_size,membersC,recordT
{.#None}
(..product analyse archive members)
{.#Some [record_size membersC recordT]}
(do !
[expectedT (///extension.lifted meta.expected_type)]
- (case expectedT
+ (when expectedT
{.#Var _}
(do !
[inferenceT (/inference.record record_size recordT)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux
index b14ae34cc..7864fd3d5 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux
@@ -59,7 +59,7 @@
[expectedT (///extension.lifted meta.expected_type)]
(loop (again [expectedT expectedT])
(/.with_exception ..cannot_analyse [expectedT function_name arg_name body]
- (case expectedT
+ (when expectedT
{.#Function :input: :output:}
(<| (at ! each (.function (_ [scope bodyA])
{/.#Function (list#each (|>> /.variable)
@@ -77,7 +77,7 @@
(again :anonymous:)
{.#Apply argT funT}
- (case (type.applied (list argT) funT)
+ (when (type.applied (list argT) funT)
{.#Some value}
(again value)
@@ -97,7 +97,7 @@
{.#Var id}
(do !
[?expectedT' (/type.check (check.peek id))]
- (case ?expectedT'
+ (when ?expectedT'
{.#Some expectedT'}
(again expectedT')
@@ -115,7 +115,7 @@
?:input: (check.try (check.identity (list @output) @input))
? (check.linked? @input @output)
_ (<| (check.check expectedT)
- (case ?:input:
+ (when ?:input:
{try.#Success :input:}
{.#Function :input: (if ?
:input:
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux
index cbee3c622..d71fa4ad0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux
@@ -45,7 +45,7 @@
(with_expansions [<return> (in (|> def_name ///reference.constant {/.#Reference}))]
(do [! ///.monad]
[constant (///extension.lifted (meta.definition def_name))]
- (case constant
+ (when constant
{.#Alias real_def_name}
(definition quoted_module real_def_name)
@@ -91,7 +91,7 @@
(-> Text (Operation (Maybe Analysis)))
(do [! ///.monad]
[?var (/scope.variable var_name)]
- (case ?var
+ (when ?var
{.#Some [actualT ref]}
(do !
[_ (/type.inference actualT)]
@@ -102,11 +102,11 @@
(def .public (reference quoted_module it)
(-> Text Symbol (Operation Analysis))
- (case it
+ (when it
["" simple_name]
(do [! ///.monad]
[?var (variable simple_name)]
- (case ?var
+ (when ?var
{.#Some varA}
(in varA)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux
index 6c637184c..ceb60e374 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Pattern case)
+ [lux (.except Pattern when)
[abstract
["[0]" monad (.only do)]]
[control
@@ -73,7 +73,7 @@
(def (quantified envs baseT)
(-> (List (List Type)) Type Type)
- (.case envs
+ (.when envs
{.#End}
baseT
@@ -81,22 +81,22 @@
(quantified tail {.#UnivQ head baseT})))
... Type-checking on the input value is done during the analysis of a
-... "case" expression, to ensure that the patterns being used make
+... "when" expression, to ensure that the patterns being used make
... sense for the type of the input value.
... Sometimes, that input value is complex, by depending on
... type-variables or quantifications.
-... This function makes it easier for "case" analysis to properly
+... This function makes it easier for "when" analysis to properly
... type-check the input with respect to the patterns.
(def .public (tuple :it:)
(-> Type (Check [(List check.Var) Type]))
(loop (again [envs (is (List (List Type))
(list))
:it: :it:])
- (.case :it:
+ (.when :it:
{.#Var id}
(do check.monad
[?:it:' (check.peek id)]
- (.case ?:it:'
+ (.when ?:it:'
{.#Some :it:'}
(again envs :it:')
@@ -118,11 +118,11 @@
{.#Apply _}
(do [! check.monad]
[.let [[:abstraction: :parameters:] (type.flat_application :it:)]
- :abstraction: (.case :abstraction:
+ :abstraction: (.when :abstraction:
{.#Var @abstraction}
(do !
[?:abstraction: (check.peek @abstraction)]
- (.case ?:abstraction:
+ (.when ?:abstraction:
{.#Some :abstraction:}
(in :abstraction:)
@@ -131,7 +131,7 @@
_
(in :abstraction:))]
- (.case (type.applied :parameters: :abstraction:)
+ (.when (type.applied :parameters: :abstraction:)
{.#Some :it:}
(again envs :it:)
@@ -163,13 +163,13 @@
Type (List Code) (Operation a) (Operation [Pattern a])))
(do [! ///.monad]
[[@ex_var+ :input:'] (/type.check (..tuple :input:))]
- (.case :input:'
+ (.when :input:'
{.#Product _}
(let [matches (loop (again [types (type.flat_tuple :input:')
patterns sub_patterns
output (is (List [Type Code])
{.#End})])
- (.case [types patterns]
+ (.when [types patterns]
[{.#End} {.#End}]
output
@@ -226,7 +226,7 @@
... pattern, and not separately.
(def (pattern_analysis num_tags :input: pattern next)
(All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a])))
- (.case pattern
+ (.when pattern
[location {.#Symbol ["" name]}]
(/.with_location location
(do ///.monad
@@ -254,16 +254,16 @@
(do [! ///.monad]
[record (//complex.normal true sub_patterns)
record_size,members,recordT (is (Operation (Maybe [Nat (List Code) Type]))
- (.case record
+ (.when record
{.#Some record}
(//complex.order true record)
{.#None}
(in {.#None})))]
- (.case record_size,members,recordT
+ (.when record_size,members,recordT
{.#Some [record_size members recordT]}
(do !
- [_ (.case :input:
+ [_ (.when :input:
{.#Var @input}
(/type.check (do check.monad
[? (check.bound? @input)]
@@ -273,7 +273,7 @@
_
(in []))]
- (.case members
+ (.when members
(list singleton)
(pattern_analysis {.#None} :input: singleton next)
@@ -287,13 +287,13 @@
(/.with_location location
(do ///.monad
[[@ex_var+ :input:'] (/type.check (..tuple :input:))]
- (.case :input:'
+ (.when :input:'
{.#Sum _}
(let [flat_sum (type.flat_variant :input:')
size_sum (list.size flat_sum)
num_cases (maybe.else size_sum num_tags)
idx (/complex.tag right? lefts)]
- (.case (list.item idx flat_sum)
+ (.when (list.item idx flat_sum)
(^.multi {.#Some caseT}
(n.< num_cases idx))
(do ///.monad
@@ -337,9 +337,9 @@
(/.except ..invalid [pattern])
))
-(def .public (case analyse branches archive inputC)
+(def .public (when analyse branches archive inputC)
(-> Phase (List [Code Code]) Phase)
- (.case branches
+ (.when branches
{.#Item [patternH bodyH] branchesT}
(do [! ///.monad]
[[:input: inputA] (<| /type.inferring
@@ -351,14 +351,14 @@
branchesT)
outputHC (|> outputH product.left /coverage.coverage /.of_try)
outputTC (monad.each ! (|>> product.left /coverage.coverage /.of_try) outputT)
- _ (.case (monad.mix try.monad /coverage.composite outputHC outputTC)
+ _ (.when (monad.mix try.monad /coverage.composite outputHC outputTC)
{try.#Success coverage}
(///.assertion ..non_exhaustive [inputC branches coverage]
(/coverage.exhaustive? coverage))
{try.#Failure error}
(/.failure error))]
- (in {/.#Case inputA [outputH outputT]}))
+ (in {/.#When inputA [outputH outputT]}))
{.#End}
(/.except ..empty_branches [])))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux
index 4fd6f0ed3..cd102ce48 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux
@@ -47,7 +47,7 @@
(-> Archive ///analysis.Bundle evaluation.Eval
Eval)
(function (_ type code lux)
- (case (compiler_eval archive type code [bundle lux])
+ (when (compiler_eval archive type code [bundle lux])
{try.#Success [[_bundle lux'] value]}
{try.#Success [lux' value]}
@@ -62,12 +62,12 @@
(loop (again [state state
input expansion
output /.no_requirements])
- (case input
+ (when input
{.#End}
{try.#Success [state output]}
{.#Item head tail}
- (case (phase archive head state)
+ (when (phase archive head state)
{try.#Success [state' head']}
(again state' tail (/.merge_requirements head' output))
@@ -89,7 +89,7 @@
(the [//extension.#state /.#generation /.#phase] state)))
extension_eval (as Eval (wrapper (as_expected compiler_eval)))]
_ (//.with (has [//extension.#state /.#analysis /.#state //extension.#state .#eval] extension_eval state))]
- (case code
+ (when code
[_ {.#Form (list.partial [_ {.#Text name}] inputs)}]
(//extension.apply archive again [name inputs])
@@ -99,11 +99,11 @@
(do !
[macroA (<| (///analysis/type.expecting Macro)
(analysis archive macro))]
- (case macroA
+ (when macroA
(///analysis.constant macro_name)
(do !
[?macro (//extension.lifted (meta.macro macro_name))
- macro (case ?macro
+ macro (when ?macro
{.#Some macro}
(in macro)
@@ -113,7 +113,7 @@
_
(//.except ..invalid_macro_call code))))]
- (case expansion
+ (when expansion
(list.partial <lux_def_module> referrals)
(|> (again archive <lux_def_module>)
(at ! each (revised /.#referrals (list#composite referrals))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux
index 5606f0a5e..0ad49b88e 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux
@@ -99,7 +99,7 @@
(All (_ s i o)
(-> (Extender s i o) Name (Handler s i o) (Operation s i o Any)))
(function (_ [bundle state])
- (case (dictionary.has' name (extender handler) bundle)
+ (when (dictionary.has' name (extender handler) bundle)
{try.#Success bundle'}
{try.#Success [[bundle' state]
[]]}
@@ -121,7 +121,7 @@
(All (_ s i o)
(-> Archive (Phase s i o) (Extension i) (Operation s i o o)))
(function (_ (^.let stateE [bundle state]))
- (case (dictionary.value name bundle)
+ (when (dictionary.value name bundle)
{.#Some handler}
(((handler name phase) archive parameters)
stateE)
@@ -136,7 +136,7 @@
(function (_ operation)
(function (_ [bundle state])
(let [old (get state)]
- (case (operation [bundle (set (transform old) state)])
+ (when (operation [bundle (set (transform old) state)])
{try.#Success [[bundle' state'] output]}
{try.#Success [[bundle' (set old state')] output]}
@@ -149,7 +149,7 @@
(-> (Operation s i o v) (Operation s i o v))))
(function (_ operation)
(function (_ [bundle state])
- (case (operation [bundle (transform state)])
+ (when (operation [bundle (transform state)])
{try.#Success [[bundle' state'] output]}
{try.#Success [[bundle' state] output]}
@@ -177,7 +177,7 @@
(All (_ s i o v)
(-> (//.Operation s v) (Operation s i o v)))
(function (_ [bundle state])
- (case (action state)
+ (when (action state)
{try.#Success [state' output]}
{try.#Success [[bundle state'] output]}
@@ -188,7 +188,7 @@
(All (_ s i o v)
(-> (Operation s i o v) (//.Operation s v)))
(function (_ state)
- (case (it [..empty state])
+ (when (it [..empty state])
{try.#Success [[_ state'] output]}
{try.#Success [state' output]}
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
index e072e7d9d..9b8eabe1b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -395,16 +395,16 @@
(def lux_array_type
(template (_ :read: :write:)
- [{.#Primitive array.type_name (list {.#Apply :write: {.#Apply :read: _Mutable}})}]))
+ [{.#Primitive array.primitive (list {.#Apply :write: {.#Apply :read: _Mutable}})}]))
(def (jvm_type luxT)
(-> .Type (Operation (Type Value)))
- (case luxT
+ (when luxT
{.#Named name anonymousT}
(jvm_type anonymousT)
{.#Apply inputT abstractionT}
- (case (type.applied (list inputT) abstractionT)
+ (when (type.applied (list inputT) abstractionT)
{.#Some outputT}
(jvm_type outputT)
@@ -415,9 +415,9 @@
(phase#each jvm.array (jvm_type elemT))
{.#Primitive class parametersT}
- (case (dictionary.value class ..boxes)
+ (when (dictionary.value class ..boxes)
{.#Some [_ primitive_type]}
- (case parametersT
+ (when parametersT
{.#End}
(phase#in primitive_type)
@@ -431,7 +431,7 @@
(function (_ parameterT)
(do phase.monad
[parameterJT (jvm_type parameterT)]
- (case (parser.parameter? parameterJT)
+ (when (parser.parameter? parameterJT)
{.#Some parameterJT}
(in parameterJT)
@@ -461,7 +461,7 @@
(def (primitive_array_length_handler primitive_type)
(-> (Type Primitive) Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list arrayC)
(do phase.monad
[_ (typeA.inference ..int)
@@ -477,7 +477,7 @@
(def array::length::object
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list arrayC)
(<| typeA.with_var
(function (_ [@read :read:]))
@@ -499,7 +499,7 @@
(def (new_primitive_array_handler primitive_type)
(-> (Type Primitive) Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list lengthC)
(do phase.monad
[lengthA (<| (typeA.expecting ..int)
@@ -514,14 +514,14 @@
(def array::new::object
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list lengthC)
(do phase.monad
[lengthA (<| (typeA.expecting ..int)
(analyse archive lengthC))
expectedT (///.lifted meta.expected_type)
expectedJT (jvm_array_type expectedT)
- elementJT (case (parser.array? expectedJT)
+ elementJT (when (parser.array? expectedJT)
{.#Some elementJT}
(in elementJT)
@@ -535,7 +535,7 @@
(def (check_parameter objectT)
(-> .Type (Operation (Type Parameter)))
- (case objectT
+ (when objectT
(lux_array_type elementT _)
(/////analysis.except ..non_parameter objectT)
@@ -563,7 +563,7 @@
{.#Var @var}
(do phase.monad
[:var: (typeA.check (check.peek @var))]
- (case :var:
+ (when :var:
{.#Some :var:}
(check_parameter :var:)
@@ -581,7 +581,7 @@
[.#ExQ])
{.#Apply inputT abstractionT}
- (case (type.applied (list inputT) abstractionT)
+ (when (type.applied (list inputT) abstractionT)
{.#Some outputT}
(check_parameter outputT)
@@ -596,7 +596,7 @@
(def (check_jvm objectT)
(-> .Type (Operation (Type Value)))
- (case objectT
+ (when objectT
{.#Primitive name {.#End}}
(`` (cond (,, (with_template [<type>]
[(text#= (..reflection <type>) name)
@@ -652,7 +652,7 @@
[.#ExQ])
{.#Apply inputT abstractionT}
- (case (type.applied (list inputT) abstractionT)
+ (when (type.applied (list inputT) abstractionT)
{.#Some outputT}
(check_jvm outputT)
@@ -665,7 +665,7 @@
(with_template [<name> <category> <parser>]
[(def .public (<name> mapping typeJ)
(-> Mapping (Type <category>) (Operation .Type))
- (case (|> typeJ ..signature (<text>.result (<parser> mapping)))
+ (when (|> typeJ ..signature (<text>.result (<parser> mapping)))
{try.#Success check}
(typeA.check check)
@@ -698,7 +698,7 @@
(def (read_primitive_array_handler lux_type jvm_type)
(-> .Type (Type Primitive) Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list idxC arrayC)
(do phase.monad
[_ (typeA.inference lux_type)
@@ -715,7 +715,7 @@
(def array::read::object
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list idxC arrayC)
(<| typeA.with_var
(function (_ [@read :read:]))
@@ -742,7 +742,7 @@
(let [array_type {.#Primitive (|> (jvm.array jvm_type) ..reflection)
(list)}]
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list idxC valueC arrayC)
(do phase.monad
[_ (typeA.inference array_type)
@@ -762,7 +762,7 @@
(def array::write::object
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list idxC valueC arrayC)
(<| typeA.with_var
(function (_ [@read :read:]))
@@ -840,7 +840,7 @@
(def object::null
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list)
(do phase.monad
[expectedT (///.lifted meta.expected_type)
@@ -854,7 +854,7 @@
(def object::null?
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list objectC)
(do phase.monad
[_ (typeA.inference .Bit)
@@ -869,7 +869,7 @@
(def object::synchronized
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list monitorC exprC)
(do phase.monad
[[monitorT monitorA] (typeA.inferring
@@ -884,7 +884,7 @@
(def (object::throw class_loader)
(-> java/lang/ClassLoader Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list exceptionC)
(do phase.monad
[_ (typeA.inference Nothing)
@@ -904,9 +904,9 @@
(def (object::class class_loader)
(-> java/lang/ClassLoader Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list classC)
- (case classC
+ (when classC
[_ {.#Text class}]
(do phase.monad
[_ (..ensure_fresh_class! class_loader class)
@@ -949,7 +949,7 @@
super_class (phase.lifted (reflection!.load class_loader super_name))
superT (reflection_type mapping superJT)]
(in [[super_name superT] (java/lang/Class::isAssignableFrom super_class to_class)])))
- (case (java/lang/Class::getGenericSuperclass from_class)
+ (when (java/lang/Class::getGenericSuperclass from_class)
{.#Some super}
(list.partial super (array.list {.#None} (java/lang/Class::getGenericInterfaces from_class)))
@@ -962,7 +962,7 @@
(def (object::cast class_loader)
(-> java/lang/ClassLoader Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list fromC)
(do [! phase.monad]
[toT (///.lifted meta.expected_type)
@@ -1006,7 +1006,7 @@
(do !
[candidate_parents (is (Operation (List [[Text .Type] Bit]))
(class_candidate_parents class_loader current_name currentT to_name to_class))]
- (case (|> candidate_parents
+ (when (|> candidate_parents
(list.only product.right)
(list#each product.left))
{.#Item [next_name nextT] _}
@@ -1014,7 +1014,7 @@
{.#End}
(in false)))))
- (in (case [(type#= java/lang/Object fromT)
+ (in (when [(type#= java/lang/Object fromT)
(parser.array? toJT)]
[.true {.#Some _}]
true
@@ -1154,21 +1154,21 @@
(def (de_aliased aliasing)
(-> Aliasing (Type Value) (Type Value))
(function (again it)
- (`` (<| (case (parser.var? it)
+ (`` (<| (when (parser.var? it)
{.#Some name}
(|> aliasing
(dictionary.value name)
(maybe#each jvm.var)
(maybe.else it))
{.#None})
- (case (parser.class? it)
+ (when (parser.class? it)
{.#Some [name parameters]}
(|> parameters
(list#each (|>> again (as (Type Parameter))))
(jvm.class name))
{.#None})
(,, (with_template [<read> <as> <write>]
- [(case (<read> it)
+ [(when (<read> it)
{.#Some :sub:}
(<write> (as (Type <as>) (again :sub:)))
{.#None})]
@@ -1189,13 +1189,13 @@
.let [modifiers (java/lang/reflect/Method::getModifiers method)
correct_class? (java/lang/Class::isAssignableFrom class (java/lang/reflect/Method::getDeclaringClass method))
correct_method? (text#= method_name (java/lang/reflect/Method::getName method))
- same_static? (case method_style
+ same_static? (when method_style
{#Static}
(java/lang/reflect/Modifier::isStatic modifiers)
_
true)
- same_special? (case method_style
+ same_special? (when method_style
{#Special}
(not (or (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers class))
(java/lang/reflect/Modifier::isAbstract modifiers)))
@@ -1262,7 +1262,7 @@
(def (return_type it)
(-> java/lang/reflect/Method (Try (Type Return)))
(reflection!.return
- (case (java/lang/reflect/Method::getGenericReturnType it)
+ (when (java/lang/reflect/Method::getGenericReturnType it)
{.#Some it}
it
@@ -1272,7 +1272,7 @@
(def (method_signature method_style method)
(-> Method_Style java/lang/reflect/Method (Operation Method_Signature))
(let [owner (java/lang/reflect/Method::getDeclaringClass method)
- owner_tvars (case method_style
+ owner_tvars (when method_style
{#Static}
(list)
@@ -1303,7 +1303,7 @@
(phase#each (monad.each ! (..reflection_type mapping)))
phase#conjoint)
.let [methodT (<| (type.univ_q (dictionary.size mapping))
- (type.function (case method_style
+ (type.function (when method_style
{#Static}
inputsT
@@ -1358,7 +1358,7 @@
(with_template [<name> <tag>]
[(def <name>
(-> Evaluation (Maybe Method_Signature))
- (|>> (pipe.case
+ (|>> (pipe.when
{<tag> output}
{.#Some output}
@@ -1391,7 +1391,7 @@
(-> (java/lang/Class java/lang/Object)
(List (java/lang/Class java/lang/Object)))
(let [interfaces (array.list {.#None} (java/lang/Class::getInterfaces it))
- supers (case (java/lang/Class::getSuperclass it)
+ supers (when (java/lang/Class::getSuperclass it)
{.#Some class}
(list.partial class interfaces)
@@ -1440,7 +1440,7 @@
(|>> {#Pass})
(|>> {#Hint}))
(method_signature method_style method)))))))]
- (case (list.all pass candidates)
+ (when (list.all pass candidates)
{.#Item method {.#End}}
(in method)
@@ -1474,7 +1474,7 @@
(|>> {#Pass})
(|>> {#Hint}))
(constructor_signature constructor))))))]
- (case (list.all pass candidates)
+ (when (list.all pass candidates)
{.#Item constructor {.#End}}
(in constructor)
@@ -1539,7 +1539,7 @@
_ (phase.assertion ..deprecated_method [class method methodT]
(not deprecated?))
[outputT allA] (inference.general archive analyse methodT (list.partial objectC (list#each product.right argsTC)))
- .let [[objectA argsA] (case allA
+ .let [[objectA argsA] (when allA
{.#Item objectA argsA}
[objectA argsA]
@@ -1564,7 +1564,7 @@
_ (phase.assertion ..deprecated_method [class method methodT]
(not deprecated?))
[outputT allA] (inference.general archive analyse methodT (list.partial objectC (list#each product.right argsTC)))
- .let [[objectA argsA] (case allA
+ .let [[objectA argsA] (when allA
{.#Item objectA argsA}
[objectA argsA]
@@ -1592,7 +1592,7 @@
_ (phase.assertion ..deprecated_method [class_name method methodT]
(not deprecated?))
[outputT allA] (inference.general archive analyse methodT (list.partial objectC (list#each product.right argsTC)))
- .let [[objectA argsA] (case allA
+ .let [[objectA argsA] (when allA
{.#Item objectA argsA}
[objectA argsA]
@@ -1790,7 +1790,7 @@
(def .public (visibility_analysis visibility)
(-> Visibility Analysis)
- (/////analysis.text (case visibility
+ (/////analysis.text (when visibility
{#Public} ..public_tag
{#Private} ..private_tag
{#Protected} ..protected_tag
@@ -1897,13 +1897,13 @@
(def (with_fake_parameter#pattern it)
(-> pattern.Pattern pattern.Pattern)
- (case it
+ (when it
{pattern.#Simple _}
it
{pattern.#Complex it}
{pattern.#Complex
- (case it
+ (when it
{complex.#Variant it}
{complex.#Variant (revised complex.#value with_fake_parameter#pattern it)}
@@ -1915,13 +1915,13 @@
(def (with_fake_parameter it)
(-> Analysis Analysis)
- (case it
+ (when it
{/////analysis.#Simple _}
it
{/////analysis.#Structure it}
{/////analysis.#Structure
- (case it
+ (when it
{complex.#Variant it}
{complex.#Variant (revised complex.#value with_fake_parameter it)}
@@ -1930,10 +1930,10 @@
{/////analysis.#Reference it}
{/////analysis.#Reference
- (case it
+ (when it
{reference.#Variable it}
{reference.#Variable
- (case it
+ (when it
{variable.#Local it}
{variable.#Local (++ it)}
@@ -1943,8 +1943,8 @@
{reference.#Constant _}
it)}
- {/////analysis.#Case value [head tail]}
- {/////analysis.#Case (with_fake_parameter value)
+ {/////analysis.#When value [head tail]}
+ {/////analysis.#When (with_fake_parameter value)
(let [with_fake_parameter (is (-> /////analysis.Branch /////analysis.Branch)
(|>> (revised /////analysis.#when with_fake_parameter#pattern)
(revised /////analysis.#then with_fake_parameter)))]
@@ -1967,13 +1967,13 @@
(-> Nat Analysis Analysis)
(<| /////analysis.tuple
(list (/////analysis.unit))
- (case arity
+ (when arity
(^.or 0 1)
bodyA
2
(let [forced_refencing (/////analysis.tuple (list#each (|>> /////analysis.local) (list.indices (++ arity))))]
- {/////analysis.#Case (/////analysis.unit)
+ {/////analysis.#When (/////analysis.unit)
[[/////analysis.#when
{pattern.#Bind 2}
@@ -1983,7 +1983,7 @@
_
(let [forced_refencing (/////analysis.tuple (list#each (|>> /////analysis.local) (list.indices (++ arity))))]
- {/////analysis.#Case (/////analysis.unit)
+ {/////analysis.#When (/////analysis.unit)
[[/////analysis.#when
{pattern.#Complex
{complex.#Tuple
@@ -2044,7 +2044,7 @@
(list#each (|>> /////analysis.variable)
(scope.environment scope))
(<| (..hidden_method_body arity)
- (case arity
+ (when arity
0 (with_fake_parameter bodyA)
_ bodyA))}
))))))
@@ -2148,7 +2148,7 @@
(list#each (|>> /////analysis.variable)
(scope.environment scope))
(<| (..hidden_method_body arity)
- (case arity
+ (when arity
0 (with_fake_parameter bodyA)
_ bodyA))}
))))))
@@ -2274,7 +2274,7 @@
(def (override_mapping mapping supers parent_type)
(-> Mapping (List (Type Class)) (Type Class) (Operation (List [Text .Type])))
(let [[parent_name parent_parameters] (parser.read_class parent_type)]
- (case (list.one (function (_ super)
+ (when (list.one (function (_ super)
(let [[super_name super_parameters] (parser.read_class super)]
(if (text#= parent_name super_name)
{.#Some super_parameters}
@@ -2353,7 +2353,7 @@
(list#each (|>> /////analysis.variable)
(scope.environment scope))
(<| (..hidden_method_body arity)
- (case arity
+ (when arity
0 (with_fake_parameter bodyA)
_ bodyA))}
))))))
@@ -2397,7 +2397,7 @@
(list.size actual_parameters)))]
(in (|> (list.zipped_2 expected_parameters actual_parameters)
(list#mix (function (_ [expected actual] mapping)
- (case (parser.var? actual)
+ (when (parser.var? actual)
{.#Some actual}
(dictionary.has actual expected mapping)
@@ -2493,17 +2493,17 @@
(def (field_definition field)
(-> Field (Resource field.Field))
- (case field
+ (when field
... TODO: Handle annotations.
{#Constant [name annotations type value]}
- (case value
+ (when value
(^.with_template [<tag> <type> <constant>]
[[_ {<tag> value}]
(do pool.monad
[constant (`` (|> value (,, (template.spliced <constant>))))
attribute (attribute.constant constant)]
(field.field ..constant::modifier name true <type> (sequence.sequence attribute)))])
- ([.#Bit jvm.boolean [(pipe.case #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]]
+ ([.#Bit jvm.boolean [(pipe.when #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]]
[.#Int jvm.byte [.i64 i32.i32 constant.integer pool.integer]]
[.#Int jvm.short [.i64 i32.i32 constant.integer pool.integer]]
[.#Int jvm.int [.i64 i32.i32 constant.integer pool.integer]]
@@ -2525,7 +2525,7 @@
(def method_privacy
(-> ffi.Privacy (Modifier method.Method))
- (|>> (pipe.case
+ (|>> (pipe.when
{ffi.#PublicP} method.public
{ffi.#PrivateP} method.private
{ffi.#ProtectedP} method.protected
@@ -2536,7 +2536,7 @@
(def (mock_value valueT)
(-> (Type Value) (Bytecode Any))
- (case (jvm.primitive? valueT)
+ (when (jvm.primitive? valueT)
{.#Left classT}
_.aconst_null
@@ -2555,14 +2555,14 @@
(def (mock_return :return:)
(-> (Type Return) (Bytecode Any))
- (case (jvm.void? :return:)
+ (when (jvm.void? :return:)
{.#Right :return:}
_.return
{.#Left valueT}
(all _.composite
(mock_value valueT)
- (case (jvm.primitive? valueT)
+ (when (jvm.primitive? valueT)
{.#Left classT}
_.areturn
@@ -2581,7 +2581,7 @@
(def (mock_method super method)
(-> (Type Class) (Method_Definition Code) (Resource method.Method))
- (case method
+ (when method
{#Constructor [privacy strict_floating_point? annotations variables exceptions
self arguments constructor_arguments
body]}
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
index df5a61fc9..98912da07 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -42,7 +42,7 @@
(-> Text Phase Archive s (Operation Analysis))]
Handler))
(function (_ extension_name analyse archive args)
- (case (<code>.result syntax args)
+ (when (<code>.result syntax args)
{try.#Success inputs}
(handler extension_name analyse archive inputs)
@@ -91,7 +91,7 @@
(Parser text.Char)
(do <>.monad
[raw <code>.text]
- (case (text.size raw)
+ (when (text.size raw)
1 (in (|> raw (text.char 0) maybe.trusted))
_ (<>.failure (exception.error ..char_text_must_be_size_1 [raw])))))
@@ -137,7 +137,7 @@
(def lux::try
Handler
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list opC)
(<| typeA.with_var
(function (_ [@var :var:]))
@@ -154,7 +154,7 @@
(def lux::in_module
Handler
(function (_ extension_name analyse archive argsC+)
- (case argsC+
+ (when argsC+
(list [_ {.#Text module_name}] exprC)
(////analysis.with_current_module module_name
(analyse archive exprC))
@@ -165,7 +165,7 @@
(def (lux::type::check eval)
(-> Eval Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list typeC valueC)
(do [! ////.monad]
[actualT (at ! each (|>> (as Type))
@@ -180,7 +180,7 @@
(def (lux::type::as eval)
(-> Eval Handler)
(function (_ extension_name analyse archive args)
- (case args
+ (when args
(list typeC valueC)
(do [! ////.monad]
[actualT (at ! each (|>> (as Type))
@@ -217,7 +217,7 @@
input_type (loop (again [input_name (symbol .Macro')])
(do !
[input_type (///.lifted (meta.definition (symbol .Macro')))]
- (case input_type
+ (when input_type
(^.or {.#Definition [exported? def_type def_value]}
{.#Type [exported? def_value labels]})
(in (as Type def_value))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
index 16dc3bc08..942f931d8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
@@ -103,7 +103,7 @@
(def method_privacy
(-> ffi.Privacy (Modifier method.Method))
- (|>> (pipe.case
+ (|>> (pipe.when
{ffi.#PublicP} method.public
{ffi.#PrivateP} method.private
{ffi.#ProtectedP} method.protected
@@ -227,17 +227,17 @@
(def (field_definition field)
(-> Field (Resource field.Field))
- (case field
+ (when field
... TODO: Handle annotations.
{#Constant [name annotations type value]}
- (case value
+ (when value
(^.with_template [<tag> <type> <constant>]
[[_ {<tag> value}]
(do pool.monad
[constant (`` (|> value (,, (template.spliced <constant>))))
attribute (attribute.constant constant)]
(field.field ..constant::modifier name true <type> (sequence.sequence attribute)))])
- ([.#Bit type.boolean [(pipe.case #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]]
+ ([.#Bit type.boolean [(pipe.when #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]]
[.#Int type.byte [.i64 i32.i32 constant.integer pool.integer]]
[.#Int type.short [.i64 i32.i32 constant.integer pool.integer]]
[.#Int type.int [.i64 i32.i32 constant.integer pool.integer]]
@@ -414,7 +414,7 @@
(def (method_argument lux_register argumentT jvm_register)
(-> Register (Type Value) Register [Register (Bytecode Any)])
- (case (type.primitive? argumentT)
+ (when (type.primitive? argumentT)
{.#Left argumentT}
[(n.+ 1 jvm_register)
(if (n.= lux_register jvm_register)
@@ -460,7 +460,7 @@
(<| (let [[privacy strict_floating_point? annotations method_tvars exceptions
self arguments constructor_argumentsS
bodyS] method
- bodyS (case (list.size arguments)
+ bodyS (when (list.size arguments)
0 (host.without_fake_parameter bodyS)
_ bodyS)])
(do [! phase.monad]
@@ -495,14 +495,14 @@
(def (method_return returnT)
(-> (Type Return) (Bytecode Any))
- (case (type.void? returnT)
+ (when (type.void? returnT)
{.#Right returnT}
_.return
{.#Left returnT}
- (case (type.primitive? returnT)
+ (when (type.primitive? returnT)
{.#Left returnT}
- (case (type.class? returnT)
+ (when (type.class? returnT)
{.#Some class_name}
(all _.composite
(_.checkcast returnT)
@@ -537,7 +537,7 @@
[.let [[super method_name strict_floating_point? annotations
method_tvars self arguments returnJ exceptionsJ
bodyS] method
- bodyS (case (list.size arguments)
+ bodyS (when (list.size arguments)
0 (host.without_fake_parameter bodyS)
_ bodyS)]
generate declaration.generation]
@@ -564,7 +564,7 @@
[.let [[method_name privacy final? strict_floating_point? annotations method_tvars
self arguments returnJ exceptionsJ
bodyS] method
- bodyS (case (list.size arguments)
+ bodyS (when (list.size arguments)
0 (host.without_fake_parameter bodyS)
_ bodyS)]
generate declaration.generation]
@@ -627,7 +627,7 @@
(def (method_generation archive super_class method)
(-> Archive (Type Class) (Method_Definition Synthesis) (Operation (Resource Method)))
- (case method
+ (when method
{#Constructor method}
(..constructor_method_generation archive super_class method)
@@ -656,7 +656,7 @@
(do phase.monad
[methodA (is (Operation Analysis)
(declaration.lifted_analysis
- (case methodC
+ (when methodC
{#Constructor method}
(jvm.analyse_constructor_method analyse archive selfT mapping method)
@@ -709,7 +709,7 @@
(def (mock_value valueT)
(-> (Type Value) (Bytecode Any))
- (case (type.primitive? valueT)
+ (when (type.primitive? valueT)
{.#Left classT}
_.aconst_null
@@ -728,14 +728,14 @@
(def (mock_return returnT)
(-> (Type Return) (Bytecode Any))
- (case (type.void? returnT)
+ (when (type.void? returnT)
{.#Right returnT}
_.return
{.#Left valueT}
(all _.composite
(mock_value valueT)
- (case (type.primitive? valueT)
+ (when (type.primitive? valueT)
{.#Left classT}
_.areturn
@@ -754,7 +754,7 @@
(def (mock_method super method)
(-> (Type Class) (Method_Definition Code) (Resource method.Method))
- (case method
+ (when method
{#Constructor [privacy strict_floating_point? annotations variables exceptions
self arguments constructor_arguments
body]}
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux
index 4b93daa97..c917dd6a0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux
@@ -66,7 +66,7 @@
(Operation anchor expression declaration Requirements))]
(Handler anchor expression declaration)))
(function (_ extension_name phase archive inputs)
- (case (<code>.result syntax inputs)
+ (when (<code>.result syntax inputs)
{try.#Success inputs}
(handler extension_name phase archive inputs)
@@ -126,7 +126,7 @@
[dependencies (cache/artifact.dependencies archive codeS)
[interim_artifacts codeG] (/////generation.with_interim_artifacts archive
(generate archive codeS))
- .let [@abstraction (case codeS
+ .let [@abstraction (when codeS
(/////synthesis.function/abstraction [env arity body])
(|> interim_artifacts
list.last
@@ -152,7 +152,7 @@
[_ code//type codeA] (/////declaration.lifted_analysis
(scope.with
(typeA.fresh
- (case expected
+ (when expected
{.#None}
(do !
[[code//type codeA] (typeA.inferring
@@ -245,7 +245,7 @@
(def (lux::def expander host_analysis)
(-> Expander /////analysis.Bundle Handler)
(function (_ extension_name phase archive inputsC+)
- (case inputsC+
+ (when inputsC+
(list [_ {.#Symbol ["" short_name]}] valueC exported?C)
(do phase.monad
[current_module (/////declaration.lifted_analysis
@@ -288,13 +288,13 @@
[type valueT value] (..definition archive full_name {.#Some .Type} valueC)
labels (/////declaration.lifted_analysis
(do phase.monad
- [.let [[record? labels] (case labels
+ [.let [[record? labels] (when labels
{.#Left tags}
[false tags]
{.#Right slots}
[true slots])]
- _ (case labels
+ _ (when labels
{.#End}
(moduleA.define short_name {.#Definition [exported? type value]})
@@ -325,7 +325,7 @@
(monad.each ! (function (_ [module alias])
(do !
[_ (moduleA.import module)]
- (case alias
+ (when alias
"" (in [])
_ (moduleA.alias alias module))))
imports))]
@@ -351,7 +351,7 @@
(do phase.monad
[current_module (///.lifted meta.current_module_name)
constant (///.lifted (meta.definition original))]
- (case constant
+ (when constant
{.#Alias de_aliased}
(phase.except ..cannot_alias_an_alias [[current_module alias] original de_aliased])
@@ -393,7 +393,7 @@
(function (again type)
(if (type#= original type)
replacement
- (case type
+ (when type
{.#Primitive name parameters}
{.#Primitive name (list#each again parameters)}
@@ -425,7 +425,7 @@
(-> [Type Type Type] Extender
(Handler anchor expression declaration)))
(function (handler extension_name phase archive inputsC+)
- (case inputsC+
+ (when inputsC+
(list nameC valueC)
(do phase.monad
[target_platform (/////declaration.lifted_analysis
@@ -433,7 +433,7 @@
[_ _ name] (evaluate! archive Text nameC)
[_ handlerV] (<definer> archive (as Text name)
(let [raw_type (type_literal <def_type>)]
- (case target_platform
+ (when target_platform
(^.or @.jvm
@.js)
raw_type
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
index 41b1165c9..cda183698 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
@@ -31,7 +31,7 @@
["[0]" reference]
["//" common_lisp
["[1][0]" runtime (.only Operation Phase Handler Bundle Generator)]
- ["[1][0]" case]]]
+ ["[1][0]" when]]]
[//
["[0]" generation]
["[0]" synthesis (.only %synthesis)
@@ -45,7 +45,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/common.lux
index 772660310..d6db61d49 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/common.lux
@@ -31,7 +31,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]]]
[//
@@ -46,7 +46,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
@@ -101,7 +101,7 @@
(def .public (statement expression archive synthesis)
Phase!
- (case synthesis
+ (when synthesis
... TODO: Get rid of this ASAP
{synthesis.#Extension "lux syntax char case!" parameters}
(do /////.monad
@@ -126,17 +126,17 @@
([synthesis.#Reference]
[synthesis.#Extension])
- (synthesis.branch/case case)
- (//case.case! statement expression archive case)
+ (synthesis.branch/when when)
+ (//when.when! statement expression archive when)
(synthesis.branch/exec it)
- (//case.exec! statement expression archive it)
+ (//when.exec! statement expression archive it)
(synthesis.branch/let let)
- (//case.let! statement expression archive let)
+ (//when.let! statement expression archive let)
(synthesis.branch/if if)
- (//case.if! statement expression archive if)
+ (//when.if! statement expression archive if)
(synthesis.loop/scope scope)
(//loop.scope! statement expression archive scope)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/host.lux
index b15b0ae3f..2f7766332 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/js/host.lux
@@ -143,7 +143,7 @@
(in (_.closure g!inputs
(all _.then
(_.define g!abstraction abstractionG)
- (_.return (case (.nat arity)
+ (_.return (when (.nat arity)
0 (_.apply_1 g!abstraction //runtime.unit)
1 (_.apply g!abstraction g!inputs)
_ (_.apply_1 g!abstraction (_.array g!inputs)))))))))]))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/common.lux
index 9520433e1..bc81d188e 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/common.lux
@@ -49,7 +49,7 @@
(-> Text Phase Archive s (Operation (Bytecode Any)))]
Handler))
(function (_ extension_name phase archive input)
- (case (<synthesis>.result parser input)
+ (when (<synthesis>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux
index ced11c93e..0d7953920 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -372,9 +372,9 @@
(Parser (Type Object))
(do <>.monad
[arrayJT (<text>.then parser.array <synthesis>.text)]
- (case (parser.array? arrayJT)
+ (when (parser.array? arrayJT)
{.#Some elementJT}
- (case (parser.object? elementJT)
+ (when (parser.object? elementJT)
{.#Some elementJT}
(in elementJT)
@@ -665,7 +665,7 @@
[valueG (generate archive valueS)]
(in (all _.composite
valueG
- (case (parser.object? :unboxed:)
+ (when (parser.object? :unboxed:)
{.#Some :unboxed:}
(_.checkcast :unboxed:)
@@ -697,7 +697,7 @@
[valueG (generate archive valueS)
objectG (generate archive objectS)
.let [:class: (type.class class (list))
- putG (case (parser.object? :unboxed:)
+ putG (when (parser.object? :unboxed:)
{.#Some :unboxed:}
(all _.composite
(_.checkcast :unboxed:)
@@ -723,7 +723,7 @@
(-> Phase Archive Input (Operation (Typed (Bytecode Any))))
(do //////.monad
[valueG (generate archive valueS)]
- (case (type.primitive? valueT)
+ (when (type.primitive? valueT)
{.#Right valueT}
(in [valueT valueG])
@@ -734,7 +734,7 @@
(def (prepare_output outputT)
(-> (Type Return) (Bytecode Any))
- (case (type.void? outputT)
+ (when (type.void? outputT)
{.#Right outputT}
..unitG
@@ -825,7 +825,7 @@
(def .public (hidden_method_body arity body)
(-> Nat Synthesis Synthesis)
(with_expansions [<oops> (panic! (%.format (%.nat arity) " " (synthesis.%synthesis body)))]
- (case [arity body]
+ (when [arity body]
(^.or [0 _]
[1 _])
body
@@ -833,9 +833,9 @@
[2 {synthesis.#Control {synthesis.#Branch {synthesis.#Let _ 2 (synthesis.tuple (list _ hidden))}}}]
hidden
- [_ {synthesis.#Control {synthesis.#Branch {synthesis.#Case _ path}}}]
+ [_ {synthesis.#Control {synthesis.#Branch {synthesis.#When _ path}}}]
(loop (again [path (is Path path)])
- (case path
+ (when path
{synthesis.#Seq _ next}
(again next)
@@ -852,7 +852,7 @@
(-> (-> Synthesis Synthesis)
(-> Path Path))
(function (again it)
- (case it
+ (when it
(^.or {synthesis.#Pop}
{synthesis.#Access _})
it
@@ -884,13 +884,13 @@
(def .public (without_fake_parameter it)
(-> Synthesis Synthesis)
- (case it
+ (when it
{synthesis.#Simple _}
it
{synthesis.#Structure it}
{synthesis.#Structure
- (case it
+ (when it
{complex.#Variant it}
{complex.#Variant (revised complex.#value without_fake_parameter it)}
@@ -899,10 +899,10 @@
{synthesis.#Reference it}
{synthesis.#Reference
- (case it
+ (when it
{//////reference.#Variable it}
{//////reference.#Variable
- (case it
+ (when it
{//////variable.#Local it}
{//////variable.#Local (-- it)}
@@ -914,10 +914,10 @@
{synthesis.#Control it}
{synthesis.#Control
- (case it
+ (when it
{synthesis.#Branch it}
{synthesis.#Branch
- (case it
+ (when it
{synthesis.#Exec before after}
{synthesis.#Exec (without_fake_parameter before)
(without_fake_parameter after)}
@@ -936,13 +936,13 @@
{synthesis.#Get members
(without_fake_parameter record)}
- {synthesis.#Case value path}
- {synthesis.#Case (without_fake_parameter value)
+ {synthesis.#When value path}
+ {synthesis.#When (without_fake_parameter value)
(without_fake_parameter#path without_fake_parameter path)})}
{synthesis.#Loop it}
{synthesis.#Loop
- (case it
+ (when it
{synthesis.#Scope [synthesis.#start start
synthesis.#inits inits
synthesis.#iteration iteration]}
@@ -955,7 +955,7 @@
{synthesis.#Function it}
{synthesis.#Function
- (case it
+ (when it
{synthesis.#Abstraction [synthesis.#environment environment
synthesis.#arity arity
synthesis.#body body]}
@@ -995,7 +995,7 @@
strict_fp? annotations vars
self_name arguments returnT exceptionsT
(<| (..hidden_method_body arity)
- (case arity
+ (when arity
0 (without_fake_parameter body)
_ body))]]))))
@@ -1003,7 +1003,7 @@
(-> (-> Synthesis Synthesis)
(-> Path Path))
(function (again path)
- (case path
+ (when path
(synthesis.path/then bodyS)
(synthesis.path/then (normalize bodyS))
@@ -1039,7 +1039,7 @@
(def (normalize_method_body mapping)
(-> Mapping Synthesis Synthesis)
(function (again body)
- (case body
+ (when body
(^.with_template [<tag>]
[<tag>
body])
@@ -1058,8 +1058,8 @@
(maybe.else var)
synthesis.variable)
- (synthesis.branch/case [inputS pathS])
- (synthesis.branch/case [(again inputS) (normalize_path again pathS)])
+ (synthesis.branch/when [inputS pathS])
+ (synthesis.branch/when [(again inputS) (normalize_path again pathS)])
(synthesis.branch/exec [this that])
(synthesis.branch/exec [(again this) (again that)])
@@ -1081,7 +1081,7 @@
(synthesis.function/abstraction [environment arity bodyS])
(synthesis.function/abstraction [(list#each (function (_ captured)
- (case captured
+ (when captured
(synthesis.variable var)
(|> mapping
(dictionary.value captured)
@@ -1116,7 +1116,7 @@
inputs! (|> inputsTG
list.enumeration
(list#each (function (_ [register [type term]])
- (let [then! (case (type.primitive? type)
+ (let [then! (when (type.primitive? type)
{.#Right type}
(///value.unwrap type)
@@ -1161,14 +1161,14 @@
(def (returnG returnT)
(-> (Type Return) (Bytecode Any))
- (case (type.void? returnT)
+ (when (type.void? returnT)
{.#Right returnT}
_.return
{.#Left returnT}
- (case (type.primitive? returnT)
+ (when (type.primitive? returnT)
{.#Left returnT}
- (case (type.class? returnT)
+ (when (type.class? returnT)
{.#Some class_name}
(all _.composite
(_.checkcast returnT)
@@ -1221,7 +1221,7 @@
(def (prepare_argument lux_register argumentT jvm_register)
(-> Register (Type Value) Register [Register (Bytecode Any)])
- (case (type.primitive? argumentT)
+ (when (type.primitive? argumentT)
{.#Left argumentT}
[(n.+ 1 jvm_register)
(if (n.= lux_register jvm_register)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/common.lux
index 8fdfccda4..80882cbbd 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/common.lux
@@ -34,7 +34,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]]]
[//
@@ -50,7 +50,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
@@ -63,7 +63,7 @@
(def .public (statement expression archive synthesis)
Phase!
- (case synthesis
+ (when synthesis
... TODO: Get rid of this ASAP
{synthesis.#Extension "lux syntax char case!" parameters}
(do /////.monad
@@ -88,17 +88,17 @@
([synthesis.#Reference]
[synthesis.#Extension])
- (synthesis.branch/case case)
- (//case.case! statement expression archive case)
+ (synthesis.branch/when when)
+ (//when.when! statement expression archive when)
(synthesis.branch/exec it)
- (//case.exec! statement expression archive it)
+ (//when.exec! statement expression archive it)
(synthesis.branch/let let)
- (//case.let! statement expression archive let)
+ (//when.let! statement expression archive let)
(synthesis.branch/if if)
- (//case.if! statement expression archive if)
+ (//when.if! statement expression archive if)
(synthesis.loop/scope scope)
(do /////.monad
@@ -123,7 +123,7 @@
(function (_ extension_name phase archive [input else conditionals])
(|> conditionals
(list#each (function (_ [chars branch])
- {synthesis.#Seq (case chars
+ {synthesis.#Seq (when chars
{.#End}
{synthesis.#Pop}
@@ -139,7 +139,7 @@
{synthesis.#Alt pre post})
{synthesis.#Then else})
[input]
- (//case.case! statement phase archive)
+ (//when.when! statement phase archive)
(at /////.monad each (|>> (as Expression)))))]))
(def lux_procs
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/host.lux
index 603d2efb2..5072f1488 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/lua/host.lux
@@ -180,7 +180,7 @@
(list.repeated (.nat arity) []))]
(in (<| (_.closure g!inputs)
_.return
- (case (.nat arity)
+ (when (.nat arity)
0 (_.apply (list //runtime.unit) abstractionG)
1 (_.apply g!inputs abstractionG)
_ (_.apply (list (_.array g!inputs)) abstractionG))))))]))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/php/common.lux
index 8fcabe6e4..00c99a594 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/php/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/php/common.lux
@@ -31,7 +31,7 @@
["[0]" reference]
["//" php
["[1][0]" runtime (.only Operation Phase Handler Bundle Generator)]
- ["[1][0]" case]]]
+ ["[1][0]" when]]]
[//
["[0]" synthesis (.only %synthesis)
["<s>" \\parser (.only Parser)]]
@@ -45,7 +45,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
@@ -84,8 +84,8 @@
branchG])))
conditionals))
.let [foreigns (|> conditionals
- (list#each (|>> product.right synthesis.path/then //case.dependencies))
- (list.partial (//case.dependencies (synthesis.path/then else)))
+ (list#each (|>> product.right synthesis.path/then //when.dependencies))
+ (list.partial (//when.dependencies (synthesis.path/then else)))
list.together
(set.of_list _.hash)
set.list)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/common.lux
index b4a6a8f0c..5bb154a47 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/common.lux
@@ -36,7 +36,7 @@
["[1][0]" structure]
["[1][0]" reference]
["[1][0]" function]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]]]
[//
[analysis (.only)]
@@ -48,7 +48,7 @@
(def .public (statement expression archive synthesis)
Phase!
- (case synthesis
+ (when synthesis
... TODO: Get rid of this ASAP
{synthesis.#Extension "lux syntax char case!" parameters}
(do /////.monad
@@ -73,15 +73,15 @@
([synthesis.#Reference]
[synthesis.#Extension])
- (synthesis.branch/case case)
- (//case.case! false statement expression archive case)
+ (synthesis.branch/when when)
+ (//when.when! false statement expression archive when)
(^.with_template [<tag> <generator>]
[(<tag> value)
(<generator> statement expression archive value)])
- ([synthesis.branch/exec //case.exec!]
- [synthesis.branch/let //case.let!]
- [synthesis.branch/if //case.if!]
+ ([synthesis.branch/exec //when.exec!]
+ [synthesis.branch/let //when.let!]
+ [synthesis.branch/if //when.if!]
[synthesis.loop/scope //loop.scope!]
[synthesis.loop/again //loop.again!])
@@ -95,7 +95,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<synthesis>.result parser input)
+ (when (<synthesis>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/host.lux
index 3354e69db..fde1ab399 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/python/host.lux
@@ -140,7 +140,7 @@
g!inputs (monad.each ! (function (_ _) (variable "input"))
(list.repeated (.nat arity) []))]
(in (_.lambda g!inputs
- (case (.nat arity)
+ (when (.nat arity)
0 (_.apply (list //runtime.unit) abstractionG)
1 (_.apply g!inputs abstractionG)
_ (_.apply (list (_.list g!inputs)) abstractionG))))))]))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/r/common.lux
index b2dbae1f3..faab4946a 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/r/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/r/common.lux
@@ -31,7 +31,7 @@
["[0]" reference]
["//" r
["[1][0]" runtime (.only Operation Phase Handler Bundle Generator)]
- ["[1][0]" case]]]
+ ["[1][0]" when]]]
[//
["[0]" synthesis (.only %synthesis)
["<s>" \\parser (.only Parser)]]
@@ -45,7 +45,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/ruby/common.lux
index dca8af12f..9c136ef38 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/ruby/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/ruby/common.lux
@@ -35,7 +35,7 @@
["[1][0]" structure]
["[1][0]" reference]
["[1][0]" function]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]]]
[//
["[0]" generation]
@@ -50,7 +50,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
@@ -59,7 +59,7 @@
(def .public (statement expression archive synthesis)
Phase!
- (case synthesis
+ (when synthesis
... TODO: Get rid of this ASAP
{synthesis.#Extension "lux syntax char case!" parameters}
(do /////.monad
@@ -85,15 +85,15 @@
([synthesis.#Reference]
[synthesis.#Extension])
- (synthesis.branch/case case)
- (//case.case! false statement expression archive case)
+ (synthesis.branch/when when)
+ (//when.when! false statement expression archive when)
(^.with_template [<tag> <generator>]
[(<tag> value)
(<generator> statement expression archive value)])
- ([synthesis.branch/exec //case.exec!]
- [synthesis.branch/let //case.let!]
- [synthesis.branch/if //case.if!]
+ ([synthesis.branch/exec //when.exec!]
+ [synthesis.branch/let //when.let!]
+ [synthesis.branch/if //when.if!]
[synthesis.loop/scope //loop.scope!]
[synthesis.loop/again //loop.again!])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/scheme/common.lux
index 2b8bbcba8..9eec19a4a 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/scheme/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/generation/scheme/common.lux
@@ -31,7 +31,7 @@
["[0]" reference]
["//" scheme
["[1][0]" runtime (.only Operation Phase Handler Bundle Generator)]
- ["[1][0]" case]]]
+ ["[1][0]" when]]]
[//
["[0]" generation]
["[0]" synthesis (.only %synthesis)
@@ -45,7 +45,7 @@
(-> Text (Generator s))]
Handler))
(function (_ extension_name phase archive input)
- (case (<s>.result parser input)
+ (when (<s>.result parser input)
{try.#Success input'}
(handler extension_name phase archive input')
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp.lux
index 1168d5b8b..0f1867ff7 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp.lux
@@ -11,7 +11,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]
["/[1]" //
@@ -28,7 +28,7 @@
(def .public (generate archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -45,12 +45,12 @@
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
[////synthesis.tuple /structure.tuple]
- [////synthesis.branch/let /case.let]
- [////synthesis.branch/if /case.if]
- [////synthesis.branch/get /case.get]
+ [////synthesis.branch/let /when.let]
+ [////synthesis.branch/if /when.if]
+ [////synthesis.branch/get /when.get]
[////synthesis.function/apply /function.apply]
- [////synthesis.branch/case /case.case]
+ [////synthesis.branch/when /when.when]
[////synthesis.loop/scope /loop.scope]
[////synthesis.loop/again /loop.again]
[////synthesis.function/abstraction /function.function])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/function.lux
index 6b6fd617d..5a9e65883 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/function.lux
@@ -17,7 +17,7 @@
["[0]" //
["[1][0]" runtime (.only Operation Phase Generator)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -43,7 +43,7 @@
(def (with_closure inits function_definition)
(-> (List (Expression Any)) (Expression Any) (Operation (Expression Any)))
- (case inits
+ (when inits
{.#End}
(at ///////phase.monad in function_definition)
@@ -57,7 +57,7 @@
(_.funcall/+ [(_.function/1 @closure) inits]))))))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def .public (function expression archive [environment arity bodyS])
(Generator (Abstraction Synthesis))
@@ -73,7 +73,7 @@
arityG (|> arity .int _.int)
@num_args (_.var "num_args")
@self (_.var (///reference.artifact function_name))
- initialize_self! [(//case.register 0) (_.function/1 @self)]
+ initialize_self! [(//when.register 0) (_.function/1 @self)]
initialize! [(|> (list.indices arity)
(list#each ..input)
_.args)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/loop.lux
index ad1f110de..d2dcb8802 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/loop.lux
@@ -17,12 +17,12 @@
["_" common_lisp (.only Expression)]]]]]
["[0]" //
[runtime (.only Operation Phase Generator)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[0]"synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -35,7 +35,7 @@
(def .public (scope expression archive [start initsS+ bodyS])
(Generator (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -52,7 +52,7 @@
(in (_.let (|> initsG+
list.enumeration
(list#each (function (_ [idx init])
- [(|> idx (n.+ start) //case.register)
+ [(|> idx (n.+ start) //when.register)
init]))
(list.partial [@output _.nil]))
(list (_.tagbody (list @scope
@@ -66,7 +66,7 @@
argsO+ (monad.each ! (expression archive) argsS+)
.let [bindings (|> argsO+
list.enumeration
- (list#each (|>> product.left (n.+ offset) //case.register))
+ (list#each (|>> product.left (n.+ offset) //when.register))
_.args)]]
(in (_.progn (list (_.multiple_value_setq bindings (_.values/* argsO+))
(_.go tag))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/runtime.lux
index 77f1e5cfd..9294d4335 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/runtime.lux
@@ -110,7 +110,7 @@
(macro.with_symbols [g!_]
(let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
runtime_name (` (_.var (, (code.text (%.code runtime)))))]
- (case declaration
+ (when declaration
{.#Left name}
(let [g!name (code.local name)
code_nameC (code.local (format "@" name))]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/structure.lux
index af4d6023b..c4aabc6f2 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/structure.lux
@@ -17,7 +17,7 @@
(def .public (tuple expression archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/when.lux
index cd5ef69ad..731102b94 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/common_lisp/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case let if)
+ [lux (.except when let if)
[abstract
["[0]" monad (.only do)]]
[data
@@ -25,7 +25,7 @@
["[1][0]" reference]
["/[1]" //
["[1][0]" synthesis
- ["[1]/[0]" case]]
+ ["[1]/[0]" when]]
["/[1]" //
["[1][0]" synthesis (.only Member Synthesis Path)]
["[1][0]" generation]
@@ -65,7 +65,7 @@
(do ///////phase.monad
[valueG (expression archive valueS)]
(in (list#mix (function (_ side source)
- (.let [method (.case side
+ (.let [method (.when side
(^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
@@ -113,11 +113,11 @@
(list.partial (_.setq @temp (|> idx <prep> .int _.int (//runtime.sum//get @variant <flag>)))
(.if simple?
(_.when <failure_condition>
- (_.go @fail))
+ (_.go @fail))
(_.if <failure_condition>
(_.go @fail)
(..push! @temp)))
- (.case next!
+ (.when next!
{.#Some next!}
(list next!)
@@ -140,7 +140,7 @@
(def (pattern_matching' expression archive)
(Generator [Var/1 _.Tag _.Tag Path])
(function (again [$output @done @fail pathP])
- (.case pathP
+ (.when pathP
(/////synthesis.path/then bodyS)
(at ///////phase.monad each
(function (_ outputV)
@@ -157,7 +157,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again [$output @done @fail thenP])
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again [$output @done @fail elseP])
@@ -210,7 +210,7 @@
[/////synthesis.member/right //runtime.tuple//right])
(/////synthesis.!multi_pop nextP)
- (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)]
+ (.let [[extra_pops nextP'] (////synthesis/when.count_pops nextP)]
(do ///////phase.monad
[next! (again [$output @done @fail nextP'])]
(///////phase#in (_.progn (list (..multi_pop! (n.+ 2 extra_pops))
@@ -218,7 +218,7 @@
(/////synthesis.path/alt preP postP)
(do [! ///////phase.monad]
- [@otherwise (at ! each (|>> %.nat (format "lux_case_otherwise") _.tag) /////generation.next)
+ [@otherwise (at ! each (|>> %.nat (format "lux_when_otherwise") _.tag) /////generation.next)
pre! (again [$output @done @otherwise preP])
post! (again [$output @done @fail postP])]
(in (..alternation @otherwise pre! post!)))
@@ -232,24 +232,24 @@
(def (pattern_matching $output expression archive pathP)
(-> Var/1 (Generator Path))
(do [! ///////phase.monad]
- [@done (at ! each (|>> %.nat (format "lux_case_done") _.tag) /////generation.next)
- @fail (at ! each (|>> %.nat (format "lux_case_fail") _.tag) /////generation.next)
+ [@done (at ! each (|>> %.nat (format "lux_when_done") _.tag) /////generation.next)
+ @fail (at ! each (|>> %.nat (format "lux_when_fail") _.tag) /////generation.next)
pattern_matching! (pattern_matching' expression archive [$output @done @fail pathP])]
(in (_.tagbody
(list pattern_matching!
@fail
- (_.error/1 (_.string ////synthesis/case.pattern_matching_error))
+ (_.error/1 (_.string ////synthesis/when.pattern_matching_error))
@done)))))
-(def .public (case expression archive [valueS pathP])
+(def .public (when expression archive [valueS pathP])
(Generator [Synthesis Path])
(do [! ///////phase.monad]
[initG (expression archive valueS)
- $output (at ! each (|>> %.nat (format "lux_case_output") _.var) /////generation.next)
+ $output (at ! each (|>> %.nat (format "lux_when_output") _.var) /////generation.next)
pattern_matching! (pattern_matching $output expression archive pathP)
.let [storage (|> pathP
- ////synthesis/case.storage
- (the ////synthesis/case.#bindings)
+ ////synthesis/when.storage
+ (the ////synthesis/when.#bindings)
set.list
(list#each (function (_ register)
[(..register register)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/extension.lux
index 9d2c7e1db..3566da9bf 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/extension.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/extension.lux
@@ -39,7 +39,7 @@
(generation.Handler (, g!anchor) (, g!expression) (, g!declaration))))
(function ((, g!_) (, g!extension))
(function ((, g!_) (, g!name) (, g!phase) (, g!archive) (, g!inputs))
- (case (, g!inputs)
+ (when (, g!inputs)
(list (,* g!input+))
(do ///.monad
[(,* (|> g!input+
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js.lux
index 864edbf16..009b99257 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js.lux
@@ -15,7 +15,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]
["/[1]" //
@@ -37,7 +37,7 @@
(def (expression archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -55,20 +55,20 @@
{synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (synthesis.branch/case case)
- (/case.case ///extension/common.statement expression archive case)
+ (synthesis.branch/when when)
+ (/when.when ///extension/common.statement expression archive when)
(synthesis.branch/exec it)
- (/case.exec expression archive it)
+ (/when.exec expression archive it)
(synthesis.branch/let let)
- (/case.let expression archive let)
+ (/when.let expression archive let)
(synthesis.branch/if if)
- (/case.if expression archive if)
+ (/when.if expression archive if)
(synthesis.branch/get get)
- (/case.get expression archive get)
+ (/when.get expression archive get)
(synthesis.loop/scope scope)
(/loop.scope ///extension/common.statement expression archive scope)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/function.lux
index 5d5cf5e13..f0bb48d3d 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/function.lux
@@ -15,7 +15,7 @@
["[0]" //
["[1][0]" runtime (.only Operation Phase Phase! Generator)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -47,7 +47,7 @@
(def (with_closure @self inits body!)
(-> Var (List Expression) Statement [Statement Expression])
- (case inits
+ (when inits
{.#End}
[(_.function_definition @self (list) body!)
@self]
@@ -63,7 +63,7 @@
(_.var "curried"))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def @@arguments
(_.var "arguments"))
@@ -88,7 +88,7 @@
@self (_.var (///reference.artifact function_name))
apply_poly (.function (_ args func)
(|> func (_.do "apply" (list _.null args))))
- initialize_self! (_.define (//case.register 0) @self)
+ initialize_self! (_.define (//when.register 0) @self)
initialize! (list#mix (.function (_ post pre!)
(all _.then
pre!
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/loop.lux
index bac543584..c475281e4 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/loop.lux
@@ -17,7 +17,7 @@
["_" js (.only Computation Var Expression Statement)]]]]]
["[0]" //
[runtime (.only Operation Phase Phase! Generator Generator!)]
- ["[1][0]" case]
+ ["[1][0]" when]
["///[1]" ////
[synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -36,12 +36,12 @@
(def (setup $iteration initial? offset bindings body)
(-> Var Bit Register (List Expression) Statement Statement)
- (case bindings
+ (when bindings
(list)
body
(list binding)
- (let [$binding (//case.register offset)]
+ (let [$binding (//when.register offset)]
(all _.then
(if initial?
(_.define $binding binding)
@@ -53,7 +53,7 @@
(|> bindings
list.enumeration
(list#each (function (_ [register _])
- (let [variable (//case.register (n.+ offset register))]
+ (let [variable (//when.register (n.+ offset register))]
(if initial?
(_.define variable (_.at (_.i32 (.int register)) $iteration))
(_.set variable (_.at (_.i32 (.int register)) $iteration))))))
@@ -63,7 +63,7 @@
(def .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(statement expression archive bodyS)
@@ -85,7 +85,7 @@
(def .public (scope statement expression archive [start initsS+ bodyS])
(-> Phase! (Generator (Scope Synthesis)))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux
index 437f6624d..73a240682 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux
@@ -101,7 +101,7 @@
code <code>.any])
(macro.with_symbols [g!_ runtime]
(let [runtime_name (` (_.var (, (code.text (%.code runtime)))))]
- (case declaration
+ (when declaration
{.#Left name}
(let [g!name (code.local name)]
(in (list (` (def .public (, g!name)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/structure.lux
index e5a492e37..ee1ae1a03 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/structure.lux
@@ -18,7 +18,7 @@
(def .public (tuple generate archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in //runtime.unit)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/when.lux
index f8b30c1f9..7487beb55 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case exec let if)
+ [lux (.except when exec let if)
[abstract
["[0]" monad (.only do)]]
[control
@@ -25,7 +25,7 @@
["[1][0]" reference]
["/[1]" //
["[1][0]" synthesis
- ["[1]/[0]" case]]
+ ["[1]/[0]" when]]
["/[1]" //
["[1][0]" synthesis (.only Synthesis Path)
[access
@@ -158,7 +158,7 @@
(|> idx .int _.i32)))
(.if simple?
(_.when (_.= _.null @temp)
- ..fail_pm!)
+ ..fail_pm!)
(_.if (_.= _.null @temp)
..fail_pm!
(push_cursor! @temp)))))]
@@ -181,7 +181,7 @@
(def (optimized_pattern_matching again pathP)
(-> (-> Path (Operation Statement))
(-> Path (Operation (Maybe Statement))))
- (.case pathP
+ (.when pathP
(^.with_template [<simple> <choice>]
[(<simple> idx nextP)
(|> nextP
@@ -224,7 +224,7 @@
then!)}))
(/////synthesis.!multi_pop nextP)
- (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)]
+ (.let [[extra_pops nextP'] (////synthesis/when.count_pops nextP)]
(do ///////phase.monad
[next! (again nextP')]
(in {.#Some (all _.then
@@ -240,12 +240,12 @@
(function (again pathP)
(do ///////phase.monad
[outcome (optimized_pattern_matching again pathP)]
- (.case outcome
+ (.when outcome
{.#Some outcome}
(in outcome)
{.#None}
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(statement expression archive bodyS)
@@ -258,7 +258,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -326,9 +326,9 @@
(in (all _.then
(_.do_while (_.boolean false)
pattern_matching!)
- (_.throw (_.string ////synthesis/case.pattern_matching_error))))))
+ (_.throw (_.string ////synthesis/when.pattern_matching_error))))))
-(def .public (case! statement expression archive [valueS pathP])
+(def .public (when! statement expression archive [valueS pathP])
(Generator! [Synthesis Path])
(do ///////phase.monad
[stack_init (expression archive valueS)
@@ -339,8 +339,8 @@
(_.define @savepoint (_.array (list)))
pattern_matching!))))
-(def .public (case statement expression archive [valueS pathP])
+(def .public (when statement expression archive [valueS pathP])
(-> Phase! (Generator [Synthesis Path]))
(do ///////phase.monad
- [pattern_matching! (..case! statement expression archive [valueS pathP])]
+ [pattern_matching! (..when! statement expression archive [valueS pathP])]
(in (_.apply (_.closure (list) pattern_matching!) (list)))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm.lux
index b1fa42f27..0b9ec3dba 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm.lux
@@ -12,7 +12,7 @@
["[1][0]" structure]
["[1][0]" reference]
["[1][0]" function]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["//[1]" ///
["[1][0]" extension]
@@ -24,7 +24,7 @@
(def .public (generate archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(///#in (<generator> value))])
@@ -40,27 +40,27 @@
(/structure.tuple generate archive members)
{synthesis.#Reference reference}
- (case reference
+ (when reference
{reference.#Variable variable}
(/reference.variable archive variable)
{reference.#Constant constant}
(/reference.constant archive constant))
- (synthesis.branch/case [valueS pathS])
- (/case.case generate archive [valueS pathS])
+ (synthesis.branch/when [valueS pathS])
+ (/when.when generate archive [valueS pathS])
(synthesis.branch/exec [this that])
- (/case.exec generate archive [this that])
+ (/when.exec generate archive [this that])
(synthesis.branch/let [inputS register bodyS])
- (/case.let generate archive [inputS register bodyS])
+ (/when.let generate archive [inputS register bodyS])
(synthesis.branch/if [conditionS thenS elseS])
- (/case.if generate archive [conditionS thenS elseS])
+ (/when.if generate archive [conditionS thenS elseS])
(synthesis.branch/get [path recordS])
- (/case.get generate archive [path recordS])
+ (/when.get generate archive [path recordS])
(synthesis.loop/scope scope)
(/loop.scope generate archive scope)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/debug.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/debug.lux
index b983c3b7d..51ae831e0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/debug.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/debug.lux
@@ -23,7 +23,7 @@
[file (is (IO (Try (File IO)))
(file.get_file io.monad file.default file_path))]
(at file over_write bytecode))]
- (in (case outcome
+ (in (when outcome
{try.#Success definition}
file_path
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux
index b150e4536..c6b9dac3a 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function.lux
@@ -170,12 +170,12 @@
(def .public (apply generate archive [abstractionS inputsS])
(Generator Apply)
- (case abstractionS
+ (when abstractionS
(synthesis.constant $abstraction)
(do [! phase.monad]
[[@definition |abstraction|] (generation.definition archive $abstraction)
.let [actual_arity (list.size inputsS)]]
- (case |abstraction|
+ (when |abstraction|
{.#Some [_ {.#Some [expected_arity @abstraction]}]}
(cond (n.< expected_arity actual_arity)
(apply/? generate archive [abstractionS inputsS])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
index 74a1dac76..ae502cbee 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
@@ -87,7 +87,7 @@
(method.method //.modifier ////runtime.apply::name
false (////runtime.apply::type apply_arity)
(list)
- {.#Some (case num_partials
+ {.#Some (when num_partials
0 (all _.composite
////reference.this
(..inputs ..this_offset apply_arity)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux
index 270fb31ab..973ab7cad 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/host.lux
@@ -86,11 +86,11 @@
(def (class_value class_name class)
(-> Text (java/lang/Class java/lang/Object) (Try Any))
- (case (java/lang/Class::getField //value.field class)
+ (when (java/lang/Class::getField //value.field class)
{try.#Success field}
- (case (java/lang/reflect/Field::get {.#None} field)
+ (when (java/lang/reflect/Field::get {.#None} field)
{try.#Success ?value}
- (case ?value
+ (when ?value
{.#Some value}
{try.#Success value}
@@ -109,7 +109,7 @@
(def (evaluate! library loader eval_class [@it valueG])
(-> Library java/lang/ClassLoader Text [(Maybe unit.ID) (Bytecode Any)] (Try [Any Definition]))
(let [bytecode_name (text.replaced class_path_separator .module_separator eval_class)
- :value: (case @it
+ :value: (when @it
{.#Some @it}
(type.class (//runtime.class_name @it) (list))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/loop.lux
index d7b73995e..495882117 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/loop.lux
@@ -29,7 +29,7 @@
(def (invariant? register changeS)
(-> Register Synthesis Bit)
- (case changeS
+ (when changeS
(synthesis.variable/local var)
(n.= register var)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/primitive.lux
index ad5a79db9..5c9677bb7 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/primitive.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/primitive.lux
@@ -34,7 +34,7 @@
(def .public (i64 value)
(-> (I64 Any) (Bytecode Any))
- (case (.int value)
+ (when (.int value)
(^.with_template [<int> <instruction>]
[<int>
(do _.monad
@@ -58,7 +58,7 @@
[+5 _.iconst_5])
value
- (case (signed.s1 value)
+ (when (signed.s1 value)
{try.#Success value}
(do _.monad
[_ (_.bipush value)
@@ -66,7 +66,7 @@
..wrap_i64)
{try.#Failure _}
- (case (signed.s2 value)
+ (when (signed.s2 value)
{try.#Success value}
(do _.monad
[_ (_.sipush value)
@@ -91,7 +91,7 @@
(def .public (f64 value)
(-> Frac (Bytecode Any))
- (case value
+ (when value
(^.with_template [<int> <instruction>]
[<int>
(do _.monad
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/reference.lux
index a6f209206..9f4a1c945 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/reference.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/reference.lux
@@ -53,7 +53,7 @@
(def .public (variable archive variable)
(-> Archive Variable (Operation (Bytecode Any)))
- (case variable
+ (when variable
{variable.#Local variable}
(operation#in (_.aload variable))
@@ -65,7 +65,7 @@
(do ////.monad
[[@definition |abstraction|] (generation.definition archive name)
.let [:definition: (type.class (//runtime.class_name @definition) (list))]]
- (in (case |abstraction|
+ (in (when |abstraction|
{.#Some [_ {.#Some [expected_arity @abstraction]}]}
(let [:abstraction: (type.class (//runtime.class_name @abstraction) (list))]
(_.getstatic :definition: //value.field :abstraction:))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux
index 385015373..2a0d2c994 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Type Definition Label case false true try)
+ [lux (.except Type Definition Label when false true try)
[abstract
["[0]" monad (.only do)]
["[0]" enum]]
@@ -289,13 +289,13 @@
(..set! ..stack_tail $tail)
_.areturn))}))
-(def case::name "case")
-(def case::type (type.method [(list) (list //type.variant //type.lefts //type.right?) //type.value (list)]))
-(def .public case (..procedure ..case::name ..case::type))
+(def when::name "when")
+(def when::type (type.method [(list) (list //type.variant //type.lefts //type.right?) //type.value (list)]))
+(def .public when (..procedure ..when::name ..when::type))
-(def case::method
- (method.method ..modifier ..case::name
- .false ..case::type
+(def when::method
+ (method.method ..modifier ..when::name
+ .false ..when::type
(list)
{.#Some
(do _.monad
@@ -560,7 +560,7 @@
..pm_failure::method
..push::method
- ..case::method
+ ..when::method
left_projection::method
right_projection::method
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/structure.lux
index 54958837b..1dfafd509 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/structure.lux
@@ -31,7 +31,7 @@
(def .public (tuple phase archive membersS)
(Generator (Tuple Synthesis))
- (case membersS
+ (when membersS
{.#End}
(at phase.monad in //runtime.unit)
@@ -57,19 +57,19 @@
(def .public (lefts lefts)
(-> Nat (Bytecode Any))
- (case lefts
+ (when lefts
0 _.iconst_0
1 _.iconst_1
2 _.iconst_2
3 _.iconst_3
4 _.iconst_4
5 _.iconst_5
- _ (case (signed.s1 (.int lefts))
+ _ (when (signed.s1 (.int lefts))
{try.#Success value}
(_.bipush value)
{try.#Failure _}
- (case (signed.s2 (.int lefts))
+ (when (signed.s2 (.int lefts))
{try.#Success value}
(_.sipush value)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/when.lux
index f5d258fbb..767a48216 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/jvm/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Type Label if let exec case int)
+ [lux (.except Type Label if let exec when int)
[abstract
["[0]" monad (.only do)]]
[control
@@ -42,7 +42,7 @@
(def (pop_alt stack_depth)
(-> Nat (Bytecode Any))
- (.case stack_depth
+ (.when stack_depth
0 (_#in [])
1 _.pop
2 _.pop2
@@ -76,7 +76,7 @@
(all _.composite
(_.checkcast //type.tuple)
(..int lefts)
- (.case lefts
+ (.when lefts
0
_.aaload
@@ -107,7 +107,7 @@
(Operation (Bytecode Any)))
(do phase.monad
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -161,7 +161,7 @@
(def (path' stack_depth @else @end phase archive)
(-> Nat Label Label (Generator Path))
(function (again path)
- (.case path
+ (.when path
{synthesis.#Pop}
(operation#in ..pop)
@@ -193,7 +193,7 @@
(_.checkcast //type.variant)
(//structure.lefts lefts)
(//structure.right? right?)
- //runtime.case
+ //runtime.when
_.dup
(_.ifnonnull @success)
_.pop
@@ -312,7 +312,7 @@
record!
(list.reversed path)))))
-(def .public (case phase archive [valueS path])
+(def .public (when phase archive [valueS path])
(Generator [Synthesis Path])
(do phase.monad
[@end //runtime.forge_label
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua.lux
index 2e27b6973..08fbc07cf 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua.lux
@@ -15,7 +15,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]
["/[1]" //
@@ -37,7 +37,7 @@
(def (expression archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -55,20 +55,20 @@
{synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (synthesis.branch/case case)
- (/case.case ///extension/common.statement expression archive case)
+ (synthesis.branch/when when)
+ (/when.when ///extension/common.statement expression archive when)
(synthesis.branch/exec it)
- (/case.exec expression archive it)
+ (/when.exec expression archive it)
(synthesis.branch/let let)
- (/case.let expression archive let)
+ (/when.let expression archive let)
(synthesis.branch/if if)
- (/case.if expression archive if)
+ (/when.if expression archive if)
(synthesis.branch/get get)
- (/case.get expression archive get)
+ (/when.get expression archive get)
(synthesis.loop/scope scope)
(/loop.scope ///extension/common.statement expression archive scope)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/function.lux
index 77f3d2caf..0e7b19de8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/function.lux
@@ -15,7 +15,7 @@
["[0]" //
["[1][0]" runtime (.only Operation Phase Phase! Generator)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -47,7 +47,7 @@
(def (with_closure inits @self @args body!)
(-> (List Expression) Var (List Var) Statement [Statement Expression])
- (case inits
+ (when inits
{.#End}
[(_.function @self @args body!)
@self]
@@ -62,7 +62,7 @@
(_.apply inits @self)])))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def (@scope function_name)
(-> unit.ID Label)
@@ -84,7 +84,7 @@
@num_args (_.var "num_args")
@scope (..@scope function_name)
@self (_.var (///reference.artifact function_name))
- initialize_self! (_.local/1 (//case.register 0) @self)
+ initialize_self! (_.local/1 (//when.register 0) @self)
initialize! (list#mix (.function (_ post pre!)
(all _.then
pre!
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/loop.lux
index bef9f9893..f3532770a 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/loop.lux
@@ -18,7 +18,7 @@
["_" lua (.only Var Expression Label Statement)]]]]]
["[0]" //
[runtime (.only Operation Phase Phase! Generator Generator!)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -42,7 +42,7 @@
(-> Bit Register (List Expression) Bit Statement Statement)
(let [variables (|> bindings
list.enumeration
- (list#each (|>> product.left (n.+ offset) //case.register)))]
+ (list#each (|>> product.left (n.+ offset) //when.register)))]
(if as_expression?
body
(all _.then
@@ -55,7 +55,7 @@
... (Generator! (Scope Synthesis))
(-> Phase! Phase Archive Bit (Scope Synthesis)
(Operation [(List Expression) Statement]))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(|> bodyS
@@ -77,7 +77,7 @@
(def .public (scope statement expression archive [start initsS+ bodyS])
(-> Phase! (Generator (Scope Synthesis)))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -91,10 +91,10 @@
.let [@loop (_.var (///reference.artifact [artifact_module artifact_id]))
locals (|> initsO+
list.enumeration
- (list#each (|>> product.left (n.+ start) //case.register)))
+ (list#each (|>> product.left (n.+ start) //when.register)))
[declaration instantiation] (is [Statement Expression]
- (case (|> (synthesis.path/then bodyS)
- //case.dependencies
+ (when (|> (synthesis.path/then bodyS)
+ //when.dependencies
(set.of_list _.hash)
(set.difference (set.of_list _.hash locals))
set.list)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux
index e8ba62726..b365b536e 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -129,7 +129,7 @@
(macro.with_symbols [g!_]
(let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
runtime_name (` (_.var (, (code.text (%.code runtime)))))]
- (case declaration
+ (when declaration
{.#Left name}
(macro.with_symbols [g!_]
(let [g!name (code.local name)]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/structure.lux
index e3b0c8c66..c623bd592 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/structure.lux
@@ -18,7 +18,7 @@
(def .public (tuple phase archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/when.lux
index 5924848e8..7e9e383ca 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/lua/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case exec let if)
+ [lux (.except when exec let if)
[abstract
["[0]" monad (.only do)]]
[data
@@ -22,7 +22,7 @@
["[1][0]" reference]
["/[1]" //
["[1][0]" synthesis
- ["[1]/[0]" case]]
+ ["[1]/[0]" when]]
["/[1]" //
["[1][0]" synthesis (.only Synthesis Path)
[access
@@ -160,7 +160,7 @@
(|> idx .int _.int)))
(.if simple?
(_.when (_.= _.nil @temp)
- fail!)
+ fail!)
(_.if (_.= _.nil @temp)
fail!
(..push! @temp)))))]
@@ -183,7 +183,7 @@
(def (pattern_matching' statement expression archive)
(-> Phase! Phase Archive Path (Operation Statement))
(function (again pathP)
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(statement expression archive bodyS)
@@ -196,7 +196,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -269,22 +269,22 @@
(in (all _.then
(_.while (_.boolean true)
pattern_matching!)
- (_.statement (|> (_.var "error") (_.apply (list (_.string ////synthesis/case.pattern_matching_error)))))))))
+ (_.statement (|> (_.var "error") (_.apply (list (_.string ////synthesis/when.pattern_matching_error)))))))))
(def .public dependencies
(-> Path (List Var))
- (|>> ////synthesis/case.storage
- (the ////synthesis/case.#dependencies)
+ (|>> ////synthesis/when.storage
+ (the ////synthesis/when.#dependencies)
set.list
(list#each (function (_ variable)
- (.case variable
+ (.when variable
{///////variable.#Local register}
(..register register)
{///////variable.#Foreign register}
(..capture register))))))
-(def .public (case! statement expression archive [valueS pathP])
+(def .public (when! statement expression archive [valueS pathP])
(Generator! [Synthesis Path])
(do ///////phase.monad
[stack_init (expression archive valueS)
@@ -295,10 +295,10 @@
(_.local/1 @savepoint (_.array (list)))
pattern_matching!))))
-(def .public (case statement expression archive [valueS pathP])
+(def .public (when statement expression archive [valueS pathP])
(-> Phase! (Generator [Synthesis Path]))
(|> [valueS pathP]
- (..case! statement expression archive)
+ (..when! statement expression archive)
(at ///////phase.monad each
(|>> (_.closure (list))
(_.apply (list))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php.lux
index 293366280..12e2dffd3 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php.lux
@@ -15,7 +15,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]
["/[1]" //
@@ -32,7 +32,7 @@
(def (statement expression archive synthesis)
Phase!
- (case synthesis
+ (when synthesis
(^.with_template [<tag>]
[(<tag> value)
(//////phase#each _.return (expression archive synthesis))])
@@ -51,14 +51,14 @@
([////synthesis.#Reference]
[////synthesis.#Extension])
- (////synthesis.branch/case case)
- (/case.case! statement expression archive case)
+ (////synthesis.branch/when when)
+ (/when.when! statement expression archive when)
(^.with_template [<tag> <generator>]
[(<tag> value)
(<generator> statement expression archive value)])
- ([////synthesis.branch/let /case.let!]
- [////synthesis.branch/if /case.if!]
+ ([////synthesis.branch/let /when.let!]
+ [////synthesis.branch/if /when.if!]
[////synthesis.loop/scope /loop.scope!]
[////synthesis.loop/again /loop.again!])
@@ -70,7 +70,7 @@
(def .public (expression archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -87,15 +87,15 @@
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
[////synthesis.tuple /structure.tuple]
- [////synthesis.branch/let /case.let]
- [////synthesis.branch/if /case.if]
- [////synthesis.branch/get /case.get]
+ [////synthesis.branch/let /when.let]
+ [////synthesis.branch/if /when.if]
+ [////synthesis.branch/get /when.get]
[////synthesis.function/apply /function.apply])
(^.with_template [<tag> <generator>]
[(<tag> value)
(<generator> statement expression archive value)])
- ([////synthesis.branch/case /case.case]
+ ([////synthesis.branch/when /when.when]
[////synthesis.loop/scope /loop.scope]
[////synthesis.function/abstraction /function.function])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/function.lux
index b2ca21671..e4195f3d4 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/function.lux
@@ -17,7 +17,7 @@
["[0]" //
["[1][0]" runtime (.only Operation Phase Phase! Generator)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -42,7 +42,7 @@
(|>> (///reference.foreign //reference.system) as_expected))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def (@scope function_name)
(-> Context Label)
@@ -50,7 +50,7 @@
(def (with_closure inits @selfG @selfL body!)
(-> (List Expression) Global Var Statement [Statement Expression])
- (case inits
+ (when inits
{.#End}
[(all _.then
(_.set! @selfL (_.closure (list (_.reference @selfL)) (list) body!))
@@ -84,7 +84,7 @@
@scope (..@scope function_name)
@selfG (_.global (///reference.artifact function_name))
@selfL (_.var (///reference.artifact function_name))
- initialize_self! (_.set! (//case.register 0) @selfL)
+ initialize_self! (_.set! (//when.register 0) @selfL)
initialize! (list#mix (.function (_ post pre!)
(all _.then
pre!
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/loop.lux
index 5c3682738..b4c3804e8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/loop.lux
@@ -18,12 +18,12 @@
["_" php (.only Var Expression Label Statement)]]]]]
["[0]" //
[runtime (.only Operation Phase Phase! Generator Generator!)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[0]" synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -44,14 +44,14 @@
(|> bindings
list.enumeration
(list#each (function (_ [register value])
- (let [variable (//case.register (n.+ offset register))]
+ (let [variable (//when.register (n.+ offset register))]
(_.set! variable value))))
list.reversed
(list#mix _.then body)))
(def .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(statement expression archive bodyS)
@@ -70,7 +70,7 @@
(def .public (scope statement expression archive [start initsS+ bodyS])
(-> Phase! (Generator (Scope Synthesis)))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -82,15 +82,15 @@
(..scope! statement expression archive [start initsS+ bodyS]))
.let [locals (|> initsS+
list.enumeration
- (list#each (|>> product.left (n.+ start) //case.register _.parameter)))
+ (list#each (|>> product.left (n.+ start) //when.register _.parameter)))
@loop (_.constant (///reference.artifact [loop_module loop_artifact]))
loop_variables (set.of_list _.hash (list#each product.right locals))
referenced_variables (is (-> Synthesis (Set Var))
(|>> synthesis.path/then
- //case.dependencies
+ //when.dependencies
(set.of_list _.hash)))
[declaration instantiation] (is [Statement Expression]
- (case (|> (list#each referenced_variables initsS+)
+ (when (|> (list#each referenced_variables initsS+)
(list#mix set.union (referenced_variables bodyS))
(set.difference loop_variables)
set.list)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/runtime.lux
index bff0a6cf0..b1d1abe87 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/runtime.lux
@@ -96,7 +96,7 @@
(macro.with_symbols [g!_]
(let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
runtime_name (` (_.constant (, (code.text (%.code runtime)))))]
- (case declaration
+ (when declaration
{.#Left name}
(macro.with_symbols [g!_]
(let [g!name (code.local name)]
@@ -606,7 +606,7 @@
i64_error (_.string (format "Cannot run program!" text.new_line
"Lux/PHP programs require 64-bit PHP builds!"))]
(_.when (_.not i64_support?)
- (_.throw (_.new (_.constant "Exception") (list i64_error))))))
+ (_.throw (_.new (_.constant "Exception") (list i64_error))))))
(def runtime
Statement
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/structure.lux
index 749ba0f5d..239d34609 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/structure.lux
@@ -19,7 +19,7 @@
(def .public (tuple expression archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/when.lux
index 816b77d0f..fc703eb8b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/php/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case let if)
+ [lux (.except when let if)
[abstract
["[0]" monad (.only do)]]
[data
@@ -26,7 +26,7 @@
["[1][0]" reference]
["/[1]" //
["[1][0]" synthesis
- ["[1]/[0]" case]]
+ ["[1]/[0]" when]]
["/[1]" //
["[1][0]" synthesis (.only Member Synthesis Path)]
["[1][0]" generation]
@@ -87,7 +87,7 @@
(do ///////phase.monad
[valueG (expression archive valueS)]
(in (list#mix (function (_ side source)
- (.let [method (.case side
+ (.let [method (.when side
(^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
@@ -142,7 +142,7 @@
(_.set! @temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek <flag>)))
(.if simple?
(_.when (_.is_null/1 @temp)
- fail!)
+ fail!)
(_.if (_.is_null/1 @temp)
fail!
(..push! @temp)))))]
@@ -165,7 +165,7 @@
(def (pattern_matching' statement expression archive)
(Generator! Path)
(function (again pathP)
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(statement expression archive bodyS)
@@ -178,7 +178,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -235,7 +235,7 @@
then!)))
... (/////synthesis.!multi_pop nextP)
- ... (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)]
+ ... (.let [[extra_pops nextP'] (////synthesis/when.count_pops nextP)]
... (do ///////phase.monad
... [next! (again nextP')]
... (///////phase#in (all _.then
@@ -258,22 +258,22 @@
(in (all _.then
(_.do_while (_.bool false)
iteration!)
- (_.throw (_.new (_.constant "Exception") (list (_.string ////synthesis/case.pattern_matching_error))))))))
+ (_.throw (_.new (_.constant "Exception") (list (_.string ////synthesis/when.pattern_matching_error))))))))
(def .public dependencies
(-> Path (List Var))
- (|>> ////synthesis/case.storage
- (the ////synthesis/case.#dependencies)
+ (|>> ////synthesis/when.storage
+ (the ////synthesis/when.#dependencies)
set.list
(list#each (function (_ variable)
- (.case variable
+ (.when variable
{///////variable.#Local register}
(..register register)
{///////variable.#Foreign register}
(..capture register))))))
-(def .public (case! statement expression archive [valueS pathP])
+(def .public (when! statement expression archive [valueS pathP])
(Generator! [Synthesis Path])
(do ///////phase.monad
[stack_init (expression archive valueS)
@@ -283,15 +283,15 @@
(_.set! @savepoint (_.array/* (list)))
pattern_matching!))))
-(def .public (case statement expression archive [valueS pathP])
+(def .public (when statement expression archive [valueS pathP])
(-> Phase! (Generator [Synthesis Path]))
(do [! ///////phase.monad]
- [[[case_module case_artifact] case!] (/////generation.with_new_context archive
- (case! statement expression archive [valueS pathP]))
- .let [@case (_.constant (///reference.artifact [case_module case_artifact]))
+ [[[when_module when_artifact] when!] (/////generation.with_new_context archive
+ (when! statement expression archive [valueS pathP]))
+ .let [@when (_.constant (///reference.artifact [when_module when_artifact]))
@dependencies+ (..dependencies (/////synthesis.path/seq (/////synthesis.path/then valueS)
pathP))
- declaration (_.define_function @case (list#each _.parameter @dependencies+) case!)]
+ declaration (_.define_function @when (list#each _.parameter @dependencies+) when!)]
_ (/////generation.execute! declaration)
- _ (/////generation.save! case_artifact declaration)]
- (in (_.apply @dependencies+ @case))))
+ _ (/////generation.save! when_artifact declaration)]
+ (in (_.apply @dependencies+ @when))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python.lux
index cd48b763b..b2692261f 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python.lux
@@ -16,7 +16,7 @@
["[1][0]" structure]
["[1][0]" reference]
["[1][0]" function]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["/[1]" //
["[1][0]" reference]
@@ -37,7 +37,7 @@
(def .public (expression archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -52,17 +52,17 @@
([////synthesis.variant /structure.variant]
[////synthesis.tuple /structure.tuple]
- [////synthesis.branch/exec /case.exec]
- [////synthesis.branch/let /case.let]
- [////synthesis.branch/if /case.if]
- [////synthesis.branch/get /case.get]
+ [////synthesis.branch/exec /when.exec]
+ [////synthesis.branch/let /when.let]
+ [////synthesis.branch/if /when.if]
+ [////synthesis.branch/get /when.get]
[////synthesis.function/apply /function.apply])
(^.with_template [<tag> <generator>]
[(<tag> value)
(<generator> ///extension/common.statement expression archive value)])
- ([////synthesis.branch/case /case.case]
+ ([////synthesis.branch/when /when.when]
[////synthesis.loop/scope /loop.scope]
[////synthesis.function/abstraction /function.function])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/function.lux
index 1d1021d11..7afc45ccb 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/function.lux
@@ -15,7 +15,7 @@
["[0]" //
[runtime (.only Operation Phase Generator Phase! Generator!)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["/[1]" //
["[1][0]" reference]
@@ -48,7 +48,7 @@
(def (with_closure function_id @function inits function_definition)
(-> artifact.ID SVar (List (Expression Any)) (Statement Any) (Operation (Expression Any)))
- (case inits
+ (when inits
{.#End}
(do ///////phase.monad
[_ (/////generation.execute! function_definition)
@@ -68,7 +68,7 @@
(in (_.apply inits @function)))))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def .public (function statement expression archive [environment arity bodyS])
(-> Phase! (Generator (Abstraction Synthesis)))
@@ -84,7 +84,7 @@
@self (_.var (///reference.artifact [function_module function_artifact]))
apply_poly (.function (_ args func)
(_.apply (list (_.splat_poly args)) func))
- initialize_self! (_.set (list (//case.register 0)) @self)
+ initialize_self! (_.set (list (//when.register 0)) @self)
initialize! (list#mix (.function (_ post pre!)
(all _.then
pre!
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/loop.lux
index d767eeeeb..16df5397a 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/loop.lux
@@ -18,12 +18,12 @@
["_" python (.only Expression SVar Statement)]]]]]
["[0]" //
[runtime (.only Operation Phase Generator Phase! Generator!)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[0]" synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -40,7 +40,7 @@
(-> Register (List (Expression Any)) (Statement Any) (Statement Any))
(let [variables (|> bindings
list.enumeration
- (list#each (|>> product.left (n.+ offset) //case.register)))]
+ (list#each (|>> product.left (n.+ offset) //when.register)))]
(all _.then
(_.set variables (_.multi bindings))
body)))
@@ -53,7 +53,7 @@
(def .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(statement expression archive bodyS)
@@ -70,7 +70,7 @@
(def .public (scope statement expression archive [start initsS+ bodyS])
(-> Phase! (Generator (Scope Synthesis)))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -86,13 +86,13 @@
.let [@loop (_.var (///reference.artifact [loop_module loop_artifact]))
locals (|> initsS+
list.enumeration
- (list#each (|>> product.left (n.+ start) //case.register)))
+ (list#each (|>> product.left (n.+ start) //when.register)))
actual_loop (<| (_.def @loop locals)
..set_scope
body!)
[declaration instantiation] (is [(Statement Any) (Expression Any)]
- (case (|> (synthesis.path/then bodyS)
- //case.dependencies
+ (when (|> (synthesis.path/then bodyS)
+ //when.dependencies
(set.of_list _.hash)
(set.difference (set.of_list _.hash locals))
set.list)
@@ -115,7 +115,7 @@
(Generator! (List Synthesis))
(do [! ///////phase.monad]
[offset /////generation.anchor
- @temp (//case.symbol "lux_again_values")
+ @temp (//when.symbol "lux_again_values")
argsO+ (monad.each ! (expression archive) argsS+)
.let [re_binds (|> argsO+
list.enumeration
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/runtime.lux
index d045b7d8e..38c5d87e3 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/runtime.lux
@@ -127,7 +127,7 @@
(<code>.form (<>.and <code>.local
(<>.some <code>.local))))
code <code>.any])
- (case declaration
+ (when declaration
{.#Left name}
(macro.with_symbols [g!_]
(let [nameC (code.local name)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/structure.lux
index 428320d23..f89cf244b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/structure.lux
@@ -18,7 +18,7 @@
(def .public (tuple generate archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/when.lux
index 090c2587e..3666dc9fc 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/python/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case exec let if symbol)
+ [lux (.except when exec let if symbol)
[abstract
["[0]" monad (.only do)]]
[data
@@ -26,7 +26,7 @@
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[1][0]" generation]
["[1][0]" synthesis (.only Synthesis Path)
@@ -164,7 +164,7 @@
(|> idx .int _.int)))
(.if simple?
(_.when (_.= _.none @temp)
- fail_pm!)
+ fail_pm!)
(_.if (_.= _.none @temp)
fail_pm!
(..push! @temp))
@@ -201,11 +201,11 @@
(def (primitive_pattern_matching again pathP)
(-> (-> Path (Operation (Statement Any)))
(-> Path (Operation (Maybe (Statement Any)))))
- (.case pathP
+ (.when pathP
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -244,12 +244,12 @@
(function (again pathP)
(do [! ///////phase.monad]
[?output (primitive_pattern_matching again pathP)]
- (.case ?output
+ (.when ?output
{.#Some output}
(in output)
{.#None}
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(statement expression archive bodyS)
@@ -287,7 +287,7 @@
then!)))
(/////synthesis.!multi_pop nextP)
- (.let [[extra_pops nextP'] (case.count_pops nextP)]
+ (.let [[extra_pops nextP'] (when.count_pops nextP)]
(do !
[next! (again nextP')]
(///////phase#in (all _.then
@@ -318,22 +318,22 @@
(in (all _.then
(..with_looping in_closure? g!once
pattern_matching!)
- (_.raise (_.Exception/1 (_.string case.pattern_matching_error)))))))
+ (_.raise (_.Exception/1 (_.string when.pattern_matching_error)))))))
(def .public dependencies
(-> Path (List SVar))
- (|>> case.storage
- (the case.#dependencies)
+ (|>> when.storage
+ (the when.#dependencies)
set.list
(list#each (function (_ variable)
- (.case variable
+ (.when variable
{///////variable.#Local register}
(..register register)
{///////variable.#Foreign register}
(..capture register))))))
-(def .public (case! in_closure? statement expression archive [valueS pathP])
+(def .public (when! in_closure? statement expression archive [valueS pathP])
(-> Bit (Generator! [Synthesis Path]))
(do ///////phase.monad
[stack_init (expression archive valueS)
@@ -344,19 +344,19 @@
pattern_matching!
))))
-(def .public (case statement expression archive [valueS pathP])
+(def .public (when statement expression archive [valueS pathP])
(-> Phase! (Generator [Synthesis Path]))
(do ///////phase.monad
[dependencies (cache.path_dependencies archive pathP)
- [[case_module case_artifact] pattern_matching!] (/////generation.with_new_context
+ [[when_module when_artifact] pattern_matching!] (/////generation.with_new_context
archive
dependencies
- (case! true statement expression archive [valueS pathP]))
- .let [@case (_.var (///reference.artifact [case_module case_artifact]))
+ (when! true statement expression archive [valueS pathP]))
+ .let [@when (_.var (///reference.artifact [when_module when_artifact]))
@dependencies+ (..dependencies (/////synthesis.path/seq (/////synthesis.path/then valueS)
pathP))
- declaration (_.def @case @dependencies+
+ declaration (_.def @when @dependencies+
pattern_matching!)]
_ (/////generation.execute! declaration)
- _ (/////generation.save! case_artifact {.#None} declaration)]
- (in (_.apply @dependencies+ @case))))
+ _ (/////generation.save! when_artifact {.#None} declaration)]
+ (in (_.apply @dependencies+ @when))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r.lux
index 7741ccce0..cf20229d8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r.lux
@@ -13,7 +13,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]
["/[1]" //
@@ -30,7 +30,7 @@
(def .public (generate archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -47,12 +47,12 @@
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
[////synthesis.tuple /structure.tuple]
- [////synthesis.branch/let /case.let]
- [////synthesis.branch/if /case.if]
- [////synthesis.branch/get /case.get]
+ [////synthesis.branch/let /when.let]
+ [////synthesis.branch/if /when.if]
+ [////synthesis.branch/get /when.get]
[////synthesis.function/apply /function.apply]
- [////synthesis.branch/case /case.case]
+ [////synthesis.branch/when /when.when]
[////synthesis.loop/scope /loop.scope]
[////synthesis.loop/again /loop.again]
[////synthesis.function/abstraction /function.function])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/function.lux
index 80f8ac48c..bf6d09b19 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/function.lux
@@ -17,7 +17,7 @@
["[0]" //
["[1][0]" runtime (.only Operation Phase Generator)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -42,7 +42,7 @@
(def (with_closure function_id $function inits function_definition)
(-> artifact.ID SVar (List Expression) Expression (Operation Expression))
- (case inits
+ (when inits
{.#End}
(do ///////phase.monad
[_ (/////generation.execute! function_definition)
@@ -56,7 +56,7 @@
(_.function (|> inits
list.size
list.indices
- (list#each //case.capture))
+ (list#each //when.capture))
(all _.then
function_definition
$function)))]
@@ -69,7 +69,7 @@
(def (input_declaration register)
(-> Register Expression)
- (_.set! (|> register ++ //case.register)
+ (_.set! (|> register ++ //when.register)
(|> $curried (_.item (|> register ++ .int _.int)))))
(def .public (function expression archive [environment arity bodyS])
@@ -94,7 +94,7 @@
(_.set! $num_args (_.length $curried))
(_.cond (list [(|> $num_args (_.= arityO))
(all _.then
- (_.set! (//case.register 0) $self)
+ (_.set! (//when.register 0) $self)
(|> arity
list.indices
(list#each input_declaration)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/loop.lux
index 35477e3f7..7a72081e9 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/loop.lux
@@ -18,12 +18,12 @@
["_" r]]]]]
["[0]" //
[runtime (.only Operation Phase Generator)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[0]" synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -36,7 +36,7 @@
(def .public (scope expression archive [offset initsS+ bodyS])
(Generator (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -54,7 +54,7 @@
(_.function (|> initsS+
list.size
list.indices
- (list#each (|>> (n.+ offset) //case.register)))
+ (list#each (|>> (n.+ offset) //when.register)))
bodyO))
(_.apply initsO+ $scope)))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/common.lux
index a64f95bc9..f57141564 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/common.lux
@@ -20,7 +20,7 @@
(host [r (.only Expression)])))
[///]
(/// ["[0]T" runtime]
- ["[0]T" case]
+ ["[0]T" when]
["[0]T" function]
["[0]T" loop]))
@@ -56,7 +56,7 @@
(def (lux//if [testO thenO elseO])
Trinary
- (caseT.translate_if testO thenO elseO))
+ (whenT.translate_if testO thenO elseO))
(def (lux//try riskyO)
Unary
@@ -74,7 +74,7 @@
(-> Text Proc)
(function (_ proc_name)
(function (_ translate inputsS)
- (case (s.result inputsS (all p.and s.nat (s.tuple (p.many s.any)) s.any))
+ (when (s.result inputsS (all p.and s.nat (s.tuple (p.many s.any)) s.any))
{e.#Success [offset initsS+ bodyS]}
(loopT.translate_loop translate offset initsS+ bodyS)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/host.lux
index b5a3fcb3a..1b588bc61 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/procedure/host.lux
@@ -24,7 +24,7 @@
... (def (lua//global proc translate inputs)
... (-> Text @.Proc)
-... (case inputs
+... (when inputs
... (list [_ {.#Text name}])
... (do macro.Monad<Meta>
... []
@@ -35,7 +35,7 @@
... (def (lua//call proc translate inputs)
... (-> Text @.Proc)
-... (case inputs
+... (when inputs
... (list.partial functionS argsS+)
... (do [@ macro.Monad<Meta>]
... [functionO (translate functionS)
@@ -55,7 +55,7 @@
... (def (table//call proc translate inputs)
... (-> Text @.Proc)
-... (case inputs
+... (when inputs
... (list.partial tableS [_ {.#Text field}] argsS+)
... (do [@ macro.Monad<Meta>]
... [tableO (translate tableS)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/runtime.lux
index c23b725d5..261cba579 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/runtime.lux
@@ -99,7 +99,7 @@
(macro.with_symbols [g!_]
(let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
runtime_name (` (_.var (, (code.text (%.code runtime)))))]
- (case declaration
+ (when declaration
{.#Left name}
(let [g!name (code.local name)]
(in (list (` (def .public (, g!name)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/structure.lux
index b381f8d63..77b7a3f62 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/structure.lux
@@ -20,7 +20,7 @@
(def .public (tuple expression archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/when.lux
index cc47ed212..0f2a0954c 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/r/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case let if)
+ [lux (.except when let if)
[abstract
["[0]" monad (.only do)]]
[data
@@ -27,7 +27,7 @@
["[1][0]" reference]
["/[1]" //
["[1][0]" synthesis
- ["[1]/[0]" case]]
+ ["[1]/[0]" when]]
["/[1]" //
["[1][0]" synthesis (.only Member Synthesis Path)]
["[1][0]" generation]
@@ -69,7 +69,7 @@
(do ///////phase.monad
[valueO (expression archive valueS)]
(in (list#mix (function (_ side source)
- (.let [method (.case side
+ (.let [method (.when side
(^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
@@ -136,7 +136,7 @@
(def (pattern_matching' expression archive)
(Generator Path)
(function (again pathP)
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(expression archive bodyS)
@@ -149,7 +149,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -231,7 +231,7 @@
{.#Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))}
{.#None}))))
-(def .public (case expression archive [valueS pathP])
+(def .public (when expression archive [valueS pathP])
(Generator [Synthesis Path])
(do [! ///////phase.monad]
[valueO (expression archive valueS)]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux
index ef720c4ae..2ec80b679 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/reference.lux
@@ -83,7 +83,7 @@
(def .public (variable system variable)
(All (_ expression)
(-> (System expression) Variable expression))
- (case variable
+ (when variable
{variable.#Local register}
(..local system register)
@@ -93,7 +93,7 @@
(def .public (reference system archive reference)
(All (_ anchor expression declaration)
(-> (System expression) Archive Reference (////generation.Operation anchor expression declaration expression)))
- (case reference
+ (when reference
{reference.#Constant value}
(..constant system archive value)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby.lux
index f3e5aed3c..9c2719467 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby.lux
@@ -16,7 +16,7 @@
["[1][0]" structure]
["[1][0]" reference]
["[1][0]" function]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["/[1]" //
["[1][0]" reference]
@@ -37,7 +37,7 @@
(def (expression archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -52,17 +52,17 @@
([////synthesis.variant /structure.variant]
[////synthesis.tuple /structure.tuple]
- [////synthesis.branch/exec /case.exec]
- [////synthesis.branch/let /case.let]
- [////synthesis.branch/if /case.if]
- [////synthesis.branch/get /case.get]
+ [////synthesis.branch/exec /when.exec]
+ [////synthesis.branch/let /when.let]
+ [////synthesis.branch/if /when.if]
+ [////synthesis.branch/get /when.get]
[////synthesis.function/apply /function.apply])
(^.with_template [<tag> <generator>]
[(<tag> value)
(<generator> ///extension/common.statement expression archive value)])
- ([////synthesis.branch/case /case.case]
+ ([////synthesis.branch/when /when.when]
[////synthesis.loop/scope /loop.scope]
[////synthesis.function/abstraction /function.function])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/function.lux
index 51cf79c55..fc63bb4fa 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/function.lux
@@ -15,7 +15,7 @@
["[0]" //
[runtime (.only Operation Phase Generator Phase! Generator!)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["/[1]" //
["[1][0]" reference]
@@ -47,7 +47,7 @@
(def (with_closure inits self function_definition)
(-> (List Expression) Text Expression [Statement Expression])
(let [@self (_.global self)]
- (case inits
+ (when inits
{.#End}
[(_.set (list @self) function_definition)
@self]
@@ -63,7 +63,7 @@
(_.apply_lambda inits @self)])))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def .public (function statement expression archive [environment arity bodyS])
(-> Phase! (Generator (Abstraction Synthesis)))
@@ -79,13 +79,13 @@
limitO (|> arity -- .int _.int)
@num_args (_.local "num_args")
@self (is _.Location
- (case closureO+
+ (when closureO+
{.#End}
(_.global function_name)
_
(_.local function_name)))
- initialize_self! (_.set (list (//case.register 0)) @self)
+ initialize_self! (_.set (list (//when.register 0)) @self)
initialize! (list#mix (.function (_ post pre!)
(all _.then
pre!
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/loop.lux
index 1a82b9e18..25feac999 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/loop.lux
@@ -18,12 +18,12 @@
["_" ruby (.only Expression LVar Statement)]]]]]
["[0]" //
[runtime (.only Operation Phase Generator Phase! Generator!)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[0]" synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -36,7 +36,7 @@
(-> Register (List Expression) Statement Statement)
(let [variables (|> bindings
list.enumeration
- (list#each (|>> product.left (n.+ offset) //case.register)))]
+ (list#each (|>> product.left (n.+ offset) //when.register)))]
(all _.then
(_.set variables (_.multi bindings))
body)))
@@ -50,7 +50,7 @@
(def .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(statement expression archive bodyS)
@@ -67,7 +67,7 @@
(def .public (scope statement expression archive [start initsS+ bodyS])
(-> Phase! (Generator (Scope Synthesis)))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -84,7 +84,7 @@
(Generator! (List Synthesis))
(do [! ///////phase.monad]
[offset /////generation.anchor
- @temp (//case.symbol "lux_again_values")
+ @temp (//when.symbol "lux_again_values")
argsO+ (monad.each ! (expression archive) argsS+)
.let [re_binds (|> argsO+
list.enumeration
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux
index b193b5b84..9cb620e31 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -112,7 +112,7 @@
(do meta.monad
[runtime_id meta.seed]
(macro.with_symbols [g!_]
- (case declaration
+ (when declaration
{.#Left name}
(macro.with_symbols [g!_]
(let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
@@ -599,13 +599,13 @@
Statement
(all _.then
(_.when ..mruby?
- ... We're in mRuby/DragonRuby territory.
- (_.statement
- (_.do "class_eval" (list) {.#Some [(list (_.local "_"))
- (_.statement
- (_.alias_method/2 (_.string "remainder")
- (_.string "remainder_of_divide")))]}
- $Numeric)))
+ ... We're in mRuby/DragonRuby territory.
+ (_.statement
+ (_.do "class_eval" (list) {.#Some [(list (_.local "_"))
+ (_.statement
+ (_.alias_method/2 (_.string "remainder")
+ (_.string "remainder_of_divide")))]}
+ $Numeric)))
runtime//adt
runtime//lux
runtime//i64
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/structure.lux
index 5947bc8c4..a879af9d3 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/structure.lux
@@ -18,7 +18,7 @@
(def .public (tuple generate archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/when.lux
index 88a7e039e..28599463f 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/ruby/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case exec let if symbol)
+ [lux (.except when exec let if symbol)
[abstract
["[0]" monad (.only do)]]
[data
@@ -26,7 +26,7 @@
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[1][0]" generation]
["[1][0]" synthesis (.only Synthesis Path)
@@ -166,7 +166,7 @@
(|> idx .int _.int)))
(.if simple?
(_.when (_.= _.nil @temp)
- fail!)
+ fail!)
(_.if (_.= _.nil @temp)
fail!
(..push! @temp)))))]
@@ -193,7 +193,7 @@
(_.set (list g!continue?) (_.bool true))
_.break)))
(_.when g!continue?
- _.next))))
+ _.next))))
(def (alternation in_closure? g!once g!continue? pre! post!)
(-> Bit LVar LVar Statement Statement Statement)
@@ -208,11 +208,11 @@
(def (primitive_pattern_matching again pathP)
(-> (-> Path (Operation Statement))
(-> Path (Operation (Maybe Statement))))
- (.case pathP
+ (.when pathP
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -251,12 +251,12 @@
(function (again pathP)
(do ///////phase.monad
[?output (primitive_pattern_matching again pathP)]
- (.case ?output
+ (.when ?output
{.#Some output}
(in output)
{.#None}
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(statement expression archive bodyS)
@@ -269,7 +269,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -328,7 +328,7 @@
then!)))
(/////synthesis.!multi_pop nextP)
- (.let [[extra_pops nextP'] (case.count_pops nextP)]
+ (.let [[extra_pops nextP'] (when.count_pops nextP)]
(do ///////phase.monad
[next! (again nextP')]
(///////phase#in (all _.then
@@ -360,9 +360,9 @@
(in (all _.then
(..with_looping in_closure? g!once g!continue?
pattern_matching!)
- (_.statement (_.raise (_.string case.pattern_matching_error)))))))
+ (_.statement (_.raise (_.string when.pattern_matching_error)))))))
-(def .public (case! in_closure? statement expression archive [valueS pathP])
+(def .public (when! in_closure? statement expression archive [valueS pathP])
(-> Bit (Generator! [Synthesis Path]))
(do ///////phase.monad
[stack_init (expression archive valueS)
@@ -373,10 +373,10 @@
pattern_matching!
))))
-(def .public (case statement expression archive case)
+(def .public (when statement expression archive when)
(-> Phase! (Generator [Synthesis Path]))
- (|> case
- (case! true statement expression archive)
+ (|> when
+ (when! true statement expression archive)
(at ///////phase.monad each
(|>> [(list)] (_.lambda {.#None})
(_.apply_lambda (list))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme.lux
index cdedd1a3d..e62788463 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme.lux
@@ -13,7 +13,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" loop]
["[1][0]" function]
["/[1]" //
@@ -30,7 +30,7 @@
(def .public (generate archive synthesis)
Phase
- (case synthesis
+ (when synthesis
(^.with_template [<tag> <generator>]
[(<tag> value)
(//////phase#in (<generator> value))])
@@ -47,12 +47,12 @@
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
[////synthesis.tuple /structure.tuple]
- [////synthesis.branch/let /case.let]
- [////synthesis.branch/if /case.if]
- [////synthesis.branch/get /case.get]
+ [////synthesis.branch/let /when.let]
+ [////synthesis.branch/if /when.if]
+ [////synthesis.branch/get /when.get]
[////synthesis.function/apply /function.apply]
- [////synthesis.branch/case /case.case]
+ [////synthesis.branch/when /when.when]
[////synthesis.loop/scope /loop.scope]
[////synthesis.loop/again /loop.again]
[////synthesis.function/abstraction /function.function])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/function.lux
index cbddbab59..5688d5457 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/function.lux
@@ -17,7 +17,7 @@
["[0]" //
["[1][0]" runtime (.only Operation Phase Generator)]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["//[1]" ///
@@ -44,7 +44,7 @@
(def (with_closure inits function_definition)
(-> (List Expression) Computation (Operation Computation))
(///////phase#in
- (case inits
+ (when inits
{.#End}
function_definition
@@ -59,7 +59,7 @@
(def @missing (_.var "missing"))
(def input
- (|>> ++ //case.register))
+ (|>> ++ //when.register))
(def .public (function expression archive [environment arity bodyS])
(Generator (Abstraction Synthesis))
@@ -80,7 +80,7 @@
(_.letrec (list [@self (_.lambda [(list) {.#Some @curried}]
(_.let (list [@num_args (_.length/1 @curried)])
(<| (_.if (|> @num_args (_.=/2 arityO))
- (<| (_.let (list [(//case.register 0) @self]))
+ (<| (_.let (list [(//when.register 0) @self]))
(_.let_values (list [[(|> (list.indices arity)
(list#each ..input))
{.#None}]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/loop.lux
index d8cf4511e..451de1c90 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/loop.lux
@@ -18,12 +18,12 @@
["_" scheme]]]]]
["[0]" //
[runtime (.only Operation Phase Generator)]
- ["[1][0]" case]
+ ["[1][0]" when]
["/[1]" //
["[1][0]" reference]
["/[1]" //
[synthesis
- ["[0]" case]]
+ ["[0]" when]]
["/[1]" //
["[0]" synthesis (.only Scope Synthesis)]
["[1][0]" generation]
@@ -39,7 +39,7 @@
(def .public (scope expression archive [start initsS+ bodyS])
(Generator (Scope Synthesis))
- (case initsS+
+ (when initsS+
... function/false/non-independent loop
{.#End}
(expression archive bodyS)
@@ -52,7 +52,7 @@
(expression archive bodyS))]
(in (_.letrec (list [@scope (_.lambda [(|> initsS+
list.enumeration
- (list#each (|>> product.left (n.+ start) //case.register)))
+ (list#each (|>> product.left (n.+ start) //when.register)))
{.#None}]
bodyO)])
(_.apply initsO+ @scope))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/runtime.lux
index 31803cfab..e0eb242ec 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/runtime.lux
@@ -81,7 +81,7 @@
(macro.with_symbols [g!_]
(let [runtime (code.local (///reference.artifact [..module_id runtime_id]))
runtime_name (` (_.var (, (code.text (%.code runtime)))))]
- (case declaration
+ (when declaration
{.#Left name}
(let [g!name (code.local name)]
(in (list (` (def .public (, g!name)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/structure.lux
index e98aa8ff4..526b833ff 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/structure.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/structure.lux
@@ -20,7 +20,7 @@
(def .public (tuple expression archive elemsS+)
(Generator (Tuple Synthesis))
- (case elemsS+
+ (when elemsS+
{.#End}
(///////phase#in (//primitive.text /////synthesis.unit))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/when.lux
index a1f679836..b70ccef33 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/scheme/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case let if)
+ [lux (.except when let if)
[abstract
["[0]" monad (.only do)]]
[data
@@ -27,7 +27,7 @@
["[1][0]" reference]
["/[1]" //
["[1][0]" synthesis
- ["[1]/[0]" case]]
+ ["[1]/[0]" when]]
["/[1]" //
["[1][0]" synthesis (.only Member Synthesis Path)]
["[1][0]" generation]
@@ -67,7 +67,7 @@
(do ///////phase.monad
[valueO (expression archive valueS)]
(in (list#mix (function (_ side source)
- (.let [method (.case side
+ (.let [method (.when side
(^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
@@ -130,7 +130,7 @@
(def (pattern_matching' expression archive)
(Generator Path)
(function (again pathP)
- (.case pathP
+ (.when pathP
{/////synthesis.#Then bodyS}
(expression archive bodyS)
@@ -143,7 +143,7 @@
{/////synthesis.#Bit_Fork when thenP elseP}
(do [! ///////phase.monad]
[then! (again thenP)
- else! (.case elseP
+ else! (.when elseP
{.#Some elseP}
(again elseP)
@@ -216,7 +216,7 @@
(try_pm (_.raise/1 (_.string "Invalid expression for pattern-matching.")))
(pattern_matching' expression archive pathP)))
-(def .public (case expression archive [valueS pathP])
+(def .public (when expression archive [valueS pathP])
(Generator [Synthesis Path])
(do [! ///////phase.monad]
[valueO (expression archive valueS)]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux
index b21dbdaae..fba249351 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux
@@ -15,7 +15,7 @@
["^" pattern]]]]]
["[0]" /
["[1][0]" function]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" variable]
["/[1]" //
["[1][0]" extension]
@@ -32,7 +32,7 @@
(def (simple analysis)
(-> ///simple.Simple /simple.Simple)
- (case analysis
+ (when analysis
{///simple.#Unit}
{/simple.#Text /.unit}
@@ -53,7 +53,7 @@
(def (optimization archive)
Phase
(function (optimization' analysis)
- (case analysis
+ (when analysis
{///analysis.#Simple analysis'}
(phase#in {/.#Simple (..simple analysis')})
@@ -62,7 +62,7 @@
{///analysis.#Structure structure}
(/.with_currying? false
- (case structure
+ (when structure
{///complex.#Variant variant}
(do phase.monad
[valueS (optimization' (the ///complex.#value variant))]
@@ -73,9 +73,9 @@
(monad.each phase.monad optimization')
(phase#each (|>> /.tuple)))))
- {///analysis.#Case inputA branchesAB+}
+ {///analysis.#When inputA branchesAB+}
(/.with_currying? false
- (/case.synthesize optimization branchesAB+ archive inputA))
+ (/when.synthesize optimization branchesAB+ archive inputA))
(///analysis.no_op value)
(optimization' value)
@@ -92,7 +92,7 @@
(function (_ state)
(|> (//extension.apply archive optimization [name args])
(phase.result' state)
- (pipe.case
+ (pipe.when
{try.#Success output}
{try.#Success output}
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux
index e9507024a..c1a6184d1 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux
@@ -59,7 +59,7 @@
[funcS (phase archive funcA)
argsS (monad.each ! (phase archive) argsA)]
(with_expansions [<apply> (these (/.function/apply [funcS argsS]))]
- (case funcS
+ (when funcS
(/.function/abstraction functionS)
(if (n.= (the /.#arity functionS)
(list.size argsS))
@@ -69,7 +69,7 @@
(//loop.optimization true locals argsS)
(maybe#each (is (-> [Nat (List Synthesis) Synthesis] Synthesis)
(function (_ [start inits iteration])
- (case iteration
+ (when iteration
(/.loop/scope [start' inits' output])
(if (and (n.= start start')
(list.empty? inits'))
@@ -89,7 +89,7 @@
(def (find_foreign environment register)
(-> (Environment Synthesis) Register (Operation Synthesis))
- (case (list.item register environment)
+ (when (list.item register environment)
{.#Some aliased}
(phase#in aliased)
@@ -98,7 +98,7 @@
(def (grow_path grow path)
(-> (-> Synthesis (Operation Synthesis)) Path (Operation Path))
- (case path
+ (when path
{/.#Bind register}
(phase#in {/.#Bind (++ register)})
@@ -110,16 +110,16 @@
(in {<tag> left' right'}))])
([/.#Alt] [/.#Seq])
- {/.#Bit_Fork when then else}
+ {/.#Bit_Fork test then else}
(do [! phase.monad]
[then (grow_path grow then)
- else (case else
+ else (when else
{.#Some else}
(at ! each (|>> {.#Some}) (grow_path grow else))
{.#None}
(in {.#None}))]
- (in {/.#Bit_Fork when then else}))
+ (in {/.#Bit_Fork test then else}))
(^.with_template [<tag>]
[{<tag> [[test then] elses]}
@@ -145,9 +145,9 @@
(def (grow environment expression)
(-> (Environment Synthesis) Synthesis (Operation Synthesis))
- (case expression
+ (when expression
{/.#Structure structure}
- (case structure
+ (when structure
{////analysis/complex.#Variant [lefts right? subS]}
(|> subS
(grow environment)
@@ -162,9 +162,9 @@
(phase#in (/.function/apply [expression (list (/.variable/local 1))]))
{/.#Reference reference}
- (case reference
+ (when reference
{////reference.#Variable variable}
- (case variable
+ (when variable
{////reference/variable.#Local register}
(phase#in (/.variable/local (++ register)))
@@ -175,9 +175,9 @@
(phase#in expression))
{/.#Control control}
- (case control
+ (when control
{/.#Branch branch}
- (case branch
+ (when branch
{/.#Exec [this that]}
(do phase.monad
[this (grow environment this)
@@ -202,14 +202,14 @@
[inputS' (grow environment inputS)]
(in (/.branch/get [members inputS'])))
- {/.#Case [inputS pathS]}
+ {/.#When [inputS pathS]}
(do phase.monad
[inputS' (grow environment inputS)
pathS' (grow_path (grow environment) pathS)]
- (in (/.branch/case [inputS' pathS']))))
+ (in (/.branch/when [inputS' pathS']))))
{/.#Loop loop}
- (case loop
+ (when loop
{/.#Scope [start initsS+ iterationS]}
(do [! phase.monad]
[initsS+' (monad.each ! (grow environment) initsS+)
@@ -222,11 +222,11 @@
(phase#each (|>> /.loop/again))))
{/.#Function function}
- (case function
+ (when function
{/.#Abstraction [_env _arity _body]}
(do [! phase.monad]
[_env' (monad.each !
- (|>> (pipe.case
+ (|>> (pipe.when
{/.#Reference {////reference.#Variable {////reference/variable.#Foreign register}}}
(..find_foreign environment register)
@@ -239,7 +239,7 @@
(do [! phase.monad]
[funcS (grow environment funcS)
argsS+ (monad.each ! (grow environment) argsS+)]
- (in (/.function/apply (case funcS
+ (in (/.function/apply (when funcS
(/.function/apply [(..self_reference) pre_argsS+])
[(..self_reference)
(list#composite pre_argsS+ argsS+)]
@@ -264,7 +264,7 @@
(/.with_locals 2
(phase archive bodyA)))
abstraction (is (Operation Abstraction)
- (case bodyS
+ (when bodyS
(/.function/abstraction [env' down_arity' bodyS'])
(|> bodyS'
(grow env')
@@ -281,7 +281,7 @@
(in (/.function/abstraction
(if currying?
abstraction
- (case (//loop.optimization false 1 (list) abstraction)
+ (when (//loop.optimization false 1 (list) abstraction)
{.#Some [startL initsL bodyL]}
[/.#environment environment
/.#arity (the /.#arity abstraction)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/loop.lux
index c967930bf..0ae8912f8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/loop.lux
@@ -33,7 +33,7 @@
(def (path_optimization body_optimization offset)
(-> (Transform Synthesis) Register (Transform Path))
(function (again path)
- (case path
+ (when path
{/.#Bind register}
{.#Some {/.#Bind (register_optimization offset register)}}
@@ -45,16 +45,16 @@
(in {<tag> left' right'}))])
([/.#Alt] [/.#Seq])
- {/.#Bit_Fork when then else}
+ {/.#Bit_Fork test then else}
(do [! maybe.monad]
[then (again then)
- else (case else
+ else (when else
{.#Some else}
(at ! each (|>> {.#Some}) (again else))
{.#None}
(in {.#None}))]
- (in {/.#Bit_Fork when then else}))
+ (in {/.#Bit_Fork test then else}))
(^.with_template [<tag>]
[{<tag> [[test then] elses]}
@@ -82,12 +82,12 @@
(-> Bit Register (Environment Synthesis) Arity (Transform Synthesis))
(loop (again [return? true
expr expr])
- (case expr
+ (when expr
{/.#Simple _}
{.#Some expr}
{/.#Structure structure}
- (case structure
+ (when structure
{analysis/complex.#Variant variant}
(do maybe.monad
[value' (|> variant (the analysis/complex.#value) (again false))]
@@ -101,7 +101,7 @@
(maybe#each (|>> /.tuple))))
{/.#Reference reference}
- (case reference
+ (when reference
{reference.#Variable (variable.self)}
(if true_loop?
{.#None}
@@ -118,11 +118,11 @@
(list.item register scope_environment)
{.#Some expr}))
- (/.branch/case [input path])
+ (/.branch/when [input path])
(do maybe.monad
[input' (again false input)
path' (path_optimization (again return?) offset path)]
- (in (|> path' [input'] /.branch/case)))
+ (in (|> path' [input'] /.branch/when)))
(/.branch/exec [this that])
(do maybe.monad
@@ -174,7 +174,7 @@
(with_expansions [<application> (these (do !
[abstraction' (again false abstraction)]
(in (/.function/apply [abstraction' arguments']))))]
- (case abstraction
+ (when abstraction
{/.#Reference {reference.#Variable (variable.self)}}
(if (and return?
(n.= arity (list.size arguments)))
@@ -193,7 +193,7 @@
[input (again false input)
matches (monad.each !
(function (_ match)
- (case match
+ (when match
{/.#Structure {analysis/complex.#Tuple (list when then)}}
(do !
[when (again false when)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/variable.lux
index f6ef820af..0f0d88bdd 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/variable.lux
@@ -43,7 +43,7 @@
(def (remove_local_from_path remove_local redundant)
(-> (Remover Synthesis) (Remover Path))
(function (again path)
- (case path
+ (when path
{/.#Seq {/.#Bind register}
post}
(if (n.= redundant register)
@@ -101,7 +101,7 @@
(def (remove_local_from_variable redundant variable)
(Remover Variable)
- (case variable
+ (when variable
{variable.#Local register}
{variable.#Local (..prune redundant register)}
@@ -111,12 +111,12 @@
(def (remove_local redundant)
(Remover Synthesis)
(function (again synthesis)
- (case synthesis
+ (when synthesis
{/.#Simple _}
synthesis
{/.#Structure structure}
- {/.#Structure (case structure
+ {/.#Structure (when structure
{analysis/complex.#Variant [lefts right value]}
{analysis/complex.#Variant [lefts right (again value)]}
@@ -124,7 +124,7 @@
{analysis/complex.#Tuple (list#each again tuple)})}
{/.#Reference reference}
- (case reference
+ (when reference
{reference.#Variable variable}
(/.variable (..remove_local_from_variable redundant variable))
@@ -132,9 +132,9 @@
synthesis)
{/.#Control control}
- {/.#Control (case control
+ {/.#Control (when control
{/.#Branch branch}
- {/.#Branch (case branch
+ {/.#Branch (when branch
{/.#Exec this that}
{/.#Exec (again this)
(again that)}
@@ -150,11 +150,11 @@
{/.#Get path record}
{/.#Get path (again record)}
- {/.#Case input path}
- {/.#Case (again input) (remove_local_from_path remove_local redundant path)})}
+ {/.#When input path}
+ {/.#When (again input) (remove_local_from_path remove_local redundant path)})}
{/.#Loop loop}
- {/.#Loop (case loop
+ {/.#Loop (when loop
{/.#Scope [start inits iteration]}
{/.#Scope [(..prune redundant start)
(list#each again inits)
@@ -164,7 +164,7 @@
{/.#Again (list#each again resets)})}
{/.#Function function}
- {/.#Function (case function
+ {/.#Function (when function
{/.#Abstraction [environment arity body]}
{/.#Abstraction [(list#each again environment)
arity
@@ -205,7 +205,7 @@
(def (list_optimization optimization)
(All (_ a) (-> (Optimization a) (Optimization (List a))))
(function (again [redundancy values])
- (case values
+ (when values
{.#End}
{try.#Success [redundancy
values]}
@@ -228,7 +228,7 @@
(def (declare register redundancy)
(-> Register Redundancy (Try Redundancy))
- (case (dictionary.value register redundancy)
+ (when (dictionary.value register redundancy)
{.#None}
{try.#Success (dictionary.has register ..redundant! redundancy)}
@@ -237,7 +237,7 @@
(def (observe register redundancy)
(-> Register Redundancy (Try Redundancy))
- (case (dictionary.value register redundancy)
+ (when (dictionary.value register redundancy)
{.#None}
(exception.except ..unknown_register [register])
@@ -255,16 +255,16 @@
(def (path_optimization optimization)
(-> (Optimization Synthesis) (Optimization Path))
(function (again [redundancy path])
- (case path
+ (when path
(^.or {/.#Pop}
{/.#Access _})
{try.#Success [redundancy
path]}
- {/.#Bit_Fork when then else}
+ {/.#Bit_Fork test then else}
(do [! try.monad]
[[redundancy then] (again [redundancy then])
- [redundancy else] (case else
+ [redundancy else] (when else
{.#Some else}
(at ! each
(function (_ [redundancy else])
@@ -273,7 +273,7 @@
{.#None}
(in [redundancy {.#None}]))]
- (in [redundancy {/.#Bit_Fork when then else}]))
+ (in [redundancy {/.#Bit_Fork test then else}]))
(^.with_template [<tag> <type>]
[{<tag> [[test then] elses]}
@@ -334,12 +334,12 @@
(Optimization Synthesis)
(with_expansions [<no_op> (these {try.#Success [redundancy
synthesis]})]
- (case synthesis
+ (when synthesis
{/.#Simple _}
<no_op>
{/.#Structure structure}
- (case structure
+ (when structure
{analysis/complex.#Variant [lefts right value]}
(do try.monad
[[redundancy value] (optimization' [redundancy value])]
@@ -353,9 +353,9 @@
{/.#Structure {analysis/complex.#Tuple tuple}}])))
{/.#Reference reference}
- (case reference
+ (when reference
{reference.#Variable variable}
- (case variable
+ (when variable
{variable.#Local register}
(do try.monad
[redundancy (..observe register redundancy)]
@@ -368,9 +368,9 @@
<no_op>)
{/.#Control control}
- (case control
+ (when control
{/.#Branch branch}
- (case branch
+ (when branch
{/.#Exec this that}
(do try.monad
[[redundancy this] (optimization' [redundancy this])
@@ -405,15 +405,15 @@
(in [redundancy
{/.#Control {/.#Branch {/.#Get path record}}}]))
- {/.#Case input path}
+ {/.#When input path}
(do try.monad
[[redundancy input] (optimization' [redundancy input])
[redundancy path] (..path_optimization optimization' [redundancy path])]
(in [redundancy
- {/.#Control {/.#Branch {/.#Case input path}}}])))
+ {/.#Control {/.#Branch {/.#When input path}}}])))
{/.#Loop loop}
- (case loop
+ (when loop
{/.#Scope [start inits iteration]}
(do try.monad
[[redundancy inits] (..list_optimization optimization' [redundancy inits])
@@ -429,7 +429,7 @@
{/.#Control {/.#Loop {/.#Again resets}}}])))
{/.#Function function}
- (case function
+ (when function
{/.#Abstraction [environment arity body]}
(do [! try.monad]
[[redundancy environment] (..list_optimization optimization' [redundancy environment])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux
index d6d6f31ed..c41a41da0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux
@@ -44,9 +44,9 @@
(def (path' pattern end? thenC)
(-> Pattern Bit (Operation Path) (Operation Path))
- (case pattern
+ (when pattern
{///pattern.#Simple simple}
- (case simple
+ (when simple
{///simple.#Unit}
thenC
@@ -75,13 +75,15 @@
(<| (///#each (|>> {/.#Seq {/.#Access {/access.#Side [/side.#lefts lefts
/side.#right? right?]}}}))
(path' value_pattern end?)
- (pipe.when [(pipe.new (not end?) [])] [(///#each ..clean_up)])
+ (pipe.if [(pipe.new (not end?) [])]
+ [(///#each ..clean_up)]
+ [])
thenC)
{///pattern.#Complex {///complex.#Tuple tuple}}
(let [tuple::last (-- (list.size tuple))]
(list#mix (function (_ [tuple::lefts tuple::member] nextC)
- (.case tuple::member
+ (.when tuple::member
{///pattern.#Simple {///simple.#Unit}}
nextC
@@ -93,7 +95,9 @@
tuple::lefts)
/member.#right? right?]}}}))
(path' tuple::member end?')
- (pipe.when [(pipe.new (not end?') [])] [(///#each ..clean_up)])
+ (pipe.if [(pipe.new (not end?') [])]
+ [(///#each ..clean_up)]
+ [])
nextC))))
thenC
(list.reversed (list.enumeration tuple))))
@@ -110,7 +114,7 @@
(if (at equivalence = new_test old_test)
[[old_test (weave new_then old_then)] old_tail]
[[old_test old_then]
- (case old_tail
+ (when old_tail
{.#End}
(list [new_test new_then])
@@ -126,7 +130,7 @@
(def (weave new old)
(-> Path Path Path)
(with_expansions [<default> (these {/.#Alt old new})]
- (case [new old]
+ (when [new old]
[_
{/.#Alt old_left old_right}]
{/.#Alt old_left
@@ -134,7 +138,7 @@
[{/.#Seq preN postN}
{/.#Seq preO postO}]
- (case (weave preN preO)
+ (when (weave preN preO)
{/.#Alt _}
<default>
@@ -149,7 +153,7 @@
(if (bit#= new_when old_when)
{/.#Bit_Fork old_when
(weave new_then old_then)
- (case [new_else old_else]
+ (when [new_else old_else]
[{.#None} {.#None}]
{.#None}
@@ -160,13 +164,13 @@
[{.#Some new_else} {.#Some old_else}]
{.#Some (weave new_else old_else)})}
{/.#Bit_Fork old_when
- (case new_else
+ (when new_else
{.#None}
old_then
{.#Some new_else}
(weave new_else old_then))
- {.#Some (case old_else
+ {.#Some (when old_else
{.#None}
new_then
@@ -212,12 +216,12 @@
(-- lefts)
lefts)
/member.#right? right?]))]
- (case patterns
+ (when patterns
{.#End}
<failure>
{.#Item head tail}
- (case head
+ (when head
{///pattern.#Simple {///simple.#Unit}}
<continue>
@@ -227,7 +231,7 @@
<continue>)
{///pattern.#Complex {///complex.#Tuple sub_patterns}}
- (case (get sub_patterns @selection)
+ (when (get sub_patterns @selection)
{.#End}
<continue>
@@ -237,12 +241,12 @@
_
<failure>)))))
-(def .public (synthesize_case synthesize archive input [[headP headA] tailPA+])
+(def .public (synthesize_when synthesize archive input [[headP headA] tailPA+])
(-> Phase Archive Synthesis Match (Operation Synthesis))
(do [! ///.monad]
[headSP (path archive synthesize headP headA)
tailSP+ (monad.each ! (product.uncurried (path archive synthesize)) tailPA+)]
- (in (/.branch/case [input (list#mix weave headSP tailSP+)]))))
+ (in (/.branch/when [input (list#mix weave headSP tailSP+)]))))
(def !masking
(template (_ <variable> <output>)
@@ -284,12 +288,12 @@
(def .public (synthesize_get synthesize archive input patterns @member)
(-> Phase Archive Synthesis (///complex.Tuple Pattern) Register (Operation Synthesis))
- (case (..get patterns @member)
+ (when (..get patterns @member)
{.#End}
- (..synthesize_case synthesize archive input (!get patterns @member))
+ (..synthesize_when synthesize archive input (!get patterns @member))
path
- (case input
+ (when input
(/.branch/get [sub_path sub_input])
(///#in (/.branch/get [(list#composite path sub_path) sub_input]))
@@ -300,13 +304,13 @@
(-> Phase Match Phase)
(do [! ///.monad]
[inputS (synthesize^ archive inputA)]
- (case [headB tailB+]
+ (when [headB tailB+]
(!masking @variable @output)
(..synthesize_masking synthesize^ archive inputS @variable @output)
[[(///pattern.unit) body]
{.#End}]
- (case inputA
+ (when inputA
(^.or {///analysis.#Simple _}
{///analysis.#Structure _}
{///analysis.#Reference _})
@@ -334,11 +338,11 @@
(..synthesize_get synthesize^ archive inputS patterns @member)
match
- (..synthesize_case synthesize^ archive inputS match))))
+ (..synthesize_when synthesize^ archive inputS match))))
(def .public (count_pops path)
(-> Path [Nat Path])
- (case path
+ (when path
(/.path/seq {/.#Pop} path')
(let [[pops post_pops] (count_pops path')]
[(++ pops) post_pops])
@@ -369,7 +373,7 @@
(-> Path Storage)
(loop (for_path [path path
path_storage ..empty])
- (case path
+ (when path
(^.or {/.#Pop}
{/.#Access Access})
path_storage
@@ -379,7 +383,7 @@
path_storage)
{/.#Bit_Fork _ default otherwise}
- (|> (case otherwise
+ (|> (when otherwise
{.#None}
path_storage
@@ -401,7 +405,7 @@
(/.path/then bodyS)
(loop (for_synthesis [bodyS bodyS
synthesis_storage path_storage])
- (case bodyS
+ (when bodyS
(^.or {/.#Simple _}
(/.constant _))
synthesis_storage
@@ -426,7 +430,7 @@
(/.function/abstraction [environment arity bodyS])
(list#mix for_synthesis synthesis_storage environment)
- (/.branch/case [inputS pathS])
+ (/.branch/when [inputS pathS])
(revised #dependencies
(set.union (the #dependencies (for_path pathS synthesis_storage)))
(for_synthesis inputS synthesis_storage))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/program.lux b/stdlib/source/library/lux/meta/compiler/language/lux/program.lux
index 502922736..864a8f817 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/program.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/program.lux
@@ -43,7 +43,7 @@
[id (archive.id module archive)
[_module output registry] (archive.find module archive)]
(in [[module id] registry])))))]
- (case (list.one (function (_ [[module module_id] registry])
+ (when (list.one (function (_ [[module module_id] registry])
(do maybe.monad
[program_id (registry.id ..name registry)]
(in [module_id program_id])))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/meta/compiler/language/lux/syntax.lux
index 86d0cc16a..bbf548818 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/syntax.lux
@@ -215,7 +215,7 @@
(def !letE
(template (_ <binding> <computation> <body>)
- [(case <computation>
+ [(when <computation>
{.#Right <binding>}
<body>
@@ -251,7 +251,7 @@
(Either [Source Text] [Source Code]))
(loop (again [source (is Source [(!forward 1 where) offset source_code])
stack (is (List Code) {.#End})])
- (case (parse source)
+ (when (parse source)
{.#Right [source' top]}
(again source' {.#Item top stack})
@@ -271,7 +271,7 @@
(def !guarantee_no_new_lines
(template (_ where offset source_code content body)
- [(case ("lux text index" 0 (static text.new_line) content)
+ [(when ("lux text index" 0 (static text.new_line) content)
{.#None}
body
@@ -281,7 +281,7 @@
(def (text_parser where offset source_code)
(-> Location Offset Text (Either [Source Text] [Source Code]))
- (case ("lux text index" offset (static ..text_delimiter) source_code)
+ (when ("lux text index" offset (static ..text_delimiter) source_code)
{.#Some g!end}
(<| (let [g!content (!clip offset g!end source_code)])
(!guarantee_no_new_lines where offset source_code g!content)
@@ -348,7 +348,7 @@
(def !number_output
(template (_ <source_code> <start> <end> <codec> <tag>)
- [(case (|> <source_code>
+ [(when (|> <source_code>
(!clip <start> <end>)
(text.replaced ..digit_separator "")
(at <codec> decoded))
@@ -562,7 +562,7 @@
... It's either a Rev, a symbol, or a comment.
(with_expansions [<rev_parser> (rev_parser source_code//size offset/0 where (!++ offset/1) source_code)
<short_symbol_parser> (!short_symbol_parser source_code//size current_module [where offset/1 source_code] where .#Symbol)
- <comment_parser> (case ("lux text index" (!++ offset/1) (static text.new_line) source_code)
+ <comment_parser> (when ("lux text index" (!++ offset/1) (static text.new_line) source_code)
{.#Some end}
(again (!vertical where end source_code))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux
index 735da0f51..29b3604b8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux
@@ -98,7 +98,7 @@
{#Let s Register s}
{#If s s s}
{#Get (List Member) s}
- {#Case s (Path' s)}))
+ {#When s (Path' s)}))
(type .public (Scope s)
(Record
@@ -274,7 +274,7 @@
{<tag>}
content)]))]
- [branch/case ..#Branch ..#Case]
+ [branch/when ..#Branch ..#When]
[branch/exec ..#Branch ..#Exec]
[branch/let ..#Branch ..#Let]
[branch/if ..#Branch ..#If]
@@ -289,16 +289,16 @@
(def .public (%path' %then value)
(All (_ a) (-> (Format a) (Format (Path' a))))
- (case value
+ (when value
{#Pop}
"_"
- {#Bit_Fork when then else}
+ {#Bit_Fork test then else}
(format "(?"
- " " (%.bit when) " " (%path' %then then)
- (case else
+ " " (%.bit test) " " (%path' %then then)
+ (when else
{.#Some else}
- (format " " (%.bit (not when)) " " (%path' %then else))
+ (format " " (%.bit (not test)) " " (%path' %then else))
{.#None}
"")
@@ -333,12 +333,12 @@
(def .public (%synthesis value)
(Format Synthesis)
- (case value
+ (when value
{#Simple it}
(/simple.format it)
{#Structure structure}
- (case structure
+ (when structure
{analysis/complex.#Variant [lefts right? content]}
(|> (%synthesis content)
(format (%.nat lefts) " " (%.bit right?) " ")
@@ -354,9 +354,9 @@
(reference.format reference)
{#Control control}
- (case control
+ (when control
{#Function function}
- (case function
+ (when function
{#Abstraction [environment arity body]}
(let [environment' (|> environment
(list#each %synthesis)
@@ -373,7 +373,7 @@
(text.enclosed ["(" ")"])))
{#Branch branch}
- (case branch
+ (when branch
{#Exec this that}
(|> (format (%synthesis this) " " (%synthesis that))
(text.enclosed ["{#exec " "}"]))
@@ -392,12 +392,12 @@
" " (%synthesis record))
(text.enclosed ["{#get " "}"]))
- {#Case input path}
+ {#When input path}
(|> (format (%synthesis input) " " (%path' %synthesis path))
- (text.enclosed ["{#case " "}"])))
+ (text.enclosed ["{#when " "}"])))
{#Loop loop}
- (case loop
+ (when loop
{#Scope scope}
(|> (format (%.nat (the #start scope))
" " (|> (the #inits scope)
@@ -427,7 +427,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Path' a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Pop} {#Pop}]
true
@@ -473,7 +473,7 @@
(..path'_equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (when value
{#Pop}
2
@@ -491,9 +491,9 @@
(^.with_template [<factor> <tag> <hash>]
[{<tag> item}
- (let [case_hash (product.hash <hash>
+ (let [when_hash (product.hash <hash>
(path'_hash super))
- item_hash (product.hash case_hash (list.hash case_hash))]
+ item_hash (product.hash when_hash (list.hash when_hash))]
(n.* <factor> (at item_hash hash item)))])
([11 #I64_Fork i64.hash]
[13 #F64_Fork f.hash]
@@ -515,7 +515,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Branch a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Let [reference_input reference_register reference_body]}
{#Let [sample_input sample_register sample_body]}]
(and (#= reference_input sample_input)
@@ -533,8 +533,8 @@
(and (at (list.equivalence /member.equivalence) = reference_path sample_path)
(#= reference_record sample_record))
- [{#Case [reference_input reference_path]}
- {#Case [sample_input sample_path]}]
+ [{#When [reference_input reference_path]}
+ {#When [sample_input sample_path]}]
(and (#= reference_input sample_input)
(at (path'_equivalence #=) = reference_path sample_path))
@@ -548,7 +548,7 @@
(..branch_equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (when value
{#Exec this that}
(all n.* 2
(at super hash this)
@@ -571,7 +571,7 @@
(at (list.hash /member.hash) hash path)
(at super hash record))
- {#Case [input path]}
+ {#When [input path]}
(all n.* 11
(at super hash input)
(at (..path'_hash super) hash path))
@@ -581,7 +581,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Loop a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Scope [reference_start reference_inits reference_iteration]}
{#Scope [sample_start sample_inits sample_iteration]}]
(and (n.= reference_start sample_start)
@@ -601,7 +601,7 @@
(..loop_equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (when value
{#Scope [start inits iteration]}
(all n.* 2
(at n.hash hash start)
@@ -617,7 +617,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Function a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Abstraction [reference_environment reference_arity reference_body]}
{#Abstraction [sample_environment sample_arity sample_body]}]
(and (at (list.equivalence #=) = reference_environment sample_environment)
@@ -639,7 +639,7 @@
(..function_equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (when value
{#Abstraction [environment arity body]}
(all n.* 2
(at (list.hash super) hash environment)
@@ -656,7 +656,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Control a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at (<equivalence> #=) = reference sample)])
@@ -674,7 +674,7 @@
(..control_equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (when value
(^.with_template [<factor> <tag> <hash>]
[{<tag> value}
(n.* <factor> (at (<hash> super) hash value))])
@@ -687,7 +687,7 @@
(Equivalence Synthesis)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag> <equivalence>]
[[{<tag> reference'} {<tag> sample'}]
(at <equivalence> = reference' sample')])
@@ -711,7 +711,7 @@
(def (hash value)
(let [again_hash [..equivalence hash]]
- (case value
+ (when value
(^.with_template [<tag> <hash>]
[{<tag> value}
(at <hash> hash value)])
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/access.lux b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/access.lux
index f599f4d90..fc1d14e8f 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/access.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/access.lux
@@ -19,7 +19,7 @@
(def .public (format it)
(Format Access)
- (case it
+ (when it
{#Side it}
(/side.format it)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/simple.lux b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/simple.lux
index 738ea9b76..a44021d1f 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/simple.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis/simple.lux
@@ -29,7 +29,7 @@
(def .public (format it)
(%.Format Simple)
- (case it
+ (when it
(^.with_template [<pattern> <format>]
[{<pattern> value}
(<format> value)])
@@ -44,7 +44,7 @@
(Equivalence Simple)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag> <eq> <format>]
[[{<tag> reference'} {<tag> sample'}]
(<eq> reference' sample')])
@@ -64,7 +64,7 @@
(def equivalence ..equivalence)
(def hash
- (|>> (pipe.case
+ (|>> (pipe.when
(^.with_template [<factor> <tag> <hash>]
[{<tag> value'}
(n.* <factor> (at <hash> hash value'))])
diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive.lux b/stdlib/source/library/lux/meta/compiler/meta/archive.lux
index a67b84f92..bcbdcaff4 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/archive.lux
@@ -89,7 +89,7 @@
(def .public (id module archive)
(-> descriptor.Module Archive (Try module.ID))
(let [(open "/[0]") (representation archive)]
- (case (dictionary.value module /#resolver)
+ (when (dictionary.value module /#resolver)
{.#Some [id _]}
{try.#Success id}
@@ -100,7 +100,7 @@
(def .public (reserve module archive)
(-> descriptor.Module Archive (Try [module.ID Archive]))
(let [(open "/[0]") (representation archive)]
- (case (dictionary.value module /#resolver)
+ (when (dictionary.value module /#resolver)
{.#Some _}
(exception.except ..module_has_already_been_reserved [module])
@@ -115,7 +115,7 @@
(def .public (has module entry archive)
(-> descriptor.Module (Entry Any) Archive (Try Archive))
(let [(open "/[0]") (representation archive)]
- (case (dictionary.value module /#resolver)
+ (when (dictionary.value module /#resolver)
{.#Some [id {.#None}]}
{try.#Success (|> archive
representation
@@ -143,7 +143,7 @@
(def .public (find module archive)
(-> descriptor.Module Archive (Try (Entry Any)))
(let [(open "/[0]") (representation archive)]
- (case (dictionary.value module /#resolver)
+ (when (dictionary.value module /#resolver)
{.#Some [id {.#Some entry}]}
{try.#Success entry}
@@ -155,7 +155,7 @@
(def .public (archived? archive module)
(-> Archive descriptor.Module Bit)
- (case (..find module archive)
+ (when (..find module archive)
{try.#Success _}
true
@@ -168,14 +168,14 @@
(the #resolver)
dictionary.entries
(list.all (function (_ [module [id descriptor+document]])
- (case descriptor+document
+ (when descriptor+document
{.#Some _} {.#Some module}
{.#None} {.#None})))))
(def .public (reserved? archive module)
(-> Archive descriptor.Module Bit)
(let [(open "/[0]") (representation archive)]
- (case (dictionary.value module /#resolver)
+ (when (dictionary.value module /#resolver)
{.#Some [id _]}
true
@@ -204,7 +204,7 @@
(revised #next (n.max +next))
(revised #resolver (function (_ resolver)
(list#mix (function (_ [module [id entry]] resolver)
- (case entry
+ (when entry
{.#Some _}
(dictionary.has module [id entry] resolver)
@@ -240,7 +240,7 @@
(|> /#resolver
dictionary.entries
(list.all (function (_ [module [id descriptor+document]])
- (case descriptor+document
+ (when descriptor+document
{.#Some _} {.#Some [module id]}
{.#None} {.#None})))
[version /#next]
diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/artifact/category.lux
index 706ea16ae..0afb9adc5 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/archive/artifact/category.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/archive/artifact/category.lux
@@ -45,7 +45,7 @@
(Equivalence Category)
(implementation
(def (= left right)
- (case [left right]
+ (when [left right]
[{#Anonymous} {#Anonymous}]
true
diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/module/descriptor.lux
index 057f72e6e..f9cfae82a 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/archive/module/descriptor.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/archive/module/descriptor.lux
@@ -41,7 +41,7 @@
(Equivalence Module_State)
(implementation
(def (= left right)
- (case [left right]
+ (when [left right]
(^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux
index 48f9fb04c..9f1e240d9 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux
@@ -82,7 +82,7 @@
sequence.list
(list.all (|>> product.left
(the //.#category)
- (pipe.case
+ (pipe.when
{<tag> it} {.#Some it}
_ {.#None})))))]
@@ -119,7 +119,7 @@
))
category (is (Format Category)
(function (_ value)
- (case value
+ (when value
(^.with_template [<nat> <tag> <format>]
[{<tag> value}
((binary.and binary.nat <format>) [<nat> value])])
@@ -164,7 +164,7 @@
category (is (Parser Category)
(do [! <>.monad]
[tag <binary>.nat]
- (case tag
+ (when tag
(^.with_template [<nat> <tag> <parser>]
[<nat>
(at ! each (|>> {<tag>}) <parser>)])
@@ -185,7 +185,7 @@
(|> (<binary>.sequence_64 (all <>.and category mandatory? dependencies))
(at <>.monad each (sequence#mix (function (_ [category mandatory? dependencies] registry)
(product.right
- (case category
+ (when category
{//category.#Anonymous}
(..resource mandatory? dependencies registry)
diff --git a/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/artifact.lux
index 9f1d8bf22..26f28d451 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/artifact.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/artifact.lux
@@ -38,7 +38,7 @@
(-> (-> Synthesis (List Constant))
(-> Path (List Constant)))
(function (again path)
- (case path
+ (when path
(^.or {synthesis.#Pop}
{synthesis.#Access _}
{synthesis.#Bind _})
@@ -52,8 +52,8 @@
([synthesis.#Alt]
[synthesis.#Seq])
- {synthesis.#Bit_Fork when then else}
- (case else
+ {synthesis.#Bit_Fork test then else}
+ (when else
{.#Some else}
(.all list#composite
(again then)
@@ -76,12 +76,12 @@
(def (references value)
(-> Synthesis (List Constant))
- (case value
+ (when value
{synthesis.#Simple value}
(list)
{synthesis.#Structure value}
- (case value
+ (when value
{analysis/complex.#Variant value}
(|> value
(the analysis/complex.#value)
@@ -93,7 +93,7 @@
list#conjoint))
{synthesis.#Reference value}
- (case value
+ (when value
{reference.#Variable _}
(list)
@@ -101,9 +101,9 @@
(list value))
{synthesis.#Control value}
- (case value
+ (when value
{synthesis.#Branch value}
- (case value
+ (when value
{synthesis.#Exec this that}
(.all list#composite
(references this)
@@ -123,13 +123,13 @@
{synthesis.#Get _ record}
(references record)
- {synthesis.#Case input path}
+ {synthesis.#When input path}
(.all list#composite
(references input)
(path_references references path)))
{synthesis.#Loop value}
- (case value
+ (when value
{synthesis.#Scope value}
(let [of_inits (|> value
(the synthesis.#inits)
@@ -145,7 +145,7 @@
list#conjoint))
{synthesis.#Function value}
- (case value
+ (when value
{synthesis.#Abstraction value}
(|> value
(the synthesis.#body)
@@ -217,11 +217,11 @@
(let [[mandatory immediate] (immediate_dependencies archive)]
(loop (again [pending mandatory
minimum unit.none])
- (case pending
+ (when pending
{.#Item head tail}
(if (set.member? minimum head)
(again tail minimum)
- (again (case (dictionary.value head immediate)
+ (again (when (dictionary.value head immediate)
{.#Some additional}
(list#composite (set.list additional) tail)
diff --git a/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/module.lux b/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/module.lux
index 0a9b6028f..60e4af536 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/module.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/cache/dependency/module.lux
@@ -57,7 +57,7 @@
(let [memo (is (Memo descriptor.Module Ancestry)
(function (_ again module)
(do [! state.monad]
- [.let [parents (case (archive.find module archive)
+ [.let [parents (when (archive.find module archive)
{try.#Success [module output registry]}
(the [module.#descriptor descriptor.#references] module)
diff --git a/stdlib/source/library/lux/meta/compiler/meta/cache/module.lux b/stdlib/source/library/lux/meta/compiler/meta/cache/module.lux
index 081911993..619e3db90 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/cache/module.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/cache/module.lux
@@ -55,14 +55,14 @@
error])]
(do !
[? (//.enable! ! fs context)]
- (case ?
+ (when ?
{try.#Failure error}
(in <failure>)
success
(|> path
(at fs make_directory)
- (at ! each (|>> (pipe.case
+ (at ! each (|>> (pipe.when
{try.#Failure error}
<failure>
diff --git a/stdlib/source/library/lux/meta/compiler/meta/cli.lux b/stdlib/source/library/lux/meta/compiler/meta/cli.lux
index 21d0885ad..37adb69f4 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/cli.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/cli.lux
@@ -114,7 +114,7 @@
(def .public target
(-> Service Target)
- (|>> (pipe.case
+ (|>> (pipe.when
(^.or {#Compilation [host_dependencies libraries compilers sources target module]}
{#Interpretation [host_dependencies libraries compilers sources target module]}
{#Export [sources target]})
diff --git a/stdlib/source/library/lux/meta/compiler/meta/import.lux b/stdlib/source/library/lux/meta/compiler/meta/import.lux
index b904d3df6..500de0a6f 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/import.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/import.lux
@@ -50,10 +50,10 @@
(at ! conjoint)
(at ! each (|>> sequence.list
(monad.mix ! (function (_ entry import)
- (case entry
+ (when entry
{tar.#Normal [path instant mode ownership content]}
(let [path (tar.from_path path)]
- (case (dictionary.has' path (tar.data content) import)
+ (when (dictionary.has' path (tar.data content) import)
{try.#Failure error}
(exception.except ..duplicate [library path])
diff --git a/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux b/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux
index cf8d212f8..40e32ad80 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux
@@ -120,13 +120,13 @@
bundles ..empty_bundles
output (is Output sequence.empty)])
(let [[analysers synthesizers generators declarations] bundles]
- (case input
+ (when input
{.#Item [[[@artifact artifact_category mandatory_artifact?] artifact_dependencies] input']}
- (case (do !
+ (when (do !
[data (try.of_maybe (dictionary.value (format (%.nat @artifact) extension) actual))
.let [context [@module @artifact]
declaration (at host ingest context data)]]
- (case artifact_category
+ (when artifact_category
{category.#Anonymous}
(do !
[.let [output (sequence.suffix [@artifact {.#None} data] output)]
@@ -220,7 +220,7 @@
{try.#Success [definitions bundles output]}))))
content (document.content $.key document)
definitions (monad.each ! (function (_ [def_name def_global])
- (case def_global
+ (when def_global
(^.with_template [<tag>]
[{<tag> payload}
(in [def_name {<tag> payload}])])
@@ -269,7 +269,7 @@
(def (cache_parser customs)
(-> (List Custom) (Parser [(module.Module Any) Registry]))
- (case (for @.old (as (List (Custom Any Any Any))
+ (when (for @.old (as (List (Custom Any Any Any))
customs)
customs)
{.#End}
@@ -380,7 +380,7 @@
(Async (Try [Archive .Lux Bundles]))))
(do async.monad
[binary (at fs read (cache/archive.descriptor fs context))]
- (case binary
+ (when binary
{try.#Success binary}
(do (try.with async.monad)
[archive (async#in (archive.import ///.version binary))]
diff --git a/stdlib/source/library/lux/meta/compiler/meta/io/context.lux b/stdlib/source/library/lux/meta/compiler/meta/io/context.lux
index d5cc32d72..e6a80f7a5 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/io/context.lux
@@ -58,7 +58,7 @@
(def (find_source_file fs importer contexts module extension)
(-> (file.System Async) Module (List Context) Module Extension
(Async (Try file.Path)))
- (case contexts
+ (when contexts
{.#End}
(async#in (exception.except ..cannot_find_module [importer module]))
@@ -81,7 +81,7 @@
... Normal Lux files (i.e. without a host extension) are then picked as fallback files.
(do [! async.monad]
[outcome (..find_source_file fs importer contexts module (..full_host_extension partial_host_extension))]
- (case outcome
+ (when outcome
{try.#Success path}
(|> path
(at fs read)
@@ -97,13 +97,13 @@
(def (find_library_source_file importer import partial_host_extension module)
(-> Module Import Extension Module (Try [file.Path Binary]))
(let [path (format module (..full_host_extension partial_host_extension))]
- (case (dictionary.value path import)
+ (when (dictionary.value path import)
{.#Some data}
{try.#Success [path data]}
{.#None}
(let [path (format module ..lux_extension)]
- (case (dictionary.value path import)
+ (when (dictionary.value path import)
{.#Some data}
{try.#Success [path data]}
@@ -117,7 +117,7 @@
... Normal Lux files (i.e. without a host extension) are then picked as fallback files.
(do [! async.monad]
[outcome (find_local_source_file fs importer import contexts partial_host_extension module)]
- (case outcome
+ (when outcome
{try.#Success [path data]}
(in outcome)
@@ -129,7 +129,7 @@
(Async (Try Input)))
(do (try.with async.monad)
[[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)]
- (case (at utf8.codec decoded binary)
+ (when (at utf8.codec decoded binary)
{try.#Success code}
(in [////.#module module
////.#file path
diff --git a/stdlib/source/library/lux/meta/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/meta/compiler/meta/packager/jvm.lux
index b783f1262..1fbba7497 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/packager/jvm.lux
@@ -140,7 +140,7 @@
(java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MANIFEST_VERSION)
(ffi.as_string ..manifest_version)))]
(exec
- (case program
+ (when program
{.#Some program}
(to attrs
(java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MAIN_CLASS)
@@ -188,7 +188,7 @@
chunk_size (.int ..mebi_byte)
buffer (java/io/ByteArrayOutputStream::new (ffi.as_int chunk_size))]
(loop (again [so_far 0])
- (case (ffi.of_int (java/io/InputStream::read chunk (ffi.as_int +0) (ffi.as_int chunk_size) input))
+ (when (ffi.of_int (java/io/InputStream::read chunk (ffi.as_int +0) (ffi.as_int chunk_size) input))
-1
[so_far
(java/io/ByteArrayOutputStream::toByteArray buffer)]
@@ -213,7 +213,7 @@
(def (read_jar_entry entry input)
(-> java/util/jar/JarEntry java/util/jar/JarInputStream [Nat Binary])
- (case (ffi.of_long (java/util/zip/ZipEntry::getSize entry))
+ (when (ffi.of_long (java/util/zip/ZipEntry::getSize entry))
-1
(..read_jar_entry_with_unknown_size input)
@@ -230,12 +230,12 @@
(loop (again [entries entries
duplicates duplicates
sink sink])
- (case (java/util/jar/JarInputStream::getNextJarEntry input)
+ (when (java/util/jar/JarInputStream::getNextJarEntry input)
{try.#Failure error}
{try.#Failure error}
{try.#Success ?entry}
- (case ?entry
+ (when ?entry
{.#None}
(exec
(java/io/Closeable::close input)
@@ -249,7 +249,7 @@
(text.starts_with? "META-INF/leiningen/" entry_path))
(or (text.ends_with? ".SF" entry_path)
(text.ends_with? ".DSA" entry_path))))
- (case (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new (ffi.as_string entry_path))
+ (when (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new (ffi.as_string entry_path))
sink)
{try.#Failure error}
(again entries
diff --git a/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux
index 1c0d70dc2..80be5feaf 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux
@@ -49,7 +49,7 @@
(-> descriptor.Module module.ID (Set unit.ID) Output (Try (Maybe _.Statement)))
(do [! try.monad]
[]
- (case (|> output
+ (when (|> output
sequence.list
(list.only (function (_ [artifact_id custom content])
(set.member? necessary_dependencies [module_id artifact_id]))))
@@ -86,7 +86,7 @@
(do [! try.monad]
[bundle (is (Try (Maybe _.Statement))
(..bundle_module module module_id necessary_dependencies (the archive.#output entry)))]
- (case bundle
+ (when bundle
{.#None}
(in sink)
diff --git a/stdlib/source/library/lux/meta/compiler/phase.lux b/stdlib/source/library/lux/meta/compiler/phase.lux
index 2b67baec4..b5d04c40e 100644
--- a/stdlib/source/library/lux/meta/compiler/phase.lux
+++ b/stdlib/source/library/lux/meta/compiler/phase.lux
@@ -29,7 +29,7 @@
(implementation
(def (each f it)
(function (_ state)
- (case (it state)
+ (when (it state)
{try.#Success [state' output]}
{try.#Success [state' (f output)]}
@@ -47,7 +47,7 @@
(def (conjoint it)
(function (_ state)
- (case (it state)
+ (when (it state)
{try.#Success [state' it']}
(it' state')
diff --git a/stdlib/source/library/lux/meta/compiler/reference.lux b/stdlib/source/library/lux/meta/compiler/reference.lux
index 340cf1a0d..b7eb370de 100644
--- a/stdlib/source/library/lux/meta/compiler/reference.lux
+++ b/stdlib/source/library/lux/meta/compiler/reference.lux
@@ -31,7 +31,7 @@
(Equivalence Reference)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
@@ -48,7 +48,7 @@
..equivalence)
(def (hash value)
- (case value
+ (when value
(^.with_template [<factor> <tag> <hash>]
[{<tag> value}
(|> value
@@ -85,7 +85,7 @@
(def .public format
(Format Reference)
- (|>> (pipe.case
+ (|>> (pipe.when
{#Variable variable}
(/variable.format variable)
diff --git a/stdlib/source/library/lux/meta/compiler/reference/variable.lux b/stdlib/source/library/lux/meta/compiler/reference/variable.lux
index caa6d2c89..0e038ed06 100644
--- a/stdlib/source/library/lux/meta/compiler/reference/variable.lux
+++ b/stdlib/source/library/lux/meta/compiler/reference/variable.lux
@@ -29,7 +29,7 @@
(Equivalence Variable)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag>]
[[{<tag> reference'} {<tag> sample'}]
(n.= reference' sample')])
@@ -45,7 +45,7 @@
..equivalence)
(def hash
- (|>> (pipe.case
+ (|>> (pipe.when
(^.with_template [<factor> <tag>]
[{<tag> register}
(|> register
@@ -60,7 +60,7 @@
(def .public self?
(-> Variable Bit)
- (|>> (pipe.case
+ (|>> (pipe.when
(..self)
true
@@ -69,7 +69,7 @@
(def .public format
(Format Variable)
- (|>> (pipe.case
+ (|>> (pipe.when
{#Local local}
(%.format "+" (%.nat local))
diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux
index 45ca34758..b98d92ee1 100644
--- a/stdlib/source/library/lux/meta/configuration.lux
+++ b/stdlib/source/library/lux/meta/configuration.lux
@@ -74,7 +74,7 @@
(def (subsumes? actual expected)
(-> Configuration Configuration Bit)
- (case expected
+ (when expected
{.#End}
true
@@ -90,7 +90,7 @@
default (<>.maybe <code>.any)])
(do meta.monad
[actual meta.configuration]
- (case (list#mix (function (_ [expected then] choice)
+ (when (list#mix (function (_ [expected then] choice)
(if (subsumes? actual expected)
{.#Some then}
choice))
diff --git a/stdlib/source/library/lux/meta/extension.lux b/stdlib/source/library/lux/meta/extension.lux
index f4e7b41d7..175b1143f 100644
--- a/stdlib/source/library/lux/meta/extension.lux
+++ b/stdlib/source/library/lux/meta/extension.lux
@@ -50,7 +50,7 @@
(with_symbols [g!handler g!inputs g!error g!_]
(in (list (` (<extension> (, name)
(.function ((, g!handler) (, g!name) (, g!phase) (, g!archive) (, g!inputs))
- (.case (<result>
+ (.when (<result>
(monad.do <>.monad
[(,* inputs)
(, g!_) <end>]
diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux
index a9e62dd5f..2c4fc0eb1 100644
--- a/stdlib/source/library/lux/meta/location.lux
+++ b/stdlib/source/library/lux/meta/location.lux
@@ -20,7 +20,7 @@
(def .public here
(macro (_ tokens compiler)
- (case tokens
+ (when tokens
{.#End}
(let [location (the .#location compiler)]
{.#Right [compiler
diff --git a/stdlib/source/library/lux/meta/macro.lux b/stdlib/source/library/lux/meta/macro.lux
index 0b7bb514a..298bde13d 100644
--- a/stdlib/source/library/lux/meta/macro.lux
+++ b/stdlib/source/library/lux/meta/macro.lux
@@ -27,7 +27,7 @@
(def (local ast)
(-> Code (Meta Text))
- (case ast
+ (when ast
[_ {.#Symbol ["" name]}]
(at //.monad in name)
@@ -42,7 +42,7 @@
(def .public with_symbols
(.macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {.#Tuple symbols}] body)
(do [! //.monad]
[symbol_names (monad.each ! ..local symbols)
@@ -58,11 +58,11 @@
(def .public times
(.macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_ {.#Nat times}] terms)
(loop (again [times times
before terms])
- (case times
+ (when times
0
(at //.monad in before)
diff --git a/stdlib/source/library/lux/meta/macro/context.lux b/stdlib/source/library/lux/meta/macro/context.lux
index 73cda9cd0..5a347775d 100644
--- a/stdlib/source/library/lux/meta/macro/context.lux
+++ b/stdlib/source/library/lux/meta/macro/context.lux
@@ -33,7 +33,7 @@
(do meta.monad
[.let [[@ expected_name] it]
defs (meta.definitions @)]
- (case (list.one (function (_ [actual_name [exported? type value]])
+ (when (list.one (function (_ [actual_name [exported? type value]])
(if (text#= expected_name actual_name)
{.#Some value}
{.#None}))
@@ -50,7 +50,7 @@
(All (_ a) (-> (Stack a) Symbol (Meta a)))
(do meta.monad
[stack (..global context)]
- (case (|> stack
+ (when (|> stack
(as (Stack Any))
list.head)
{.#Some top}
@@ -69,7 +69,7 @@
(All (_ a) (-> (Stack a) (Predicate a) Symbol (Meta a)))
(do meta.monad
[stack (..global context)]
- (case (|> stack
+ (when (|> stack
(as (Stack Any))
(list.example (as (Predicate Any) ?)))
{.#Some it}
@@ -88,7 +88,7 @@
(function (_ lux)
(let [on_global (is (-> Global Global)
(function (_ it)
- (case it
+ (when it
{.#Definition it}
{.#Definition (on_definition it)}
diff --git a/stdlib/source/library/lux/meta/macro/expansion.lux b/stdlib/source/library/lux/meta/macro/expansion.lux
index eb30d4ee8..9364ecc77 100644
--- a/stdlib/source/library/lux/meta/macro/expansion.lux
+++ b/stdlib/source/library/lux/meta/macro/expansion.lux
@@ -20,11 +20,11 @@
(def .public (single syntax)
(-> Code (Meta (List Code)))
- (case syntax
+ (when syntax
[_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
(do ///.monad
[?macro (///.macro name)]
- (case ?macro
+ (when ?macro
{.#Some macro}
((as Macro' macro) args)
@@ -36,11 +36,11 @@
(def .public (complete syntax)
(-> Code (Meta (List Code)))
- (case syntax
+ (when syntax
[_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
(do ///.monad
[?macro (///.macro name)]
- (case ?macro
+ (when ?macro
{.#Some macro}
(do [! ///.monad]
[top_level_complete ((as Macro' macro) args)]
@@ -56,11 +56,11 @@
(def .public (total syntax)
(-> Code (Meta (List Code)))
- (case syntax
+ (when syntax
[_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
(do ///.monad
[?macro (///.macro name)]
- (case ?macro
+ (when ?macro
{.#Some macro}
(do ///.monad
[complete ((as Macro' macro) args)
@@ -95,7 +95,7 @@
(-> Code (Meta Code))
(do ///.monad
[token+ (..complete token)]
- (case token+
+ (when token+
(list token')
(in token')
@@ -108,8 +108,8 @@
(let [[module _] (.symbol .._)
[_ short] (.symbol <macro>)
macro_name [module short]]
- (case (is (Maybe [Bit Code])
- (case tokens
+ (when (is (Maybe [Bit Code])
+ (when tokens
(list [_ {.#Text "omit"}]
token)
{.#Some [true token]}
diff --git a/stdlib/source/library/lux/meta/macro/local.lux b/stdlib/source/library/lux/meta/macro/local.lux
index 8e0d8d709..c69b32f95 100644
--- a/stdlib/source/library/lux/meta/macro/local.lux
+++ b/stdlib/source/library/lux/meta/macro/local.lux
@@ -37,9 +37,9 @@
(def (with_module name body)
(All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a)))
(function (_ compiler)
- (case (|> compiler (the .#modules) (property.value name))
+ (when (|> compiler (the .#modules) (property.value name))
{.#Some module}
- (case (body module)
+ (when (body module)
{try.#Success [module' output]}
{try.#Success [(revised .#modules (property.has name module') compiler)
output]}
@@ -59,7 +59,7 @@
(property.has definition_name definition))]]
(..with_module module_name
(function (_ module)
- (case (|> module (the .#definitions) (property.value definition_name))
+ (when (|> module (the .#definitions) (property.value definition_name))
{.#None}
{try.#Success [(revised .#definitions add_macro! module)
[]]}
@@ -75,7 +75,7 @@
(property.lacks definition_name))]]
(..with_module module_name
(function (_ module)
- (case (|> module (the .#definitions) (property.value definition_name))
+ (when (|> module (the .#definitions) (property.value definition_name))
{.#Some _}
{try.#Success [(revised .#definitions lacks_macro! module)
[]]}
@@ -91,7 +91,7 @@
[_ (monad.each ! ..pop_one macros)
_ (..pop_one self)
compiler meta.compiler_state]
- (in (case (the .#expected compiler)
+ (in (when (the .#expected compiler)
{.#Some _}
(list (' []))
@@ -135,7 +135,7 @@
locals)
expression? (is (Meta Bit)
(function (_ lux)
- {try.#Success [lux (case (the .#expected lux)
+ {try.#Success [lux (when (the .#expected lux)
{.#None}
false
diff --git a/stdlib/source/library/lux/meta/macro/pattern.lux b/stdlib/source/library/lux/meta/macro/pattern.lux
index b639259ba..f4f352efc 100644
--- a/stdlib/source/library/lux/meta/macro/pattern.lux
+++ b/stdlib/source/library/lux/meta/macro/pattern.lux
@@ -19,7 +19,7 @@
(def locally
(macro (_ tokens lux)
(.let [[prelude _] (symbol ._)]
- (case tokens
+ (when tokens
(list [@ {.#Symbol ["" name]}])
{.#Right [lux (list (.` ("lux in-module" (., [@ {.#Text prelude}])
(., [@ {.#Symbol [prelude name]}]))))]}
@@ -68,9 +68,9 @@
(def .public or
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_ {.#Form patterns}] body branches)
- (case patterns
+ (when patterns
{.#End}
(///.failure (..wrong_syntax_error (symbol ..or)))
@@ -85,12 +85,12 @@
(def .public with_template
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_ {.#Form (list [_ {.#Tuple bindings}]
[_ {.#Tuple templates}])}]
[_ {.#Form data}]
branches)
- (case (is (Maybe (List Code))
+ (when (is (Maybe (List Code))
(do maybe.monad
[bindings' (monad.each maybe.monad symbol_short bindings)
data' (monad.each maybe.monad tuple_list data)]
@@ -118,7 +118,7 @@
(def (level it)
(-> Code (Meta Level))
- (///#in (case it
+ (///#in (when it
[_ {.#Tuple (list expr binding)}]
[expr binding]
@@ -130,7 +130,7 @@
(def (multiP levels)
(-> (List Code) (Meta Multi))
- (case levels
+ (when levels
{.#End}
(///.failure "Multi-level patterns cannot be empty.")
@@ -142,13 +142,13 @@
(def (multiG g!_ [[init_pattern levels] body])
(-> Code [Multi Code] (List Code))
(.let [inner_pattern_body (list#mix (function (_ [calculation pattern] success)
- (.let [bind? (case pattern
+ (.let [bind? (when pattern
[_ {.#Symbol _}]
true
_
false)]
- (.` (case (., calculation)
+ (.` (when (., calculation)
(., pattern)
(., success)
@@ -162,12 +162,12 @@
(def .public multi
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_meta {.#Form levels}] body next_branches)
(with_symbols [g!temp]
(do ///.monad
[mlc (multiP levels)
- .let [initial_bind? (case mlc
+ .let [initial_bind? (when mlc
[[_ {.#Symbol _}] _]
true
@@ -179,10 +179,10 @@
(., g!temp)
{.#None}
- (.case (., g!temp)
+ (.when (., g!temp)
(.,* next_branches))}
("lux type check" {.#Apply (., (type_code expected)) Maybe}
- (.case (., g!temp)
+ (.when (., g!temp)
(.,* (multiG g!temp [mlc body]))
(.,* (if initial_bind?
@@ -195,11 +195,11 @@
(def .public let
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_meta {.#Form (list [_ {.#Symbol ["" name]}] pattern)}] body branches)
(.let [g!whole (local$ name)]
(///#in (list.partial g!whole
- (.` (case (., g!whole) (., pattern) (., body)))
+ (.` (when (., g!whole) (., pattern) (., body)))
branches)))
_
@@ -208,7 +208,7 @@
(def .public |>
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_meta {.#Form (list [_ {.#Symbol ["" name]}] [_ {.#Tuple steps}])}] body branches)
(.let [g!name (local$ name)]
(///#in (list.partial g!name
@@ -225,7 +225,7 @@
(def (untemplated_partial_list last inits)
(-> Code (List Code) Code)
- (case inits
+ (when inits
{.#End}
last
@@ -244,12 +244,12 @@
(with_expansions [<default> (do ///.monad
[=elems (monad.each ///.monad untemplated_pattern elems)]
(in (.` [(., g!meta) {(., <tag>) (., (untemplated_list =elems))}])))]
- (case (list.reversed elems)
+ (when (list.reversed elems)
{.#Item [_ {.#Form {.#Item [_ {.#Symbol global}] parameters}}]
inits}
(do ///.monad
[micro (///.try (..named_spliced_unquote global))]
- (case micro
+ (when micro
{try.#Success micro}
(do ///.monad
[output (..one_expansion ((//.function micro) parameters))
@@ -281,7 +281,7 @@
(def (untemplated_pattern pattern)
(-> Code (Meta Code))
(with_symbols [g!meta]
- (case pattern
+ (when pattern
(..with_template [<tag> <gen>]
[[_ {<tag> value}]
(///#in (.` [(., g!meta) {<tag> (., (<gen> value))}]))])
@@ -296,7 +296,7 @@
[@composite {.#Form {.#Item [@global {.#Symbol global}] parameters}}]
(do [! ///.monad]
[micro (///.try (..named_unquote global))]
- (case micro
+ (when micro
{try.#Success micro}
(do !
[[_ output] (..one_expansion ((//.function micro) parameters))]
@@ -316,7 +316,7 @@
(def .public `
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list.partial [_meta {.#Form (list template)}] body branches)
(do ///.monad
[pattern (untemplated_pattern template)]
diff --git a/stdlib/source/library/lux/meta/macro/syntax.lux b/stdlib/source/library/lux/meta/macro/syntax.lux
index aa415eeb8..ec96b9e42 100644
--- a/stdlib/source/library/lux/meta/macro/syntax.lux
+++ b/stdlib/source/library/lux/meta/macro/syntax.lux
@@ -18,7 +18,7 @@
(def .public (self_documenting binding parser)
(All (_ a) (-> Code (Parser a) (Parser a)))
(function (_ tokens)
- (case (parser tokens)
+ (when (parser tokens)
{try.#Failure error}
{try.#Failure (all text#composite
"Failed to parse: " (code.format binding) text.new_line
@@ -29,7 +29,7 @@
(def (un_paired pairs)
(All (_ a) (-> (List [a a]) (List a)))
- (case pairs
+ (when pairs
{.#Item [x y] pairs'}
(list.partial x y (un_paired pairs'))
@@ -47,11 +47,11 @@
(def .public syntax
(macro (_ tokens)
- (case (</>.result ..syntaxP tokens)
+ (when (</>.result ..syntaxP tokens)
{try.#Success [[name g!state args] body]}
(with_symbols [g!tokens g!body g!error]
(do [! meta.monad]
- [vars+parsers (case (list.pairs args)
+ [vars+parsers (when (list.pairs args)
{.#Some args}
(monad.each !
(is (-> [Code Code] (Meta [Code Code]))
@@ -59,7 +59,7 @@
(with_expansions [<default> (in [var
(` (..self_documenting (' (, var))
(, parser)))])]
- (case var
+ (when var
[_ {.#Symbol ["" _]}]
<default>
@@ -72,7 +72,7 @@
_
(meta.failure "Syntax pattern expects pairs of bindings and code-parsers."))
- g!state (case g!state
+ g!state (when g!state
{.#Some g!state}
(in (code.local g!state))
@@ -81,7 +81,7 @@
this_module meta.current_module_name
.let [g!name (code.symbol ["" name])]]
(in (list (` (.macro ((, g!name) (, g!tokens) (, g!state))
- (.case (</>.result
+ (.when (</>.result
(is (</>.Parser (Meta (List Code)))
(do <>.monad
[(,* (..un_paired vars+parsers))]
diff --git a/stdlib/source/library/lux/meta/macro/syntax/declaration.lux b/stdlib/source/library/lux/meta/macro/syntax/declaration.lux
index 1f4a9cccd..511f10c30 100644
--- a/stdlib/source/library/lux/meta/macro/syntax/declaration.lux
+++ b/stdlib/source/library/lux/meta/macro/syntax/declaration.lux
@@ -36,7 +36,7 @@
(def .public (format value)
(-> Declaration Code)
(let [g!name (code.local (the #name value))]
- (case (the #arguments value)
+ (when (the #arguments value)
{.#End}
g!name
diff --git a/stdlib/source/library/lux/meta/macro/syntax/definition.lux b/stdlib/source/library/lux/meta/macro/syntax/definition.lux
index 445068226..0f6be7510 100644
--- a/stdlib/source/library/lux/meta/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/meta/macro/syntax/definition.lux
@@ -55,7 +55,7 @@
(-> Definition Code)
(` ((, (code.text ..extension))
(, (code.local _#name))
- (, (case _#value
+ (, (when _#value
{.#Left check}
(//check.format check)
@@ -89,7 +89,7 @@
(-> Lux (Parser Definition))
(do <>.monad
[definition (..parser compiler)
- _ (case (the #value definition)
+ _ (when (the #value definition)
{.#Left _}
(in [])
diff --git a/stdlib/source/library/lux/meta/macro/syntax/export.lux b/stdlib/source/library/lux/meta/macro/syntax/export.lux
index 1bc78cb9f..04e5c730a 100644
--- a/stdlib/source/library/lux/meta/macro/syntax/export.lux
+++ b/stdlib/source/library/lux/meta/macro/syntax/export.lux
@@ -17,7 +17,7 @@
(Parser Code)
(do [! <>.monad]
[candidate <code>.next]
- (case candidate
+ (when candidate
[_ {.#Symbol ["" _]}]
(in default_policy)
diff --git a/stdlib/source/library/lux/meta/macro/template.lux b/stdlib/source/library/lux/meta/macro/template.lux
index cb6acd2d5..a045bd235 100644
--- a/stdlib/source/library/lux/meta/macro/template.lux
+++ b/stdlib/source/library/lux/meta/macro/template.lux
@@ -53,7 +53,7 @@
(do <>.monad
[[module short] parser]
(in (if module_side?
- (case module
+ (when module
"" short
_ module)
short))))
@@ -86,7 +86,7 @@
[(def .public <name>
(syntax (_ [name (<>.or (<>.and (..part true) (..part false))
(..part false))])
- (case name
+ (when name
{.#Left [simple complex]}
(in (list (<complex> [(text.interposed "" simple)
(text.interposed "" complex)])))
@@ -102,9 +102,9 @@
(def (applied env template)
(-> Environment Code Code)
- (case template
+ (when template
[_ {.#Symbol "" name}]
- (case (dictionary.value name env)
+ (when (dictionary.value name env)
{.#Some substitute}
substitute
@@ -164,7 +164,7 @@
[here_name meta.current_module_name
expression? (is (Meta Bit)
(function (_ lux)
- {try.#Success [lux (case (the .#expected lux)
+ {try.#Success [lux (when (the .#expected lux)
{.#None}
false
diff --git a/stdlib/source/library/lux/meta/static.lux b/stdlib/source/library/lux/meta/static.lux
index 617ce7cdb..9a8d25cfe 100644
--- a/stdlib/source/library/lux/meta/static.lux
+++ b/stdlib/source/library/lux/meta/static.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except nat int rev if cond)
+ [lux (.except nat int rev if cond when)
[abstract
[monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/symbol.lux b/stdlib/source/library/lux/meta/symbol.lux
index e46516bb9..edbf2acd3 100644
--- a/stdlib/source/library/lux/meta/symbol.lux
+++ b/stdlib/source/library/lux/meta/symbol.lux
@@ -46,12 +46,12 @@
(Codec Text Symbol)
(implementation
(def (encoded [module short])
- (case module
+ (when module
"" short
_ (all text#composite module ..separator short)))
(def (decoded input)
- (case (text.all_split_by ..separator input)
+ (when (text.all_split_by ..separator input)
(list short)
{.#Right ["" short]}
diff --git a/stdlib/source/library/lux/meta/target/common_lisp.lux b/stdlib/source/library/lux/meta/target/common_lisp.lux
index b7ce2a7fb..9d92f4557 100644
--- a/stdlib/source/library/lux/meta/target/common_lisp.lux
+++ b/stdlib/source/library/lux/meta/target/common_lisp.lux
@@ -77,7 +77,7 @@
(def .public bool
(-> Bit Literal)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 ..nil
#1 (..symbol "t"))))
@@ -154,7 +154,7 @@
(def .public (args& singles rest)
(-> (List Var/1) Var/1 Var/*)
- (|> (case singles
+ (|> (when singles
{.#End}
""
@@ -404,7 +404,7 @@
(with_template [<name> <prefix>]
[(def .public (<name> conditions expression)
(-> (List Text) (Expression Any) (Expression Any))
- (case conditions
+ (when conditions
{.#End}
expression
diff --git a/stdlib/source/library/lux/meta/target/js.lux b/stdlib/source/library/lux/meta/target/js.lux
index e5a1ce144..37792d6bc 100644
--- a/stdlib/source/library/lux/meta/target/js.lux
+++ b/stdlib/source/library/lux/meta/target/js.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Location Code Label or and function if undefined for comment not int try ++ -- the type_of at ,)
+ [lux (.except Location Code Label or and function if undefined for comment not int try ++ -- the type_of at , when)
[control
["[0]" pipe]]
[data
@@ -73,7 +73,7 @@
(def .public boolean
(-> Bit Literal)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "false"
#1 "true")
abstraction))
@@ -414,7 +414,7 @@
(..nested (representation then)))))
(text.interposed \n+))
\n+
- (case default
+ (.when default
{.#Some default}
(format "default:"
(..nested (representation default)))
diff --git a/stdlib/source/library/lux/meta/target/jvm/attribute.lux b/stdlib/source/library/lux/meta/target/jvm/attribute.lux
index 0b0af146e..c6ff2472f 100644
--- a/stdlib/source/library/lux/meta/target/jvm/attribute.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/attribute.lux
@@ -87,7 +87,7 @@
(def (length attribute)
(-> Attribute Nat)
- (case attribute
+ (when attribute
(^.with_template [<tag>]
[{<tag> [name length info]}
(|> length //unsigned.value (n.+ ..common_attribute_length))])
@@ -139,7 +139,7 @@
(def .public (format it)
(Format Attribute)
- (case it
+ (when it
{#Constant it}
((info_format /constant.format) it)
diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode.lux
index 6123ee60e..57ea8caf8 100644
--- a/stdlib/source/library/lux/meta/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/bytecode.lux
@@ -85,7 +85,7 @@
(def try|do
(template (_ <binding> <term> <then>)
- [(.case <term>
+ [(.when <term>
{try.#Success <binding>}
<then>
@@ -151,7 +151,7 @@
(let [[pool environment tracker] state]
{try.#Success [state
[..relative#identity
- (case (dictionary.value label (the #known tracker))
+ (when (dictionary.value label (the #known tracker))
{.#Some [expected {.#Some address}]}
{.#Some [expected address]}
@@ -164,7 +164,7 @@
(let [[pool environment tracker] state]
{try.#Success [state
[..relative#identity
- (case (dictionary.value label (the #known tracker))
+ (when (dictionary.value label (the #known tracker))
{.#Some [expected {.#None}]}
{.#Some expected}
@@ -190,7 +190,7 @@
(-> Label (Bytecode Any))
(function (_ [pool environment tracker])
(let [@here (the #program_counter tracker)]
- (case (dictionary.value label (the #known tracker))
+ (when (dictionary.value label (the #known tracker))
{.#Some [expected {.#Some address}]}
(exception.except ..label_has_already_been_set [label])
@@ -211,7 +211,7 @@
(implementation
(def (each $ it)
(function (_ state)
- (case (it state)
+ (when (it state)
{try.#Success [state' [relative it]]}
{try.#Success [state' [relative ($ it)]]}
@@ -230,9 +230,9 @@
(def (conjoint ^^it)
(function (_ state)
- (case (^^it state)
+ (when (^^it state)
{try.#Success [state' [left ^it]]}
- (case (^it state')
+ (when (^it state')
{try.#Success [state'' [right it]]}
{try.#Success [state'' [(relative#composite left right) it]]}
@@ -248,7 +248,7 @@
(-> (Bytecode Any) (Bytecode Any))
(do ..monad
[stack ..stack]
- (.case stack
+ (.when stack
{.#Some _}
it
@@ -260,7 +260,7 @@
(-> Label (Bytecode Any) (Bytecode Any))
(do ..monad
[?@ (..acknowledged? @)]
- (.case ?@
+ (.when ?@
{.#Some _}
it
@@ -557,7 +557,7 @@
(-> //constant.UTF8 (Bytecode Any))
(do ..monad
[index (..lifted (//constant/pool.string value))]
- (case (|> index //index.value //unsigned.value //unsigned.u1)
+ (when (|> index //index.value //unsigned.value //unsigned.u1)
{try.#Success index}
(..bytecode $0 $1 @_ _.ldc [index])
@@ -575,14 +575,14 @@
(with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
[(def .public (<name> value)
(-> <type> (Bytecode Any))
- (case (|> value <to_lux>)
+ (when (|> value <to_lux>)
(^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
<specializations>
_ (do ..monad
[index (..lifted (<constant> (<constructor> value)))]
- (case (|> index //index.value //unsigned.value //unsigned.u1)
+ (when (|> index //index.value //unsigned.value //unsigned.u1)
{try.#Success index}
(..bytecode $0 $1 @_ _.ldc [index])
@@ -604,7 +604,7 @@
(-> java/lang/Float (Bytecode Any))
(do ..monad
[index (..lifted (//constant/pool.float (//constant.float value)))]
- (case (|> index //index.value //unsigned.value //unsigned.u1)
+ (when (|> index //index.value //unsigned.value //unsigned.u1)
{try.#Success index}
(..bytecode $0 $1 @_ _.ldc [index])
@@ -625,7 +625,7 @@
(if (i.= ..negative_zero_float_bits
(..float_bits value))
(..arbitrary_float value)
- (case (|> value ffi.float_to_double (as Frac))
+ (when (|> value ffi.float_to_double (as Frac))
(^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
([+0.0 _.fconst_0]
@@ -637,7 +637,7 @@
(with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
[(def .public (<name> value)
(-> <type> (Bytecode Any))
- (case (|> value <to_lux>)
+ (when (|> value <to_lux>)
(^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
<specializations>
@@ -671,7 +671,7 @@
(if (i.= ..negative_zero_double_bits
(..double_bits value))
(..arbitrary_double value)
- (case (as Frac value)
+ (when (as Frac value)
(^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
([+0.0 _.dconst_0]
@@ -685,7 +685,7 @@
(def (register id)
(-> Nat (Bytecode Register))
- (case (//unsigned.u1 id)
+ (when (//unsigned.u1 id)
{try.#Success register}
(at ..monad in register)
@@ -696,7 +696,7 @@
[(def .public (<name> local)
(-> Nat (Bytecode Any))
(with_expansions [<specials>' (template.spliced <specials>)]
- (`` (case local
+ (`` (when local
(,, (with_template [<case> <instruction> <registry>]
[<case> (..bytecode $0 <size> <registry> <instruction> [])]
@@ -736,7 +736,7 @@
[(def .public (<name> local)
(-> Nat (Bytecode Any))
(with_expansions [<specials>' (template.spliced <specials>)]
- (`` (case local
+ (`` (when local
(,, (with_template [<case> <instruction> <registry>]
[<case> (..bytecode <size> $0 <registry> <instruction> [])]
@@ -815,7 +815,7 @@
(def (resolve_label label resolver)
(-> Label Resolver (Try [Stack Address]))
- (case (dictionary.value label resolver)
+ (when (dictionary.value label resolver)
{.#Some [actual {.#Some address}]}
{try.#Success [actual address]}
@@ -828,7 +828,7 @@
(def (acknowledge_label stack label tracker)
(-> Stack Label Tracker Tracker)
- (case (dictionary.value label (the #known tracker))
+ (when (dictionary.value label (the #known tracker))
{.#Some _}
tracker
@@ -857,7 +857,7 @@
(try|do _ (exception.assertion ..mismatched_environments [(symbol <instruction>) label @here expected actual]
(at /stack.equivalence = expected actual)))
(try|do jump (..jump @from @to))
- (case jump
+ (when jump
{.#Left jump}
(exception.except ..cannot_do_a_big_jump [label @from jump])
@@ -901,12 +901,12 @@
(..acknowledge_label actual label)
(has #program_counter program_counter'))]
[(function (_ resolver)
- (case (dictionary.value label resolver)
+ (when (dictionary.value label resolver)
{.#Some [expected {.#Some @to}]}
(<| (try|do _ (exception.assertion ..mismatched_environments [(symbol <instruction>) label @here expected actual]
(at /stack.equivalence = expected actual)))
(try|do jump (..jump @from @to))
- (case jump
+ (when jump
{.#Left jump}
<on_long_jump>
@@ -931,7 +931,7 @@
(def (big_jump jump)
(-> Any_Jump Big_Jump)
- (case jump
+ (when jump
{.#Left big}
big
@@ -957,7 +957,7 @@
(let [get (is (-> Label (Maybe [Stack (Maybe Address)]))
(function (_ label)
(dictionary.value label resolver)))]
- (case (do [! maybe.monad]
+ (when (do [! maybe.monad]
[@default (|> default get (monad.then ! product.right))
@at_minimum (|> at_minimum get (monad.then ! product.right))]
(|> afterwards
@@ -999,7 +999,7 @@
(let [get (is (-> Label (Maybe [Stack (Maybe Address)]))
(function (_ label)
(dictionary.value label resolver)))]
- (case (do [! maybe.monad]
+ (when (do [! maybe.monad]
[@default (|> default get (monad.then ! product.right))]
(|> cases
(monad.each ! (|>> product.right get))
@@ -1050,7 +1050,7 @@
(-> (Type Object) U1 (Bytecode Any))
(do ..monad
[_ (is (Bytecode Any)
- (case (|> dimensions //unsigned.value)
+ (when (|> dimensions //unsigned.value)
0 (..except ..multiarray_cannot_be_zero_dimensional [class])
_ (in [])))
index (..lifted (//constant/pool.class (//name.internal (..reflection class))))]
@@ -1162,9 +1162,9 @@
(All (_ pre post)
(-> (Bytecode pre) (Bytecode post) (Bytecode post)))
(function (_ state)
- (case (pre state)
+ (when (pre state)
{try.#Success [state' [left _]]}
- (case (post state')
+ (when (post state')
{try.#Success [state'' [right it]]}
{try.#Success [state'' [(relative#composite left right) it]]}
diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode/environment.lux
index 49e3455f4..dd33b7853 100644
--- a/stdlib/source/library/lux/meta/target/jvm/bytecode/environment.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/bytecode/environment.lux
@@ -53,7 +53,7 @@
(def .public (stack environment)
(-> Environment (Try Stack))
- (case (the ..#stack environment)
+ (when (the ..#stack environment)
{.#Some stack}
{try.#Success stack}
@@ -72,7 +72,7 @@
(def .public (continue expected environment)
(-> Stack Environment (Try [Stack Environment]))
- (case (the ..#stack environment)
+ (when (the ..#stack environment)
{.#Some actual}
(if (at /stack.equivalence = expected actual)
{try.#Success [actual environment]}
diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux
index 9dc19ed00..573424e12 100644
--- a/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux
@@ -608,7 +608,7 @@
maximum (///signed.+/4 minimum amount_of_afterwards)]
(in (let [_ (binary.has_8! offset (hex "AA") binary)
offset (n.+ (///unsigned.value ..opcode_size) offset)
- _ (case padding
+ _ (when padding
3 (|> binary
(binary.has_8! offset 0)
(binary.has_16! (++ offset) 0))
@@ -624,7 +624,7 @@
(loop (again [offset (n.+ (///unsigned.value ..integer_size) offset)
afterwards (is (List Big_Jump)
{.#Item at_minimum afterwards})])
- (case afterwards
+ (when afterwards
{.#End}
binary
@@ -668,7 +668,7 @@
[(n.+ lookupswitch_size offset)
(let [_ (binary.has_8! offset (hex "AB") binary)
offset (n.+ (///unsigned.value ..opcode_size) offset)
- _ (case padding
+ _ (when padding
3 (|> binary
(binary.has_8! offset 0)
(binary.has_16! (++ offset) 0))
@@ -681,7 +681,7 @@
_ (binary.has_32! offset amount_of_cases binary)]
(loop (again [offset (n.+ (///unsigned.value ..integer_size) offset)
cases cases])
- (case cases
+ (when cases
{.#End}
binary
diff --git a/stdlib/source/library/lux/meta/target/jvm/class.lux b/stdlib/source/library/lux/meta/target/jvm/class.lux
index bd9fdd41b..1a5b3a1d8 100644
--- a/stdlib/source/library/lux/meta/target/jvm/class.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/class.lux
@@ -103,7 +103,7 @@
[classes (install_classes this super interfaces)
=fields (monad.all ! fields)
=methods (monad.all ! methods)
- @signature (case signature
+ @signature (when signature
{.#Some signature}
(at ! each (|>> {.#Some}) (//attribute.signature signature))
@@ -120,7 +120,7 @@
#interfaces @interfaces
#fields (sequence.of_list =fields)
#methods (sequence.of_list =methods)
- #attributes (case @signature
+ #attributes (when @signature
{.#Some @signature}
(sequence.suffix @signature attributes)
diff --git a/stdlib/source/library/lux/meta/target/jvm/constant.lux b/stdlib/source/library/lux/meta/target/jvm/constant.lux
index a56a74c11..d05df9511 100644
--- a/stdlib/source/library/lux/meta/target/jvm/constant.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/constant.lux
@@ -171,7 +171,7 @@
(def .public (size constant)
(-> Constant Nat)
- (case constant
+ (when constant
(^.or {#Long _} {#Double _})
2
@@ -184,7 +184,7 @@
... version below as soon as the new format for variants is implemented.
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
@@ -242,7 +242,7 @@
... TODO: Invoke_Dynamic
)]
(function (_ value)
- (case value
+ (when value
(^.with_template [<case> <tag> <format>]
[{<case> value}
(binaryF#composite (/tag.format <tag>)
diff --git a/stdlib/source/library/lux/meta/target/jvm/constant/pool.lux b/stdlib/source/library/lux/meta/target/jvm/constant/pool.lux
index d3a8c2546..759d88314 100644
--- a/stdlib/source/library/lux/meta/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/constant/pool.lux
@@ -49,7 +49,7 @@
(implementation
(def (each $ it)
(|>> it
- (pipe.case
+ (pipe.when
{try.#Success [state output]}
{try.#Success [state ($ output)]}
@@ -68,7 +68,7 @@
(def (conjoint it)
(function (_ state)
- (case (it state)
+ (when (it state)
{try.#Success [state' it']}
(it' state')
@@ -78,7 +78,7 @@
(def try|each
(template (_ <binding> <value> <body>)
- [(case <value>
+ [(when <value>
{try.#Success <binding>}
<body>
@@ -96,9 +96,9 @@
<value>' <value>]
(with_expansions [<try_again> (these (again (.++ idx)))]
(loop (again [idx 0])
- (case (sequence.item idx pool)
+ (when (sequence.item idx pool)
{try.#Success entry}
- (case entry
+ (when entry
[index {<tag> reference}]
(if (at <equivalence> = reference <value>')
{try.#Success [[current pool]
@@ -127,7 +127,7 @@
(def /|each
(template (_ <state> <binding> <value> <body>)
- [(case (<value> <state>)
+ [(when (<value> <state>)
{try.#Success [<state> <binding>]}
<body>
diff --git a/stdlib/source/library/lux/meta/target/jvm/field.lux b/stdlib/source/library/lux/meta/target/jvm/field.lux
index e0561b457..49c60849e 100644
--- a/stdlib/source/library/lux/meta/target/jvm/field.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/field.lux
@@ -73,7 +73,7 @@
(in [#modifier modifier
#name @name
#descriptor @descriptor
- #attributes (case @signature
+ #attributes (when @signature
{.#Some @signature}
(sequence.suffix @signature attributes)
diff --git a/stdlib/source/library/lux/meta/target/jvm/loader.lux b/stdlib/source/library/lux/meta/target/jvm/loader.lux
index 05d45cfad..c8d70c482 100644
--- a/stdlib/source/library/lux/meta/target/jvm/loader.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/loader.lux
@@ -117,9 +117,9 @@
"throws" [java/lang/ClassNotFoundException]
(let [class_name (as Text class_name)
classes (|> library atom.read! io.run!)]
- (case (dictionary.value class_name classes)
+ (when (dictionary.value class_name classes)
{.#Some bytecode}
- (case (..define class_name bytecode (<| <cast> self))
+ (when (..define class_name bytecode (<| <cast> self))
{try.#Success class}
(as_expected class)
diff --git a/stdlib/source/library/lux/meta/target/jvm/method.lux b/stdlib/source/library/lux/meta/target/jvm/method.lux
index 3db1be9bc..ec4780b0f 100644
--- a/stdlib/source/library/lux/meta/target/jvm/method.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/method.lux
@@ -63,10 +63,10 @@
attributes)
(monad.all !)
(at ! each sequence.of_list))
- attributes (case code
+ attributes (when code
{.#Some code}
(do !
- [environment (case (if (//modifier.has? static modifier)
+ [environment (when (if (//modifier.has? static modifier)
(//environment.static type)
(//environment.virtual type))
{try.#Success environment}
diff --git a/stdlib/source/library/lux/meta/target/jvm/reflection.lux b/stdlib/source/library/lux/meta/target/jvm/reflection.lux
index 0ee71e599..a33bc6507 100644
--- a/stdlib/source/library/lux/meta/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/reflection.lux
@@ -112,7 +112,7 @@
(def .public (load class_loader name)
(-> java/lang/ClassLoader External (Try (java/lang/Class java/lang/Object)))
- (case (java/lang/Class::forName name false class_loader)
+ (when (java/lang/Class::forName name false class_loader)
{try.#Failure _}
(exception.except ..unknown_class [name])
@@ -130,7 +130,7 @@
(-> (-> java/lang/reflect/Type (Try (/.Type Parameter)))
java/lang/reflect/Type
(Try (/.Type Class)))
- (<| (case (ffi.as java/lang/Class reflection)
+ (<| (when (ffi.as java/lang/Class reflection)
{.#Some class}
(let [class_name (|> class
(as (java/lang/Class java/lang/Object))
@@ -151,10 +151,10 @@
(exception.except ..not_a_class [reflection])
{try.#Success (/.class class_name (list))})))
_)
- (case (ffi.as java/lang/reflect/ParameterizedType reflection)
+ (when (ffi.as java/lang/reflect/ParameterizedType reflection)
{.#Some reflection}
(let [raw (java/lang/reflect/ParameterizedType::getRawType reflection)]
- (case (ffi.as java/lang/Class raw)
+ (when (ffi.as java/lang/Class raw)
{.#Some raw'}
(let [! try.monad]
(|> reflection
@@ -175,19 +175,19 @@
(def .public (parameter type reflection)
(-> (-> java/lang/reflect/Type (Try (/.Type Value)))
(-> java/lang/reflect/Type (Try (/.Type Parameter))))
- (<| (case (ffi.as java/lang/reflect/TypeVariable reflection)
+ (<| (when (ffi.as java/lang/reflect/TypeVariable reflection)
{.#Some reflection}
{try.#Success (/.var (java/lang/reflect/TypeVariable::getName reflection))}
_)
- (case (ffi.as java/lang/reflect/WildcardType reflection)
+ (when (ffi.as java/lang/reflect/WildcardType reflection)
{.#Some reflection}
... TODO: Instead of having single lower/upper bounds, should
... allow for multiple ones.
- (case [(array.item 0 (java/lang/reflect/WildcardType::getLowerBounds reflection))
+ (when [(array.item 0 (java/lang/reflect/WildcardType::getLowerBounds reflection))
(array.item 0 (java/lang/reflect/WildcardType::getUpperBounds reflection))]
(^.with_template [<pattern> <kind>]
[<pattern>
- (case (ffi.as java/lang/reflect/GenericArrayType bound)
+ (when (ffi.as java/lang/reflect/GenericArrayType bound)
{.#Some it}
... TODO: Array bounds should not be "erased" as they
... are right now.
@@ -201,14 +201,14 @@
_
{try.#Success /.wildcard})
_)
- (case (ffi.as java/lang/reflect/GenericArrayType reflection)
+ (when (ffi.as java/lang/reflect/GenericArrayType reflection)
{.#Some reflection}
(|> reflection
java/lang/reflect/GenericArrayType::getGenericComponentType
type
(at try.monad each /.array))
_)
- (case (ffi.as java/lang/Class reflection)
+ (when (ffi.as java/lang/Class reflection)
{.#Some class}
(if (java/lang/Class::isArray class)
(|> class
@@ -221,7 +221,7 @@
(def .public (type reflection)
(-> java/lang/reflect/Type (Try (/.Type Value)))
- (<| (case (ffi.as java/lang/Class reflection)
+ (<| (when (ffi.as java/lang/Class reflection)
{.#Some reflection}
(let [class_name (|> reflection
(as (java/lang/Class java/lang/Object))
@@ -254,7 +254,7 @@
(def .public (return reflection)
(-> java/lang/reflect/Type (Try (/.Type Return)))
(with_expansions [<else> (these (..type reflection))]
- (case (ffi.as java/lang/Class reflection)
+ (when (ffi.as java/lang/Class reflection)
{.#Some class}
(let [class_name (|> reflection
(as (java/lang/Class java/lang/Object))
@@ -289,8 +289,8 @@
(def .public (correspond class type)
(-> (java/lang/Class java/lang/Object) Type (Try Mapping))
- (case type
- {.#Primitive array.type_name (list :member:)}
+ (when type
+ {.#Primitive array.primitive (list :member:)}
(if (java/lang/Class::isArray class)
(correspond (java/lang/Class::getComponentType class)
:member:)
@@ -317,7 +317,7 @@
(correspond class anonymousT)
{.#Apply inputT abstractionT}
- (case (type.applied (list inputT) abstractionT)
+ (when (type.applied (list inputT) abstractionT)
{.#Some outputT}
(correspond class outputT)
@@ -349,7 +349,7 @@
(def .public (field field target)
(-> Text (java/lang/Class java/lang/Object) (Try java/lang/reflect/Field))
- (case (java/lang/Class::getDeclaredField field target)
+ (when (java/lang/Class::getDeclaredField field target)
{try.#Success field}
(let [owner (java/lang/reflect/Field::getDeclaringClass field)]
(if (same? owner target)
@@ -372,7 +372,7 @@
(do [! try.monad]
[fieldJ (..field field class)
.let [modifiers (java/lang/reflect/Field::getModifiers fieldJ)]]
- (case (java/lang/reflect/Modifier::isStatic modifiers)
+ (when (java/lang/reflect/Modifier::isStatic modifiers)
<then?> (|> fieldJ
java/lang/reflect/Field::getGenericType
..type
diff --git a/stdlib/source/library/lux/meta/target/jvm/type/lux.lux b/stdlib/source/library/lux/meta/target/jvm/type/lux.lux
index 3af93e1b5..4f6d9076f 100644
--- a/stdlib/source/library/lux/meta/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/type/lux.lux
@@ -121,7 +121,7 @@
(-> Mapping (Parser (Check Type)))
(do <>.monad
[var //parser.var']
- (in (case (dictionary.value var mapping)
+ (in (when (dictionary.value var mapping)
{.#None}
(check.except ..unknown_var [var])
@@ -174,7 +174,7 @@
(def array
(-> (Parser (Check Type)) (Parser (Check Type)))
(|>> (<>#each (check#each (function (_ elementT)
- (case elementT
+ (when elementT
{.#Primitive name {.#End}}
(if (`` (or (,, (with_template [<reflection>]
[(text#= (//reflection.reflection <reflection>) name)]
@@ -230,7 +230,7 @@
(def .public (check operation input)
(All (_ a) (-> (Parser (Check a)) Text (Check a)))
- (case (<text>.result operation input)
+ (when (<text>.result operation input)
{try.#Success check}
check
diff --git a/stdlib/source/library/lux/meta/target/jvm/type/signature.lux b/stdlib/source/library/lux/meta/target/jvm/type/signature.lux
index 6afc33607..96a912cde 100644
--- a/stdlib/source/library/lux/meta/target/jvm/type/signature.lux
+++ b/stdlib/source/library/lux/meta/target/jvm/type/signature.lux
@@ -95,7 +95,7 @@
(abstraction
(format //descriptor.class_prefix
(|> name ///name.internal ///name.read)
- (case parameters
+ (when parameters
{.#End}
""
@@ -130,7 +130,7 @@
(def var_declaration/*
(-> (List (Signature Var)) Text)
- (|>> (pipe.case
+ (|>> (pipe.when
{.#End}
""
diff --git a/stdlib/source/library/lux/meta/target/lua.lux b/stdlib/source/library/lux/meta/target/lua.lux
index 1ea2f196c..8168b065b 100644
--- a/stdlib/source/library/lux/meta/target/lua.lux
+++ b/stdlib/source/library/lux/meta/target/lua.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Location Code Label int if function or and not let local comment the)
+ [lux (.except Location Code Label int if function or and not let local comment the when)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]
@@ -91,7 +91,7 @@
(def .public boolean
(-> Bit Literal)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "false"
#1 "true")
abstraction))
@@ -375,7 +375,7 @@
(def arity_inputs
(syntax (_ [arity <code>.nat])
- (in (case arity
+ (in (.when arity
0 (.list)
_ (|> (-- arity)
(enum.range n.enum 0)
diff --git a/stdlib/source/library/lux/meta/target/php.lux b/stdlib/source/library/lux/meta/target/php.lux
index cb7870fd2..748d852c2 100644
--- a/stdlib/source/library/lux/meta/target/php.lux
+++ b/stdlib/source/library/lux/meta/target/php.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Location Code Global Label static int if cond or and not comment for try global the parameter)
+ [lux (.except Location Code Global Label static int if cond or and not comment for try global the parameter when)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]
@@ -134,7 +134,7 @@
(def .public bool
(-> Bit Literal)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "false"
#1 "true")
abstraction))
@@ -220,7 +220,7 @@
(def .public (closure uses arguments body!)
(-> (List Argument) (List Argument) Statement Literal)
- (let [uses (case uses
+ (let [uses (.when uses
{.#End}
""
@@ -234,7 +234,7 @@
(def arity_inputs
(syntax (_ [arity <code>.nat])
- (in (case arity
+ (in (.when arity
0 (.list)
_ (|> (-- arity)
(enum.range n.enum 0)
diff --git a/stdlib/source/library/lux/meta/target/python.lux b/stdlib/source/library/lux/meta/target/python.lux
index b3c874f26..93014c3e4 100644
--- a/stdlib/source/library/lux/meta/target/python.lux
+++ b/stdlib/source/library/lux/meta/target/python.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Location Code not or and list if int comment exec try the is def)
+ [lux (.except Location Code not or and list if int comment exec try the is def when)
["[0]" ffi]
[abstract
[equivalence (.only Equivalence)]
@@ -132,7 +132,7 @@
(.def .public bool
(-> Bit Literal)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "False"
#1 "True")
abstraction))
@@ -370,7 +370,7 @@
(abstraction
(format "while " (representation test) ":"
(..nested (representation body!))
- (case else!
+ (.when else!
{.#Some else!}
(format \n+ "else:"
(..nested (representation else!)))
@@ -423,7 +423,7 @@
(.def .public (exec globals code)
(-> (Maybe (Expression Any)) (Expression Any) (Statement Any))
- (let [extra (case globals
+ (let [extra (.when globals
{.#Some globals}
(.list globals)
@@ -453,7 +453,7 @@
(.def arity_inputs
(syntax (_ [arity <code>.nat])
- (in (case arity
+ (in (.when arity
0 (.list)
_ (|> (-- arity)
(enum.range n.enum 0)
diff --git a/stdlib/source/library/lux/meta/target/r.lux b/stdlib/source/library/lux/meta/target/r.lux
index f425f584b..7da2c28bd 100644
--- a/stdlib/source/library/lux/meta/target/r.lux
+++ b/stdlib/source/library/lux/meta/target/r.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Code or and list if function cond not int)
+ [lux (.except Code or and list if function cond not int when)
[control
["[0]" pipe]
["[0]" function]
@@ -113,7 +113,7 @@
(def .public bool
(-> Bit Expression)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "FALSE"
#1 "TRUE")
abstraction))
@@ -211,7 +211,7 @@
(def arity_inputs
(syntax (_ [arity <code>.nat])
- (in (case arity
+ (in (.when arity
0 (.list)
_ (|> arity
list.indices
diff --git a/stdlib/source/library/lux/meta/target/ruby.lux b/stdlib/source/library/lux/meta/target/ruby.lux
index 179d0182c..628c02eb3 100644
--- a/stdlib/source/library/lux/meta/target/ruby.lux
+++ b/stdlib/source/library/lux/meta/target/ruby.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Location Code static int if function or and not comment local global symbol the)
+ [lux (.except Location Code static int if function or and not comment local global symbol the when)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]
@@ -153,7 +153,7 @@
(def .public bool
(-> Bit Literal)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "false"
#1 "true")
abstraction))
@@ -247,7 +247,7 @@
(list#each (|>> representation))
(text.interposed ..input_separator)
(text.enclosed ["(" ")"]))
- block (case block
+ block (.when block
{.#None}
""
@@ -395,7 +395,7 @@
(def .public (lambda name block)
(-> (Maybe LVar) Block Literal)
(let [proc (format "lambda " (..block block))]
- (|> (case name
+ (|> (.when name
{.#None}
proc
@@ -483,7 +483,7 @@
(def arity_inputs
(syntax (_ [arity <code>.nat])
- (in (case arity
+ (in (.when arity
0 (.list)
_ (|> (-- arity)
(enum.range n.enum 0)
diff --git a/stdlib/source/library/lux/meta/target/scheme.lux b/stdlib/source/library/lux/meta/target/scheme.lux
index 86b9c5921..51a712a6f 100644
--- a/stdlib/source/library/lux/meta/target/scheme.lux
+++ b/stdlib/source/library/lux/meta/target/scheme.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Code int or and if cond let symbol)
+ [lux (.except Code int or and if cond let symbol when)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]]
@@ -81,9 +81,9 @@
(def (arguments [mandatory rest])
(-> Arguments (Code Any))
- (case rest
+ (.when rest
{.#Some rest}
- (case mandatory
+ (.when mandatory
{.#End}
rest
@@ -108,7 +108,7 @@
(def .public bool
(-> Bit Computation)
- (|>> (pipe.case
+ (|>> (pipe.when
#0 "#f"
#1 "#t")
abstraction))
@@ -163,7 +163,7 @@
(def form
(-> (List (Code Any)) Code)
(.let [nested_new_line (format \n+ text.tab)]
- (|>> (pipe.case
+ (|>> (pipe.when
{.#End}
(abstraction "()")
@@ -375,7 +375,7 @@
(def .public (guard variable clauses else body)
(-> Var (List [Expression Expression]) (Maybe Expression) Expression Computation)
(..form (list (..var "guard")
- (..form (|> (case else
+ (..form (|> (.when else
{.#None}
(list)
diff --git a/stdlib/source/library/lux/meta/type.lux b/stdlib/source/library/lux/meta/type.lux
index 70181ea04..a2bec39bf 100644
--- a/stdlib/source/library/lux/meta/type.lux
+++ b/stdlib/source/library/lux/meta/type.lux
@@ -32,7 +32,7 @@
(-> Type [Nat Type])
(loop (again [num_args 0
type type])
- (case type
+ (when type
{<tag> env sub_type}
(again (++ num_args) sub_type)
@@ -45,7 +45,7 @@
(def .public (flat_function type)
(-> Type [(List Type) Type])
- (case type
+ (when type
{.#Function in out'}
(.let [[ins out] (flat_function out')]
[(list.partial in ins) out])
@@ -55,7 +55,7 @@
(def .public (flat_application type)
(-> Type [Type (List Type)])
- (case type
+ (when type
{.#Apply arg func'}
(.let [[func args] (flat_application func')]
[func (list#composite args (list arg))])
@@ -66,7 +66,7 @@
(with_template [<name> <tag>]
[(def .public (<name> type)
(-> Type (List Type))
- (case type
+ (when type
{<tag> left right}
(list.partial left (<name> right))
@@ -79,7 +79,7 @@
(`` (def .public (format type)
(-> Type Text)
- (case type
+ (when type
{.#Primitive name params}
(all text#composite
"(Primitive "
@@ -139,7 +139,7 @@
... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction
(`` (def (reduced env type)
(-> (List Type) Type Type)
- (case type
+ (when type
{.#Primitive name params}
{.#Primitive name (list#each (reduced env) params)}
@@ -152,7 +152,7 @@
(,, (with_template [<tag>]
[{<tag> old_env def}
- (case old_env
+ (when old_env
{.#End}
{<tag> env def}
@@ -187,7 +187,7 @@
... TODO: Remove this once JPHP is gone.
false
(same? x y))
- (case [x y]
+ (when [x y]
[{.#Primitive xname xparams} {.#Primitive yname yparams}]
(and (text#= xname yname)
(n.= (list.size yparams) (list.size xparams))
@@ -237,12 +237,12 @@
(`` (def .public (applied params func)
(-> (List Type) Type (Maybe Type))
- (case params
+ (when params
{.#End}
{.#Some func}
{.#Item param params'}
- (case func
+ (when func
(,, (with_template [<tag>]
[{<tag> env body}
(|> body
@@ -263,7 +263,7 @@
(`` (def .public (code type)
(-> Type Code)
- (case type
+ (when type
{.#Primitive name params}
(` {.#Primitive (, (code.text name))
(.list (,* (list#each code params)))})
@@ -300,7 +300,7 @@
(def .public (de_aliased type)
(-> Type Type)
- (case type
+ (when type
{.#Named _ {.#Named name type'}}
(de_aliased {.#Named name type'})
@@ -309,7 +309,7 @@
(def .public (anonymous type)
(-> Type Type)
- (case type
+ (when type
{.#Named name type'}
(anonymous type')
@@ -319,7 +319,7 @@
(with_template [<name> <base> <ctor>]
[(def .public (<name> types)
(-> (List Type) Type)
- (case types
+ (when types
{.#End}
<base>
@@ -335,7 +335,7 @@
(def .public (function inputs output)
(-> (List Type) Type Type)
- (case inputs
+ (when inputs
{.#End}
output
@@ -344,7 +344,7 @@
(def .public (application params quant)
(-> (List Type) Type Type)
- (case params
+ (when params
{.#End}
quant
@@ -354,7 +354,7 @@
(with_template [<name> <tag>]
[(def .public (<name> size body)
(-> Nat Type Type)
- (case size
+ (when size
0 body
_ (|> body (<name> (-- size)) {<tag> (list)})))]
@@ -364,7 +364,7 @@
(`` (def .public (quantified? type)
(-> Type Bit)
- (case type
+ (when type
{.#Named [module name] _type}
(quantified? _type)
@@ -385,7 +385,7 @@
(def .public (array depth element_type)
(-> Nat Type Type)
- (case depth
+ (when depth
0 element_type
_ (|> element_type
(array (-- depth))
@@ -395,7 +395,7 @@
(def .public (flat_array type)
(-> Type [Nat Type])
(with_expansions [<default> [0 type]]
- (case type
+ (when type
{.#Primitive name (list element_type)}
(if (text#= array.primitive name)
(.let [[depth element_type] (flat_array element_type)]
@@ -423,7 +423,7 @@
(syntax (_ [input (<>.or (<>.and <code>.symbol
(<>.maybe (<>.after (<code>.this_symbol ..secret_marker) <code>.any)))
<code>.any)])
- (case input
+ (when input
{.#Left [valueN valueC]}
(do meta.monad
[location meta.location
@@ -431,7 +431,7 @@
.let [_ ("lux io log"
(all text#composite
(symbol#encoded (symbol ..log!)) " " (location.format location) text.new_line
- "Expression: " (case valueC
+ "Expression: " (when valueC
{.#Some valueC}
(code.format valueC)
@@ -459,7 +459,7 @@
(.let [casterC (` (is (All ((, g!_) (,* (list#each code.local type_vars)))
(-> (, input) (, output)))
(|>> as_expected)))]
- (case value
+ (when value
{.#None}
(in (list casterC))
@@ -511,7 +511,7 @@
(.function (again it)
(if (at ..equivalence = before it)
after
- (case it
+ (when it
{.#Primitive name co_variant}
{.#Primitive name (list#each again co_variant)}
diff --git a/stdlib/source/library/lux/meta/type/check.lux b/stdlib/source/library/lux/meta/type/check.lux
index 90fb49156..184864469 100644
--- a/stdlib/source/library/lux/meta/type/check.lux
+++ b/stdlib/source/library/lux/meta/type/check.lux
@@ -80,7 +80,7 @@
(implementation
(def (each f fa)
(function (_ context)
- (case (fa context)
+ (when (fa context)
{try.#Success [context' output]}
{try.#Success [context' (f output)]}
@@ -94,9 +94,9 @@
(def (on fa ff)
(function (_ context)
- (case (ff context)
+ (when (ff context)
{try.#Success [context' f]}
- (case (fa context')
+ (when (fa context')
{try.#Success [context'' a]}
{try.#Success [context'' (f a)]}
@@ -119,9 +119,9 @@
(def (conjoint ffa)
(function (_ context)
- (case (ffa context)
+ (when (ffa context)
{try.#Success [context' fa]}
- (case (fa context')
+ (when (fa context')
{try.#Success [context'' a]}
{try.#Success [context'' a]}
@@ -141,7 +141,7 @@
(def (var::get id property_list)
(-> Var Type_Vars (Maybe (Maybe Type)))
- (case property_list
+ (when property_list
{.#Item [var_id var_type]
property_list'}
(if (!n#= id var_id)
@@ -153,7 +153,7 @@
(def (var::put id value property_list)
(-> Var (Maybe Type) Type_Vars Type_Vars)
- (case property_list
+ (when property_list
{.#End}
(list [id value])
@@ -167,7 +167,7 @@
(def .public (result context proc)
(All (_ a) (-> Type_Context (Check a) (Try a)))
- (case (proc context)
+ (when (proc context)
{try.#Success [context' output]}
{try.#Success output}
@@ -201,7 +201,7 @@
[(def .public (<name> id)
(-> Var (Check <outputT>))
(function (_ context)
- (case (|> context (the .#var_bindings) (var::get id))
+ (when (|> context (the .#var_bindings) (var::get id))
(^.or {.#Some {.#Some {.#Var _}}}
{.#Some {.#None}})
{try.#Success [context <fail>]}
@@ -220,7 +220,7 @@
(-> Var (Check Type))
(do ..monad
[?type (peek id)]
- (case ?type
+ (when ?type
{.#Some type}
(in type)
@@ -230,7 +230,7 @@
(def (bound id)
(-> Var (Check Type))
(function (_ context)
- (case (|> context (the .#var_bindings) (var::get id))
+ (when (|> context (the .#var_bindings) (var::get id))
{.#Some {.#Some bound}}
{try.#Success [context bound]}
@@ -243,7 +243,7 @@
(def .public (bind type id)
(-> Type Var (Check Any))
(function (_ context)
- (case (|> context (the .#var_bindings) (var::get id))
+ (when (|> context (the .#var_bindings) (var::get id))
{.#Some {.#None}}
{try.#Success [(revised .#var_bindings (var::put id {.#Some type}) context)
[]]}
@@ -257,7 +257,7 @@
(def (re_bind' ?type id)
(-> (Maybe Type) Var (Check Any))
(function (_ context)
- (case (|> context (the .#var_bindings) (var::get id))
+ (when (|> context (the .#var_bindings) (var::get id))
{.#Some _}
{try.#Success [(revised .#var_bindings (var::put id ?type) context)
[]]}
@@ -280,11 +280,11 @@
(def (on argT funcT)
(-> Type Type (Check Type))
- (case funcT
+ (when funcT
{.#Var func_id}
(do ..monad
[?funcT' (peek func_id)]
- (case ?funcT'
+ (when ?funcT'
{.#Some funcT'}
(on argT funcT')
@@ -297,7 +297,7 @@
(on argT funcT''))
_
- (case (//.applied (list argT) funcT)
+ (when (//.applied (list argT) funcT)
{.#Some output}
(check#in output)
@@ -309,9 +309,9 @@
(function (_ context)
(loop (again [current start
output (list start)])
- (case (|> context (the .#var_bindings) (var::get current))
+ (when (|> context (the .#var_bindings) (var::get current))
{.#Some {.#Some type}}
- (case type
+ (when type
{.#Var next}
(if (!n#= start next)
{try.#Success [context output]}
@@ -346,7 +346,7 @@
(-> (List Var) Var (Check Type))
(do [! ..monad]
[:bound: (..peek @)]
- (case :bound:
+ (when :bound:
{.#Some :bound:}
(in :bound:)
@@ -358,7 +358,7 @@
(do !
[.let [forbidden_aliases (set.of_list n.hash (list.partial @ aliases))
allowed_aliases (set.difference forbidden_aliases existing_aliases)]]
- (case (set.list allowed_aliases)
+ (when (set.list allowed_aliases)
{.#Item identity _}
(in {.#Var identity})
@@ -387,7 +387,7 @@
(-> Var (Check Any))
(do [! ..monad]
[ring (..ring' @)]
- (case ring
+ (when ring
(list)
(in [])
@@ -400,7 +400,7 @@
(erase! @me))
(list.partial @prev _)
- (case (list.reversed ring)
+ (when (list.reversed ring)
(list.partial @me @next _)
(do !
[_ (re_bind {.#Var @next} @prev)
@@ -413,7 +413,7 @@
(def .public (try it)
(All (_ a) (-> (Check a) (Check (Try a))))
(function (_ context)
- (case (it context)
+ (when (it context)
{try.#Success [context' output]}
{try.#Success [context' {try.#Success output}]}
@@ -429,7 +429,7 @@
(def (either left right)
(All (_ a) (-> (Check a) (Check a) (Check a)))
(function (_ context)
- (case (left context)
+ (when (left context)
{try.#Failure _}
(right context)
@@ -483,7 +483,7 @@
(do [! ..monad]
[ebound (..try (..bound idE))
abound (..try (..bound idA))]
- (case [ebound abound]
+ (when [ebound abound]
... Link the 2 variables circularly
[{try.#Failure _} {try.#Failure _}]
(do !
@@ -492,7 +492,7 @@
... Interpose new variable between 2 existing links
[{try.#Success etype} {try.#Failure _}]
- (case etype
+ (when etype
{.#Var targetE}
(do !
[_ (link/3 idA targetE idE)]
@@ -503,7 +503,7 @@
... Interpose new variable between 2 existing links
[{try.#Failure _} {try.#Success atype}]
- (case atype
+ (when atype
{.#Var targetA}
(do !
[_ (link/3 idE targetA idA)]
@@ -513,7 +513,7 @@
(check' assumptions {.#Var idE} atype))
[{try.#Success etype} {try.#Success atype}]
- (case [etype atype]
+ (when [etype atype]
[{.#Var targetE} {.#Var targetA}]
(do !
[ringE (..ring idE)
@@ -551,7 +551,7 @@
(-> (Checker Type) (Checker [Type Type]))
(let [[expected_input expected_function] expected
[actual_input actual_function] actual]
- (case [expected_function actual_function]
+ (when [expected_function actual_function]
[{.#Ex exE} {.#Ex exA}]
(if (!n#= exE exA)
(check' assumptions expected_input actual_input)
@@ -584,7 +584,7 @@
[{.#Var id} _]
(function (_ context)
- (case ((do ..monad
+ (when ((do ..monad
[expected_function' (..read id)]
(check' assumptions {.#Apply expected_input expected_function'} {.#Apply actual}))
context)
@@ -592,7 +592,7 @@
{try.#Success output}
{try.#Failure _}
- (case actual_function
+ (when actual_function
{.#UnivQ _ _}
((do ..monad
[actual' (..on actual_input actual_function)]
@@ -615,7 +615,7 @@
[_ {.#Var id}]
(function (_ context)
- (case ((do ..monad
+ (when ((do ..monad
[actual_function' (read id)]
(check' assumptions {.#Apply expected} {.#Apply actual_input actual_function'}))
context)
@@ -648,7 +648,7 @@
(same? expected actual))
(check#in assumptions)
(with_exception ..type_check_failed [expected actual]
- (case [expected actual]
+ (when [expected actual]
[{.#Var idE} {.#Var idA}]
(check_vars check' assumptions idE idA)
@@ -710,7 +710,7 @@
(loop (again [assumptions assumptions
e_params e_params
a_params a_params])
- (case [e_params a_params]
+ (when [e_params a_params]
[{.#End} {.#End}]
(check#in assumptions)
@@ -756,7 +756,7 @@
(def .public (subsumes? expected actual)
(-> Type Type Bit)
- (case (..result ..fresh_context
+ (when (..result ..fresh_context
(..check expected actual))
{try.#Failure _}
false
@@ -776,7 +776,7 @@
(def .public (clean aliases inputT)
(-> (List Var) Type (Check Type))
- (case inputT
+ (when inputT
{.#Primitive name paramsT+}
(|> paramsT+
(monad.each ..monad (clean aliases))
@@ -794,11 +794,11 @@
([.#Sum] [.#Product] [.#Function] [.#Apply])
{.#Var @it}
- (case aliases
+ (when aliases
(list)
(do ..monad
[?actualT (..peek @it)]
- (case ?actualT
+ (when ?actualT
{.#Some actualT}
(clean aliases actualT)
@@ -808,9 +808,9 @@
_
(do ..monad
[:it: (..try (..identity aliases @it))]
- (case :it:
+ (when :it:
{try.#Success :it:}
- (case :it:
+ (when :it:
{.#Var _}
(in inputT)
diff --git a/stdlib/source/library/lux/meta/type/implicit.lux b/stdlib/source/library/lux/meta/type/implicit.lux
index 835fff931..df5da5767 100644
--- a/stdlib/source/library/lux/meta/type/implicit.lux
+++ b/stdlib/source/library/lux/meta/type/implicit.lux
@@ -29,10 +29,10 @@
(def (type_var id env)
(-> Nat Type_Context (Meta Type))
- (case (list.example (|>> product.left (n.= id))
+ (when (list.example (|>> product.left (n.= id))
(the .#var_bindings env))
{.#Some [_ {.#Some type}]}
- (case type
+ (when type
{.#Var id'}
(type_var id' env)
@@ -51,7 +51,7 @@
(do ///.monad
[raw_type (///.type var_name)
compiler ///.compiler_state]
- (case raw_type
+ (when raw_type
{.#Var id}
(type_var id (the .#type_context compiler))
@@ -60,12 +60,12 @@
(def (member_type idx sig_type)
(-> Nat Type (Check Type))
- (case sig_type
+ (when sig_type
{.#Named _ sig_type'}
(member_type idx sig_type')
{.#Apply arg func}
- (case (//.applied (list arg) func)
+ (when (//.applied (list arg) func)
{.#None}
(check.failure (format "Cannot apply type " (%.type func) " to type " (%.type arg)))
@@ -84,7 +84,7 @@
(def (member_name member)
(-> Symbol (Meta Symbol))
- (case member
+ (when member
["" simple_name]
(///.either (do ///.monad
[member (///.normal member)
@@ -97,7 +97,7 @@
.let [tag_lists (|> tag_lists list#conjoint (list#each product.left) list#conjoint)
candidates (list.only (|>> product.right (text#= simple_name))
tag_lists)]]
- (case candidates
+ (when candidates
{.#End}
(///.failure (format "Unknown tag: " (%.symbol member)))
@@ -181,7 +181,7 @@
(def (on_argument arg func)
(-> Type Type (Check Type))
- (case func
+ (when func
{.#Named _ func'}
(on_argument arg func')
@@ -203,7 +203,7 @@
(def (concrete_type type)
(-> Type (Check [(List Nat) Type]))
- (case type
+ (when type
{.#UnivQ _}
(do check.monad
[[id var] check.var
@@ -232,9 +232,9 @@
(Meta (List Instance)))
(do ///.monad
[compiler ///.compiler_state]
- (case (|> alts
+ (when (|> alts
(list#each (function (_ [alt_name alt_type])
- (case (check.result context
+ (when (check.result context
(do [! check.monad]
[[tvars alt_type] (concrete_type alt_type)
.let [[deps alt_type] (//.flat_function alt_type)]
@@ -256,7 +256,7 @@
(def (provision sig_type compiler context dep)
(-> Type Lux Type_Context Type (Check Instance))
- (case (///.result compiler
+ (when (///.result compiler
(all ///.either
(do ///.monad [alts (..local_env sig_type)] (..candidate_provision (provision sig_type) context dep alts))
(do ///.monad [alts (..local_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts))
@@ -265,7 +265,7 @@
(check.failure error)
{.#Right candidates}
- (case candidates
+ (when candidates
{.#End}
(check.failure (format "No candidates for provisioning: " (%.type dep)))
@@ -281,9 +281,9 @@
(do ///.monad
[compiler ///.compiler_state
context ///.type_context]
- (case (|> alts
+ (when (|> alts
(list#each (function (_ [alt_name alt_type])
- (case (<| (check.result context)
+ (when (<| (check.result context)
(do [! check.monad]
[[tvars alt_type] (concrete_type alt_type)
.let [[deps alt_type] (//.flat_function alt_type)]
@@ -315,7 +315,7 @@
(def (var? input)
(-> Code Bit)
- (case input
+ (when input
[_ {.#Symbol _}]
#1
@@ -328,7 +328,7 @@
(def (instance$ [constructor dependencies])
(-> Instance Code)
- (case dependencies
+ (when dependencies
{.#End}
(code.symbol constructor)
@@ -339,14 +339,14 @@
(syntax (_ [member <code>.symbol
args (<>.or (<>.and (<>.some <code>.symbol) <code>.end)
(<>.and (<>.some <code>.any) <code>.end))])
- (case args
+ (when args
{.#Left [args _]}
(do [! ///.monad]
[[member_idx sig_type] (..implicit_member member)
input_types (monad.each ! ..implicit_type args)
output_type ///.expected_type
chosen_ones (alternatives sig_type member_idx input_types output_type)]
- (case chosen_ones
+ (when chosen_ones
{.#End}
(///.failure (format "No implementation could be found for member: " (%.symbol member)))
diff --git a/stdlib/source/library/lux/meta/type/poly.lux b/stdlib/source/library/lux/meta/type/poly.lux
index a9a533d94..cccc9e518 100644
--- a/stdlib/source/library/lux/meta/type/poly.lux
+++ b/stdlib/source/library/lux/meta/type/poly.lux
@@ -33,7 +33,7 @@
(in (.list (` (syntax ((, g!_) [(, g!type) <code>.any])
(do ///.monad
[(, g!type) (///.eval .Type (, g!type))]
- (case (is (.Either .Text .Code)
+ (when (is (.Either .Text .Code)
(<//>.result (<>.rec
(function ((, g!_) (, g!name))
(, body)))
@@ -46,7 +46,7 @@
(def .public (code env type)
(-> Env Type Code)
- (case type
+ (when type
{.#Primitive name params}
(` {.#Primitive (, (code.text name))
(.list (,* (list#each (code env) params)))})
@@ -64,7 +64,7 @@
{.#Apply {.#Primitive "" {.#End}}
{.#Parameter idx}}
- (case (<//>.argument env idx)
+ (when (<//>.argument env idx)
0 (|> env (dictionary.value 0) maybe.trusted product.left (code env))
idx (undefined))
diff --git a/stdlib/source/library/lux/meta/type/primitive.lux b/stdlib/source/library/lux/meta/type/primitive.lux
index ea277d239..8c6b0a98e 100644
--- a/stdlib/source/library/lux/meta/type/primitive.lux
+++ b/stdlib/source/library/lux/meta/type/primitive.lux
@@ -46,7 +46,7 @@
[(def .public <name>
(syntax (_ [[frame value] ..cast])
(do meta.monad
- [[name type_vars abstraction representation] (case frame
+ [[name type_vars abstraction representation] (when frame
{.#Some frame}
(..specific frame)
diff --git a/stdlib/source/library/lux/meta/type/quotient.lux b/stdlib/source/library/lux/meta/type/quotient.lux
index 0687af5ce..04058c1e1 100644
--- a/stdlib/source/library/lux/meta/type/quotient.lux
+++ b/stdlib/source/library/lux/meta/type/quotient.lux
@@ -51,7 +51,7 @@
... (..Class (, g!t) (, g!c) (, g!%)))
... (, class))
]
- (.case (.type_of (, class))
+ (.when (.type_of (, class))
{.#Apply (, g!%) {.#Apply (, g!c) {.#Apply (, g!t) (, g!:quotient:)}}}
(.type_literal (..Quotient (, g!t) (, g!c) (, g!%)))
diff --git a/stdlib/source/library/lux/meta/type/refinement.lux b/stdlib/source/library/lux/meta/type/refinement.lux
index 5b7e939a5..fb7553897 100644
--- a/stdlib/source/library/lux/meta/type/refinement.lux
+++ b/stdlib/source/library/lux/meta/type/refinement.lux
@@ -55,12 +55,12 @@
(def .public (only refiner values)
(All (_ t %)
(-> (Refiner t %) (List t) (List (Refined t %))))
- (case values
+ (when values
{.#End}
{.#End}
{.#Item head tail}
- (case (refiner head)
+ (when (refiner head)
{.#Some refined}
{.#Item refined (only refiner tail)}
@@ -70,13 +70,13 @@
(def .public (partition refiner values)
(All (_ t %)
(-> (Refiner t %) (List t) [(List (Refined t %)) (List t)]))
- (case values
+ (when values
{.#End}
[{.#End} {.#End}]
{.#Item head tail}
(let [[yes no] (partition refiner tail)]
- (case (refiner head)
+ (when (refiner head)
{.#Some refined}
[{.#Item refined yes}
no]
@@ -93,7 +93,7 @@
... (..Refined (, g!t) (, g!%)))
... (, refiner))
]
- (.case (.type_of (, refiner))
+ (.when (.type_of (, refiner))
{.#Apply (, g!%) {.#Apply (, g!t) (, g!:refiner:)}}
(.type_literal (..Refined (, g!t) (, g!%)))
diff --git a/stdlib/source/library/lux/meta/type/resource.lux b/stdlib/source/library/lux/meta/type/resource.lux
index 3e652b8b9..7b1a83195 100644
--- a/stdlib/source/library/lux/meta/type/resource.lux
+++ b/stdlib/source/library/lux/meta/type/resource.lux
@@ -130,7 +130,7 @@
(def .public exchange
(syntax (_ [swaps ..indices])
(macro.with_symbols [g!_ g!context g!!]
- (case swaps
+ (when swaps
{.#End}
(in (list (` ..no_op)))
diff --git a/stdlib/source/library/lux/meta/version.lux b/stdlib/source/library/lux/meta/version.lux
index a1e00e3d4..af8da3bce 100644
--- a/stdlib/source/library/lux/meta/version.lux
+++ b/stdlib/source/library/lux/meta/version.lux
@@ -35,7 +35,7 @@
default (<>.maybe <code>.any)])
(do meta.monad
[current meta.version]
- (case (list#mix (function (_ [when then] choice)
+ (when (list#mix (function (_ [when then] choice)
(if (text#= when current)
{.#Some then}
choice))