aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2022-08-11 04:15:07 -0400
committerEduardo Julian2022-08-11 04:15:07 -0400
commit065e8a4d8122d4616b570496915d2c0e2c78cd6b (patch)
treef2bbdc3e40b796b34026ab04c9a478d8a3f082d5
parent68d78235694c633c956bb9e8a007cad7d65370bc (diff)
Re-named the "case" macro to "when".
-rw-r--r--licentia/source/program/licentia.lux2
-rw-r--r--licentia/source/program/licentia/output.lux10
-rw-r--r--licentia/source/test/licentia.lux8
-rw-r--r--lux-cl/source/program.lux16
-rw-r--r--lux-js/commands.md3
-rw-r--r--lux-js/source/program.lux46
-rw-r--r--lux-lua/source/program.lux44
-rw-r--r--lux-mode/lux-mode.el4
-rw-r--r--lux-php/source/program.lux157
-rw-r--r--lux-python/source/program.lux42
-rw-r--r--lux-r/source/program.lux22
-rw-r--r--lux-ruby/source/program.lux52
-rw-r--r--lux-scheme/source/program.lux26
-rw-r--r--stdlib/source/documentation/lux.lux1751
-rw-r--r--stdlib/source/documentation/lux/control/concatenative.lux3
-rw-r--r--stdlib/source/documentation/lux/control/function/mutual.lux8
-rw-r--r--stdlib/source/documentation/lux/control/pipe.lux13
-rw-r--r--stdlib/source/documentation/lux/data/color/named.lux142
-rw-r--r--stdlib/source/documentation/lux/data/text/encoding.lux322
-rw-r--r--stdlib/source/documentation/lux/data/text/regex.lux2
-rw-r--r--stdlib/source/documentation/lux/data/text/unicode/block.lux99
-rw-r--r--stdlib/source/documentation/lux/ffi.js.lux103
-rw-r--r--stdlib/source/documentation/lux/ffi.jvm.lux2
-rw-r--r--stdlib/source/documentation/lux/ffi.lua.lux47
-rw-r--r--stdlib/source/documentation/lux/ffi.old.lux423
-rw-r--r--stdlib/source/documentation/lux/ffi.py.lux85
-rw-r--r--stdlib/source/documentation/lux/ffi.rb.lux61
-rw-r--r--stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux2
-rw-r--r--stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux2
-rw-r--r--stdlib/source/documentation/lux/meta/target/python.lux39
-rw-r--r--stdlib/source/documentation/lux/world/input/keyboard.lux38
-rw-r--r--stdlib/source/experiment/tool/interpreter.lux4
-rw-r--r--stdlib/source/format/lux/data/binary.lux8
-rw-r--r--stdlib/source/format/lux/data/text.lux2
-rw-r--r--stdlib/source/library/lux.lux376
-rw-r--r--stdlib/source/library/lux/abstract/comonad.lux16
-rw-r--r--stdlib/source/library/lux/abstract/functor.lux2
-rw-r--r--stdlib/source/library/lux/abstract/monad.lux28
-rw-r--r--stdlib/source/library/lux/abstract/monad/free.lux8
-rw-r--r--stdlib/source/library/lux/abstract/monad/indexed.lux6
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux10
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux12
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux6
-rw-r--r--stdlib/source/library/lux/control/concurrency/frp.lux26
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/stm.lux10
-rw-r--r--stdlib/source/library/lux/control/concurrency/thread.lux6
-rw-r--r--stdlib/source/library/lux/control/exception.lux12
-rw-r--r--stdlib/source/library/lux/control/function/memo.lux2
-rw-r--r--stdlib/source/library/lux/control/function/mutual.lux4
-rw-r--r--stdlib/source/library/lux/control/lazy.lux2
-rw-r--r--stdlib/source/library/lux/control/maybe.lux24
-rw-r--r--stdlib/source/library/lux/control/parser.lux44
-rw-r--r--stdlib/source/library/lux/control/pipe.lux16
-rw-r--r--stdlib/source/library/lux/control/region.lux12
-rw-r--r--stdlib/source/library/lux/control/remember.lux8
-rw-r--r--stdlib/source/library/lux/control/try.lux26
-rw-r--r--stdlib/source/library/lux/data/bit.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux46
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux66
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux96
-rw-r--r--stdlib/source/library/lux/data/collection/list/property.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/queue.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/queue/priority.lux16
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux26
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/stack.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/stream.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/tree/finger.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux34
-rw-r--r--stdlib/source/library/lux/data/color.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css.lux4
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux6
-rw-r--r--stdlib/source/library/lux/data/format/html.lux20
-rw-r--r--stdlib/source/library/lux/data/format/json.lux26
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux4
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux12
-rw-r--r--stdlib/source/library/lux/data/format/xml.lux10
-rw-r--r--stdlib/source/library/lux/data/sum.lux14
-rw-r--r--stdlib/source/library/lux/data/text.lux26
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux16
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux18
-rw-r--r--stdlib/source/library/lux/data/text/unicode/set.lux2
-rw-r--r--stdlib/source/library/lux/debug.lux36
-rw-r--r--stdlib/source/library/lux/documentation.lux48
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux92
-rw-r--r--stdlib/source/library/lux/ffi.lux32
-rw-r--r--stdlib/source/library/lux/ffi.old.lux84
-rw-r--r--stdlib/source/library/lux/ffi.php.lux10
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux6
-rw-r--r--stdlib/source/library/lux/ffi/export.jvm.lux4
-rw-r--r--stdlib/source/library/lux/ffi/export.rb.lux4
-rw-r--r--stdlib/source/library/lux/math.lux4
-rw-r--r--stdlib/source/library/lux/math/infix.lux2
-rw-r--r--stdlib/source/library/lux/math/modular.lux2
-rw-r--r--stdlib/source/library/lux/math/number.lux6
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux2
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux14
-rw-r--r--stdlib/source/library/lux/math/number/i16.lux2
-rw-r--r--stdlib/source/library/lux/math/number/i32.lux2
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux6
-rw-r--r--stdlib/source/library/lux/math/number/i8.lux2
-rw-r--r--stdlib/source/library/lux/math/number/int.lux8
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux28
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux4
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux18
-rw-r--r--stdlib/source/library/lux/math/random.lux4
-rw-r--r--stdlib/source/library/lux/meta.lux74
-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
-rw-r--r--stdlib/source/library/lux/program.lux4
-rw-r--r--stdlib/source/library/lux/test/property.lux14
-rw-r--r--stdlib/source/library/lux/world/console.lux12
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/output.lux19
-rw-r--r--stdlib/source/library/lux/world/db/sql.lux8
-rw-r--r--stdlib/source/library/lux/world/environment.lux20
-rw-r--r--stdlib/source/library/lux/world/file.lux70
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux12
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux16
-rw-r--r--stdlib/source/library/lux/world/net/http/cookie.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/header.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux10
-rw-r--r--stdlib/source/library/lux/world/net/http/route.lux4
-rw-r--r--stdlib/source/library/lux/world/shell.lux8
-rw-r--r--stdlib/source/library/lux/world/time.lux2
-rw-r--r--stdlib/source/library/lux/world/time/day.lux18
-rw-r--r--stdlib/source/library/lux/world/time/duration.lux4
-rw-r--r--stdlib/source/library/lux/world/time/instant.lux4
-rw-r--r--stdlib/source/library/lux/world/time/month.lux20
-rw-r--r--stdlib/source/library/lux/world/time/year.lux4
-rw-r--r--stdlib/source/parser/lux/data/binary.lux8
-rw-r--r--stdlib/source/parser/lux/data/collection/tree.lux2
-rw-r--r--stdlib/source/parser/lux/data/format/json.lux28
-rw-r--r--stdlib/source/parser/lux/data/format/xml.lux22
-rw-r--r--stdlib/source/parser/lux/data/text.lux24
-rw-r--r--stdlib/source/parser/lux/meta/code.lux34
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux14
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux18
-rw-r--r--stdlib/source/parser/lux/meta/type.lux28
-rw-r--r--stdlib/source/parser/lux/program.lux12
-rw-r--r--stdlib/source/parser/lux/world/environment.lux2
-rw-r--r--stdlib/source/polytypic/lux/abstract/equivalence.lux2
-rw-r--r--stdlib/source/polytypic/lux/abstract/functor.lux4
-rw-r--r--stdlib/source/polytypic/lux/data/format/json.lux4
-rw-r--r--stdlib/source/program/aedifex.lux20
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/version/value.lux2
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux2
-rw-r--r--stdlib/source/program/aedifex/command/build.lux20
-rw-r--r--stdlib/source/program/aedifex/command/deploy/release.lux2
-rw-r--r--stdlib/source/program/aedifex/command/install.lux2
-rw-r--r--stdlib/source/program/aedifex/command/test.lux2
-rw-r--r--stdlib/source/program/aedifex/dependency/deployment.lux10
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux16
-rw-r--r--stdlib/source/program/aedifex/format.lux8
-rw-r--r--stdlib/source/program/aedifex/hash.lux6
-rw-r--r--stdlib/source/program/aedifex/input.lux2
-rw-r--r--stdlib/source/program/aedifex/metadata/artifact.lux2
-rw-r--r--stdlib/source/program/aedifex/metadata/snapshot.lux4
-rw-r--r--stdlib/source/program/aedifex/package.lux2
-rw-r--r--stdlib/source/program/aedifex/pom.lux4
-rw-r--r--stdlib/source/program/aedifex/profile.lux2
-rw-r--r--stdlib/source/program/aedifex/project.lux4
-rw-r--r--stdlib/source/program/aedifex/repository.lux4
-rw-r--r--stdlib/source/program/aedifex/repository/local.lux2
-rw-r--r--stdlib/source/program/aedifex/repository/remote.lux6
-rw-r--r--stdlib/source/program/compositor.lux12
-rw-r--r--stdlib/source/specification/aedifex/repository.lux4
-rw-r--r--stdlib/source/specification/compositor.lux6
-rw-r--r--stdlib/source/specification/compositor/analysis/type.lux2
-rw-r--r--stdlib/source/specification/compositor/generation/case.lux50
-rw-r--r--stdlib/source/specification/compositor/generation/common.lux42
-rw-r--r--stdlib/source/specification/compositor/generation/primitive.lux2
-rw-r--r--stdlib/source/specification/compositor/generation/reference.lux4
-rw-r--r--stdlib/source/specification/compositor/generation/structure.lux6
-rw-r--r--stdlib/source/specification/lux/abstract/codec.lux2
-rw-r--r--stdlib/source/specification/lux/world/console.lux6
-rw-r--r--stdlib/source/specification/lux/world/file.lux18
-rw-r--r--stdlib/source/specification/lux/world/shell.lux6
-rw-r--r--stdlib/source/test/aedifex/artifact/time/date.lux2
-rw-r--r--stdlib/source/test/aedifex/cli.lux8
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux2
-rw-r--r--stdlib/source/test/aedifex/command/build.lux10
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux4
-rw-r--r--stdlib/source/test/aedifex/dependency/deployment.lux2
-rw-r--r--stdlib/source/test/aedifex/dependency/resolution.lux8
-rw-r--r--stdlib/source/test/aedifex/dependency/status.lux2
-rw-r--r--stdlib/source/test/aedifex/hash.lux6
-rw-r--r--stdlib/source/test/aedifex/metadata/artifact.lux4
-rw-r--r--stdlib/source/test/aedifex/metadata/snapshot.lux4
-rw-r--r--stdlib/source/test/aedifex/package.lux10
-rw-r--r--stdlib/source/test/aedifex/parser.lux2
-rw-r--r--stdlib/source/test/aedifex/pom.lux4
-rw-r--r--stdlib/source/test/aedifex/project.lux4
-rw-r--r--stdlib/source/test/aedifex/repository.lux4
-rw-r--r--stdlib/source/test/aedifex/repository/local.lux2
-rw-r--r--stdlib/source/test/aedifex/repository/remote.lux6
-rw-r--r--stdlib/source/test/lux.lux60
-rw-r--r--stdlib/source/test/lux/abstract/apply.lux2
-rw-r--r--stdlib/source/test/lux/abstract/codec.lux2
-rw-r--r--stdlib/source/test/lux/abstract/enum.lux2
-rw-r--r--stdlib/source/test/lux/abstract/equivalence.lux8
-rw-r--r--stdlib/source/test/lux/abstract/functor.lux8
-rw-r--r--stdlib/source/test/lux/abstract/interval.lux8
-rw-r--r--stdlib/source/test/lux/abstract/monad/free.lux2
-rw-r--r--stdlib/source/test/lux/control/concatenative.lux8
-rw-r--r--stdlib/source/test/lux/control/concurrency/actor.lux12
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux8
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux12
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux10
-rw-r--r--stdlib/source/test/lux/control/continuation.lux2
-rw-r--r--stdlib/source/test/lux/control/exception.lux14
-rw-r--r--stdlib/source/test/lux/control/function/contract.lux4
-rw-r--r--stdlib/source/test/lux/control/function/memo.lux4
-rw-r--r--stdlib/source/test/lux/control/function/mixin.lux10
-rw-r--r--stdlib/source/test/lux/control/function/mutual.lux8
-rw-r--r--stdlib/source/test/lux/control/function/predicate.lux4
-rw-r--r--stdlib/source/test/lux/control/maybe.lux2
-rw-r--r--stdlib/source/test/lux/control/parser.lux12
-rw-r--r--stdlib/source/test/lux/control/pipe.lux13
-rw-r--r--stdlib/source/test/lux/control/region.lux6
-rw-r--r--stdlib/source/test/lux/control/remember.lux14
-rw-r--r--stdlib/source/test/lux/control/try.lux6
-rw-r--r--stdlib/source/test/lux/data/binary.lux24
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux20
-rw-r--r--stdlib/source/test/lux/data/collection/bits.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary.lux24
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/ordered.lux8
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux18
-rw-r--r--stdlib/source/test/lux/data/collection/queue.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/queue/priority.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/sequence.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/set/ordered.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/stack.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/tree.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/tree/finger.lux6
-rw-r--r--stdlib/source/test/lux/data/format/json.lux10
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux38
-rw-r--r--stdlib/source/test/lux/data/format/xml.lux2
-rw-r--r--stdlib/source/test/lux/data/sum.lux8
-rw-r--r--stdlib/source/test/lux/data/text.lux20
-rw-r--r--stdlib/source/test/lux/data/text/escape.lux10
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux12
-rw-r--r--stdlib/source/test/lux/debug.lux6
-rw-r--r--stdlib/source/test/lux/documentation.lux2
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux26
-rw-r--r--stdlib/source/test/lux/ffi.lua.lux2
-rw-r--r--stdlib/source/test/lux/ffi.old.lux12
-rw-r--r--stdlib/source/test/lux/math/logic/fuzzy.lux4
-rw-r--r--stdlib/source/test/lux/math/modular.lux6
-rw-r--r--stdlib/source/test/lux/math/modulus.lux6
-rw-r--r--stdlib/source/test/lux/math/number.lux6
-rw-r--r--stdlib/source/test/lux/math/number/i64.lux4
-rw-r--r--stdlib/source/test/lux/math/number/ratio.lux4
-rw-r--r--stdlib/source/test/lux/meta.lux10
-rw-r--r--stdlib/source/test/lux/meta/code.lux8
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux62
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux26
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux6
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux6
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux22
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux8
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux12
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux72
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux32
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux14
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux12
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux10
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/when.lux (renamed from stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/case.lux)64
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux10
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux2
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux22
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux8
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux14
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/when.lux (renamed from stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/case.lux)36
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux8
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux2
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/archive.lux2
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux10
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux12
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/cache.lux2
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/cache/module.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux2
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/cli.lux6
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/export.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/phase.lux20
-rw-r--r--stdlib/source/test/lux/meta/compiler/reference.lux8
-rw-r--r--stdlib/source/test/lux/meta/compiler/reference/variable.lux2
-rw-r--r--stdlib/source/test/lux/meta/configuration.lux4
-rw-r--r--stdlib/source/test/lux/meta/macro.lux10
-rw-r--r--stdlib/source/test/lux/meta/macro/local.lux2
-rw-r--r--stdlib/source/test/lux/meta/macro/pattern.lux18
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/check.lux2
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/declaration.lux2
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/definition.lux6
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/export.lux2
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/input.lux2
-rw-r--r--stdlib/source/test/lux/meta/macro/template.lux10
-rw-r--r--stdlib/source/test/lux/meta/static.lux8
-rw-r--r--stdlib/source/test/lux/meta/target/js.lux18
-rw-r--r--stdlib/source/test/lux/meta/target/jvm.lux12
-rw-r--r--stdlib/source/test/lux/meta/target/lua.lux12
-rw-r--r--stdlib/source/test/lux/meta/target/python.lux10
-rw-r--r--stdlib/source/test/lux/meta/target/ruby.lux10
-rw-r--r--stdlib/source/test/lux/meta/type.lux16
-rw-r--r--stdlib/source/test/lux/meta/type/check.lux48
-rw-r--r--stdlib/source/test/lux/meta/type/dynamic.lux6
-rw-r--r--stdlib/source/test/lux/meta/type/refinement.lux2
-rw-r--r--stdlib/source/test/lux/meta/type/resource.lux2
-rw-r--r--stdlib/source/test/lux/meta/version.lux2
-rw-r--r--stdlib/source/test/lux/program.lux4
-rw-r--r--stdlib/source/test/lux/world/environment.lux4
-rw-r--r--stdlib/source/test/lux/world/file.lux40
-rw-r--r--stdlib/source/test/lux/world/file/watch.lux12
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux4
-rw-r--r--stdlib/source/test/lux/world/shell.lux4
-rw-r--r--stdlib/source/test/lux/world/time.lux8
-rw-r--r--stdlib/source/test/lux/world/time/date.lux4
-rw-r--r--stdlib/source/test/lux/world/time/day.lux4
-rw-r--r--stdlib/source/test/lux/world/time/instant.lux2
-rw-r--r--stdlib/source/test/lux/world/time/month.lux4
-rw-r--r--stdlib/source/test/lux/world/time/year.lux6
-rw-r--r--stdlib/source/unsafe/lux/data/collection/array.lux6
498 files changed, 4975 insertions, 4811 deletions
diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux
index d4478b885..e721e69b1 100644
--- a/licentia/source/program/licentia.lux
+++ b/licentia/source/program/licentia.lux
@@ -76,7 +76,7 @@
(<json>.result /input.license)
(at ! each /output.license))))]
(at file.default write (at utf8.codec encoded document) output)))]
- (wrap (debug.log! (case ?done
+ (wrap (debug.log! (when ?done
{try.#Success _}
(success_message output)
diff --git a/licentia/source/program/licentia/output.lux b/licentia/source/program/licentia/output.lux
index 0f05937e2..30bdfaf5a 100644
--- a/licentia/source/program/licentia/output.lux
+++ b/licentia/source/program/licentia/output.lux
@@ -166,7 +166,7 @@
(def .public (extension value)
(-> Extension Text)
- (let [[show? document] (case (the license.#notification_period value)
+ (let [[show? document] (when (the license.#notification_period value)
{.#Some period}
[true (extension.notification_requirement period)]
@@ -194,14 +194,14 @@
(def .public (attribution value)
(-> Attribution Text)
(let [copyright_notice (format "Attribution Copyright Notice: " (the license.#copyright_notice value))
- phrase (case (the license.#phrase value)
+ phrase (when (the license.#phrase value)
{.#Some phrase}
(format text.new_line "Attribution Phrase: " phrase text.new_line)
{.#None}
"")
url (format text.new_line "Attribution URL: " (the license.#url value))
- image (case (the license.#image value)
+ image (when (the license.#image value)
{.#Some image}
(format text.new_line "Attribution Image: " image)
@@ -257,7 +257,7 @@
(the license.#identification)
(maybe#each ..identification)
(maybe.default ""))
- identified? (case (the license.#identification value)
+ identified? (when (the license.#identification value)
{.#Some _}
true
@@ -266,7 +266,7 @@
(`` (format ($.block identification)
($.block (notice.copyright (the license.#copyright_holders value)))
- (case (the license.#black_lists value)
+ (when (the license.#black_lists value)
{.#End}
""
diff --git a/licentia/source/test/licentia.lux b/licentia/source/test/licentia.lux
index 91121c9b1..4183dc564 100644
--- a/licentia/source/test/licentia.lux
+++ b/licentia/source/test/licentia.lux
@@ -229,7 +229,7 @@
(bit#= (the license.#must_be_distinguishable? extension)
(present? extension.distinctness_requirement)))
(_.test "The community must be notified of new extensions."
- (case (the license.#notification_period extension)
+ (when (the license.#notification_period extension)
{.#Some period}
(present? (extension.notification_requirement period))
@@ -298,7 +298,7 @@
(the license.#copyright_holders license)))
(_.test "Identification is present (if the license is identified)."
- (case (the license.#identification license)
+ (when (the license.#identification license)
{.#Some identification}
(and (present? (output.identification identification))
(present? miscellaneous.new_versions))
@@ -308,7 +308,7 @@
(_.test "Black-lists (if wanted by licensor) are explicitly enumerated and justified."
(list.every? (function (_ black_list)
- (let [black_list_is_justified? (case (the license.#justification black_list)
+ (let [black_list_is_justified? (when (the license.#justification black_list)
{.#Some justification}
(present? justification)
@@ -348,7 +348,7 @@
(..about_extension present? (the license.#extension license))
- (case (the license.#attribution license)
+ (when (the license.#attribution license)
{.#Some attribution}
(..about_attribution present? attribution)
diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux
index 04df3b86d..ff6aff2e5 100644
--- a/lux-cl/source/program.lux
+++ b/lux-cl/source/program.lux
@@ -164,7 +164,7 @@
(def host_bit
(-> Bit org/armedbear/lisp/LispObject)
- (|>> (pipe.case #0 (org/armedbear/lisp/Nil::NIL)
+ (|>> (pipe.when #0 (org/armedbear/lisp/Nil::NIL)
#1 (org/armedbear/lisp/Symbol::T))))
(def (host_value value)
@@ -173,7 +173,7 @@
(function (_ sub_value)
(let [sub_value (as java/lang/Object sub_value)]
(`` (<| (,, (with_template [<type> <then>]
- [(case (ffi.is <type> sub_value)
+ [(when (ffi.is <type> sub_value)
{.#Some sub_value}
(`` (|> sub_value (,, (template.splice <then>))))
@@ -208,7 +208,7 @@
[(org/armedbear/lisp/LispObject
[] (<name> self [idx int])
org/armedbear/lisp/LispObject
- (case (array.read! (|> idx java/lang/Integer::longValue (as Nat))
+ (when (array.read! (|> idx java/lang/Integer::longValue (as Nat))
(as (Array java/lang/Object) value))
{.#Some sub}
(to_sub sub)
@@ -229,7 +229,7 @@
[tag (read (org/armedbear/lisp/LispObject::NTH +0 host_object))
value (read (org/armedbear/lisp/LispObject::NTH +2 host_object))]
(wrap [(java/lang/Long::intValue (as java/lang/Long tag))
- (case (ffi.is org/armedbear/lisp/Nil (org/armedbear/lisp/LispObject::NTH +1 host_object))
+ (when (ffi.is org/armedbear/lisp/Nil (org/armedbear/lisp/LispObject::NTH +1 host_object))
{.#Some _}
(is Any (ffi.null))
@@ -244,7 +244,7 @@
output (as (Array Any) (array.new size))])
(if (n.< size idx)
... TODO: Start using "SVREF" instead of "elt" ASAP
- (case (read (org/armedbear/lisp/LispObject::elt (.int idx) host_object))
+ (when (read (org/armedbear/lisp/LispObject::elt (.int idx) host_object))
{try.#Failure error}
{try.#Failure error}
@@ -255,7 +255,7 @@
(def (read host_object)
(Reader org/armedbear/lisp/LispObject)
(`` (<| (,, (with_template [<class> <post_processing>]
- [(case (ffi.is <class> host_object)
+ [(when (ffi.is <class> host_object)
{.#Some host_object}
(`` (|> host_object (,, (template.splice <post_processing>))))
@@ -270,7 +270,7 @@
[org/armedbear/lisp/Nil [(pipe.new {try.#Success false} [])]]
[org/armedbear/lisp/Closure [{try.#Success}]]
[program/LuxADT [program/LuxADT::getValue {try.#Success}]]))
- (case (ffi.is org/armedbear/lisp/Symbol host_object)
+ (when (ffi.is org/armedbear/lisp/Symbol host_object)
{.#Some host_object}
(if (same? (org/armedbear/lisp/Symbol::T) host_object)
{try.#Success true}
@@ -294,7 +294,7 @@
(def (expander macro inputs lux)
Expander
- (case (ensure_macro macro)
+ (when (ensure_macro macro)
{.#Some macro}
(call_macro inputs lux macro)
diff --git a/lux-js/commands.md b/lux-js/commands.md
index a71f5e2e8..0c724a3b5 100644
--- a/lux-js/commands.md
+++ b/lux-js/commands.md
@@ -10,8 +10,7 @@ cd ~/lux/lux-js/ \
```
cd ~/lux/lux-js/ \
&& lux clean \
-&& lux with js build \
-&& mv target/program.js lux.js
+&& lux with js auto build
## Build JVM-based compiler
cd ~/lux/lux-js/ \
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index b7053d6e9..233db1518 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -71,7 +71,7 @@
["/" compositor]])
(exception (null_has_no_lux_representation [code (Maybe _.Expression)])
- (case code
+ (when code
{.#Some code}
(_.code code)
@@ -176,7 +176,7 @@
(ffi.is java/lang/Object (ffi.as_long value)))
(org/openjdk/nashorn/api/scripting/AbstractJSObject
[] (getMember self [member java/lang/String]) java/lang/Object
- (case (ffi.of_string member)
+ (when (ffi.of_string member)
runtime.i64_high_field
(|> value
.nat
@@ -242,14 +242,14 @@
(-> (Array java/lang/Object) org/openjdk/nashorn/api/scripting/JSObject)
(let [js_object (is (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject)
(function (_ sub_value)
- (<| (case (ffi.as [java/lang/Object] sub_value)
+ (<| (when (ffi.as [java/lang/Object] sub_value)
{.#Some sub_value}
(|> sub_value
(as (Array java/lang/Object))
js_structure)
{.#None})
- (case (ffi.as java/lang/Long sub_value)
+ (when (ffi.as java/lang/Long sub_value)
{.#Some sub_value}
(|> sub_value
ffi.of_long
@@ -273,7 +273,7 @@
(org/openjdk/nashorn/api/scripting/AbstractJSObject
[] (getMember self [member java/lang/String])
java/lang/Object
- (case (ffi.of_string member)
+ (when (ffi.of_string member)
(^.or "toJSON" "toString")
(|> (::toString value)
(ffi.is java/lang/Object))
@@ -294,7 +294,7 @@
maybe.trusted)
runtime.variant_flag_field
- (case (array.item 1 value)
+ (when (array.item 1 value)
{.#Some set!}
set!
@@ -326,7 +326,7 @@
(exception.report
(list ["Class" (ffi.of_string (java/lang/Object::toString (java/lang/Object::getClass object)))]
["Object" (ffi.of_string (java/lang/Object::toString object))]
- ["Keys" (case (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror object)
+ ["Keys" (when (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror object)
{.#Some object}
(|> object
(org/openjdk/nashorn/api/scripting/ScriptObjectMirror::getOwnKeys true)
@@ -347,7 +347,7 @@
(def (check_int js_object)
(-> org/openjdk/nashorn/api/scripting/ScriptObjectMirror
(Maybe Int))
- (case [(..i32 runtime.i64_high_field js_object)
+ (when [(..i32 runtime.i64_high_field js_object)
(..i32 runtime.i64_low_field js_object)]
[{.#Some high} {.#Some low}]
{.#Some (.int (n.+ (|> high .nat (i64.left_shifted 32))
@@ -362,7 +362,7 @@
(-> (-> java/lang/Object (Try Any))
org/openjdk/nashorn/api/scripting/ScriptObjectMirror
(Maybe Any))
- (case [(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_tag_field)] js_object)
+ (when [(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_tag_field)] js_object)
(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_flag_field)] js_object)
(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_value_field)] js_object)]
(^.multi [{.#Some tag} ?flag {.#Some value}]
@@ -385,14 +385,14 @@
output (is (Array java/lang/Object)
(array.empty num_keys))])
(if (n.< num_keys idx)
- (case (org/openjdk/nashorn/api/scripting/JSObject::getMember (ffi.as_string (%.nat idx)) js_object)
+ (when (org/openjdk/nashorn/api/scripting/JSObject::getMember (ffi.as_string (%.nat idx)) js_object)
{.#Some member}
- (case (ffi.as org/openjdk/nashorn/internal/runtime/Undefined member)
+ (when (ffi.as org/openjdk/nashorn/internal/runtime/Undefined member)
{.#Some _}
(again (++ idx) output)
{.#None}
- (case (lux_object member)
+ (when (lux_object member)
{try.#Success parsed_member}
(again (++ idx) (array.has! idx (as java/lang/Object parsed_member) output))
@@ -408,13 +408,13 @@
(-> java/lang/Object (Try Any))
(`` (<| (if (ffi.null? js_object)
(exception.except ..null_has_no_lux_representation [{.#None}]))
- (case (ffi.as org/openjdk/nashorn/internal/runtime/Undefined js_object)
+ (when (ffi.as org/openjdk/nashorn/internal/runtime/Undefined js_object)
{.#Some _}
(exception.except ..undefined_has_no_lux_representation [])
{.#None})
(,, (with_template [<class>]
- [(case (ffi.as <class> js_object)
+ [(when (ffi.as <class> js_object)
{.#Some js_object}
{try.#Success js_object}
@@ -422,7 +422,7 @@
[java/lang/Boolean] [java/lang/String]))
(,, (with_template [<class> <method>]
- [(case (ffi.as <class> js_object)
+ [(when (ffi.as <class> js_object)
{.#Some js_object}
{try.#Success (<method> js_object)}
@@ -431,19 +431,19 @@
[java/lang/Number java/lang/Number::doubleValue]
[StructureValue StructureValue::getValue]
[IntValue IntValue::getValue]))
- (case (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object)
+ (when (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object)
{.#Some js_object}
- (case (check_int js_object)
+ (when (check_int js_object)
{.#Some value}
{try.#Success value}
{.#None}
- (case (check_variant lux_object js_object)
+ (when (check_variant lux_object js_object)
{.#Some value}
{try.#Success value}
{.#None}
- (case (check_tuple lux_object js_object)
+ (when (check_tuple lux_object js_object)
{.#Some value}
{try.#Success value}
@@ -492,9 +492,9 @@
(def (expander macro inputs lux)
Expander
- (case (..ensure_function macro)
+ (when (..ensure_function macro)
{.#Some macro}
- (case (call_macro inputs lux macro)
+ (when (call_macro inputs lux macro)
{try.#Success output}
(|> output
(as java/lang/Object)
@@ -519,7 +519,7 @@
(-> javax/script/ScriptEngine unit.ID _.Expression (Try Any))
(do try.monad
[?output (javax/script/ScriptEngine::eval (ffi.as_string (_.code input)) interpreter)]
- (case ?output
+ (when ?output
{.#Some output}
(..lux_object output)
@@ -580,7 +580,7 @@
(-> unit.ID _.Expression (Try Any))
(do try.monad
[?output (..eval (_.code input))]
- (case ?output
+ (when ?output
{.#Some output}
(in output)
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index a98f18507..3292b7feb 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -185,7 +185,7 @@
(def (read_variant read host_object)
(-> Translator net/sandius/rembulan/impl/DefaultTable (Try Any))
- (case [(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_tag_field) host_object)
+ (when [(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_tag_field) host_object)
(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_flag_field) host_object)
(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_value_field) host_object)]
(^.multi [{.#Some tag} ?flag {.#Some value}]
@@ -196,7 +196,7 @@
ffi.as_long
java/lang/Long::intValue
(is java/lang/Integer)))
- (is Any (case ?flag
+ (is Any (when ?flag
{.#Some _} (is Any "")
{.#None} (as Any (ffi.null))))
(is Any value)]}
@@ -212,12 +212,12 @@
output (is (Array java/lang/Object)
(array.empty init_num_keys))])
(if (n.< num_keys idx)
- (case (net/sandius/rembulan/Table::get_idx (ffi.as_long (.int (++ idx))) host_object)
+ (when (net/sandius/rembulan/Table::get_idx (ffi.as_long (.int (++ idx))) host_object)
{.#None}
(again num_keys (++ idx) output)
{.#Some member}
- (case (read member)
+ (when (read member)
{try.#Success parsed_member}
(again num_keys (++ idx) (array.has! idx (as java/lang/Object parsed_member) output))
@@ -232,7 +232,7 @@
(`` (<| (if (ffi.null? host_object)
(exception.except ..nil_has_no_lux_representation []))
(,, (with_template [<class> <post_processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some typed_object}
(|> typed_object <post_processing>)
@@ -246,9 +246,9 @@
[net/sandius/rembulan/ByteString (<| {try.#Success} net/sandius/rembulan/ByteString::decode)]
[net/sandius/rembulan/runtime/LuaFunction {try.#Success}]
))
- (case (ffi.as net/sandius/rembulan/impl/DefaultTable host_object)
+ (when (ffi.as net/sandius/rembulan/impl/DefaultTable host_object)
{.#Some typed_object}
- (case (read_variant read typed_object)
+ (when (read_variant read typed_object)
{try.#Failure error}
(read_tuple read typed_object)
@@ -296,7 +296,7 @@
[input/* (monad.each ! ..read parameters)]
(loop (again [lux_function abstraction
input/* input/*])
- (`` (`` (case input/*
+ (`` (`` (when input/*
(list)
(in self)
@@ -395,11 +395,11 @@
(net/sandius/rembulan/impl/DefaultTable
[] (rawget self [field java/lang/Object])
java/lang/Object
- (case (ffi.as net/sandius/rembulan/ByteString field)
+ (when (ffi.as net/sandius/rembulan/ByteString field)
{.#Some field}
- (case (ffi.of_string (net/sandius/rembulan/ByteString::decode field))
+ (when (ffi.of_string (net/sandius/rembulan/ByteString::decode field))
runtime.variant_tag_field
- (case (array.item 0 value)
+ (when (array.item 0 value)
{.#Some it}
(|> it
(as java/lang/Integer)
@@ -409,7 +409,7 @@
(undefined))
runtime.variant_flag_field
- (case (array.item 1 value)
+ (when (array.item 1 value)
{.#Some _}
(as java/lang/Object "")
@@ -433,9 +433,9 @@
(panic! (exception.error ..unknown_kind_of_object [(as java/lang/Object field)])))
{.#None}
- (case (ffi.as java/lang/Long field)
+ (when (ffi.as java/lang/Long field)
{.#Some idx}
- (case (array.item (|> idx ffi.of_long .nat --) value)
+ (when (array.item (|> idx ffi.of_long .nat --) value)
{.#Some it}
(to_host it)
@@ -479,9 +479,9 @@
(def (expander to_host baggage macro inputs lux)
(-> (-> Any java/lang/Object) Baggage Expander)
- (case (..ensure_function macro)
+ (when (..ensure_function macro)
{.#Some macro}
- (case (..call_macro to_host baggage inputs lux macro)
+ (when (..call_macro to_host baggage inputs lux macro)
{try.#Success output}
(|> output
(as (Try [Lux (List Code)]))
@@ -530,10 +530,10 @@
(all _.then
(_.when (_.or (_.< (_.int +0) $v)
(_.> (!int "10FFFF") $v))
- (_.statement (_.error/2 (|> (_.string "bad argument #")
- (_.concat $k)
- (_.concat (_.string " to char (out of range)")))
- (_.int +2))))
+ (_.statement (_.error/2 (|> (_.string "bad argument #")
+ (_.concat $k)
+ (_.concat (_.string " to char (out of range)")))
+ (_.int +2))))
(<| (_.if (_.< (!int "80") $v)
... Single-byte sequence
(_.statement (|> (_.var "string.char")
@@ -702,7 +702,7 @@
[lua_function (net/sandius/rembulan/load/ChunkLoader::loadTextChunk variable (ffi.as_string "lux compilation") (ffi.as_string (_.code code)) loader)
output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (as java/lang/Object lua_function) (array.empty 0)
executor)]
- (case (array.item 0 output)
+ (when (array.item 0 output)
{.#None}
(in [])
@@ -784,7 +784,7 @@
(with_expansions [<jvm> (these (def (to_host it)
(-> Any java/lang/Object)
(`` (<| (,, (with_template [<jvm> <lua>]
- [(case (ffi.as <jvm> (as java/lang/Object it))
+ [(when (ffi.as <jvm> (as java/lang/Object it))
{.#Some it}
(as java/lang/Object
(<lua> [(as_expected it)]))
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el
index b7329e753..9e0d6b8d2 100644
--- a/lux-mode/lux-mode.el
+++ b/lux-mode/lux-mode.el
@@ -361,7 +361,7 @@ Called by `imenu--generic-function'."
(int&fracRE (literal (concat integer "\\(\\." natural "\\(\\(e\\|E\\)" integer "\\)?\\)?")))
(revRE (literal (concat "\\." natural)))
(specialRE (let (;; Control
- (control//flow (altRE "case" "exec" "let" "if" "cond" "loop" "do" "be"))
+ (control//flow (altRE "when" "exec" "let" "if" "cond" "loop" "do" "be"))
(control//pattern-matching (altRE "open"))
(control//logic (altRE "and" "or"))
(control//contract (altRE "pre" "post"))
@@ -610,7 +610,7 @@ This function also returns nil meaning don't specify the indentation."
("capability" 'defun)
(let 'defun)
- (case 'defun)
+ (when 'defun)
(do 'defun)
(exec 'defun)
(be 'defun)
diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux
index 73c278858..47edfa25c 100644
--- a/lux-php/source/program.lux
+++ b/lux-php/source/program.lux
@@ -1,64 +1,65 @@
(.require
- [lux (.except)
- [program (.only program)]
- ["[0]" ffi]
- ["[0]" debug]
- [abstract
- ["[0]" monad (.only do)]]
- [control
- ["[0]" pipe]
- ["[0]" maybe]
- ["[0]" try (.only Try)]
- ["[0]" exception (.only exception)]
- ["[0]" io (.only IO io)]
- [concurrency
- ["[0]" promise (.only Promise)]]]
- [data
- ["[0]" text (.use "[1]#[0]" hash)
- ["%" \\format (.only format)]
- [encoding
- ["[0]" utf8]]]
- [collection
- ["[0]" array (.only Array)]]]
- [macro
- ["[0]" template]]
- [math
- [number (.only hex)
- ["n" nat]
- ["[0]" i64]]]
- ["[0]" world
- ["[0]" file]
- ["[1]/[0]" program]]
- ["@" target
- ["_" php]]
- [meta
- [compiler
- [phase (.only Operation Phase)]
- [reference
- [variable (.only Register)]]
- [language
- [lux
- [program (.only Program)]
- [generation (.only Context Host)]
- ["[0]" synthesis]
- [analysis
- [macro (.only Expander)]]
- [phase
- ["[0]" extension (.only Extender Handler)
- ["[1]/[0]" bundle]
- ["[0]" analysis
- ["[1]" php]]
- ["[0]" generation
- ["[1]" php]]]
- [generation
- ["[0]" reference]
- ["[0]" php
- ["[0]" runtime]]]]]]
- [default
- ["[0]" platform (.only Platform)]]
- [meta
- ["[0]" packager
- ["[1]" script]]]]]]
+ [library
+ [lux (.except)
+ [program (.only program)]
+ ["[0]" ffi]
+ ["[0]" debug]
+ [abstract
+ ["[0]" monad (.only do)]]
+ [control
+ ["[0]" pipe]
+ ["[0]" maybe]
+ ["[0]" try (.only Try)]
+ ["[0]" exception (.only exception)]
+ ["[0]" io (.only IO io)]
+ [concurrency
+ ["[0]" promise (.only Promise)]]]
+ [data
+ ["[0]" text (.use "[1]#[0]" hash)
+ ["%" \\format (.only format)]
+ [encoding
+ ["[0]" utf8]]]
+ [collection
+ ["[0]" array (.only Array)]]]
+ [macro
+ ["[0]" template]]
+ [math
+ [number (.only hex)
+ ["n" nat]
+ ["[0]" i64]]]
+ ["[0]" world
+ ["[0]" file]
+ ["[1]/[0]" program]]
+ ["@" target
+ ["_" php]]
+ [meta
+ [compiler
+ [phase (.only Operation Phase)]
+ [reference
+ [variable (.only Register)]]
+ [language
+ [lux
+ [program (.only Program)]
+ [generation (.only Context Host)]
+ ["[0]" synthesis]
+ [analysis
+ [macro (.only Expander)]]
+ [phase
+ ["[0]" extension (.only Extender Handler)
+ ["[1]/[0]" bundle]
+ ["[0]" analysis
+ ["[1]" php]]
+ ["[0]" generation
+ ["[1]" php]]]
+ [generation
+ ["[0]" reference]
+ ["[0]" php
+ ["[0]" runtime]]]]]]
+ [default
+ ["[0]" platform (.only Platform)]]
+ [meta
+ ["[0]" packager
+ ["[1]" script]]]]]]]
[program
["/" compositor
["[1][0]" cli]
@@ -189,34 +190,34 @@
(-> (-> (Array java/lang/Object) php/runtime/Memory) java/lang/Object php/runtime/Memory)
(<| (if (ffi.null? value)
(php/runtime/memory/NullMemory::INSTANCE))
- (case (ffi.as java/lang/Boolean value)
+ (when (ffi.as java/lang/Boolean value)
{.#Some value}
(if (as Bit value)
(php/runtime/memory/TrueMemory::INSTANCE)
(php/runtime/memory/FalseMemory::INSTANCE))
{.#None})
- (case (ffi.as java/lang/Long value)
+ (when (ffi.as java/lang/Long value)
{.#Some value}
(php/runtime/memory/LongMemory::new value)
{.#None})
- (case (ffi.as java/lang/Double value)
+ (when (ffi.as java/lang/Double value)
{.#Some value}
(php/runtime/memory/DoubleMemory::new value)
{.#None})
- (case (ffi.as java/lang/String value)
+ (when (ffi.as java/lang/String value)
{.#Some value}
(php/runtime/memory/StringMemory::new value)
{.#None})
- (case (ffi.as [java/lang/Object] value)
+ (when (ffi.as [java/lang/Object] value)
{.#Some value}
(lux_structure (as (Array java/lang/Object) value))
{.#None})
- (case (ffi.as php/runtime/memory/ObjectMemory value)
+ (when (ffi.as php/runtime/memory/ObjectMemory value)
{.#Some value}
value
@@ -247,7 +248,7 @@
index php/runtime/Memory])
php/runtime/Memory
(`` (<| (,, (with_template [<class> <method> <extractor>]
- [(case (ffi.as <class> index)
+ [(when (ffi.as <class> index)
{.#Some index}
(<method> trace (<extractor> index) self)
@@ -278,7 +279,7 @@
[] (valueOfIndex self [trace php/runtime/env/TraceInfo
index java/lang/String])
php/runtime/Memory
- (case (as Text index)
+ (when (as Text index)
runtime.variant_tag_field
(|> value
(array.read! 0)
@@ -287,7 +288,7 @@
php/runtime/memory/LongMemory::valueOf)
runtime.variant_flag_field
- (case (array.read! 1 value)
+ (when (array.read! 1 value)
{.#None}
(php/runtime/memory/NullMemory::INSTANCE)
@@ -321,12 +322,12 @@
maybe.trusted
(as php/runtime/memory/ReferenceMemory)
php/runtime/memory/ReferenceMemory::getValue)]
- (case (ffi.as php/runtime/memory/NullMemory value)
+ (when (ffi.as php/runtime/memory/NullMemory value)
{.#Some _}
(again (++ idx) output)
{.#None}
- (case (read value)
+ (when (read value)
{try.#Success lux_value}
(again (++ idx) (array.write! idx lux_value output))
@@ -345,7 +346,7 @@
(def (read_variant read host_object)
(-> Reader php/runtime/memory/ArrayMemory (Try Any))
- (case [(|> host_object
+ (when [(|> host_object
(php/runtime/memory/ArrayMemory::get ..variant_tag_field)
maybe.trusted
read)
@@ -356,7 +357,7 @@
[{try.#Success tag} {try.#Success value}]
{try.#Success [(java/lang/Long::intValue (as java/lang/Long tag))
(is Any
- (case (|> host_object
+ (when (|> host_object
(php/runtime/memory/ArrayMemory::get ..variant_flag_field)
maybe.trusted
(as php/runtime/memory/ReferenceMemory)
@@ -380,7 +381,7 @@
(def (read host_object)
Reader
(`` (<| (,, (with_template [<class> <constant>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some _}
{try.#Success <constant>}
@@ -390,7 +391,7 @@
[php/runtime/memory/TrueMemory true]
))
(,, (with_template [<class> <post>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some value}
(`` (|> value (,, (template.splice <post>))))
@@ -403,11 +404,11 @@
[php/runtime/memory/ReferenceMemory [php/runtime/memory/ReferenceMemory::getValue read]]
[php/runtime/memory/ObjectMemory [{try.#Success}]]
))
- (case (ffi.as php/runtime/memory/ArrayMemory host_object)
+ (when (ffi.as php/runtime/memory/ArrayMemory host_object)
{.#Some value}
(if (|> value
(php/runtime/memory/ArrayMemory::get ..tuple_size_field)
- (pipe.case {.#Some _} false {.#None} true))
+ (pipe.when {.#Some _} false {.#None} true))
(read_variant read value)
(read_tuple read value))
@@ -461,7 +462,7 @@
(def (expander macro inputs lux)
Expander
- (case (ensure_macro macro)
+ (when (ensure_macro macro)
{.#Some macro}
(call_macro inputs lux macro)
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index 8cbe4e0e4..389e8251a 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -154,9 +154,9 @@
output (as (Array Any)
(array.empty size))])
(if (n.< size idx)
- (case (org/python/core/PyObject::__getitem__ (ffi.as_int (.int idx)) host_object)
+ (when (org/python/core/PyObject::__getitem__ (ffi.as_int (.int idx)) host_object)
{try.#Success value}
- (case (read value)
+ (when (read value)
{try.#Success lux_value}
(again (++ idx) (array.has! idx lux_value output))
@@ -173,7 +173,7 @@
(def (read_variant read host_object)
(-> Translator Translator)
- (case [(org/python/core/PyObject::__getitem__ (ffi.as_int +0) host_object)
+ (when [(org/python/core/PyObject::__getitem__ (ffi.as_int +0) host_object)
(org/python/core/PyObject::__getitem__ (ffi.as_int +1) host_object)
(org/python/core/PyObject::__getitem__ (ffi.as_int +2) host_object)]
(^.or [{try.#Failure try} _ _]
@@ -188,7 +188,7 @@
{try.#Success value}])
{try.#Success [tag
(is Any
- (case (ffi.as org/python/core/PyNone
+ (when (ffi.as org/python/core/PyNone
(as java/lang/Object flag))
{.#Some _}
(as Any (ffi.null))
@@ -210,7 +210,7 @@
(def (read host_object)
Translator
(`` (<| (,, (with_template [<class> <processing>]
- [(case (ffi.as <class> (as <class> host_object))
+ [(when (ffi.as <class> (as <class> host_object))
{.#Some host_object}
{try.#Success (`` (|> host_object (,, (template.spliced <processing>))))}
@@ -232,7 +232,7 @@
[[java/lang/Object] [(|>)]]
))
(,, (with_template [<class> <processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
(<| <processing> (as org/python/core/PyObject) host_object)
@@ -270,7 +270,7 @@
[inputs (monad.each ! ..read (array.list {.#None} inputs))]
(in (loop (again [it it
inputs inputs])
- (`` (`` (case inputs
+ (`` (`` (when inputs
(list)
(as org/python/core/PyObject self)
@@ -316,19 +316,19 @@
(org/python/core/PyArray
[] (pyget self [index' int])
org/python/core/PyObject
- (case (|> it
+ (when (|> it
(as (Array Any))
(array.item (|> index' ffi.int_to_long (as Nat))))
{.#None}
(ffi.super [index'] self)
{.#Some it}
- (<| (case (ffi.as [java/lang/Object] (as java/lang/Object it))
+ (<| (when (ffi.as [java/lang/Object] (as java/lang/Object it))
{.#Some it}
(to_host it)
{.#None})
- (case (ffi.as library/lux/Function (as java/lang/Object it))
+ (when (ffi.as library/lux/Function (as java/lang/Object it))
{.#Some it}
(pseudo_function to_host it)
@@ -339,7 +339,7 @@
(def (to_host it)
(-> Any org/python/core/PyObject)
(`` (<| (,, (with_template [<jvm> <python>]
- [(case (ffi.as <jvm> (as java/lang/Object it))
+ [(when (ffi.as <jvm> (as java/lang/Object it))
{.#Some it}
(as org/python/core/PyObject
(<python> [it]))
@@ -381,9 +381,9 @@
(def (expander macro inputs lux)
Expander
- (case (python_function! macro)
+ (when (python_function! macro)
{.#Some macro}
- (case (..call_macro inputs lux macro)
+ (when (..call_macro inputs lux macro)
{try.#Success output}
(|> output
(as org/python/core/PyObject)
@@ -413,7 +413,7 @@
(..read output))))
execute! (is (-> (_.Statement Any) (Try Any))
(function (execute! input)
- (case (org/python/util/PythonInterpreter::exec (ffi.as_string (_.code input)) interpreter)
+ (when (org/python/util/PythonInterpreter::exec (ffi.as_string (_.code input)) interpreter)
{try.#Failure error}
(if (text.contains? "maximum recursion depth exceeded" error)
(execute! input)
@@ -544,13 +544,13 @@
(all _.then
(_.import "sys")
(_.when (_.= (_.string "__main__") (_.var "__name__"))
- (_.statement (_.apply (list (|> (_.var "sys") (_.the "argv")
- ... The first entry in the list will be the program.py file itself
- ... so, it must be removed so only the program's arguments are left.
- (_.slice_from (_.int +1))
- runtime.lux::program_args)
- _.none)
- program)))))
+ (_.statement (_.apply (list (|> (_.var "sys") (_.the "argv")
+ ... The first entry in the list will be the program.py file itself
+ ... so, it must be removed so only the program's arguments are left.
+ (_.slice_from (_.int +1))
+ runtime.lux::program_args)
+ _.none)
+ program)))))
(def (declare_success! _)
(-> Any (Async Any))
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux
index 68f8ef9c8..ab60ff510 100644
--- a/lux-r/source/program.lux
+++ b/lux-r/source/program.lux
@@ -182,7 +182,7 @@
... (def host_bit
... (-> Bit org/armedbear/lisp/LispObject)
-... (|>> (pipe.case #0 (org/armedbear/lisp/Nil::NIL)
+... (|>> (pipe.when #0 (org/armedbear/lisp/Nil::NIL)
... #1 (org/armedbear/lisp/Symbol::T))))
(def %%code
@@ -195,7 +195,7 @@
... (function (_ sub_value)
... (let [sub_value (as java/lang/Object sub_value)]
... (`` (<| (,, (with_template [<type> <then>]
- ... [(case (ffi.as <type> sub_value)
+ ... [(when (ffi.as <type> sub_value)
... {.#Some sub_value}
... (`` (|> sub_value (,, (template.splice <then>))))
... {.#None})]
@@ -367,7 +367,7 @@
(as java/lang/Object)
read)]
(wrap [(|> tag (as java/lang/Long) java/lang/Long::intValue)
- (case (|> host_object
+ (when (|> host_object
(org/renjin/sexp/ListVector::get_field runtime.variant_flag_field)
(ffi.as org/renjin/sexp/Null))
{.#Some _}
@@ -379,7 +379,7 @@
(def (read_i64 host_object)
(Reader org/renjin/sexp/ListVector)
- (case [(|> host_object
+ (when [(|> host_object
(org/renjin/sexp/ListVector::get_field runtime.i64_high_field)
(ffi.as org/renjin/sexp/IntArrayVector))
(|> host_object
@@ -398,7 +398,7 @@
(loop (again [idx 0
output (as (Array Any) (array.new size))])
(if (n.< size idx)
- (case (|> host_object (org/renjin/sexp/ListVector::get_index (.int idx)) (as java/lang/Object) read)
+ (when (|> host_object (org/renjin/sexp/ListVector::get_index (.int idx)) (as java/lang/Object) read)
{try.#Failure error}
{try.#Failure error}
@@ -418,14 +418,14 @@
(Reader java/lang/Object)
(exec
... (debug.log! (exception.construct ..unknown_kind_of_object [host_object]))
- (`` (<| (case (ffi.as org/renjin/sexp/ListVector host_object)
+ (`` (<| (when (ffi.as org/renjin/sexp/ListVector host_object)
{.#Some host_object}
- (<| (case (..read_variant read host_object)
+ (<| (when (..read_variant read host_object)
{try.#Success output}
{try.#Success output}
{try.#Failure _})
- (case (..read_i64 host_object)
+ (when (..read_i64 host_object)
{try.#Success output}
{try.#Success output}
@@ -434,7 +434,7 @@
{.#None})
(,, (with_template [<class> <post_processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
(`` (|> host_object (,, (template.splice <post_processing>))))
@@ -461,7 +461,7 @@
(-> org/renjin/script/RenjinScriptEngine (List Code) Lux org/renjin/sexp/Closure (Try (Try [Lux (List Code)])))
(let [_ (debug.log! "@call_macro 0")
r_inputs (is org/renjin/sexp/PairList
- (case (ffi.try (|> (org/renjin/sexp/PairList$Builder::new)
+ (when (ffi.try (|> (org/renjin/sexp/PairList$Builder::new)
(org/renjin/sexp/PairList$Builder::add (..host_value inputs))
(org/renjin/sexp/PairList$Builder::add (..host_value lux))
org/renjin/sexp/PairList$Builder::build
@@ -488,7 +488,7 @@
(def (expander interpreter macro inputs lux)
(-> org/renjin/script/RenjinScriptEngine Expander)
- (case (ensure_macro macro)
+ (when (ensure_macro macro)
{.#Some macro}
(call_macro interpreter inputs lux macro)
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 6c541c74c..534b78e34 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -238,12 +238,12 @@
output (is (Array Any)
(array.empty size))])
(if (n.< size idx)
- (case (org/jruby/RubyArray::get (ffi.as_int (.int idx)) host_object)
+ (when (org/jruby/RubyArray::get (ffi.as_int (.int idx)) host_object)
{.#None}
(again (++ idx) output)
{.#Some value}
- (case (read value)
+ (when (read value)
{try.#Success lux_value}
(again (++ idx) (array.has! idx lux_value output))
@@ -258,7 +258,7 @@
(def (read_variant read host_object)
(-> Translator org/jruby/RubyHash (Try Any))
- (case [(org/jruby/RubyHash::get (ffi.as_string runtime.variant_tag_field) host_object)
+ (when [(org/jruby/RubyHash::get (ffi.as_string runtime.variant_tag_field) host_object)
(org/jruby/RubyHash::get (ffi.as_string runtime.variant_flag_field) host_object)
(org/jruby/RubyHash::get (ffi.as_string runtime.variant_value_field) host_object)]
[{.#Some tag} ?flag {.#Some value}]
@@ -269,7 +269,7 @@
java/lang/Long::intValue
(is java/lang/Integer)))
(is Any
- (case ?flag
+ (when ?flag
{.#Some _}
""
@@ -287,7 +287,7 @@
(`` (<| (if (ffi.null? host_object)
(exception.except ..nil_has_no_lux_representation []))
(,, (with_template [<class> <post_processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some typed_object}
(`` (|> typed_object (,, (template.spliced <post_processing>))))
@@ -327,7 +327,7 @@
(-> java/lang/Object org/jruby/runtime/builtin/IRubyObject))
(function (again value)
(`` (<| (,, (with_template [<when> <then>]
- [(case (ffi.as <when> value)
+ [(when (ffi.as <when> value)
{.#Some value}
(|> value
<then>
@@ -401,7 +401,7 @@
(list#each (function (_ index)
(ffi.read! index args)))
(monad.each ! (|>> (ffi.is java/lang/Object) ..read)))
- output (case args
+ output (when args
(list arg/0)
(in ((as (-> Any java/lang/Object) value)
arg/0))
@@ -462,9 +462,9 @@
block org/jruby/runtime/Block])
org/jruby/runtime/builtin/IRubyObject
(let [member (ffi.read! 0 args)]
- (<| (case (ffi.as org/jruby/RubyFixnum member)
+ (<| (when (ffi.as org/jruby/RubyFixnum member)
{.#Some member}
- (case (array.item (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value)
+ (when (array.item (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value)
{.#Some value}
(wrapped_lux_value (as_expected useful_object_class) lux_structure value)
@@ -472,9 +472,9 @@
..ruby_nil)
{.#None})
- (case (ffi.as org/jruby/RubyString member)
+ (when (ffi.as org/jruby/RubyString member)
{.#Some member}
- (case (ffi.of_string (org/jruby/RubyString::asJavaString member))
+ (when (ffi.of_string (org/jruby/RubyString::asJavaString member))
runtime.variant_tag_field
(|> value
(array.item 0)
@@ -485,7 +485,7 @@
(ffi.is org/jruby/runtime/builtin/IRubyObject))
runtime.variant_flag_field
- (case (array.item 1 value)
+ (when (array.item 1 value)
{.#None}
..ruby_nil
@@ -493,7 +493,7 @@
..lux_unit)
runtime.variant_value_field
- (case (array.item 2 value)
+ (when (array.item 2 value)
{.#Some value}
(wrapped_lux_value (as_expected useful_object_class) lux_structure value)
@@ -504,9 +504,9 @@
(panic! (exception.error ..invalid_variant_access [field])))
{.#None})
- (case (ffi.as org/jruby/RubyRange member)
+ (when (ffi.as org/jruby/RubyRange member)
{.#Some member}
- (case [(|> member (org/jruby/RubyRange::first thread_context) (ffi.as org/jruby/RubyFixnum))
+ (when [(|> member (org/jruby/RubyRange::first thread_context) (ffi.as org/jruby/RubyFixnum))
(|> member (org/jruby/RubyRange::size thread_context) (ffi.as org/jruby/RubyFixnum))]
[{.#Some first} {.#Some size}]
(let [first (ffi.of_long (org/jruby/RubyFixnum::getLongValue first))
@@ -541,7 +541,7 @@
(<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime)
ffi.as_boolean
- (case (|> args
+ (when (|> args
(ffi.read! 0)
(ffi.is java/lang/Object)
..read)
@@ -625,11 +625,11 @@
args [org/jruby/runtime/builtin/IRubyObject]
block org/jruby/runtime/Block])
org/jruby/runtime/builtin/IRubyObject
- (case (|> args
+ (when (|> args
(ffi.read! 0)
(ffi.as org/jruby/RubySymbol))
{.#Some method}
- (|> (case (|> method
+ (|> (when (|> method
org/jruby/RubySymbol::asJavaString
ffi.of_string)
(^.or "==" "equal?"
@@ -663,7 +663,7 @@
(org/jruby/RubyClass
[] (searchWithCache this [method java/lang/String])
org/jruby/runtime/callsite/CacheEntry
- (case (ffi.of_string method)
+ (when (ffi.of_string method)
"call"
(org/jruby/runtime/callsite/CacheEntry::new (::call useful_object_class lux_structure value) (ffi.as_int +0))
@@ -719,9 +719,9 @@
(def (expander macro inputs lux)
Expander
- (case (macro! macro)
+ (when (macro! macro)
{.#Some macro}
- (case (call_macro inputs lux macro)
+ (when (call_macro inputs lux macro)
{try.#Success output}
(|> output
(as java/lang/Object)
@@ -851,10 +851,10 @@
[inputs (|> inputs
(array.list {.#None})
(monad.each ! (|>> (ffi.is java/lang/Object) ..read)))])
- (case inputs
+ (when inputs
... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value.
(list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host)
- (case partial_application
+ (when partial_application
(list partial/0 partial/1)
(in (..to_host ((as (-> Any Any Any Any) phase)
partial/0
@@ -869,7 +869,7 @@
(host_phase partial_application phase))}
(list input/0)
- (case partial_application
+ (when partial_application
(list)
(in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(host_phase (list input/0) phase)))
@@ -888,7 +888,7 @@
(exception.except ..invaid_phase_application [partial_application inputs]))
(list input/0 input/1)
- (case partial_application
+ (when partial_application
(list)
(in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(host_phase (list input/0 input/1) phase)))
@@ -903,7 +903,7 @@
(exception.except ..invaid_phase_application [partial_application inputs]))
(list input/0 input/1 input/2)
- (case partial_application
+ (when partial_application
(list)
(in (..to_host ((as (-> Any Any Any Any) phase)
input/0
diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux
index b6d06f341..ff51d1b45 100644
--- a/lux-scheme/source/program.lux
+++ b/lux-scheme/source/program.lux
@@ -139,14 +139,14 @@
(def (variant? value)
(-> Any Bit)
- (case (ffi.as [java/lang/Object] (as java/lang/Object value))
+ (when (ffi.as [java/lang/Object] (as java/lang/Object value))
{.#Some array}
... TODO: Get rid of this coercion ASAP.
(let [array (as (Array java/lang/Object) array)]
(and (n.= 3 (array.size array))
- (case (array.read! 0 array)
+ (when (array.read! 0 array)
{.#Some tag}
- (case (ffi.as java/lang/Integer tag)
+ (when (ffi.as java/lang/Integer tag)
{.#Some _}
true
@@ -182,7 +182,7 @@
(gnu/lists/Pair
[] (getCar self []) java/lang/Object
(if cdr?
- (case (array.read! 1 value)
+ (when (array.read! 1 value)
{.#Some flag_is_set}
true
@@ -248,7 +248,7 @@
(def (lux_value value)
(-> java/lang/Object java/lang/Object)
- (<| (case (ffi.as [java/lang/Object] value)
+ (<| (when (ffi.as [java/lang/Object] value)
{.#Some value}
... TODO: Get rid of the coercions below.
(if (variant? value)
@@ -275,7 +275,7 @@
(do try.monad
[tag (read (gnu/lists/Pair::getCar host_object))
#let [host_object (as gnu/lists/Pair (gnu/lists/Pair::getCdr host_object))
- flag (case (ffi.as java/lang/Boolean (gnu/lists/Pair::getCar host_object))
+ flag (when (ffi.as java/lang/Boolean (gnu/lists/Pair::getCar host_object))
{.#Some flag}
(as Bit flag)
@@ -291,7 +291,7 @@
output (is (Array Any)
(array.new size))])
(if (n.< size idx)
- (case (read (gnu/lists/FVector::getRaw (.int idx) host_object))
+ (when (read (gnu/lists/FVector::getRaw (.int idx) host_object))
{try.#Failure error}
{try.#Failure error}
@@ -302,7 +302,7 @@
(def (read host_object)
(Reader java/lang/Object)
(`` (<| (,, (with_template [<class>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
{try.#Success host_object}
@@ -312,7 +312,7 @@
[gnu/mapping/Procedure] [gnu/lists/U8Vector]
))
(,, (with_template [<class> <processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
{try.#Success (<| <processing> host_object)}
@@ -329,12 +329,12 @@
[program/VariantValue program/VariantValue::getValue]
[program/TupleValue program/TupleValue::getValue]
))
- (case (ffi.as gnu/lists/Pair host_object)
+ (when (ffi.as gnu/lists/Pair host_object)
{.#Some host_object}
(read_variant read host_object)
{.#None})
- (case (ffi.as gnu/lists/FVector host_object)
+ (when (ffi.as gnu/lists/FVector host_object)
{.#Some host_object}
(read_tuple read (as (gnu/lists/FVector java/lang/Object) host_object))
@@ -348,9 +348,9 @@
(def (expander macro inputs lux)
Expander
- (case (..ensure_macro macro)
+ (when (..ensure_macro macro)
{.#Some macro}
- (case (gnu/mapping/Procedure::apply2 (lux_value (as java/lang/Object inputs))
+ (when (gnu/mapping/Procedure::apply2 (lux_value (as java/lang/Object inputs))
(lux_value (as java/lang/Object lux))
macro)
{try.#Success output}
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 68491c807..21b90e2a6 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -27,876 +27,895 @@
["[1][0]" test]
["[1][0]" world]])
-(`` (def .public documentation
- (List $.Documentation)
- (list.partial ($.module /._
- "")
-
- ($.definition /.prelude
- (format "The name of the prelude module"
- \n "Value: " (%.text /.prelude)))
-
- ($.definition /.Any
- (format "The type of things whose type is irrelevant."
- \n "It can be used to write functions or data-structures that can take, or return, anything."))
-
- ($.definition /.Nothing
- (format "The type of things whose type is undefined."
- \n "Useful for expressions that cause errors or other 'extraordinary' conditions."))
-
- ($.definition (/.List item)
- "A potentially empty list of values.")
-
- ($.definition /.Bit
- "Your standard, run-of-the-mill boolean values (as #0 or #1 bits).")
-
- ($.definition (/.I64 kind)
- "64-bit integers without any semantics.")
-
- ($.definition /.Nat
- (format "Natural numbers (unsigned integers)."
- \n "They start at zero (0) and extend in the positive direction."))
+(def sub_modules
+ (List $.Documentation)
+ (all list#composite
+ /abstract.documentation
+ /control.documentation
+ /data.documentation
+ /debug.documentation
+ /documentation.documentation
+ /ffi.documentation
+ /math.documentation
+ /meta.documentation
+ /program.documentation
+ /test.documentation
+ /world.documentation
+ ))
- ($.definition /.Int
- "Your standard, run-of-the-mill integer numbers.")
+(def all/1-4
+ (List $.Documentation)
+ (list ($.definition /.prelude
+ (format "The name of the prelude module"
+ \n "Value: " (%.text /.prelude)))
- ($.definition /.Rev
- (format "Fractional numbers that live in the interval [0,1)."
- \n "Useful for probability, and other domains that work within that interval."))
+ ($.definition /.Any
+ (format "The type of things whose type is irrelevant."
+ \n "It can be used to write functions or data-structures that can take, or return, anything."))
- ($.definition /.Frac
- "Your standard, run-of-the-mill floating-point (fractional) numbers.")
+ ($.definition /.Nothing
+ (format "The type of things whose type is undefined."
+ \n "Useful for expressions that cause errors or other 'extraordinary' conditions."))
- ($.definition /.Text
- "Your standard, run-of-the-mill string values.")
-
- ($.definition /.Symbol
- (format "A name for a Lux definition."
- \n "It includes the module of provenance."))
-
- ($.definition (/.Maybe value)
- "A potentially missing value.")
-
- ($.definition /.Type
- "This type represents the data-structures that are used to specify types themselves.")
-
- ($.definition /.Location
- "Locations are for specifying the location of Code nodes in Lux files during compilation.")
-
- ($.definition (/.Ann meta_data datum)
- "The type of things that can be annotated with meta-data of arbitrary types.")
-
- ($.definition /.Code
- "The type of Code nodes for Lux syntax.")
-
- ($.definition /.private
- "The export policy for private/local definitions.")
-
- ($.definition /.local
- "The export policy for private/local definitions.")
-
- ($.definition /.public
- "The export policy for public/global definitions.")
-
- ($.definition /.global
- "The export policy for public/global definitions.")
-
- ($.definition /.Definition
- "Represents all the data associated with a definition: its type, its annotations, and its value.")
-
- ($.definition /.Global
- "Represents all the data associated with a global constant.")
-
- ($.definition (/.Either left right)
- "A choice between two values of different types.")
-
- ($.definition /.Module
- "All the information contained within a Lux module.")
-
- ($.definition /.Mode
- "A sign that shows the conditions under which the compiler is running.")
-
- ($.definition /.Info
- "Information about the current version and type of compiler that is running.")
-
- ($.definition /.Lux
- (format "Represents the state of the Lux compiler during a run."
- \n "It is provided to macros during their invocation, so they can access compiler data."
- \n "Caveat emptor: Avoid fiddling with it, unless you know what you're doing."))
-
- ($.definition (/.Meta it)
- (format "Computations that can have access to the state of the compiler."
- \n "These computations may fail, or modify the state of the compiler."))
-
- ($.definition /.Macro
- "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")
-
- ($.definition /.comment
- (format "Throws away any code given to it."
- \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.")
- [(comment
- (def (this will not)
- (Be Defined)
- (because it will be (commented out))))])
-
- ($.definition /.All
- "Universal quantification."
- [(All (_ a)
- (-> a a))]
- ["A name can be provided, to specify a recursive type."
- (All (List a)
- (Or Any
- [a (List a)]))])
-
- ($.definition /.Ex
- "Existential quantification."
- [(Ex (_ a)
- [(Codec Text a) a])]
- ["A name can be provided, to specify a recursive type."
- (Ex (Self a)
- [(Codec Text a)
- a
- (List (Self a))])])
-
- ($.definition /.->
- "Function types."
- ["This is the type of a function that takes 2 Ints and returns an Int."
- (-> Int Int Int)])
-
- ($.definition /.list
- "List literals."
- [(is (List Nat)
- (list 0 1 2 3))])
-
- ($.definition /.Union
- "Union types."
- [(Union Bit Nat Text)]
- [(= Nothing
- (Union))])
-
- ($.definition /.Tuple
- "Tuple types."
- [(Tuple Bit Nat Text)]
- [(= Any
- (Tuple))])
-
- ($.definition /.Or
- "An alias for the Union type constructor."
- [(= (Union Bit Nat Text)
- (Or Bit Nat Text))]
- [(= (Union)
- (Or))])
-
- ($.definition /.And
- "An alias for the Tuple type constructor."
- [(= (Tuple Bit Nat Text)
- (And Bit Nat Text))]
- [(= (Tuple)
- (And))])
-
- ($.definition /.left
- "Left-association for the application of binary functions over variadic arguments."
- [(left text#composite "Hello, " name ". How are you?")
- "=>"
- (text#composite (text#composite "Hello, " name) ". How are you?")])
-
- ($.definition /.all
- "Right-association for the application of binary functions over variadic arguments."
- [(all text#composite "Hello, " name ". How are you?")
- "=>"
- (text#composite "Hello, " (text#composite name ". How are you?"))])
-
- ($.definition /.if
- "Picks which expression to evaluate based on a bit test value."
- [(if #1
- "Oh, yeah!"
- "Aw hell naw!")
- "=>"
- "Oh, yeah!"]
- [(if #0
- "Oh, yeah!"
- "Aw hell naw!")
- "=>"
- "Aw hell naw!"])
-
- ($.definition /.Primitive
- "Macro to treat define new primitive types."
- [(Primitive "java.lang.Object")]
- [(Primitive "java.util.List" [(Primitive "java.lang.Long")])])
-
- ($.definition /.`
- (format "Hygienic quasi-quotation as a macro."
- \n "Unquote (,) and unquote-splice (,*) must also be used as forms."
- \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.")
- [(` (def (, name)
- (function ((,' _) (,* args))
- (, body))))])
-
- ($.definition /.`'
- (format "Unhygienic quasi-quotation as a macro."
- \n "Unquote (,) and unquote-splice (,*) must also be used as forms.")
- [(`' (def (, name)
- (function (_ (,* args))
- (, body))))])
-
- ($.definition /.'
- "Quotation as a macro."
- [(' YOLO)])
-
- ($.definition /.|>
- "Piping macro."
- [(|> elems
- (list#each int#encoded)
- (interposed " ")
- (mix text#composite ""))
- "=>"
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded
- elems)))])
-
- ($.definition /.<|
- "Reverse piping macro."
- [(<| (mix text#composite "")
- (interposed " ")
- (list#each int#encoded)
- elems)
- "=>"
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded
- elems)))])
-
- ($.definition /.template
- ""
- ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary."
- (with_template [<name> <diff>]
- [(def .public <name>
- (-> Int Int)
- (+ <diff>))]
-
- [++ +1]
- [-- -1]
- )])
-
- ($.definition /.not
- "Bit negation."
- [(not #1)
- "=>"
- #0]
- [(not #0)
- "=>"
- #1])
-
- ($.definition /.type
- "Takes a type expression and returns its representation as data-structure."
- [(type_literal (All (_ a)
- (Maybe (List a))))])
-
- ($.definition /.is
- "The type-annotation macro."
- [(is (List Int)
- (list +1 +2 +3))])
-
- ($.definition /.as
- "The type-coercion macro."
- [(as Dinosaur
- (list +1 +2 +3))])
-
- ($.definition /.Rec
- "Parameter-less recursive types."
- ["A name has to be given to the whole type, to use it within its body."
- (Rec Int_List
- (Or Any
- [Int Int_List]))]
- ["Can also be used with type and labelled-type definitions."
- (type Type
- (Rec @
- (Variant
- {#Primitive Text (List @)}
- {#Sum @ @}
- {#Product @ @}
- {#Function @ @}
- {#Parameter Nat}
- {#Var Nat}
- {#Ex Nat}
- {#UnivQ (List @) @}
- {#ExQ (List @) @}
- {#Apply @ @}
- {#Named Symbol @})))])
-
- ($.definition /.exec
- "Sequential execution of expressions (great for side-effects)."
- [(exec
- (log! "#1")
- (log! "#2")
- (log! "#3")
- "YOLO")])
-
- ($.definition /.case
- (format "The pattern-matching macro."
- \n "Allows the usage of macros within the patterns to provide custom syntax.")
- [(case (is (List Int)
- (list +1 +2 +3))
- {#Item x {#Item y {#Item z {#End}}}}
- {#Some (all * x y z)}
-
- _
- {#None})])
-
- ($.definition /.pattern
- (format "Macro-expanding patterns."
- \n "It's a special macro meant to be used with 'case'.")
- [(case (is (List Int)
- (list +1 +2 +3))
- (list x y z)
- {#Some (all * x y z)}
-
- _
- {#None})])
-
- ... ($.definition /.^or
- ... (format "Or-patterns."
- ... \n "It's a special macro meant to be used with 'case'.")
- ... [(type Weekday
- ... (Variant
- ... {#Monday}
- ... {#Tuesday}
- ... {#Wednesday}
- ... {#Thursday}
- ... {#Friday}
- ... {#Saturday}
- ... {#Sunday}))
-
- ... (def (weekend? day)
- ... (-> Weekday Bit)
- ... (case day
- ... (^or {#Saturday} {#Sunday})
- ... true
-
- ... _
- ... false))])
-
- ($.definition /.let
- (format "Creates local bindings."
- \n "Can (optionally) use pattern-matching macros when binding.")
- [(let [x (foo bar)
- y (baz quux)]
- (op x y))])
-
- ($.definition /.function
- "Syntax for creating functions."
- [(is (All (_ a b)
- (-> a b a))
- (function (_ x y)
- x))]
- ["Allows for giving the function itself a name, for the sake of recursion."
- (is (-> Nat Nat)
- (function (factorial n)
- (case n
- 0 1
- _ (* n (factorial (-- n))))))])
-
- ($.definition /.def
- "Defines global constants/functions."
- [(def branching_exponent
- Int
- +5)]
- ["The type is optional."
- (def branching_exponent
- +5)]
- [(def (pair_list pair)
- (-> [Code Code] (List Code))
- (let [[left right] pair]
- (list left right)))]
- ["Can pattern-match on the inputs to functions."
- (def (pair_list [left right])
- (-> [Code Code] (List Code))
- (list left right))])
-
- ($.definition /.macro
- "Macro-definition macro."
- [(def .public symbol
- (macro (_ tokens)
- (case tokens
- (^with_template [<tag>]
- [(list [_ {<tag> [module name]}])
- (in (list (` [(, (text$ module)) (, (text$ name))])))])
- ([#Symbol])
-
- _
- (failure "Wrong syntax for symbol"))))])
-
- ($.definition /.and
- "Short-circuiting 'and'."
- [(and #1 #0)
- "=>"
- #0]
- [(and #1 #1)
- "=>"
- #1])
-
- ($.definition /.or
- "Short-circuiting 'or'."
- [(or #1 #0)
- "=>"
- #1]
- [(or #0 #0)
- "=>"
- #0])
-
- ($.definition /.panic!
- "Causes an error, with the given error message."
- [(panic! "OH NO!")])
-
- ($.definition /.implementation
- "Express a value that implements an interface."
- [(is (Order Int)
- (implementation
- (def equivalence
- equivalence)
- (def (< reference subject)
- (< reference subject))
- ))])
-
- ($.definition /.Variant
- (format "Syntax for defining labelled/tagged sum/union types."
- \n "WARNING: Only use it within the type macro.")
- [(type Referrals
- (Variant
- {#All}
- {#Only (List Text)}
- {#Exclude (List Text)}
- {#Ignore}
- {#Nothing}))])
-
- ($.definition /.Record
- (format "Syntax for defining labelled/slotted product/tuple types."
- \n "WARNING: Only use it within the type macro.")
- [(type Refer
- (Record
- [#refer_defs Referrals
- #refer_open (List Openings)]))])
-
- ($.definition /.type
- "The type-definition macro."
- [(type (List a)
- {#End}
- {#Item a (List a)})])
-
- ($.definition /.Interface
- "Interface definition."
- [(type .public (Order a)
- (Interface
- (is (Equivalence a)
- equivalence)
- (is (-> a a Bit)
- <)))])
-
- (,, (with_template [<name>]
- [($.definition <name>
- "Safe type-casting for I64 values.")]
-
- [/.i64]
- [/.nat]
- [/.int]
- [/.rev]
- ))
-
- ($.definition /.module_separator
- (format "Character used to separate the parts of module names."
- \n "Value: " (%.text /.module_separator)))
-
- ($.definition /.open
- (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings."
- \n "Takes an 'alias' text for the generated local bindings.")
- [(def .public (range enum from to)
- (All (_ a) (-> (Enum a) a a (List a)))
- (let [(open "[0]") enum]
- (loop (again [end to
- output {.#End}])
- (cond (< end from)
- (again (pred end) {.#Item end output})
-
- (< from end)
- (again (succ end) {.#Item end output})
-
- ... (= end from)
- {.#Item end output}))))])
-
- ($.definition /.cond
- "Conditional branching with multiple test conditions."
- [(cond (even? num) "WHEN even"
- (odd? num) "WHEN odd"
- "ELSE")])
-
- ($.definition /.the
- "Accesses the value of a record at a given tag."
- [(the #field my_record)]
- ["Can also work with multiple levels of nesting."
- (the [#foo #bar #baz] my_record)]
- ["And, if only the slot/path is given, generates an accessor function."
- (let [getter (the [#foo #bar #baz])]
- (getter my_record))])
-
- ($.definition /.use
- "Opens a implementation and generates a definition for each of its members (including nested members)."
- [(use "i:[0]" order)
- "=>"
- (def i:= (at order =))
- (def i:< (at order <))])
-
- ($.definition /.|>>
- "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it."
- [(|>> (list#each int#encoded)
- (interposed " ")
- (mix text#composite ""))
- "=>"
- (function (_ <it>)
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded <it>))))])
-
- ($.definition /.<<|
- "Similar to the reverse piping macro, but rather than taking an initial object to work on, creates a function for taking it."
- [(<<| (mix text#composite "")
- (interposed " ")
- (list#each int#encoded))
- "=>"
- (function (_ <it>)
- (mix text#composite ""
- (interposed " "
- (list#each int#encoded
- <it>))))])
-
- ($.definition /.require
- "Module-definition macro."
- [(.require
- [lux (.except)
- [control
- ["M" monad (.except)]]
- [data
- maybe
- ["[0]" name (.use "[1]#[0]" codec)]]
- [macro
- code]]
- [//
- [type (.use "[0]" equivalence)]])])
-
- ($.definition /.at
- "Allows accessing the value of a implementation's member."
- [(at codec encoded)]
- ["Also allows using that value as a function."
- (at codec encoded +123)])
-
- ($.definition /.has
- "Sets the value of a record at a given tag."
- [(has #name "Lux" lang)]
- ["Can also work with multiple levels of nesting."
- (has [#foo #bar #baz] value my_record)]
- ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
- (let [setter (has [#foo #bar #baz] value)]
- (setter my_record))
- (let [setter (has [#foo #bar #baz])]
- (setter value my_record))])
-
- ($.definition /.revised
- "Modifies the value of a record at a given tag, based on some function."
- [(revised #age ++ person)]
- ["Can also work with multiple levels of nesting."
- (revised [#foo #bar #baz] func my_record)]
- ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
- (let [updater (revised [#foo #bar #baz] func)]
- (updater my_record))
- (let [updater (revised [#foo #bar #baz])]
- (updater func my_record))])
-
- ... ($.definition /.^template
- ... "It's similar to template, but meant to be used during pattern-matching."
- ... [(def (reduced env type)
- ... (-> (List Type) Type Type)
- ... (case type
- ... {.#Primitive name params}
- ... {.#Primitive name (list#each (reduced env) params)}
-
- ... (^with_template [<tag>]
- ... [{<tag> left right}
- ... {<tag> (reduced env left) (reduced env right)}])
- ... ([.#Sum] [.#Product])
-
- ... (^with_template [<tag>]
- ... [{<tag> left right}
- ... {<tag> (reduced env left) (reduced env right)}])
- ... ([.#Function] [.#Apply])
-
- ... (^with_template [<tag>]
- ... [{<tag> old_env def}
- ... (case old_env
- ... {.#End}
- ... {<tag> env def}
-
- ... _
- ... type)])
- ... ([.#UnivQ] [.#ExQ])
-
- ... {.#Parameter idx}
- ... (else type (list.item idx env))
-
- ... _
- ... type
- ... ))])
-
- (,, (with_template [<name> <doc>]
- [($.definition <name>
- <doc>)]
-
- [/.++ "Increment function."]
- [/.-- "Decrement function."]
- ))
-
- ($.definition /.loop
- (format "Allows arbitrary looping, using the 'again' form to re-start the loop."
- \n "Can be used in monadic code to create monadic loops.")
- [(loop (again [count +0
- x init])
- (if (< +10 count)
- (again (++ count) (f x))
- x))]
- ["Loops can also be given custom names."
- (loop (my_loop [count +0
- x init])
- (if (< +10 count)
- (my_loop (++ count) (f x))
- x))])
-
- ($.definition /.with_expansions
- (format "Controlled macro-expansion."
- \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings."
- \n "Wherever a binding appears, the bound Code nodes will be spliced in there.")
- [(def test
- Test
- (with_expansions
- [<tests> (with_template [<function> <parameter> <expected>]
- [(cover [<function>]
- (compare <text>
- (at codec encoded <function> <parameter>)))]
-
- [bit #1 "#1"]
- [int +123 "+123"]
- [frac +123.0 "+123.0"]
- [text "123" "'123'"]
- [symbol ["yolo" "lol"] "yolo.lol"]
- [form (list (bit #1)) "(#1)"]
- [tuple (list (bit #1)) "[#1]"]
- )]
- (all and
- <tests>
- )))])
-
- ($.definition /.static
- (format "Resolves the names of definitions to their values at compile-time, assuming their values are either:"
- \n "* Bit"
- \n "* Nat"
- \n "* Int"
- \n "* Rev"
- \n "* Frac"
- \n "* Text")
- [(def my_nat 123)
- (def my_text "456")
- (and (case [my_nat my_text]
- (static [..my_nat ..my_text])
- true
-
- _
- false)
- (case [my_nat my_text]
- [(static ..my_nat) (static ..my_text)]
- true
-
- _
- false))])
-
- ... ($.definition /.^multi
- ... (format "Multi-level pattern matching."
- ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.")
- ... [(case (split (size static) uri)
- ... (^multi {#Some [chunk uri']}
- ... [(text#= static chunk) .true])
- ... (match_uri endpoint? parts' uri')
-
- ... _
- ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]
- ... ["Short-cuts can be taken when using bit tests."
- ... "The example above can be rewritten as..."
- ... (case (split (size static) uri)
- ... (^multi {#Some [chunk uri']}
- ... (text#= static chunk))
- ... (match_uri endpoint? parts' uri')
-
- ... _
- ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})])
-
- ($.definition /.symbol
- "Gives back a 2 tuple with the module and name parts, both as Text."
- [(symbol ..#doc)
- "=>"
- ["documentation/lux" "#doc"]])
-
- ($.definition /.parameter
- (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux."
- "Allows you to refer to the type-variables in a polymorphic function's type, by their index.")
- ["In the example below, 0 corresponds to the 'a' variable."
- (def .public (of_list list)
- (All (_ a) (-> (List a) (Sequence a)))
- (list#mix add
- (is (Sequence (parameter 0))
- empty)
- list))])
-
- ($.definition /.same?
- "Tests whether the 2 values are identical (not just 'equal')."
- ["This one should succeed:"
- (let [value +5]
- (same? value
- value))]
- ["This one should fail:"
- (same? +5
- (+ +2 +3))])
-
- ... ($.definition /.^let
- ... "Allows you to simultaneously bind and de-structure a value."
- ... [(def (hash (^let set [member_hash _]))
- ... (list#mix (function (_ elem acc)
- ... (+ acc
- ... (at member_hash hash elem)))
- ... 0
- ... (set.list set)))])
-
- ... ($.definition /.^|>
- ... "Pipes the value being pattern-matched against prior to binding it to a variable."
- ... [(case input
- ... (^|> value [++ (% 10) (max 1)])
- ... (foo value))])
-
- ($.definition /.as_expected
- "Coerces the given expression to the type of whatever is expected."
- [(is Dinosaur
- (as_expected (is (List Nat)
- (list 1 2 3))))])
-
- ($.definition /.undefined
- (format "Meant to be used as a stand-in for functions with undefined implementations."
- \n "Undefined expressions will type-check against everything, so they make good dummy implementations."
- \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.")
- [(def (square x)
- (-> Int Int)
- (undefined))])
-
- ($.definition /.type_of
- "Generates the type corresponding to a given expression."
- [(let [my_num +123]
- (type_of my_num))
- "=="
- Int]
- [(type_of +123)
- "=="
- Int])
-
- ($.definition /.template
- (format "Define macros in the style of with_template."
- \n "For simple macros that do not need any fancy features.")
- [(def square
- (template (square x)
- (* x x)))])
-
- ($.definition /.these
- (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done."
- \n "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros.")
- [(with_expansions [<operands> (these 1
- 2
- 3
- 4)]
- (all + <operands>))])
-
- ($.definition /.char
- "If given a 1-character text literal, yields the char-code of the sole character."
- [(is Nat
- (char "A"))
- "=>"
- 65])
-
- ($.definition /.for
- (format "Selects the appropriate code for a given target-platform when compiling Lux to it."
- \n "Look-up the available targets in library/lux/target.")
- [(def js
- "JavaScript")
-
- (for "JVM" (do jvm stuff)
- js (do js stuff)
- (do default stuff))])
-
- ($.definition /.``
- (format "Delimits a controlled (spliced) macro-expansion."
- \n "Uses a (,,) special form to specify where to expand.")
- [(`` (some expression
- (,, (some macro which may yield 0 or more results))))])
-
- ... ($.definition /.^code
- ... "Generates pattern-matching code for Code values in a way that looks like code-templating."
- ... [(is (Maybe Nat)
- ... (case (` (#0 123 +456.789))
- ... (^code (#0 (, [_ {.#Nat number}]) +456.789))
- ... {.#Some number}
-
- ... _
- ... {.#None}))])
-
- ($.definition /.false
- "The boolean FALSE value.")
-
- ($.definition /.true
- "The boolean TRUE value.")
-
- ($.definition /.try
- ""
- [(is Foo
- (case (is (Either Text Bar)
- (try (is Bar
- (risky computation which may panic))))
- {.#Right success}
- (is Foo
- (do something after success))
-
- {.#Left error}
- (is Foo
- (recover from error))))])
-
- ($.definition (/.Code' w))
- ($.definition /.Alias)
- ($.definition (/.Bindings key value))
- ($.definition /.Ref)
- ($.definition /.Scope)
- ($.definition /.Source)
- ($.definition /.Module_State)
- ($.definition /.Type_Context)
- ($.definition /.Macro')
- ($.definition /.Label)
- ($.definition /.macro)
-
- (all list#composite
- /abstract.documentation
- /control.documentation
- /data.documentation
- /debug.documentation
- /documentation.documentation
- /ffi.documentation
- /math.documentation
- /meta.documentation
- /program.documentation
- /test.documentation
- /world.documentation
- )
- )))
+ ($.definition (/.List item)
+ "A potentially empty list of values.")
+
+ ($.definition /.Bit
+ "Your standard, run-of-the-mill boolean values (as #0 or #1 bits).")
+
+ ($.definition (/.I64 kind)
+ "64-bit integers without any semantics.")
+
+ ($.definition /.Nat
+ (format "Natural numbers (unsigned integers)."
+ \n "They start at zero (0) and extend in the positive direction."))
+
+ ($.definition /.Int
+ "Your standard, run-of-the-mill integer numbers.")
+
+ ($.definition /.Rev
+ (format "Fractional numbers that live in the interval [0,1)."
+ \n "Useful for probability, and other domains that work within that interval."))
+
+ ($.definition /.Frac
+ "Your standard, run-of-the-mill floating-point (fractional) numbers.")
+
+ ($.definition /.Text
+ "Your standard, run-of-the-mill string values.")
+
+ ($.definition /.Symbol
+ (format "A name for a Lux definition."
+ \n "It includes the module of provenance."))
+
+ ($.definition (/.Maybe value)
+ "A potentially missing value.")
+
+ ($.definition /.Type
+ "This type represents the data-structures that are used to specify types themselves.")
+
+ ($.definition /.Location
+ "Locations are for specifying the location of Code nodes in Lux files during compilation.")
+
+ ($.definition (/.Ann meta_data datum)
+ "The type of things that can be annotated with meta-data of arbitrary types.")
+
+ ($.definition /.Code
+ "The type of Code nodes for Lux syntax.")
+
+ ($.definition /.private
+ "The export policy for private/local definitions.")
+
+ ($.definition /.local
+ "The export policy for private/local definitions.")
+
+ ($.definition /.public
+ "The export policy for public/global definitions.")
+
+ ($.definition /.global
+ "The export policy for public/global definitions.")
+
+ ($.definition /.Definition
+ "Represents all the data associated with a definition: its type, its annotations, and its value.")
+
+ ($.definition /.Global
+ "Represents all the data associated with a global constant.")
+
+ ($.definition (/.Either left right)
+ "A choice between two values of different types.")
+
+ ($.definition /.Module
+ "All the information contained within a Lux module.")
+
+ ($.definition /.Mode
+ "A sign that shows the conditions under which the compiler is running.")
+
+ ($.definition /.Info
+ "Information about the current version and type of compiler that is running.")
+
+ ($.definition /.Lux
+ (format "Represents the state of the Lux compiler during a run."
+ \n "It is provided to macros during their invocation, so they can access compiler data."
+ \n "Caveat emptor: Avoid fiddling with it, unless you know what you're doing."))
+
+ ($.definition (/.Meta it)
+ (format "Computations that can have access to the state of the compiler."
+ \n "These computations may fail, or modify the state of the compiler."))
+
+ ($.definition /.Macro
+ "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")
+
+ ($.definition /.comment
+ (format "Throws away any code given to it."
+ \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.")
+ [(comment
+ (def (this will not)
+ (Be Defined)
+ (because it will be (commented out))))])
+
+ ($.definition /.All
+ "Universal quantification."
+ [(All (_ a)
+ (-> a a))]
+ ["A name can be provided, to specify a recursive type."
+ (All (List a)
+ (Or Any
+ [a (List a)]))])
+
+ ($.definition /.Ex
+ "Existential quantification."
+ [(Ex (_ a)
+ [(Codec Text a) a])]
+ ["A name can be provided, to specify a recursive type."
+ (Ex (Self a)
+ [(Codec Text a)
+ a
+ (List (Self a))])])
+ ))
+
+(def all/2-4
+ (List $.Documentation)
+ (list ($.definition /.->
+ "Function types."
+ ["This is the type of a function that takes 2 Ints and returns an Int."
+ (-> Int Int Int)])
+
+ ($.definition /.list
+ "List literals."
+ [(is (List Nat)
+ (list 0 1 2 3))])
+
+ ($.definition /.Union
+ "Union types."
+ [(Union Bit Nat Text)]
+ [(= Nothing
+ (Union))])
+
+ ($.definition /.Tuple
+ "Tuple types."
+ [(Tuple Bit Nat Text)]
+ [(= Any
+ (Tuple))])
+
+ ($.definition /.Or
+ "An alias for the Union type constructor."
+ [(= (Union Bit Nat Text)
+ (Or Bit Nat Text))]
+ [(= (Union)
+ (Or))])
+
+ ($.definition /.And
+ "An alias for the Tuple type constructor."
+ [(= (Tuple Bit Nat Text)
+ (And Bit Nat Text))]
+ [(= (Tuple)
+ (And))])
+
+ ($.definition /.left
+ "Left-association for the application of binary functions over variadic arguments."
+ [(left text#composite "Hello, " name ". How are you?")
+ "=>"
+ (text#composite (text#composite "Hello, " name) ". How are you?")])
+
+ ($.definition /.all
+ "Right-association for the application of binary functions over variadic arguments."
+ [(all text#composite "Hello, " name ". How are you?")
+ "=>"
+ (text#composite "Hello, " (text#composite name ". How are you?"))])
+
+ ($.definition /.if
+ "Picks which expression to evaluate based on a bit test value."
+ [(if #1
+ "Oh, yeah!"
+ "Aw hell naw!")
+ "=>"
+ "Oh, yeah!"]
+ [(if #0
+ "Oh, yeah!"
+ "Aw hell naw!")
+ "=>"
+ "Aw hell naw!"])
+
+ ($.definition /.Primitive
+ "Macro to treat define new primitive types."
+ [(Primitive "java.lang.Object")]
+ [(Primitive "java.util.List" [(Primitive "java.lang.Long")])])
+
+ ($.definition /.`
+ (format "Hygienic quasi-quotation as a macro."
+ \n "Unquote (,) and unquote-splice (,*) must also be used as forms."
+ \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.")
+ [(` (def (, name)
+ (function ((,' _) (,* args))
+ (, body))))])
+
+ ($.definition /.`'
+ (format "Unhygienic quasi-quotation as a macro."
+ \n "Unquote (,) and unquote-splice (,*) must also be used as forms.")
+ [(`' (def (, name)
+ (function (_ (,* args))
+ (, body))))])
+
+ ($.definition /.'
+ "Quotation as a macro."
+ [(' YOLO)])
+
+ ($.definition /.|>
+ "Piping macro."
+ [(|> elems
+ (list#each int#encoded)
+ (interposed " ")
+ (mix text#composite ""))
+ "=>"
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded
+ elems)))])
+
+ ($.definition /.<|
+ "Reverse piping macro."
+ [(<| (mix text#composite "")
+ (interposed " ")
+ (list#each int#encoded)
+ elems)
+ "=>"
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded
+ elems)))])
+
+ ($.definition /.template
+ ""
+ ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary."
+ (with_template [<name> <diff>]
+ [(def .public <name>
+ (-> Int Int)
+ (+ <diff>))]
+
+ [++ +1]
+ [-- -1]
+ )])
+ ))
+
+(`` (def all/3-4
+ (List $.Documentation)
+ (list ($.definition /.not
+ "Bit negation."
+ [(not #1)
+ "=>"
+ #0]
+ [(not #0)
+ "=>"
+ #1])
+
+ ($.definition /.type
+ "Takes a type expression and returns its representation as data-structure."
+ [(type_literal (All (_ a)
+ (Maybe (List a))))])
+
+ ($.definition /.is
+ "The type-annotation macro."
+ [(is (List Int)
+ (list +1 +2 +3))])
+
+ ($.definition /.as
+ "The type-coercion macro."
+ [(as Dinosaur
+ (list +1 +2 +3))])
+
+ ($.definition /.Rec
+ "Parameter-less recursive types."
+ ["A name has to be given to the whole type, to use it within its body."
+ (Rec Int_List
+ (Or Any
+ [Int Int_List]))]
+ ["Can also be used with type and labelled-type definitions."
+ (type Type
+ (Rec @
+ (Variant
+ {#Primitive Text (List @)}
+ {#Sum @ @}
+ {#Product @ @}
+ {#Function @ @}
+ {#Parameter Nat}
+ {#Var Nat}
+ {#Ex Nat}
+ {#UnivQ (List @) @}
+ {#ExQ (List @) @}
+ {#Apply @ @}
+ {#Named Symbol @})))])
+
+ ($.definition /.exec
+ "Sequential execution of expressions (great for side-effects)."
+ [(exec
+ (log! "#1")
+ (log! "#2")
+ (log! "#3")
+ "YOLO")])
+
+ ($.definition /.when
+ (format "The pattern-matching macro."
+ \n "Allows the usage of macros within the patterns to provide custom syntax.")
+ [(when (is (List Int)
+ (list +1 +2 +3))
+ {#Item x {#Item y {#Item z {#End}}}}
+ {#Some (all * x y z)}
+
+ _
+ {#None})])
+
+ ($.definition /.pattern
+ (format "Macro-expanding patterns."
+ \n "It's a special macro meant to be used with 'when'.")
+ [(when (is (List Int)
+ (list +1 +2 +3))
+ (list x y z)
+ {#Some (all * x y z)}
+
+ _
+ {#None})])
+
+ ... ($.definition /.^or
+ ... (format "Or-patterns."
+ ... \n "It's a special macro meant to be used with 'when'.")
+ ... [(type Weekday
+ ... (Variant
+ ... {#Monday}
+ ... {#Tuesday}
+ ... {#Wednesday}
+ ... {#Thursday}
+ ... {#Friday}
+ ... {#Saturday}
+ ... {#Sunday}))
+
+ ... (def (weekend? day)
+ ... (-> Weekday Bit)
+ ... (when day
+ ... (^or {#Saturday} {#Sunday})
+ ... true
+
+ ... _
+ ... false))])
+
+ ($.definition /.let
+ (format "Creates local bindings."
+ \n "Can (optionally) use pattern-matching macros when binding.")
+ [(let [x (foo bar)
+ y (baz quux)]
+ (op x y))])
+
+ ($.definition /.function
+ "Syntax for creating functions."
+ [(is (All (_ a b)
+ (-> a b a))
+ (function (_ x y)
+ x))]
+ ["Allows for giving the function itself a name, for the sake of recursion."
+ (is (-> Nat Nat)
+ (function (factorial n)
+ (when n
+ 0 1
+ _ (* n (factorial (-- n))))))])
+
+ ($.definition /.def
+ "Defines global constants/functions."
+ [(def branching_exponent
+ Int
+ +5)]
+ ["The type is optional."
+ (def branching_exponent
+ +5)]
+ [(def (pair_list pair)
+ (-> [Code Code] (List Code))
+ (let [[left right] pair]
+ (list left right)))]
+ ["Can pattern-match on the inputs to functions."
+ (def (pair_list [left right])
+ (-> [Code Code] (List Code))
+ (list left right))])
+
+ ($.definition /.macro
+ "Macro-definition macro."
+ [(def .public symbol
+ (macro (_ tokens)
+ (when tokens
+ (^with_template [<tag>]
+ [(list [_ {<tag> [module name]}])
+ (in (list (` [(, (text$ module)) (, (text$ name))])))])
+ ([#Symbol])
+
+ _
+ (failure "Wrong syntax for symbol"))))])
+
+ ($.definition /.and
+ "Short-circuiting 'and'."
+ [(and #1 #0)
+ "=>"
+ #0]
+ [(and #1 #1)
+ "=>"
+ #1])
+
+ ($.definition /.or
+ "Short-circuiting 'or'."
+ [(or #1 #0)
+ "=>"
+ #1]
+ [(or #0 #0)
+ "=>"
+ #0])
+
+ ($.definition /.panic!
+ "Causes an error, with the given error message."
+ [(panic! "OH NO!")])
+
+ ($.definition /.implementation
+ "Express a value that implements an interface."
+ [(is (Order Int)
+ (implementation
+ (def equivalence
+ equivalence)
+ (def (< reference subject)
+ (< reference subject))
+ ))])
+
+ ($.definition /.Variant
+ (format "Syntax for defining labelled/tagged sum/union types."
+ \n "WARNING: Only use it within the type macro.")
+ [(type Referrals
+ (Variant
+ {#All}
+ {#Only (List Text)}
+ {#Exclude (List Text)}
+ {#Ignore}
+ {#Nothing}))])
+
+ ($.definition /.Record
+ (format "Syntax for defining labelled/slotted product/tuple types."
+ \n "WARNING: Only use it within the type macro.")
+ [(type Refer
+ (Record
+ [#refer_defs Referrals
+ #refer_open (List Openings)]))])
+
+ ($.definition /.type
+ "The type-definition macro."
+ [(type (List a)
+ {#End}
+ {#Item a (List a)})])
+
+ ($.definition /.Interface
+ "Interface definition."
+ [(type .public (Order a)
+ (Interface
+ (is (Equivalence a)
+ equivalence)
+ (is (-> a a Bit)
+ <)))])
+
+ (,, (with_template [<name>]
+ [($.definition <name>
+ "Safe type-casting for I64 values.")]
+
+ [/.i64]
+ [/.nat]
+ [/.int]
+ [/.rev]
+ ))
+
+ ($.definition /.module_separator
+ (format "Character used to separate the parts of module names."
+ \n "Value: " (%.text /.module_separator)))
+
+ ($.definition /.open
+ (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings."
+ \n "Takes an 'alias' text for the generated local bindings.")
+ [(def .public (range enum from to)
+ (All (_ a) (-> (Enum a) a a (List a)))
+ (let [(open "[0]") enum]
+ (loop (again [end to
+ output {.#End}])
+ (cond (< end from)
+ (again (pred end) {.#Item end output})
+
+ (< from end)
+ (again (succ end) {.#Item end output})
+
+ ... (= end from)
+ {.#Item end output}))))])
+
+ ($.definition /.cond
+ "Conditional branching with multiple test conditions."
+ [(cond (even? num) "WHEN even"
+ (odd? num) "WHEN odd"
+ "ELSE")])
+
+ ($.definition /.the
+ "Accesses the value of a record at a given tag."
+ [(the #field my_record)]
+ ["Can also work with multiple levels of nesting."
+ (the [#foo #bar #baz] my_record)]
+ ["And, if only the slot/path is given, generates an accessor function."
+ (let [getter (the [#foo #bar #baz])]
+ (getter my_record))])
+
+ ($.definition /.use
+ "Opens a implementation and generates a definition for each of its members (including nested members)."
+ [(use "i:[0]" order)
+ "=>"
+ (def i:= (at order =))
+ (def i:< (at order <))])
+
+ ($.definition /.|>>
+ "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it."
+ [(|>> (list#each int#encoded)
+ (interposed " ")
+ (mix text#composite ""))
+ "=>"
+ (function (_ <it>)
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded <it>))))])
+
+ ($.definition /.<<|
+ "Similar to the reverse piping macro, but rather than taking an initial object to work on, creates a function for taking it."
+ [(<<| (mix text#composite "")
+ (interposed " ")
+ (list#each int#encoded))
+ "=>"
+ (function (_ <it>)
+ (mix text#composite ""
+ (interposed " "
+ (list#each int#encoded
+ <it>))))])
+
+ ($.definition /.require
+ "Module-definition macro."
+ [(.require
+ [lux (.except)
+ [control
+ ["M" monad (.except)]]
+ [data
+ maybe
+ ["[0]" name (.use "[1]#[0]" codec)]]
+ [macro
+ code]]
+ [//
+ [type (.use "[0]" equivalence)]])])
+
+ ($.definition /.at
+ "Allows accessing the value of a implementation's member."
+ [(at codec encoded)]
+ ["Also allows using that value as a function."
+ (at codec encoded +123)])
+
+ ($.definition /.has
+ "Sets the value of a record at a given tag."
+ [(has #name "Lux" lang)]
+ ["Can also work with multiple levels of nesting."
+ (has [#foo #bar #baz] value my_record)]
+ ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
+ (let [setter (has [#foo #bar #baz] value)]
+ (setter my_record))
+ (let [setter (has [#foo #bar #baz])]
+ (setter value my_record))])
+ )))
+
+(`` (def all/4-4
+ (List $.Documentation)
+ (list ($.definition /.revised
+ "Modifies the value of a record at a given tag, based on some function."
+ [(revised #age ++ person)]
+ ["Can also work with multiple levels of nesting."
+ (revised [#foo #bar #baz] func my_record)]
+ ["And, if only the slot/path and (optionally) the value are given, generates a mutator function."
+ (let [updater (revised [#foo #bar #baz] func)]
+ (updater my_record))
+ (let [updater (revised [#foo #bar #baz])]
+ (updater func my_record))])
+
+ ... ($.definition /.^template
+ ... "It's similar to template, but meant to be used during pattern-matching."
+ ... [(def (reduced env type)
+ ... (-> (List Type) Type Type)
+ ... (when type
+ ... {.#Primitive name params}
+ ... {.#Primitive name (list#each (reduced env) params)}
+
+ ... (^with_template [<tag>]
+ ... [{<tag> left right}
+ ... {<tag> (reduced env left) (reduced env right)}])
+ ... ([.#Sum] [.#Product])
+
+ ... (^with_template [<tag>]
+ ... [{<tag> left right}
+ ... {<tag> (reduced env left) (reduced env right)}])
+ ... ([.#Function] [.#Apply])
+
+ ... (^with_template [<tag>]
+ ... [{<tag> old_env def}
+ ... (when old_env
+ ... {.#End}
+ ... {<tag> env def}
+
+ ... _
+ ... type)])
+ ... ([.#UnivQ] [.#ExQ])
+
+ ... {.#Parameter idx}
+ ... (else type (list.item idx env))
+
+ ... _
+ ... type
+ ... ))])
+
+ (,, (with_template [<name> <doc>]
+ [($.definition <name>
+ <doc>)]
+
+ [/.++ "Increment function."]
+ [/.-- "Decrement function."]
+ ))
+
+ ($.definition /.loop
+ (format "Allows arbitrary looping, using the 'again' form to re-start the loop."
+ \n "Can be used in monadic code to create monadic loops.")
+ [(loop (again [count +0
+ x init])
+ (if (< +10 count)
+ (again (++ count) (f x))
+ x))]
+ ["Loops can also be given custom names."
+ (loop (my_loop [count +0
+ x init])
+ (if (< +10 count)
+ (my_loop (++ count) (f x))
+ x))])
+
+ ($.definition /.with_expansions
+ (format "Controlled macro-expansion."
+ \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings."
+ \n "Wherever a binding appears, the bound Code nodes will be spliced in there.")
+ [(def test
+ Test
+ (with_expansions
+ [<tests> (with_template [<function> <parameter> <expected>]
+ [(cover [<function>]
+ (compare <text>
+ (at codec encoded <function> <parameter>)))]
+
+ [bit #1 "#1"]
+ [int +123 "+123"]
+ [frac +123.0 "+123.0"]
+ [text "123" "'123'"]
+ [symbol ["yolo" "lol"] "yolo.lol"]
+ [form (list (bit #1)) "(#1)"]
+ [tuple (list (bit #1)) "[#1]"]
+ )]
+ (all and
+ <tests>
+ )))])
+
+ ($.definition /.static
+ (format "Resolves the names of definitions to their values at compile-time, assuming their values are either:"
+ \n "* Bit"
+ \n "* Nat"
+ \n "* Int"
+ \n "* Rev"
+ \n "* Frac"
+ \n "* Text")
+ [(def my_nat 123)
+ (def my_text "456")
+ (and (when [my_nat my_text]
+ (static [..my_nat ..my_text])
+ true
+
+ _
+ false)
+ (when [my_nat my_text]
+ [(static ..my_nat) (static ..my_text)]
+ true
+
+ _
+ false))])
+
+ ... ($.definition /.^multi
+ ... (format "Multi-level pattern matching."
+ ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.")
+ ... [(when (split (size static) uri)
+ ... (^multi {#Some [chunk uri']}
+ ... [(text#= static chunk) .true])
+ ... (match_uri endpoint? parts' uri')
+
+ ... _
+ ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]
+ ... ["Short-cuts can be taken when using bit tests."
+ ... "The example above can be rewritten as..."
+ ... (when (split (size static) uri)
+ ... (^multi {#Some [chunk uri']}
+ ... (text#= static chunk))
+ ... (match_uri endpoint? parts' uri')
+
+ ... _
+ ... {#Left (format "Static part " (%t static) " does not match URI: " uri)})])
+
+ ($.definition /.symbol
+ "Gives back a 2 tuple with the module and name parts, both as Text."
+ [(symbol ..#doc)
+ "=>"
+ ["documentation/lux" "#doc"]])
+
+ ($.definition /.parameter
+ (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux."
+ "Allows you to refer to the type-variables in a polymorphic function's type, by their index.")
+ ["In the example below, 0 corresponds to the 'a' variable."
+ (def .public (of_list list)
+ (All (_ a) (-> (List a) (Sequence a)))
+ (list#mix add
+ (is (Sequence (parameter 0))
+ empty)
+ list))])
+
+ ($.definition /.same?
+ "Tests whether the 2 values are identical (not just 'equal')."
+ ["This one should succeed:"
+ (let [value +5]
+ (same? value
+ value))]
+ ["This one should fail:"
+ (same? +5
+ (+ +2 +3))])
+
+ ... ($.definition /.^let
+ ... "Allows you to simultaneously bind and de-structure a value."
+ ... [(def (hash (^let set [member_hash _]))
+ ... (list#mix (function (_ elem acc)
+ ... (+ acc
+ ... (at member_hash hash elem)))
+ ... 0
+ ... (set.list set)))])
+
+ ... ($.definition /.^|>
+ ... "Pipes the value being pattern-matched against prior to binding it to a variable."
+ ... [(when input
+ ... (^|> value [++ (% 10) (max 1)])
+ ... (foo value))])
+
+ ($.definition /.as_expected
+ "Coerces the given expression to the type of whatever is expected."
+ [(is Dinosaur
+ (as_expected (is (List Nat)
+ (list 1 2 3))))])
+
+ ($.definition /.undefined
+ (format "Meant to be used as a stand-in for functions with undefined implementations."
+ \n "Undefined expressions will type-check against everything, so they make good dummy implementations."
+ \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.")
+ [(def (square x)
+ (-> Int Int)
+ (undefined))])
+
+ ($.definition /.type_of
+ "Generates the type corresponding to a given expression."
+ [(let [my_num +123]
+ (type_of my_num))
+ "=="
+ Int]
+ [(type_of +123)
+ "=="
+ Int])
+
+ ($.definition /.template
+ (format "Define macros in the style of with_template."
+ \n "For simple macros that do not need any fancy features.")
+ [(def square
+ (template (square x)
+ (* x x)))])
+
+ ($.definition /.these
+ (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done."
+ \n "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros.")
+ [(with_expansions [<operands> (these 1
+ 2
+ 3
+ 4)]
+ (all + <operands>))])
+
+ ($.definition /.char
+ "If given a 1-character text literal, yields the char-code of the sole character."
+ [(is Nat
+ (char "A"))
+ "=>"
+ 65])
+
+ ($.definition /.for
+ (format "Selects the appropriate code for a given target-platform when compiling Lux to it."
+ \n "Look-up the available targets in library/lux/target.")
+ [(def js
+ "JavaScript")
+
+ (for "JVM" (do jvm stuff)
+ js (do js stuff)
+ (do default stuff))])
+
+ ($.definition /.``
+ (format "Delimits a controlled (spliced) macro-expansion."
+ \n "Uses a (,,) special form to specify where to expand.")
+ [(`` (some expression
+ (,, (some macro which may yield 0 or more results))))])
+
+ ... ($.definition /.^code
+ ... "Generates pattern-matching code for Code values in a way that looks like code-templating."
+ ... [(is (Maybe Nat)
+ ... (when (` (#0 123 +456.789))
+ ... (^code (#0 (, [_ {.#Nat number}]) +456.789))
+ ... {.#Some number}
+
+ ... _
+ ... {.#None}))])
+
+ ($.definition /.false
+ "The boolean FALSE value.")
+
+ ($.definition /.true
+ "The boolean TRUE value.")
+
+ ($.definition /.try
+ ""
+ [(is Foo
+ (when (is (Either Text Bar)
+ (try (is Bar
+ (risky computation which may panic))))
+ {.#Right success}
+ (is Foo
+ (do something after success))
+
+ {.#Left error}
+ (is Foo
+ (recover from error))))])
+
+ ($.definition (/.Code' w))
+ ($.definition /.Alias)
+ ($.definition (/.Bindings key value))
+ ($.definition /.Ref)
+ ($.definition /.Scope)
+ ($.definition /.Source)
+ ($.definition /.Module_State)
+ ($.definition /.Type_Context)
+ ($.definition /.Macro')
+ ($.definition /.Label)
+ ($.definition /.macro)
+ )))
+
+(def .public documentation
+ (List $.Documentation)
+ (all list#composite
+ all/1-4
+ all/2-4
+ all/3-4
+ all/4-4
+
+ ..sub_modules
+ ))
(def _
(program inputs
diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux
index 1a1f06dfa..6c8b17adf 100644
--- a/stdlib/source/documentation/lux/control/concatenative.lux
+++ b/stdlib/source/documentation/lux/control/concatenative.lux
@@ -189,9 +189,6 @@
partial
call)))])
- ($.definition /.when
- "Only execute the block when #1.")
-
($.definition /.?
"Choose the top value when #0 and the second-to-top when #1.")
)))
diff --git a/stdlib/source/documentation/lux/control/function/mutual.lux b/stdlib/source/documentation/lux/control/function/mutual.lux
index 9a6930379..58fb34b97 100644
--- a/stdlib/source/documentation/lux/control/function/mutual.lux
+++ b/stdlib/source/documentation/lux/control/function/mutual.lux
@@ -17,13 +17,13 @@
"Locally-defined mutually-recursive functions."
[(let [(even? number)
(-> Nat Bit)
- (case number
+ (when number
0 true
_ (odd? (-- number)))
(odd? number)
(-> Nat Bit)
- (case number
+ (when number
0 false
_ (even? (-- number)))]
(and (even? 4)
@@ -34,13 +34,13 @@
[(def
[.public (even? number)
(-> Nat Bit)
- (case number
+ (when number
0 true
_ (odd? (-- number)))]
[.public (odd? number)
(-> Nat Bit)
- (case number
+ (when number
0 false
_ (even? (-- number)))])])
))
diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux
index 50d232154..ff4d7a4fb 100644
--- a/stdlib/source/documentation/lux/control/pipe.lux
+++ b/stdlib/source/documentation/lux/control/pipe.lux
@@ -45,15 +45,6 @@
[(new "even" [])]
[(new "odd" [])])))])
- ($.definition /.when
- "Only execute the body when the test passes."
- [(same? (if (n.even? sample)
- (n.* 2 sample)
- sample)
- (|> sample
- (when [n.even?]
- [(n.* 2)])))])
-
($.definition /.while
(format "While loops for pipes."
\n "Both the testing and calculating steps are pipes and must be given inside tuples.")
@@ -87,11 +78,11 @@
"=>"
[+50 +2 "+5"]])
- ($.definition /.case
+ ($.definition /.when
(format "Pattern-matching for pipes."
\n "The bodies of each branch are NOT pipes; just regular values.")
[(|> +5
- (case
+ (when
+0 "zero"
+1 "one"
+2 "two"
diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux
index 4ed4c3324..5e884b82c 100644
--- a/stdlib/source/documentation/lux/data/color/named.lux
+++ b/stdlib/source/documentation/lux/data/color/named.lux
@@ -4,7 +4,9 @@
["$" documentation]
[data
["[0]" text (.only)
- ["%" \\format (.only format)]]]
+ ["%" \\format (.only format)]]
+ [collection
+ ["[0]" list (.use "[1]#[0]" monoid)]]]
[math
[number
["[0]" nat (.use "hex#[0]" hex)]]]]]
@@ -12,41 +14,21 @@
["[0]" / (.only)
["/[1]" //]]])
-(`` (def .public documentation
- (List $.Documentation)
- (list ($.module /._
- "")
+(def description
+ (template (_ <name>)
+ [($.definition <name>
+ (let [[red green blue] (//.rgb <name>)
+ [_ name] (symbol <name>)]
+ (format "R:" (hex#encoded red)
+ " G:" (hex#encoded green)
+ " B:" (hex#encoded blue)
+ " | " (text.replaced "_" " " name))))]))
- (,, (with_template [<name>]
- [($.definition <name>
- (let [[red green blue] (//.rgb <name>)
- [_ name] (symbol <name>)]
- (format "R:" (hex#encoded red)
- " G:" (hex#encoded green)
- " B:" (hex#encoded blue)
- " | " (text.replaced "_" " " name))))]
+(`` (def colors/d-k
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
- [/.alice_blue]
- [/.antique_white]
- [/.aqua]
- [/.aquamarine]
- [/.azure]
- [/.beige]
- [/.bisque]
- [/.black]
- [/.blanched_almond]
- [/.blue]
- [/.blue_violet]
- [/.brown]
- [/.burly_wood]
- [/.cadet_blue]
- [/.chartreuse]
- [/.chocolate]
- [/.coral]
- [/.cornflower_blue]
- [/.cornsilk]
- [/.crimson]
- [/.cyan]
[/.dark_blue]
[/.dark_cyan]
[/.dark_goldenrod]
@@ -85,6 +67,14 @@
[/.indigo]
[/.ivory]
[/.khaki]
+ ))
+ )))
+
+(`` (def colors/l-o
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
[/.lavender]
[/.lavender_blush]
[/.lawn_green]
@@ -128,6 +118,14 @@
[/.orange]
[/.orange_red]
[/.orchid]
+ ))
+ )))
+
+(`` (def colors/p-y
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
[/.pale_goldenrod]
[/.pale_green]
[/.pale_turquoise]
@@ -169,3 +167,79 @@
[/.yellow_green]
))
)))
+
+(`` (def .public documentation
+ (List $.Documentation)
+ (list.partial ($.module /._
+ "")
+
+ (,, (with_template [<name>]
+ [(description <name>)]
+
+ [/.alice_blue]
+ [/.antique_white]
+ [/.aqua]
+ [/.aquamarine]
+ [/.azure]
+ [/.beige]
+ [/.bisque]
+ [/.black]
+ [/.blanched_almond]
+ [/.blue]
+ [/.blue_violet]
+ [/.brown]
+ [/.burly_wood]
+ [/.cadet_blue]
+ [/.chartreuse]
+ [/.chocolate]
+ [/.coral]
+ [/.cornflower_blue]
+ [/.cornsilk]
+ [/.crimson]
+ [/.cyan]
+ [/.dark_blue]
+ [/.dark_cyan]
+ [/.dark_goldenrod]
+ [/.dark_gray]
+ [/.dark_green]
+ [/.dark_khaki]
+ [/.dark_magenta]
+ [/.dark_olive_green]
+ [/.dark_orange]
+ [/.dark_orchid]
+ [/.dark_red]
+ [/.dark_salmon]
+ [/.dark_sea_green]
+ [/.dark_slate_blue]
+ [/.dark_slate_gray]
+ [/.dark_turquoise]
+ [/.dark_violet]
+ [/.deep_pink]
+ [/.deep_sky_blue]
+ [/.dim_gray]
+ [/.dodger_blue]
+ [/.fire_brick]
+ [/.floral_white]
+ [/.forest_green]
+ [/.fuchsia]
+ [/.gainsboro]
+ [/.ghost_white]
+ [/.gold]
+ [/.goldenrod]
+ [/.gray]
+ [/.green]
+ [/.green_yellow]
+ [/.honey_dew]
+ [/.hot_pink]
+ [/.indian_red]
+ [/.indigo]
+ [/.ivory]
+ [/.khaki]
+ ))
+
+ (all list#composite
+ colors/d-k
+ colors/l-o
+ colors/p-y
+ )
+ )))
diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux
index e5e324f22..f370ef501 100644
--- a/stdlib/source/documentation/lux/data/text/encoding.lux
+++ b/stdlib/source/documentation/lux/data/text/encoding.lux
@@ -6,12 +6,180 @@
[text (.only \n)
["%" \\format (.only format)]]
[collection
- ["[0]" list]]]]]
+ ["[0]" list (.use "[1]#[0]" monoid)]]]]]
[\\library
["[0]" /]]
["[0]" /
["[1][0]" utf8]])
+(def description
+ (template (_ <name>)
+ [($.definition <name>
+ (format "'" (/.name <name>) "' text encoding. "))]))
+
+(`` (def all/ibm
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
+ [/.ibm_037]
+ [/.ibm_273]
+ [/.ibm_277]
+ [/.ibm_278]
+ [/.ibm_280]
+ [/.ibm_284]
+ [/.ibm_285]
+ [/.ibm_290]
+ [/.ibm_297]
+ [/.ibm_300]
+ [/.ibm_420]
+ [/.ibm_424]
+ [/.ibm_437]
+ [/.ibm_500]
+ [/.ibm_737]
+ [/.ibm_775]
+ [/.ibm_833]
+ [/.ibm_834]
+ [/.ibm_838]
+ [/.ibm_850]
+ [/.ibm_852]
+ [/.ibm_855]
+ [/.ibm_856]
+ [/.ibm_857]
+ [/.ibm_858]
+ [/.ibm_860]
+ [/.ibm_861]
+ [/.ibm_862]
+ [/.ibm_863]
+ [/.ibm_864]
+ [/.ibm_865]
+ [/.ibm_866]
+ [/.ibm_868]
+ [/.ibm_869]
+ [/.ibm_870]
+ [/.ibm_871]
+ [/.ibm_874]
+ [/.ibm_875]
+ [/.ibm_918]
+ [/.ibm_921]
+ [/.ibm_922]
+ [/.ibm_930]
+ [/.ibm_933]
+ [/.ibm_935]
+ [/.ibm_937]
+ [/.ibm_939]
+ [/.ibm_942]
+ [/.ibm_942c]
+ [/.ibm_943]
+ [/.ibm_943c]
+ [/.ibm_948]
+ [/.ibm_949]
+ [/.ibm_949c]
+ [/.ibm_950]
+ [/.ibm_964]
+ [/.ibm_970]
+ [/.ibm_1006]
+ [/.ibm_1025]
+ [/.ibm_1026]
+ [/.ibm_1046]
+ [/.ibm_1047]
+ [/.ibm_1097]
+ [/.ibm_1098]
+ [/.ibm_1112]
+ [/.ibm_1122]
+ [/.ibm_1123]
+ [/.ibm_1124]
+ [/.ibm_1140]
+ [/.ibm_1141]
+ [/.ibm_1142]
+ [/.ibm_1143]
+ [/.ibm_1144]
+ [/.ibm_1145]
+ [/.ibm_1146]
+ [/.ibm_1147]
+ [/.ibm_1148]
+ [/.ibm_1149]
+ [/.ibm_1166]
+ [/.ibm_1364]
+ [/.ibm_1381]
+ [/.ibm_1383]
+ [/.ibm_33722]
+ ))
+ )))
+
+(`` (def all/iso-mac
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
+ [/.iso_2022_cn]
+ [/.iso2022_cn_cns]
+ [/.iso2022_cn_gb]
+ [/.iso_2022_jp]
+ [/.iso_2022_jp_2]
+ [/.iso_2022_kr]
+ [/.iso_8859_1]
+ [/.iso_8859_2]
+ [/.iso_8859_3]
+ [/.iso_8859_4]
+ [/.iso_8859_5]
+ [/.iso_8859_6]
+ [/.iso_8859_7]
+ [/.iso_8859_8]
+ [/.iso_8859_9]
+ [/.iso_8859_11]
+ [/.iso_8859_13]
+ [/.iso_8859_15]
+
+ [/.mac_arabic]
+ [/.mac_central_europe]
+ [/.mac_croatian]
+ [/.mac_cyrillic]
+ [/.mac_dingbat]
+ [/.mac_greek]
+ [/.mac_hebrew]
+ [/.mac_iceland]
+ [/.mac_roman]
+ [/.mac_romania]
+ [/.mac_symbol]
+ [/.mac_thai]
+ [/.mac_turkish]
+ [/.mac_ukraine]
+ ))
+ )))
+
+(`` (def all/utf-koi8
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
+ [/.utf_8]
+ [/.utf_16]
+ [/.utf_32]
+
+ [/.windows_31j]
+ [/.windows_874]
+ [/.windows_949]
+ [/.windows_950]
+ [/.windows_1250]
+ [/.windows_1252]
+ [/.windows_1251]
+ [/.windows_1253]
+ [/.windows_1254]
+ [/.windows_1255]
+ [/.windows_1256]
+ [/.windows_1257]
+ [/.windows_1258]
+ [/.windows_iso2022jp]
+ [/.windows_50220]
+ [/.windows_50221]
+
+ [/.cesu_8]
+ [/.koi8_r]
+ [/.koi8_u]
+ ))
+ )))
+
(`` (def .public documentation
(List $.Documentation)
(list.partial ($.module /._
@@ -23,153 +191,15 @@
"Encoding formats for text.")
(,, (with_template [<name>]
- [($.definition <name>
- (format "'" (/.name <name>) "' text encoding. "))]
+ [(description <name>)]
[/.ascii]
-
- [/.ibm_037]
- [/.ibm_273]
- [/.ibm_277]
- [/.ibm_278]
- [/.ibm_280]
- [/.ibm_284]
- [/.ibm_285]
- [/.ibm_290]
- [/.ibm_297]
- [/.ibm_300]
- [/.ibm_420]
- [/.ibm_424]
- [/.ibm_437]
- [/.ibm_500]
- [/.ibm_737]
- [/.ibm_775]
- [/.ibm_833]
- [/.ibm_834]
- [/.ibm_838]
- [/.ibm_850]
- [/.ibm_852]
- [/.ibm_855]
- [/.ibm_856]
- [/.ibm_857]
- [/.ibm_858]
- [/.ibm_860]
- [/.ibm_861]
- [/.ibm_862]
- [/.ibm_863]
- [/.ibm_864]
- [/.ibm_865]
- [/.ibm_866]
- [/.ibm_868]
- [/.ibm_869]
- [/.ibm_870]
- [/.ibm_871]
- [/.ibm_874]
- [/.ibm_875]
- [/.ibm_918]
- [/.ibm_921]
- [/.ibm_922]
- [/.ibm_930]
- [/.ibm_933]
- [/.ibm_935]
- [/.ibm_937]
- [/.ibm_939]
- [/.ibm_942]
- [/.ibm_942c]
- [/.ibm_943]
- [/.ibm_943c]
- [/.ibm_948]
- [/.ibm_949]
- [/.ibm_949c]
- [/.ibm_950]
- [/.ibm_964]
- [/.ibm_970]
- [/.ibm_1006]
- [/.ibm_1025]
- [/.ibm_1026]
- [/.ibm_1046]
- [/.ibm_1047]
- [/.ibm_1097]
- [/.ibm_1098]
- [/.ibm_1112]
- [/.ibm_1122]
- [/.ibm_1123]
- [/.ibm_1124]
- [/.ibm_1140]
- [/.ibm_1141]
- [/.ibm_1142]
- [/.ibm_1143]
- [/.ibm_1144]
- [/.ibm_1145]
- [/.ibm_1146]
- [/.ibm_1147]
- [/.ibm_1148]
- [/.ibm_1149]
- [/.ibm_1166]
- [/.ibm_1364]
- [/.ibm_1381]
- [/.ibm_1383]
- [/.ibm_33722]
-
- [/.iso_2022_cn]
- [/.iso2022_cn_cns]
- [/.iso2022_cn_gb]
- [/.iso_2022_jp]
- [/.iso_2022_jp_2]
- [/.iso_2022_kr]
- [/.iso_8859_1]
- [/.iso_8859_2]
- [/.iso_8859_3]
- [/.iso_8859_4]
- [/.iso_8859_5]
- [/.iso_8859_6]
- [/.iso_8859_7]
- [/.iso_8859_8]
- [/.iso_8859_9]
- [/.iso_8859_11]
- [/.iso_8859_13]
- [/.iso_8859_15]
-
- [/.mac_arabic]
- [/.mac_central_europe]
- [/.mac_croatian]
- [/.mac_cyrillic]
- [/.mac_dingbat]
- [/.mac_greek]
- [/.mac_hebrew]
- [/.mac_iceland]
- [/.mac_roman]
- [/.mac_romania]
- [/.mac_symbol]
- [/.mac_thai]
- [/.mac_turkish]
- [/.mac_ukraine]
-
- [/.utf_8]
- [/.utf_16]
- [/.utf_32]
-
- [/.windows_31j]
- [/.windows_874]
- [/.windows_949]
- [/.windows_950]
- [/.windows_1250]
- [/.windows_1252]
- [/.windows_1251]
- [/.windows_1253]
- [/.windows_1254]
- [/.windows_1255]
- [/.windows_1256]
- [/.windows_1257]
- [/.windows_1258]
- [/.windows_iso2022jp]
- [/.windows_50220]
- [/.windows_50221]
-
- [/.cesu_8]
- [/.koi8_r]
- [/.koi8_u]
))
- /utf8.documentation
+ (all list#composite
+ all/ibm
+ all/iso-mac
+ all/utf-koi8
+ /utf8.documentation
+ )
)))
diff --git a/stdlib/source/documentation/lux/data/text/regex.lux b/stdlib/source/documentation/lux/data/text/regex.lux
index 090b88c41..8de3d70e7 100644
--- a/stdlib/source/documentation/lux/data/text/regex.lux
+++ b/stdlib/source/documentation/lux/data/text/regex.lux
@@ -63,7 +63,7 @@
($.definition /.pattern
"Allows you to test text against regular expressions."
- [(case some_text
+ [(when some_text
(pattern "(\d{3})-(\d{3})-(\d{4})"
[_ country_code area_code place_code])
do_some_thing_when_number
diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux
index 7aa0355ab..78002e97c 100644
--- a/stdlib/source/documentation/lux/data/text/unicode/block.lux
+++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux
@@ -4,42 +4,27 @@
["$" documentation]
[data
["[0]" text (.only)
- ["%" \\format (.only format)]]]
+ ["%" \\format (.only format)]]
+ [collection
+ ["[0]" list (.use "[1]#[0]" monoid)]]]
[math
[number
["[0]" nat (.use "hex#[0]" hex)]]]]]
[\\library
["[0]" /]])
-(`` (def .public documentation
- (List $.Documentation)
- (list ($.module /._
- "")
-
- ($.definition /.monoid)
- ($.definition /.start)
- ($.definition /.end)
- ($.definition /.size)
- ($.definition /.equivalence)
- ($.definition /.hash)
-
- ($.definition /.Block
- "A block of valid unicode characters.")
-
- ($.definition /.block
- ""
- [(block start additional)])
+(def description
+ (template (_ <name>)
+ [($.definition <name>
+ (let [[_ name] (symbol <name>)]
+ (format (hex#encoded (/.start <name>))
+ "-" (hex#encoded (/.end <name>))
+ " | " (text.replaced "_" " " name))))]))
- ($.definition /.within?
- ""
- [(within? block char)])
-
- (,, (with_template [<name>]
- [($.definition <name>
- (let [[_ name] (symbol <name>)]
- (format (hex#encoded (/.start <name>))
- "-" (hex#encoded (/.end <name>))
- " | " (text.replaced "_" " " name))))]
+(`` (def all_1/4
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
[/.basic_latin]
[/.latin_1_supplement]
@@ -74,6 +59,14 @@
[/.hangul_jamo]
[/.ethiopic]
[/.cherokee]
+ ))
+ )))
+
+(`` (def all_2/4
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
[/.unified_canadian_aboriginal_syllabics]
[/.ogham]
[/.runic]
@@ -93,6 +86,15 @@
[/.superscripts_and_subscripts]
[/.currency_symbols]
[/.combining_diacritical_marks_for_symbols]
+ ))
+ )))
+
+(`` (def all_3/4
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
+ [/.combining_diacritical_marks_for_symbols]
[/.letterlike_symbols]
[/.number_forms]
[/.arrows]
@@ -120,6 +122,14 @@
[/.hiragana]
[/.katakana]
[/.bopomofo]
+ ))
+ )))
+
+(`` (def all_4/4
+ (List $.Documentation)
+ (list (,, (with_template [<name>]
+ [(description <name>)]
+
[/.hangul_compatibility_jamo]
[/.kanbun]
[/.bopomofo_extended]
@@ -151,3 +161,34 @@
[/.lower_case]
))
)))
+
+(def .public documentation
+ (List $.Documentation)
+ (list.partial ($.module /._
+ "")
+
+ ($.definition /.monoid)
+ ($.definition /.start)
+ ($.definition /.end)
+ ($.definition /.size)
+ ($.definition /.equivalence)
+ ($.definition /.hash)
+
+ ($.definition /.Block
+ "A block of valid unicode characters.")
+
+ ($.definition /.block
+ ""
+ [(block start additional)])
+
+ ($.definition /.within?
+ ""
+ [(within? block char)])
+
+ (all list#composite
+ all_1/4
+ all_2/4
+ all_3/4
+ all_4/4
+ )
+ ))
diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux
index 3048cea36..980ad9a6e 100644
--- a/stdlib/source/documentation/lux/ffi.js.lux
+++ b/stdlib/source/documentation/lux/ffi.js.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except int char)
+ [lux (.except)
["$" documentation]
[data
["[0]" text (.only \n)
@@ -8,60 +8,61 @@
[\\library
["[0]" /]])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [($.definition (/.Object brand))
- ($.definition /.Function)
- ($.definition /.Symbol)
- ($.definition /.Null)
- ($.definition /.Undefined)
- ($.definition /.Boolean)
- ($.definition /.Number)
- ($.definition /.String)
- ($.definition /.null?)
- ($.definition /.on_browser?)
- ($.definition /.on_nashorn?)
- ($.definition /.on_node_js?)
+(def .public documentation
+ (List $.Documentation)
+ (list ($.module /._
+ "")
- ($.definition /.null
- "The null pointer.")
+ ($.definition (/.Object brand))
+ ($.definition /.Function)
+ ($.definition /.Symbol)
+ ($.definition /.Null)
+ ($.definition /.Undefined)
+ ($.definition /.Boolean)
+ ($.definition /.Number)
+ ($.definition /.String)
+ ($.definition /.null?)
+ ($.definition /.on_browser?)
+ ($.definition /.on_nashorn?)
+ ($.definition /.on_node_js?)
- ($.definition /.import
- "Easily import types, methods, functions and constants."
- [(import Uint8Array
- "[1]::[0]")
+ ($.definition /.null
+ "The null pointer.")
- (import TextEncoder
- "[1]::[0]"
- (new [/.String])
- (encode [/.String] Uint8Array))
+ ($.definition /.import
+ "Easily import types, methods, functions and constants."
+ [(import Uint8Array
+ "[1]::[0]")
- (import TextDecoder
- "[1]::[0]"
- (new [/.String])
- (decode [/.String] String))])
+ (import TextEncoder
+ "[1]::[0]"
+ (new [/.String])
+ (encode [/.String] Uint8Array))
- ($.definition /.type_of
- "The type of an object, as text."
- [(= "boolean"
- (type_of true))]
- [(= "number"
- (type_of +123.456))]
- [(= "string"
- (type_of "789"))]
- [(= "function"
- (type_of (function (_ value) value)))])
+ (import TextDecoder
+ "[1]::[0]"
+ (new [/.String])
+ (decode [/.String] String))])
- ($.definition /.global
- "Allows using definitions from the JavaScript host platform."
- [(global .Frac [Math PI])])
+ ($.definition /.type_of
+ "The type of an object, as text."
+ [(= "boolean"
+ (type_of true))]
+ [(= "number"
+ (type_of +123.456))]
+ [(= "string"
+ (type_of "789"))]
+ [(= "function"
+ (type_of (function (_ value) value)))])
- ($.definition /.function
- (format "Allows defining closures/anonymous-functions in the form that JavaScript expects."
- \n "This is useful for adapting Lux functions for usage by JavaScript code.")
- [(is /.Function
- (function [left right]
- (do_something (as Foo left) (as Bar right))))])]
- []))
+ ($.definition /.global
+ "Allows using definitions from the JavaScript host platform."
+ [(global .Frac [Math PI])])
+
+ ($.definition /.function
+ (format "Allows defining closures/anonymous-functions in the form that JavaScript expects."
+ \n "This is useful for adapting Lux functions for usage by JavaScript code.")
+ [(is /.Function
+ (function [left right]
+ (do_something (as Foo left) (as Bar right))))])
+ ))
diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux
index 52b551378..ca1841a0b 100644
--- a/stdlib/source/documentation/lux/ffi.jvm.lux
+++ b/stdlib/source/documentation/lux/ffi.jvm.lux
@@ -171,7 +171,7 @@
($.definition /.as
(format "Checks whether an object is an instance of a particular class."
\n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.")
- [(case (as String "YOLO")
+ [(when (as String "YOLO")
{.#Some value_as_string}
{.#None})])
diff --git a/stdlib/source/documentation/lux/ffi.lua.lux b/stdlib/source/documentation/lux/ffi.lua.lux
index 0763955d6..b4713841f 100644
--- a/stdlib/source/documentation/lux/ffi.lua.lux
+++ b/stdlib/source/documentation/lux/ffi.lua.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except int char)
+ [lux (.except)
["$" documentation]
[data
["[0]" text (.only \n)
@@ -8,27 +8,28 @@
[\\library
["[0]" /]])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [($.definition (/.Object brand))
- ($.definition /.Nil)
- ($.definition /.Function)
- ($.definition /.Table)
- ($.definition /.Boolean)
- ($.definition /.Integer)
- ($.definition /.Float)
- ($.definition /.String)
+(def .public documentation
+ (List $.Documentation)
+ (list ($.module /._
+ "")
- ($.definition /.import
- "Easily import types, methods, functions and constants."
- [(import (os/getenv [..String] "io" "?" ..String))])
+ ($.definition (/.Object brand))
+ ($.definition /.Nil)
+ ($.definition /.Function)
+ ($.definition /.Table)
+ ($.definition /.Boolean)
+ ($.definition /.Integer)
+ ($.definition /.Float)
+ ($.definition /.String)
- ($.definition /.closure
- (format "Allows defining closures/anonymous-functions in the form that Lua expects."
- \n "This is useful for adapting Lux functions for usage by Lua code.")
- [(is ..Function
- (closure [left right]
- (do_something (as Foo left) (as Bar right))))])]
- []))
+ ($.definition /.import
+ "Easily import types, methods, functions and constants."
+ [(import (os/getenv [..String] "io" "?" ..String))])
+
+ ($.definition /.function
+ (format "Allows defining closures/anonymous-functions in the form that Lua expects."
+ \n "This is useful for adapting Lux functions for usage by Lua code.")
+ [(is ..Function
+ (function [left right]
+ (do_something (as Foo left) (as Bar right))))])
+ ))
diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux
index a862963d8..2400b4f37 100644
--- a/stdlib/source/documentation/lux/ffi.old.lux
+++ b/stdlib/source/documentation/lux/ffi.old.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except int char)
+ [lux (.except)
["$" documentation]
[data
["[0]" text (.only \n)
@@ -8,213 +8,214 @@
[\\library
["[0]" /]])
-(`` (.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [($.definition /.Privacy)
- ($.definition /.State)
- ($.definition /.Inheritance)
-
- (,, (with_template [<name> <from> <to>]
- [($.definition <name>
- "Type converter.")]
-
- [/.byte_to_long "java.lang.Byte" "java.lang.Long"]
-
- [/.short_to_long "java.lang.Short" "java.lang.Long"]
-
- [/.double_to_int "java.lang.Double" "java.lang.Integer"]
- [/.double_to_long "java.lang.Double" "java.lang.Long"]
- [/.double_to_float "java.lang.Double" "java.lang.Float"]
-
- [/.float_to_int "java.lang.Float" "java.lang.Integer"]
- [/.float_to_long "java.lang.Float" "java.lang.Long"]
- [/.float_to_double "java.lang.Float" "java.lang.Double"]
-
- [/.int_to_byte "java.lang.Integer" "java.lang.Byte"]
- [/.int_to_short "java.lang.Integer" "java.lang.Short"]
- [/.int_to_long "java.lang.Integer" "java.lang.Long"]
- [/.int_to_float "java.lang.Integer" "java.lang.Float"]
- [/.int_to_double "java.lang.Integer" "java.lang.Double"]
- [/.int_to_char "java.lang.Integer" "java.lang.Character"]
-
- [/.long_to_byte "java.lang.Long" "java.lang.Byte"]
- [/.long_to_short "java.lang.Long" "java.lang.Short"]
- [/.long_to_int "java.lang.Long" "java.lang.Integer"]
- [/.long_to_float "java.lang.Long" "java.lang.Float"]
- [/.long_to_double "java.lang.Long" "java.lang.Double"]
-
- [/.char_to_byte "java.lang.Character" "java.lang.Byte"]
- [/.char_to_short "java.lang.Character" "java.lang.Short"]
- [/.char_to_int "java.lang.Character" "java.lang.Integer"]
- [/.char_to_long "java.lang.Character" "java.lang.Long"]
- ))
-
- ($.definition /.class
- "Allows defining JVM classes in Lux code."
- [(class "final" (TestClass A) [Runnable]
- ... Fields
- ("private" foo boolean)
- ("private" bar A)
- ("private" baz java/lang/Object)
- ... Methods
- ("public" [] (new [value A]) []
- (exec
- (:= ::foo true)
- (:= ::bar value)
- (:= ::baz "")
- []))
- ("public" (virtual) java/lang/Object
- "")
- ("public" "static" (static) java/lang/Object
- "")
- (Runnable [] (run) void
- []))
- "The tuple corresponds to parent interfaces."
- "An optional super-class can be specified before the tuple. If not specified, java.lang.Object will be assumed."
- "Fields and methods defined in the class can be used with special syntax."
- "For example:"
- "::resolved, for accessing the 'resolved' field."
- "(:= ::resolved true) for modifying it."
- "(::new! []) for calling the class's constructor."
- "(::resolve! container [value]) for calling the 'resolve' method."])
-
- ($.definition /.interface
- "Allows defining JVM interfaces."
- [(interface TestInterface
- ([] foo [boolean String] void "throws" [Exception]))])
-
- ($.definition /.object
- "Allows defining anonymous classes."
- ["The 1st tuple corresponds to class-level type-variables."
- "The 2nd tuple corresponds to parent interfaces."
- "The 3rd tuple corresponds to arguments to the super class constructor."
- "An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed."
- (object [] [Runnable]
- []
- (Runnable [] (run self) void
- (exec (do_something some_value)
- [])))])
-
- ($.definition /.null
- "Null object reference."
- (null))
-
- ($.definition /.null?
- "Test for null object reference."
- [(= (null? (null))
- true)]
- [(= (null? "YOLO")
- false)])
-
- ($.definition /.???
- "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it."
- [(= (??? (is java/lang/String (null)))
- {.#None})]
- [(= (??? "YOLO")
- {.#Some "YOLO"})])
-
- ($.definition /.!!!
- "Takes a (Maybe ObjectType) and returns a ObjectType."
- [(= "foo"
- (!!! (??? "foo")))]
- ["A .#None would get translated into a (null)."
- (= (null)
- (!!! (??? (is java/lang/Thread (null)))))])
-
- ($.definition /.check
- (format "Checks whether an object is an instance of a particular class."
- \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.")
- [(case (check java/lang/String "YOLO")
- {.#Some value_as_string}
- {.#None})])
-
- ($.definition /.synchronized
- "Evaluates body, while holding a lock on a given object."
- [(synchronized object_to_be_locked
- (exec
- (do something)
- (do_something else)
- (finish the computation)))])
-
- ($.definition /.to
- "Call a variety of methods on an object. Then, return the object."
- [(to object
- (ClassName::method0 arg0 arg1 arg2)
- (ClassName::method1 arg3 arg4 arg5))])
-
- ($.definition /.import
- (format "Allows importing JVM classes, and using them as types."
- \n "Their methods, fields and enum options can also be imported.")
- [(import java/lang/Object
- "[1]::[0]"
- (new [])
- (equals [java/lang/Object] boolean)
- (wait [int] "io" "try" void))]
- ["Special options can also be given for the return values."
- "'?' means that the values will be returned inside a Maybe type. That way, null becomes .#None."
- "'try' means that the computation might throw an exception, and the return value will be wrapped by the Try type."
- "'io' means the computation has side effects, and will be wrapped by the IO type."
- "These options must show up in the following order ['io' 'try' '?'] (although, each option can be used independently)."
- (import java/lang/String
- "[1]::[0]"
- (new [[byte]])
- ("static" valueOf [char] java/lang/String)
- ("static" valueOf "as" int_valueOf [int] java/lang/String))
-
- (import (java/util/List e)
- "[1]::[0]"
- (size [] int)
- (get [int] e))
-
- (import (java/util/ArrayList a)
- "[1]::[0]"
- ([T] toArray [[T]] [T]))]
- ["The class-type that is generated is of the fully-qualified name."
- "This avoids a clash between the java.util.List type, and Lux's own List type."
- "All enum options to be imported must be specified."
- (import java/lang/Character$UnicodeScript
- "[1]::[0]"
- ("enum" ARABIC CYRILLIC LATIN))]
- ["It should also be noted, the only types that may show up in method arguments or return values may be Java classes, arrays, primitives, void or type-parameters."
- "Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes)."
- (import (lux/concurrency/async/JvmAsync A)
- "[1]::[0]"
- (resolve [A] boolean)
- (poll [] A)
- (wasResolved [] boolean)
- (waitOn [lux/Function] void)
- ("static" [A] make [A] (lux/concurrency/async/JvmAsync A)))]
- ["Also, the names of the imported members will look like Class::member"
- (java/lang/Object::new [])
- (java/lang/Object::equals [other_object] my_object)
- (java/util/List::size [] my_list)
- java/lang/Character$UnicodeScript::LATIN])
-
- ($.definition /.array
- "Create an array of the given type, with the given size."
- [(array java/lang/Object 10)])
-
- ($.definition /.length
- "Gives the length of an array."
- [(length my_array)])
-
- ($.definition /.read!
- "Loads an element from an array."
- [(read! 10 my_array)])
-
- ($.definition /.write!
- "Stores an element into an array."
- [(write! 10 my_object my_array)])
-
- ($.definition /.class_for
- "Loads the class as a java.lang.Class object."
- [(is (Primitive "java.lang.Class" ["java.lang.Object"])
- (class_for java/lang/String))])
-
- ($.definition /.type
- ""
- [(is .Type
- (type java/lang/String))])]
- [])))
+(`` (def .public documentation
+ (List $.Documentation)
+ (list ($.module /._
+ "")
+
+ ($.definition /.Privacy)
+ ($.definition /.State)
+ ($.definition /.Inheritance)
+
+ (,, (with_template [<name> <from> <to>]
+ [($.definition <name>
+ "Type converter.")]
+
+ [/.byte_to_long "java.lang.Byte" "java.lang.Long"]
+
+ [/.short_to_long "java.lang.Short" "java.lang.Long"]
+
+ [/.double_to_int "java.lang.Double" "java.lang.Integer"]
+ [/.double_to_long "java.lang.Double" "java.lang.Long"]
+ [/.double_to_float "java.lang.Double" "java.lang.Float"]
+
+ [/.float_to_int "java.lang.Float" "java.lang.Integer"]
+ [/.float_to_long "java.lang.Float" "java.lang.Long"]
+ [/.float_to_double "java.lang.Float" "java.lang.Double"]
+
+ [/.int_to_byte "java.lang.Integer" "java.lang.Byte"]
+ [/.int_to_short "java.lang.Integer" "java.lang.Short"]
+ [/.int_to_long "java.lang.Integer" "java.lang.Long"]
+ [/.int_to_float "java.lang.Integer" "java.lang.Float"]
+ [/.int_to_double "java.lang.Integer" "java.lang.Double"]
+ [/.int_to_char "java.lang.Integer" "java.lang.Character"]
+
+ [/.long_to_byte "java.lang.Long" "java.lang.Byte"]
+ [/.long_to_short "java.lang.Long" "java.lang.Short"]
+ [/.long_to_int "java.lang.Long" "java.lang.Integer"]
+ [/.long_to_float "java.lang.Long" "java.lang.Float"]
+ [/.long_to_double "java.lang.Long" "java.lang.Double"]
+
+ [/.char_to_byte "java.lang.Character" "java.lang.Byte"]
+ [/.char_to_short "java.lang.Character" "java.lang.Short"]
+ [/.char_to_int "java.lang.Character" "java.lang.Integer"]
+ [/.char_to_long "java.lang.Character" "java.lang.Long"]
+ ))
+
+ ($.definition /.class
+ "Allows defining JVM classes in Lux code."
+ [(class "final" (TestClass A) [Runnable]
+ ... Fields
+ ("private" foo boolean)
+ ("private" bar A)
+ ("private" baz java/lang/Object)
+ ... Methods
+ ("public" [] (new [value A]) []
+ (exec
+ (:= ::foo true)
+ (:= ::bar value)
+ (:= ::baz "")
+ []))
+ ("public" (virtual) java/lang/Object
+ "")
+ ("public" "static" (static) java/lang/Object
+ "")
+ (Runnable [] (run) void
+ []))
+ "The tuple corresponds to parent interfaces."
+ "An optional super-class can be specified before the tuple. If not specified, java.lang.Object will be assumed."
+ "Fields and methods defined in the class can be used with special syntax."
+ "For example:"
+ "::resolved, for accessing the 'resolved' field."
+ "(:= ::resolved true) for modifying it."
+ "(::new! []) for calling the class's constructor."
+ "(::resolve! container [value]) for calling the 'resolve' method."])
+
+ ($.definition /.interface
+ "Allows defining JVM interfaces."
+ [(interface TestInterface
+ ([] foo [boolean String] void "throws" [Exception]))])
+
+ ($.definition /.object
+ "Allows defining anonymous classes."
+ ["The 1st tuple corresponds to class-level type-variables."
+ "The 2nd tuple corresponds to parent interfaces."
+ "The 3rd tuple corresponds to arguments to the super class constructor."
+ "An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed."
+ (object [] [Runnable]
+ []
+ (Runnable [] (run self) void
+ (exec (do_something some_value)
+ [])))])
+
+ ($.definition /.null
+ "Null object reference."
+ (null))
+
+ ($.definition /.null?
+ "Test for null object reference."
+ [(= (null? (null))
+ true)]
+ [(= (null? "YOLO")
+ false)])
+
+ ($.definition /.???
+ "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it."
+ [(= (??? (is java/lang/String (null)))
+ {.#None})]
+ [(= (??? "YOLO")
+ {.#Some "YOLO"})])
+
+ ($.definition /.!!!
+ "Takes a (Maybe ObjectType) and returns a ObjectType."
+ [(= "foo"
+ (!!! (??? "foo")))]
+ ["A .#None would get translated into a (null)."
+ (= (null)
+ (!!! (??? (is java/lang/Thread (null)))))])
+
+ ($.definition /.check
+ (format "Checks whether an object is an instance of a particular class."
+ \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.")
+ [(when (check java/lang/String "YOLO")
+ {.#Some value_as_string}
+ {.#None})])
+
+ ($.definition /.synchronized
+ "Evaluates body, while holding a lock on a given object."
+ [(synchronized object_to_be_locked
+ (exec
+ (do something)
+ (do_something else)
+ (finish the computation)))])
+
+ ($.definition /.to
+ "Call a variety of methods on an object. Then, return the object."
+ [(to object
+ (ClassName::method0 arg0 arg1 arg2)
+ (ClassName::method1 arg3 arg4 arg5))])
+
+ ($.definition /.import
+ (format "Allows importing JVM classes, and using them as types."
+ \n "Their methods, fields and enum options can also be imported.")
+ [(import java/lang/Object
+ "[1]::[0]"
+ (new [])
+ (equals [java/lang/Object] boolean)
+ (wait [int] "io" "try" void))]
+ ["Special options can also be given for the return values."
+ "'?' means that the values will be returned inside a Maybe type. That way, null becomes .#None."
+ "'try' means that the computation might throw an exception, and the return value will be wrapped by the Try type."
+ "'io' means the computation has side effects, and will be wrapped by the IO type."
+ "These options must show up in the following order ['io' 'try' '?'] (although, each option can be used independently)."
+ (import java/lang/String
+ "[1]::[0]"
+ (new [[byte]])
+ ("static" valueOf [char] java/lang/String)
+ ("static" valueOf "as" int_valueOf [int] java/lang/String))
+
+ (import (java/util/List e)
+ "[1]::[0]"
+ (size [] int)
+ (get [int] e))
+
+ (import (java/util/ArrayList a)
+ "[1]::[0]"
+ ([T] toArray [[T]] [T]))]
+ ["The class-type that is generated is of the fully-qualified name."
+ "This avoids a clash between the java.util.List type, and Lux's own List type."
+ "All enum options to be imported must be specified."
+ (import java/lang/Character$UnicodeScript
+ "[1]::[0]"
+ ("enum" ARABIC CYRILLIC LATIN))]
+ ["It should also be noted, the only types that may show up in method arguments or return values may be Java classes, arrays, primitives, void or type-parameters."
+ "Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes)."
+ (import (lux/concurrency/async/JvmAsync A)
+ "[1]::[0]"
+ (resolve [A] boolean)
+ (poll [] A)
+ (wasResolved [] boolean)
+ (waitOn [lux/Function] void)
+ ("static" [A] make [A] (lux/concurrency/async/JvmAsync A)))]
+ ["Also, the names of the imported members will look like Class::member"
+ (java/lang/Object::new [])
+ (java/lang/Object::equals [other_object] my_object)
+ (java/util/List::size [] my_list)
+ java/lang/Character$UnicodeScript::LATIN])
+
+ ($.definition /.array
+ "Create an array of the given type, with the given size."
+ [(array java/lang/Object 10)])
+
+ ($.definition /.length
+ "Gives the length of an array."
+ [(length my_array)])
+
+ ($.definition /.read!
+ "Loads an element from an array."
+ [(read! 10 my_array)])
+
+ ($.definition /.write!
+ "Stores an element into an array."
+ [(write! 10 my_object my_array)])
+
+ ($.definition /.class_for
+ "Loads the class as a java.lang.Class object."
+ [(is (Primitive "java.lang.Class" ["java.lang.Object"])
+ (class_for java/lang/String))])
+
+ ($.definition /.type
+ ""
+ [(is .Type
+ (type java/lang/String))])
+ )))
diff --git a/stdlib/source/documentation/lux/ffi.py.lux b/stdlib/source/documentation/lux/ffi.py.lux
index d2da39eff..f73c5eb83 100644
--- a/stdlib/source/documentation/lux/ffi.py.lux
+++ b/stdlib/source/documentation/lux/ffi.py.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except int char)
+ [lux (.except)
["$" documentation]
[data
["[0]" text (.only \n)
@@ -8,48 +8,49 @@
[\\library
["[0]" /]])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [($.definition (/.Object brand))
- ($.definition /.None)
- ($.definition /.Dict)
- ($.definition /.Function)
- ($.definition /.Boolean)
- ($.definition /.Integer)
- ($.definition /.Float)
- ($.definition /.String)
+(def .public documentation
+ (List $.Documentation)
+ (list ($.module /._
+ "")
- ($.definition /.import
- "Easily import types, methods, functions and constants."
- [(import os
- "[1]::[0]"
- ("static" F_OK Integer)
- ("static" R_OK Integer)
- ("static" W_OK Integer)
- ("static" X_OK Integer)
+ ($.definition (/.Object brand))
+ ($.definition /.None)
+ ($.definition /.Dict)
+ ($.definition /.Function)
+ ($.definition /.Boolean)
+ ($.definition /.Integer)
+ ($.definition /.Float)
+ ($.definition /.String)
- ("static" mkdir [String] "io" "try" "?" Any)
- ("static" access [String Integer] "io" "try" Boolean)
- ("static" remove [String] "io" "try" "?" Any)
- ("static" rmdir [String] "io" "try" "?" Any)
- ("static" rename [String String] "io" "try" "?" Any)
- ("static" listdir [String] "io" "try" (Array String)))
+ ($.definition /.import
+ "Easily import types, methods, functions and constants."
+ [(import os
+ "[1]::[0]"
+ ("static" F_OK Integer)
+ ("static" R_OK Integer)
+ ("static" W_OK Integer)
+ ("static" X_OK Integer)
- (import os/path
- "[1]::[0]"
- ("static" isfile [String] "io" "try" Boolean)
- ("static" isdir [String] "io" "try" Boolean)
- ("static" sep String)
- ("static" getsize [String] "io" "try" Integer)
- ("static" getmtime [String] "io" "try" Float))])
+ ("static" mkdir [String] "io" "try" "?" Any)
+ ("static" access [String Integer] "io" "try" Boolean)
+ ("static" remove [String] "io" "try" "?" Any)
+ ("static" rmdir [String] "io" "try" "?" Any)
+ ("static" rename [String String] "io" "try" "?" Any)
+ ("static" listdir [String] "io" "try" (Array String)))
- ($.definition /.function
- (format "Allows defining closures/anonymous-functions in the form that Python expects."
- \n "This is useful for adapting Lux functions for usage by Python code.")
- [(is ..Function
- (function [left right]
- (do_something (as Foo left)
- (as Bar right))))])]
- []))
+ (import os/path
+ "[1]::[0]"
+ ("static" isfile [String] "io" "try" Boolean)
+ ("static" isdir [String] "io" "try" Boolean)
+ ("static" sep String)
+ ("static" getsize [String] "io" "try" Integer)
+ ("static" getmtime [String] "io" "try" Float))])
+
+ ($.definition /.function
+ (format "Allows defining closures/anonymous-functions in the form that Python expects."
+ \n "This is useful for adapting Lux functions for usage by Python code.")
+ [(is ..Function
+ (function [left right]
+ (do_something (as Foo left)
+ (as Bar right))))])
+ ))
diff --git a/stdlib/source/documentation/lux/ffi.rb.lux b/stdlib/source/documentation/lux/ffi.rb.lux
index 24696edc5..bc3f482c1 100644
--- a/stdlib/source/documentation/lux/ffi.rb.lux
+++ b/stdlib/source/documentation/lux/ffi.rb.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except int char)
+ [lux (.except)
["$" documentation]
[data
["[0]" text (.only \n)
@@ -8,35 +8,36 @@
[\\library
["[0]" /]])
-(.def .public documentation
- (.List $.Module)
- ($.module /._
- ""
- [($.definition (/.Object brand))
- ($.definition /.Nil)
- ($.definition /.Function)
- ($.definition /.Integer)
- ($.definition /.Float)
- ($.definition /.String)
+(def .public documentation
+ (List $.Documentation)
+ (list ($.module /._
+ "")
- ($.definition /.import
- "Easily import types, methods, functions and constants."
- [(import Stat
- "[1]::[0]"
- (executable? [] Bit)
- (size Int))
+ ($.definition (/.Object brand))
+ ($.definition /.Nil)
+ ($.definition /.Function)
+ ($.definition /.Integer)
+ ($.definition /.Float)
+ ($.definition /.String)
- (import File "as" RubyFile
- "[1]::[0]"
- ("static" SEPARATOR ..String)
- ("static" open [Path ..String] "io" "try" RubyFile)
- ("static" stat [Path] "io" "try" Stat)
- ("static" delete [Path] "io" "try" Int)
- ("static" file? [Path] "io" "try" Bit)
- ("static" directory? [Path] "io" "try" Bit)
+ ($.definition /.import
+ "Easily import types, methods, functions and constants."
+ [(import Stat
+ "[1]::[0]"
+ (executable? [] Bit)
+ (size Int))
- (read [] "io" "try" Binary)
- (write [Binary] "io" "try" Int)
- (flush [] "io" "try" "?" Any)
- (close [] "io" "try" "?" Any))])]
- []))
+ (import File "as" RubyFile
+ "[1]::[0]"
+ ("static" SEPARATOR ..String)
+ ("static" open [Path ..String] "io" "try" RubyFile)
+ ("static" stat [Path] "io" "try" Stat)
+ ("static" delete [Path] "io" "try" Int)
+ ("static" file? [Path] "io" "try" Bit)
+ ("static" directory? [Path] "io" "try" Bit)
+
+ (read [] "io" "try" Binary)
+ (write [Binary] "io" "try" Int)
+ (flush [] "io" "try" "?" Any)
+ (close [] "io" "try" "?" Any))])
+ ))
diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux
index 45d71946e..766e1740f 100644
--- a/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux
@@ -72,7 +72,7 @@
($.definition /.Branch)
($.definition /.Match)
($.definition /.equivalence)
- ($.definition /.case)
+ ($.definition /.when)
($.definition /.unit)
($.definition /.bit)
($.definition /.nat)
diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux
index b74515da2..af6cc479e 100644
--- a/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux
@@ -124,7 +124,7 @@
($.definition /.constant)
($.definition /.variable/local)
($.definition /.variable/foreign)
- ($.definition /.branch/case)
+ ($.definition /.branch/when)
($.definition /.branch/let)
($.definition /.branch/if)
($.definition /.branch/get)
diff --git a/stdlib/source/documentation/lux/meta/target/python.lux b/stdlib/source/documentation/lux/meta/target/python.lux
index 50263c3b9..656f3373f 100644
--- a/stdlib/source/documentation/lux/meta/target/python.lux
+++ b/stdlib/source/documentation/lux/meta/target/python.lux
@@ -6,16 +6,13 @@
[text (.only \n)
["%" \\format (.only format)]]
[collection
- ["[0]" list]]]]]
+ ["[0]" list (.use "[1]#[0]" monoid)]]]]]
[\\library
["[0]" /]])
-(def .public documentation
+(def all_1/4
(List $.Documentation)
- (list ($.module /._
- "")
-
- ($.definition /.Code)
+ (list ($.definition /.Code)
($.definition /.equivalence)
($.definition /.hash)
($.definition /.manual)
@@ -37,7 +34,11 @@
($.definition /.var)
($.definition /.poly)
($.definition /.keyword)
- ($.definition /.none)
+ ))
+
+(def all_2/4
+ (List $.Documentation)
+ (list ($.definition /.none)
($.definition /.bool)
($.definition /.int)
($.definition /.long)
@@ -69,7 +70,11 @@
($.definition /.//)
($.definition /.%)
($.definition /.**)
- ($.definition /.bit_or)
+ ))
+
+(def all_3/4
+ (List $.Documentation)
+ (list ($.definition /.bit_or)
($.definition /.bit_and)
($.definition /.bit_xor)
($.definition /.bit_shl)
@@ -89,6 +94,11 @@
($.definition /.while)
($.definition /.for_in)
($.definition /.statement)
+ ))
+
+(def all_4/4
+ (List $.Documentation)
+ (list ($.definition /.statement)
($.definition /.pass)
($.definition /.Except)
($.definition /.try)
@@ -111,3 +121,16 @@
($.definition /.__import__/1)
($.definition /.Exception/1)
))
+
+(def .public documentation
+ (List $.Documentation)
+ (list.partial ($.module /._
+ "")
+
+ (all list#composite
+ ..all_1/4
+ ..all_2/4
+ ..all_3/4
+ ..all_4/4
+ )
+ ))
diff --git a/stdlib/source/documentation/lux/world/input/keyboard.lux b/stdlib/source/documentation/lux/world/input/keyboard.lux
index b6fa9b392..3d8d246e8 100644
--- a/stdlib/source/documentation/lux/world/input/keyboard.lux
+++ b/stdlib/source/documentation/lux/world/input/keyboard.lux
@@ -4,16 +4,15 @@
["$" documentation]
[data
["[0]" text (.only \n)
- ["%" \\format (.only format)]]]]]
+ ["%" \\format (.only format)]]
+ [collection
+ ["[0]" list (.use "[1]#[0]" monoid)]]]]]
[\\library
["[0]" /]])
-(def .public documentation
+(def all/characters
(List $.Documentation)
- (list ($.module /._
- "")
-
- ($.definition /.back_space)
+ (list ($.definition /.back_space)
($.definition /.enter)
($.definition /.shift)
($.definition /.control)
@@ -55,7 +54,11 @@
($.definition /.x)
($.definition /.y)
($.definition /.z)
- ($.definition /.num_pad_0)
+ ))
+
+(def all/special
+ (List $.Documentation)
+ (list ($.definition /.num_pad_0)
($.definition /.num_pad_1)
($.definition /.num_pad_2)
($.definition /.num_pad_3)
@@ -97,10 +100,21 @@
($.definition /.f24)
($.definition /.release)
($.definition /.press)
+ ))
- ($.definition /.Key
- "A key from a keyboard, identify by a numeric ID.")
+(def .public documentation
+ (List $.Documentation)
+ (list.partial ($.module /._
+ "")
- ($.definition /.Press
- "A key-press for a key.")
- ))
+ ($.definition /.Key
+ "A key from a keyboard, identify by a numeric ID.")
+
+ ($.definition /.Press
+ "A key-press for a key.")
+
+ (all list#composite
+ ..all/characters
+ ..all/special
+ )
+ ))
diff --git a/stdlib/source/experiment/tool/interpreter.lux b/stdlib/source/experiment/tool/interpreter.lux
index ad8092a5b..cea7bd833 100644
--- a/stdlib/source/experiment/tool/interpreter.lux
+++ b/stdlib/source/experiment/tool/interpreter.lux
@@ -128,7 +128,7 @@
(All (_ anchor expression declaration)
(-> Configuration Code <Interpretation>))
(function (_ state)
- (case (<| (phase.result' state)
+ (when (<| (phase.result' state)
(sharing [anchor expression declaration]
(is (State+ anchor expression declaration)
state)
@@ -213,7 +213,7 @@
(if (and (not multi_line?)
(text#= ..exit_command line))
(at Console<!> write ..farewell_message)
- (case (read_eval_print (revised #source (add_line line) context))
+ (when (read_eval_print (revised #source (add_line line) context))
{try.#Success [context' representation]}
(do !
[_ (at Console<!> write representation)]
diff --git a/stdlib/source/format/lux/data/binary.lux b/stdlib/source/format/lux/data/binary.lux
index 761176a3a..034d4edd7 100644
--- a/stdlib/source/format/lux/data/binary.lux
+++ b/stdlib/source/format/lux/data/binary.lux
@@ -96,7 +96,7 @@
(def .public (or left right)
(All (_ l r) (-> (Format l) (Format r) (Format (Or l r))))
(function (_ altV)
- (case altV
+ (when altV
(^.with_template [<number> <tag> <format>]
[{<tag> caseV}
(let [[caseS caseT] (<format> caseV)]
@@ -126,7 +126,7 @@
(def .public bit
(Format Bit)
- (|>> (pipe.case #0 0 #1 1) ..bits_8))
+ (|>> (pipe.when #0 0 #1 1) ..bits_8))
(with_template [<name> <type>]
[(def .public <name> (Format <type>) ..bits_64)]
@@ -241,7 +241,7 @@
indexed ..nat
quantified (..and (..list again) again)]
(function (_ altV)
- (case altV
+ (when altV
(^.with_template [<number> <tag> <format>]
[{<tag> caseV}
(let [[caseS caseT] (<format> caseV)]
@@ -275,7 +275,7 @@
(let [sequence (..list again)]
(..and ..location
(function (_ altV)
- (case altV
+ (when altV
(^.with_template [<number> <tag> <format>]
[{<tag> caseV}
(let [[caseS caseT] (<format> caseV)]
diff --git a/stdlib/source/format/lux/data/text.lux b/stdlib/source/format/lux/data/text.lux
index f9d79c466..7d237bea2 100644
--- a/stdlib/source/format/lux/data/text.lux
+++ b/stdlib/source/format/lux/data/text.lux
@@ -126,7 +126,7 @@
(def .public (maybe format)
(All (_ a) (-> (Format a) (Format (Maybe a))))
(function (_ value)
- (case value
+ (when value
{.#None}
"{.#None}"
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 16fb17d92..84f0ddf14 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -2997,17 +2997,17 @@
(-> Pattern Macro')
("lux type as" Macro' it))
-(def' .private (case_expansion#macro case_expansion pattern body branches)
+(def' .private (when_expansion#macro when_expansion pattern body branches)
(type_literal (-> (-> (List Code) (Meta (List Code)))
Code Code (List Code)
(Meta (List Code))))
(do meta#monad
[pattern (one_expansion (total_expansion pattern))
pattern (static' #1 pattern)
- branches (case_expansion branches)]
+ branches (when_expansion branches)]
(in (list#partial pattern body branches))))
-(def' .private (case_expansion branches)
+(def' .private (when_expansion branches)
(type_literal (-> (List Code) (Meta (List Code))))
({{#Item [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}]
{#Item body
@@ -3020,46 +3020,46 @@
(do meta#monad
[branches'' ((pattern_macro ("lux type as" Pattern value))
(list#partial (form$ parameters) body branches'))]
- (case_expansion branches''))
- (case_expansion#macro case_expansion [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}] body branches'))
+ (when_expansion branches''))
+ (when_expansion#macro when_expansion [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}] body branches'))
{#None}
- (case_expansion#macro case_expansion [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}] body branches')}
+ (when_expansion#macro when_expansion [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}] body branches')}
?type,value))
{#Item pattern {#Item body branches'}}
- (case_expansion#macro case_expansion pattern body branches')
+ (when_expansion#macro when_expansion pattern body branches')
{#End}
(meta#in (list))
_
- (failure (all text#composite "'case' expects an even number of tokens: " (|> branches
+ (failure (all text#composite "'when' expects an even number of tokens: " (|> branches
(list#each code#encoded)
(list#interposed " ")
list#reversed
(list#mix text#composite ""))))}
branches))
-(def' .public case
+(def' .public when
Macro
(macro (_ tokens)
({{#Item value branches}
(do meta#monad
- [expansion (case_expansion branches)]
+ [expansion (when_expansion branches)]
(in (list (` ((, (variant$ expansion)) (, value))))))
_
- (failure (..wrong_syntax_error (symbol ..case)))}
+ (failure (..wrong_syntax_error (symbol ..when)))}
tokens)))
(def' .private pattern#or
Pattern
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list#partial [_ {#Form patterns}] body branches)
- (case patterns
+ (when patterns
{#End}
(failure "pattern#or cannot have 0 patterns")
@@ -3073,7 +3073,7 @@
(def' .private (symbol? code)
(type_literal (-> Code Bit))
- (case code
+ (when code
[_ {#Symbol _}]
#1
@@ -3083,9 +3083,9 @@
(def' .public let
Macro
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Tuple bindings}] body)
- (case (..pairs bindings)
+ (when (..pairs bindings)
{#Some bindings}
(|> bindings
list#reversed
@@ -3094,7 +3094,7 @@
(let' [[l r] lr]
(if (symbol? l)
(` ({(, l) (, body')} (, r)))
- (` (case (, r) (, l) (, body')))))))
+ (` (when (, r) (, l) (, body')))))))
body)
list
meta#in)
@@ -3108,8 +3108,8 @@
(def' .public function
Macro
(macro (_ tokens)
- (case (is (Maybe [Text Code (List Code) Code])
- (case tokens
+ (when (is (Maybe [Text Code (List Code) Code])
+ (when tokens
(list [_ {#Form (list#partial [_ {#Symbol ["" name]}] head tail)}] body)
{#Some name head tail body}
@@ -3123,7 +3123,7 @@
(if (symbol? arg)
(` ([(, g!name) (, arg)] (, body')))
(` ([(, g!name) (, g!blank)]
- (.case (, g!blank) (, arg) (, body'))))))))]
+ (.when (, g!blank) (, arg) (, body'))))))))]
(meta#in (list (nest (..local$ g!name) head
(list#mix (nest g!blank) body (list#reversed tail))))))
@@ -3138,7 +3138,7 @@
(def' .private (parsed parser tokens)
(type_literal (All (_ a) (-> (Parser a) (List Code) (Maybe a))))
- (case (parser tokens)
+ (when (parser tokens)
{#Some [(list) it]}
{#Some it}
@@ -3157,12 +3157,12 @@
(-> (Parser l)
(Parser r)
(Parser (Or l r)))))
- (case (leftP tokens)
+ (when (leftP tokens)
{#Some [tokens left]}
{#Some [tokens {#Left left}]}
_
- (case (rightP tokens)
+ (when (rightP tokens)
{#Some [tokens right]}
{#Some [tokens {#Right right}]}
@@ -3175,7 +3175,7 @@
(-> (Parser a)
(Parser a)
(Parser a))))
- (case (leftP tokens)
+ (when (leftP tokens)
{#None}
(rightP tokens)
@@ -3211,7 +3211,7 @@
(All (_ a)
(-> (Parser a)
(Parser (List a)))))
- (case (itP tokens)
+ (when (itP tokens)
{#Some [tokens head]}
(do maybe#monad
[it (someP itP tokens)
@@ -3238,7 +3238,7 @@
(All (_ a)
(-> (Parser a)
(Parser (Maybe a)))))
- (case (itP tokens)
+ (when (itP tokens)
{#Some [tokens it]}
{#Some [tokens {#Some it}]}
@@ -3249,7 +3249,7 @@
(type_literal
(All (_ a)
(-> (Parser a) (Parser a))))
- (case tokens
+ (when tokens
(list#partial [_ {#Tuple input}] tokens')
(do maybe#monad
[it (parsed itP input)]
@@ -3262,7 +3262,7 @@
(type_literal
(All (_ a)
(-> (Parser a) (Parser a))))
- (case tokens
+ (when tokens
(list#partial [_ {#Form input}] tokens')
(do maybe#monad
[it (parsed itP input)]
@@ -3273,7 +3273,7 @@
(def' .private (bindingP tokens)
(type_literal (Parser [Text Code]))
- (case tokens
+ (when tokens
(list#partial [_ {#Symbol ["" name]}] value &rest)
{#Some [&rest [name value]]}
@@ -3282,7 +3282,7 @@
(def' .private (endP tokens)
(type_literal (Parser Any))
- (case tokens
+ (when tokens
(list)
{#Some [tokens []]}
@@ -3291,7 +3291,7 @@
(def' .private (anyP tokens)
(type_literal (Parser Code))
- (case tokens
+ (when tokens
(list#partial code tokens')
{#Some [tokens' code]}
@@ -3300,7 +3300,7 @@
(def' .private (localP tokens)
(type_literal (-> (List Code) (Maybe [(List Code) Text])))
- (case tokens
+ (when tokens
(list#partial [_ {#Symbol ["" local]}] tokens')
{#Some [tokens' local]}
@@ -3309,7 +3309,7 @@
(def' .private (symbolP tokens)
(type_literal (-> (List Code) (Maybe [(List Code) Symbol])))
- (case tokens
+ (when tokens
(list#partial [_ {#Symbol it}] tokens')
{#Some [tokens' it]}
@@ -3319,7 +3319,7 @@
(with_template [<parser> <item_type> <item_parser>]
[(def' .private (<parser> tokens)
(type_literal (-> (List Code) (Maybe (List <item_type>))))
- (case tokens
+ (when tokens
{#End}
{#Some {#End}}
@@ -3337,7 +3337,7 @@
(with_template [<parser> <parameter_type> <parameters_parser>]
[(def' .private (<parser> tokens)
(type_literal (Parser [Text (List <parameter_type>)]))
- (case tokens
+ (when tokens
(list#partial [_ {#Form local_declaration}] tokens')
(do maybe#monad
[% (localP local_declaration)
@@ -3357,9 +3357,9 @@
(def' .private (export_policyP tokens)
(type_literal (-> (List Code) [(List Code) Code]))
- (case tokens
+ (when tokens
(list#partial candidate tokens')
- (case candidate
+ (when candidate
[_ {#Bit it}]
[tokens' candidate]
@@ -3390,7 +3390,7 @@
(def' .private (bodyP tokens)
(type_literal (-> (List Code) (Maybe [(List Code) [(Maybe Code) Code]])))
- (case tokens
+ (when tokens
... TB
(list#partial type body tokens')
{#Some [tokens' [{#Some type} body]]}
@@ -3415,16 +3415,16 @@
(def' .public def
Macro
(macro (_ tokens)
- (case (definitionP tokens)
+ (when (definitionP tokens)
{#Some [export_policy name parameters ?type body]}
- (let [body (case parameters
+ (let [body (when parameters
{#End}
body
_
(` (function ((, (..local$ name)) (,* parameters))
(, body))))
- body (case ?type
+ body (when ?type
{#Some type}
(` (is (, type)
(, body)))
@@ -3441,7 +3441,7 @@
(with_template [<name> <form> <message>]
[(def .public <name>
(macro (_ tokens)
- (case (list#reversed tokens)
+ (when (list#reversed tokens)
(list#partial last init)
(meta#in (list (list#mix (is (-> Code Code Code)
(function (_ pre post) (` <form>)))
@@ -3464,10 +3464,10 @@
(def maybe#else
(macro (_ tokens state)
- (case tokens
+ (when tokens
(list else maybe)
(let [g!temp (is Code [dummy_location {#Symbol ["" ""]}])
- code (` (case (, maybe)
+ code (` (when (, maybe)
{.#Some (, g!temp)}
(, g!temp)
@@ -3480,7 +3480,7 @@
(def (text#all_split_by splitter input)
(-> Text Text (List Text))
- (case (..index splitter input)
+ (when (..index splitter input)
{#None}
(list input)
@@ -3496,7 +3496,7 @@
(def (item idx xs)
(All (_ a)
(-> Nat (List a) (Maybe a)))
- (case xs
+ (when xs
{#End}
{#None}
@@ -3508,7 +3508,7 @@
... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction
(def (reduced env type)
(-> (List Type) Type Type)
- (case type
+ (when type
{#Sum left right}
{#Sum (reduced env left) (reduced env right)}
@@ -3519,7 +3519,7 @@
{#Apply (reduced env arg) (reduced env func)}
{#UnivQ ?local_env ?local_def}
- (case ?local_env
+ (when ?local_env
{#End}
{#UnivQ env ?local_def}
@@ -3527,7 +3527,7 @@
type)
{#ExQ ?local_env ?local_def}
- (case ?local_env
+ (when ?local_env
{#End}
{#ExQ env ?local_def}
@@ -3538,7 +3538,7 @@
{#Function (reduced env ?input) (reduced env ?output)}
{#Parameter idx}
- (case (item idx env)
+ (when (item idx env)
{#Some parameter}
parameter
@@ -3554,7 +3554,7 @@
(def (applied_type param type_fn)
(-> Type Type (Maybe Type))
- (case type_fn
+ (when type_fn
{#UnivQ env body}
{#Some (reduced (list#partial type_fn param env) body)}
@@ -3574,7 +3574,7 @@
(def (interface_methods type)
(-> Type (Maybe (List Type)))
- (case type
+ (when type
{#Product _}
{#Some (flat_tuple type)}
@@ -3605,7 +3605,7 @@
..#scopes scopes ..#type_context types ..#host host
..#seed seed ..#expected expected ..#location location ..#extensions extensions
..#scope_type_vars scope_type_vars ..#eval _eval] state]
- (case (property#value name modules)
+ (when (property#value name modules)
{#Some module}
{#Right state module}
@@ -3621,7 +3621,7 @@
..#definitions definitions
..#imports _
..#module_state _] =module]]
- (case (property#value name definitions)
+ (when (property#value name definitions)
{#Some {#Slot [exported type group index]}}
(meta#in [index
(list#each (function (_ slot)
@@ -3635,7 +3635,7 @@
(def (record_slots type)
(-> Type (Meta (Maybe [(List Symbol) (List Type)])))
- (case type
+ (when type
{#Apply arg func}
(record_slots func)
@@ -3653,9 +3653,9 @@
..#definitions definitions
..#imports _
..#module_state _] =module]]
- (case (property#value name definitions)
+ (when (property#value name definitions)
{#Some {#Type [exported? {#Named _ _type} {#Right slots}]}}
- (case (interface_methods _type)
+ (when (interface_methods _type)
{#Some members}
(meta#in {#Some [(list#each (function (_ slot) [module slot])
{#Item slots})
@@ -3677,7 +3677,7 @@
..#scopes scopes ..#type_context types ..#host host
..#seed seed ..#expected expected ..#location location ..#extensions extensions
..#scope_type_vars scope_type_vars ..#eval _eval] state]
- (case expected
+ (when expected
{#Some type}
{#Right state type}
@@ -3691,7 +3691,7 @@
implementation_type ..expected_type
tags+type (record_slots implementation_type)
tags (is (Meta (List Symbol))
- (case tags+type
+ (when tags+type
{#Some [tags _]}
(meta#in tags)
@@ -3707,9 +3707,9 @@
members (monad#each meta#monad
(is (-> Code (Meta (List Code)))
(function (_ token)
- (case token
+ (when token
[_ {#Form (list [_ {#Text "lux def"}] [_ {#Symbol ["" slot_name]}] value export_policy)}]
- (case (property#value slot_name tag_mappings)
+ (when (property#value slot_name tag_mappings)
{#Some tag}
(in (list tag value))
@@ -3723,7 +3723,7 @@
(def (text#interposed separator parts)
(-> Text (List Text) Text)
- (case parts
+ (when parts
{#End}
""
@@ -3742,12 +3742,12 @@
(All (_ a)
(-> (-> (List Code) (Maybe [(List Code) a]))
(-> (List Code) (Maybe (List a)))))
- (case tokens
+ (when tokens
{#Item _}
(do maybe#monad
[% (itP tokens)
.let [[tokens' head] %]
- tail (case tokens'
+ tail (when tokens'
{#Item _}
(everyP itP tokens')
@@ -3758,33 +3758,33 @@
{#End}
{#Some (list)}))
-(def (caseP tokens)
+(def (whenP tokens)
(-> (List Code) (Maybe [(List Code) [Text Code]]))
- (case tokens
+ (when tokens
(list#partial [_ {#Variant (list [_ {#Symbol ["" niladic]}])}] tokens')
{#Some [tokens' [niladic (` .Any)]]}
- (list#partial [_ {#Variant (list#partial [_ {#Symbol ["" polyadic]}] caseT)}] tokens')
- {#Some [tokens' [polyadic (` (..Tuple (,* caseT)))]]}
+ (list#partial [_ {#Variant (list#partial [_ {#Symbol ["" polyadic]}] whenT)}] tokens')
+ {#Some [tokens' [polyadic (` (..Tuple (,* whenT)))]]}
_
{#None}))
(def .public Variant
(macro (_ tokens)
- (case (everyP caseP tokens)
- {#Some cases}
- (meta#in (list (` (..Union (,* (list#each product#right cases))))
- (variant$ (list#each (function (_ case)
- (text$ (product#left case)))
- cases))))
+ (when (everyP whenP tokens)
+ {#Some whens}
+ (meta#in (list (` (..Union (,* (list#each product#right whens))))
+ (variant$ (list#each (function (_ when)
+ (text$ (product#left when)))
+ whens))))
{#None}
(failure (..wrong_syntax_error (symbol ..Variant))))))
(def (slotP tokens)
(-> (List Code) (Maybe [(List Code) [Text Code]]))
- (case tokens
+ (when tokens
(list#partial [_ {#Symbol ["" slot]}] type tokens')
{#Some [tokens' [slot type]]}
@@ -3793,9 +3793,9 @@
(def .public Record
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Tuple record}])
- (case (everyP slotP record)
+ (when (everyP slotP record)
{#Some slots}
(meta#in (list (` (..Tuple (,* (list#each product#right slots))))
(tuple$ (list#each (function (_ slot)
@@ -3820,7 +3820,7 @@
(def (textP tokens)
(-> (List Code) (Maybe [(List Code) Text]))
- (case tokens
+ (when tokens
(list#partial [_ {#Text it}] tokens')
{#Some [tokens' it]}
@@ -3832,9 +3832,9 @@
({[_ {#Form {#Item [_ {#Symbol declarer}] parameters}}]
(do meta#monad
[declaration (single_expansion (form$ (list#partial (symbol$ declarer) parameters)))]
- (case declaration
+ (when declaration
(list type [_ {#Variant tags}])
- (case (everyP textP tags)
+ (when (everyP textP tags)
{#Some tags}
(meta#in [type {#Some {#Left tags}}])
@@ -3842,7 +3842,7 @@
(failure "Improper type-definition syntax"))
(list type [_ {#Tuple slots}])
- (case (everyP textP slots)
+ (when (everyP textP slots)
{#Some slots}
(meta#in [type {#Some {#Right slots}}])
@@ -3861,7 +3861,7 @@
(def .public type
(macro (_ tokens)
- (case (typeP tokens)
+ (when (typeP tokens)
{#Some [export_policy name args type_codes]}
(do meta#monad
[type+labels?? (..type_declaration type_codes)
@@ -3869,23 +3869,23 @@
.let' [type_name (local$ name)
[type labels??] type+labels??
type' (is (Maybe Code)
- (case args
+ (when args
{#End}
{#Some type}
_
{#Some (` (.All ((, type_name) (,* (list#each local$ args)))
(, type)))}))]]
- (case type'
+ (when type'
{#Some type''}
(let [typeC (` {.#Named [(, (text$ module_name))
(, (text$ name))]
(..type_literal (, type''))})]
- (meta#in (list (case labels??
+ (meta#in (list (when labels??
{#Some labels}
(` ("lux def type tagged" (, type_name)
(, typeC)
- (, (case labels
+ (, (when labels
{#Left tags}
(` {(,* (list#each text$ tags))})
@@ -3945,7 +3945,7 @@
(-> Text Text Text Text)
((is (-> Text Text Text)
(function (again left right)
- (case (..text#split_by pattern right)
+ (when (..text#split_by pattern right)
{#Some [pre post]}
(again (all "lux text concat" left pre replacement) post)
@@ -3974,20 +3974,20 @@
(def (normal_parallel_path' hierarchy root)
(-> Text Text Text)
- (case [(text#split_by ..module_separator hierarchy)
+ (when [(text#split_by ..module_separator hierarchy)
(text#split_by ..parallel_hierarchy_sigil root)]
[{#Some [_ hierarchy']}
{#Some ["" root']}]
(normal_parallel_path' hierarchy' root')
_
- (case root
+ (when root
"" hierarchy
_ (all text#composite root ..module_separator hierarchy))))
(def (normal_parallel_path hierarchy root)
(-> Text Text (Maybe Text))
- (case (text#split_by ..parallel_hierarchy_sigil root)
+ (when (text#split_by ..parallel_hierarchy_sigil root)
{#Some ["" root']}
{#Some (normal_parallel_path' hierarchy root')}
@@ -3996,7 +3996,7 @@
(def (relative_ups relatives input)
(-> Nat Text Nat)
- (case ("lux text index" relatives ..module_separator input)
+ (when ("lux text index" relatives ..module_separator input)
{#None}
relatives
@@ -4007,7 +4007,7 @@
(def (list#after amount list)
(All (_ a) (-> Nat (List a) (List a)))
- (case [amount list]
+ (when [amount list]
(pattern#or [0 _]
[_ {#End}])
list
@@ -4017,7 +4017,7 @@
(def (absolute_module_name nested? relative_root module)
(-> Bit Text Text (Meta Text))
- (case (relative_ups 0 module)
+ (when (relative_ups 0 module)
0
(meta#in (if nested?
(all "lux text concat" relative_root ..module_separator module)
@@ -4033,7 +4033,7 @@
list#reversed
(text#interposed ..module_separator))
clean ("lux text clip" relatives (|> module "lux text size" ("lux i64 -" relatives)) module)
- output (case ("lux text size" clean)
+ output (when ("lux text size" clean)
0 prefix
_ (all text#composite prefix ..module_separator clean))]
(meta#in output))
@@ -4048,17 +4048,17 @@
[imports' (monad#each meta#monad
(is (-> Code (Meta (List Importation)))
(function (_ token)
- (case token
+ (when token
... Nested
[_ {#Tuple (list#partial [_ {#Symbol ["" module_name]}] extra)}]
(do meta#monad
- [absolute_module_name (case (normal_parallel_path relative_root module_name)
+ [absolute_module_name (when (normal_parallel_path relative_root module_name)
{#Some parallel_path}
(in parallel_path)
{#None}
(..absolute_module_name nested? relative_root module_name))
- extra,referral (case (referrals_parser #0 extra)
+ extra,referral (when (referrals_parser #0 extra)
{#Some extra,referral}
(in extra,referral)
@@ -4066,7 +4066,7 @@
(failure ""))
.let [[extra referral] extra,referral]
sub_imports (imports_parser #1 absolute_module_name context extra)]
- (in (case referral
+ (in (when referral
{#End}
sub_imports
@@ -4078,13 +4078,13 @@
[_ {#Tuple (list#partial [_ {#Text alias}] [_ {#Symbol ["" module_name]}] extra)}]
(do meta#monad
- [absolute_module_name (case (normal_parallel_path relative_root module_name)
+ [absolute_module_name (when (normal_parallel_path relative_root module_name)
{#Some parallel_path}
(in parallel_path)
{#None}
(..absolute_module_name nested? relative_root module_name))
- extra,referral (case (referrals_parser #1 extra)
+ extra,referral (when (referrals_parser #1 extra)
{#Some extra,referral}
(in extra,referral)
@@ -4093,7 +4093,7 @@
.let [[extra referral] extra,referral]
.let [module_alias (..module_alias {#Item module_name context} alias)]
sub_imports (imports_parser #1 absolute_module_name {#Item module_alias context} extra)]
- (in (case referral
+ (in (when referral
{#End}
sub_imports
@@ -4115,18 +4115,18 @@
(def (exported_definitions module state)
(-> Text (Meta (List Text)))
- (let [[current_module modules] (case state
+ (let [[current_module modules] (when state
[..#info info ..#source source ..#current_module current_module ..#modules modules
..#scopes scopes ..#type_context types ..#host host
..#seed seed ..#expected expected ..#location location ..#extensions extensions
..#scope_type_vars scope_type_vars ..#eval _eval]
[current_module modules])]
- (case (property#value module modules)
+ (when (property#value module modules)
{#Some =module}
(let [to_alias (list#each (is (-> [Text Global]
(List Text))
(function (_ [name definition])
- (case definition
+ (when definition
{#Alias _}
(list)
@@ -4152,7 +4152,7 @@
{#None}
{#Left (all text#composite
"Unknown module: " (text#encoded module) \n
- "Current module: " (case current_module
+ "Current module: " (when current_module
{#Some current_module}
(text#encoded current_module)
@@ -4168,7 +4168,7 @@
(def (list#only p xs)
(All (_ a)
(-> (-> a Bit) (List a) (List a)))
- (case xs
+ (when xs
{#End}
(list)
@@ -4177,13 +4177,13 @@
{#Item x (list#only p xs')}
(list#only p xs'))))
-(def (is_member? cases name)
+(def (is_member? whens name)
(-> (List Text) Text Bit)
- (let [output (list#mix (function (_ case prev)
+ (let [output (list#mix (function (_ when prev)
(or prev
- (text#= case name)))
+ (text#= when name)))
#0
- cases)]
+ whens)]
output))
(def (test_referrals current_module imported_module all_defs referred_defs)
@@ -4202,7 +4202,7 @@
(def .public only
(macro (_ tokens)
- (case (..parsed (all ..andP
+ (when (..parsed (all ..andP
..textP
..textP
..textP
@@ -4233,7 +4233,7 @@
(def .public except
(macro (_ tokens)
- (case (..parsed (all ..andP
+ (when (..parsed (all ..andP
..textP
..textP
..textP
@@ -4257,7 +4257,7 @@
..#scopes scopes ..#type_context types ..#host host
..#seed seed ..#expected expected ..#location location ..#extensions extensions
..#scope_type_vars scope_type_vars ..#eval _eval] state]
- (case (property#value expected_module modules)
+ (when (property#value expected_module modules)
{#None}
{#None}
@@ -4266,12 +4266,12 @@
..#module_aliases _
..#imports _
..#module_state _]}
- (case (property#value expected_short definitions)
+ (when (property#value expected_short definitions)
{#None}
{#None}
{#Some definition}
- (case definition
+ (when definition
{#Alias real_name}
(definition_type real_name state)
@@ -4289,7 +4289,7 @@
(def (type_variable idx bindings)
(-> Nat (List [Nat (Maybe Type)]) (Maybe Type))
- (case bindings
+ (when bindings
{#End}
{#End}
@@ -4306,31 +4306,31 @@
(function (_ compiler)
(let [temp (is (Either Text [Lux Type])
(if (text#= "" module)
- (case (in_env name compiler)
+ (when (in_env name compiler)
{#Some implementation_type}
{#Right [compiler implementation_type]}
_
- (case (definition_type [current_module name] compiler)
+ (when (definition_type [current_module name] compiler)
{#Some implementation_type}
{#Right [compiler implementation_type]}
_
{#Left (all text#composite "Unknown var: " (symbol#encoded full_name))}))
- (case (definition_type full_name compiler)
+ (when (definition_type full_name compiler)
{#Some implementation_type}
{#Right [compiler implementation_type]}
_
{#Left (all text#composite "Unknown var: " (symbol#encoded full_name))})))]
- (case temp
+ (when temp
{#Right [compiler {#Var type_id}]}
(let [[..#info _ ..#source _ ..#current_module _ ..#modules _
..#scopes _ ..#type_context type_context ..#host _
..#seed _ ..#expected _ ..#location _ ..#extensions extensions
..#scope_type_vars _ ..#eval _eval] compiler
[..#ex_counter _ ..#var_counter _ ..#var_bindings var_bindings] type_context]
- (case (type_variable type_id var_bindings)
+ (when (type_variable type_id var_bindings)
{#None}
temp
@@ -4343,9 +4343,9 @@
(def (list#all choice items)
(All (_ a b) (-> (-> a (Maybe b)) (List a) (List b)))
- (case items
+ (when items
{#Item head tail}
- (case (choice head)
+ (when (choice head)
{#Some head}
{#Item head (list#all choice tail)}
@@ -4389,7 +4389,7 @@
next (|> layer
(list#each product#right)
list#conjoint)]]
- (case next
+ (when next
{#End}
(in [pattern body])
@@ -4398,19 +4398,19 @@
[.let [sub_value (tuple$ (list#each (|>> product#left symbol$) next))]
sub_pattern,sub_body (open_layers alias (list#each product#right next) body)
.let [[sub_pattern sub_body] sub_pattern,sub_body]]
- (in [pattern (` (case (, sub_value)
+ (in [pattern (` (when (, sub_value)
(, sub_pattern)
(, sub_body)))])))))
(def .public open
(pattern
(macro (_ tokens)
- (case tokens
+ (when tokens
(list#partial [_ {#Form (list [_ {#Text alias}])}] body branches)
(do meta#monad
[g!temp (..generated_symbol "temp")]
(in (list#partial g!temp
- (` (..case (, g!temp)
+ (` (..when (, g!temp)
(..open (, g!temp) (, (text$ alias)))
(, body)))
branches)))
@@ -4421,7 +4421,7 @@
(do meta#monad
[init_type (type_definition name)
implementation_evidence (record_slots init_type)]
- (case implementation_evidence
+ (when implementation_evidence
{#None}
(failure (text#composite "Can only 'open' implementations: " (type#encoded init_type)))
@@ -4436,9 +4436,9 @@
(def .public cond
(macro (_ tokens)
- (case (list#reversed tokens)
+ (when (list#reversed tokens)
(list#partial else branches')
- (case (pairs branches')
+ (when (pairs branches')
{#Some branches'}
(meta#in (list (list#mix (is (-> [Code Code] Code Code)
(function (_ branch else)
@@ -4456,7 +4456,7 @@
(def (enumeration' idx xs)
(All (_ a)
(-> Nat (List a) (List [Nat a])))
- (case xs
+ (when xs
{#Item x xs'}
{#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')}
@@ -4470,7 +4470,7 @@
(def .public the
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Symbol slot'}] record)
(do meta#monad
[slot (normal slot')
@@ -4478,7 +4478,7 @@
.let [[idx tags exported? type] output]
g!_ (..generated_symbol "_")
g!output (..generated_symbol "")]
- (case (interface_methods type)
+ (when (interface_methods type)
{#Some members}
(let [pattern (|> (zipped_2 tags (enumeration members))
(list#each (is (-> [Symbol [Nat Type]] (List Code))
@@ -4524,7 +4524,7 @@
g!_)))
tuple$)
source+ (` ({(, pattern) (, g!output)} (, source)))]]
- (case output
+ (when output
{#Some [tags' members']}
(do meta#monad
[decls' (monad#each meta#monad
@@ -4544,7 +4544,7 @@
(do meta#monad
[interface (type_definition implementation)
output (record_slots interface)]
- (case output
+ (when output
{#Some [slots terms]}
(do meta#monad
[.let [g!implementation (symbol$ implementation)]
@@ -4561,7 +4561,7 @@
(def (localized module global)
(-> Text Symbol Symbol)
- (case global
+ (when global
["" local]
[module local]
@@ -4570,7 +4570,7 @@
(def .public use
(macro (_ tokens)
- (case (..parsed (all ..andP
+ (when (..parsed (all ..andP
(..maybeP (all ..andP
..textP
..textP
@@ -4581,13 +4581,13 @@
tokens)
{.#Some [current_module,imported_module,import_alias alias implementations]}
(let [[current_module imported_module import_alias]
- (case current_module,imported_module,import_alias
+ (when current_module,imported_module,import_alias
{#Some [current_module imported_module import_alias]}
[current_module imported_module import_alias]
{#None}
["" "" ""])]
- (case implementations
+ (when implementations
{#Left implementations}
(do meta#monad
[declarations (|> implementations
@@ -4600,7 +4600,7 @@
[pre_defs,implementations (is (Meta [(List Code) (List Code)])
(monad#mix meta#monad
(function (_ it [pre_defs implementations])
- (case it
+ (when it
[_ {#Symbol _}]
(in [pre_defs
{#Item it implementations}])
@@ -4636,7 +4636,7 @@
(def (referrals module_name extra)
(-> Text (List Code) (Meta (List Referral)))
(do meta#monad
- [extra,referral (case (referrals_parser #0 extra)
+ [extra,referral (when (referrals_parser #0 extra)
{#Some extra,referral}
(in extra,referral)
@@ -4644,7 +4644,7 @@
(failure ""))
.let [[extra referral] extra,referral]
current_module current_module_name]
- (case extra
+ (when extra
{#End}
(in referral)
@@ -4659,7 +4659,7 @@
(def .public refer
(macro (_ tokens)
- (case tokens
+ (when tokens
(list#partial [_ {#Text imported_module}] [_ {#Text alias}] options)
(do meta#monad
[referrals (..referrals imported_module options)
@@ -4677,7 +4677,7 @@
(def .public with
(macro (_ tokens)
- (case (..parsed (..andP ..anyP ..anyP)
+ (when (..parsed (..andP ..anyP ..anyP)
tokens)
{.#Some [implementation expression]}
(meta#in (list (` (..let [(..open (, (text$ (alias_stand_in 0)))) (, implementation)]
@@ -4688,7 +4688,7 @@
(def .public at
(macro (_ tokens)
- (case tokens
+ (when tokens
(list implementation [_ {#Symbol member}])
(meta#in (list (` (..with (, implementation) (, (symbol$ member))))))
@@ -4700,13 +4700,13 @@
(def .public has
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Symbol slot'}] value record)
(do meta#monad
[slot (normal slot')
output (..type_slot slot)
.let [[idx tags exported? type] output]]
- (case (interface_methods type)
+ (when (interface_methods type)
{#Some members}
(do meta#monad
[pattern' (monad#each meta#monad
@@ -4738,7 +4738,7 @@
(failure "has can only use records.")))
(list [_ {#Tuple slots}] value record)
- (case slots
+ (when slots
{#End}
(failure (..wrong_syntax_error (symbol ..has)))
@@ -4784,13 +4784,13 @@
(def .public revised
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Symbol slot'}] fun record)
(do meta#monad
[slot (normal slot')
output (..type_slot slot)
.let [[idx tags exported? type] output]]
- (case (interface_methods type)
+ (when (interface_methods type)
{#Some members}
(do meta#monad
[pattern' (monad#each meta#monad
@@ -4822,7 +4822,7 @@
(failure "revised can only use records.")))
(list [_ {#Tuple slots}] fun record)
- (case slots
+ (when slots
{#End}
(failure (..wrong_syntax_error (symbol ..revised)))
@@ -4855,12 +4855,12 @@
(def .private with_template#pattern
(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)]
@@ -4896,12 +4896,12 @@
(def (interleaved xs ys)
(All (_ a)
(-> (List a) (List a) (List a)))
- (case xs
+ (when xs
{#End}
{#End}
{#Item x xs'}
- (case ys
+ (when ys
{#End}
{#End}
@@ -4910,7 +4910,7 @@
(def (type_code type)
(-> Type Code)
- (case type
+ (when type
{#Primitive name params}
(` {.#Primitive (, (text$ name)) (, (untemplated_list (list#each type_code params)))})
@@ -4941,22 +4941,22 @@
(def .public loop
(macro (_ tokens)
- (let [?params (case tokens
+ (let [?params (when tokens
(list [_ {#Form (list name [_ {#Tuple bindings}])}] body)
{#Some [name bindings body]}
_
{#None})]
- (case ?params
+ (when ?params
{#Some [name bindings body]}
- (case (pairs bindings)
+ (when (pairs bindings)
{#Some pairs}
(let [vars (list#each product#left pairs)
inits (list#each product#right pairs)]
(if (every? symbol? inits)
(do meta#monad
[inits' (is (Meta (List Symbol))
- (case (monad#each maybe#monad symbol_name inits)
+ (when (monad#each maybe#monad symbol_name inits)
{#Some inits'} (meta#in inits')
{#None} (failure (..wrong_syntax_error (symbol ..loop)))))
init_types (monad#each meta#monad type_definition inits')
@@ -4985,7 +4985,7 @@
(def .public with_expansions
(let [with_expansions' (is (-> Text (List Code) Code (List Code))
(function (with_expansions' label tokens target)
- (case target
+ (when target
(pattern#or [_ {#Bit _}]
[_ {#Nat _}]
[_ {#Int _}]
@@ -5007,7 +5007,7 @@
[#Variant]
[#Tuple]))))]
(macro (_ tokens)
- (case (parsed (andP (tupleP (someP bindingP)) (someP anyP)) tokens)
+ (when (parsed (andP (tupleP (someP bindingP)) (someP anyP)) tokens)
{#Some [bindings bodies]}
(loop (again [bindings bindings
map (is (Property_List (List Code))
@@ -5018,10 +5018,10 @@
(list#conjoint (list#each (with_expansions' binding expansion) it)))
(list it)
map)))]
- (case bindings
+ (when bindings
{#Item [var_name expr] &rest}
(do meta#monad
- [expansion (case (normal expr)
+ [expansion (when (normal expr)
(list expr)
(single_expansion expr)
@@ -5045,7 +5045,7 @@
(def .public as_expected
(macro (_ tokens)
- (case tokens
+ (when tokens
(list expr)
(do meta#monad
[type ..expected_type]
@@ -5059,7 +5059,7 @@
(function (_ compiler)
{#Right [compiler (the #location compiler)]}))]
(macro (_ tokens)
- (case tokens
+ (when tokens
{#End}
(do meta#monad
[location location
@@ -5073,7 +5073,7 @@
(def .public type_of
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Symbol var_name}])
(do meta#monad
[var_type (type_definition var_name)]
@@ -5106,7 +5106,7 @@
(` (`' (, (with_replacements replacement_environment
template))))))]
(macro (_ tokens)
- (case (templateP tokens)
+ (when (templateP tokens)
{#Some [name args input_templates]}
(do meta#monad
[g!tokens (..generated_symbol "tokens")
@@ -5114,7 +5114,7 @@
g!_ (..generated_symbol "_")
this_module ..current_module_name]
(in (list (` (..macro ((, (local$ name)) (, g!tokens) (, g!compiler))
- (case (, g!tokens)
+ (when (, g!tokens)
(list (,* (list#each local$ args)))
{.#Right [(, g!compiler)
(list (,* (list#each (instantiated_template (simple_replacement_environment args))
@@ -5143,7 +5143,7 @@
(def .public char
(macro (_ tokens compiler)
- (case tokens
+ (when tokens
(list [_ {#Text input}])
(if (|> input "lux text size" ("lux i64 =" 1))
(|> input ("lux text char" 0)
@@ -5160,7 +5160,7 @@
{#Right [compiler (the [#info #target] compiler)]}))
platform_name (is (-> Code (Meta Text))
(function (_ choice)
- (case choice
+ (when choice
[_ {#Text platform}]
(..meta#in platform)
@@ -5169,7 +5169,7 @@
[symbol (..global_symbol symbol)
type+value (..definition_value symbol)
.let [[type value] type+value]]
- (case (anonymous_type type)
+ (when (anonymous_type type)
{#Primitive "#Text" {#End}}
(in (as ..Text value))
@@ -5184,9 +5184,9 @@
\n "Must be either a text literal or a symbol.")))))
target_pick (is (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code)))
(function (target_pick target options default)
- (case options
+ (when options
{#End}
- (case default
+ (when default
{#None}
(failure (all text#composite "No code for target platform: " target))
@@ -5200,7 +5200,7 @@
(meta#in (list pick))
(target_pick target options' default))))))]
(macro (_ tokens)
- (case (..parsed (..andP (..someP (..andP ..anyP ..anyP))
+ (when (..parsed (..andP (..someP (..andP ..anyP ..anyP))
(..maybeP ..anyP))
tokens)
{.#Some [options default]}
@@ -5214,7 +5214,7 @@
... TODO: Delete "scope_type_vars" (including the #scope_type_vars Lux state) and "parameter" ASAP.
(for "{old}" (these (def (scope_type_vars state)
(Meta (List Nat))
- (case state
+ (when state
[..#info info ..#source source ..#current_module _ ..#modules modules
..#scopes scopes ..#type_context types ..#host host
..#seed seed ..#expected expected ..#location location ..#extensions extensions
@@ -5223,11 +5223,11 @@
(def .public parameter
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Nat idx}])
(do meta#monad
[stvs ..scope_type_vars]
- (case (..item idx (list#reversed stvs))
+ (when (..item idx (list#reversed stvs))
{#Some var_id}
(in (list (` {.#Ex (, (nat$ var_id))})))
@@ -5286,7 +5286,7 @@
(def .public ,,
(..immediate_unquote
(macro (_ it)
- (case it
+ (when it
(list it)
(meta#in (list it))
@@ -5305,20 +5305,20 @@
(def (embedded_expansions code)
(-> Code (Meta [(List Code) Code]))
- (case code
+ (when code
[@ {#Form (list#partial [@symbol {#Symbol original_symbol}] parameters)}]
(with_expansions [<failure> (aggregate_embedded_expansions embedded_expansions @ #Form (list#partial [@symbol {#Symbol original_symbol}] parameters))]
(do meta#monad
[resolved_symbol (..normal original_symbol)
?resolved_symbol (meta#try (..global_symbol resolved_symbol))]
- (case ?resolved_symbol
+ (when ?resolved_symbol
{#Left _}
<failure>
{#Right resolved_symbol}
(do meta#monad
[?type,value (meta#try (..definition_value resolved_symbol))]
- (case ?type,value
+ (when ?type,value
{#Left _}
<failure>
@@ -5343,7 +5343,7 @@
(def .public ``
(macro (_ tokens)
- (case tokens
+ (when tokens
(list raw)
(do meta#monad
[=raw (..embedded_expansions raw)
@@ -5363,7 +5363,7 @@
(def .public try
(macro (_ tokens)
- (case tokens
+ (when tokens
(list expression)
(do meta#monad
[g!_ (..generated_symbol "g!_")]
@@ -5376,7 +5376,7 @@
(def (methodP tokens)
(-> (List Code) (Maybe [(List Code) [Text Code]]))
- (case tokens
+ (when tokens
(list#partial [_ {#Form (list [_ {#Text "lux type check"}]
type
[_ {#Symbol ["" name]}])}]
@@ -5390,7 +5390,7 @@
(macro (_ tokens)
(do meta#monad
[methods' (monad#each meta#monad complete_expansion tokens)]
- (case (everyP methodP (list#conjoint methods'))
+ (when (everyP methodP (list#conjoint methods'))
{#Some methods}
(in (list (` (..Tuple (,* (list#each product#right methods))))
(tuple$ (list#each (|>> product#left text$) methods))))
@@ -5406,13 +5406,13 @@
(, (let$ (local$ name) (` {.#Apply (..Primitive "") (, g!self)})
body)))})))]
(macro (_ tokens)
- (case tokens
+ (when tokens
(list [_ {#Symbol "" name}] body)
(do meta#monad
[body' (complete_expansion body)
g!self (generated_symbol "g!self")
g!dummy (generated_symbol "g!dummy")]
- (case body'
+ (when body'
(list body' labels)
(in (list (recursive_type g!self g!dummy name body') labels))
diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux
index 15a1e96d3..5cf0679df 100644
--- a/stdlib/source/library/lux/abstract/comonad.lux
+++ b/stdlib/source/library/lux/abstract/comonad.lux
@@ -25,8 +25,8 @@
(def .public be
(macro (_ tokens state)
- (case (is (Maybe [(Maybe Text) Code (List Code) Code])
- (case tokens
+ (when (is (Maybe [(Maybe Text) Code (List Code) Code])
+ (when tokens
(list [_ {.#Tuple (list [_ {.#Symbol ["" name]}] comonad)}] [_ {.#Tuple bindings}] body)
{.#Some [{.#Some name} comonad bindings body]}
@@ -36,7 +36,7 @@
_
{.#None}))
{.#Some [?name comonad bindings body]}
- (case (list.pairs bindings)
+ (when (list.pairs bindings)
{.#Some bindings}
(let [[module short] (symbol ..be)
symbol (is (-> Text Code)
@@ -48,7 +48,7 @@
(function (_ binding body')
(with_expansions [<default> (` (|> (, value) (, g!disjoint) ((, g!each) (function ((, g!_) (, var)) (, body')))))]
(let [[var value] binding]
- (case var
+ (when var
[_ {.#Symbol ["" _]}]
<default>
@@ -59,17 +59,17 @@
<default>)))))
body
(list.reversed bindings))]
- {.#Right [state (list (case ?name
+ {.#Right [state (list (when ?name
{.#Some name}
(let [name [location.dummy {.#Symbol ["" name]}]]
- (` (.case (, comonad)
+ (` (.when (, comonad)
(, name)
- (.case (, name)
+ (.when (, name)
[(, g!each) (,' out) (, g!disjoint)]
(, body')))))
{.#None}
- (` (.case (, comonad)
+ (` (.when (, comonad)
[(, g!each) (,' out) (, g!disjoint)]
(, body')))))]})
diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux
index 583be0344..011f9a8d1 100644
--- a/stdlib/source/library/lux/abstract/functor.lux
+++ b/stdlib/source/library/lux/abstract/functor.lux
@@ -16,7 +16,7 @@
(All (_ F G) (-> (Functor F) (Functor G) (Functor (..Or F G))))
(implementation
(def (each f fa|ga)
- (case fa|ga
+ (when fa|ga
{.#Left fa}
{.#Left (f#each f fa)}
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux
index 71f981b3e..f2455e3f8 100644
--- a/stdlib/source/library/lux/abstract/monad.lux
+++ b/stdlib/source/library/lux/abstract/monad.lux
@@ -9,7 +9,7 @@
(def (list#mix f init xs)
(All (_ a b)
(-> (-> b a a) a (List b) a))
- (case xs
+ (when xs
{.#End}
init
@@ -20,7 +20,7 @@
(All (_ a) (-> (List a) Nat))
(loop (again [counter 0
xs xs])
- (case xs
+ (when xs
{.#End}
counter
@@ -36,7 +36,7 @@
(def (pairs xs)
(All (_ a) (-> (List a) (List [a a])))
- (case xs
+ (when xs
{.#Item x1 {.#Item x2 xs'}}
{.#Item [x1 x2] (pairs xs')}
@@ -56,8 +56,8 @@
(def .public do
(macro (_ tokens state)
- (case (is (Maybe [(Maybe Text) Code (List Code) Code])
- (case tokens
+ (when (is (Maybe [(Maybe Text) Code (List Code) Code])
+ (when tokens
(list [_ {.#Tuple (list [_ {.#Symbol ["" name]}] monad)}] [_ {.#Tuple bindings}] body)
{.#Some [{.#Some name} monad bindings body]}
@@ -78,7 +78,7 @@
(function (_ binding body')
(with_expansions [<default> (` (|> (, value) ((, g!each) (function ((, g!_) (, var)) (, body'))) (, g!conjoint)))]
(let [[var value] binding]
- (case var
+ (when var
[_ {.#Symbol ["" _]}]
<default>
@@ -89,17 +89,17 @@
<default>)))))
body
(reversed (pairs bindings)))]
- {.#Right [state (list (case ?name
+ {.#Right [state (list (when ?name
{.#Some name}
(let [name [location.dummy {.#Symbol ["" name]}]]
- (` (.case (, monad)
+ (` (.when (, monad)
(, name)
- (.case (, name)
+ (.when (, name)
[(, g!each) (,' in) (, g!conjoint)]
(, body')))))
{.#None}
- (` (.case (, monad)
+ (` (.when (, monad)
[(, g!each) (,' in) (, g!conjoint)]
(, body')))))]})
{.#Left "'do' bindings must have an even number of parts."})
@@ -120,7 +120,7 @@
(! (List a))))
(let [(open "!#[0]") monad]
(function (again xs)
- (case xs
+ (when xs
{.#End}
(!#in {.#End})
@@ -136,7 +136,7 @@
(M (List b))))
(let [(open "!#[0]") monad]
(function (again xs)
- (case xs
+ (when xs
{.#End}
(!#in {.#End})
@@ -152,7 +152,7 @@
(! (List a))))
(let [(open "!#[0]") monad]
(function (again xs)
- (case xs
+ (when xs
{.#End}
(!#in {.#End})
@@ -170,7 +170,7 @@
(All (_ M a b)
(-> (Monad M) (-> b a (M a)) a (List b)
(M a)))
- (case xs
+ (when xs
{.#End}
(at monad in init)
diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux
index 257d149b3..f0d5aabf8 100644
--- a/stdlib/source/library/lux/abstract/monad/free.lux
+++ b/stdlib/source/library/lux/abstract/monad/free.lux
@@ -15,7 +15,7 @@
(All (_ F) (-> (Functor F) (Functor (Free F))))
(implementation
(def (each f ea)
- (case ea
+ (when ea
{#Pure a}
{#Pure (f a)}
@@ -29,7 +29,7 @@
(..functor dsl))
(def (on ea ef)
- (case [ef ea]
+ (when [ef ea]
[{#Pure f} {#Pure a}]
{#Pure (f a)}
@@ -51,9 +51,9 @@
{#Pure a})
(def (conjoint efefa)
- (case efefa
+ (when efefa
{#Pure efa}
- (case efa
+ (when efa
{#Pure a}
{#Pure a}
diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux
index c321b7c3d..602d65137 100644
--- a/stdlib/source/library/lux/abstract/monad/indexed.lux
+++ b/stdlib/source/library/lux/abstract/monad/indexed.lux
@@ -41,7 +41,7 @@
(Parser Symbol)
(//.do <>.monad
[[module short] <code>.symbol
- _ (<>.assertion "" (case module "" false _ true))]
+ _ (<>.assertion "" (when module "" false _ true))]
(in [module short])))
(def context
@@ -68,7 +68,7 @@
expression <code>.any])
(macro.with_symbols [g!_ g!then]
(let [body (list#mix (function (_ context next)
- (case context
+ (when context
{#Macro macro parameter}
(` ((, (code.symbol macro))
(, parameter)
@@ -81,7 +81,7 @@
(, value)))))
expression
(list.reversed context))]
- (in (list (case ?name
+ (in (list (when ?name
{.#Some name}
(let [name (code.local name)]
(` (let [(, name) (, monad)
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index d82d73232..9113b45d9 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -278,16 +278,6 @@
(function (_ [[stack arg] quote])
[stack (|>> (push arg) quote)]))
-(def .public when
- (All (_ ,,,)
- (type.let [body (=> ,,, ,,,)]
- (=> ,,, [Bit body]
- ,,,)))
- (|>> swap
- (push ..call)
- (push ..drop)
- if))
-
(def .public ?
(All (_ a)
(=> [Bit a a] [a]))
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index 7d7d7ca93..e1eb5ff68 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -40,7 +40,7 @@
(IO (List a))))
(do [! io.monad]
[current (async.value read)]
- (case current
+ (when current
{.#Some [head tail]}
(at ! each (|>> {.#Item head})
(pending tail))
@@ -76,7 +76,7 @@
(do [! async.monad]
[[head tail] |mailbox|
?state' (behavior head state self)]
- (case ?state'
+ (when ?state'
{try.#Failure error}
(let [[_ resolve] (the #obituary (representation self))]
(exec (io.run!
@@ -95,7 +95,7 @@
(|> obituary
async.value
(at io.functor each
- (|>> (pipe.case
+ (|>> (pipe.when
{.#None}
bit.yes
@@ -124,7 +124,7 @@
(loop (again [[|mailbox| resolve] |mailbox|&resolve])
(do !
[|mailbox| (async.value |mailbox|)]
- (case |mailbox|
+ (when |mailbox|
{.#None}
(do !
[resolved? (resolve entry)]
@@ -153,7 +153,7 @@
(function (_ state self)
(do [! async.monad]
[outcome (message state self)]
- (case outcome
+ (when outcome
{try.#Success [state' return]}
(exec
(io.run! (resolve {try.#Success return}))
@@ -169,7 +169,7 @@
(let [[async mail] (..mail message)]
(do async.monad
[outcome (async.future (..mail! mail actor))]
- (case outcome
+ (when outcome
{try.#Success}
async
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index 2e0193fbb..6a4f582de 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -49,7 +49,7 @@
(let [async (representation async)]
(do [! io.monad]
[(^.let old [_value _observers]) (atom.read! async)]
- (case _value
+ (when _value
{.#Some _}
(in false)
@@ -84,7 +84,7 @@
(do [! io.monad]
[.let [async (representation async)]
(^.let old [_value _observers]) (atom.read! async)]
- (case _value
+ (when _value
{.#Some value}
(f (variance.read value))
@@ -100,7 +100,7 @@
(All (_ r w) (-> (Async' r w) (IO Bit)))
(|>> ..value
(at io.functor each
- (|>> (pipe.case
+ (|>> (pipe.when
{.#None}
false
diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux
index 36275bef4..c1b7c9931 100644
--- a/stdlib/source/library/lux/control/concurrency/frp.lux
+++ b/stdlib/source/library/lux/control/concurrency/frp.lux
@@ -105,7 +105,7 @@
(do async.monad
[item_f ff
item_a fa]
- (case [item_f item_a]
+ (when [item_f item_a]
[{.#Some [head_f tail_f]} {.#Some [head_a tail_a]}]
(in {.#Some [(head_f head_a)
(on tail_a tail_f)]})
@@ -136,13 +136,13 @@
(loop (again [mma mma])
(do [! async.monad]
[?mma mma]
- (case ?mma
+ (when ?mma
{.#Some [ma mma']}
(do !
[_ (loop (again [ma ma])
(do !
[?ma ma]
- (case ?ma
+ (when ?ma
{.#Some [a ma']}
(exec
(io.run! (at sink feed a))
@@ -169,9 +169,9 @@
it)])
(do async.monad
[item it]
- (case item
+ (when item
{.#Some [head tail]}
- (case (io.run! (subscriber head))
+ (when (io.run! (subscriber head))
{.#Some _}
(again tail)
@@ -186,7 +186,7 @@
(All (_ a) (-> (-> a Bit) (Channel a) (Channel a)))
(do async.monad
[item it]
- (case item
+ (when item
{.#Some [head tail]}
(let [tail' (only pass? tail)]
(if (pass? head)
@@ -208,7 +208,7 @@
(Async a)))
(do [! async.monad]
[item it]
- (case item
+ (when item
{.#None}
(in init)
@@ -226,7 +226,7 @@
[init]
(do [! async.monad]
[item it]
- (case item
+ (when item
{.#None}
(in {.#None})
@@ -255,7 +255,7 @@
(All (_ s o) (-> (-> s (Async (Maybe [s o]))) s (Channel o)))
(do async.monad
[?next (f init)]
- (in (case ?next
+ (in (when ?next
{.#Some [state output]}
{.#Some [output (iterations f state)]}
@@ -266,7 +266,7 @@
(All (_ a) (-> (Equivalence a) a (Channel a) (Channel a)))
(do async.monad
[item it]
- (case item
+ (when item
{.#Some [head tail]}
(if (at equivalence = previous head)
(distinct' equivalence previous tail)
@@ -279,7 +279,7 @@
(All (_ a) (-> (Equivalence a) (Channel a) (Channel a)))
(do async.monad
[item it]
- (in (case item
+ (in (when item
{.#Some [head tail]}
{.#Some [head (distinct' equivalence head tail)]}
@@ -290,7 +290,7 @@
(All (_ a) (-> (Channel a) (Async (List a))))
(do [! async.monad]
[item it]
- (case item
+ (when item
{.#Some [head tail]}
(at ! each (|>> {.#Item head})
(list tail))
@@ -300,7 +300,7 @@
(def .public (sequential milli_seconds values)
(All (_ a) (-> Nat (List a) (Channel a)))
- (case values
+ (when values
{.#End}
..empty
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index c2fa5c5c1..557f9fca8 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -86,7 +86,7 @@
(if (same? pre post)
(in (exception.except ..semaphore_is_maxed_out [(the #max_positions pre)]))
(do !
- [_ (case (queue.front (the #waiting_list pre))
+ [_ (when (queue.front (the #waiting_list pre))
{.#None}
(in true)
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux
index 9762ffa59..280c0dee8 100644
--- a/stdlib/source/library/lux/control/concurrency/stm.lux
+++ b/stdlib/source/library/lux/control/concurrency/stm.lux
@@ -55,7 +55,7 @@
[banned (monad.only ! (function (_ sink)
(do !
[result (at sink feed (variance.write new_value))]
- (in (case result
+ (in (when result
{try.#Success _}
false
@@ -113,7 +113,7 @@
(def .public (read var)
(All (_ r w) (-> (Var' r w) (STM r)))
(function (_ tx)
- (case (var_value var tx)
+ (when (var_value var tx)
{.#Some value}
[tx value]
@@ -127,7 +127,7 @@
(def (with_updated_var var value tx)
(All (_ r w) (-> (Var' r w) w Tx Tx))
- (case tx
+ (when tx
{.#End}
{.#End}
@@ -146,7 +146,7 @@
(def .public (write value var)
(All (_ r w) (-> w (Var' r w) (STM Any)))
(function (_ tx)
- (case (var_value var tx)
+ (when (var_value var tx)
{.#Some _}
[(with_updated_var var value tx)
[]]
@@ -236,7 +236,7 @@
(loop (again [[|commits| resolve] |commits|&resolve])
(do !
[|commits| (async.value |commits|)]
- (case |commits|
+ (when |commits|
{.#None}
(do io.monad
[resolved? (resolve entry)]
diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux
index 957a052d1..25e1d02d8 100644
--- a/stdlib/source/library/lux/control/concurrency/thread.lux
+++ b/stdlib/source/library/lux/control/concurrency/thread.lux
@@ -111,7 +111,7 @@
(def (execute! action)
(-> (IO Any) Any)
- (case (try (io.run! action))
+ (when (try (io.run! action))
{try.#Failure error}
(exec
(debug.log! (all "lux text concat"
@@ -128,7 +128,7 @@
[]
(java/lang/Runnable [] (run self []) void
(..execute! action)))]
- (case milli_seconds
+ (when milli_seconds
0 (java/util/concurrent/Executor::execute runnable runner)
_ (java/util/concurrent/ScheduledThreadPoolExecutor::schedule runnable (.int milli_seconds) java/util/concurrent/TimeUnit::MILLISECONDS
runner)))]
@@ -176,7 +176,7 @@
(loop (again [_ []])
(do !
[threads (atom.read! ..runner)]
- (case threads
+ (when threads
... And... we're done!
{.#End}
(in [])
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index f311fdb25..834f8afe8 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except except with)
+ [lux (.except except with when)
[abstract
[monad (.only do)]]
[control
@@ -38,7 +38,7 @@
(All (_ e a)
(-> (Exception e) (-> Text a) (Try a)
(Try a)))
- (case try
+ (.when try
{//.#Success output}
{//.#Success output}
@@ -54,7 +54,7 @@
(def .public (otherwise else try)
(All (_ a)
(-> (-> Text a) (Try a) a))
- (case try
+ (.when try
{//.#Success output}
output
@@ -127,7 +127,7 @@
(|> message
(text.replaced text.new_line on_new_line)
(all text#composite padding header header_separator)))))]
- (case entries
+ (.when entries
{.#End}
""
@@ -167,9 +167,9 @@
(def .public (with exception message computation)
(All (_ e a) (-> (Exception e) e (Try a) (Try a)))
- (case computation
+ (.when computation
{//.#Failure error}
- {//.#Failure (case error
+ {//.#Failure (.when error
""
(..error exception message)
diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux
index 3328720e2..376e248f9 100644
--- a/stdlib/source/library/lux/control/function/memo.lux
+++ b/stdlib/source/library/lux/control/function/memo.lux
@@ -25,7 +25,7 @@
(function (_ input)
(do [! state.monad]
[memory state.get]
- (case (dictionary.value input memory)
+ (when (dictionary.value input memory)
{.#Some output}
(in output)
diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux
index 150d0f49f..eab14d2ae 100644
--- a/stdlib/source/library/lux/control/function/mutual.lux
+++ b/stdlib/source/library/lux/control/function/mutual.lux
@@ -52,7 +52,7 @@
(.def .public let
(syntax (_ [functions (<code>.tuple (<>.some ..mutual))
body <code>.any])
- (case functions
+ (when functions
{.#End}
(in (list body))
@@ -105,7 +105,7 @@
(.def .public def
(syntax (_ [functions (<>.many ..definition)])
- (case functions
+ (when functions
{.#End}
(in (list))
diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux
index 4636f701a..2db5daf4a 100644
--- a/stdlib/source/library/lux/control/lazy.lux
+++ b/stdlib/source/library/lux/control/lazy.lux
@@ -29,7 +29,7 @@
(is (Maybe a)
{.#None})))]
(abstraction (function (_ _)
- (case (io.run! (atom.read! cache))
+ (when (io.run! (atom.read! cache))
{.#Some value}
value
diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux
index a3741b3c3..f760d517d 100644
--- a/stdlib/source/library/lux/control/maybe.lux
+++ b/stdlib/source/library/lux/control/maybe.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except list with)
+ [lux (.except list with when)
[abstract
[monoid (.only Monoid)]
[equivalence (.only Equivalence)]
@@ -22,7 +22,7 @@
{.#None})
(def (composite mx my)
- (case mx
+ (.when mx
{.#None}
my
@@ -33,7 +33,7 @@
(Functor Maybe)
(implementation
(def (each f ma)
- (case ma
+ (.when ma
{.#Some a}
{.#Some (f a)}
@@ -47,7 +47,7 @@
(def functor ..functor)
(def (on fa ff)
- (case [ff fa]
+ (.when [ff fa]
[{.#Some f} {.#Some a}]
{.#Some (f a)}
@@ -63,7 +63,7 @@
{.#Some x})
(def (conjoint mma)
- (case mma
+ (.when mma
{.#Some mx}
mx
@@ -75,7 +75,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Maybe a))))
(implementation
(def (= mx my)
- (case [mx my]
+ (.when [mx my]
[{.#None} {.#None}]
true
@@ -92,7 +92,7 @@
(..equivalence (at super equivalence)))
(def (hash value)
- (case value
+ (.when value
{.#None}
1
@@ -113,7 +113,7 @@
(def (conjoint MmMma)
(do monad
[mMma MmMma]
- (case mMma
+ (.when mMma
{.#Some Mma}
Mma
@@ -127,10 +127,10 @@
(def .public else
(macro (_ tokens state)
- (case tokens
+ (.when tokens
(.list else maybe)
(let [g!temp (is Code [location.dummy {.#Symbol ["" ""]}])]
- {.#Right [state (.list (` (.case (, maybe)
+ {.#Right [state (.list (` (.when (, maybe)
{.#Some (, g!temp)}
(, g!temp)
@@ -147,7 +147,7 @@
(def .public (list value)
(All (_ a) (-> (Maybe a) (List a)))
- (case value
+ (.when value
{.#Some value}
(.list value)
@@ -157,7 +157,7 @@
(def .public when
(macro (_ tokens state)
- (case tokens
+ (.when tokens
(.list test then)
{.#Right [state (.list (` (.if (, test)
(, then)
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index d7cf37138..2330b8606 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -21,7 +21,7 @@
(implementation
(def (each f ma)
(function (_ input)
- (case (ma input)
+ (when (ma input)
{try.#Success [input' a]}
{try.#Success [input' (f a)]}
@@ -35,9 +35,9 @@
(def (on fa ff)
(function (_ input)
- (case (ff input)
+ (when (ff input)
{try.#Success [input' f]}
- (case (fa input')
+ (when (fa input')
{try.#Success [input'' a]}
{try.#Success [input'' (f a)]}
@@ -58,7 +58,7 @@
(def (conjoint mma)
(function (_ input)
- (case (mma input)
+ (when (mma input)
{try.#Success [input' ma]}
(ma input')
@@ -76,7 +76,7 @@
(All (_ s a)
(-> (Parser s a) (Parser s (Maybe a))))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' x]}
{try.#Success [input' {.#Some x}]}
@@ -99,12 +99,12 @@
(All (_ s a b)
(-> (Parser s a) (Parser s b) (Parser s (Or a b))))
(function (_ tokens)
- (case (left tokens)
+ (when (left tokens)
{try.#Success [tokens' output]}
{try.#Success [tokens' {0 #0 output}]}
{try.#Failure _}
- (case (right tokens)
+ (when (right tokens)
{try.#Success [tokens' output]}
{try.#Success [tokens' {0 #1 output}]}
@@ -115,7 +115,7 @@
(All (_ s a)
(-> (Parser s a) (Parser s a) (Parser s a)))
(function (_ tokens)
- (case (this tokens)
+ (when (this tokens)
{try.#Failure _}
(that tokens)
@@ -126,7 +126,7 @@
(All (_ s a)
(-> (Parser s a) (Parser s (List a))))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' head]}
(..result (at ..monad each (|>> (list.partial head))
(some parser))
@@ -144,7 +144,7 @@
(def .public (exactly amount parser)
(All (_ s a) (-> Nat (Parser s a) (Parser s (List a))))
- (case amount
+ (when amount
0 (at ..monad in (list))
_ (do [! ..monad]
[x parser]
@@ -160,10 +160,10 @@
(def .public (at_most amount parser)
(All (_ s a) (-> Nat (Parser s a) (Parser s (List a))))
- (case amount
+ (when amount
0 (at ..monad in (list))
_ (function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' x]}
(..result (at ..monad each (|>> {.#Item x})
(at_most (-- amount) parser))
@@ -176,7 +176,7 @@
(All (_ s a) (-> Nat Nat (Parser s a) (Parser s (List a))))
(do [! ..monad]
[minimum (..exactly minimum parser)]
- (case additional
+ (when additional
0 (in minimum)
_ (at ! each (list#composite minimum)
(..at_most additional parser)))))
@@ -185,7 +185,7 @@
(All (_ s a b) (-> (Parser s b) (Parser s a) (Parser s (List a))))
(do [! ..monad]
[?x (..maybe parser)]
- (case ?x
+ (when ?x
{.#Some x}
(|> parser
(..and separator)
@@ -198,7 +198,7 @@
(def .public (not parser)
(All (_ s a) (-> (Parser s a) (Parser s Any)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Failure msg}
{try.#Success [input []]}
@@ -213,7 +213,7 @@
(def .public (lifted operation)
(All (_ s a) (-> (Try a) (Parser s a)))
(function (_ input)
- (case operation
+ (when operation
{try.#Success output}
{try.#Success [input output]}
@@ -223,7 +223,7 @@
(def .public (else value parser)
(All (_ s a) (-> a (Parser s a) (Parser s a)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' output]}
{try.#Success [input' output]}
@@ -263,7 +263,7 @@
(def .public (parses? parser)
(All (_ s a) (-> (Parser s a) (Parser s Bit)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' _]}
{try.#Success [input' true]}
@@ -273,7 +273,7 @@
(def .public (parses parser)
(All (_ s a) (-> (Parser s a) (Parser s Any)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' _]}
{try.#Success [input' []]}
@@ -283,7 +283,7 @@
(def .public (speculative parser)
(All (_ s a) (-> (Parser s a) (Parser s a)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' output]}
{try.#Success [input output]}
@@ -293,9 +293,9 @@
(def .public (codec codec parser)
(All (_ s a z) (-> (Codec a z) (Parser s a) (Parser s z)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Success [input' to_decode]}
- (case (at codec decoded to_decode)
+ (when (at codec decoded to_decode)
{try.#Success value}
{try.#Success [input' value]}
diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux
index 54b0fca51..2221505af 100644
--- a/stdlib/source/library/lux/control/pipe.lux
+++ b/stdlib/source/library/lux/control/pipe.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except let cond if exec case)
+ [lux (.except let cond if exec when)
[abstract
["[0]" monad]]
[control
@@ -65,14 +65,6 @@
[(,* else)]
(, prev)))))))
-(def .public when
- (syntax (_ [test ..body
- then ..body
- prev <code>.any])
- (in (list (` (..cond [(,* test)] [(,* then)]
- []
- (, prev)))))))
-
(def .public while
(syntax (_ [test ..body
then ..body
@@ -88,7 +80,7 @@
steps (<>.some ..body)
prev <code>.any])
(with_symbols [g!temp]
- (.case (list.reversed steps)
+ (.when (list.reversed steps)
(list.partial last_step prev_steps)
(.let [step_bindings (monad.do list.monad
[step (list.reversed prev_steps)]
@@ -117,10 +109,10 @@
[(,* (list#each (function (_ body) (` (|> (, g!temp) (,* body))))
paths))])))))))
-(def .public case
+(def .public when
(syntax (_ [branches (<>.many (<>.and <code>.any <code>.any))
prev <code>.any])
- (in (list (` (.case (, prev)
+ (in (list (` (.when (, prev)
(,* (|> branches
(list#each (function (_ [pattern body]) (list pattern body)))
list#conjoint))))))))
diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux
index 1edddc5a0..e752b57a9 100644
--- a/stdlib/source/library/lux/control/region.lux
+++ b/stdlib/source/library/lux/control/region.lux
@@ -34,7 +34,7 @@
(exception .public [a] (clean_up_error [error Text
output (Try a)])
(format error
- (case output
+ (when output
{try.#Success _}
""
@@ -44,7 +44,7 @@
(def (clean clean_up output)
(All (_ a) (-> (Try Any) (Try a) (Try a)))
- (case clean_up
+ (when clean_up
{try.#Success _}
output
@@ -79,7 +79,7 @@
(function (_ region+cleaners)
(at super each
(function (_ [cleaners' temp])
- [cleaners' (case temp
+ [cleaners' (when temp
{try.#Success value}
{try.#Success (f value)}
@@ -100,9 +100,9 @@
(do super
[[cleaners ef] (ff [region cleaners])
[cleaners ea] (fa [region cleaners])]
- (case ef
+ (when ef
{try.#Success f}
- (case ea
+ (when ea
{try.#Success a}
(in [cleaners {try.#Success (f a)}])
@@ -128,7 +128,7 @@
(function (_ [region cleaners])
(do super
[[cleaners efa] (ffa [region cleaners])]
- (case efa
+ (when efa
{try.#Success fa}
(fa [region cleaners])
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index b7a91758f..1b3d0c2f0 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -30,7 +30,7 @@
(list ["Deadline" (%.date deadline)]
["Today" (%.date today)]
["Message" message]
- ["Code" (case focus
+ ["Code" (when focus
{.#Some focus}
(%.code focus)
@@ -44,7 +44,7 @@
<code>.int)
(do <>.monad
[raw <code>.text]
- (case (at date.codec decoded raw)
+ (when (at date.codec decoded raw)
{try.#Success date}
(in date)
@@ -58,7 +58,7 @@
(let [now (io.run! instant.now)
today (instant.date now)]
(if (date#< deadline today)
- (in (case focus
+ (in (when focus
{.#Some focus}
(list focus)
@@ -73,7 +73,7 @@
focus (<>.maybe <code>.any)])
(in (list (` (..remember (, (code.text (%.date deadline)))
(, (code.text (format <message> " " message)))
- (,* (case focus
+ (,* (when focus
{.#Some focus}
(list focus)
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux
index ca2010ce8..a27c466a6 100644
--- a/stdlib/source/library/lux/control/try.lux
+++ b/stdlib/source/library/lux/control/try.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except with)
+ [lux (.except with when)
[abstract
[apply (.only Apply)]
[equivalence (.only Equivalence)]
@@ -19,7 +19,7 @@
(Functor Try)
(implementation
(def (each f ma)
- (case ma
+ (.when ma
{#Success datum}
{#Success (f datum)}
@@ -33,9 +33,9 @@
(def functor ..functor)
(def (on fa ff)
- (case ff
+ (.when ff
{#Success f}
- (case fa
+ (.when fa
{#Success a}
{#Success (f a)}
@@ -56,7 +56,7 @@
{#Success a})
(def (conjoint mma)
- (case mma
+ (.when mma
{#Success ma}
ma
@@ -79,7 +79,7 @@
(def (conjoint MeMea)
(do monad
[eMea MeMea]
- (case eMea
+ (.when eMea
{#Success Mea}
Mea
@@ -95,7 +95,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Try a))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (.when [reference sample]
[{#Success reference} {#Success sample}]
(_#= reference sample)
@@ -109,7 +109,7 @@
(def .public (trusted try)
(All (_ a)
(-> (Try a) a))
- (case try
+ (.when try
{#Success value}
value
@@ -119,7 +119,7 @@
(def .public (maybe try)
(All (_ a)
(-> (Try a) (Maybe a)))
- (case try
+ (.when try
{#Success value}
{.#Some value}
@@ -130,7 +130,7 @@
(def .public (of_maybe maybe)
(All (_ a)
(-> (Maybe a) (Try a)))
- (case maybe
+ (.when maybe
{.#Some value}
{#Success value}
@@ -140,9 +140,9 @@
(def .public else
(macro (_ tokens compiler)
- (case tokens
+ (.when tokens
(list else try)
- {#Success [compiler (list (` (case (, try)
+ {#Success [compiler (list (` (.when (, try)
{..#Success (,' g!temp)}
(,' g!temp)
@@ -155,7 +155,7 @@
(def .public when
(macro (_ tokens state)
- (case tokens
+ (.when tokens
(.list test then)
(let [code#encoded ("lux in-module" "library/lux" .code#encoded)
text$ ("lux in-module" "library/lux" .text$)]
diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux
index dcb0ad6bb..18b53bb1c 100644
--- a/stdlib/source/library/lux/data/bit.lux
+++ b/stdlib/source/library/lux/data/bit.lux
@@ -31,7 +31,7 @@
(def equivalence ..equivalence)
(def (hash value)
- (case value
+ (when value
#0 2
#1 3))))
@@ -55,7 +55,7 @@
"#0"))
(def (decoded input)
- (case input
+ (when input
"#1" {.#Right #1}
"#0" {.#Right #0}
_ {.#Left "Wrong syntax for Bit."}))))
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index b036bb9dc..1e84ee9c4 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -69,7 +69,7 @@
output ..empty])
(let [idx|output (-- size|output)]
(if (n.> 0 size|output)
- (case (|> (..chunk idx|output input)
+ (when (|> (..chunk idx|output input)
(pipe.cond [(pipe.new (n.= chunk_index idx|output) [])]
[(<op> bit_index)]
@@ -109,7 +109,7 @@
(def .public (not input)
(-> Bits Bits)
- (case (array.size input)
+ (when (array.size input)
0
..empty
@@ -117,7 +117,7 @@
(loop (again [size|output size|output
output ..empty])
(let [idx (-- size|output)]
- (case (|> input (..chunk idx) i64.not .nat)
+ (when (|> input (..chunk idx) i64.not .nat)
0
(again (-- size|output) output)
@@ -133,7 +133,7 @@
(with_template [<name> <op>]
[(def .public (<name> param subject)
(-> Bits Bits Bits)
- (case (n.max (array.size param)
+ (when (n.max (array.size param)
(array.size subject))
0
..empty
@@ -143,7 +143,7 @@
output ..empty])
(let [idx (-- size|output)]
(if (n.> 0 size|output)
- (case (|> (..chunk idx subject)
+ (when (|> (..chunk idx subject)
(<op> (..chunk idx param))
.nat)
0
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index 99badd2bc..a2e1282d5 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -271,7 +271,7 @@
(if (with_bit_position? (to_bit_position hierarchy_idx)
bitmap)
[(++ base_idx)
- (case (array.item base_idx base)
+ (when (array.item base_idx base)
{.#Left sub_node}
(array.has! hierarchy_idx sub_node h_array)
@@ -289,7 +289,7 @@
... So, this test is introduced to detect them.
(def (node#empty? node)
(All (_ k v) (-> (Node k v) Bit))
- (case node
+ (when node
{#Base ..clean_bitmap _}
true
@@ -298,7 +298,7 @@
(def (node#has level hash key val key_hash node)
(All (_ k v) (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v)))
- (case node
+ (when node
... For #Hierarchy nodes, check whether one can add the element to
... a sub-node. If impossible, introduce a new singleton sub-node.
{#Hierarchy _size hierarchy}
@@ -317,7 +317,7 @@
(if (with_bit_position? bit bitmap)
... If so...
(let [idx (base_index bit bitmap)]
- {#Base bitmap (case (array.item idx base)
+ {#Base bitmap (when (array.item idx base)
... If it's being used by a node, add the KV to it.
{.#Left sub_node}
(let [sub_node' (node#has (level_up level) hash key val key_hash sub_node)]
@@ -371,7 +371,7 @@
(if (n.= hash _hash)
... If they're equal, that means the new KV contributes to the
... collisions.
- (case (collision_index key_hash key _colls)
+ (when (collision_index key_hash key _colls)
... If the key was already present in the collisions-list, its
... value gets updated.
{.#Some coll_idx}
@@ -390,7 +390,7 @@
(def (node#lacks level hash key key_hash node)
(All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Node k v)))
- (case node
+ (when node
... For #Hierarchy nodes, find out if there's a valid sub-node for
... the Hash-Code.
{#Hierarchy h_size h_array}
@@ -422,7 +422,7 @@
(let [bit (level_bit_position level hash)]
(if (with_bit_position? bit bitmap)
(let [idx (base_index bit bitmap)]
- (case (array.item idx base)
+ (when (array.item idx base)
... If set, check if it's a sub_node, and remove the KV
... from it.
{.#Left sub_node}
@@ -460,7 +460,7 @@
... For #Collisions nodes, It need to find out if the key already existst.
{#Collisions _hash _colls}
- (case (collision_index key_hash key _colls)
+ (when (collision_index key_hash key _colls)
... If not, then there's nothing to remove.
{.#None}
node
@@ -477,7 +477,7 @@
(def (node#value level hash key key_hash node)
(All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v)))
- (case node
+ (when node
... For #Hierarchy nodes, just look-up the key on its children.
{#Hierarchy _size hierarchy}
(let [index (level_index level hash)]
@@ -489,7 +489,7 @@
{#Base bitmap base}
(let [bit (level_bit_position level hash)]
(if (with_bit_position? bit bitmap)
- (case (array.item (base_index bit bitmap) base)
+ (when (array.item (base_index bit bitmap) base)
{.#Left sub_node}
(node#value (level_up level) hash key key_hash sub_node)
@@ -508,7 +508,7 @@
(def (node#size node)
(All (_ k v) (-> (Node k v) Nat))
- (case node
+ (when node
{#Hierarchy _size hierarchy}
(array.mix (function (_ _ item total)
(n.+ item total))
@@ -520,7 +520,7 @@
(n.+ item total))
0
(array.each (function (_ sub_node')
- (case sub_node'
+ (when sub_node'
{.#Left sub_node} (node#size sub_node)
{.#Right _} 1))
base))
@@ -531,7 +531,7 @@
(def (node#mix f init node)
(All (_ k v a) (-> (-> [k v] a a) a (Node k v) a))
- (case node
+ (when node
{#Hierarchy _size hierarchy}
(array.mix (function (_ _ sub_node current)
(node#mix f current sub_node))
@@ -540,7 +540,7 @@
{#Base bitmap base}
(array.mix (function (_ _ branch current)
- (case branch
+ (when branch
{.#Left sub_node}
(node#mix f current sub_node)
@@ -592,7 +592,7 @@
(def .public (key? dict key)
(All (_ k v) (-> (Dictionary k v) k Bit))
- (case (value key dict)
+ (when (value key dict)
{.#None}
false
@@ -603,13 +603,13 @@
(def .public (has' key val dict)
(All (_ k v) (-> k v (Dictionary k v) (Try (Dictionary k v))))
- (case (value key dict)
+ (when (value key dict)
{.#None} {try.#Success (has key val dict)}
{.#Some _} (exception.except ..key_already_exists [])))
(def .public (revised key f dict)
(All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v)))
- (case (value key dict)
+ (when (value key dict)
{.#None}
dict
@@ -664,7 +664,7 @@
(def .public (composite_with f dict2 dict1)
(All (_ k v) (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v)))
(node#mix (function (_ [key val2] dict)
- (case (value key dict)
+ (when (value key dict)
{.#None}
(has key val2 dict)
@@ -675,7 +675,7 @@
(def .public (re_bound from_key to_key dict)
(All (_ k v) (-> k k (Dictionary k v) (Dictionary k v)))
- (case (value from_key dict)
+ (when (value from_key dict)
{.#None}
dict
@@ -688,7 +688,7 @@
(All (_ k v) (-> (List k) (Dictionary k v) (Dictionary k v)))
(let [[key_hash _] dict]
(list#mix (function (_ key new_dict)
- (case (value key dict)
+ (when (value key dict)
{.#None} new_dict
{.#Some val} (has key val new_dict)))
(empty key_hash)
@@ -701,7 +701,7 @@
(and (n.= (..size reference)
(..size subject))
(list.every? (function (_ [k rv])
- (case (..value k subject)
+ (when (..value k subject)
{.#Some sv}
(,#= rv sv)
@@ -713,13 +713,13 @@
(All (_ k) (Functor (Node k)))
(implementation
(def (each f fa)
- (case fa
+ (when fa
{#Hierarchy size hierarchy}
{#Hierarchy size (array.each (each f) hierarchy)}
{#Base bitmap base}
{#Base bitmap (array.each (function (_ either)
- (case either
+ (when either
{.#Left fa'}
{.#Left (each f fa')}
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index 44848eae6..3541cef42 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -64,7 +64,7 @@
(let [... (open "_#[0]") (the #order dict)
]
(loop (again [node (the #root dict)])
- (case node
+ (when node
{.#None}
{.#None}
@@ -89,7 +89,7 @@
(let [... (open "_#[0]") (the #order dict)
]
(loop (again [node (the #root dict)])
- (case node
+ (when node
{.#None}
false
@@ -105,13 +105,13 @@
(with_template [<name> <side>]
[(def .public (<name> dict)
(All (_ k v) (-> (Dictionary k v) (Maybe v)))
- (case (the #root dict)
+ (when (the #root dict)
{.#None}
{.#None}
{.#Some node}
(loop (again [node node])
- (case (the <side> node)
+ (when (the <side> node)
{.#None}
{.#Some (the #value node)}
@@ -125,7 +125,7 @@
(def .public (size dict)
(All (_ k v) (-> (Dictionary k v) Nat))
(loop (again [node (the #root dict)])
- (case node
+ (when node
{.#None}
0
@@ -140,7 +140,7 @@
(with_template [<name> <other_color> <self_color> <no_change>]
[(def (<name> self)
(All (_ k v) (-> (Node k v) (Node k v)))
- (case (the #color self)
+ (when (the #color self)
{<other_color>}
(.has #color {<self_color>} self)
@@ -154,7 +154,7 @@
(def (with_left addition center)
(All (_ k v) (-> (Node k v) (Node k v) (Node k v)))
- (case (the #color center)
+ (when (the #color center)
{#Red}
(red (the #key center)
(the #value center)
@@ -167,9 +167,9 @@
(the #value center)
{.#Some addition}
(the #right center)))]
- (case (the #color addition)
+ (when (the #color addition)
{#Red}
- (case (the #left addition)
+ (when (the #left addition)
(^.multi {.#Some left}
[(the #color left) {#Red}])
(red (the #key addition)
@@ -181,7 +181,7 @@
(the #right center))})
_
- (case (the #right addition)
+ (when (the #right addition)
(^.multi {.#Some right}
[(the #color right) {#Red}])
(red (the #key right)
@@ -203,7 +203,7 @@
(def (with_right addition center)
(All (_ k v) (-> (Node k v) (Node k v) (Node k v)))
- (case (the #color center)
+ (when (the #color center)
{#Red}
(red (the #key center)
(the #value center)
@@ -216,9 +216,9 @@
(the #value center)
(the #left center)
{.#Some addition}))]
- (case (the #color addition)
+ (when (the #color addition)
{#Red}
- (case (the #right addition)
+ (when (the #right addition)
(^.multi {.#Some right}
[(the #color right) {#Red}])
(red (the #key addition)
@@ -230,7 +230,7 @@
{.#Some (blackened right)})
_
- (case (the #left addition)
+ (when (the #left addition)
(^.multi {.#Some left}
[(the #color left) {#Red}])
(red (the #key left)
@@ -254,7 +254,7 @@
(All (_ k v) (-> k v (Dictionary k v) (Dictionary k v)))
(let [(open "_#[0]") (the #order dict)
root' (loop (again [?root (the #root dict)])
- (case ?root
+ (when ?root
{.#None}
{.#Some (red key value {.#None} {.#None})}
@@ -281,7 +281,7 @@
(def (left_balanced key value ?left ?right)
(All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
- (case ?left
+ (when ?left
(^.multi {.#Some left}
[(the #color left) {#Red}]
[(the #left left) {.#Some left>>left}]
@@ -310,7 +310,7 @@
(def (right_balanced key value ?left ?right)
(All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
- (case ?right
+ (when ?right
(^.multi {.#Some right}
[(the #color right) {#Red}]
[(the #right right) {.#Some right>>right}]
@@ -337,13 +337,13 @@
(def (without_left key value ?left ?right)
(All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
- (case ?left
+ (when ?left
(^.multi {.#Some left}
[(the #color left) {#Red}])
(red key value {.#Some (blackened left)} ?right)
_
- (case ?right
+ (when ?right
(^.multi {.#Some right}
[(the #color right) {#Black}])
(right_balanced key value ?left {.#Some (reddened right)})
@@ -366,13 +366,13 @@
(def (without_right key value ?left ?right)
(All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
- (case ?right
+ (when ?right
(^.multi {.#Some right}
[(the #color right) {#Red}])
(red key value ?left {.#Some (blackened right)})
_
- (case ?left
+ (when ?left
(^.multi {.#Some left}
[(the #color left) {#Black}])
(left_balanced key value {.#Some (reddened left)} ?right)
@@ -395,7 +395,7 @@
(def (prepended ?left ?right)
(All (_ k v) (-> (Maybe (Node k v)) (Maybe (Node k v)) (Maybe (Node k v))))
- (case [?left ?right]
+ (when [?left ?right]
[{.#None} _]
?right
@@ -403,11 +403,11 @@
?left
[{.#Some left} {.#Some right}]
- (case [(the #color left) (the #color right)]
+ (when [(the #color left) (the #color right)]
[{#Red} {#Red}]
(do maybe.monad
[fused (prepended (the #right left) (the #right right))]
- (case (the #color fused)
+ (when (the #color fused)
{#Red}
(in (red (the #key fused)
(the #value fused)
@@ -446,7 +446,7 @@
[{#Black} {#Black}]
(do maybe.monad
[fused (prepended (the #right left) (the #left right))]
- (case (the #color fused)
+ (when (the #color fused)
{#Red}
(in (red (the #key fused)
(the #value fused)
@@ -477,7 +477,7 @@
(All (_ k v) (-> k (Dictionary k v) (Dictionary k v)))
(let [(open "_#[0]") (the #order dict)
[?root found?] (loop (again [?root (the #root dict)])
- (case ?root
+ (when ?root
{.#Some root}
(let [root_key (the #key root)
root_val (the #value root)]
@@ -486,7 +486,7 @@
(the #right root))
true]
(let [go_left? (_#< root_key key)]
- (case (again (if go_left?
+ (when (again (if go_left?
(the #left root)
(the #right root)))
[{.#None} .false]
@@ -494,7 +494,7 @@
[side_outcome _]
(if go_left?
- (case (the #left root)
+ (when (the #left root)
(^.multi {.#Some left}
[(the #color left) {#Black}])
[{.#Some (without_left root_key root_val side_outcome (the #right root))}
@@ -503,7 +503,7 @@
_
[{.#Some (red root_key root_val side_outcome (the #right root))}
false])
- (case (the #right root)
+ (when (the #right root)
(^.multi {.#Some right}
[(the #color right) {#Black}])
[{.#Some (without_right root_key root_val (the #left root) side_outcome)}
@@ -518,7 +518,7 @@
{.#None}
[{.#None} false]
))]
- (case ?root
+ (when ?root
{.#None}
(if found?
(.has #root ?root dict)
@@ -530,7 +530,7 @@
(def .public (revised key transform dict)
(All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v)))
- (case (..value key dict)
+ (when (..value key dict)
{.#Some old}
(..has key (transform old) dict)
@@ -548,7 +548,7 @@
[(def .public (<name> dict)
(All (_ k v) (-> (Dictionary k v) (List <type>)))
(loop (again [node (the #root dict)])
- (case node
+ (when node
{.#None}
(list)
@@ -570,7 +570,7 @@
(let [(open "/#[0]") (the #order reference)]
(loop (again [entriesR (entries reference)
entriesS (entries sample)])
- (case [entriesR entriesS]
+ (when [entriesR entriesS]
[{.#End} {.#End}]
true
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index 4114acd8e..c2dff94fc 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except revised all only with)
+ [lux (.except revised all only with when)
[abstract
[monoid (.only Monoid)]
[apply (.only Apply)]
@@ -30,7 +30,7 @@
(Mix List)
(implementation
(def (mix f init xs)
- (case xs
+ (.when xs
{.#End}
init
@@ -39,7 +39,7 @@
(def .public (mixes f init inputs)
(All (_ a b) (-> (-> a b b) b (List a) (List b)))
- (case inputs
+ (.when inputs
{.#End}
(list init)
@@ -57,7 +57,7 @@
(def .public (only keep? xs)
(All (_ a)
(-> (Predicate a) (List a) (List a)))
- (case xs
+ (.when xs
{.#End}
{.#End}
@@ -68,7 +68,7 @@
(def .public (partition satisfies? list)
(All (_ a) (-> (Predicate a) (List a) [(List a) (List a)]))
- (case list
+ (.when list
{.#End}
[{.#End} {.#End}]
@@ -85,7 +85,7 @@
(def .public partial
(macro (_ tokens state)
- (case (reversed tokens)
+ (.when (reversed tokens)
{.#Item tail heads}
{.#Right [state (list (..mix (function (_ head tail)
(` {.#Item (, head) (, tail)}))
@@ -97,9 +97,9 @@
(def .public (pairs xs)
(All (_ a) (-> (List a) (Maybe (List [a a]))))
- (case xs
+ (.when xs
(partial x1 x2 xs')
- (case (pairs xs')
+ (.when (pairs xs')
{.#Some tail}
{.#Some (partial [x1 x2] tail)}
@@ -117,7 +117,7 @@
(All (_ a)
(-> Nat (List a) (List a)))
(if (n.> 0 n)
- (case xs
+ (.when xs
{.#End}
{.#End}
@@ -133,7 +133,7 @@
[(def .public (<name> predicate xs)
(All (_ a)
(-> (Predicate a) (List a) (List a)))
- (case xs
+ (.when xs
{.#End}
{.#End}
@@ -149,9 +149,9 @@
(def .public (split_at n xs)
(All (_ a)
(-> Nat (List a) [(List a) (List a)]))
- (case n
+ (.when n
0 [{.#End} xs]
- _ (case xs
+ _ (.when xs
{.#End}
[{.#End} {.#End}]
@@ -162,7 +162,7 @@
(def (split_when' predicate ys xs)
(All (_ a)
(-> (Predicate a) (List a) (List a) [(List a) (List a)]))
- (case xs
+ (.when xs
{.#End}
[ys xs]
@@ -179,7 +179,7 @@
(def .public (sub size list)
(All (_ a) (-> Nat (List a) (List (List a))))
- (case list
+ (.when list
{.#End}
{.#End}
@@ -190,14 +190,14 @@
(def .public (repeated n x)
(All (_ a)
(-> Nat a (List a)))
- (case n
+ (.when n
0 {.#End}
_ {.#Item x (repeated (-- n) x)}))
(def (iterations' f x)
(All (_ a)
(-> (-> a (Maybe a)) a (List a)))
- (case (f x)
+ (.when (f x)
{.#Some x'}
{.#Item x (iterations' f x')}
@@ -207,7 +207,7 @@
(def .public (iterations f x)
(All (_ a)
(-> (-> a (Maybe a)) a (List a)))
- (case (f x)
+ (.when (f x)
{.#Some x'}
{.#Item x (iterations' f x')}
@@ -217,12 +217,12 @@
(def .public (one check xs)
(All (_ a b)
(-> (-> a (Maybe b)) (List a) (Maybe b)))
- (case xs
+ (.when xs
{.#End}
{.#None}
{.#Item x xs'}
- (case (check x)
+ (.when (check x)
{.#Some output}
{.#Some output}
@@ -235,7 +235,7 @@
(for @.js
... TODO: Stop relying on this ASAP.
(mix (function (_ head tail)
- (case (check head)
+ (.when (check head)
{.#Some head}
{.#Item head tail}
@@ -243,12 +243,12 @@
tail))
{.#End}
(reversed xs))
- (case xs
+ (.when xs
{.#End}
{.#End}
{.#Item x xs'}
- (case (check x)
+ (.when (check x)
{.#Some output}
{.#Item output (all check xs')}
@@ -267,7 +267,7 @@
(def .public (interposed sep xs)
(All (_ a)
(-> a (List a) (List a)))
- (case xs
+ (.when xs
{.#End}
xs
@@ -285,7 +285,7 @@
[(def .public (<name> predicate items)
(All (_ a)
(-> (Predicate a) (List a) Bit))
- (case items
+ (.when items
{.#End}
<init>
@@ -300,12 +300,12 @@
(def .public (item i xs)
(All (_ a)
(-> Nat (List a) (Maybe a)))
- (case xs
+ (.when xs
{.#End}
{.#None}
{.#Item x xs'}
- (case i
+ (.when i
0 {.#Some x}
_ (item (-- i) xs'))))
@@ -313,7 +313,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (List a))))
(implementation
(def (= xs ys)
- (case [xs ys]
+ (.when [xs ys]
[{.#End} {.#End}]
true
@@ -342,7 +342,7 @@
(def identity
{.#End})
(def (composite xs ys)
- (case xs
+ (.when xs
{.#End}
ys
@@ -355,7 +355,7 @@
(Functor List)
(implementation
(def (each f ma)
- (case ma
+ (.when ma
{.#End}
{.#End}
@@ -370,7 +370,7 @@
(def functor ..functor)
(def (on fa ff)
- (case ff
+ (.when ff
{.#End}
{.#End}
@@ -392,7 +392,7 @@
(def .public (sorted < xs)
(All (_ a) (-> (-> a a Bit) (List a) (List a)))
- (case xs
+ (.when xs
{.#End}
(list)
@@ -410,7 +410,7 @@
(def .public (empty? xs)
(All (_ a) (Predicate (List a)))
- (case xs
+ (.when xs
{.#End}
true
@@ -419,7 +419,7 @@
(def .public (member? eq xs x)
(All (_ a) (-> (Equivalence a) (List a) a Bit))
- (case xs
+ (.when xs
{.#End}
false
@@ -430,7 +430,7 @@
(with_template [<name> <output> <side>]
[(def .public (<name> xs)
(All (_ a) (-> (List a) (Maybe <output>)))
- (case xs
+ (.when xs
{.#End}
{.#None}
@@ -443,7 +443,7 @@
(def .public (indices size)
(All (_ a) (-> Nat (List Nat)))
- (case size
+ (.when size
0 (list)
_ (|> size -- (enum.range n.enum 0))))
@@ -455,7 +455,7 @@
(-> Nat Text)
(loop (again [input value
output ""])
- (let [digit (case (n.% 10 input)
+ (let [digit (.when (n.% 10 input)
0 "0"
1 "1"
2 "2"
@@ -469,13 +469,13 @@
_ (undefined))
output' ("lux text concat" digit output)
input' (n./ 10 input)]
- (case input'
+ (.when input'
0 output'
_ (again input' output')))))
(def .public zipped
(macro (_ tokens state)
- (case tokens
+ (.when tokens
(list [_ {.#Nat num_lists}])
(if (n.> 0 num_lists)
(let [(open "[0]") ..functor
@@ -498,7 +498,7 @@
list_vars (each product.right vars+lists)
code (` (is (, zipped_type)
(function ((, g!step) (,* list_vars))
- (case [(,* list_vars)]
+ (.when [(,* list_vars)]
(, pattern)
{.#Item [(,* (each product.left vars+lists))]
((, g!step) (,* list_vars))}
@@ -516,7 +516,7 @@
(def .public zipped_with
(macro (_ tokens state)
- (case tokens
+ (.when tokens
(list [_ {.#Nat num_lists}])
(if (n.> 0 num_lists)
(let [(open "[0]") ..functor
@@ -542,7 +542,7 @@
list_vars (each product.right vars+lists)
code (` (is (, zipped_type)
(function ((, g!step) (, g!func) (,* list_vars))
- (case [(,* list_vars)]
+ (.when [(,* list_vars)]
(, pattern)
{.#Item ((, g!func) (,* (each product.left vars+lists)))
((, g!step) (, g!func) (,* list_vars))}
@@ -560,7 +560,7 @@
(def .public (last xs)
(All (_ a) (-> (List a) (Maybe a)))
- (case xs
+ (.when xs
{.#End}
{.#None}
@@ -572,7 +572,7 @@
(def .public (inits xs)
(All (_ a) (-> (List a) (Maybe (List a))))
- (case xs
+ (.when xs
{.#End}
{.#None}
@@ -580,7 +580,7 @@
{.#Some {.#End}}
{.#Item x xs'}
- (case (inits xs')
+ (.when (inits xs')
{.#None}
(undefined)
@@ -620,7 +620,7 @@
(All (_ a) (-> (List a) (List [Nat a])))
(loop (again [idx 0
xs xs])
- (case xs
+ (.when xs
{.#End}
{.#End}
@@ -629,7 +629,7 @@
(def .public when
(macro (_ tokens state)
- (case tokens
+ (.when tokens
(list test then)
{.#Right [state (.list (` (.if (, test)
(, then)
@@ -640,11 +640,11 @@
(def .public (revised item revision it)
(All (_ a) (-> Nat (-> a a) (List a) (List a)))
- (case it
+ (.when it
{.#End}
{.#End}
{.#Item head tail}
- (case item
+ (.when item
0 {.#Item (revision head) tail}
_ (revised (-- item) revision it))))
diff --git a/stdlib/source/library/lux/data/collection/list/property.lux b/stdlib/source/library/lux/data/collection/list/property.lux
index a4480dabb..d249a3a4f 100644
--- a/stdlib/source/library/lux/data/collection/list/property.lux
+++ b/stdlib/source/library/lux/data/collection/list/property.lux
@@ -33,7 +33,7 @@
(def .public (value key properties)
(All (_ a) (-> Text (List a) (Maybe a)))
- (case properties
+ (when properties
{.#End}
{.#None}
@@ -53,7 +53,7 @@
(def .public (contains? key properties)
(All (_ a) (-> Text (List a) Bit))
- (case (..value key properties)
+ (when (..value key properties)
{.#Some _}
true
@@ -62,7 +62,7 @@
(def .public (has key val properties)
(All (_ a) (-> Text a (List a) (List a)))
- (case properties
+ (when properties
{.#End}
(list [key val])
@@ -75,7 +75,7 @@
(def .public (revised key f properties)
(All (_ a) (-> Text (-> a a) (List a) (List a)))
- (case properties
+ (when properties
{.#End}
{.#End}
@@ -86,7 +86,7 @@
(def .public (lacks key properties)
(All (_ a) (-> Text (List a) (List a)))
- (case properties
+ (when properties
{.#End}
properties
diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux
index 0420c1954..05a5107c3 100644
--- a/stdlib/source/library/lux/data/collection/queue.lux
+++ b/stdlib/source/library/lux/data/collection/queue.lux
@@ -53,7 +53,7 @@
(def .public (next queue)
(All (_ a) (-> (Queue a) (Queue a)))
- (case (the #front queue)
+ (when (the #front queue)
... Empty...
(.list)
queue
@@ -71,7 +71,7 @@
(def .public (end val queue)
(All (_ a) (-> a (Queue a) (Queue a)))
- (case (the #front queue)
+ (when (the #front queue)
{.#End}
(has #front (.list val) queue)
diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux
index 0d02d0a09..bbd66f362 100644
--- a/stdlib/source/library/lux/data/collection/queue/priority.lux
+++ b/stdlib/source/library/lux/data/collection/queue/priority.lux
@@ -53,13 +53,13 @@
(def .public (size queue)
(All (_ a) (-> (Queue a) Nat))
- (case (representation queue)
+ (when (representation queue)
{.#None}
0
{.#Some tree}
(loop (again [node tree])
- (case (tree.root node)
+ (when (tree.root node)
{0 #0 _}
1
@@ -68,13 +68,13 @@
(def .public (member? equivalence queue member)
(All (_ a) (-> (Equivalence a) (Queue a) a Bit))
- (case (representation queue)
+ (when (representation queue)
{.#None}
false
{.#Some tree}
(loop (again [node tree])
- (case (tree.root node)
+ (when (tree.root node)
{0 #0 reference}
(at equivalence = reference member)
@@ -89,7 +89,7 @@
[tree (representation queue)
.let [highest_priority (tree.tag tree)]]
(loop (again [node tree])
- (case (tree.root node)
+ (when (tree.root node)
{0 #0 reference}
(if (n.= highest_priority (tree.tag node))
{.#None}
@@ -97,13 +97,13 @@
{0 #1 left right}
(if (n.= highest_priority (tree.tag left))
- (case (again left)
+ (when (again left)
{.#None}
{.#Some right}
{.#Some =left}
{.#Some (at ..builder branch =left right)})
- (case (again right)
+ (when (again right)
{.#None}
{.#Some left}
@@ -114,7 +114,7 @@
(All (_ a) (-> Priority a (Queue a) (Queue a)))
(let [addition (at ..builder leaf priority value)]
(abstraction
- (case (representation queue)
+ (when (representation queue)
{.#None}
{.#Some addition}
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index 060c5a255..55c782acf 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -118,7 +118,7 @@
(if (array.lacks? sub_idx parent)
... If so, set the path to the tail
(..path (level_down level) tail)
- (case (array.item sub_idx parent)
+ (when (array.item sub_idx parent)
... If not, push the tail onto the sub_node.
{#Hierarchy sub_node}
{#Hierarchy (with_tail size (level_down level) tail sub_node)}
@@ -138,7 +138,7 @@
(def (hierarchy#has level idx val hierarchy)
(All (_ a) (-> Level Index a (Hierarchy a) (Hierarchy a)))
(let [sub_idx (branch_idx (i64.right_shifted level idx))]
- (case (array.item sub_idx hierarchy)
+ (when (array.item sub_idx hierarchy)
{#Hierarchy sub_node}
(|> (array.clone hierarchy)
(array.has! sub_idx {#Hierarchy (hierarchy#has (level_down level) idx val sub_node)}))
@@ -165,7 +165,7 @@
(maybe#each (function (_ sub)
(|> (array.clone hierarchy)
(array.has! sub_idx {#Hierarchy sub})))
- (case (array.item sub_idx hierarchy)
+ (when (array.item sub_idx hierarchy)
{#Hierarchy sub}
(without_tail size (level_down level) sub)
@@ -180,7 +180,7 @@
(def (node#list node)
(All (_ a) (-> (Node a) (List a)))
- (case node
+ (when node
{#Base base}
(array.list {.#None} base)
@@ -264,7 +264,7 @@
(let [index (branch_idx (i64.right_shifted level idx))]
(if (array.lacks? index hierarchy)
(exception.except ..base_was_not_found [])
- (case [(n.> branching_exponent level)
+ (when [(n.> branching_exponent level)
(array.item index hierarchy)]
[.true {#Hierarchy sub}]
(again (level_down level) sub)
@@ -307,7 +307,7 @@
(def .public (prefix sequence)
(All (_ a) (-> (Sequence a) (Sequence a)))
- (case (the #size sequence)
+ (when (the #size sequence)
0
empty
@@ -332,7 +332,7 @@
(with_expansions [<else> [level root]]
(if (n.> branching_exponent level)
(if (array.lacks? 1 root)
- (case (array.item 0 root)
+ (when (array.item 0 root)
{#Hierarchy sub_node}
(again (level_down level) sub_node)
@@ -375,7 +375,7 @@
(All (_ a) (-> (Equivalence a) (Equivalence (Node a))))
(implementation
(def (= v1 v2)
- (case [v1 v2]
+ (when [v1 v2]
[{#Base b1} {#Base b2}]
(array.= //#= b1 b2)
@@ -400,7 +400,7 @@
(Mix Node)
(implementation
(def (mix $ init xs)
- (case xs
+ (when xs
{#Base base}
(array.mix (function (_ _ item output) ($ item output))
init
@@ -434,7 +434,7 @@
(Functor Node)
(implementation
(def (each $ xs)
- (case xs
+ (when xs
{#Base base}
{#Base (array.each $ base)}
@@ -491,7 +491,7 @@
(let [help (is (All (_ a)
(-> (Predicate a) (Node a) Bit))
(function (help predicate node)
- (case node
+ (when node
{#Base base}
(<array> predicate base)
@@ -518,7 +518,7 @@
(def (one|node check items)
(All (_ a b)
(-> (-> a (Maybe b)) (Node a) (Maybe b)))
- (case items
+ (when items
{#Base items}
(array.one check items)
@@ -528,7 +528,7 @@
(def .public (one check items)
(All (_ a b)
(-> (-> a (Maybe b)) (Sequence a) (Maybe b)))
- (case (let [... TODO: This binding was established to get around a compilation error. Fix and inline!
+ (when (let [... TODO: This binding was established to get around a compilation error. Fix and inline!
check (..one|node check)]
(|> items
(the #root)
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index 3b3e2039d..e08756a80 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -34,7 +34,7 @@
(def .public (has multiplicity elem set)
(All (_ a) (-> Nat a (Set a) (Set a)))
- (case multiplicity
+ (when multiplicity
0 set
_ (|> set
representation
@@ -43,9 +43,9 @@
(def .public (lacks multiplicity elem set)
(All (_ a) (-> Nat a (Set a) (Set a)))
- (case multiplicity
+ (when multiplicity
0 set
- _ (case (dictionary.value elem (representation set))
+ _ (when (dictionary.value elem (representation set))
{.#Some current}
(abstraction
(if (n.> multiplicity current)
diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux
index c53ba235a..c037e1a56 100644
--- a/stdlib/source/library/lux/data/collection/stack.lux
+++ b/stdlib/source/library/lux/data/collection/stack.lux
@@ -28,7 +28,7 @@
(def .public (value stack)
(All (_ a) (-> (Stack a) (Maybe a)))
- (case (representation stack)
+ (when (representation stack)
{.#End}
{.#None}
@@ -37,7 +37,7 @@
(def .public (next stack)
(All (_ a) (-> (Stack a) (Maybe [a (Stack a)])))
- (case (representation stack)
+ (when (representation stack)
{.#End}
{.#None}
diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux
index 3c3a2cb29..bf39422ee 100644
--- a/stdlib/source/library/lux/data/collection/stream.lux
+++ b/stdlib/source/library/lux/data/collection/stream.lux
@@ -39,7 +39,7 @@
(-> [a (List a)] (Stream a)))
(loop (again [head start
tail next])
- (//.pending [head (case tail
+ (//.pending [head (when tail
{.#End}
(again start next)
@@ -59,7 +59,7 @@
(def .public (item idx stream)
(All (_ a) (-> Nat (Stream a) a))
(let [[head tail] (//.result stream)]
- (case idx
+ (when idx
0 head
_ (item (-- idx) tail))))
diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux
index b8a654516..68d7e7157 100644
--- a/stdlib/source/library/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/library/lux/data/collection/tree/finger.lux
@@ -58,7 +58,7 @@
(def .public (value tree)
(All (_ @ t v) (-> (Tree @ t v) v))
- (case (the #root (representation tree))
+ (when (the #root (representation tree))
{0 #0 value}
value
@@ -67,7 +67,7 @@
(def .public (tags tree)
(All (_ @ t v) (-> (Tree @ t v) (List t)))
- (case (the #root (representation tree))
+ (when (the #root (representation tree))
{0 #0 value}
(list (the #tag (representation tree)))
@@ -77,7 +77,7 @@
(def .public (values tree)
(All (_ @ t v) (-> (Tree @ t v) (List v)))
- (case (the #root (representation tree))
+ (when (the #root (representation tree))
{0 #0 value}
(list value)
@@ -92,7 +92,7 @@
(let [(open "tag//[0]") monoid]
(loop (again [_tag tag//identity
_node root])
- (case _node
+ (when _node
{0 #0 value}
{.#Some value}
@@ -106,7 +106,7 @@
(def .public (exists? predicate tree)
(All (_ @ t v) (-> (Predicate t) (Tree @ t v) Bit))
- (case (..one predicate tree)
+ (when (..one predicate tree)
{.#Some _}
true
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 1e403280e..b06a5c591 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -80,7 +80,7 @@
(def .public (start? zipper)
(All (_ a) (-> (Zipper a) Bit))
- (case (the #family zipper)
+ (when (the #family zipper)
{.#None}
true
@@ -89,7 +89,7 @@
(def .public (down zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
- (case (..children zipper)
+ (when (..children zipper)
{.#End}
{.#None}
@@ -120,9 +120,9 @@
(with_template [<one> <all> <side> <op_side>]
[(def .public (<one> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
- (case (the #family zipper)
+ (when (the #family zipper)
{.#Some family}
- (case (the <side> family)
+ (when (the <side> family)
{.#Item next side'}
{.#Some (for @.old
[#family {.#Some (|> family
@@ -144,12 +144,12 @@
(def .public (<all> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
- (case (the #family zipper)
+ (when (the #family zipper)
{.#None}
{.#None}
{.#Some family}
- (case (list.reversed (the <side> family))
+ (when (list.reversed (the <side> family))
{.#End}
{.#None}
@@ -173,13 +173,13 @@
(def .public (next zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
- (case (..down zipper)
+ (when (..down zipper)
{.#Some forward}
{.#Some forward}
{.#None}
(loop (again [@ zipper])
- (case (..right @)
+ (when (..right @)
{.#Some forward}
{.#Some forward}
@@ -190,12 +190,12 @@
(def (bottom zipper)
(All (_ a) (-> (Zipper a) (Zipper a)))
- (case (..right zipper)
+ (when (..right zipper)
{.#Some forward}
(bottom forward)
{.#None}
- (case (..down zipper)
+ (when (..down zipper)
{.#Some forward}
(bottom forward)
@@ -204,12 +204,12 @@
(def .public (previous zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
- (case (..left zipper)
+ (when (..left zipper)
{.#None}
(..up zipper)
{.#Some backward}
- {.#Some (case (..down backward)
+ {.#Some (when (..down backward)
{.#Some then}
(..bottom then)
@@ -219,13 +219,13 @@
(with_template [<name> <move>]
[(def .public (<name> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
- (case (<move> zipper)
+ (when (<move> zipper)
{.#None}
{.#None}
{.#Some @}
(loop (again [@ @])
- (case (<move> @)
+ (when (<move> @)
{.#None}
{.#Some @}
@@ -238,7 +238,7 @@
(def .public (end? zipper)
(All (_ a) (-> (Zipper a) Bit))
- (case (..end zipper)
+ (when (..end zipper)
{.#None}
true
@@ -261,7 +261,7 @@
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
(do maybe.monad
[family (the #family zipper)]
- (case (the #lefts family)
+ (when (the #lefts family)
{.#End}
(in (has [#node //.#children]
(the #rights family)
@@ -277,7 +277,7 @@
(with_template [<name> <side>]
[(def .public (<name> value zipper)
(All (_ a) (-> a (Zipper a) (Maybe (Zipper a))))
- (case (the #family zipper)
+ (when (the #family zipper)
{.#None}
{.#None}
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index bbccf6b7b..61e3d5593 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -249,9 +249,9 @@
t (|> +1.0 (f.- (|> +1.0 (f.- f) (f.* saturation))) (f.* brightness))
v brightness
mod (|> i (f.% +6.0) f.int .nat)
- red (case mod 0 v 1 q 2 p 3 p 4 t 5 v _ (undefined))
- green (case mod 0 t 1 v 2 v 3 q 4 p 5 p _ (undefined))
- blue (case mod 0 p 1 p 2 t 3 v 4 v 5 q _ (undefined))]
+ red (when mod 0 v 1 q 2 p 3 p 4 t 5 v _ (undefined))
+ green (when mod 0 t 1 v 2 v 3 q 4 p 5 p _ (undefined))
+ blue (when mod 0 p 1 p 2 t 3 v 4 v 5 q _ (undefined))]
(of_rgb [#red (..up red)
#green (..up green)
#blue (..up blue)])))
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 80b0623cd..600068d16 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -55,7 +55,7 @@
(def .public (font font)
(-> Font (CSS Special))
- (let [with_unicode (case (the /font.#unicode_range font)
+ (let [with_unicode (when (the /font.#unicode_range font)
{.#Some unicode_range}
(let [unicode_range' (format "U+" (at nat.hex encoded (the /font.#start unicode_range))
"-" (at nat.hex encoded (the /font.#end unicode_range)))]
@@ -79,7 +79,7 @@
(def .public (import url query)
(-> URL (Maybe Query) (CSS Special))
(abstraction (format (format "@import url(" (%.text url) ")")
- (case query
+ (when query
{.#Some query}
(format " " (/query.query query))
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 3845d2cb6..4675c0385 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -918,7 +918,7 @@
(def (with_hint [hint stop])
(-> [(Maybe Hint) Stop] Text)
- (case hint
+ (when hint
{.#None}
(representation Stop stop)
@@ -1073,7 +1073,7 @@
Stop (List/1 [(Maybe Hint) Stop])
(Value Image))
(let [after_extent (format "at " (representation location))
- with_extent (case extent
+ with_extent (when extent
{.#Some extent}
(format (..extent extent) " " after_extent)
@@ -1155,7 +1155,7 @@
(def .public (font_family options)
(-> (List Font) (Value Font))
- (case options
+ (when options
{.#Item _}
(|> options
(list#each ..font_name)
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 15d20bb2d..d01f92b22 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -46,7 +46,7 @@
(def (target value)
(-> Target Text)
- (case value
+ (when value
{#Blank} "_blank"
{#Parent} "_parent"
{#Self} "_self"
@@ -176,7 +176,7 @@
(def .public (base href target)
(-> URL (Maybe Target) Meta)
(let [partial (list ["href" href])
- full (case target
+ full (when target
{.#Some target}
(list.partial ["target" (..target target)] partial)
@@ -286,7 +286,7 @@
(def (area attributes shape)
(-> Attributes Shape (HTML Any))
- (case shape
+ (when shape
{#Rectangle rectangle}
(..rectangle attributes rectangle)
@@ -300,7 +300,7 @@
(-> Attributes (List [Attributes Shape]) Image Image)
(all ..and
for
- (case (list#each (product.uncurried ..area) areas)
+ (when (list#each (product.uncurried ..area) areas)
{.#End}
(..empty "map" attributes)
@@ -348,7 +348,7 @@
[(def .public (<name> description attributes content)
(-> (Maybe Content) Attributes <type> <type>)
(..tag <container_tag> attributes
- (case description
+ (when description
{.#Some description}
(all ..and
(..tag <description_tag> (list) description)
@@ -462,7 +462,7 @@
(def .public (description_list attributes descriptions)
(-> Attributes (List [Content Element]) Element)
- (case (list#each (function (_ [term description])
+ (when (list#each (function (_ [term description])
(all ..and
(..term term)
(..description description)))
@@ -524,7 +524,7 @@
(def .public (table attributes caption columns headers rows footer)
(-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element)
(let [head (..table_head (..table_row headers))
- content (case (list#each table_row rows)
+ content (when (list#each table_row rows)
{.#End}
head
@@ -532,21 +532,21 @@
(..and head
(..table_body
(list#mix (function.flipped ..and) first rest))))
- content (case footer
+ content (when footer
{.#None}
content
{.#Some footer}
(..and content
(..table_foot (..table_row footer))))
- content (case columns
+ content (when columns
{.#None}
content
{.#Some columns}
(..and (..columns_group columns)
content))
- content (case caption
+ content (when caption
{.#None}
content
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 3dd15f400..a5b036478 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -62,7 +62,7 @@
(def .public null?
(Predicate JSON)
- (|>> (pipe.case {#Null} true
+ (|>> (pipe.when {#Null} true
_ false)))
(def .public object
@@ -98,7 +98,7 @@
(def (jsonF token)
(-> JSON' Code)
- (case token
+ (when token
{#Null' _}
(` {..#Null})
@@ -128,7 +128,7 @@
(def .public (fields json)
(-> JSON (Try (List String)))
- (case json
+ (when json
{#Object obj}
{try.#Success (dictionary.keys obj)}
@@ -137,9 +137,9 @@
(def .public (field key json)
(-> String JSON (Try JSON))
- (case json
+ (when json
{#Object obj}
- (case (dictionary.value key obj)
+ (when (dictionary.value key obj)
{.#Some value}
{try.#Success value}
@@ -151,7 +151,7 @@
(def .public (has key value json)
(-> String JSON JSON (Try JSON))
- (case json
+ (when json
{#Object obj}
{try.#Success {#Object (dictionary.has key value obj)}}
@@ -161,7 +161,7 @@
(with_template [<name> <tag> <type>]
[(def .public (<name> key json)
(-> Text JSON (Try <type>))
- (case (field key json)
+ (when (field key json)
{try.#Success {<tag> value}}
{try.#Success value}
@@ -182,7 +182,7 @@
(Equivalence JSON)
(implementation
(def (= x y)
- (case [x y]
+ (when [x y]
[{#Null} {#Null}]
true
@@ -209,7 +209,7 @@
(and (n.= (dictionary.size xs) (dictionary.size ys))
(list#mix (function (_ [xk xv] prev)
(and prev
- (case (dictionary.value xk ys)
+ (when (dictionary.value xk ys)
{.#None} false
{.#Some yv} (= xv yv))))
true
@@ -228,7 +228,7 @@
(def boolean_format
(-> Boolean Text)
- (|>> (pipe.case
+ (|>> (pipe.when
.false
"false"
@@ -237,7 +237,7 @@
(def number_format
(-> Number Text)
- (|>> (pipe.case
+ (|>> (pipe.when
+0.0 ... OR -0.0
"0.0"
@@ -294,7 +294,7 @@
(def .public (format json)
(-> JSON Text)
- (case json
+ (when json
(^.with_template [<tag> <format>]
[{<tag> value}
(<format> value)])
@@ -359,7 +359,7 @@
signed?' (<>.parses? (<text>.this "-"))
offset (<text>.many <text>.decimal)]
(in (all text#composite mark (if signed?' "-" "") offset))))]
- (case (f#decoded (all text#composite (if signed? "-" "") digits "." decimals exp))
+ (when (f#decoded (all text#composite (if signed? "-" "") digits "." decimals exp))
{try.#Failure message}
(<>.failure message)
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 4b8e1a4a2..f6faa4820 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -110,7 +110,7 @@
(|>> list.enumeration
(list#each (function (_ [idx [summary detail]])
(format "1. " (representation summary)
- (case detail
+ (when detail
{.#Some detail}
(|> detail
representation
@@ -128,7 +128,7 @@
(Markdown Block))
(|>> (list#each (function (_ [summary detail])
(format "* " (representation summary)
- (case detail
+ (when detail
{.#Some detail}
(|> detail
representation
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index aad8579af..360ceeb11 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -236,16 +236,16 @@
(def (un_padded string)
(-> Binary Binary)
- (case (binary!.size string)
+ (when (binary!.size string)
0
string
size
(loop (again [end (-- size)])
- (case end
+ (when end
0 (at utf8.codec encoded "")
_ (let [last_char (binary!.bits_8 end string)]
- (`` (case (.nat last_char)
+ (`` (when (.nat last_char)
(char (,, (static ..null)))
(again (-- end))
@@ -434,7 +434,7 @@
(Parser Link_Flag)
(do <>.monad
[it <binary>.bits_8]
- (case (.nat it)
+ (when (.nat it)
(^.with_template [<value> <link_flag>]
[<value>
(in <link_flag>)])
@@ -597,7 +597,7 @@
(-> Big Nat)
(n.+ (n./ ..block_size
(..from_big size))
- (case (n.% ..block_size (..from_big size))
+ (when (n.% ..block_size (..from_big size))
0 0
_ 1)))
@@ -729,7 +729,7 @@
(def entry_format
(Format Entry)
- (|>> (pipe.case
+ (|>> (pipe.when
{#Normal value} (..normal_file_format value)
{#Symbolic_Link value} (..symbolic_link_format value)
{#Directory value} (..directory_format value)
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index 3635c56f3..0978967f1 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -62,7 +62,7 @@
(<>.codec int.decimal)
<text>.slice
<text>.many!
- (case hex?
+ (when hex?
{.#None}
<text>.decimal!
@@ -95,7 +95,7 @@
(do <>.monad
[first_part xml_identifier
?second_part (<| <>.maybe (<>.after (<text>.this ..namespace_separator)) xml_identifier)]
- (case ?second_part
+ (when ?second_part
{.#None}
(in ["" first_part])
@@ -213,7 +213,7 @@
(def .public (tag [namespace name])
(-> Tag Text)
- (case namespace
+ (when namespace
"" name
_ (all text#composite namespace ..namespace_separator name)))
@@ -248,7 +248,7 @@
..xml_header text.new_line
(loop (again [prefix ""
input input])
- (case input
+ (when input
{#Text value}
(sanitize_value value)
@@ -282,7 +282,7 @@
(Equivalence XML)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{#Text reference/value} {#Text sample/value}]
(text#= reference/value sample/value)
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index 03e26b25d..0ed2931d1 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -19,7 +19,7 @@
(-> (-> a c) (-> b c)
(-> (Or a b) c)))
(function (_ input)
- (case input
+ (when input
{0 #0 l} (on_left l)
{0 #1 r} (on_right r))))
@@ -28,14 +28,14 @@
(-> (-> l l') (-> r r')
(-> (Or l r) (Or l' r'))))
(function (_ input)
- (case input
+ (when input
{0 #0 l} {0 #0 (on_left l)}
{0 #1 r} {0 #1 (on_right r)})))
(with_template [<name> <side> <right?>]
[(def .public (<name> items)
(All (_ a b) (-> (List (Or a b)) (List <side>)))
- (case items
+ (when items
{.#End}
{.#End}
@@ -51,13 +51,13 @@
(def .public (partition xs)
(All (_ a b) (-> (List (Or a b)) [(List a) (List b)]))
- (case xs
+ (when xs
{.#End}
[{.#End} {.#End}]
{.#Item x xs'}
(let [[lefts rights] (partition xs')]
- (case x
+ (when x
{0 #0 x'} [{.#Item x' lefts} rights]
{0 #1 x'} [lefts {.#Item x' rights}]))))
@@ -65,7 +65,7 @@
(All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r))))
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
[{.#Left reference} {.#Left sample}]
(at left = reference sample)
@@ -82,7 +82,7 @@
(..equivalence (at left equivalence)
(at right equivalence)))
(def (hash value)
- (.nat (case value
+ (.nat (when value
{.#Left value}
("lux i64 *" +2 (.int (at left hash value)))
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index e9fa52957..8502d1d76 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -71,7 +71,7 @@
output (is (Maybe Nat)
{.#None})])
(let [output' ("lux text index" offset part text)]
- (case output'
+ (when output'
{.#None}
output
@@ -80,7 +80,7 @@
(def .public (starts_with? prefix x)
(-> Text Text Bit)
- (case (index prefix x)
+ (when (index prefix x)
{.#Some 0}
true
@@ -89,7 +89,7 @@
(def .public (ends_with? postfix x)
(-> Text Text Bit)
- (case (last_index postfix x)
+ (when (last_index postfix x)
{.#Some n}
(n.= (size x)
(n.+ (size postfix) n))
@@ -104,7 +104,7 @@
(def .public (contains? sub text)
(-> Text Text Bit)
- (case ("lux text index" 0 sub text)
+ (when ("lux text index" 0 sub text)
{.#Some _}
true
@@ -146,7 +146,7 @@
(def .public (split_at at x)
(-> Nat Text (Maybe [Text Text]))
- (case [(..clip 0 at x) (..clip_since at x)]
+ (when [(..clip 0 at x) (..clip_since at x)]
[{.#Some pre} {.#Some post}]
{.#Some [pre post]}
@@ -165,7 +165,7 @@
(-> Text Text (List Text))
(loop (again [input sample
output (is (List Text) (list))])
- (case (..split_by token input)
+ (when (..split_by token input)
{.#Some [pre post]}
(|> output
{.#Item pre}
@@ -185,9 +185,9 @@
(for @.js (these (def defined?
(macro (_ tokens lux)
- (case tokens
+ (when tokens
(list it)
- {.#Right [lux (list (` (.case ("js type-of" ("js constant" (, it)))
+ {.#Right [lux (list (` (.when ("js type-of" ("js constant" (, it)))
"undefined"
.false
@@ -198,7 +198,7 @@
{.#Left ""})))
(def if_nashorn
(macro (_ tokens lux)
- (case tokens
+ (when tokens
(list then else)
{.#Right [lux (list (if (and (..defined? "java")
(..defined? "java.lang")
@@ -215,7 +215,7 @@
(with_expansions [... Inefficient default
<default> (loop (again [left ""
right template])
- (case (..split_by pattern right)
+ (when (..split_by pattern right)
{.#Some [pre post]}
(again (all "lux text concat" left pre replacement) post)
@@ -320,13 +320,13 @@
(def .public (interposed separator texts)
(-> Text (List Text) Text)
- (case separator
+ (when separator
"" (..together texts)
_ (|> texts (list.interposed separator) ..together)))
(def .public (empty? text)
(-> Text Bit)
- (case text
+ (when text
"" true
_ false))
@@ -347,7 +347,7 @@
[..carriage_return]
[..form_feed]
)]
- (`` (case char
+ (`` (when char
<options>
_
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 85f038d05..2ce6021a6 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -72,7 +72,7 @@
(-> Char Bit)
(or (n.< ..ascii_bottom char)
(n.> ..ascii_top char)
- (case char
+ (when char
(^.with_template [<char>]
[<char>
true])
@@ -97,7 +97,7 @@
(-> Char Nat Nat Text Text [Text Text Nat])
(let [code (at n.hex encoded char)
replacement (format ..sigil "u"
- (case ("lux text size" code)
+ (when ("lux text size" code)
1 (format "000" code)
2 (format "00" code)
3 (format "0" code)
@@ -117,7 +117,7 @@
current text
limit ("lux text size" text)])
(if (n.< limit offset)
- (case ("lux text char" offset current)
+ (when ("lux text char" offset current)
(^.with_template [<char> <replacement>]
[<char>
(let [[previous' current' limit'] (ascii_escaped <replacement> offset limit previous current)]
@@ -180,7 +180,7 @@
(def (unicode_un_escaped offset previous current limit)
(-> Nat Text Text Nat (Try [Text Text Nat]))
- (case (|> current
+ (when (|> current
("lux text clip" (n.+ ..ascii_escape_offset offset) ..code_size)
(at n.hex decoded))
{try.#Success char}
@@ -201,11 +201,11 @@
current text
limit ("lux text size" text)])
(if (n.< limit offset)
- (case ("lux text char" offset current)
+ (when ("lux text char" offset current)
..sigil_char
(let [@sigil (++ offset)]
(if (n.< limit @sigil)
- (case ("lux text char" @sigil current)
+ (when ("lux text char" @sigil current)
(^.with_template [<sigil> <un_escaped>]
[<sigil>
(let [[previous' current' limit'] (..ascii_un_escaped <un_escaped> offset previous current limit)]
@@ -235,13 +235,13 @@
_
(again (++ offset) previous current limit))
- {try.#Success (case previous
+ {try.#Success (when previous
"" current
_ (format previous current))})))
(def .public literal
(syntax (_ [literal <code>.text])
- (case (..un_escaped literal)
+ (when (..un_escaped literal)
{try.#Success un_escaped}
(in (list (code.text un_escaped)))
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index d8d094f6e..09dba9073 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -111,7 +111,7 @@
parts (<>.many (all <>.either
re_range^
re_options^))]
- (in (case negate?
+ (in (when negate?
{.#Some _} (` (<text>.not (all <>.either (,* parts))))
{.#None} (` (all <>.either (,* parts)))))))
@@ -219,7 +219,7 @@
(do <>.monad
[base (re_simple^ current_module)
quantifier (<text>.one_of "?*+")]
- (case quantifier
+ (when quantifier
"?"
(in (` (<>.else "" (, base))))
@@ -290,7 +290,7 @@
[Nat (List Code) (List (List Code))]
[Nat (List Code) (List (List Code))])
(function (_ part [idx names steps])
- (case part
+ (when part
(^.or {.#Left complex}
{.#Right [{#Non_Capturing} complex]})
[idx
@@ -300,7 +300,7 @@
steps)]
{.#Right [{#Capturing [?name num_captures]} scoped]}
- (let [[idx! name!] (case ?name
+ (let [[idx! name!] (when ?name
{.#Some _name}
[idx (code.symbol ["" _name])]
@@ -335,12 +335,12 @@
(def .public (or left right)
(All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (Or l r)])))
(function (_ input)
- (case (left input)
+ (when (left input)
{try.#Success [input' [lt lv]]}
{try.#Success [input' [lt {0 #0 lv}]]}
{try.#Failure _}
- (case (right input)
+ (when (right input)
{try.#Success [input' [rt rv]]}
{try.#Success [input' [rt {0 #1 rv}]]}
@@ -350,12 +350,12 @@
(def .public (either left right)
(All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser Text)))
(function (_ input)
- (case (left input)
+ (when (left input)
{try.#Success [input' [lt lv]]}
{try.#Success [input' lt]}
{try.#Failure _}
- (case (right input)
+ (when (right input)
{try.#Success [input' [rt rv]]}
{try.#Success [input' rt]}
@@ -418,7 +418,7 @@
(syntax (_ [pattern <code>.text])
(do meta.monad
[current_module meta.current_module_name]
- (case (<text>.result (regex^ current_module)
+ (when (<text>.result (regex^ current_module)
pattern)
{try.#Failure error}
(meta.failure (format "Error while parsing regular-expression:" //.new_line
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index 13c5d4f47..771fb287f 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -217,7 +217,7 @@
(-> Set Char Bit)
(loop (again [tree (representation set)])
(if (//block.within? (tree.tag tree) character)
- (case (tree.root tree)
+ (when (tree.root tree)
{0 #0 _}
true
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index ad5fa71fb..88df6bc7b 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -148,7 +148,7 @@
Inspector
(with_expansions [<jvm> (let [object (as java/lang/Object value)]
(`` (<| (,, (with_template [<class> <processing>]
- [(case (ffi.as <class> object)
+ [(when (ffi.as <class> object)
{.#Some value}
(`` (|> value (,, (template.spliced <processing>))))
@@ -159,16 +159,16 @@
[java/lang/Number [java/lang/Number::doubleValue ffi.of_double %.frac]]
[java/lang/String [ffi.of_string %.text]]
))
- (case (ffi.as [java/lang/Object] object)
+ (when (ffi.as [java/lang/Object] object)
{.#Some value}
(let [value (as (array.Array java/lang/Object) value)]
- (case (array.item 0 value)
+ (when (array.item 0 value)
(^.multi {.#Some tag}
[(ffi.as java/lang/Integer tag)
{.#Some tag}]
[[(array.item 1 value) (array.item 2 value)]
[last? {.#Some choice}]])
- (let [last? (case last?
+ (let [last? (when last?
{.#Some _} #1
{.#None} #0)]
(|> (%.format (%.nat (.nat (ffi.of_long (java/lang/Integer::longValue tag))))
@@ -184,7 +184,7 @@
@.jvm <jvm>
@.js
- (case (ffi.type_of value)
+ (when (ffi.type_of value)
(^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (,, (template.spliced <then>))))])
@@ -219,7 +219,7 @@
(JSON::stringify value))
@.python
- (case (..str (..type value))
+ (when (..str (..type value))
(^.with_template [<type_of> <class_of> <then>]
[(^.or <type_of> <class_of>)
(`` (|> value (,, (template.spliced <then>))))])
@@ -234,7 +234,7 @@
(^.or "<type 'tuple'>" "<class 'tuple'>")
(let [variant (as (array.Array Any) value)]
- (case (array.size variant)
+ (when (array.size variant)
3 (let [variant_tag ("python array read" 0 variant)
variant_flag ("python array read" 1 variant)
variant_value ("python array read" 2 variant)]
@@ -251,7 +251,7 @@
(..str value))
@.lua
- (case (..type value)
+ (when (..type value)
(^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (,, (template.spliced <then>))))])
@@ -260,7 +260,7 @@
["nil" [(pipe.new "nil" [])]])
"number"
- (case (math::type value)
+ (when (math::type value)
{.#Some "integer"} (|> value (as .Int) %.int)
{.#Some "float"} (|> value (as .Frac) %.frac)
@@ -324,7 +324,7 @@
(to_s value)))))
@.php
- (case (..gettype value)
+ (when (..gettype value)
(^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (,, (template.spliced <then>))))])
@@ -451,14 +451,14 @@
(let [[lefts right? sub_repr] (loop (again [lefts 0
representations membersR+
variantV variantV])
- (case representations
+ (when representations
{.#Item leftR {.#Item rightR extraR+}}
- (case (as (Or Any Any) variantV)
+ (when (as (Or Any Any) variantV)
{.#Left left}
[lefts #0 (leftR left)]
{.#Right right}
- (case extraR+
+ (when extraR+
{.#End}
[lefts #1 (rightR right)]
@@ -476,7 +476,7 @@
(in (function (_ tupleV)
(let [tuple_body (loop (again [representations membersR+
tupleV tupleV])
- (case representations
+ (when representations
{.#End}
""
@@ -500,7 +500,7 @@
(do <>.monad
[[funcT inputsT+] (<type>.applied (<>.and <type>.any (<>.many <type>.any)))]
- (case (type.applied inputsT+ funcT)
+ (when (type.applied inputsT+ funcT)
{.#Some outputT}
(<type>.local (list outputT) representation)
@@ -516,7 +516,7 @@
(def .public (representation type value)
(-> Type Any (Try Text))
- (case (<type>.result ..representation_parser type)
+ (when (<type>.result ..representation_parser type)
{try.#Success representation}
{try.#Success (representation value)}
@@ -576,7 +576,7 @@
list.reversed
(dictionary.of_list text.hash))]
targets (is (Meta (List Target))
- (case targets
+ (when targets
{.#End}
(|> environment
dictionary.keys
@@ -594,7 +594,7 @@
(exception.report
(.list (,* (|> targets
(list#each (function (_ [name format])
- (let [format (case format
+ (let [format (when format
{.#None}
(` ..inspection)
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index c12774068..dc8e85722 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -54,7 +54,7 @@
(def (reference_column code)
(-> Code Nat)
- (case code
+ (when code
(^.with_template [<tag>]
[[[_ _ column] {<tag> _}]
column])
@@ -91,7 +91,7 @@
(def (code_documentation expected_module old_location reference_column example)
(-> Text Location Nat Code [Location Text])
- (case example
+ (when example
[new_location {.#Symbol [module short]}]
(let [documentation (cond (text#= expected_module module)
short
@@ -139,7 +139,7 @@
(def (fragment_documentation module fragment)
(-> Text Fragment Text)
- (case fragment
+ (when fragment
{#Comment comment}
(format "... " comment)
@@ -176,7 +176,7 @@
(-> [Text (List Text)] Nat Nat Text)
(if (type_parameter? id)
(let [parameter_id (..parameter_id level id)]
- (case (list.item parameter_id type_function_arguments)
+ (when (list.item parameter_id type_function_arguments)
{.#Some found}
found
@@ -206,7 +206,7 @@
(def (%type' level type_function_name nestable? module type)
(-> Nat Text Bit Text Type Text)
- (case type
+ (when type
{.#Primitive name params}
(|> params
(list#each (|>> (%type' level type_function_name false module)
@@ -292,9 +292,9 @@
(def (parameterized_type arity type)
(-> Nat Type (Maybe Type))
- (case arity
+ (when arity
0 {.#Some type}
- _ (case type
+ _ (when type
{.#UnivQ _env _type}
(parameterized_type (-- arity) _type)
@@ -303,15 +303,15 @@
(def (type_definition' nestable? level arity type_function_info tags module type)
(-> Bit Nat Nat [Text (List Text)] (List Text) Text Type Text)
- (case tags
+ (when tags
(list single_tag)
(format "(Record" \n
" [#" single_tag " " (type_definition' false level arity type_function_info {.#None} module type) "])")
_
- (case type
+ (when type
{.#Primitive name params}
- (case params
+ (when params
{.#End}
(format "(Primitive " (%.text name) ")")
@@ -320,7 +320,7 @@
{.#Sum _}
(let [members (type.flat_variant type)]
- (case tags
+ (when tags
{.#End}
(format "(Or "
(|> members
@@ -332,7 +332,7 @@
(|> members
(list.zipped_2 tags)
(list#each (function (_ [t_name type])
- (case type
+ (when type
{.#Product _}
(let [types (type.flat_tuple type)]
(format " {" t_name " "
@@ -348,7 +348,7 @@
{.#Product _}
(let [members (type.flat_tuple type)]
- (case tags
+ (when tags
{.#End}
(format "[" (|> members (list#each (type_definition' false level arity type_function_info {.#None} module)) (text.interposed " ")) "]")
@@ -382,7 +382,7 @@
(let [[level' body] (<flat> type)
args (level_parameters (n.- arity level) level')
body_doc (type_definition' nestable? (n.+ level level') arity type_function_info tags module body)
- fn_name (case type_function_info
+ fn_name (when type_function_info
[fn_name {.#End}] fn_name
_ "_")]
(format "(" <name> " " "(" fn_name " " (text.interposed " " args) ")"
@@ -427,7 +427,7 @@
(def .public (type_definition module [name parameters] tags type)
(-> Text [Text (List Text)] (List Text) Type Text)
(let [arity (list.size parameters)]
- (case (parameterized_type arity type)
+ (when (parameterized_type arity type)
{.#Some type}
(type_definition' true (-- arity) arity [name parameters] tags module type)
@@ -447,7 +447,7 @@
(Parser Symbol)
(do <>.monad
[name <code>.symbol]
- (case name
+ (when name
["" _]
(<>.failure (exception.error ..unqualified_symbol [name]))
@@ -498,7 +498,7 @@
... Name
(<| (md.heading/3)
(, (code.text (%.code (let [g!name (|> name product.right code.local)]
- (case parameters
+ (when parameters
{.#End}
g!name
@@ -534,7 +534,7 @@
(in (list (` (all md.then
(,* minimal)
... Description
- (,* (case description
+ (,* (when description
{.#Some description}
(list (` (<| md.paragraph
md.text
@@ -543,7 +543,7 @@
{.#None}
(list)))
... Examples
- (,* (case examples
+ (,* (when examples
{.#End}
(list)
@@ -574,7 +574,7 @@
(syntax (_ [[name parameters] ..declaration
extra (<>.some <code>.any)])
(do meta.monad
- [documentation (expansion.single (` ((, (case extra
+ [documentation (expansion.single (` ((, (when extra
(list)
(` ..minimal_definition_documentation)
@@ -606,7 +606,7 @@
(def coverage_format
(-> (List Text) Text)
(list#mix (function (_ short aggregate)
- (case aggregate
+ (when aggregate
"" short
_ (format aggregate ..coverage_separator short)))
""))
@@ -641,7 +641,7 @@
(md.heading/1 (the #module module))
... Description
- (case (the #description module)
+ (when (the #description module)
"" md.empty
description (<| md.paragraph
md.text
@@ -656,7 +656,7 @@
..definitions_documentation)
... Missing documentation
- (case (|> definitions
+ (when (|> definitions
(list#mix (function (_ definition missing)
(set.lacks (symbol.short (the #global definition)) missing))
_#coverage)
@@ -670,7 +670,7 @@
(..listing missing)))
... Un-expected documentation
- (case (|> definitions
+ (when (|> definitions
(list.only (|>> (the #global)
symbol.short
(set.member? _#coverage)
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index b244493a6..be31fd27a 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -333,7 +333,7 @@
(def (primitive_type mode type)
(-> Primitive_Mode (Type Primitive) Code)
- (case mode
+ (when mode
{#ManualPrM}
(cond (at jvm.equivalence = jvm.boolean type) (` ..Boolean)
(at jvm.equivalence = jvm.byte type) (` ..Byte)
@@ -370,7 +370,7 @@
(-> (-> (Type Value) Code)
(-> (Type Parameter) Code))
(`` (<| (,, (with_template [<when> <binding> <then>]
- [(case (<when> type)
+ [(when (<when> type)
{.#Some <binding>}
<then>
@@ -384,7 +384,7 @@
(` (.Primitive (, (code.text name))
[(,* (list#each (parameter_type value_type) parameters))]))]
[parser.array? elementT
- (case (parser.primitive? elementT)
+ (when (parser.primitive? elementT)
{.#Some elementT}
(` {.#Primitive (, (code.text (..reflection (jvm.array elementT)))) {.#End}})
@@ -397,7 +397,7 @@
(def (value_type mode type)
(-> Primitive_Mode (Type Value) Code)
(`` (<| (,, (with_template [<when> <binding> <then>]
- [(case (<when> type)
+ [(when (<when> type)
{.#Some <binding>}
<then>
@@ -885,7 +885,7 @@
(def (privacy_modifier$ pm)
(-> Privacy Code)
- (case pm
+ (when pm
{#PublicP} (code.text "public")
{#PrivateP} (code.text "private")
{#ProtectedP} (code.text "protected")
@@ -893,7 +893,7 @@
(def (inheritance_modifier$ im)
(-> Inheritance Code)
- (case im
+ (when im
{#FinalI} (code.text "final")
{#AbstractI} (code.text "abstract")
{#DefaultI} (code.text "default")))
@@ -935,14 +935,14 @@
(def (state_modifier$ it)
(-> State Code)
- (case it
+ (when it
{#VolatileS} (' "volatile")
{#FinalS} (' "final")
{#DefaultS} (' "default")))
(def (field_decl$ [[name pm anns] field])
(-> [Member_Declaration FieldDecl] Code)
- (case field
+ (when field
{#ConstantField class value}
(` ("constant" (, (code.text name))
[(,* (list#each annotation$ anns))]
@@ -1126,9 +1126,9 @@
(list#each (function (_ [member field])
[(the #member_name member) [member field]]))
(dictionary.of_list text.hash))]]
- (case (dictionary.value field fields)
+ (when (dictionary.value field fields)
{.#Some [member {#VariableField _ static? :field:}]}
- (case [static? this]
+ (when [static? this]
[.true {.#None}]
(in (list (` ("jvm member get static"
(, (code.text class_name))
@@ -1156,14 +1156,14 @@
(list#each (function (_ [member field])
[(the #member_name member) [member field]]))
(dictionary.of_list text.hash))]]
- (case (dictionary.value field fields)
+ (when (dictionary.value field fields)
{.#Some [member {#VariableField state static? :field:}]}
- (case state
+ (when state
{#FinalS}
(meta.failure (exception.error ..cannot_set_field [class_name field]))
_
- (case [static? this]
+ (when [static? this]
[.true {.#None}]
(in (list (` ("jvm member put static"
(, (code.text class_name))
@@ -1210,7 +1210,7 @@
(list#each (function (_ [member virtual])
[(the #member_name member) [member virtual]]))
(dictionary.of_list text.hash))]]
- (case (dictionary.value method virtuals)
+ (when (dictionary.value method virtuals)
{.#Some [member method]}
(let [expected_arguments (list.size (the #method_inputs method))
actual_arguments (list.size inputs)]
@@ -1233,7 +1233,7 @@
(def (method_declaration [member definition])
(-> [Member_Declaration Method_Definition]
(Maybe [Member_Declaration MethodDecl]))
- (case definition
+ (when definition
{#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs}
{.#Some [member
[#method_tvars type_vars
@@ -1247,14 +1247,14 @@
(def (method_def$ fully_qualified_class_name class_vars super_class fields methods [method_declaration method_def])
(-> External (List (Type Var)) (Type Class) (List [Member_Declaration FieldDecl]) (List [Member_Declaration Method_Definition]) [Member_Declaration Method_Definition] (Meta Code))
(let [[name pm anns] method_declaration
- virtual_methods (case (list.all ..method_declaration methods)
+ virtual_methods (when (list.all ..method_declaration methods)
{.#End}
(list)
virtual_methods
(list (` (..with_call [(, (declaration$ (jvm.declaration fully_qualified_class_name class_vars)))
[(,* (list#each method_decl$$ virtual_methods))]]))))]
- (case method_def
+ (when method_def
{#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs}
(meta#in (` ("init"
(, (privacy_modifier$ pm))
@@ -1426,7 +1426,7 @@
(def .public !!!
(syntax (_ [expr <code>.any])
(with_symbols [g!value]
- (in (list (` (.case (, expr)
+ (in (list (` (.when (, expr)
{.#Some (, g!value)}
(, g!value)
@@ -1444,7 +1444,7 @@
{.#Some (.as (, class_type)
(, g!unchecked))}
{.#None}))]
- (case unchecked
+ (when unchecked
{.#Some unchecked}
(in (list (` (.is (, check_type)
(let [(, g!unchecked) (, unchecked)]
@@ -1483,12 +1483,12 @@
(def (member_type_vars class_tvars member)
(-> (List (Type Var)) Import_Member_Declaration (List (Type Var)))
- (case member
+ (when member
{#ConstructorDecl [commons _]}
(list#composite class_tvars (the #import_member_tvars commons))
{#MethodDecl [commons _]}
- (case (the #import_member_kind commons)
+ (when (the #import_member_kind commons)
{#StaticIMK}
(the #import_member_tvars commons)
@@ -1500,7 +1500,7 @@
(def (member_def_arg_bindings vars member)
(-> (List (Type Var)) Import_Member_Declaration (Meta [(List [Bit Code]) (List (Type Value)) (List Code)]))
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(let [(open "[0]") commons]
(do [! meta.monad]
@@ -1525,7 +1525,7 @@
(def (with_return_maybe member never_null? unboxed return_term)
(-> Import_Member_Declaration Bit (Type Value) Code Code)
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(cond (or never_null?
(dictionary.key? ..boxes unboxed))
@@ -1548,7 +1548,7 @@
(with_template [<name> <tag> <term_trans>]
[(def (<name> member return_term)
(-> Import_Member_Declaration Code Code)
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(if (the <tag> commons)
<term_trans>
@@ -1565,7 +1565,7 @@
[(def (<name> mode [unboxed raw])
(-> Primitive_Mode [(Type Value) Code] Code)
(let [[unboxed refined post] (.is [(Type Value) Code (List Code)]
- (case mode
+ (when mode
{#ManualPrM}
[unboxed raw (list)]
@@ -1586,13 +1586,13 @@
(` ("jvm object cast" (, raw)))
raw)
(list)]))))
- unboxed/boxed (case (dictionary.value unboxed ..boxes)
+ unboxed/boxed (when (dictionary.value unboxed ..boxes)
{.#Some boxed}
(<unbox/box> unboxed boxed refined)
{.#None}
refined)]
- (case post
+ (when post
{.#End}
unboxed/boxed
@@ -1656,12 +1656,12 @@
(def (member_def_interop vars kind class [arg_function_inputs input_jvm_types arg_types] member method_prefix import_format)
(-> (List (Type Var)) Class_Kind (Type Declaration) [(List [Bit Code]) (List (Type Value)) (List Code)] Import_Member_Declaration Text Text (Meta (List Code)))
(let [[full_name class_tvars] (parser.declaration class)]
- (case member
+ (when member
{#EnumDecl enum_members}
(with_symbols [g!_]
(do meta.monad
[.let [enum_type (.is Code
- (case class_tvars
+ (when class_tvars
{.#End}
(` (.Primitive (, (code.text full_name))))
@@ -1704,13 +1704,13 @@
(open "[0]") commons
(open "[0]") method
[jvm_op object_ast] (.is [Text (List Code)]
- (case #import_member_kind
+ (when #import_member_kind
{#StaticIMK}
["jvm member invoke static"
(list)]
{#VirtualIMK}
- (case kind
+ (when kind
{#Class}
["jvm member invoke virtual"
(list g!obj)]
@@ -1734,7 +1734,7 @@
(list.zipped_2 input_jvm_types)
(list#each ..decorate_input))))))
jvm_interop (.is Code
- (case (jvm.void? method_return)
+ (when (jvm.void? method_return)
{.#Left method_return}
(|> [method_return
callC]
@@ -1805,7 +1805,7 @@
(` ((,' in) (.list (.` (, getter_body))))))]
(list (` (def (, g!name)
(syntax ((, g!name) [(, write|read) (, parser)])
- (case (, write|read)
+ (when (, write|read)
(,* write)
(,* read))))))))))
)))
@@ -1835,7 +1835,7 @@
(def (class_kind declaration)
(-> (Type Declaration) (Meta Class_Kind))
(let [[class_name _] (parser.declaration declaration)]
- (case (load_class class_name)
+ (when (load_class class_name)
{.#Right class}
(at meta.monad in (if (interface? class)
{#Interface}
@@ -1890,11 +1890,11 @@
(-> Type_Context .Type (Meta (Type Value)))
(if (type#= .Any type)
(at meta.monad in $Object)
- (case type
+ (when type
{.#Primitive name params}
(`` (cond (,, (with_template [<type>]
[(text#= (..reflection <type>) name)
- (case params
+ (when params
{.#End}
(at meta.monad in <type>)
@@ -1912,7 +1912,7 @@
(,, (with_template [<type>]
[(text#= (..reflection (jvm.array <type>)) name)
- (case params
+ (when params
{.#End}
(at meta.monad in (jvm.array <type>))
@@ -1929,7 +1929,7 @@
[jvm.char]))
(text#= array.primitive name)
- (case params
+ (when params
{.#Item {.#Apply writeLT {.#Apply readLT _Mutable}} {.#End}}
(at meta.monad each jvm.array
(lux_type->jvm_type context readLT))
@@ -1938,7 +1938,7 @@
<failure>)
(text.starts_with? descriptor.array_prefix name)
- (case params
+ (when params
{.#End}
(let [[_ unprefixed] (maybe.trusted (text.split_by descriptor.array_prefix name))]
(at meta.monad each jvm.array
@@ -1954,7 +1954,7 @@
(function (_ paramLT)
(do meta.monad
[paramJT (lux_type->jvm_type context paramLT)]
- (case (parser.parameter? paramJT)
+ (when (parser.parameter? paramJT)
{.#Some paramJT}
(in paramJT)
@@ -1963,7 +1963,7 @@
params)))))
{.#Apply A F}
- (case (type.applied (list A) F)
+ (when (type.applied (list A) F)
{.#None}
<failure>
@@ -1974,7 +1974,7 @@
(lux_type->jvm_type context type')
{.#Var @it}
- (case (check.result context (check.peek @it))
+ (when (check.result context (check.peek @it))
{try.#Success {.#Some :it:}}
(lux_type->jvm_type context :it:)
@@ -1986,7 +1986,7 @@
(def .public length
(syntax (_ [array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
@@ -2023,7 +2023,7 @@
(def .public read!
(syntax (_ [idx <code>.any
array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
@@ -2063,7 +2063,7 @@
(syntax (_ [idx <code>.any
value <code>.any
array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
@@ -2116,7 +2116,7 @@
(def .public is
(syntax (_ [type (..type^ (list))
object <code>.any])
- (case [(parser.array? type)
+ (when [(parser.array? type)
(parser.class? type)]
(^.or [{.#Some _} _] [_ {.#Some _}])
(in (list (` (.is (, (..value_type {#ManualPrM} type))
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 92c342750..850ac3b83 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -277,7 +277,7 @@
(def (host_optional it)
(-> Optional Code)
(.if (.the #optional? it)
- (` (.case (, (the #mandatory it))
+ (` (.when (, (the #mandatory it))
{.#Some (, g!it')}
(, g!it')
@@ -371,13 +371,13 @@
:parameters: (the #parameters input)
g!parameters (..parameters :parameters:)
:output: (the [#anonymous #output] it)
- :input:/* (case :parameters:
+ :input:/* (when :parameters:
{.#End}
(list (` []))
parameters
(list#each ..output_type :parameters:))]
- (` (.def ((, g!it) (,* (case g!parameters
+ (` (.def ((, g!it) (,* (when g!parameters
{.#End} (list g!it)
_ (list#each (the #mandatory) g!parameters))))
(.All ((, g!it) (,* g!variables))
@@ -407,7 +407,7 @@
(for @.js (these)
(def (imported class)
(-> Text Code)
- (case (text.all_split_by .module_separator class)
+ (when (text.all_split_by .module_separator class)
{.#Item head tail}
(list#mix (.function (_ sub super)
(` (<get> (, (code.text sub))
@@ -449,7 +449,7 @@
g!class_variables (list#each code.local class_parameters)
g!class (` ((, (code.local (maybe.else class_name alias))) (,* g!class_variables)))
:output: [#optional? false #mandatory g!class]]
- (` (.def ((, g!it) (,* (case g!parameters
+ (` (.def ((, g!it) (,* (when g!parameters
{.#End} (list g!it)
_ (list#each (the #mandatory) g!parameters))))
(.All ((, g!it) (,* g!class_variables) (,* g!input_variables))
@@ -564,13 +564,13 @@
(syntax (_ [host_module (<>.maybe <code>.text)
it ..importP])
(let [host_module_import! (is (List Code)
- (case host_module
+ (when host_module
{.#Some host_module}
(list (` (<import> (, (code.text host_module)))))
{.#None}
(list)))]
- (case it
+ (when it
{#Global it}
(in (list (..global_definition host_module_import! it)))
@@ -591,7 +591,7 @@
(..Object (.Primitive (, (code.text (..host_path class_name)))
[(,* g!class_variables)]))))
(list#each (.function (_ member)
- (`` (`` (case member
+ (`` (`` (when member
(,, (for @.lua (,, (these))
@.ruby (,, (these))
(,, (these {#Constructor it}
@@ -631,10 +631,10 @@
[head tail] (<code>.tuple (<>.and <code>.local (<>.some <code>.local)))])
(with_symbols [g!_]
(let [global (` ("js constant" (, (code.text head))))]
- (case tail
+ (when tail
{.#End}
(in (list (` (is (.Maybe (, type))
- (case (..type_of (, global))
+ (when (..type_of (, global))
"undefined"
{.#None}
@@ -644,7 +644,7 @@
{.#Item [next tail]}
(let [separator "."]
(in (list (` (is (.Maybe (, type))
- (case (..type_of (, global))
+ (when (..type_of (, global))
"undefined"
{.#None}
@@ -654,7 +654,7 @@
(def !defined?
(template (_ <global>)
- [(.case (..global Any <global>)
+ [(.when (..global Any <global>)
{.#None}
.false
@@ -706,7 +706,7 @@
(.function (_ name phase archive inputs)
(.function (_ state)
(let [<bindings> [name phase archive state]]
- (case (<code>.result <parser> inputs)
+ (when (<code>.result <parser> inputs)
{try.#Failure error}
{try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
text.\n error)}
@@ -720,7 +720,7 @@
(.function (_ name phase archive inputs)
(.function (_ state)
(let [<bindings> [name phase archive state]]
- (case inputs
+ (when inputs
<inputs>
<body>
@@ -780,7 +780,7 @@
(def (pairs it)
(All (_ a) (-> (List a) (List [a a])))
- (case it
+ (when it
(list.partial left right tail)
(list.partial [left right] (pairs tail))
@@ -796,7 +796,7 @@
(do [! try.monad]
[[state output] (monad.mix !
(.function (_ [key value] [state output])
- (case key
+ (when key
(text_synthesis key)
(do try.monad
[[state value] (phase archive value state)]
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 2208f9ee4..7444e1d3a 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -284,7 +284,7 @@
... Utils
(def (manual_primitive_type class)
(-> Text (Maybe Code))
- (case class
+ (when class
(^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
@@ -303,7 +303,7 @@
(def (auto_primitive_type class)
(-> Text (Maybe Code))
- (case class
+ (when class
(^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
@@ -328,7 +328,7 @@
(-> Primitive_Mode (List Type_Parameter) Bit [Text (List GenericType)]
(-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
Code)
- (case [name+params mode in_array?]
+ (when [name+params mode in_array?]
(^.multi [[prim {.#End}] {#ManualPrM} .false]
[(manual_primitive_type prim)
{.#Some output}])
@@ -346,9 +346,9 @@
(def (class_type' mode type_params in_array? class)
(-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
- (case class
+ (when class
{#GenericTypeVar name}
- (case (list.example (function (_ [pname pbounds])
+ (when (list.example (function (_ [pname pbounds])
(and (text#= name pname)
(not (list.empty? pbounds))))
type_params)
@@ -386,7 +386,7 @@
(-> Class_Declaration Code)
(let [=params (list#each (.is (-> Type_Parameter Code)
(function (_ [pname pbounds])
- (case pbounds
+ (when pbounds
{.#End}
(code.symbol ["" pname])
@@ -400,9 +400,9 @@
(def (simple_class$ env class)
(-> (List Type_Parameter) GenericType Text)
- (case class
+ (when class
{#GenericTypeVar name}
- (case (list.example (function (_ [pname pbounds])
+ (when (list.example (function (_ [pname pbounds])
(and (text#= name pname)
(not (list.empty? pbounds))))
env)
@@ -423,7 +423,7 @@
(safe name)
{#GenericArray param'}
- (case param'
+ (when param'
{#GenericArray param}
(format "[" (simple_class$ env param))
@@ -467,7 +467,7 @@
(def (pre_walk_replace f input)
(-> (-> Code Code) Code Code)
- (case (f input)
+ (when (f input)
(^.with_template [<tag>]
[[meta {<tag> parts}]
[meta {<tag> (list#each (pre_walk_replace f) parts)}]])
@@ -480,7 +480,7 @@
(def (parser_replacer p ast)
(-> (Parser Code) (-> Code Code))
- (case (<>.result p (list ast))
+ (when (<>.result p (list ast))
{.#Right [{.#End} ast']}
ast'
@@ -490,7 +490,7 @@
(def (field_parser class_name [[field_name _ _] field])
(-> Text [Member_Declaration FieldDecl] (Parser Code))
- (case field
+ (when field
{#ConstantField _}
(get_const_parser class_name field_name)
@@ -537,7 +537,7 @@
(def (method_parser params class_name [[method_name _ _] meth_def])
(-> (List Type_Parameter) Text [Member_Declaration Method_Definition] (Parser Code))
- (case meth_def
+ (when meth_def
{#ConstructorMethod strict? type_vars args constructor_args return_expr exs}
(constructor_parser params class_name args)
@@ -603,7 +603,7 @@
(in {#GenericClass name (list)})))
(<code>.tuple (do <>.monad
[component again^]
- (case component
+ (when component
(^.with_template [<class> <name>]
[{#GenericClass <name> {.#End}}
(in {#GenericClass <class> (list)})])
@@ -988,7 +988,7 @@
(def (privacy_modifier$ pm)
(-> Privacy JVM_Code)
- (case pm
+ (when pm
{#PublicP} "public"
{#PrivateP} "private"
{#ProtectedP} "protected"
@@ -996,7 +996,7 @@
(def (inheritance_modifier$ im)
(-> Inheritance JVM_Code)
- (case im
+ (when im
{#FinalI} "final"
{#AbstractI} "abstract"
{#DefaultI} "default"))
@@ -1011,13 +1011,13 @@
(def (bound_kind$ kind)
(-> BoundKind JVM_Code)
- (case kind
+ (when kind
{#UpperBound} "<"
{#LowerBound} ">"))
(def (generic_type$ gtype)
(-> GenericType JVM_Code)
- (case gtype
+ (when gtype
{#GenericTypeVar name}
name
@@ -1061,14 +1061,14 @@
(def (state_modifier$ sm)
(-> State JVM_Code)
- (case sm
+ (when sm
{#VolatileS} "volatile"
{#FinalS} "final"
{#DefaultS} "default"))
(def (field_decl$ [[name pm anns] field])
(-> [Member_Declaration FieldDecl] JVM_Code)
- (case field
+ (when field
{#ConstantField class value}
(with_parens
(spaced (list "constant" name
@@ -1099,7 +1099,7 @@
(def (method_def$ replacer super_class [[name pm anns] method_def])
(-> (-> Code Code) Super_Class_Decl [Member_Declaration Method_Definition] JVM_Code)
- (case method_def
+ (when method_def
{#ConstructorMethod strict_fp? type_vars arg_decls constructor_args body exs}
(with_parens
(spaced (list "init"
@@ -1280,7 +1280,7 @@
(def .public !!!
(syntax (_ [expr <code>.any])
(with_symbols [g!value]
- (in (list (` (.case (, expr)
+ (in (list (` (.when (, expr)
{.#Some (, g!value)}
(, g!value)
@@ -1298,7 +1298,7 @@
{.#Some (.as (, class_type)
(, g!unchecked))}
{.#None}))]
- (case unchecked
+ (when unchecked
{.#Some unchecked}
(in (list (` (.is (, check_type)
(let [(, g!unchecked) (, unchecked)]
@@ -1335,12 +1335,12 @@
(def (member_type_vars class_tvars member)
(-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter))
- (case member
+ (when member
{#ConstructorDecl [commons _]}
(list#composite class_tvars (the #import_member_tvars commons))
{#MethodDecl [commons _]}
- (case (the #import_member_kind commons)
+ (when (the #import_member_kind commons)
{#StaticIMK}
(the #import_member_tvars commons)
@@ -1352,7 +1352,7 @@
(def (member_def_arg_bindings type_params class member)
(-> (List Type_Parameter) Class_Declaration Import_Member_Declaration (Meta [(List [Bit Code]) (List Text) (List Code)]))
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(let [(open "[0]") commons]
(do [! meta.monad]
@@ -1379,7 +1379,7 @@
(def (decorate_return_maybe class member return_term)
(-> Class_Declaration Import_Member_Declaration Code Code)
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(if (the #import_member_maybe? commons)
(` (??? (, return_term)))
@@ -1398,7 +1398,7 @@
(with_template [<name> <tag> <term_trans>]
[(def (<name> member return_term)
(-> Import_Member_Declaration Code Code)
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(if (the <tag> commons)
<term_trans>
@@ -1413,7 +1413,7 @@
(def (free_type_param? [name bounds])
(-> Type_Parameter Bit)
- (case bounds
+ (when bounds
{.#End}
true
@@ -1427,7 +1427,7 @@
(with_template [<name> <byte> <short> <int> <float>]
[(def (<name> mode [class expression])
(-> Primitive_Mode [Text Code] Code)
- (case mode
+ (when mode
{#ManualPrM}
expression
@@ -1471,12 +1471,12 @@
all_params (|> (member_type_vars class_tvars member)
(list.only free_type_param?)
(list#each lux_type_parameter))]
- (case member
+ (when member
{#EnumDecl enum_members}
(macro.with_symbols [g!_]
(do [! meta.monad]
[.let [enum_type (.is Code
- (case class_tvars
+ (when class_tvars
{.#End}
(` (Primitive (, (code.text full_name))))
@@ -1513,13 +1513,13 @@
(open "[0]") commons
(open "[0]") method
[jvm_op object_ast] (.is [Text (List Code)]
- (case #import_member_kind
+ (when #import_member_kind
{#StaticIMK}
["invokestatic"
(list)]
{#VirtualIMK}
- (case kind
+ (when kind
{#Class}
["invokevirtual"
(list g!obj)]
@@ -1621,7 +1621,7 @@
(def (class_kind [class_name _])
(-> Class_Declaration (Meta Class_Kind))
(let [class_name (..safe class_name)]
- (case (..load_class class_name)
+ (when (..load_class class_name)
{try.#Success class}
(at meta.monad in (if (interface? class)
{#Interface}
@@ -1645,7 +1645,7 @@
(def .public array
(syntax (_ [type (..generic_type^ (list))
size <code>.any])
- (case type
+ (when type
(^.with_template [<type> <array_op>]
[{#GenericClass <type> (list)}
(in (list (` (<array_op> (, size)))))])
@@ -1669,12 +1669,12 @@
(-> Type (Meta Text))
(if (type#= Any type)
(at meta.monad in "java.lang.Object")
- (case type
+ (when type
{.#Primitive name params}
(at meta.monad in name)
{.#Apply A F}
- (case (type.applied (list A) F)
+ (when (type.applied (list A) F)
{.#None}
(meta.failure (format "Cannot apply type: " (type.format F) " to " (type.format A)))
@@ -1690,12 +1690,12 @@
(def .public read!
(syntax (_ [idx <code>.any
array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
- (case array_jvm_type
+ (when array_jvm_type
(^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (, array) (, idx)))))])
@@ -1720,12 +1720,12 @@
(syntax (_ [idx <code>.any
value <code>.any
array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
- (case array_jvm_type
+ (when array_jvm_type
(^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (, array) (, idx) (, value)))))])
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index d891daf44..1eea0f3a0 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -147,7 +147,7 @@
(def (with_null g!temp [nullable? input])
(-> Code [Bit Code] Code)
(if nullable?
- (` (case (, input)
+ (` (when (, input)
{.#Some (, g!temp)}
(, g!temp)
@@ -188,7 +188,7 @@
(def .public try
(syntax (_ [expression <code>.any])
- ... {.#doc (example (case (try (risky_computation input))
+ ... {.#doc (example (when (try (risky_computation input))
... {.#Right success}
... (do_something success)
@@ -240,7 +240,7 @@
(def .public import
(syntax (_ [import ..import])
(with_symbols [g!temp]
- (case import
+ (when import
{#Class [class alias format members]}
(with_symbols [g!object]
(let [qualify (is (-> Text Code)
@@ -254,7 +254,7 @@
(in (list.partial (` (type (, g!type)
(..Object (Primitive (, (code.text class))))))
(list#each (function (_ member)
- (case member
+ (when member
{#Field [static? field alias fieldT]}
(let [g!field (qualify (maybe.else field alias))]
(if static?
@@ -271,7 +271,7 @@
(as (..Object .Any) (, g!object)))))))))))
{#Method method}
- (case method
+ (when method
{#Static [method alias inputsT io? try? outputT]}
(..make_function (qualify (maybe.else method alias))
g!temp
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index b7ed29d92..434926adc 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -119,7 +119,7 @@
(def (with_nil g!temp [nilable? input])
(-> Code [Bit Code] Code)
(if nilable?
- (` (case (, input)
+ (` (when (, input)
{.#Some (, g!temp)}
(, g!temp)
@@ -153,7 +153,7 @@
(def .public try
(syntax (_ [expression <code>.any])
- ... {.#doc (example (case (try (risky_computation input))
+ ... {.#doc (example (when (try (risky_computation input))
... {.#Right success}
... (do_something success)
@@ -205,7 +205,7 @@
(def .public import
(syntax (_ [import ..import])
(with_symbols [g!temp]
- (case import
+ (when import
{#Function [name alias inputsT io? try? outputT]}
(let [imported (` ("scheme constant" (, (code.text name))))]
(in (list (..make_function (code.local (maybe.else name alias))
diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux
index ddd8f9d50..9c16d04a4 100644
--- a/stdlib/source/library/lux/ffi/export.jvm.lux
+++ b/stdlib/source/library/lux/ffi/export.jvm.lux
@@ -70,7 +70,7 @@
exports (<>.many ..exportP)])
(let [initialization (is (List (API Constant))
(list.all (.function (_ it)
- (case it
+ (when it
{#Constant it}
{.#Some it}
@@ -79,7 +79,7 @@
exports))]
(in (list (` (//.class "final" (, (code.local api))
(,* (list#each (.function (_ it)
- (case it
+ (when it
{#Constant [name type term]}
(` ("public" "final" "static" (, (code.local name)) (, type)))
diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux
index 62fa2b691..614cd7b45 100644
--- a/stdlib/source/library/lux/ffi/export.rb.lux
+++ b/stdlib/source/library/lux/ffi/export.rb.lux
@@ -114,7 +114,7 @@
.let [[:input:/* :output:] (type.flat_function type)
code (if global?
(/.set (list (/.manual name)) term)
- (case :input:/*
+ (when :input:/*
{.#End}
(/.function (/.manual name) (list)
(/.return term))
@@ -136,7 +136,7 @@
(monad.each ! ..definition)))
(at ! conjoint)
(at ! each (list#each (function (_ [name term])
- (` (<extension> (,* (case name
+ (` (<extension> (,* (when name
{#Method name}
(list (code.bit false) (code.text name))
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index 486c7221a..0d470214a 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -47,7 +47,7 @@
(def (composite phase archive <+> last prevs)
(-> Phase Archive Code Analysis (List Analysis) (Operation Analysis))
- (case <+>
+ (when <+>
[_ {.#Text $}]
(phase#in (list#mix (function (_ left right)
{analysis.#Extension $ (list left right)})
@@ -81,7 +81,7 @@
operands)
_ (type.inference :it:)
:it: (type.check (check.identity (list) $it))]
- (case (list.reversed operands)
+ (when (list.reversed operands)
(list single)
(in single)
diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux
index 6716f43b2..871f9c7f4 100644
--- a/stdlib/source/library/lux/math/infix.lux
+++ b/stdlib/source/library/lux/math/infix.lux
@@ -58,7 +58,7 @@
(def (prefix infix)
(-> Infix Code)
- (case infix
+ (when infix
{#Const value}
value
diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux
index 87f575f54..3899e9a55 100644
--- a/stdlib/source/library/lux/math/modular.lux
+++ b/stdlib/source/library/lux/math/modular.lux
@@ -134,7 +134,7 @@
(All (_ %) (-> (Mod %) (Maybe (Mod %))))
(let [[modulus value] (representation modular)
[[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))]
- (case gcd
+ (when gcd
+1 {.#Some (..modular modulus vk)}
_ {.#None})))
)
diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux
index 8e1233bf3..b31167dc9 100644
--- a/stdlib/source/library/lux/math/number.lux
+++ b/stdlib/source/library/lux/math/number.lux
@@ -21,7 +21,7 @@
(def (separator_prefixed? number)
(-> Text Bit)
- (case ("lux text index" 0 ..separator number)
+ (when ("lux text index" 0 ..separator number)
{.#Some 0}
true
@@ -35,12 +35,12 @@
(with_template [<macro> <nat> <int> <rev> <frac> <error>]
[(def .public <macro>
(macro (_ tokens state)
- (case tokens
+ (when tokens
{.#Item [meta {.#Text repr'}] {.#End}}
(if (..separator_prefixed? repr')
{try.#Failure <error>}
(let [repr (..without_separators repr')]
- (case (at <nat> decoded repr)
+ (when (at <nat> decoded repr)
{try.#Success value}
{try.#Success [state (list [meta {.#Nat value}])]}
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index 8392c9a57..c862a952e 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -288,7 +288,7 @@
(def .public (roots nth input)
(-> Nat Complex (List Complex))
- (case nth
+ (when nth
0 (list)
_ (let [r_nth (|> nth .int int.frac)
nth_root_of_abs (|> input ..abs (f.pow (f./ r_nth +1.0)))
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 05811c9cc..1cbe2d535 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -603,7 +603,7 @@
(Codec Text Frac)
(implementation
(def (encoded x)
- (case x
+ (when x
-0.0 (let [output ("lux f64 encode" x)]
(if (text.starts_with? "-" output)
output
@@ -613,7 +613,7 @@
("lux text concat" "+" ("lux f64 encode" x)))))
(def (decoded input)
- (case ("lux f64 decode" input)
+ (when ("lux f64 decode" input)
{.#Some value}
{try.#Success value}
@@ -715,7 +715,7 @@
(def .public (of_bits it)
(-> I64 Frac)
- (case [(is Nat (..exponent it))
+ (when [(is Nat (..exponent it))
(is Nat (..mantissa it))
(is Nat (..sign it))]
[..special_exponent_bits 0 0]
@@ -754,7 +754,7 @@
(`` (def (representation_exponent codec representation)
(-> (Codec Text Nat) Text (Try [Text Int]))
- (case [("lux text index" 0 "e+" representation)
+ (when [("lux text index" 0 "e+" representation)
("lux text index" 0 "E+" representation)
("lux text index" 0 "e-" representation)
("lux text index" 0 "E-" representation)]
@@ -788,7 +788,7 @@
exponent (//int.- (.int ..double_bias) (..exponent bits))
sign (..sign bits)]
(all "lux text concat"
- (case (.nat sign)
+ (when (.nat sign)
1 "-"
0 "+"
_ (undefined))
@@ -802,7 +802,7 @@
(if (or negative? positive?)
(do [! try.monad]
[[mantissa exponent] (..representation_exponent <nat> representation)
- [whole decimal] (case ("lux text index" 0 "." mantissa)
+ [whole decimal] (when ("lux text index" 0 "." mantissa)
{.#Some split_index}
(do !
[.let [after_offset (++ split_index)
@@ -816,7 +816,7 @@
{.#None}
{try.#Failure ("lux text concat" <error> representation)})
.let [whole ("lux text clip" 1 (-- ("lux text size" whole)) whole)]
- mantissa (at <nat> decoded (case decimal
+ mantissa (at <nat> decoded (when decimal
0 whole
_ ("lux text concat" whole (at <nat> encoded decimal))))
.let [sign (if negative? 1 0)]]
diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux
index b83bf1f72..53c71f68f 100644
--- a/stdlib/source/library/lux/math/number/i16.lux
+++ b/stdlib/source/library/lux/math/number/i16.lux
@@ -16,7 +16,7 @@
(def .public I16
Type
... TODO: Switch to the cleaner approach ASAP.
- (case (type_of ..sub)
+ (when (type_of ..sub)
{.#Apply :size: :sub:}
(type_literal (I64 :size:))
diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux
index 4423f3098..3d7acc842 100644
--- a/stdlib/source/library/lux/math/number/i32.lux
+++ b/stdlib/source/library/lux/math/number/i32.lux
@@ -18,7 +18,7 @@
(def .public I32
Type
... TODO: Switch to the cleaner approach ASAP.
- (case (type_of ..sub)
+ (when (type_of ..sub)
{.#Apply :size: :sub:}
(type_literal (I64 :size:))
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index d476bc4ff..9a1077f88 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -60,9 +60,9 @@
(def .public (mask amount_of_bits)
(-> Nat Mask)
- (case amount_of_bits
+ (when amount_of_bits
0 ..false
- bits (case (n.% ..width bits)
+ bits (when (n.% ..width bits)
0 ..true
bits (|> 1 .i64 (..left_shifted (n.% ..width bits)) .--))))
@@ -205,7 +205,7 @@
(..or (|> value (..and ..sign) (..right_shifted sign_shift))
(|> value (..and mantissa))))
(def (wide value)
- (.i64 (case (.nat (..and sign value))
+ (.i64 (when (.nat (..and sign value))
0 value
_ (..or co_mantissa value))))))})
{.#None}))
diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux
index 49ccad042..d4ac05aaf 100644
--- a/stdlib/source/library/lux/math/number/i8.lux
+++ b/stdlib/source/library/lux/math/number/i8.lux
@@ -16,7 +16,7 @@
(def .public I8
Type
... TODO: Switch to the cleaner approach ASAP.
- (case (type_of ..sub)
+ (when (type_of ..sub)
{.#Apply :size: :sub:}
(type_literal (I64 :size:))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index 2dfb5e7b8..c51ed91bd 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -122,7 +122,7 @@
... https://en.wikipedia.org/wiki/Greatest_common_divisor
(def .public (gcd a b)
(-> Int Int Int)
- (case b
+ (when b
+0 a
_ (gcd b (..% b a))))
@@ -136,7 +136,7 @@
(loop (again [x +1 x1 +0
y +0 y1 +1
a1 a b1 b])
- (case b1
+ (when b1
+0 [[x y] a1]
_ (let [q (/ b1 a1)]
(again x1 (- (* q x1) x)
@@ -146,7 +146,7 @@
... https://en.wikipedia.org/wiki/Least_common_multiple
(`` (def .public (lcm a b)
(-> Int Int Int)
- (case [a b]
+ (when [a b]
(,, (with_template [<pattern>]
[<pattern>
+0]
@@ -221,7 +221,7 @@
(def (decoded repr)
(let [input_size ("lux text size" repr)]
(if (//nat.> 1 input_size)
- (case ("lux text clip" 0 1 repr)
+ (when ("lux text clip" 0 1 repr)
..+sign
(|> repr
("lux text clip" 1 (-- input_size))
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index cef20dca2..f5fd924d5 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -111,7 +111,7 @@
(def .public (gcd a b)
(-> Nat Nat Nat)
- (case b
+ (when b
0 a
_ (gcd b (..% b a))))
@@ -121,7 +121,7 @@
(`` (def .public (lcm a b)
(-> Nat Nat Nat)
- (case [a b]
+ (when [a b]
(,, (with_template [<pattern>]
[<pattern>
0]
@@ -184,21 +184,21 @@
(def (binary_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
_ (undefined)))
(def (binary_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(char "0") {.#Some 0}
(char "1") {.#Some 1}
_ {.#None}))
(def (octal_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
2 "2"
@@ -211,7 +211,7 @@
(def (octal_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(char "0") {.#Some 0}
(char "1") {.#Some 1}
(char "2") {.#Some 2}
@@ -224,7 +224,7 @@
(def (decimal_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
2 "2"
@@ -239,7 +239,7 @@
(def (decimal_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(char "0") {.#Some 0}
(char "1") {.#Some 1}
(char "2") {.#Some 2}
@@ -254,7 +254,7 @@
(def (hexadecimal_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
2 "2"
@@ -275,7 +275,7 @@
(`` (def (hexadecimal_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(,, (with_template [<character> <number>]
[(char <character>)
{.#Some <number>}]
@@ -308,7 +308,7 @@
(let [output' ("lux text concat"
(<to_character> ("lux i64 and" mask input))
output)]
- (case (is Nat ("lux i64 right-shift" <shift> input))
+ (when (is Nat ("lux i64 right-shift" <shift> input))
0
output'
@@ -321,7 +321,7 @@
(loop (again [idx 0
output 0])
(if (..< input_size idx)
- (case (<to_value> ("lux text char" idx repr))
+ (when (<to_value> ("lux text char" idx repr))
{.#Some digit_value}
(again (++ idx)
(|> output
@@ -346,7 +346,7 @@
output ""])
(let [digit (decimal_character (..% 10 input))
output' ("lux text concat" digit output)]
- (case (../ 10 input)
+ (when (../ 10 input)
0
output'
@@ -360,7 +360,7 @@
(loop (again [idx 0
output 0])
(if (..< input_size idx)
- (case (decimal_value ("lux text char" idx repr))
+ (when (decimal_value ("lux text char" idx repr))
{.#None}
<failure>
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index b81667def..2974eae8b 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -30,7 +30,7 @@
(def .public (nat value)
(-> Ratio (Maybe Nat))
- (case (the #denominator value)
+ (when (the #denominator value)
1 {.#Some (the #numerator value)}
_ {.#None}))
@@ -139,7 +139,7 @@
..separator (n#encoded _#denominator)))
(def (decoded input)
- (case (text.split_by ..separator input)
+ (when (text.split_by ..separator input)
{.#Some [num denom]}
(do try.monad
[numerator (n#decoded num)
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index 1d164f539..a1b8e14ed 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -127,7 +127,7 @@
(with_expansions [<least_significant_bit> 1]
(def .public (reciprocal numerator)
(-> Nat Rev)
- (.rev (case (is Nat ("lux i64 and" <least_significant_bit> numerator))
+ (.rev (when (is Nat ("lux i64 and" <least_significant_bit> numerator))
0 (..even_reciprocal numerator)
_ (..odd_reciprocal numerator))))
@@ -135,7 +135,7 @@
(-> Rev Rev Rev)
(if ("lux i64 =" +0 param)
(panic! "Cannot divide Rev by zero!")
- (let [reciprocal (case (is Nat ("lux i64 and" <least_significant_bit> param))
+ (let [reciprocal (when (is Nat ("lux i64 and" <least_significant_bit> param))
0 (..even_reciprocal (.nat param))
_ (..odd_reciprocal (.nat param)))]
(.rev (//nat.* reciprocal (.nat subject)))))))
@@ -230,7 +230,7 @@
(def (encoded value)
(let [raw_output (at <codec> encoded (.nat value))
max_num_chars (//nat.+ (//nat./ <char_bit_size> //i64.width)
- (case (//nat.% <char_bit_size> //i64.width)
+ (when (//nat.% <char_bit_size> //i64.width)
0 0
_ 1))
raw_size ("lux text size" raw_output)
@@ -248,9 +248,9 @@
(def (decoded repr)
(let [repr_size ("lux text size" repr)]
(if (//nat.> 1 repr_size)
- (case ("lux text char" 0 repr)
+ (when ("lux text char" 0 repr)
(char ".")
- (case (at <codec> decoded (..decimals repr))
+ (when (at <codec> decoded (..decimals repr))
{try.#Success output}
{try.#Success (.rev output)}
@@ -359,7 +359,7 @@
(loop (again [idx 0
output (..digits [])])
(if (//nat.< length idx)
- (case ("lux text index" 0 ("lux text clip" idx 1 input) "0123456789")
+ (when ("lux text index" 0 ("lux text clip" idx 1 input) "0123456789")
{.#None}
{.#None}
@@ -403,7 +403,7 @@
(Codec Text Rev)
(implementation
(def (encoded input)
- (case (.nat input)
+ (when (.nat input)
0
".0"
@@ -422,7 +422,7 @@
digits)))))))
(def (decoded input)
- (let [dotted? (case ("lux text index" 0 "." input)
+ (let [dotted? (when ("lux text index" 0 "." input)
{.#Some 0}
true
@@ -432,7 +432,7 @@
"lux text size"
(//nat.<= (++ //i64.width)))]
(if (and dotted? within_limits?)
- (case (|> input ..decimals ..text_digits)
+ (when (|> input ..decimals ..text_digits)
{.#Some digits}
(loop (again [digits digits
idx 0
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index d482c72b3..3d7b33581 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -92,7 +92,7 @@
(-> (-> a (Maybe b)) (Random a) (Random b)))
(do ..monad
[sample random]
- (case (check sample)
+ (when (check sample)
{.#Some output}
(in output)
@@ -103,7 +103,7 @@
(All (_ t r) (-> (Refiner t r) (Random t) (Random (Refined t r))))
(do ..monad
[sample gen]
- (case (refiner sample)
+ (when (refiner sample)
{.#Some refined}
(in refined)
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index c2123fa99..5cb1d3894 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -31,7 +31,7 @@
(implementation
(def (each f fa)
(function (_ lux)
- (case (fa lux)
+ (when (fa lux)
{try.#Success [lux' a]}
{try.#Success [lux' (f a)]}
@@ -45,9 +45,9 @@
(def (on fa ff)
(function (_ lux)
- (case (ff lux)
+ (when (ff lux)
{try.#Success [lux' f]}
- (case (fa lux')
+ (when (fa lux')
{try.#Success [lux'' a]}
{try.#Success [lux'' (f a)]}
@@ -68,7 +68,7 @@
(def (conjoint mma)
(function (_ lux)
- (case (mma lux)
+ (when (mma lux)
{try.#Success [lux' ma]}
(ma lux')
@@ -81,7 +81,7 @@
(def .public (result lux action)
(All (_ a) (-> Lux (Meta a) (Try a)))
- (case (action lux)
+ (when (action lux)
{try.#Success [_ output]}
{try.#Success output}
@@ -91,7 +91,7 @@
(def .public (either left right)
(All (_ a) (-> (Meta a) (Meta a) (Meta a)))
(function (_ lux)
- (case (left lux)
+ (when (left lux)
{try.#Success [lux' output]}
{try.#Success [lux' output]}
@@ -114,7 +114,7 @@
(def .public (module name)
(-> Text (Meta Module))
(function (_ lux)
- (case (property.value name (the .#modules lux))
+ (when (property.value name (the .#modules lux))
{.#Some module}
{try.#Success [lux module]}
@@ -124,7 +124,7 @@
(def .public current_module_name
(Meta Text)
(function (_ lux)
- (case (the .#current_module lux)
+ (when (the .#current_module lux)
{.#Some current_module}
{try.#Success [lux current_module]}
@@ -140,7 +140,7 @@
(def (macro_type? type)
(-> Type Bit)
- (case type
+ (when type
{.#Named [.prelude "Macro"]
{.#Primitive "#Macro" {.#End}}}
true
@@ -150,7 +150,7 @@
(def .public (normal name)
(-> Symbol (Meta Symbol))
- (case name
+ (when name
["" name]
(do ..monad
[module_name ..current_module_name]
@@ -166,7 +166,7 @@
(is (Meta (Maybe Macro))
(function (_ lux)
{try.#Success [lux
- (case (..current_module_name lux)
+ (when (..current_module_name lux)
{try.#Success [_ this_module]}
(let [modules (the .#modules lux)]
(loop (again [module module
@@ -178,7 +178,7 @@
(is Module)
(the .#definitions)
(property.value name)))]
- (case definition
+ (when definition
{.#Alias [r_module r_name]}
(again r_module r_name)
@@ -208,7 +208,7 @@
(def .public (module_exists? module)
(-> Text (Meta Bit))
(function (_ lux)
- {try.#Success [lux (case (property.value module (the .#modules lux))
+ {try.#Success [lux (when (property.value module (the .#modules lux))
{.#Some _}
true
@@ -218,13 +218,13 @@
(def (on_either f x1 x2)
(All (_ a b)
(-> (-> a (Maybe b)) a a (Maybe b)))
- (case (f x1)
+ (when (f x1)
{.#None} (f x2)
{.#Some y} {.#Some y}))
(def (type_variable idx bindings)
(-> Nat (List [Nat (Maybe Type)]) (Maybe Type))
- (case bindings
+ (when bindings
{.#End}
{.#None}
@@ -235,10 +235,10 @@
(`` (def (clean_type type)
(-> Type (Meta Type))
- (case type
+ (when type
{.#Var var}
(function (_ lux)
- (case (|> lux
+ (when (|> lux
(the [.#type_context .#var_bindings])
(type_variable var))
(,, (with_template [<pattern>]
@@ -260,7 +260,7 @@
(function (_ lux)
(let [test (is (-> [Text [Type Any]] Bit)
(|>> product.left (text#= name)))]
- (case (do maybe.monad
+ (when (do maybe.monad
[scope (list.example (function (_ env)
(or (list.any? test (is (List [Text [Type Any]])
(the [.#locals .#mappings] env)))
@@ -301,7 +301,7 @@
[name (..normal name)
.let [[normal_module normal_short] name]]
(function (_ lux)
- (case (is (Maybe Global)
+ (when (is (Maybe Global)
(do maybe.monad
[(open "[0]") (|> lux
(the .#modules)
@@ -319,7 +319,7 @@
{try.#Failure (all text#composite
"Unknown definition: " (symbol#encoded name) text.new_line
" Current module: " current_module text.new_line
- (case (property.value current_module (the .#modules lux))
+ (when (property.value current_module (the .#modules lux))
{.#Some this_module}
(let [candidates (|> lux
(the .#modules)
@@ -327,7 +327,7 @@
(|> module
(the .#definitions)
(list.all (function (_ [def_name global])
- (`` (case global
+ (`` (when global
(,, (with_template [<pattern>]
[<pattern>
(if (and exported?
@@ -370,7 +370,7 @@
(-> Symbol (Meta Definition))
(do ..monad
[definition (..definition name)]
- (case definition
+ (when definition
{.#Definition definition}
(let [[exported? def_type def_value] definition]
(if exported?
@@ -401,7 +401,7 @@
(-> Symbol (Meta Type))
(do ..monad
[definition (definition name)]
- (case definition
+ (when definition
{.#Alias de_aliased}
(definition_type de_aliased)
@@ -423,7 +423,7 @@
(def .public (type name)
(-> Symbol (Meta Type))
- (case name
+ (when name
["" _name]
(either (var_type _name)
(definition_type name))
@@ -435,7 +435,7 @@
(-> Symbol (Meta Type))
(do ..monad
[definition (definition name)]
- (case definition
+ (when definition
{.#Alias de_aliased}
(type_definition de_aliased)
@@ -460,7 +460,7 @@
(def .public (globals module)
(-> Text (Meta (List [Text Global])))
(function (_ lux)
- (case (property.value module (the .#modules lux))
+ (when (property.value module (the .#modules lux))
{.#Some module}
{try.#Success [lux (the .#definitions module)]}
@@ -471,7 +471,7 @@
(-> Text (Meta (List [Text Definition])))
(at ..monad each
(list.all (function (_ [name global])
- (case global
+ (when global
{.#Alias de_aliased}
{.#None}
@@ -511,9 +511,9 @@
(do ..monad
[.let [[module_name name] type_name]
module (..module module_name)]
- (case (property.value name (the .#definitions module))
+ (when (property.value name (the .#definitions module))
{.#Some {.#Type [exported? type labels]}}
- (case labels
+ (when labels
(,, (with_template [<pattern>]
[<pattern>
(in {.#Some (list#each (|>> [module_name])
@@ -533,7 +533,7 @@
(def .public expected_type
(Meta Type)
(function (_ lux)
- (case (the .#expected lux)
+ (when (the .#expected lux)
{.#Some type}
{try.#Success [lux type]}
@@ -565,7 +565,7 @@
[.let [[module name] label_name]
=module (..module module)
this_module_name ..current_module_name]
- (case (property.value name (the .#definitions =module))
+ (when (property.value name (the .#definitions =module))
{.#Some {<tag> [exported? type group idx]}}
(if (or (text#= this_module_name module)
exported?)
@@ -586,12 +586,12 @@
[=module (..module module)
this_module_name ..current_module_name]
(in (list.all (function (_ [short global])
- (case global
+ (when global
{.#Type [exported? type labels]}
(if (or exported?
(text#= this_module_name module))
{.#Some [(list#each (|>> [module])
- (case labels
+ (when labels
{.#Left tags}
{.#Item tags}
@@ -607,7 +607,7 @@
(def .public locals
(Meta (List (List [Text Type])))
(function (_ lux)
- (case (list.inits (the .#scopes lux))
+ (when (list.inits (the .#scopes lux))
{.#Some scopes}
{try.#Success [lux
(list#each (|>> (the [.#locals .#mappings])
@@ -622,7 +622,7 @@
(-> Symbol (Meta Symbol))
(do ..monad
[constant (..definition def_name)]
- (in (case constant
+ (in (when constant
{.#Alias real_def_name}
real_def_name
@@ -650,7 +650,7 @@
(def .public (lifted result)
(All (_ a) (-> (Try a) (Meta a)))
- (case result
+ (when result
{try.#Success output}
(at ..monad in output)
@@ -667,7 +667,7 @@
(def .public (try computation)
(All (_ it) (-> (Meta it) (Meta (Try it))))
(function (_ lux)
- (case (computation lux)
+ (when (computation lux)
{try.#Success [lux' output]}
{try.#Success [lux' {try.#Success output}]}
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))
diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux
index 794dcbcc8..9c9e5148a 100644
--- a/stdlib/source/library/lux/program.lux
+++ b/stdlib/source/library/lux/program.lux
@@ -43,14 +43,14 @@
(, g!_) thread.run!]
((,' in) (, g!output)))))]
(in (list (` (is Program
- (, (case args
+ (, (when args
{#Raw args}
(` (.function ((, g!program) (, (code.symbol ["" args])))
(, initialization+event_loop)))
{#Parsed args}
(` (.function ((, g!program) (, g!args))
- (case (</>.result (.is (</>.Parser (io.IO .Any))
+ (when (</>.result (.is (</>.Parser (io.IO .Any))
(do <>.monad
[(,* args)
(, g!_) </>.end]
diff --git a/stdlib/source/library/lux/test/property.lux b/stdlib/source/library/lux/test/property.lux
index ff61d64d5..e18d7b36b 100644
--- a/stdlib/source/library/lux/test/property.lux
+++ b/stdlib/source/library/lux/test/property.lux
@@ -110,7 +110,7 @@
(def .public (times amount test)
(-> Nat Test Test)
- (case amount
+ (when amount
0 (..failure (exception.error ..must_try_test_at_least_once []))
_ (do random.monad
[seed random.nat]
@@ -120,7 +120,7 @@
[[tally documentation] instance]
(if (..failed? tally)
(in [tally (times_failure seed documentation)])
- (case amount
+ (when amount
1 instance
_ (|> test
(times (-- amount))
@@ -143,7 +143,7 @@
unexpected_coverage (set.size unexpected)
actual_coverage (n.- unexpected_coverage
(set.size (the tally.#actual tally)))
- coverage (case expected_coverage
+ coverage (when expected_coverage
0 "N/A"
expected (let [missing_ratio (f./ (n.frac expected)
(n.frac (set.size missing)))
@@ -197,7 +197,7 @@
(..description duration tally)
text.new_line)]
_ (with_expansions [<else> (in {try.#Success (debug.log! report)})]
- (.for @.js (case console.default
+ (.for @.js (when console.default
{.#None}
<else>
@@ -205,7 +205,7 @@
(console.write_line report console))
<else>))]
(async.future (at environment.default exit
- (case (the tally.#failures tally)
+ (when (the tally.#failures tally)
0 ..success_exit_code
_ ..failure_exit_code)))))
@@ -236,7 +236,7 @@
(def .public (in_parallel tests)
(-> (List Test) Test)
- (case (list.size tests)
+ (when (list.size tests)
0
(random#in (async#in [tally.empty ""]))
@@ -249,7 +249,7 @@
product.right
(function (_ _))
"lux try"
- (pipe.case
+ (pipe.when
{try.#Success output}
output
diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux
index b1ae1618c..71761bead 100644
--- a/stdlib/source/library/lux/world/console.lux
+++ b/stdlib/source/library/lux/world/console.lux
@@ -70,7 +70,7 @@
(IO (Try (Console IO)))
(do io.monad
[?jvm_console (java/lang/System::console)]
- (case ?jvm_console
+ (when ?jvm_console
{.#None}
(in (exception.except ..cannot_open []))
@@ -122,10 +122,10 @@
(def !read
(template (_ <type> <query>)
[(let [it (process::stdin)]
- (case (Readable_Stream::read it)
+ (when (Readable_Stream::read it)
{.#Some buffer}
(let [input (Buffer::toString buffer)]
- (case (is (Maybe [<type> Text])
+ (when (is (Maybe [<type> Text])
<query>)
{.#Some [head tail]}
(exec
@@ -189,7 +189,7 @@
[(def (<method> _)
(do [! io.monad]
[|state| (atom.read! state)]
- (case (at mock <mock> |state|)
+ (when (at mock <mock> |state|)
{try.#Success [|state| output]}
(do !
[_ (atom.write! |state| state)]
@@ -205,7 +205,7 @@
(def (write input)
(do [! io.monad]
[|state| (atom.read! state)]
- (case (at mock on_write input |state|)
+ (when (at mock on_write input |state|)
{try.#Success |state|}
(do !
[_ (atom.write! |state| state)]
@@ -217,7 +217,7 @@
(def (close _)
(do [! io.monad]
[|state| (atom.read! state)]
- (case (at mock on_close |state|)
+ (when (at mock on_close |state|)
{try.#Success |state|}
(do !
[_ (atom.write! |state| state)]
diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux
index 383f565dc..6e7976a2c 100644
--- a/stdlib/source/library/lux/world/db/jdbc/output.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/output.lux
@@ -6,7 +6,6 @@
[functor (.only Functor)]
[apply (.only Apply)]
[monad (.only Monad do)]
- ["ex" exception]
["[0]" try (.only Try)]
["[0]" io (.only IO)]]
[world
@@ -55,7 +54,7 @@
(implementation
(def (each f fa)
(function (_ idx+rs)
- (case (fa idx+rs)
+ (when (fa idx+rs)
{try.#Failure error}
{try.#Failure error}
@@ -69,9 +68,9 @@
(def (apply ff fa)
(function (_ [idx rs])
- (case (ff [idx rs])
+ (when (ff [idx rs])
{try.#Success [idx' f]}
- (case (fa [idx' rs])
+ (when (fa [idx' rs])
{try.#Success [idx'' a]}
{try.#Success [idx'' (f a)]}
@@ -92,7 +91,7 @@
(def (conjoint mma)
(function (_ [idx rs])
- (case (mma [idx rs])
+ (when (mma [idx rs])
{try.#Failure error}
{try.#Failure error}
@@ -116,7 +115,7 @@
[(def .public <func_name>
(Output <type>)
(function (_ [idx result_set])
- (case (<method_name> [(.int idx)] result_set)
+ (when (<method_name> [(.int idx)] result_set)
{try.#Failure error}
{try.#Failure error}
@@ -141,7 +140,7 @@
[(def .public <func_name>
(Output Instant)
(function (_ [idx result_set])
- (case (<method_name> [(.int idx)] result_set)
+ (when (<method_name> [(.int idx)] result_set)
{try.#Failure error}
{try.#Failure error}
@@ -156,14 +155,14 @@
(def .public (rows output results)
(All (_ a) (-> (Output a) java/sql/ResultSet (IO (Try (List a)))))
- (case (java/sql/ResultSet::next results)
+ (when (java/sql/ResultSet::next results)
{try.#Success has_next?}
(if has_next?
- (case (output [1 results])
+ (when (output [1 results])
{.#Some [_ head]}
(do io.monad
[?tail (rows output results)]
- (case ?tail
+ (when ?tail
{try.#Success tail}
(in {try.#Success {.#Item head tail}})
diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux
index 70312b648..698c862bc 100644
--- a/stdlib/source/library/lux/world/db/sql.lux
+++ b/stdlib/source/library/lux/world/db/sql.lux
@@ -214,7 +214,7 @@
(abstraction
(format <op>
" "
- (case columns
+ (when columns
{.#End}
"*"
@@ -292,7 +292,7 @@
(-> (List [Value Order])
(Query where having No_Order group limit offset)
(Query where having With_Order group limit offset)))
- (case pairs
+ (when pairs
{.#End}
(|> query representation abstraction)
@@ -310,7 +310,7 @@
(-> (List Value)
(Query where having order No_Group limit offset)
(Query where having order With_Group limit offset)))
- (case pairs
+ (when pairs
{.#End}
(|> query representation abstraction)
@@ -335,7 +335,7 @@
(def .public (update table pairs)
(-> Table (List [Column Value]) (Command No_Where No_Having))
(abstraction (format "UPDATE " (representation table)
- (case pairs
+ (when pairs
{.#End}
""
diff --git a/stdlib/source/library/lux/world/environment.lux b/stdlib/source/library/lux/world/environment.lux
index ba85d53ef..ba941b30e 100644
--- a/stdlib/source/library/lux/world/environment.lux
+++ b/stdlib/source/library/lux/world/environment.lux
@@ -62,7 +62,7 @@
variables)]
(in (|> entries
(list.all (function (_ [name value])
- (case value
+ (when value
{try.#Success value}
{.#Some [name value]}
@@ -97,7 +97,7 @@
(def available_variables
(function.constant (io.io (dictionary.keys environment))))
(def (variable name)
- (io.io (case (dictionary.value name environment)
+ (io.io (when (dictionary.value name environment)
{.#Some value}
{try.#Success value}
@@ -156,7 +156,7 @@
(def (exit_node_js! code)
(-> Exit (IO Nothing))
- (case (ffi.global ..NodeJs_Process [process])
+ (when (ffi.global ..NodeJs_Process [process])
{.#Some process}
(NodeJs_Process::exit (i.frac code) process)
@@ -173,7 +173,7 @@
(def (exit_browser! code)
(-> Exit (IO Nothing))
- (case [(ffi.global ..Browser_Window [window])
+ (when [(ffi.global ..Browser_Window [window])
(ffi.global ..Browser_Location [location])]
[{.#Some window} {.#Some location}]
(exec
@@ -227,9 +227,9 @@
(-> Text Text (IO Text))
(do [! io.monad]
[outcome (io/popen [command])]
- (case outcome
+ (when outcome
{try.#Success outcome}
- (case outcome
+ (when outcome
{.#Some file}
(do !
[?output (LuaFile::read "*l" file)
@@ -296,7 +296,7 @@
(for @.old <jvm>
@.jvm <jvm>
@.js (io.io (if ffi.on_node_js?
- (case (ffi.global Object [process env])
+ (when (ffi.global Object [process env])
{.#Some process/env}
(|> (Object::entries [process/env])
(array.list {.#None})
@@ -332,7 +332,7 @@
(template.let [(!fetch <method> <post>)
[(do io.monad
[value (|> name <method>)]
- (in (case value
+ (in (when value
{.#Some value}
{try.#Success (<post> value)}
@@ -342,7 +342,7 @@
(for @.old <jvm>
@.jvm <jvm>
@.js (io.io (if ffi.on_node_js?
- (case (do maybe.monad
+ (when (do maybe.monad
[process/env (ffi.global Object [process env])]
(array.item (as Nat name)
(as (Array Text) process/env)))
@@ -394,7 +394,7 @@
(for @.old <jvm>
@.jvm <jvm>
@.js (if ffi.on_node_js?
- (case (ffi.global ..NodeJs_Process [process])
+ (when (ffi.global ..NodeJs_Process [process])
{.#Some process}
(NodeJs_Process::cwd process)
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index cb8c48307..eb4bb69fa 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -85,7 +85,7 @@
(def (un_rooted fs path)
(All (_ !) (-> (System !) Path (Maybe [Path Text])))
(let [/ (at fs separator)]
- (case (text.last_index / path)
+ (when (text.last_index / path)
{.#None}
{.#None}
@@ -228,7 +228,7 @@
[(def (<name> path)
(do [! (try.with io.monad)]
[?children (java/io/File::listFiles (java/io/File::new (ffi.as_string path)))]
- (case ?children
+ (when ?children
{.#Some children}
(|> children
(array.list {.#None})
@@ -396,7 +396,7 @@
[?stats (with_async write! (Try Stats)
(Fs::stat path (..value_callback write!)
node_fs))]
- (in (case ?stats
+ (in (when ?stats
{try.#Success stats}
(<method> stats)
@@ -414,7 +414,7 @@
(|> node_fs Fs::constants FsConstants::F_OK)
(..any_callback write!)
node_fs))]
- (case outcome
+ (when outcome
{try.#Success _}
(in (exception.except ..cannot_make_directory [path]))
@@ -463,7 +463,7 @@
(def (can_execute? path)
(at async.monad each
- (|>> (pipe.case
+ (|>> (pipe.when
{try.#Success _}
true
@@ -704,7 +704,7 @@
(list#each (|>> (format path ..ruby_separator))))
output (is (List ..Path)
(list))])
- (case input
+ (when input
{.#End}
(in output)
@@ -899,7 +899,7 @@
... (text#= ".." child))))))
... output (is (List (<capability> IO))
... (list))])
- ... (case input
+ ... (when input
... {.#End}
... (in output)
@@ -987,14 +987,14 @@
(-> Text Path Mock (Try [Text Mock_File]))
(loop (again [directory mock
trail (text.all_split_by separator path)])
- (case trail
+ (when trail
{.#Item head tail}
- (case (dictionary.value head directory)
+ (when (dictionary.value head directory)
{.#None}
(exception.except ..cannot_find_file [path])
{.#Some node}
- (case [node tail]
+ (when [node tail]
[{.#Left file} {.#End}]
{try.#Success [head file]}
@@ -1011,11 +1011,11 @@
(-> Text Path Instant Binary Mock (Try Mock))
(loop (again [directory mock
trail (text.all_split_by / path)])
- (case trail
+ (when trail
{.#Item head tail}
- (case (dictionary.value head directory)
+ (when (dictionary.value head directory)
{.#None}
- (case tail
+ (when tail
{.#End}
{try.#Success (dictionary.has head
{.#Left [#mock_last_modified now
@@ -1027,7 +1027,7 @@
(exception.except ..cannot_find_file [path]))
{.#Some node}
- (case [node tail]
+ (when [node tail]
[{.#Left file} {.#End}]
{try.#Success (dictionary.has head
{.#Left (|> file
@@ -1050,16 +1050,16 @@
(-> Text Path Mock (Try Mock))
(loop (again [directory mock
trail (text.all_split_by / path)])
- (case trail
+ (when trail
{.#Item head tail}
- (case (dictionary.value head directory)
+ (when (dictionary.value head directory)
{.#None}
(exception.except ..cannot_delete [path])
{.#Some node}
- (case tail
+ (when tail
{.#End}
- (case node
+ (when node
{.#Left file}
{try.#Success (dictionary.lacks head directory)}
@@ -1069,7 +1069,7 @@
(exception.except ..cannot_delete [path])))
{.#Item _}
- (case node
+ (when node
{.#Left file}
(exception.except ..cannot_delete [path])
@@ -1085,7 +1085,7 @@
(All (_ a) (-> (-> a (Try a)) (Var a) (STM (Try Any))))
(do [! stm.monad]
[|var| (stm.read var)]
- (case (transform |var|)
+ (when (transform |var|)
{try.#Success |var|}
(do !
[_ (stm.write |var| var)]
@@ -1098,11 +1098,11 @@
(-> Text Path Mock (Try Mock))
(loop (again [directory mock
trail (text.all_split_by / path)])
- (case trail
+ (when trail
{.#Item head tail}
- (case (dictionary.value head directory)
+ (when (dictionary.value head directory)
{.#None}
- (case tail
+ (when tail
{.#End}
{try.#Success (dictionary.has head {.#Right ..empty_mock} directory)}
@@ -1110,7 +1110,7 @@
(exception.except ..cannot_make_directory [path]))
{.#Some node}
- (case [node tail]
+ (when [node tail]
[{.#Right sub_directory} {.#Item _}]
(do try.monad
[sub_directory (again sub_directory tail)]
@@ -1126,22 +1126,22 @@
(-> Text Path Mock (Try Mock))
(loop (again [directory mock
trail (text.all_split_by / path)])
- (case trail
+ (when trail
{.#End}
{try.#Success directory}
{.#Item head tail}
- (case (dictionary.value head directory)
+ (when (dictionary.value head directory)
{.#None}
(exception.except ..cannot_find_directory [path])
{.#Some node}
- (case node
+ (when node
{.#Left _}
(exception.except ..cannot_find_directory [path])
{.#Right sub_directory}
- (case tail
+ (when tail
{.#End}
{try.#Success sub_directory}
@@ -1172,7 +1172,7 @@
(stm.commit!
(do [! stm.monad]
[|store| (stm.read store)]
- (case (..make_mock_directory! separator path |store|)
+ (when (..make_mock_directory! separator path |store|)
{try.#Success |store|}
(do !
[_ (stm.write |store| store)]
@@ -1191,7 +1191,7 @@
(in (|> directory
dictionary.entries
(list.all (function (_ [node_name node])
- (case node
+ (when node
{<tag> _}
{.#Some (format path separator node_name)}
@@ -1275,7 +1275,7 @@
(stm.commit!
(do [! stm.monad]
[|store| (stm.read store)]
- (case (do try.monad
+ (when (do try.monad
[[name file] (..retrieve_mock_file! separator origin |store|)
|store| (..delete_mock_node! separator origin |store|)]
(..update_mock_file! separator destination (the #mock_last_modified file) (the #mock_content file) |store|))
@@ -1300,14 +1300,14 @@
(All (_ !) (-> (Monad !) (System !) Path (! (Try Any))))
(let [rooted? (text.starts_with? (at fs separator) path)
segments (text.all_split_by (at fs separator) path)]
- (case (if rooted?
+ (when (if rooted?
(list.after 1 segments)
segments)
{.#End}
(at monad in (exception.except ..cannot_make_directory [path]))
{.#Item head tail}
- (case head
+ (when head
"" (at monad in (exception.except ..cannot_make_directory [path]))
_ (loop (again [current (if rooted?
(format (at fs separator) head)
@@ -1315,9 +1315,9 @@
next tail])
(do monad
[? (..check_or_make_directory monad fs current)]
- (case ?
+ (when ?
{try.#Success _}
- (case next
+ (when next
{.#End}
(in {try.#Success []})
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 91cd25c53..c0d79ea50 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -114,7 +114,7 @@
(-> Concern //.Path (Var Directory_Tracker) (STM Bit))
(do [! stm.monad]
[@tracker (stm.read tracker)]
- (case (dictionary.value path @tracker)
+ (when (dictionary.value path @tracker)
{.#Some [old_concern last_modified]}
(do !
[_ (stm.update (dictionary.has path [new_concern last_modified]) tracker)]
@@ -210,7 +210,7 @@
(stm.commit!
(do stm.monad
[@tracker (stm.read tracker)]
- (in (case (dictionary.value path @tracker)
+ (in (when (dictionary.value path @tracker)
{.#Some [it file_tracker]}
{try.#Success it}
@@ -220,7 +220,7 @@
(stm.commit!
(do [! stm.monad]
[@tracker (stm.read tracker)]
- (case (dictionary.value path @tracker)
+ (when (dictionary.value path @tracker)
{.#Some [the_concern file_tracker]}
(do !
[_ (stm.update (dictionary.lacks path) tracker)]
@@ -381,7 +381,7 @@
(list))])
(do (try.with io.monad)
[?key (java/nio/file/WatchService::poll watcher)]
- (case ?key
+ (when ?key
{.#Some key}
(do [! io.monad]
[valid? (java/nio/file/WatchKey::reset key)]
@@ -427,7 +427,7 @@
(function (_ path)
(do [! async.monad]
[@tracker (stm.commit! (stm.read tracker))]
- (case (dictionary.value path @tracker)
+ (when (dictionary.value path @tracker)
{.#Some [the_concern key]}
(do !
[_ (async.future
@@ -453,7 +453,7 @@
(def (concern path)
(do async.monad
[@tracker (stm.commit! (stm.read tracker))]
- (case (dictionary.value path @tracker)
+ (when (dictionary.value path @tracker)
{.#Some [it key]}
(in {try.#Success it})
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index dc3ea4219..c11a8285d 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -111,7 +111,7 @@
(def jvm_method
(-> //.Method Text)
- (|>> (pipe.case
+ (|>> (pipe.when
{//.#Post} "POST"
{//.#Get} "GET"
{//.#Put} "PUT"
@@ -126,7 +126,7 @@
(-> java/io/BufferedInputStream (//.Body IO))
(|>> (maybe#each (|>> [true]))
(maybe.else [false ..default_buffer_size])
- (pipe.case
+ (pipe.when
[_ 0]
(do (try.with io.monad)
[_ (java/lang/AutoCloseable::close input)]
@@ -140,7 +140,7 @@
[.let [remaining (i.- so_far (.int buffer_size))]
bytes_read (at ! each (|>> ffi.of_int)
(java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))]
- (case bytes_read
+ (when bytes_read
-1 (do !
[_ (java/lang/AutoCloseable::close input)]
(in [(.nat so_far) buffer]))
@@ -154,10 +154,10 @@
[.let [remaining (i.- so_far (.int buffer_size))]
bytes_read (at ! each (|>> ffi.of_int)
(java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))]
- (case bytes_read
+ (when bytes_read
-1 (do !
[_ (java/lang/AutoCloseable::close input)]
- (case so_far
+ (when so_far
+0 (in (..body_of output))
_ (|> buffer
(binary.slice 0 (.nat so_far))
@@ -178,7 +178,7 @@
headers //.empty])
(do [! (try.with io.monad)]
[?name (java/net/URLConnection::getHeaderFieldKey (ffi.as_int index) connection)]
- (case ?name
+ (when ?name
{.#Some name}
(do !
[?value (java/net/URLConnection::getHeaderField (ffi.as_int index) connection)]
@@ -200,7 +200,7 @@
_ (monad.each ! (function (_ [name value])
(java/net/URLConnection::setRequestProperty (ffi.as_string name) (ffi.as_string value) connection))
(dictionary.entries headers))
- _ (case data
+ _ (when data
{.#Some data}
(do !
[_ (java/net/URLConnection::setDoOutput true connection)
@@ -231,7 +231,7 @@
(|> (at client request method url headers data)
async.future
(at async.monad each
- (|>> (pipe.case
+ (|>> (pipe.when
{try.#Success [status message]}
{try.#Success [status (revised //.#body (is (-> (//.Body IO) (//.Body Async))
(function (_ body)
diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux
index a87addd69..5863b5bee 100644
--- a/stdlib/source/library/lux/world/net/http/cookie.lux
+++ b/stdlib/source/library/lux/world/net/http/cookie.lux
@@ -65,7 +65,7 @@
(def .public (same_site policy)
(-> CSRF_Policy Directive)
- (..directive (format "SameSite=" (case policy
+ (..directive (format "SameSite=" (when policy
{#Strict} "Strict"
{#Lax} "Lax"))))
diff --git a/stdlib/source/library/lux/world/net/http/header.lux b/stdlib/source/library/lux/world/net/http/header.lux
index 21b00565a..91ad629a2 100644
--- a/stdlib/source/library/lux/world/net/http/header.lux
+++ b/stdlib/source/library/lux/world/net/http/header.lux
@@ -15,7 +15,7 @@
(def .public (has name value)
(-> Text Text Header)
(dictionary.revised' name ""
- (|>> (pipe.case
+ (|>> (pipe.when
""
value
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index fdf8a8aa1..c69666791 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -59,7 +59,7 @@
(function (_ (^.let request [identification protocol resource message]))
(do async.monad
[?raw (read_text_body (the //.#body message))]
- (case (do try.monad
+ (when (do try.monad
[raw ?raw
content (at json.codec decoded raw)]
(json.result content reader))
@@ -74,7 +74,7 @@
(function (_ (^.let request [identification protocol resource message]))
(do async.monad
[?raw (read_text_body (the //.#body message))]
- (case ?raw
+ (when ?raw
{try.#Success content}
(server content request)
@@ -88,7 +88,7 @@
[uri query] (|> full
(text.split_by "?")
(maybe.else [full ""]))]
- (case (do try.monad
+ (when (do try.monad
[query (//query.parameters query)
input (context.result query property)]
(in [[identification protocol (has //.#uri uri resource) message]
@@ -104,7 +104,7 @@
(function (_ (^.let request [identification protocol resource message]))
(do async.monad
[?body (read_text_body (the //.#body message))]
- (case (do try.monad
+ (when (do try.monad
[body ?body
form (//query.parameters body)]
(context.result form property))
@@ -117,7 +117,7 @@
(def .public (cookies property server)
(All (_ a) (-> (Property a) (-> a Server) Server))
(function (_ (^.let request [identification protocol resource message]))
- (case (do try.monad
+ (when (do try.monad
[cookies (|> (the //.#headers message)
(dictionary.value "Cookie")
(maybe.else "")
diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux
index 53d533334..bcb7aa4a8 100644
--- a/stdlib/source/library/lux/world/net/http/route.lux
+++ b/stdlib/source/library/lux/world/net/http/route.lux
@@ -21,7 +21,7 @@
[(def .public (<name> server)
(-> Server Server)
(function (_ (^.let request [identification protocol resource message]))
- (case (the //.#scheme protocol)
+ (when (the //.#scheme protocol)
{<scheme>}
(server request)
@@ -36,7 +36,7 @@
[(def .public (<name> server)
(-> Server Server)
(function (_ (^.let request [identification protocol resource message]))
- (case (the //.#method resource)
+ (when (the //.#method resource)
{<method>}
(server request)
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index 4e9bd0d37..5ab10bba6 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -250,7 +250,7 @@
[(def (<name> _)
(do !
[output (java/io/BufferedReader::readLine <stream>)]
- (case output
+ (when output
{.#Some output}
(in (ffi.of_string output))
@@ -332,7 +332,7 @@
[(def (<name> _)
(do [! io.monad]
[|state| (atom.read! state)]
- (case (at mock <mock> |state|)
+ (when (at mock <mock> |state|)
{try.#Success [|state| output]}
(do !
[_ (atom.write! |state| state)]
@@ -348,7 +348,7 @@
(def (write message)
(do [! io.monad]
[|state| (atom.read! state)]
- (case (at mock on_write message |state|)
+ (when (at mock on_write message |state|)
{try.#Success |state|}
(do !
[_ (atom.write! |state| state)]
@@ -359,7 +359,7 @@
(def (destroy _)
(do [! io.monad]
[|state| (atom.read! state)]
- (case (at mock on_destroy |state|)
+ (when (at mock on_destroy |state|)
{try.#Success |state|}
(do !
[_ (atom.write! |state| state)]
diff --git a/stdlib/source/library/lux/world/time.lux b/stdlib/source/library/lux/world/time.lux
index d24e87497..22a0d85f3 100644
--- a/stdlib/source/library/lux/world/time.lux
+++ b/stdlib/source/library/lux/world/time.lux
@@ -118,7 +118,7 @@
(def pred
(|>> representation
- (pipe.case
+ (pipe.when
0 ..limit
millis millis)
--
diff --git a/stdlib/source/library/lux/world/time/day.lux b/stdlib/source/library/lux/world/time/day.lux
index 5daf79ac0..f763fbb8f 100644
--- a/stdlib/source/library/lux/world/time/day.lux
+++ b/stdlib/source/library/lux/world/time/day.lux
@@ -34,7 +34,7 @@
(Equivalence Day)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
@@ -51,7 +51,7 @@
(def (nat day)
(-> Day Nat)
- (case day
+ (when day
(^.with_template [<nat> <day>]
[{<day>} <nat>])
([0 #Sunday]
@@ -76,7 +76,7 @@
(def order ..order)
(def (succ day)
- (case day
+ (when day
{#Sunday} {#Monday}
{#Monday} {#Tuesday}
{#Tuesday} {#Wednesday}
@@ -86,7 +86,7 @@
{#Saturday} {#Sunday}))
(def (pred day)
- (case day
+ (when day
{#Monday} {#Sunday}
{#Tuesday} {#Monday}
{#Wednesday} {#Tuesday}
@@ -103,7 +103,7 @@
(Codec Text Day)
(implementation
(def (encoded value)
- (case value
+ (when value
(^.with_template [<tag>]
[{<tag>}
(text.replaced "#" "" (template.text [<tag>]))])
@@ -115,7 +115,7 @@
[..#Saturday]
[..#Sunday])))
(def (decoded value)
- (case (text#composite "#" value)
+ (when (text#composite "#" value)
(^.with_template [<tag>]
[(template.text [<tag>])
{try.#Success {<tag>}}])
@@ -147,7 +147,7 @@
[07 #Saturday])]
(def .public (number day)
(-> Day Nat)
- (case day
+ (when day
(^.with_template [<number> <day>]
[{<day>}
<number>])
@@ -163,7 +163,7 @@
(def .public (by_number number)
(-> Nat (Try Day))
- (case number
+ (when number
(^.with_template [<number> <day>]
[<number>
{try.#Success {<day>}}])
@@ -178,7 +178,7 @@
(implementation
(def equivalence ..equivalence)
(def (hash day)
- (case day
+ (when day
(^.with_template [<prime> <day>]
[{<day>}
<prime>])
diff --git a/stdlib/source/library/lux/world/time/duration.lux b/stdlib/source/library/lux/world/time/duration.lux
index 00a7c1d1e..a8850b4fb 100644
--- a/stdlib/source/library/lux/world/time/duration.lux
+++ b/stdlib/source/library/lux/world/time/duration.lux
@@ -159,7 +159,7 @@
(function (_ suffix false_suffix)
(|> (<text>.many <text>.decimal)
(<>.codec nat.decimal)
- (<>.before (case false_suffix
+ (<>.before (when false_suffix
"" (<text>.this suffix)
_ (<>.after (<>.not (<text>.this false_suffix))
(<text>.this suffix))))
@@ -178,7 +178,7 @@
(..composite (..up minutes ..minute))
(..composite (..up seconds ..second))
(..composite (..up millis ..milli_second)))]]
- (in (case sign
+ (in (when sign
{.#Left _} (..inverse span)
{.#Right _} span)))))
diff --git a/stdlib/source/library/lux/world/time/instant.lux b/stdlib/source/library/lux/world/time/instant.lux
index 2f08a6833..55bb1eae8 100644
--- a/stdlib/source/library/lux/world/time/instant.lux
+++ b/stdlib/source/library/lux/world/time/instant.lux
@@ -95,7 +95,7 @@
bce? (i.< +0 offset)
[days day_time] (if bce?
(let [[days millis] (i./% ..millis_per_day offset)]
- (case millis
+ (when millis
+0 [days millis]
_ [(-- days) (i.+ ..millis_per_day millis)]))
(i./% ..millis_per_day offset))]
@@ -209,7 +209,7 @@
days)
... 1970/01/01 was a Thursday
y1970m0d0 +4]
- (case (|> y1970m0d0
+ (when (|> y1970m0d0
(i.+ days) (i.% +7)
... This is done to turn negative days into positive days.
(i.+ +7) (i.% +7))
diff --git a/stdlib/source/library/lux/world/time/month.lux b/stdlib/source/library/lux/world/time/month.lux
index c2e88c976..35f56020d 100644
--- a/stdlib/source/library/lux/world/time/month.lux
+++ b/stdlib/source/library/lux/world/time/month.lux
@@ -39,7 +39,7 @@
(Equivalence Month)
(implementation
(def (= reference sample)
- (case [reference sample]
+ (when [reference sample]
(^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
@@ -73,7 +73,7 @@
[12 #December])]
(def .public (number month)
(-> Month Nat)
- (case month
+ (when month
(^.with_template [<number> <month>]
[{<month>}
<number>])
@@ -89,7 +89,7 @@
(def .public (by_number number)
(-> Nat (Try Month))
- (case number
+ (when number
(^.with_template [<number> <month>]
[<number>
{try.#Success {<month>}}])
@@ -104,7 +104,7 @@
(implementation
(def equivalence ..equivalence)
(def (hash month)
- (case month
+ (when month
(^.with_template [<prime> <month>]
[{<month>}
<prime>])
@@ -136,7 +136,7 @@
(def order ..order)
(def (succ month)
- (case month
+ (when month
{#January} {#February}
{#February} {#March}
{#March} {#April}
@@ -151,7 +151,7 @@
{#December} {#January}))
(def (pred month)
- (case month
+ (when month
{#February} {#January}
{#March} {#February}
{#April} {#March}
@@ -167,7 +167,7 @@
(def .public (days month)
(-> Month Nat)
- (case month
+ (when month
(^.with_template [<days> <month>]
[{<month>}
<days>])
@@ -189,7 +189,7 @@
(def .public (leap_year_days month)
(-> Month Nat)
- (case month
+ (when month
{#February} (++ (..days month))
_ (..days month)))
@@ -216,7 +216,7 @@
(Codec Text Month)
(implementation
(def (encoded value)
- (case value
+ (when value
(^.with_template [<tag>]
[{<tag>}
(text.replaced "#" "" (template.text [<tag>]))])
@@ -233,7 +233,7 @@
[..#November]
[..#December])))
(def (decoded value)
- (case (text#composite "#" value)
+ (when (text#composite "#" value)
(^.with_template [<tag>]
[(template.text [<tag>])
{try.#Success {<tag>}}])
diff --git a/stdlib/source/library/lux/world/time/year.lux b/stdlib/source/library/lux/world/time/year.lux
index a7bdb0dcf..ae01271f5 100644
--- a/stdlib/source/library/lux/world/time/year.lux
+++ b/stdlib/source/library/lux/world/time/year.lux
@@ -41,7 +41,7 @@
(def .public (year value)
(-> Int (Try Year))
- (case value
+ (when value
+0 (exception.except ..there_is_no_year_0 [])
_ {try.#Success (abstraction (..internal value))}))
@@ -118,7 +118,7 @@
[sign (<>.or (<text>.this "-") (in []))
digits (<text>.many <text>.decimal)
raw_year (<>.codec i.decimal (in (text#composite "+" digits)))]
- (<>.lifted (..year (case sign
+ (<>.lifted (..year (when sign
{.#Left _} (i.* -1 raw_year)
{.#Right _} raw_year)))))
diff --git a/stdlib/source/parser/lux/data/binary.lux b/stdlib/source/parser/lux/data/binary.lux
index d1cf273f3..37fc881d3 100644
--- a/stdlib/source/parser/lux/data/binary.lux
+++ b/stdlib/source/parser/lux/data/binary.lux
@@ -56,7 +56,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) Binary (Try a)))
- (case (parser [0 input])
+ (when (parser [0 input])
{try.#Success [[end _] output]}
(let [length (/.size input)]
(if (n#= end length)
@@ -138,7 +138,7 @@
[flag (is (Parser Nat)
..bits_8)]
(with_expansions [<case>+' (template.spliced <case>+)]
- (case flag
+ (when flag
(^.with_template [<number> <tag> <parser>]
[<number> (`` (at ! each (|>> {(,, (template.spliced <tag>))}) <parser>))])
(<case>+')
@@ -170,14 +170,14 @@
(do //.monad
[value (is (Parser Nat)
..bits_8)]
- (case value
+ (when value
0 (in #0)
1 (in #1)
_ (//.lifted (exception.except ..not_a_bit [value])))))
(def .public (segment size)
(-> Nat (Parser Binary))
- (case size
+ (when size
0 (//#in (/.empty 0))
_ (function (_ [start binary])
(let [end (n#+ size start)]
diff --git a/stdlib/source/parser/lux/data/collection/tree.lux b/stdlib/source/parser/lux/data/collection/tree.lux
index 5d10ce15b..38132cdb4 100644
--- a/stdlib/source/parser/lux/data/collection/tree.lux
+++ b/stdlib/source/parser/lux/data/collection/tree.lux
@@ -35,7 +35,7 @@
[(def .public <name>
(All (_ t) (Parser t []))
(function (_ zipper)
- (case (<direction> zipper)
+ (when (<direction> zipper)
{.#None}
(exception.except ..cannot_move_further [])
diff --git a/stdlib/source/parser/lux/data/format/json.lux b/stdlib/source/parser/lux/data/format/json.lux
index d440cd091..e1c1178e0 100644
--- a/stdlib/source/parser/lux/data/format/json.lux
+++ b/stdlib/source/parser/lux/data/format/json.lux
@@ -33,9 +33,9 @@
(def .public (result parser json)
(All (_ a) (-> (Parser a) JSON (Try a)))
- (case (//.result parser (list json))
+ (when (//.result parser (list json))
{try.#Success [remainder output]}
- (case remainder
+ (when remainder
{.#End}
{try.#Success output}
@@ -48,7 +48,7 @@
(def .public any
(Parser JSON)
(<| (function (_ inputs))
- (case inputs
+ (when inputs
{.#End}
(exception.except ..empty_input [])
@@ -64,7 +64,7 @@
(Parser <type>)
(do //.monad
[head ..any]
- (case head
+ (when head
{<tag> value}
(in value)
@@ -88,7 +88,7 @@
(-> <type> (Parser Bit))
(do //.monad
[head ..any]
- (case head
+ (when head
{<tag> value}
(in (at <equivalence> = test value))
@@ -99,7 +99,7 @@
(-> <type> (Parser Any))
(do //.monad
[head ..any]
- (case head
+ (when head
{<tag> value}
(if (at <equivalence> = test value)
(in [])
@@ -122,14 +122,14 @@
(All (_ a) (-> (Parser a) (Parser a)))
(do //.monad
[head ..any]
- (case head
+ (when head
{/.#Array values}
- (case (//.result parser (sequence.list values))
+ (when (//.result parser (sequence.list values))
{try.#Failure error}
(//.failure error)
{try.#Success [remainder output]}
- (case remainder
+ (when remainder
{.#End}
(in output)
@@ -143,9 +143,9 @@
(All (_ a) (-> (Parser a) (Parser a)))
(do //.monad
[head ..any]
- (case head
+ (when head
{/.#Object kvs}
- (case (|> kvs
+ (when (|> kvs
dictionary.entries
(list#each (function (_ [key value])
(list {/.#String key} value)))
@@ -155,7 +155,7 @@
(//.failure error)
{try.#Success [remainder output]}
- (case remainder
+ (when remainder
{.#End}
(in output)
@@ -168,10 +168,10 @@
(def .public (field field_name parser)
(All (_ a) (-> Text (Parser a) (Parser a)))
(function (again inputs)
- (case inputs
+ (when inputs
(list.partial {/.#String key} value inputs')
(if (text#= key field_name)
- (case (//.result parser (list value))
+ (when (//.result parser (list value))
{try.#Success [{.#End} output]}
{try.#Success [inputs' output]}
diff --git a/stdlib/source/parser/lux/data/format/xml.lux b/stdlib/source/parser/lux/data/format/xml.lux
index 0a54431e2..38d0d33da 100644
--- a/stdlib/source/parser/lux/data/format/xml.lux
+++ b/stdlib/source/parser/lux/data/format/xml.lux
@@ -42,7 +42,7 @@
(def (result' parser attrs documents)
(All (_ a) (-> (Parser a) Attrs (List XML) (Try a)))
- (case (//.result parser [attrs documents])
+ (when (//.result parser [attrs documents])
{try.#Success [[attrs' remaining] output]}
(if (list.empty? remaining)
{try.#Success output}
@@ -58,12 +58,12 @@
(def .public text
(Parser Text)
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
{.#Item head tail}
- (case head
+ (when head
{/.#Text value}
{try.#Success [[attrs tail] value]}
@@ -73,12 +73,12 @@
(def .public tag
(Parser Tag)
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
{.#Item head _}
- (case head
+ (when head
{/.#Text _}
(exception.except ..unexpected_input [])
@@ -88,7 +88,7 @@
(def .public (attribute name)
(-> Attribute (Parser Text))
(function (_ [attrs documents])
- (case (dictionary.value name attrs)
+ (when (dictionary.value name attrs)
{.#None}
(exception.except ..unknown_attribute [name (dictionary.keys attrs)])
@@ -98,12 +98,12 @@
(def .public (node expected parser)
(All (_ a) (-> Tag (Parser a) (Parser a)))
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
{.#Item head tail}
- (case head
+ (when head
{/.#Text _}
(exception.except ..unexpected_input [])
@@ -117,7 +117,7 @@
(def .public any
(Parser XML)
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
@@ -129,12 +129,12 @@
(def .public (somewhere parser)
(All (_ a) (-> (Parser a) (Parser a)))
(function (again [attrs input])
- (case (//.result parser [attrs input])
+ (when (//.result parser [attrs input])
{try.#Success [[attrs remaining] output]}
{try.#Success [[attrs remaining] output]}
{try.#Failure error}
- (case input
+ (when input
{.#End}
(exception.except ..nowhere [])
diff --git a/stdlib/source/parser/lux/data/text.lux b/stdlib/source/parser/lux/data/text.lux
index 75c30816f..28320b351 100644
--- a/stdlib/source/parser/lux/data/text.lux
+++ b/stdlib/source/parser/lux/data/text.lux
@@ -45,7 +45,7 @@
(do //.monad
[[basis distance] parser]
(function (_ (^.let input [offset tape]))
- (case (/.clip basis distance tape)
+ (when (/.clip basis distance tape)
{.#Some output}
{try.#Success [input output]}
@@ -71,7 +71,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) Text (Try a)))
- (case (parser [..beginning input])
+ (when (parser [..beginning input])
{try.#Failure msg}
{try.#Failure msg}
@@ -100,7 +100,7 @@
(def .public any
(Parser Text)
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
{try.#Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]}
@@ -110,7 +110,7 @@
(def .public any!
(Parser Slice)
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some _}
{try.#Success [[("lux i64 +" 1 offset) tape]
[#basis offset
@@ -123,7 +123,7 @@
[(`` (def .public (<name> parser)
(All (_ a) (-> (Parser a) (Parser <type>)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Failure msg}
(<any> input)
@@ -141,7 +141,7 @@
(def .public (this reference)
(-> Text (Parser Any))
(function (_ [offset tape])
- (case (/.index_since offset reference tape)
+ (when (/.index_since offset reference tape)
{.#Some where}
(if (n.= offset where)
{try.#Success [[("lux i64 +" (/.size reference) offset) tape]
@@ -161,7 +161,7 @@
(def .public next
(Parser Text)
(function (_ (^.let input [offset tape]))
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
{try.#Success [input (/.of_char output)]}
@@ -244,7 +244,7 @@
[(def .public (<name> options)
(-> Text (Parser Text))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
@@ -262,7 +262,7 @@
[(def .public (<name> options)
(-> Text (Parser Slice))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
@@ -285,7 +285,7 @@
(def .public (satisfies parser)
(-> (-> Char Bit) (Parser Text))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(if (parser output)
{try.#Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]}
@@ -297,7 +297,7 @@
(def .public (satisfies! parser)
(-> (-> Char Bit) (Parser Slice))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(if (parser output)
{try.#Success [[("lux i64 +" 1 offset) tape]
@@ -390,7 +390,7 @@
(def .public (local local_input parser)
(All (_ a) (-> Text (Parser a) (Parser a)))
(function (_ real_input)
- (case (..result parser local_input)
+ (when (..result parser local_input)
{try.#Failure error}
{try.#Failure error}
diff --git a/stdlib/source/parser/lux/meta/code.lux b/stdlib/source/parser/lux/meta/code.lux
index 844c0e1c2..b0a23eb8c 100644
--- a/stdlib/source/parser/lux/meta/code.lux
+++ b/stdlib/source/parser/lux/meta/code.lux
@@ -23,7 +23,7 @@
(def (un_paired pairs)
(All (_ a) (-> (List [a a]) (List a)))
- (case pairs
+ (when pairs
{.#End}
{.#End}
@@ -42,7 +42,7 @@
(def .public any
(Parser Code)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End}
{try.#Failure "There are no tokens to parse!"}
@@ -52,7 +52,7 @@
(def .public next
(Parser Code)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End}
{try.#Failure "There are no tokens to parse!"}
@@ -64,7 +64,7 @@
(def .public <query>
(Parser <type>)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {<tag> x}] tokens']}
{try.#Success [tokens' x]}
@@ -74,7 +74,7 @@
(def .public (<check> expected)
(-> <type> (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {<tag> actual}] tokens']}
(if (at <eq> = expected actual)
{try.#Success [tokens' []]}
@@ -95,7 +95,7 @@
(def .public (this code)
(-> Code (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [token tokens']}
(if (code#= code token)
{try.#Success [tokens' []]}
@@ -109,7 +109,7 @@
(def .public local
(Parser Text)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" x]}] tokens']}
{try.#Success [tokens' x]}
@@ -119,7 +119,7 @@
(def .public (this_local expected)
(-> Text (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" actual]}] tokens']}
(if (at text.equivalence = expected actual)
{try.#Success [tokens' []]}
@@ -132,7 +132,7 @@
(def .public global
(Parser Symbol)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" short]}] tokens']}
<failure>
@@ -145,7 +145,7 @@
(def .public (this_global expected)
(-> Symbol (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" actual]}] tokens']}
<failure>
@@ -162,9 +162,9 @@
(All (_ a)
(-> (Parser a) (Parser a)))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {<tag> members}] tokens']}
- (case (p members)
+ (when (p members)
{try.#Success [{.#End} x]} {try.#Success [tokens' x]}
_ {try.#Failure (all text#composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens))})
@@ -179,25 +179,25 @@
(def .public end
(Parser Any)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End} {try.#Success [tokens []]}
_ {try.#Failure (all text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))})))
(def .public end?
(Parser Bit)
(function (_ tokens)
- {try.#Success [tokens (case tokens
+ {try.#Success [tokens (when tokens
{.#End} true
_ false)]}))
(def .public (result parser inputs)
(All (_ a) (-> (Parser a) (List Code) (Try a)))
- (case (parser inputs)
+ (when (parser inputs)
{try.#Failure error}
{try.#Failure error}
{try.#Success [unconsumed value]}
- (case unconsumed
+ (when unconsumed
{.#End}
{try.#Success value}
@@ -220,6 +220,6 @@
[sample ..next
result (//.or parser
..any)]
- (case result
+ (when result
{.#Left _} (//.failure (text#composite "Did NOT expect to parse code: " (code.format sample)))
{.#Right output} (in output))))
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
index e8be9f6dc..0d98f3bd4 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
@@ -50,7 +50,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) (List Analysis) (Try a)))
- (case (parser input)
+ (when (parser input)
{try.#Failure error}
{try.#Failure error}
@@ -63,7 +63,7 @@
(def .public any
(Parser Analysis)
(function (_ input)
- (case input
+ (when input
{.#End}
(exception.except ..cannot_parse input)
@@ -73,7 +73,7 @@
(def .public end
(Parser Any)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End} {try.#Success [tokens []]}
_ {try.#Failure (format "Expected list of tokens to be empty!"
(remaining_inputs tokens))})))
@@ -81,7 +81,7 @@
(def .public end?
(Parser Bit)
(function (_ tokens)
- {try.#Success [tokens (case tokens
+ {try.#Success [tokens (when tokens
{.#End} true
_ false)]}))
@@ -89,7 +89,7 @@
[(`` (these (def .public <query>
(Parser <type>)
(function (_ input)
- (case input
+ (when input
(list.partial (<tag> x) input')
{try.#Success [input' x]}
@@ -99,7 +99,7 @@
(def .public (<assertion> expected)
(-> <type> (Parser Any))
(function (_ input)
- (case input
+ (when input
(list.partial (<tag> actual) input')
(if (at <eq> = expected actual)
{try.#Success [input' []]}
@@ -122,7 +122,7 @@
(def .public (tuple parser)
(All (_ a) (-> (Parser a) (Parser a)))
(function (_ input)
- (case input
+ (when input
(list.partial (/.tuple head) tail)
(do try.monad
[output (..result parser head)]
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
index 9431da2a7..fda40e0cd 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
@@ -55,7 +55,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) (List Synthesis) (Try a)))
- (case (parser input)
+ (when (parser input)
{try.#Failure error}
{try.#Failure error}
@@ -68,7 +68,7 @@
(def .public any
(Parser Synthesis)
(.function (_ input)
- (case input
+ (when input
{.#End}
(exception.except ..empty_input [])
@@ -78,14 +78,14 @@
(def .public end
(Parser Any)
(.function (_ tokens)
- (case tokens
+ (when tokens
{.#End} {try.#Success [tokens []]}
_ (exception.except ..expected_empty_input [tokens]))))
(def .public end?
(Parser Bit)
(.function (_ tokens)
- {try.#Success [tokens (case tokens
+ {try.#Success [tokens (when tokens
{.#End} true
_ false)]}))
@@ -93,7 +93,7 @@
[(`` (def .public <query>
(Parser <type>)
(.function (_ input)
- (case input
+ (when input
(list.partial (<tag> x) input')
{try.#Success [input' x]}
@@ -103,7 +103,7 @@
(`` (def .public (<assertion> expected)
(-> <type> (Parser Any))
(.function (_ input)
- (case input
+ (when input
(list.partial (<tag> actual) input')
(if (at <eq> = expected actual)
{try.#Success [input' []]}
@@ -124,7 +124,7 @@
(def .public (tuple parser)
(All (_ a) (-> (Parser a) (Parser a)))
(.function (_ input)
- (case input
+ (when input
(list.partial (/.tuple head) tail)
(do try.monad
[output (..result parser head)]
@@ -136,7 +136,7 @@
(def .public (function expected parser)
(All (_ a) (-> Arity (Parser a) (Parser [(Environment Synthesis) a])))
(.function (_ input)
- (case input
+ (when input
(list.partial (/.function/abstraction [environment actual body]) tail)
(if (n.= expected actual)
(do try.monad
@@ -150,7 +150,7 @@
(def .public (loop init_parsers iteration_parser)
(All (_ a b) (-> (Parser a) (Parser b) (Parser [Register a b])))
(.function (_ input)
- (case input
+ (when input
(list.partial (/.loop/scope [start inits iteration]) tail)
(do try.monad
[inits (..result init_parsers inits)
diff --git a/stdlib/source/parser/lux/meta/type.lux b/stdlib/source/parser/lux/meta/type.lux
index b7cc07bef..f93efcd6d 100644
--- a/stdlib/source/parser/lux/meta/type.lux
+++ b/stdlib/source/parser/lux/meta/type.lux
@@ -77,12 +77,12 @@
(def (result' env poly types)
(All (_ a) (-> Env (Parser a) (List Type) (Try a)))
- (case (//.result poly [env types])
+ (when (//.result poly [env types])
{try.#Failure error}
{try.#Failure error}
{try.#Success [[env' remaining] output]}
- (case remaining
+ (when remaining
{.#End}
{try.#Success output}
@@ -101,7 +101,7 @@
(def (with_env temp poly)
(All (_ a) (-> Env (Parser a) (Parser a)))
(.function (_ [env inputs])
- (case (//.result poly [temp inputs])
+ (when (//.result poly [temp inputs])
{try.#Failure error}
{try.#Failure error}
@@ -111,7 +111,7 @@
(def .public next
(Parser Type)
(.function (_ [env inputs])
- (case inputs
+ (when inputs
{.#End}
(exception.except ..empty_input [])
@@ -121,7 +121,7 @@
(def .public any
(Parser Type)
(.function (_ [env inputs])
- (case inputs
+ (when inputs
{.#End}
(exception.except ..empty_input [])
@@ -131,7 +131,7 @@
(def .public (local types poly)
(All (_ a) (-> (List Type) (Parser a) (Parser a)))
(.function (_ [env pass_through])
- (case (result' env poly types)
+ (when (result' env poly types)
{try.#Failure error}
{try.#Failure error}
@@ -147,7 +147,7 @@
(.function (_ [env inputs])
(let [current_id (dictionary.size env)
g!var (label current_id)]
- (case (//.result poly
+ (when (//.result poly
[(dictionary.has current_id [type g!var] env)
inputs])
{try.#Failure error}
@@ -261,9 +261,9 @@
(do //.monad
[env ..env
headT any]
- (case headT
+ (when headT
{.#Parameter idx}
- (case (dictionary.value (..argument env idx) env)
+ (when (dictionary.value (..argument env idx) env)
{.#Some [poly_type poly_code]}
(in poly_code)
@@ -278,7 +278,7 @@
(do //.monad
[env ..env
headT any]
- (case headT
+ (when headT
{.#Parameter idx}
(if (n.= id (..argument env idx))
(in [])
@@ -291,7 +291,7 @@
(Parser Nat)
(do //.monad
[headT any]
- (case headT
+ (when headT
{.#Ex ex_id}
(in ex_id)
@@ -302,7 +302,7 @@
(Parser [Symbol Type])
(do //.monad
[inputT any]
- (case inputT
+ (when inputT
{.#Named name anonymousT}
(in [name anonymousT])
@@ -313,7 +313,7 @@
(All (_ a) (-> (Parser a) (Parser [Code a])))
(do [! //.monad]
[headT any]
- (case (/.anonymous headT)
+ (when (/.anonymous headT)
{.#Apply (|recursion_dummy|) {.#UnivQ _ headT'}}
(do !
[[recT _ output] (|> poly
@@ -330,7 +330,7 @@
(do //.monad
[env ..env
headT any]
- (case (/.anonymous headT)
+ (when (/.anonymous headT)
(^.multi {.#Apply (|recursion_dummy|) {.#Parameter funcT_idx}}
(n.= 0 (..argument env funcT_idx))
[(dictionary.value 0 env) {.#Some [self_type self_call]}])
diff --git a/stdlib/source/parser/lux/program.lux b/stdlib/source/parser/lux/program.lux
index eff42b3ad..c9ec8b72a 100644
--- a/stdlib/source/parser/lux/program.lux
+++ b/stdlib/source/parser/lux/program.lux
@@ -15,9 +15,9 @@
(def .public (result parser inputs)
(All (_ a) (-> (Parser a) (List Text) (Try a)))
- (case (//.result parser inputs)
+ (when (//.result parser inputs)
{try.#Success [remaining output]}
- (case remaining
+ (when remaining
{.#End}
{try.#Success output}
@@ -30,7 +30,7 @@
(def .public any
(Parser Text)
(function (_ inputs)
- (case inputs
+ (when inputs
{.#Item arg inputs'}
{try.#Success [inputs' arg]}
@@ -58,9 +58,9 @@
(All (_ a) (-> (Parser a) (Parser a)))
(function (_ inputs)
(loop (again [immediate inputs])
- (case (//.result cli immediate)
+ (when (//.result cli immediate)
{try.#Failure try}
- (case immediate
+ (when immediate
{.#End}
{try.#Failure try}
@@ -76,7 +76,7 @@
(def .public end
(Parser Any)
(function (_ inputs)
- (case inputs
+ (when inputs
{.#End} {try.#Success [inputs []]}
_ {try.#Failure (format "Unknown parameters: " (text.interposed " " inputs))})))
diff --git a/stdlib/source/parser/lux/world/environment.lux b/stdlib/source/parser/lux/world/environment.lux
index 311048fdf..10230d5a1 100644
--- a/stdlib/source/parser/lux/world/environment.lux
+++ b/stdlib/source/parser/lux/world/environment.lux
@@ -32,7 +32,7 @@
(def .public (property name)
(-> Property (Parser Text))
(function (_ environment)
- (case (dictionary.value name environment)
+ (when (dictionary.value name environment)
{.#Some value}
{try.#Success [environment value]}
diff --git a/stdlib/source/polytypic/lux/abstract/equivalence.lux b/stdlib/source/polytypic/lux/abstract/equivalence.lux
index 8de4a0a7a..a79fd9c2a 100644
--- a/stdlib/source/polytypic/lux/abstract/equivalence.lux
+++ b/stdlib/source/polytypic/lux/abstract/equivalence.lux
@@ -115,7 +115,7 @@
g!right (code.local "_____________right")]]
(in (` (is (, (@Equivalence inputT))
(function ((, g!_) (, g!left) (, g!right))
- (case [(, g!left) (, g!right)]
+ (when [(, g!left) (, g!right)]
(,* (list#conjoint (list#each (function (_ [tag g!eq])
(if (nat.= last tag)
(list (` [{(, (code.nat (-- tag))) #1 (, g!left)}
diff --git a/stdlib/source/polytypic/lux/abstract/functor.lux b/stdlib/source/polytypic/lux/abstract/functor.lux
index 31a53d407..415c0da6e 100644
--- a/stdlib/source/polytypic/lux/abstract/functor.lux
+++ b/stdlib/source/polytypic/lux/abstract/functor.lux
@@ -54,7 +54,7 @@
[_ (in [])
membersC (<type>.variant (<>.many (Arg<?> valueC)))
.let [last (-- (list.size membersC))]]
- (in (` (case (, valueC)
+ (in (` (when (, valueC)
(,* (list#conjoint (list#each (function (_ [tag memberC])
(if (n.= last tag)
(list (` {(, (code.nat (-- tag))) #1 (, valueC)})
@@ -75,7 +75,7 @@
(again (++ idx)
(list#composite pairsCC (list [slotC memberC])))))
(in pairsCC)))))]
- (in (` (case (, valueC)
+ (in (` (when (, valueC)
[(,* (list#each product.left pairsCC))]
[(,* (list#each product.right pairsCC))]))))
... Functions
diff --git a/stdlib/source/polytypic/lux/data/format/json.lux b/stdlib/source/polytypic/lux/data/format/json.lux
index 53eba2b21..333f0c323 100644
--- a/stdlib/source/polytypic/lux/data/format/json.lux
+++ b/stdlib/source/polytypic/lux/data/format/json.lux
@@ -85,7 +85,7 @@
(def .public (nullable format)
(All (_ a) (-> (-> a JSON) (-> (Maybe a) JSON)))
(function (_ elem)
- (case elem
+ (when elem
{.#None} {/.#Null}
{.#Some value} (format value))))
@@ -175,7 +175,7 @@
.let [last (-- (list.size members))]]
(in (` (is (, (@JSON#encoded inputT))
(function ((, g!_) (, g!input))
- (case (, g!input)
+ (when (, g!input)
(,* (list#conjoint (list#each (function (_ [tag g!encoded])
(if (n.= last tag)
(.list (` {(, (code.nat (-- tag))) #1 (, g!input)})
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index 6300dc4fc..27127e3da 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -84,7 +84,7 @@
/repository.async)
profile)
[exit_code output] ((command console environment (file.async file.default) (shell.async shell.default) resolution) profile)
- _ (case exit_code
+ _ (when exit_code
shell.normal
(in [])
@@ -118,7 +118,7 @@
(do async.monad
[outcome action]
(async.future
- (case outcome
+ (when outcome
{try.#Success _}
..succeed!
@@ -153,7 +153,7 @@
(do [! io.monad]
[console (at ! each (|>> (try.else ..write_only) console.async)
console.default)]
- (case operation
+ (when operation
{/cli.#Version}
(..command
(/command/version.do! console (at /.monoid identity)))
@@ -161,12 +161,12 @@
_
(do !
[?profile (/input.read io.monad file.default profiles)]
- (case ?profile
+ (when ?profile
{try.#Failure error}
(..fail! error)
{try.#Success profile}
- (case operation
+ (when operation
{/cli.#Version}
(in [])
@@ -184,9 +184,9 @@
{/cli.#Deploy repository identity}
(..command
- (case (the /.#identity profile)
+ (when (the /.#identity profile)
{.#Some artifact}
- (case (dictionary.value repository (the /.#deploy_repositories profile))
+ (when (dictionary.value repository (the /.#deploy_repositories profile))
{.#Some remote}
(/command/deploy.do! ..environment
(shell.async shell.default)
@@ -213,7 +213,7 @@
profile))
{/cli.#Compilation compilation}
- (case compilation
+ (when compilation
{/cli.#Build} (..command
(..with_dependencies ..environment console /command/build.do! profile))
{/cli.#Test} (..command
@@ -222,13 +222,13 @@
{/cli.#Auto auto}
(do !
[?watcher watch.default]
- (case ?watcher
+ (when ?watcher
{try.#Failure error}
(..fail! error)
{try.#Success watcher}
(..command
- (case auto
+ (when auto
{/cli.#Build} (..with_dependencies ..environment console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile)
{/cli.#Test} (..with_dependencies ..environment console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile))))))
))))))
diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux
index 6b6e97124..df36e1d0d 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot.lux
@@ -59,7 +59,7 @@
(def .public (format snapshot)
(-> Snapshot XML)
(<| {xml.#Node ..<snapshot> xml.attributes}
- (case snapshot
+ (when snapshot
{#Local}
(list ..local_copy_format)
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
index 54d190c44..51a571ab8 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
@@ -31,7 +31,7 @@
(def .public (format (open "/[0]"))
(%.Format Value)
- (case /#snapshot
+ (when /#snapshot
{///.#Local}
/#version
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 4e4871f52..a5f02d37f 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -64,7 +64,7 @@
(do !
[_ (..pause delay)
events (at watcher poll [])]
- (case events
+ (when events
{.#Item _}
(do !
[_ <call>]
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index 503fd5f1c..20492bf69 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -100,9 +100,9 @@
(def (lux resolution lux_dependency)
(-> Resolution Dependency (Try [Resolution Lux]))
(let [[[lux_group lux_name lux_version] lux_type] lux_dependency]
- (case (..dependency_finder lux_group lux_name resolution)
+ (when (..dependency_finder lux_group lux_name resolution)
{.#Some dependency}
- (case lux_name
+ (when lux_name
(^.with_template [<tag> <name>]
[<name>
{try.#Success [(..remove_dependency dependency resolution)
@@ -148,7 +148,7 @@
(def (< left right)
(loop (again [left (text.all_split_by ..version_separator left)
right (text.all_split_by ..version_separator right)])
- (case [left right]
+ (when [left right]
[{.#Item leftH leftT} {.#Item rightH rightT}]
(if (text#= leftH rightH)
(again leftT rightT)
@@ -175,7 +175,7 @@
identity [(the ///artifact.#group artifact)
(the ///artifact.#name artifact)]
version (the ///artifact.#version artifact)]
- (case (dictionary.value identity uniques)
+ (when (dictionary.value identity uniques)
{.#Some [current_version current_path]}
(if (at version_order < version current_version)
(dictionary.has identity [version dependency] uniques)
@@ -213,7 +213,7 @@
(async.async []))
_ (|> (at process <capability> [])
(async.upon! (function (again ?line)
- (case ?line
+ (when ?line
{try.#Failure error}
(if (exception.match? shell.no_more_output error)
(write! {try.#Success []})
@@ -222,7 +222,7 @@
{try.#Success line}
(async.upon! (function (_ outcome)
- (case outcome
+ (when outcome
{try.#Failure error}
(write! {try.#Failure error})
@@ -264,7 +264,7 @@
(def .public (with_jvm_class_path host_dependencies runtime)
(-> (List Path) ///runtime.Runtime ///runtime.Runtime)
- (case host_dependencies
+ (when host_dependencies
{.#End}
runtime
@@ -279,7 +279,7 @@
(-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Lux Path]))
(function (_ profile)
(let [target (the ///.#target profile)]
- (case (the ///.#program profile)
+ (when (the ///.#program profile)
{.#None}
(async#in (exception.except ..no_specified_program []))
@@ -292,7 +292,7 @@
[[resolution lux] (async#in (..lux resolution (the ///.#lux profile)))
.let [host_dependencies (..host_dependencies fs home resolution)
[[command_environment command lux_params] output]
- (case lux
+ (when lux
{#JVM dependency}
[(|> (the ///.#java profile)
(has ///runtime.#parameters (list "program._"))
@@ -320,7 +320,7 @@
(..plural "--compiler" (list#each compiler.format (the ///.#compilers profile)))
(..plural "--source" (set.list (the ///.#sources profile)))
(..singular "--target" cache_directory)
- (case program_module
+ (when program_module
"" (..singular "--module" program_definition)
_ (list#composite (..singular "--module" program_module)
(..singular "--program" program_definition)))
diff --git a/stdlib/source/program/aedifex/command/deploy/release.lux b/stdlib/source/program/aedifex/command/deploy/release.lux
index d7394d7a3..88303069a 100644
--- a/stdlib/source/program/aedifex/command/deploy/release.lux
+++ b/stdlib/source/program/aedifex/command/deploy/release.lux
@@ -81,7 +81,7 @@
archive.empty
{.#None})
try.trusted
- (pipe.case
+ (pipe.when
{.#Left it}
it
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index 67739203a..b28e2b275 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -52,7 +52,7 @@
(def .public (do! console fs local profile)
(-> (Console Async) (file.System Async) (Repository Async) (Command Any))
- (case (the /.#identity profile)
+ (when (the /.#identity profile)
{.#Some identity}
(do ///action.monad
[package (|> profile
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index 16a2694d4..f22372abf 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -49,7 +49,7 @@
[_ (is (Async (Try Any))
(console.write_line ..start console))
.let [host_dependencies (//build.host_dependencies fs home resolution)
- [command_environment test_command test_parameters] (case compiler
+ [command_environment test_command test_parameters] (when compiler
{//build.#JVM dependency}
(|> program
(///runtime.for (the ///.#java profile))
diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux
index 40d7e2532..c74eac1ee 100644
--- a/stdlib/source/program/aedifex/dependency/deployment.lux
+++ b/stdlib/source/program/aedifex/dependency/deployment.lux
@@ -53,12 +53,12 @@
(at repository upload (format artifact extension)))))]
(do [! (try.with async.monad)]
[_ (at repository upload artifact data)]
- (case status
+ (when status
{///dependency/status.#Unverified}
(in [])
{///dependency/status.#Partial partial}
- (case partial
+ (when partial
{.#Left sha-1}
(deploy_hash ///hash.sha-1_codec ///artifact/extension.sha-1 sha-1)
@@ -75,12 +75,12 @@
(with_expansions [<sha-1> (format type ///artifact/extension.sha-1)
<md5> (format type ///artifact/extension.md5)]
(list.partial type
- (case status
+ (when status
{///dependency/status.#Unverified}
(list)
{///dependency/status.#Partial partial}
- (list (case partial
+ (list (when partial
{.#Left _} <sha-1>
{.#Right _} <md5>))
@@ -96,7 +96,7 @@
snapshot (|> snapshot
(revised [///metadata/snapshot.#versioning ///artifact/versioning.#snapshot]
(function (_ snapshot)
- (case snapshot
+ (when snapshot
{///artifact/snapshot.#Local}
{///artifact/snapshot.#Local}
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index ae075b5b0..81eb16502 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -84,7 +84,7 @@
(Async (Try (Maybe (Hash h))))))
(do async.monad
[?actual (at repository download (///repository/remote.uri version_template artifact extension))]
- (case ?actual
+ (when ?actual
{try.#Success actual}
(in (do [! try.monad]
[output (at ! each (|>> ffi.as_string java/lang/String::trim ffi.of_string)
@@ -111,7 +111,7 @@
?md5 (..verified_hash data
repository version_template artifact (format extension ///artifact/extension.md5)
///hash.md5 ///hash.md5_codec ..md5_does_not_match)]
- (in [data (case [?sha-1 ?md5]
+ (in [data (when [?sha-1 ?md5]
[{.#Some sha-1} {.#Some md5}]
{//status.#Verified sha-1 md5}
@@ -178,7 +178,7 @@
(def .public (any console repositories dependency)
(-> (Console Async) (List (Repository Async)) Dependency (Async (Try Package)))
- (case repositories
+ (when repositories
{.#End}
(|> dependency
(exception.except ..cannot_resolve)
@@ -188,7 +188,7 @@
(do [! async.monad]
[_ (..announce_fetching console repository (the //.#artifact dependency))
outcome (..one repository dependency)]
- (case outcome
+ (when outcome
{try.#Success package}
(do !
[_ (..announce_success console repository (the //.#artifact dependency))]
@@ -209,13 +209,13 @@
failures (is (List Dependency) (list))
dependencies dependencies
resolution resolution])
- (case dependencies
+ (when dependencies
{.#End}
(at async.monad in
[successes failures resolution])
{.#Item head tail}
- (case (the [//.#artifact ///artifact.#version] head)
+ (when (the [//.#artifact ///artifact.#version] head)
... Skip if there is no version
"" (again repositories
successes
@@ -224,13 +224,13 @@
resolution)
_ (do [! async.monad]
[?package (is (Async (Try Package))
- (case (dictionary.value head resolution)
+ (when (dictionary.value head resolution)
{.#Some package}
(in {try.#Success package})
{.#None}
(..any console repositories head)))]
- (case ?package
+ (when ?package
{try.#Success package}
(do !
[.let [redundant? (is (Predicate Dependency)
diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux
index 5eb32d757..594b91014 100644
--- a/stdlib/source/program/aedifex/format.lux
+++ b/stdlib/source/program/aedifex/format.lux
@@ -30,7 +30,7 @@
(Format /.License)
(`' [#name (, (code.text name))
#url (, (code.text url))
- #type (, (case type
+ #type (, (when type
{/.#Repo}
(' "repo")
@@ -44,7 +44,7 @@
(def (developer [name url organization])
(Format /.Developer)
- (case organization
+ (when organization
{.#None}
(`' [#name (, (code.text name))
#url (, (code.text url))])
@@ -76,7 +76,7 @@
(def (on_maybe field value format aggregate)
(All (_ a)
(-> Text (Maybe a) (Format a) Aggregate Aggregate))
- (case value
+ (when value
{.#None}
aggregate
@@ -86,7 +86,7 @@
(def (on_list field value format aggregate)
(All (_ a)
(-> Text (List a) (Format a) Aggregate Aggregate))
- (case value
+ (when value
{.#End}
aggregate
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux
index 4506720a1..eedf5e464 100644
--- a/stdlib/source/program/aedifex/hash.lux
+++ b/stdlib/source/program/aedifex/hash.lux
@@ -60,7 +60,7 @@
(Format Binary)
(binary.mix (function (_ byte representation)
(let [hex (at n.hex encoded byte)
- hex (case (text.size hex)
+ hex (when (text.size hex)
1 (format "0" hex)
_ hex)]
(format representation hex)))
@@ -128,7 +128,7 @@
chunk 0
output (binary.empty hash_size)])
(let [index (n.* chunk i64.bytes_per_i64)]
- (case (text.split_at ..hex_per_chunk input)
+ (when (text.split_at ..hex_per_chunk input)
{.#Some [head tail]}
(do try.monad
[head (at n.hex decoded head)
@@ -136,7 +136,7 @@
(again tail (++ chunk) output))
{.#None}
- (case (..hash_size input)
+ (when (..hash_size input)
0 (constructor output)
(^.with_template [<size> <write>]
[<size>
diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux
index 509d8e16f..cf65de5b6 100644
--- a/stdlib/source/program/aedifex/input.lux
+++ b/stdlib/source/program/aedifex/input.lux
@@ -34,7 +34,7 @@
(let [parse (syntax.parse ""
syntax.no_aliases
(text.size source_code))]
- (case (parse [location.dummy 0 source_code])
+ (when (parse [location.dummy 0 source_code])
{.#Left [_ error]}
{try.#Failure error}
diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux
index 5df1ae3a7..61fa4f9bb 100644
--- a/stdlib/source/program/aedifex/metadata/artifact.lux
+++ b/stdlib/source/program/aedifex/metadata/artifact.lux
@@ -179,7 +179,7 @@
(-> (Repository Async) Artifact (Async (Try Metadata)))
(do async.monad
[project (at repository download (..uri artifact))]
- (case project
+ (when project
{try.#Success binary_metadata}
(in (|> binary_metadata
(pipe.do try.monad
diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux
index 7b3e4d5d0..63000bac4 100644
--- a/stdlib/source/program/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/program/aedifex/metadata/snapshot.lux
@@ -98,7 +98,7 @@
(revised ///artifact/versioning.#versions
(is (-> (List ///artifact/snapshot/version.Version)
(List ///artifact/snapshot/version.Version))
- (|>> (pipe.case
+ (|>> (pipe.when
(list)
(list <default_version>)
@@ -127,7 +127,7 @@
(-> (Repository Async) Artifact (Async (Try Metadata)))
(do async.monad
[project (at repository download (..uri artifact))]
- (case project
+ (when project
{try.#Success project}
(in (|> project
(pipe.do try.monad
diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux
index cf4aa1e49..70f925d84 100644
--- a/stdlib/source/program/aedifex/package.lux
+++ b/stdlib/source/program/aedifex/package.lux
@@ -36,7 +36,7 @@
(with_template [<name> <tag>]
[(def .public (<name> package)
(-> Package Bit)
- (case (the #origin package)
+ (when (the #origin package)
{<tag> _}
true
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux
index c87dcabaf..eed536317 100644
--- a/stdlib/source/program/aedifex/pom.lux
+++ b/stdlib/source/program/aedifex/pom.lux
@@ -65,7 +65,7 @@
(def distribution
(-> /.Distribution XML)
- (|>> (pipe.case
+ (|>> (pipe.when
{/.#Repo} "repo"
{/.#Manual} "manual")
(..property "distribution")))
@@ -141,7 +141,7 @@
(def .public (write value)
(-> /.Profile (Try XML))
- (case (the /.#identity value)
+ (when (the /.#identity value)
{.#Some identity}
{try.#Success
{xml.#Node ["" ..project_tag] xml.attributes
diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux
index 627073d79..fa00bc64c 100644
--- a/stdlib/source/program/aedifex/profile.lux
+++ b/stdlib/source/program/aedifex/profile.lux
@@ -52,7 +52,7 @@
(Equivalence Distribution)
(implementation
(def (= reference subject)
- (case [reference subject]
+ (when [reference subject]
(^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux
index d94a31b48..2f4d853af 100644
--- a/stdlib/source/program/aedifex/project.lux
+++ b/stdlib/source/program/aedifex/project.lux
@@ -53,9 +53,9 @@
(def (profile' lineage project name)
(-> (Set Name) Project Name (Try Profile))
- (case (dictionary.value name project)
+ (when (dictionary.value name project)
{.#Some profile}
- (case (list.example (set.member? lineage)
+ (when (list.example (set.member? lineage)
(the //.#parents profile))
{.#Some ouroboros}
(exception.except ..circular_dependency [ouroboros name])
diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux
index bd1d23d3e..ea0507bcf 100644
--- a/stdlib/source/program/aedifex/repository.lux
+++ b/stdlib/source/program/aedifex/repository.lux
@@ -56,7 +56,7 @@
(stm.commit!
(do [! stm.monad]
[|state| (stm.read state)]
- (case (at mock on_download uri |state|)
+ (when (at mock on_download uri |state|)
{try.#Success [|state| output]}
(do !
[_ (stm.write |state| state)]
@@ -69,7 +69,7 @@
(stm.commit!
(do [! stm.monad]
[|state| (stm.read state)]
- (case (at mock on_upload uri content |state|)
+ (when (at mock on_upload uri content |state|)
{try.#Success |state|}
(do !
[_ (stm.write |state| state)]
diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux
index af9b502aa..dcc604306 100644
--- a/stdlib/source/program/aedifex/repository/local.lux
+++ b/stdlib/source/program/aedifex/repository/local.lux
@@ -55,7 +55,7 @@
_ (is (Async (Try Any))
(if ?
(in {try.#Success []})
- (case (file.parent fs absolute_path)
+ (when (file.parent fs absolute_path)
{.#Some parent}
(file.make_directories async.monad fs parent)
diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux
index 10b7f372d..bb89a6235 100644
--- a/stdlib/source/program/aedifex/repository/remote.lux
+++ b/stdlib/source/program/aedifex/repository/remote.lux
@@ -67,7 +67,7 @@
(http.headers ..base_headers)
{.#None}
http))]
- (case status
+ (when status
http/status.ok
(at ! each product.right ((the @http.#body message) {.#None}))
@@ -80,7 +80,7 @@
(do (try.with io.monad)
[[status message] (is (IO (Try (@http.Response IO)))
(http.put (format address uri)
- (http.headers (case identity
+ (http.headers (when identity
{.#None}
..base_headers
@@ -90,7 +90,7 @@
{.#Some content}
http))
_ ((the @http.#body message) {.#Some 0})]
- (case status
+ (when status
http/status.created
(in [])
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 108325fd7..313939963 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -62,7 +62,7 @@
(-> Text (Async (Try a)) (Async a)))
(do [! async.monad]
[?output action]
- (case ?output
+ (when ?output
{try.#Failure error}
(let [report (format text.new_line
failure_description text.new_line
@@ -70,7 +70,7 @@
(do !
[_ (with_expansions [<else> (in {try.#Success (debug.log! report)})]
(for @.js (is (Async (Try Any))
- (case console.default
+ (when console.default
{.#None}
<else>
@@ -97,9 +97,9 @@
(def (package! fs host_dependencies [packager package] archive context)
(-> (file.System Async) (Dictionary file.Path Binary) [Packager file.Path] Archive (Maybe unit.ID) (Async (Try Any)))
- (case (packager host_dependencies archive context)
+ (when (packager host_dependencies archive context)
{try.#Success content}
- (case content
+ (when content
{.#Left content}
(at fs write package content)
@@ -121,7 +121,7 @@
(loop (again [pending host_dependencies
output (is (Dictionary file.Path Binary)
(dictionary.empty text.hash))])
- (case pending
+ (when pending
{.#End}
(in output)
@@ -152,7 +152,7 @@
(Async Any)))
(do [! async.monad]
[platform (async.future platform)]
- (case service
+ (when service
{cli.#Compilation compilation}
(<| (or_crash! "Compilation failed:")
..timed
diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux
index f5f278e7c..3d8b90459 100644
--- a/stdlib/source/specification/aedifex/repository.lux
+++ b/stdlib/source/specification/aedifex/repository.lux
@@ -40,7 +40,7 @@
bad_download! (at subject download bad_uri)]
(unit.coverage [/.Repository]
(let [successfull_flow!
- (case [good_upload! good_download!]
+ (when [good_upload! good_download!]
[{try.#Success _} {try.#Success actual}]
(at binary.equivalence = expected actual)
@@ -48,7 +48,7 @@
false)
failed_flow!
- (case [bad_upload! bad_download!]
+ (when [bad_upload! bad_download!]
[{try.#Failure _} {try.#Failure _}]
true
diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux
index 1caf89d56..8526daba4 100644
--- a/stdlib/source/specification/compositor.lux
+++ b/stdlib/source/specification/compositor.lux
@@ -27,7 +27,7 @@
["[1][0]" primitive]
["[1][0]" structure]
["[1][0]" reference]
- ["[1][0]" case]
+ ["[1][0]" when]
["[1][0]" function]
["[1][0]" common]]])
@@ -38,7 +38,7 @@
(/generation/primitive.spec runner)
(/generation/structure.spec runner)
(/generation/reference.spec runner definer)
- (/generation/case.spec runner)
+ (/generation/when.spec runner)
(/generation/function.spec runner)
(/generation/common.spec runner)
))
@@ -59,7 +59,7 @@
bundle
expander
program))]]
- (case ?state,runner,definer
+ (when ?state,runner,definer
{try.#Success [[declaration_bundle declaration_state] runner definer]}
(..test runner definer
(the [declaration.#analysis declaration.#state] declaration_state)
diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux
index acd970ebc..3eab3d50d 100644
--- a/stdlib/source/specification/compositor/analysis/type.lux
+++ b/stdlib/source/specification/compositor/analysis/type.lux
@@ -27,7 +27,7 @@
(analysis/type.with_type output_type
(analysis.phase expander (` ((, (code.text extension)) (,* params))))))
(phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _}
true
diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux
index ba1168ad0..8043bd2e0 100644
--- a/stdlib/source/specification/compositor/generation/case.lux
+++ b/stdlib/source/specification/compositor/generation/case.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except case)
+ [lux (.except when)
[abstract
[monad (.only do)]]
[control
@@ -23,7 +23,7 @@
["[0]" synthesis (.only Path Synthesis)]
["[0]" phase
["[1]/[0]" synthesis
- ["[0]" case]]
+ ["[0]" when]]
["[0]" extension/synthesis]]]]
[test
["_" property (.only Test)]]]]
@@ -42,16 +42,16 @@
(def .public (verify expected)
(-> Frac (Try Any) Bit)
- (|>> (pipe.case
+ (|>> (pipe.when
{try.#Success actual}
(f.= expected (as Frac actual))
{try.#Failure _}
false)))
-(def case
+(def when
(Random [Synthesis Path])
- (<| r.rec (function (_ case))
+ (<| r.rec (function (_ when))
(`` (all r.either
(do r.monad
[value r.i64]
@@ -70,33 +70,33 @@
(do [! r.monad]
[size ..size
idx (|> r.nat (at ! each (n.% size)))
- [subS subP] case
+ [subS subP] when
.let [unitS (synthesis.text synthesis.unit)
- caseS (synthesis.tuple
+ whenS (synthesis.tuple
(list.together (list (list.repeated idx unitS)
(list subS)
(list.repeated (|> size -- (n.- idx)) unitS))))
- caseP (all synthesis.path/seq
+ whenP (all synthesis.path/seq
(if (tail? size idx)
(synthesis.member/right idx)
(synthesis.member/left idx))
subP)]]
- (in [caseS caseP]))
+ (in [whenS whenP]))
(do [! r.monad]
[size ..size
idx (|> r.nat (at ! each (n.% size)))
- [subS subP] case
+ [subS subP] when
.let [right? (tail? size idx)
- caseS (synthesis.variant
+ whenS (synthesis.variant
[analysis.#lefts idx
analysis.#right? right?
analysis.#value subS])
- caseP (all synthesis.path/seq
+ whenP (all synthesis.path/seq
(if right?
(synthesis.side/right idx)
(synthesis.side/left idx))
subP)]]
- (in [caseS caseP]))
+ (in [whenS whenP]))
))))
(def (let_spec run)
@@ -123,21 +123,21 @@
(run "if_spec")
(verify (if verdict on_true on_false))))))
-(def (case_spec run)
+(def (when_spec run)
(-> Runner Test)
(do r.monad
- [[inputS pathS] ..case
+ [[inputS pathS] ..when
on_success r.safe_frac
on_failure (|> r.safe_frac (r.only (|>> (f.= on_success) not)))]
- (_.test (%.symbol (symbol synthesis.branch/case))
- (|> (synthesis.branch/case
+ (_.test (%.symbol (symbol synthesis.branch/when))
+ (|> (synthesis.branch/when
[inputS
(all synthesis.path/alt
(all synthesis.path/seq
pathS
(synthesis.path/then (synthesis.f64 on_success)))
(synthesis.path/then (synthesis.f64 on_failure)))])
- (run "case_spec")
+ (run "when_spec")
(verify on_success)))))
(def special_input
@@ -233,7 +233,7 @@
(<| try.trusted
(phase.result [extension/synthesis.bundle
synthesis.init])
- (case.path phase/synthesis.phase
+ (when.path phase/synthesis.phase
special_pattern)
(analysis.bit #1))
(all synthesis.path/seq
@@ -252,27 +252,27 @@
(_.test "CODE"
(|> special_input
(run "special_input")
- (pipe.case
+ (pipe.when
{try.#Success output}
true
{try.#Failure _}
false)))
(_.test "PATTERN_MATCHING 0"
- (|> (synthesis.branch/case [special_input
+ (|> (synthesis.branch/when [special_input
special_path])
(run "special_path")
- (pipe.case
+ (pipe.when
{try.#Success output}
true
{try.#Failure _}
false)))
(_.test "PATTERN_MATCHING 1"
- (|> (synthesis.branch/case [special_input
+ (|> (synthesis.branch/when [special_input
special_pattern_path])
(run "special_pattern_path")
- (pipe.case
+ (pipe.when
{try.#Success output}
true
@@ -286,5 +286,5 @@
(..special_spec run)
(..let_spec run)
(..if_spec run)
- (..case_spec run)
+ (..when_spec run)
))
diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux
index e203a6098..b0f1c2390 100644
--- a/stdlib/source/specification/compositor/generation/common.lux
+++ b/stdlib/source/specification/compositor/generation/common.lux
@@ -28,7 +28,7 @@
[test
["_" property (.only Test)]]]]
["[0]" //
- ["[1][0]" case]
+ ["[1][0]" when]
[//
[common (.only Runner)]]])
@@ -46,7 +46,7 @@
(|> {synthesis.#Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject))}
(run (..safe <extension>))
- (pipe.case
+ (pipe.when
{try.#Success valueT}
(n.= (<reference> param subject) (as Nat valueT))
@@ -67,7 +67,7 @@
(list (synthesis.i64 subject)
(synthesis.i64 param))}
(run (..safe "lux i64 arithmetic-right-shift"))
- (pipe.case
+ (pipe.when
{try.#Success valueT}
("lux i64 ="
(i64.arithmetic_right_shifted param subject)
@@ -88,7 +88,7 @@
[(_.test <extension>
(|> {synthesis.#Extension <extension> (list (synthesis.i64 subject))}
(run (..safe <extension>))
- (pipe.case
+ (pipe.when
{try.#Success valueT}
(<comp> (<prepare> subject) (as <type> valueT))
@@ -107,7 +107,7 @@
(|> {synthesis.#Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject))}
(run (..safe <extension>))
- (pipe.case
+ (pipe.when
{try.#Success valueT}
(<comp> (<reference> param subject) (as <outputT> valueT))
@@ -139,7 +139,7 @@
(|> {synthesis.#Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject))}
(run (..safe <extension>))
- (//case.verify (<reference> param subject))))]
+ (//when.verify (<reference> param subject))))]
["lux f64 +" f.+ f.=]
["lux f64 -" f.- f.=]
@@ -152,7 +152,7 @@
(|> {synthesis.#Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject))}
(run (..safe <extension>))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
(bit#= (<text> param subject)
(as Bit valueV))
@@ -167,7 +167,7 @@
[(_.test <extension>
(|> {synthesis.#Extension <extension> (list)}
(run (..safe <extension>))
- (//case.verify <reference>)))]
+ (//when.verify <reference>)))]
["lux f64 min" ("lux f64 min")]
["lux f64 max" ("lux f64 max")]
@@ -178,7 +178,7 @@
(|> subject synthesis.f64
(list) {synthesis.#Extension "lux f64 i64"}
(list) {synthesis.#Extension "lux i64 f64"}))
- (//case.verify subject)))
+ (//when.verify subject)))
))))
(def (text run)
@@ -202,7 +202,7 @@
(_.test "Can compare texts for equality."
(and (|> {synthesis.#Extension "lux text =" (list sample_lowerS sample_lowerS)}
(run (..safe "lux text ="))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
(as Bit valueV)
@@ -210,7 +210,7 @@
false))
(|> {synthesis.#Extension "lux text =" (list sample_upperS sample_lowerS)}
(run (..safe "lux text ="))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
(not (as Bit valueV))
@@ -219,7 +219,7 @@
(_.test "Can compare texts for order."
(|> {synthesis.#Extension "lux text <" (list sample_lowerS sample_upperS)}
(run (..safe "lux text <"))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
(as Bit valueV)
@@ -228,7 +228,7 @@
(_.test "Can get length of text."
(|> {synthesis.#Extension "lux text size" (list sample_lowerS)}
(run (..safe "lux text size"))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
(n.= sample_size (as Nat valueV))
@@ -237,7 +237,7 @@
(_.test "Can concatenate text."
(|> {synthesis.#Extension "lux text size" (list concatenatedS)}
(run (..safe "lux text size"))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
(n.= (n.* 2 sample_size) (as Nat valueV))
@@ -248,7 +248,7 @@
(list concatenatedS sample_lowerS
(synthesis.i64 +0))}
(run (..safe "lux text index"))
- (pipe.case
+ (pipe.when
(^.multi {try.#Success valueV}
[(as (Maybe Nat) valueV)
{.#Some valueV}])
@@ -260,7 +260,7 @@
(list concatenatedS sample_upperS
(synthesis.i64 +0))}
(run (..safe "lux text index"))
- (pipe.case
+ (pipe.when
(^.multi {try.#Success valueV}
[(as (Maybe Nat) valueV)
{.#Some valueV}])
@@ -275,7 +275,7 @@
(synthesis.i64 offset)
(synthesis.i64 length))}
(run (..safe "lux text clip"))
- (pipe.case
+ (pipe.when
(^.multi {try.#Success valueV}
[(as (Maybe Text) valueV)
{.#Some valueV}])
@@ -291,7 +291,7 @@
(list sample_lowerS
(synthesis.i64 char_idx))}
(run (..safe "lux text char"))
- (pipe.case
+ (pipe.when
(^.multi {try.#Success valueV}
[(as (Maybe Int) valueV)
{.#Some valueV}])
@@ -311,7 +311,7 @@
(|> {synthesis.#Extension "lux io log"
(list (synthesis.text (format "LOG: " message)))}
(run (..safe "lux io log"))
- (pipe.case
+ (pipe.when
{try.#Success valueV}
true
@@ -325,7 +325,7 @@
synthesis.#body {synthesis.#Extension "lux io error"
(list (synthesis.text message))}]))}
(run (..safe "lux try"))
- (pipe.case
+ (pipe.when
(^.multi {try.#Success valueV}
[(as (Try Text) valueV)
{try.#Failure error}])
@@ -339,7 +339,7 @@
synthesis.#arity 1
synthesis.#body (synthesis.text message)]))}
(run (..safe "lux try"))
- (pipe.case
+ (pipe.when
(^.multi {try.#Success valueV}
[(as (Try Text) valueV)
{try.#Success valueV}])
diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux
index 43637f7a2..b9aebc000 100644
--- a/stdlib/source/specification/compositor/generation/primitive.lux
+++ b/stdlib/source/specification/compositor/generation/primitive.lux
@@ -36,7 +36,7 @@
[expected <gen>]
(_.test (%.symbol (symbol <synthesis>))
(|> (run <evaluation_name> (<synthesis> expected))
- (pipe.case
+ (pipe.when
{try.#Success actual}
(<test> expected (as_expected actual))
diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux
index 5e7516f20..ce0d00d1a 100644
--- a/stdlib/source/specification/compositor/generation/reference.lux
+++ b/stdlib/source/specification/compositor/generation/reference.lux
@@ -33,7 +33,7 @@
expected r.safe_frac]
(_.test "Definitions."
(|> (define name (synthesis.f64 expected))
- (pipe.case
+ (pipe.when
{try.#Success actual}
(f.= expected (as Frac actual))
@@ -50,7 +50,7 @@
register
(synthesis.variable/local register)])
(run "variable")
- (pipe.case
+ (pipe.when
{try.#Success actual}
(f.= expected (as Frac actual))
diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux
index 9ab5d02f2..acf9888e8 100644
--- a/stdlib/source/specification/compositor/generation/structure.lux
+++ b/stdlib/source/specification/compositor/generation/structure.lux
@@ -44,7 +44,7 @@
analysis.#right? last?_in
analysis.#value (synthesis.i64 value_in)])
(run "variant")
- (pipe.case
+ (pipe.when
{try.#Success valueT}
(let [valueT (as (Array Any) valueT)]
(and (n.= 3 (array.size valueT))
@@ -52,7 +52,7 @@
last?_out (array.read! 1 valueT)
value_out (as Any (maybe.trusted (array.read! 2 valueT)))
same_tag? (|> tag_out ffi.int_to_long (as Nat) (n.= tag_in))
- same_flag? (case last?_out
+ same_flag? (when last?_out
{.#Some last?_out'}
(and last?_in (text#= "" (as Text last?_out')))
@@ -74,7 +74,7 @@
(_.test (%.symbol (symbol synthesis.tuple))
(|> (synthesis.tuple (list#each (|>> synthesis.i64) tuple_in))
(run "tuple")
- (pipe.case
+ (pipe.when
{try.#Success tuple_out}
(let [tuple_out (as (Array Any) tuple_out)]
(and (n.= size (array.size tuple_out))
diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux
index c2dd86e90..80fa0d327 100644
--- a/stdlib/source/specification/lux/abstract/codec.lux
+++ b/stdlib/source/specification/lux/abstract/codec.lux
@@ -20,7 +20,7 @@
[expected generator]
(_.for [/.Codec]
(_.test "Isomorphism."
- (case (|> expected @//encoded @//decoded)
+ (when (|> expected @//encoded @//decoded)
{try.#Success actual}
(@//= expected actual)
diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux
index 9fc830fd2..3fbdc42af 100644
--- a/stdlib/source/specification/lux/world/console.lux
+++ b/stdlib/source/specification/lux/world/console.lux
@@ -32,7 +32,7 @@
?close/bad (at console close [])
.let [can_write!
- (case ?write
+ (when ?write
{try.#Success _}
true
@@ -40,7 +40,7 @@
false)
can_read!
- (case [?read ?read_line]
+ (when [?read ?read_line]
[{try.#Success _} {try.#Success _}]
true
@@ -48,7 +48,7 @@
false)
can_close!
- (case [?close/good ?close/bad]
+ (when [?close/good ?close/bad]
[{try.#Success _} {try.#Failure _}]
true
diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux
index b70555b6f..648449050 100644
--- a/stdlib/source/specification/lux/world/file.lux
+++ b/stdlib/source/specification/lux/world/file.lux
@@ -66,7 +66,7 @@
made? (at fs make_directory parent)
directory_post! (at fs directory? parent)]
(in (and (not directory_pre!)
- (case made?
+ (when made?
{try.#Success _} true
{try.#Failure _} false)
directory_post!))))
@@ -78,7 +78,7 @@
made? (at fs write path content)
file_post! (at fs file? path)]
(in (and (not file_pre!)
- (case made?
+ (when made?
{try.#Success _} true
{try.#Failure _} false)
file_post!))))
@@ -235,20 +235,20 @@
(and (not pre_dir/0)
(not pre_dir/1)
(not pre_dir/2)
- (case made?
+ (when made?
{try.#Success _} true
{try.#Failure _} false)
post_dir/0
post_dir/1
post_dir/2))
(unit.coverage [/.cannot_make_directory]
- (and (case cannot_make_directory!/0
+ (and (when cannot_make_directory!/0
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.cannot_make_directory error))
- (case cannot_make_directory!/1
+ (when cannot_make_directory!/1
{try.#Success _}
false
@@ -267,11 +267,11 @@
make_file!/1 (/.make_file ! fs (utf8#encoded file/0) file/0)])
(all unit.and
(unit.coverage [/.make_file]
- (case make_file!/0
+ (when make_file!/0
{try.#Success _} true
{try.#Failure error} false))
(unit.coverage [/.cannot_make_file]
- (case make_file!/1
+ (when make_file!/1
{try.#Success _}
false
@@ -314,10 +314,10 @@
(not pre_dir/0)
(not pre_dir/1)
- (case made_file?
+ (when made_file?
{try.#Success _} true
{try.#Failure _} false)
- (case made_dir?
+ (when made_dir?
{try.#Success _} true
{try.#Failure _} false)
diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux
index be41059a0..d552c1bdb 100644
--- a/stdlib/source/specification/lux/world/shell.lux
+++ b/stdlib/source/specification/lux/world/shell.lux
@@ -54,13 +54,13 @@
(do async.monad
[?destroy (at process destroy [])
?await (at process await [])]
- (in (and (case ?destroy
+ (in (and (when ?destroy
{try.#Success _}
true
{try.#Failure error}
false)
- (case ?await
+ (when ?await
{try.#Success _}
false
@@ -77,7 +77,7 @@
(in (do [! async.monad]
[?echo (at shell execute (..echo! message))
?sleep (at shell execute (..sleep! seconds))]
- (case [?echo ?sleep]
+ (when [?echo ?sleep]
[{try.#Success echo} {try.#Success sleep}]
(do !
[can_read! (..can_read! message echo)
diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux
index e50626c79..5efc00d4e 100644
--- a/stdlib/source/test/aedifex/artifact/time/date.lux
+++ b/stdlib/source/test/aedifex/artifact/time/date.lux
@@ -60,7 +60,7 @@
(try#each (at /.equivalence = expected))
(try.else false)))
(_.coverage [/.year_is_out_of_range]
- (case (/.date candidate)
+ (when (/.date candidate)
{try.#Success date}
(same? candidate (/.value date))
diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux
index a27e90074..b388866c6 100644
--- a/stdlib/source/test/aedifex/cli.lux
+++ b/stdlib/source/test/aedifex/cli.lux
@@ -53,13 +53,13 @@
(def (compilation_format value)
(-> /.Compilation (List Text))
- (case value
+ (when value
{/.#Build} (list "build")
{/.#Test} (list "test")))
(def (format value)
(-> /.Command (List Text))
- (case value
+ (when value
{/.#Version} (list "version")
{/.#Clean} (list "clean")
{/.#POM} (list "pom")
@@ -77,7 +77,7 @@
(|> expected
..format
(cli.result /.command)
- (pipe.case
+ (pipe.when
{try.#Success [names actual]}
(and (at (list.equivalence text.equivalence) = (list //.default) names)
(at /.equivalence = expected actual))
@@ -95,7 +95,7 @@
..format
(list.partial "with" expected_profile)
(cli.result /.command)
- (pipe.case
+ (pipe.when
{try.#Success [actual_profile actual_command]}
(and (at (list.equivalence text.equivalence) = (list expected_profile //.default) actual_profile)
(at /.equivalence = expected_command actual_command))
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index 5dc092327..b202af97f 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -110,7 +110,7 @@
fs
(shell.async ($build.good_shell []))
resolution)
- (at ! each (|>> (pipe.case
+ (at ! each (|>> (pipe.when
{try.#Failure error}
(same? end_signal error)
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 9aea4828c..c039b6e9c 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -85,7 +85,7 @@
(def (on_read state)
(if error?
(exception.except shell.no_more_output [])
- (case state
+ (when state
{.#Item head tail}
{try.#Success [tail head]}
@@ -93,7 +93,7 @@
(exception.except shell.no_more_output []))))
(def (on_fail state)
(if error?
- (case state
+ (when state
{.#Item head tail}
{try.#Success [tail head]}
@@ -165,7 +165,7 @@
[outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty
(with_target empty_profile))]
(unit.coverage [/.no_specified_program]
- (case outcome
+ (when outcome
{try.#Success _}
false
@@ -174,7 +174,7 @@
(in (do async.monad
[outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)]
(unit.coverage [/.Lux /.no_available_lux]
- (case outcome
+ (when outcome
{try.#Success _}
false
@@ -234,7 +234,7 @@
actual/1 (at console read_line [])
actual/2 (at console read_line [])
end! (|> (at console read_line [])
- (at ! each (|>> (pipe.case
+ (at ! each (|>> (pipe.when
{try.#Failure error}
true
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index 32a10f8a3..0d304f19d 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -41,7 +41,7 @@
(in (do [! async.monad]
[.let [console (@version.echo "")]
outcome (/.do! console fs sample)]
- (case outcome
+ (when outcome
{try.#Success _}
(do !
[verdict (do ///action.monad
@@ -64,7 +64,7 @@
{try.#Failure error}
(unit.coverage [/.do!]
- (case (the ///.#identity sample)
+ (when (the ///.#identity sample)
{.#Some _}
false
diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux
index dbc458897..f94ef4421 100644
--- a/stdlib/source/test/aedifex/dependency/deployment.lux
+++ b/stdlib/source/test/aedifex/dependency/deployment.lux
@@ -69,7 +69,7 @@
(def (request method url headers input)
(do io.monad
[_ (is (IO Any)
- (case [method input]
+ (when [method input]
[{@http.#Put} {.#Some input}]
(atom.update! (dictionary.has url input) cache)
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux
index 6bc81298e..0f353d828 100644
--- a/stdlib/source/test/aedifex/dependency/resolution.lux
+++ b/stdlib/source/test/aedifex/dependency/resolution.lux
@@ -265,7 +265,7 @@
[///dependency.#artifact expected_artifact
///dependency.#type ///artifact/type.lux_library])]
(unit.coverage [/.one]
- (case actual_package
+ (when actual_package
{try.#Success actual_package}
(at ///package.equivalence =
(has ///package.#origin {///repository/origin.#Remote ""} expected_package)
@@ -279,7 +279,7 @@
[///dependency.#artifact expected_artifact
///dependency.#type ///artifact/type.lux_library])]
(unit.coverage [<exception>]
- (case actual_package
+ (when actual_package
{try.#Failure error}
(exception.match? <exception> error)
@@ -314,7 +314,7 @@
[///dependency.#artifact expected_artifact
///dependency.#type ///artifact/type.lux_library])]
(unit.coverage [/.any]
- (case actual_package
+ (when actual_package
{try.#Success actual_package}
(at ///package.equivalence =
(has ///package.#origin {///repository/origin.#Remote ""} expected_package)
@@ -330,7 +330,7 @@
[///dependency.#artifact expected_artifact
///dependency.#type ///artifact/type.lux_library])]
(unit.coverage [/.cannot_resolve]
- (case actual_package
+ (when actual_package
{try.#Failure error}
(exception.match? /.cannot_resolve error)
diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux
index b61d35630..85edbdbf8 100644
--- a/stdlib/source/test/aedifex/dependency/status.lux
+++ b/stdlib/source/test/aedifex/dependency/status.lux
@@ -40,7 +40,7 @@
(do random.monad
[payload (binaryT.random 1)]
(_.coverage [/.verified]
- (case (/.verified payload)
+ (when (/.verified payload)
{/.#Verified sha1 md5}
true
diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux
index 61cb569fa..7271458b9 100644
--- a/stdlib/source/test/aedifex/hash.lux
+++ b/stdlib/source/test/aedifex/hash.lux
@@ -50,13 +50,13 @@
[(do random.monad
[expected (..random <hash>)]
(_.coverage [<hash> <constructor> <exception>]
- (and (case (<constructor> (/.data expected))
+ (and (when (<constructor> (/.data expected))
{try.#Success actual}
(at /.equivalence = expected actual)
{try.#Failure error}
false)
- (case (<constructor> (at binary.monoid composite
+ (when (<constructor> (at binary.monoid composite
(/.data expected)
(/.data expected)))
{try.#Success actual}
@@ -81,7 +81,7 @@
[(do random.monad
[expected (..random <hash>)]
(_.coverage [<codec>]
- (case (at <codec> decoded
+ (when (at <codec> decoded
(format (at <codec> encoded expected)
"AABBCC"))
{try.#Success actual}
diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux
index f67d1e130..f2d430fb2 100644
--- a/stdlib/source/test/aedifex/metadata/artifact.lux
+++ b/stdlib/source/test/aedifex/metadata/artifact.lux
@@ -108,10 +108,10 @@
[wrote? (/.write repository artifact expected)
actual (/.read repository artifact)]
(unit.coverage [/.write /.read]
- (and (case wrote?
+ (and (when wrote?
{try.#Success _} true
{try.#Failure _} false)
- (case actual
+ (when actual
{try.#Success actual}
(at /.equivalence = expected actual)
diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux
index b41a6ce15..34965c98a 100644
--- a/stdlib/source/test/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/test/aedifex/metadata/snapshot.lux
@@ -120,10 +120,10 @@
[wrote? (/.write repository artifact expected)
actual (/.read repository artifact)]
(unit.coverage [/.write /.read]
- (and (case wrote?
+ (and (when wrote?
{try.#Success _} true
{try.#Failure _} false)
- (case actual
+ (when actual
{try.#Success actual}
(at /.equivalence = expected actual)
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index 035765b17..dc03b1671 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -76,13 +76,13 @@
[actual_pom binary_pom pom_status] (the /.#pom local)
[actual_library library_status] (the /.#library local)]
- (and (case (the /.#origin local)
+ (and (when (the /.#origin local)
{//origin.#Local ""} true
_ false)
(let [expected_sha1 (//hash.sha-1 expected_library)
expected_md5 (//hash.md5 expected_library)]
(and (same? expected_library actual_library)
- (case library_status
+ (when library_status
{//status.#Verified actual_sha1 expected_md5}
(and (//hash#= expected_sha1 actual_sha1)
(//hash#= expected_md5 expected_md5))
@@ -97,7 +97,7 @@
decoded_pom (at xml.codec decoded xml_pom)]
(in (at xml.equivalence = actual_pom decoded_pom)))
(try.else false))
- (case pom_status
+ (when pom_status
{//status.#Verified actual_sha1 expected_md5}
(and (//hash#= expected_sha1 actual_sha1)
(//hash#= expected_md5 expected_md5))
@@ -106,7 +106,7 @@
false))))))
(_.coverage [/.dependencies]
(let [expected (the //.#dependencies profile)]
- (case (/.dependencies package)
+ (when (/.dependencies package)
{try.#Success actual}
(at set.equivalence = expected actual)
@@ -114,7 +114,7 @@
false)))
(_.coverage [/.repositories]
(let [expected (the //.#repositories profile)]
- (case (/.repositories package)
+ (when (/.repositories package)
{try.#Success actual}
(at set.equivalence = expected actual)
diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux
index fb2852701..54cdbc17a 100644
--- a/stdlib/source/test/aedifex/parser.lux
+++ b/stdlib/source/test/aedifex/parser.lux
@@ -84,7 +84,7 @@
//format.project
list
(<code>.result /.project)
- (pipe.case
+ (pipe.when
{try.#Success actual}
(|> expected
..with_empty_profile
diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux
index c6283f30d..0484599e0 100644
--- a/stdlib/source/test/aedifex/pom.lux
+++ b/stdlib/source/test/aedifex/pom.lux
@@ -34,11 +34,11 @@
(do random.monad
[expected @profile.random]
(_.coverage [/.write /.parser]
- (case [(/.write expected)
+ (when [(/.write expected)
(the //.#identity expected)]
[{try.#Success pom}
{.#Some _}]
- (case (<xml>.result /.parser (list pom))
+ (when (<xml>.result /.parser (list pom))
{try.#Success actual}
(at //.equivalence =
(|> (at //.monoid identity)
diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux
index 2db5873e8..29f8b1215 100644
--- a/stdlib/source/test/aedifex/project.lux
+++ b/stdlib/source/test/aedifex/project.lux
@@ -84,14 +84,14 @@
(try#each (at //.equivalence = (at //.monoid composite sub_profile super_profile)))
(try.else false))))
(_.coverage [/.unknown_profile]
- (case (/.profile project fake_name)
+ (when (/.profile project fake_name)
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.unknown_profile error)))
(_.coverage [/.circular_dependency]
- (case (/.profile circular sub_name)
+ (when (/.profile circular sub_name)
{try.#Success _}
false
diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux
index 72c36f74b..fbb3ef01b 100644
--- a/stdlib/source/test/aedifex/repository.lux
+++ b/stdlib/source/test/aedifex/repository.lux
@@ -72,9 +72,9 @@
(def the_description
"@")
(def (on_download uri state)
- (case (dictionary.value uri state)
+ (when (dictionary.value uri state)
{.#Some content}
- (case (binary.size content)
+ (when (binary.size content)
0 (exception.except ..not_found [uri])
_ {try.#Success [state content]})
diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux
index 52a91bea6..96a07f678 100644
--- a/stdlib/source/test/aedifex/repository/local.lux
+++ b/stdlib/source/test/aedifex/repository/local.lux
@@ -45,7 +45,7 @@
_ (at repo upload uri expected)
actual (at repo download uri)]
(unit.coverage [/.repository]
- (and (case before_upload
+ (and (when before_upload
{try.#Success _} false
{try.#Failure _} true)
(|> actual
diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux
index a5380ddec..5a1c21316 100644
--- a/stdlib/source/test/aedifex/repository/remote.lux
+++ b/stdlib/source/test/aedifex/repository/remote.lux
@@ -51,7 +51,7 @@
(dictionary.value "User-Agent")
(maybe#each (same? /.user_agent))
(maybe.else false))
- (case [method input]
+ (when [method input]
[{@http.#Get} {.#None}]
[http/status.ok
[@http.#headers (http.headers (list))
@@ -113,7 +113,7 @@
(let [repo (/.repository (..good_http user password)
{.#None}
address)]
- (case (io.run! (at repo upload uri content))
+ (when (io.run! (at repo upload uri content))
{try.#Failure error}
(exception.match? /.upload_failure error)
@@ -123,7 +123,7 @@
(let [repo (/.repository ..bad_http
{.#None}
address)]
- (case (io.run! (at repo download uri))
+ (when (io.run! (at repo download uri))
{try.#Failure error}
(exception.match? /.download_failure error)
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 4d7a695e8..53d699818 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -129,21 +129,21 @@
expected random.nat]
(all _.and
(_.coverage [/.try]
- (case (/.try expected)
+ (when (/.try expected)
{.#Left _}
false
{.#Right actual}
(n.= expected actual)))
(_.coverage [/.undefined]
- (case (/.try (/.undefined))
+ (when (/.try (/.undefined))
{.#Left _}
true
{.#Right _}
false))
(_.coverage [/.panic!]
- (case (/.try (/.panic! expected_error))
+ (when (/.try (/.panic! expected_error))
{.#Left actual_error}
(text.contains? expected_error actual_error)
@@ -160,7 +160,7 @@
e/3 random.nat]
(all _.and
(_.coverage [/.list]
- (case (/.list e/0 e/1)
+ (when (/.list e/0 e/1)
(/.list a/0 a/1)
(and (n.= e/0 a/0)
(n.= e/1 a/1))
@@ -411,7 +411,7 @@
... (let [scenario (is (-> Any Bit)
... (function (_ _)
... ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter.
- ... (`` (for @.python (case (' [<input>'])
+ ... (`` (for @.python (when (' [<input>'])
... (^.` [<module>
... ("lux def" (, [_ {.#Symbol ["" _]}]) [] #0)
... (,, (template.spliced <referrals>))])
@@ -419,7 +419,7 @@
... _
... false)
- ... (case (' [<input>'])
+ ... (when (' [<input>'])
... (^.` [<module> (,, (template.spliced <referrals>))])
... true
@@ -537,7 +537,7 @@
(_.coverage [/.type_of]
(same? /.Nat (/.type_of expected)))
(_.coverage [/.Primitive]
- (case (/.Primitive "foo" [expected/0 expected/1])
+ (when (/.Primitive "foo" [expected/0 expected/1])
{.#Primitive "foo" (list actual/0 actual/1)}
(and (same? expected/0 actual/0)
(same? expected/1 actual/1))
@@ -545,28 +545,28 @@
_
false))
(_.coverage [/.type_literal]
- (and (case (/.type_literal [expected/0 expected/1])
+ (and (when (/.type_literal [expected/0 expected/1])
{.#Product actual/0 actual/1}
(and (same? expected/0 actual/0)
(same? expected/1 actual/1))
_
false)
- (case (/.type_literal (/.Or expected/0 expected/1))
+ (when (/.type_literal (/.Or expected/0 expected/1))
{.#Sum actual/0 actual/1}
(and (same? expected/0 actual/0)
(same? expected/1 actual/1))
_
false)
- (case (/.type_literal (-> expected/0 expected/1))
+ (when (/.type_literal (-> expected/0 expected/1))
{.#Function actual/0 actual/1}
(and (same? expected/0 actual/0)
(same? expected/1 actual/1))
_
false)
- (case (/.type_literal (expected/0 expected/1))
+ (when (/.type_literal (expected/0 expected/1))
{.#Apply actual/1 actual/0}
(and (same? expected/0 actual/0)
(same? expected/1 actual/1))
@@ -668,7 +668,7 @@
(in option/1))]
(all _.and
(_.coverage [/.static]
- (case sample
+ (when sample
(/.static option/0) true
(/.static option/1) true
_ false))
@@ -906,7 +906,7 @@
{.#Some [item/1
{.#Some [item/2
{.#None}]}]}]})]
- (case list
+ (when list
{.#Some [actual/0 {.#Some [actual/1 {.#Some [actual/2 {.#None}]}]}]}
(and (same? item/0 actual/0)
(same? item/1 actual/1)
@@ -926,7 +926,7 @@
[[..#left <left>
..#right <right>]]))
-(def for_case
+(def for_when
Test
(do [! random.monad]
[expected_nat (at ! each (n.% 1) random.nat)
@@ -938,40 +938,40 @@
expected_text (random.either (in "+0.5")
(in "+1.25"))]
(all _.and
- (_.coverage [/.case]
- (and (/.case expected_nat
+ (_.coverage [/.when]
+ (and (/.when expected_nat
0 true
_ false)
- (/.case expected_int
+ (/.when expected_int
+0 true
_ false)
- (/.case expected_rev
+ (/.when expected_rev
.5 true
.25 true
_ false)
- (/.case expected_frac
+ (/.when expected_frac
+0.5 true
+1.25 true
_ false)
- (/.case expected_text
+ (/.when expected_text
"+0.5" true
"+1.25" true
_ false)
- (/.case [expected_nat expected_int]
+ (/.when [expected_nat expected_int]
[0 +0] true
_ false)
- (/.case [..#left expected_nat ..#right expected_int]
+ (/.when [..#left expected_nat ..#right expected_int]
[..#left 0 ..#right +0] true
_ false)
- (/.case (is (Either Nat Int) {.#Left expected_nat})
+ (/.when (is (Either Nat Int) {.#Left expected_nat})
{.#Left 0} true
_ false)
- (/.case (is (Either Nat Int) {.#Right expected_int})
+ (/.when (is (Either Nat Int) {.#Right expected_int})
{.#Right +0} true
_ false)
))
... (_.coverage [/.pattern]
- ... (/.case [..#left expected_nat ..#right expected_int]
+ ... (/.when [..#left expected_nat ..#right expected_int]
... (!pair 0 +0)
... true
@@ -1046,7 +1046,7 @@
(set.member? ..possible_targets (the .#target info))
compiling!
- (case (the .#mode info)
+ (when (the .#mode info)
{.#Build} true
_ false)]
{.#Right [lux (list (code.bit (and conforming_target!
@@ -1056,7 +1056,7 @@
(syntax (_ [])
(do meta.monad
[prelude (meta.module .prelude)]
- (in (list (code.bit (case (the .#module_state prelude)
+ (in (list (code.bit (when (the .#module_state prelude)
{.#Active} false
_ true)))))))
@@ -1095,7 +1095,7 @@
let/2 <code>.local
let/3 <code>.local])
- (in (list (code.bit (case (the .#scopes lux_state)
+ (in (list (code.bit (when (the .#scopes lux_state)
(list.partial scope/2 _)
(let [locals/2 (the .#locals scope/2)
expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2
@@ -1114,7 +1114,7 @@
local? (is (-> Ref Bit)
(function (_ ref)
- (case ref
+ (when ref
{.#Local _} true
{.#Captured _} false)))
captured? (is (-> Ref Bit)
@@ -1181,7 +1181,7 @@
..for_associative
..for_expansion
..for_value
- ..for_case
+ ..for_when
..for_control_flow
..for_def
..for_meta
diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux
index bc48cff4e..8544e5de6 100644
--- a/stdlib/source/test/lux/abstract/apply.lux
+++ b/stdlib/source/test/lux/abstract/apply.lux
@@ -26,7 +26,7 @@
(all _.and
(_.coverage [/.composite]
(let [expected (n.+ left right)]
- (case (at (/.composite maybe.monad maybe.apply list.apply) on
+ (when (at (/.composite maybe.monad maybe.apply list.apply) on
{.#Some (list right)}
{.#Some (list (n.+ left))})
{.#Some (list actual)}
diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux
index c55c7e311..3f07c30cb 100644
--- a/stdlib/source/test/lux/abstract/codec.lux
+++ b/stdlib/source/test/lux/abstract/codec.lux
@@ -40,7 +40,7 @@
[expected random.bit]
(<| (_.covering /._)
(_.coverage [/.composite]
- (case (|> expected (at ..codec encoded) (at ..codec decoded))
+ (when (|> expected (at ..codec encoded) (at ..codec decoded))
{try.#Success actual}
(bit#= expected actual)
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux
index fc50c636a..0f575f3e6 100644
--- a/stdlib/source/test/lux/abstract/enum.lux
+++ b/stdlib/source/test/lux/abstract/enum.lux
@@ -38,7 +38,7 @@
can_be_backwards? (at (list.equivalence n.equivalence) =
(/.range n.enum start end)
(list.reversed (/.range n.enum end start)))
- every_element_is_a_successor? (case range
+ every_element_is_a_successor? (when range
{.#Item head tail}
(|> (list#mix (function (_ next [verdict prev])
[(and verdict
diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux
index 14d22ae5f..0689009f6 100644
--- a/stdlib/source/test/lux/abstract/equivalence.lux
+++ b/stdlib/source/test/lux/abstract/equivalence.lux
@@ -29,9 +29,9 @@
(type Variant
(.Variant
- {#Case0 Bit}
- {#Case1 Int}
- {#Case2 Frac}))
+ {#Case_0 Bit}
+ {#Case_1 Int}
+ {#Case_2 Frac}))
(type Recursive
(Rec Recursive
@@ -119,7 +119,7 @@
(/.rec (function (_ equivalence)
(implementation
(def (= left right)
- (case [left right]
+ (when [left right]
[{.#End} {.#End}]
true
diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux
index c2e5f18eb..b3eee1741 100644
--- a/stdlib/source/test/lux/abstract/functor.lux
+++ b/stdlib/source/test/lux/abstract/functor.lux
@@ -54,7 +54,7 @@
(<| (_.covering /._)
(all _.and
(_.coverage [/.Or /.sum]
- (and (case (at (/.sum maybe.functor list.functor) each
+ (and (when (at (/.sum maybe.functor list.functor) each
(n.+ shift)
{.#Left {.#Some left}})
{.#Left {.#Some actual}}
@@ -62,7 +62,7 @@
_
false)
- (case (at (/.sum maybe.functor list.functor) each
+ (when (at (/.sum maybe.functor list.functor) each
(n.+ shift)
{.#Right (list right)})
{.#Right (list actual)}
@@ -71,7 +71,7 @@
_
false)))
(_.coverage [/.And /.product]
- (case (at (/.product maybe.functor list.functor) each
+ (when (at (/.product maybe.functor list.functor) each
(n.+ shift)
[{.#Some left} (list right)])
[{.#Some actualL} (list actualR)]
@@ -81,7 +81,7 @@
_
false))
(_.coverage [/.Then /.composite]
- (case (at (/.composite maybe.functor list.functor) each
+ (when (at (/.composite maybe.functor list.functor) each
(n.+ shift)
{.#Some (list left)})
{.#Some (list actual)}
diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux
index 8270a88b3..9f43008b2 100644
--- a/stdlib/source/test/lux/abstract/interval.lux
+++ b/stdlib/source/test/lux/abstract/interval.lux
@@ -142,7 +142,7 @@
[[l m r] (|> (random.set n.hash 3 random.nat)
(at ! each (|>> set.list
(list.sorted n.<)
- (pipe.case
+ (pipe.when
(list b t1 t2)
[b t1 t2]
@@ -165,7 +165,7 @@
[[b t1 t2] (|> (random.set n.hash 3 random.nat)
(at ! each (|>> set.list
(list.sorted n.<)
- (pipe.case
+ (pipe.when
(list b t1 t2)
[b t1 t2]
@@ -193,7 +193,7 @@
[x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat)
(at ! each (|>> set.list
(list.sorted n.<)
- (pipe.case
+ (pipe.when
(list x0 x1 x2 x3)
[x0 x1 x2 x3]
@@ -227,7 +227,7 @@
[x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat)
(at ! each (|>> set.list
(list.sorted n.<)
- (pipe.case
+ (pipe.when
(list x0 x1 x2 x3)
[x0 x1 x2 x3]
diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux
index 7a4375c27..eb67429b2 100644
--- a/stdlib/source/test/lux/abstract/monad/free.lux
+++ b/stdlib/source/test/lux/abstract/monad/free.lux
@@ -25,7 +25,7 @@
(def (interpret free)
(All (_ a) (-> (/.Free List a) (List a)))
- (case free
+ (when free
{/.#Pure value}
(list value)
diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux
index aec54bebe..b49761269 100644
--- a/stdlib/source/test/lux/control/concatenative.lux
+++ b/stdlib/source/test/lux/control/concatenative.lux
@@ -280,14 +280,6 @@
(/.push (/.apply_2 n.+))
/.partial
/.call))))
- (_.coverage [/.when]
- (n.= (if choice
- (++ sample)
- sample)
- (/.value (|>> (/.push sample)
- (/.push choice)
- (/.push (/.apply_1 ++))
- /.when))))
(_.coverage [/.?]
(n.= (if choice
(++ sample)
diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux
index 35fbb8027..d11016a4b 100644
--- a/stdlib/source/test/lux/control/concurrency/actor.lux
+++ b/stdlib/source/test/lux/control/concurrency/actor.lux
@@ -42,7 +42,7 @@
(def (mailed? outcome)
(-> (Try Any) Bit)
- (case outcome
+ (when outcome
{try.#Success _} true
{try.#Failure _} false))
@@ -91,7 +91,7 @@
(function (_ message state self)
(do [! async.monad]
[outcome (message state self)]
- (case outcome
+ (when outcome
{try.#Failure cause}
(do !
[_ (async.future (write cause))]
@@ -104,7 +104,7 @@
_ (async.delay 100)
result (async.future (async.value read))]
(unit.coverage [/.poisoned]
- (case result
+ (when result
{.#Some error}
(exception.match? /.poisoned error)
@@ -126,7 +126,7 @@
_ (/.poison! counter)]
(/.mail! ++! counter)))]
(unit.coverage [/.dead]
- (case result
+ (when result
{try.#Success outcome}
false
@@ -144,7 +144,7 @@
obituary (/.obituary' actor)]
(in {try.#Success [actor sent? alive? obituary]})))]
(unit.coverage [/.Obituary /.obituary']
- (case result
+ (when result
{try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]}
(and (..mailed? sent?)
(not alive?)
@@ -165,7 +165,7 @@
(n.= 2 output_2)
(n.= 3 output_3))))]
(unit.coverage [/.Message /.tell!]
- (case result
+ (when result
{try.#Success outcome}
outcome
diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 5ca8704ff..36aba9dfd 100644
--- a/stdlib/source/test/lux/control/concurrency/async.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -40,7 +40,7 @@
(do io.monad
[?left (/.value left)
?right (/.value right)]
- (in (case [?left ?right]
+ (in (when [?left ?right]
[{.#Some left}
{.#Some right}]
(== left right)
@@ -121,7 +121,7 @@
?right (/.or (/.after waiting_time dummy)
(in rightE))]
(unit.coverage [/.or]
- (case [?left ?right]
+ (when [?left ?right]
[{.#Left leftA} {.#Right rightA}]
(n.= (n.+ leftE rightE)
(n.+ leftA rightA))
@@ -142,7 +142,7 @@
(/.async []))]
?never (/.future (/.value async))]
(unit.coverage [/.value]
- (case [?actual ?never]
+ (when [?actual ?never]
[{.#Some actual} {.#None}]
(n.= expected actual)
@@ -160,7 +160,7 @@
[?none (/.within 0 (/.after waiting_time dummy))
?actual (/.within waiting_time (in expected))]
(unit.coverage [/.within]
- (case [?none ?actual]
+ (when [?none ?actual]
[{.#None} {.#Some actual}]
(n.= expected actual)
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index a3fe7263c..16cae30d8 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -40,7 +40,7 @@
(do io.monad
[?left (async.value left)
?right (async.value right)]
- (in (case [?left ?right]
+ (in (when [?left ?right]
[{.#Some {.#Some [left _]}}
{.#Some {.#Some [right _]}}]
(== left right)
@@ -50,13 +50,13 @@
(def (take_amount amount_of_polls [channel sink])
(All (_ a) (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a))))
- (case amount_of_polls
+ (when amount_of_polls
0 (do async.monad
[_ (async.future (at sink close))]
(in {.#End}))
_ (do [! async.monad]
[event channel]
- (case event
+ (when event
{.#None}
(in {.#End})
@@ -86,7 +86,7 @@
($monad.spec ..injection ..comparison /.monad))
(_.coverage [/.Channel /.Sink /.channel]
- (case (io.run!
+ (when (io.run!
(do (try.with io.monad)
[.let [[channel sink] (is [(/.Channel Nat) (/.Sink Nat)]
(/.channel []))]
@@ -97,7 +97,7 @@
(io.run!
(do io.monad
[?actual (async.value channel)]
- (in (case ?actual
+ (in (when ?actual
{.#Some {.#Some [actual _]}}
(n.= sample actual)
@@ -107,7 +107,7 @@
{try.#Failure error}
false))
(_.coverage [/.already_closed]
- (case (io.run!
+ (when (io.run!
(do (try.with io.monad)
[.let [[channel sink] (is [(/.Channel Nat) (/.Sink Nat)]
(/.channel []))]
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 19a99f55d..54143c345 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -46,7 +46,7 @@
(in (do async.monad
[result (async.within ..delay (/.wait! semaphore))]
(unit.coverage [/.semaphore]
- (case result
+ (when result
{.#Some _}
true
@@ -59,7 +59,7 @@
[_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore))
result (async.within ..delay (/.wait! semaphore))]
(unit.coverage [/.wait!]
- (case result
+ (when result
{.#Some _}
false
@@ -75,7 +75,7 @@
open_positions (/.signal! semaphore)
result/1 (async.within ..delay block)]
(unit.coverage [/.signal!]
- (case [result/0 result/1 open_positions]
+ (when [result/0 result/1 open_positions]
[{.#None} {.#Some _} {try.#Success +0}]
true
@@ -87,7 +87,7 @@
(in (do async.monad
[outcome (/.signal! semaphore)]
(unit.coverage [/.semaphore_is_maxed_out]
- (case outcome
+ (when outcome
{try.#Failure error}
(exception.match? /.semaphore_is_maxed_out error)
@@ -146,7 +146,7 @@
(do random.monad
[raw random.nat]
(_.coverage [/.Limit /.limit]
- (case [raw (/.limit raw)]
+ (when [raw (/.limit raw)]
[0 {.#None}]
true
diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux
index 8f57a99dc..ce7b9d985 100644
--- a/stdlib/source/test/lux/control/continuation.lux
+++ b/stdlib/source/test/lux/control/continuation.lux
@@ -72,7 +72,7 @@
visit (is (-> (List Nat)
(/.Cont (List Nat) (List Nat)))
(function (visit xs)
- (case xs
+ (when xs
{.#End}
(_#in {.#End})
diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux
index 1021d8522..d90494bd9 100644
--- a/stdlib/source/test/lux/control/exception.lux
+++ b/stdlib/source/test/lux/control/exception.lux
@@ -39,11 +39,11 @@
(_.for [/.Exception])
(all _.and
(_.coverage [/.except]
- (case (/.except ..an_exception [])
+ (when (/.except ..an_exception [])
{try.#Success _} false
{try.#Failure _} true))
(_.coverage [/.error]
- (case (/.except ..an_exception [])
+ (when (/.except ..an_exception [])
{try.#Success _}
false
@@ -53,7 +53,7 @@
(/.match? ..an_exception
(/.error ..an_exception [])))
(_.coverage [/.assertion]
- (case (/.assertion ..an_exception [] assertion_succeeded?)
+ (when (/.assertion ..an_exception [] assertion_succeeded?)
{try.#Success _}
assertion_succeeded?
@@ -89,13 +89,13 @@
(text.contains? field1 enumeration)
(text.contains? value1 enumeration))))
(_.coverage [/.with]
- (and (case (/.with ..an_exception [] {try.#Success expected})
+ (and (when (/.with ..an_exception [] {try.#Success expected})
{try.#Success actual} (n.= expected actual)
{try.#Failure _} false)
- (case (/.with ..an_exception [] {try.#Failure ""})
+ (when (/.with ..an_exception [] {try.#Failure ""})
{try.#Success _} false
{try.#Failure message} (text#= message (/.error ..an_exception [])))
- (case (/.with ..an_exception []
+ (when (/.with ..an_exception []
(is (Try Nat)
(/.except ..another_exception [])))
{try.#Success _}
@@ -105,7 +105,7 @@
(and (text.contains? (/.error ..an_exception []) message)
(text.contains? (/.error ..another_exception []) message)))))
(_.coverage [/.exception]
- (case (/.except ..custom_exception [expected])
+ (when (/.except ..custom_exception [expected])
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/control/function/contract.lux b/stdlib/source/test/lux/control/function/contract.lux
index 312e7070f..44666a08d 100644
--- a/stdlib/source/test/lux/control/function/contract.lux
+++ b/stdlib/source/test/lux/control/function/contract.lux
@@ -24,7 +24,7 @@
[expected random.nat])
(all _.and
(_.coverage [/.pre /.pre_condition_failed]
- (case (try (/.pre (n.even? expected)
+ (when (try (/.pre (n.even? expected)
true))
{try.#Success output}
output
@@ -34,7 +34,7 @@
error)
(not (n.even? expected)))))
(_.coverage [/.post /.post_condition_failed]
- (case (try (/.post n.odd?
+ (when (try (/.post n.odd?
expected))
{try.#Success actual}
(same? expected actual)
diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux
index d1ab63220..8c024ff60 100644
--- a/stdlib/source/test/lux/control/function/memo.lux
+++ b/stdlib/source/test/lux/control/function/memo.lux
@@ -32,7 +32,7 @@
(def (fibonacci again input)
(/.Memo Nat Nat)
- (case input
+ (when input
0 (state#in 0)
1 (state#in 1)
_ (do state.monad
@@ -110,7 +110,7 @@
(//.mixed /.memoization)
(is (//.Mixin Nat (State (Dictionary Nat Nat) Nat))
(function (factorial delegate again input)
- (case input
+ (when input
(^.or 0 1) (at state.monad in 1)
_ (do state.monad
[output' (again (-- input))]
diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux
index 9fce7f116..9d403e17d 100644
--- a/stdlib/source/test/lux/control/function/mixin.lux
+++ b/stdlib/source/test/lux/control/function/mixin.lux
@@ -55,7 +55,7 @@
(_.coverage [/.fixed]
(let [factorial (/.fixed
(function (_ delegate again input)
- (case input
+ (when input
(^.or 0 1) 1
_ (n.* input (again (-- input))))))]
(n.= expected
@@ -63,7 +63,7 @@
(_.coverage [/.mixed]
(let [bottom (is (/.Mixin Nat Nat)
(function (_ delegate again input)
- (case input
+ (when input
(^.or 0 1) 1
_ (delegate input))))
multiplication (is (/.Mixin Nat Nat)
@@ -75,7 +75,7 @@
(_.coverage [/.nothing]
(let [loop (is (/.Mixin Nat Nat)
(function (_ delegate again input)
- (case input
+ (when input
(^.or 0 1) 1
_ (n.* input (delegate (-- input))))))
left (/.fixed (/.mixed /.nothing loop))
@@ -90,7 +90,7 @@
1))
bottom? (is (Predicate Nat)
(function (_ input)
- (case input
+ (when input
(^.or 0 1) true
_ false)))
multiplication (is (/.Mixin Nat Nat)
@@ -132,7 +132,7 @@
(let [factorial (/.fixed
(/.of_recursive
(function (_ again input)
- (case input
+ (when input
(^.or 0 1) 1
_ (n.* input (again (-- input)))))))]
(n.= expected
diff --git a/stdlib/source/test/lux/control/function/mutual.lux b/stdlib/source/test/lux/control/function/mutual.lux
index a4bfed417..8f6a7069d 100644
--- a/stdlib/source/test/lux/control/function/mutual.lux
+++ b/stdlib/source/test/lux/control/function/mutual.lux
@@ -24,13 +24,13 @@
(<| (_.coverage [/.let])
(/.let [(even? number)
(-> Nat Bit)
- (case number
+ (when number
0 true
_ (odd? (-- number)))
(odd? number)
(-> Nat Bit)
- (case number
+ (when number
0 false
_ (even? (-- number)))]
(and (bit#= expected (even? sample))
@@ -39,13 +39,13 @@
(/.def
[(even? number)
(-> Nat Bit)
- (case number
+ (when number
0 true
_ (odd? (-- number)))]
[(odd? number)
(-> Nat Bit)
- (case number
+ (when number
0 false
_ (even? (-- number)))])
diff --git a/stdlib/source/test/lux/control/function/predicate.lux b/stdlib/source/test/lux/control/function/predicate.lux
index 6855a1b2d..9a016094c 100644
--- a/stdlib/source/test/lux/control/function/predicate.lux
+++ b/stdlib/source/test/lux/control/function/predicate.lux
@@ -25,7 +25,7 @@
(def (multiple? factor)
(-> Nat (/.Predicate Nat))
- (case factor
+ (when factor
0 (function.constant false)
_ (|>> (n.% factor) (n.= 0))))
@@ -80,7 +80,7 @@
any_even? (is (/.Predicate (List Nat))
(/.rec (function (_ again)
(function (_ values)
- (case values
+ (when values
{.#End}
false
diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux
index e4efb58b0..d99622737 100644
--- a/stdlib/source/test/lux/control/maybe.lux
+++ b/stdlib/source/test/lux/control/maybe.lux
@@ -56,7 +56,7 @@
[a (lifted (io#in left))
b (in right)]
(in (n.+ a b))))
- (pipe.case
+ (pipe.when
{.#Some actual}
(n.= expected actual)
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index 9922a79dc..10e897f03 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -31,7 +31,7 @@
(def (should_fail expected input)
(All (_ a) (-> Text (Try a) Bit))
- (case input
+ (when input
{try.#Failure actual}
(text#= expected actual)
@@ -40,7 +40,7 @@
(def (enforced? parser input)
(All (_ s) (-> (Parser s Any) s Bit))
- (case (/.result parser input)
+ (when (/.result parser input)
{try.#Success [_ []]}
true
@@ -49,7 +49,7 @@
(def (found? parser input)
(All (_ s) (-> (Parser s Bit) s Bit))
- (case (/.result parser input)
+ (when (/.result parser input)
{try.#Success [_ .true]}
true
@@ -58,7 +58,7 @@
(def (fails? input)
(All (_ a) (-> (Try a) Bit))
- (case input
+ (when input
{try.#Failure _}
true
@@ -69,7 +69,7 @@
(syntax (_ [pattern <code>.any
then <code>.any
input <code>.any])
- (in (list (` (case (, input)
+ (in (list (` (when (, input)
{try.#Success [(,' _) (, pattern)]}
(, then)
@@ -327,7 +327,7 @@
(def comparison
(Comparison (All (_ a i) (Parser i a)))
(function (_ == left right)
- (case [(/.result left []) (/.result right [])]
+ (when [(/.result left []) (/.result right [])]
[{try.#Success [_ left]} {try.#Success [_ right]}]
(== left right)
diff --git a/stdlib/source/test/lux/control/pipe.lux b/stdlib/source/test/lux/control/pipe.lux
index 50d5bb67f..5f367ab9b 100644
--- a/stdlib/source/test/lux/control/pipe.lux
+++ b/stdlib/source/test/lux/control/pipe.lux
@@ -51,13 +51,6 @@
(/.if [n.even?]
[(/.new "even" [])]
[(/.new "odd" [])]))))
- (_.coverage [/.when]
- (n.= (if (n.even? sample)
- (n.* 2 sample)
- sample)
- (|> sample
- (/.when [n.even?]
- [(n.* 2)]))))
(_.coverage [/.while]
(n.= (n.* 10 sample)
(|> sample
@@ -83,8 +76,8 @@
(and (n.= (++ sample) left)
(n.= (-- sample) middle)
(text#= (%.nat sample) right))))
- (_.coverage [/.case]
- (text#= (case (n.% 10 sample)
+ (_.coverage [/.when]
+ (text#= (when (n.% 10 sample)
0 "zero"
1 "one"
2 "two"
@@ -98,7 +91,7 @@
_ "???")
(|> sample
(n.% 10)
- (/.case
+ (/.when
0 "zero"
1 "one"
2 "two"
diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux
index b409a7d24..54e22f811 100644
--- a/stdlib/source/test/lux/control/region.lux
+++ b/stdlib/source/test/lux/control/region.lux
@@ -34,7 +34,7 @@
(def (success? result)
(All (_ a) (-> (Try a) Bit))
- (case result
+ (when result
{try.#Success _}
true
@@ -43,7 +43,7 @@
(def (throws? exception result)
(All (_ e a) (-> (Exception e) (Try a) Bit))
- (case result
+ (when result
{try.#Success _}
false
@@ -60,7 +60,7 @@
(def comparison
(Comparison (All (_ a) (All (_ ! r) (Region r (Thread !) a))))
(function (_ == left right)
- (case [(sharing [a]
+ (when [(sharing [a]
(is (Equivalence a)
==)
(is (Try a)
diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux
index 9e75c00e6..963b3fbc1 100644
--- a/stdlib/source/test/lux/control/remember.lux
+++ b/stdlib/source/test/lux/control/remember.lux
@@ -39,14 +39,14 @@
(` ((, (code.symbol macro))
(, (code.text (%.date deadline)))
(, (code.text message))
- (,* (case focus
+ (,* (when focus
{.#None} (list)
{.#Some focus} (list focus))))))
(def (attempt computation)
(All (_ a) (-> (Meta a) (Meta (Try a))))
(function (_ compiler)
- (case (computation compiler)
+ (when (computation compiler)
{try.#Success [compiler output]}
{try.#Success [compiler {try.#Success output}]}
@@ -57,7 +57,7 @@
(-> Date Text (Maybe Code) Text Bit)
(and (text.contains? (%.date deadline) failure)
(text.contains? message failure)
- (case focus
+ (when focus
{.#None}
true
@@ -80,27 +80,27 @@
should_fail1 (..attempt (expansion.complete (..memory macro yesterday message {.#Some expected})))
should_succeed0 (..attempt (expansion.complete (..memory macro tomorrow message {.#None})))
should_succeed1 (..attempt (expansion.complete (..memory macro tomorrow message {.#Some expected})))]
- (in (list (code.bit (and (case should_fail0
+ (in (list (code.bit (and (when should_fail0
{try.#Failure error}
(and (test_failure yesterday message {.#None} error)
(text.contains? extra error))
_
false)
- (case should_fail1
+ (when should_fail1
{try.#Failure error}
(and (test_failure yesterday message {.#Some expected} error)
(text.contains? extra error))
_
false)
- (case should_succeed0
+ (when should_succeed0
{try.#Success (list)}
true
_
false)
- (case should_succeed1
+ (when should_succeed1
{try.#Success (list actual)}
(same? expected actual)
diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux
index 857d67ac5..00aac612f 100644
--- a/stdlib/source/test/lux/control/try.lux
+++ b/stdlib/source/test/lux/control/try.lux
@@ -60,7 +60,7 @@
(n.= expected
(/.trusted {/.#Success expected})))
(_.coverage [/.of_maybe]
- (case [(/.of_maybe {.#Some expected})
+ (when [(/.of_maybe {.#Some expected})
(/.of_maybe {.#None})]
[{/.#Success actual} {/.#Failure _}]
(n.= expected actual)
@@ -68,7 +68,7 @@
_
false))
(_.coverage [/.maybe]
- (case [(/.maybe {/.#Success expected})
+ (when [(/.maybe {/.#Success expected})
(/.maybe (is (/.Try Nat) {/.#Failure error}))]
[{.#Some actual} {.#None}]
(n.= expected actual)
@@ -87,7 +87,7 @@
b (in alternative)]
(in (n.+ a b)))
io.run!
- (pipe.case
+ (pipe.when
{/.#Success result}
(n.= (n.+ expected alternative)
result)
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 296867c13..05c3c2c6a 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -54,7 +54,7 @@
(def !expect
(template (_ <expectation> <computation>)
- [(case <computation>
+ [(when <computation>
<expectation>
true
@@ -68,7 +68,7 @@
(|> value
(at utf8.codec encoded)
(at utf8.codec decoded)
- (pipe.case
+ (pipe.when
{try.#Success converted}
(text#= value converted)
@@ -423,7 +423,7 @@
(def (succeed result)
(-> (Try Bit) Bit)
- (case result
+ (when result
{try.#Failure _}
false
@@ -443,7 +443,7 @@
(def (throws? exception try)
(All (_ e a) (-> (Exception e) (Try a) Bit))
- (case try
+ (when try
{try.#Failure error}
(exception.match? exception error)
@@ -454,7 +454,7 @@
(-> Nat (-> Nat /.Binary (Try Nat)) (-> Nat Nat /.Binary (Try Any)) Nat Bit)
(let [bytes (i64.left_shifted power 1)
binary (/.empty bytes)
- cap (case bytes
+ cap (when bytes
8 (-- 0)
_ (|> 1 (i64.left_shifted (n.* 8 bytes)) --))
capped_value (i64.and cap value)]
@@ -499,7 +499,7 @@
[(_.coverage [<bytes/?> <has/?>]
(let [bytes (i64.left_shifted <power> 1)
binary (!.empty bytes)
- cap (case bytes
+ cap (when bytes
8 (-- 0)
_ (|> 1 (i64.left_shifted (n.* 8 bytes)) --))
capped_value (i64.and cap value)
@@ -517,7 +517,7 @@
(_.coverage [!.slice]
(let [random_slice (!.slice offset length sample)
idxs (is (List Nat)
- (case length
+ (when length
0 (list)
_ (enum.range n.enum 0 (-- length))))
reader (function (_ binary idx)
@@ -578,13 +578,13 @@
(_.coverage [/.slice]
(let [random_slice (try.trusted (/.slice offset length sample))
idxs (is (List Nat)
- (case length
+ (when length
0 (list)
_ (enum.range n.enum 0 (-- length))))
reader (function (_ binary idx)
(/.bits_8 idx binary))]
(and (n.= length (/.size random_slice))
- (case [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs)
+ (when [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs)
(monad.each try.monad (reader random_slice) idxs)]
[{try.#Success binary_vals} {try.#Success slice_vals}]
(at (list.equivalence n.equivalence) = binary_vals slice_vals)
@@ -594,14 +594,14 @@
(_.coverage [/.slice_out_of_bounds]
(and (throws? /.slice_out_of_bounds (/.slice size size sample))
(let [verdict (throws? /.slice_out_of_bounds (/.slice offset size sample))]
- (case offset
+ (when offset
0 (not verdict)
_ verdict))))
(_.coverage [/.after]
(and (at /.equivalence = sample (/.after 0 sample))
(at /.equivalence = (/.empty 0) (/.after size sample))
(n.= (n.- offset size) (/.size (/.after offset sample)))
- (case (list.reversed (..as_list sample))
+ (when (list.reversed (..as_list sample))
{.#End}
false
@@ -609,7 +609,7 @@
(n.= (list.mix n.+ 0 tail)
(/.mix n.+ 0 (/.after 1 sample))))))
(_.coverage [/.copy!]
- (and (case (/.copy! size 0 sample 0 (/.empty size))
+ (and (when (/.copy! size 0 sample 0 (/.empty size))
{try.#Success output}
(and (not (same? sample output))
(at /.equivalence = sample output))
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index f12014f24..b13c77f6b 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -70,7 +70,7 @@
{.#Some (at n.decimal encoded value)}
{.#None})))]
(_.coverage [/.one]
- (case [(|> evens
+ (when [(|> evens
(/#each (at n.decimal encoded))
(/.item 0))
(/.one choose evens)]
@@ -87,12 +87,12 @@
(/.example n.even? the_array)
(list.example n.even? (/.list {.#None} the_array))))
(_.coverage [/.example']
- (case [(/.example n.even? the_array)
+ (when [(/.example n.even? the_array)
(/.example' (function (_ idx member)
(n.even? member))
the_array)]
[{.#Some expected} {.#Some [idx actual]}]
- (case (/.item idx the_array)
+ (when (/.item idx the_array)
{.#Some again}
(and (n.= expected actual)
(n.= actual again))
@@ -156,7 +156,7 @@
(n.= size (!.size (is (Array Nat)
(!.empty size)))))
(_.coverage [!.primitive]
- (case !.Array
+ (when !.Array
(<| {.#Named (symbol !.Array)}
{.#UnivQ (list)}
{.#Primitive nominal_type (list {.#Parameter 1})})
@@ -281,7 +281,7 @@
(!.example n.even? the_array)
(list.example n.even? (!.list {.#None} the_array))))
(_.coverage [!.example']
- (case [(!.example n.even? the_array)
+ (when [(!.example n.even? the_array)
(!.example' (function (_ idx member)
(n.even? member))
the_array)]
@@ -324,7 +324,7 @@
(n.= size (/.size (is (Array Nat)
(/.empty size)))))
(_.coverage [/.primitive]
- (case /.Array
+ (when /.Array
(<| {.#Named (symbol /.Array)}
{.#Named (symbol !.Array)}
{.#UnivQ (list)}
@@ -337,7 +337,7 @@
(let [the_array (|> (/.empty 2)
(is (Array Nat))
(/.has! 0 expected))]
- (case [(/.item 0 the_array)
+ (when [(/.item 0 the_array)
(/.item 1 the_array)]
[{.#Some actual} {.#None}]
(n.= expected actual)
@@ -348,7 +348,7 @@
(let [the_array (|> (/.empty 1)
(is (Array Nat))
(/.has! 0 expected))]
- (case [(/.item 0 the_array)
+ (when [(/.item 0 the_array)
(/.item 0 (/.lacks! 0 the_array))]
[{.#Some actual} {.#None}]
(n.= expected actual)
@@ -372,7 +372,7 @@
(is (Array Nat))
(/.has! 0 base)
(/.revised! 0 (n.+ shift)))]
- (case (/.item 0 the_array)
+ (when (/.item 0 the_array)
{.#Some actual}
(n.= expected actual)
@@ -384,7 +384,7 @@
(/.has! 0 base)
(/.upsert! 0 dummy (n.+ shift))
(/.upsert! 1 base (n.+ shift)))]
- (case [(/.item 0 the_array)
+ (when [(/.item 0 the_array)
(/.item 1 the_array)]
[{.#Some actual/0} {.#Some actual/1}]
(and (n.= expected actual/0)
diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux
index 379cfd131..2a134ab17 100644
--- a/stdlib/source/test/lux/data/collection/bits.lux
+++ b/stdlib/source/test/lux/data/collection/bits.lux
@@ -26,7 +26,7 @@
(Random Bits)
(do [! random.monad]
[size (at ! each (n.% 1,000) random.nat)]
- (case size
+ (when size
0 (in /.empty)
_ (do [! random.monad]
[idx (|> random.nat (at ! each (n.% size)))]
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux
index 369bddd2d..d02d9f3a4 100644
--- a/stdlib/source/test/lux/data/collection/dictionary.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary.lux
@@ -44,7 +44,7 @@
(n.= size (/.size dict)))
(_.coverage [/.empty?]
- (case size
+ (when size
0 (/.empty? dict)
_ (not (/.empty? dict))))
@@ -147,26 +147,26 @@
(/.keys dict)))
(_.coverage [/.value]
- (and (list.every? (function (_ key) (case (/.value key dict)
+ (and (list.every? (function (_ key) (when (/.value key dict)
{.#Some _} true
_ false))
(/.keys dict))
- (case (/.value non_key dict)
+ (when (/.value non_key dict)
{.#Some _} false
_ true)))
(_.coverage [/.has]
(and (n.= (++ (/.size dict))
(/.size (/.has non_key test_val dict)))
- (case (/.value non_key (/.has non_key test_val dict))
+ (when (/.value non_key (/.has non_key test_val dict))
{.#Some v} (n.= test_val v)
_ true)))
(_.coverage [/.has' /.key_already_exists]
(let [can_put_new_keys!
- (case (/.has' non_key test_val dict)
+ (when (/.has' non_key test_val dict)
{try.#Success dict}
- (case (/.value non_key dict)
+ (when (/.value non_key dict)
{.#Some v} (n.= test_val v)
_ true)
@@ -176,7 +176,7 @@
cannot_put_old_keys!
(or (n.= 0 size)
(let [first_key (|> dict /.keys list.head maybe.trusted)]
- (case (/.has' first_key test_val dict)
+ (when (/.has' first_key test_val dict)
{try.#Success _}
false
@@ -189,7 +189,7 @@
(and (let [base (/.has non_key test_val dict)]
(and (/.key? base non_key)
(not (/.key? (/.lacks non_key base) non_key))))
- (case (list.head (/.keys dict))
+ (when (list.head (/.keys dict))
{.#None}
true
@@ -200,7 +200,7 @@
(_.coverage [/.revised]
(let [base (/.has non_key test_val dict)
updt (/.revised non_key ++ base)]
- (case [(/.value non_key base) (/.value non_key updt)]
+ (when [(/.value non_key base) (/.value non_key updt)]
[{.#Some x} {.#Some y}]
(n.= (++ x) y)
@@ -209,7 +209,7 @@
(_.coverage [/.revised']
(let [can_upsert_new_key!
- (case (/.value non_key (/.revised' non_key test_val ++ dict))
+ (when (/.value non_key (/.revised' non_key test_val ++ dict))
{.#Some inserted}
(n.= (++ test_val) inserted)
@@ -217,12 +217,12 @@
false)
can_upsert_old_key!
- (case (list.head (/.entries dict))
+ (when (list.head (/.entries dict))
{.#None}
true
{.#Some [known_key known_value]}
- (case (/.value known_key (/.revised' known_key test_val ++ dict))
+ (when (/.value known_key (/.revised' known_key test_val ++ dict))
{.#Some updated}
(n.= (++ known_value) updated)
diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
index 7736202d0..951d6c891 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
@@ -27,7 +27,7 @@
(def .public (dictionary order gen_key gen_value size)
(All (_ k v)
(-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v))))
- (case size
+ (when size
0
(random#in (/.empty order))
@@ -75,7 +75,7 @@
(_.coverage [/.empty]
(/.empty? (/.empty n.order)))
(_.coverage [/.min]
- (case [(/.min sample) (list.head sorted_values)]
+ (when [(/.min sample) (list.head sorted_values)]
[{.#None} {.#None}]
true
@@ -85,7 +85,7 @@
_
false))
(_.coverage [/.max]
- (case [(/.max sample) (list.last sorted_values)]
+ (when [(/.max sample) (list.last sorted_values)]
[{.#None} {.#None}]
true
@@ -116,7 +116,7 @@
(/.size sample+))))))
(_.coverage [/.value]
(let [sample+ (/.has extra_key extra_value sample)]
- (case [(/.value extra_key sample)
+ (when [(/.value extra_key sample)
(/.value extra_key sample+)]
[{.#None} {.#Some actual}]
(n.= extra_value actual)
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 6bb1808f7..bd1e684d7 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -77,7 +77,7 @@
[a (lifted (io#in parameter))
b (in subject)]
(in (n.+ a b))))
- (pipe.case
+ (pipe.when
(list actual)
(n.= expected actual)
@@ -169,7 +169,7 @@
has_correct_values!)))
(_.coverage [/.item]
(/.every? (function (_ [index expected])
- (case (/.item index sample)
+ (when (/.item index sample)
{.#Some actual}
(n.= expected actual)
@@ -177,13 +177,13 @@
false))
(/.enumeration sample)))
(do !
- [index (case size
+ [index (when size
0 random.nat
_ (at ! each (n.% size) random.nat))
.let [changed? (/#= sample (/.revised index ++ sample))
same? (/#= sample (/.revised size ++ sample))]]
(_.coverage [/.revised]
- (case size
+ (when size
0 (and changed?
same?)
_ (not changed?))))
@@ -250,7 +250,7 @@
(,, (with_template [<head> <tail> <pre>]
[(all _.and
(_.coverage [<head>]
- (case [(<pre> sample) (<head> sample)]
+ (when [(<pre> sample) (<head> sample)]
[{.#Item expected _} {.#Some actual}]
(n.= expected actual)
@@ -260,7 +260,7 @@
_
false))
(_.coverage [<tail>]
- (case [(<pre> sample) (<tail> sample)]
+ (when [(<pre> sample) (<tail> sample)]
[{.#Item _ expected} {.#Some actual}]
(/#= (<pre> expected) actual)
@@ -298,7 +298,7 @@
/.size
(n.% 2)
(n.= 0))]
- (case (/.pairs sample/0)
+ (when (/.pairs sample/0)
{.#Some pairs/0}
(and even_sized?
(n.= (n./ 2 (/.size sample/0))
@@ -384,7 +384,7 @@
[sample ..random]
(all _.and
(_.coverage [/.one]
- (case [(|> sample
+ (when [(|> sample
(/.only n.even?)
(/#each (at n.decimal encoded))
/.head)
@@ -404,7 +404,7 @@
(/#each (at n.decimal encoded)))
(/.all choice sample)))
(_.coverage [/.example]
- (case (/.example n.even? sample)
+ (when (/.example n.even? sample)
{.#Some found}
(n.even? found)
diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux
index b1889edc9..99511bab5 100644
--- a/stdlib/source/test/lux/data/collection/queue.lux
+++ b/stdlib/source/test/lux/data/collection/queue.lux
@@ -60,7 +60,7 @@
(and empty_is_empty!
all_empty_queues_look_the_same!)))
(_.coverage [/.front]
- (case [members (/.front sample)]
+ (when [members (/.front sample)]
[{.#Item head tail} {.#Some first}]
(n.= head first)
@@ -95,7 +95,7 @@
new_member_is_identified!
has_expected_order!)))
(_.coverage [/.next]
- (case members
+ (when members
{.#Item target expected}
(let [popped (/.next sample)
diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux
index b0ca6a4f9..b7a1028fe 100644
--- a/stdlib/source/test/lux/data/collection/queue/priority.lux
+++ b/stdlib/source/test/lux/data/collection/queue/priority.lux
@@ -49,14 +49,14 @@
(_.coverage [/.empty]
(/.empty? /.empty))
(_.coverage [/.front]
- (case (/.front sample)
+ (when (/.front sample)
{.#Some first}
(n.> 0 (/.size sample))
{.#None}
(/.empty? sample)))
(_.coverage [/.member?]
- (case (/.front sample)
+ (when (/.front sample)
{.#Some first}
(/.member? n.equivalence sample first)
diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux
index dac8c85a5..a24d05ed6 100644
--- a/stdlib/source/test/lux/data/collection/sequence.lux
+++ b/stdlib/source/test/lux/data/collection/sequence.lux
@@ -94,7 +94,7 @@
.let [sample (|> sample set.list /.of_list)]]
(all _.and
(_.coverage [/.item]
- (case (/.item good_index sample)
+ (when (/.item good_index sample)
{try.#Success member}
(/.member? n.equivalence sample member)
@@ -119,7 +119,7 @@
(_.coverage [/.index_out_of_bounds]
(let [fails! (is (All (_ a) (-> (Try a) Bit))
(function (_ situation)
- (case situation
+ (when situation
{try.#Success member}
false
@@ -201,7 +201,7 @@
(if (n.even? value)
{.#Some (at n.decimal encoded value)}
{.#None})))]
- (case [(|> sample
+ (when [(|> sample
(/.only n.even?)
(/#each (at n.decimal encoded))
(/.item 0))
diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux
index cc68dbb85..cedc2db15 100644
--- a/stdlib/source/test/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/set/ordered.lux
@@ -26,7 +26,7 @@
(def .public (random size order gen_value)
(All (_ a) (-> Nat (Order a) (Random a) (Random (Set a))))
- (case size
+ (when size
0
(random#in (/.empty order))
@@ -74,7 +74,7 @@
(/#= setL)))
(,, (with_template [<coverage> <comparison>]
[(_.coverage [<coverage>]
- (case (<coverage> setL)
+ (when (<coverage> setL)
{.#Some value}
(|> setL /.list (list.every? (<comparison> value)))
diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux
index 51357230f..22935a5f9 100644
--- a/stdlib/source/test/lux/data/collection/stack.lux
+++ b/stdlib/source/test/lux/data/collection/stack.lux
@@ -45,14 +45,14 @@
(_.coverage [/.empty]
(/.empty? /.empty))
(_.coverage [/.value]
- (case (/.value sample)
+ (when (/.value sample)
{.#None}
(/.empty? sample)
{.#Some _}
(not (/.empty? sample))))
(_.coverage [/.next]
- (case (/.next sample)
+ (when (/.next sample)
{.#None}
(/.empty? sample)
@@ -61,7 +61,7 @@
sample
(/.top top remaining))))
(_.coverage [/.top]
- (case (/.next (/.top expected_top sample))
+ (when (/.next (/.top expected_top sample))
{.#Some [actual_top actual_sample]}
(and (same? expected_top actual_top)
(same? sample actual_sample))
diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux
index 1193c4e9e..8f7ef89da 100644
--- a/stdlib/source/test/lux/data/collection/tree.lux
+++ b/stdlib/source/test/lux/data/collection/tree.lux
@@ -31,7 +31,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux
index f291a6e51..ff6e1b62f 100644
--- a/stdlib/source/test/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/test/lux/data/collection/tree/finger.lux
@@ -51,20 +51,20 @@
(at ..builder leaf tag_left expected_left)
(at ..builder leaf tag_right expected_right))))))
(_.coverage [/.root]
- (and (case (/.root (at ..builder leaf tag_left expected_left))
+ (and (when (/.root (at ..builder leaf tag_left expected_left))
{.#Left actual}
(n.= expected_left actual)
{.#Right _}
false)
- (case (/.root (at ..builder branch
+ (when (/.root (at ..builder branch
(at ..builder leaf tag_left expected_left)
(at ..builder leaf tag_right expected_right)))
{.#Left _}
false
{.#Right [left right]}
- (case [(/.root left)
+ (when [(/.root left)
(/.root right)]
[{.#Left actual_left} {.#Left actual_right}]
(and (n.= expected_left actual_left)
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index d39552093..0b5dca612 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -54,7 +54,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
@@ -152,7 +152,7 @@
expected_string (random.unicode 1)
[boolean_field number_field string_field] (|> (random.set text.hash 3 (random.unicode 3))
(at ! each (|>> set.list
- (pipe.case
+ (pipe.when
(list boolean_field number_field string_field)
[boolean_field number_field string_field]
@@ -312,7 +312,7 @@
(_.coverage [/.Null /.null?]
(at bit.equivalence =
(/.null? sample)
- (case sample
+ (when sample
{/.#Null} true
_ false))))
(do random.monad
@@ -331,7 +331,7 @@
object (/.object expected)]]
(all _.and
(_.coverage [/.object /.fields]
- (case (/.fields object)
+ (when (/.fields object)
{try.#Success actual}
(at (list.equivalence text.equivalence) =
(list#each product.left expected)
@@ -362,7 +362,7 @@
(try.else false))
cannot_find_unknown_key!
- (case (/.field unknown object)
+ (when (/.field unknown object)
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index 1101f9ca1..a858db473 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -47,7 +47,7 @@
/.path_size)]
(`` (all _.and
(_.coverage [/.path /.from_path]
- (case (/.path expected)
+ (when (/.path expected)
{try.#Success actual}
(text#= expected
(/.from_path actual))
@@ -57,14 +57,14 @@
(_.coverage [/.no_path]
(text#= "" (/.from_path /.no_path)))
(_.coverage [/.path_size /.path_is_too_long]
- (case (/.path invalid)
+ (when (/.path invalid)
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.path_is_too_long error)))
(_.coverage [/.not_ascii]
- (case (/.path not_ascii)
+ (when (/.path not_ascii)
{try.#Success actual}
false
@@ -82,7 +82,7 @@
/.name_size)]
(`` (all _.and
(_.coverage [/.name /.from_name]
- (case (/.name expected)
+ (when (/.name expected)
{try.#Success actual}
(text#= expected
(/.from_name actual))
@@ -90,14 +90,14 @@
{try.#Failure error}
false))
(_.coverage [/.name_size /.name_is_too_long]
- (case (/.name invalid)
+ (when (/.name invalid)
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.name_is_too_long error)))
(_.coverage [/.not_ascii]
- (case (/.name not_ascii)
+ (when (/.name not_ascii)
{try.#Success actual}
false
@@ -113,7 +113,7 @@
invalid (|> random.nat (at ! each (n.max /.small_limit)))]
(`` (all _.and
(_.coverage [/.small /.from_small]
- (case (/.small expected)
+ (when (/.small expected)
{try.#Success actual}
(n.= expected
(/.from_small actual))
@@ -121,7 +121,7 @@
{try.#Failure error}
false))
(_.coverage [/.small_limit /.not_a_small_number]
- (case (/.small invalid)
+ (when (/.small invalid)
{try.#Success actual}
false
@@ -137,7 +137,7 @@
invalid (|> random.nat (at ! each (n.max /.big_limit)))]
(`` (all _.and
(_.coverage [/.big /.from_big]
- (case (/.big expected)
+ (when (/.big expected)
{try.#Success actual}
(n.= expected
(/.from_big actual))
@@ -145,7 +145,7 @@
{try.#Failure error}
false))
(_.coverage [/.big_limit /.not_a_big_number]
- (case (/.big invalid)
+ (when (/.big invalid)
{try.#Success actual}
false
@@ -175,7 +175,7 @@
tar (|> (sequence.sequence {<tag> expected_path})
(\\format.result /.format)
(<b>.result /.parser))]
- (in (case (sequence.list tar)
+ (in (when (sequence.list tar)
(list {<tag> actual_path})
(text#= (/.from_path expected_path)
(/.from_path actual_path))
@@ -204,7 +204,7 @@
expected_content]})
(\\format.result /.format)
(<b>.result /.parser))]
- (in (case (sequence.list tar)
+ (in (when (sequence.list tar)
(list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]})
(let [seconds (is (-> Instant Int)
(|>> instant.relative (duration.ticks duration.second)))]
@@ -262,7 +262,7 @@
content]})
(\\format.result /.format)
(<b>.result /.parser))]
- (in (case (sequence.list tar)
+ (in (when (sequence.list tar)
(list {/.#Normal [_ _ actual_mode _ _]})
(n.= (/.mode expected_mode)
(/.mode actual_mode))
@@ -285,7 +285,7 @@
content]})
(\\format.result /.format)
(<b>.result /.parser))]
- (in (case (sequence.list tar)
+ (in (when (sequence.list tar)
(list {/.#Normal [_ _ actual_mode _ _]})
(n.= (/.mode <expected_mode>)
(/.mode actual_mode))
@@ -324,14 +324,14 @@
(_.for [/.Ownership /.Owner /.ID]
(all _.and
(_.coverage [/.name_size /.name_is_too_long]
- (case (/.name invalid)
+ (when (/.name invalid)
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.name_is_too_long error)))
(_.coverage [/.not_ascii]
- (case (/.name not_ascii)
+ (when (/.name not_ascii)
{try.#Success actual}
false
@@ -352,7 +352,7 @@
content]})
(\\format.result /.format)
(<b>.result /.parser))]
- (in (case (sequence.list tar)
+ (in (when (sequence.list tar)
(list {/.#Normal [_ _ _ actual_ownership _]})
(and (text#= (/.from_name expected)
(/.from_name (the [/.#user /.#name] actual_ownership)))
@@ -376,7 +376,7 @@
content]})
(\\format.result /.format)
(<b>.result /.parser))]
- (in (case (sequence.list tar)
+ (in (when (sequence.list tar)
(list {/.#Normal [_ _ _ actual_ownership _]})
(and (text#= (/.from_name /.anonymous)
(/.from_name (the [/.#user /.#name] actual_ownership)))
@@ -407,7 +407,7 @@
(try.else false)))
(_.coverage [/.invalid_end_of_archive]
(let [dump (\\format.result /.format sequence.empty)]
- (case (<b>.result /.parser (binary#composite dump dump))
+ (when (<b>.result /.parser (binary#composite dump dump))
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux
index c4cccc987..44e3c2553 100644
--- a/stdlib/source/test/lux/data/format/xml.lux
+++ b/stdlib/source/test/lux/data/format/xml.lux
@@ -35,7 +35,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux
index 11430bb32..b0956f5ba 100644
--- a/stdlib/source/test/lux/data/sum.lux
+++ b/stdlib/source/test/lux/data/sum.lux
@@ -40,13 +40,13 @@
(_.coverage [/.left]
(|> (/.left expected)
(is (Or Nat Nat))
- (pipe.case
+ (pipe.when
{0 #0 actual} (n.= expected actual)
_ false)))
(_.coverage [/.right]
(|> (/.right expected)
(is (Or Nat Nat))
- (pipe.case
+ (pipe.when
{0 #1 actual} (n.= expected actual)
_ false)))
(_.coverage [/.either]
@@ -62,11 +62,11 @@
(and (|> (/.left expected)
(is (Or Nat Nat))
(/.then (n.+ shift) (n.- shift))
- (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false))
+ (pipe.when {0 #0 actual} (n.= (n.+ shift expected) actual) _ false))
(|> (/.right expected)
(is (Or Nat Nat))
(/.then (n.+ shift) (n.- shift))
- (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false))))
+ (pipe.when {0 #1 actual} (n.= (n.- shift expected) actual) _ false))))
(do !
[size (at ! each (n.% 5) random.nat)
expected (random.list size random.nat)]
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index dca84b015..97fe18d59 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -195,7 +195,7 @@
(do random.monad
[sample (random.maybe random.nat)]
(_.coverage [\\format.maybe]
- (case sample
+ (when sample
{.#None}
true
@@ -215,7 +215,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
@@ -224,7 +224,7 @@
(def (should_fail' sample parser exception)
(All (_ a e) (-> Text (\\parser.Parser a) (Exception e) Bit))
- (case (\\parser.result parser sample)
+ (when (\\parser.result parser sample)
{try.#Failure error}
(exception.match? exception error)
@@ -233,7 +233,7 @@
(def (should_fail sample parser)
(All (_ a) (-> Text (\\parser.Parser a) Bit))
- (case (\\parser.result parser sample)
+ (when (\\parser.result parser sample)
{try.#Failure _}
true
@@ -259,7 +259,7 @@
range (at ! each (|>> (nat.% 50) (nat.+ 10)) random.nat)
.let [limit (nat.+ offset range)]
expected (at ! each (|>> (nat.% range) (nat.+ offset) /.of_char) random.nat)
- out_of_range (case offset
+ out_of_range (when offset
0 (at ! each (|>> (nat.% 10) ++ (nat.+ limit) /.of_char) random.nat)
_ (at ! each (|>> (nat.% offset) /.of_char) random.nat))]
(_.coverage [\\parser.range]
@@ -745,9 +745,9 @@
.let [sample (|> characters set.list /.together)]
expected (at ! each (nat.% size) random.nat)]
(_.coverage [/.char]
- (case (/.char expected sample)
+ (when (/.char expected sample)
{.#Some char}
- (case (/.index (/.of_char char) sample)
+ (when (/.index (/.of_char char) sample)
{.#Some actual}
(nat.= expected actual)
@@ -803,7 +803,7 @@
(at /.monoid composite post static)
(/.replaced_once pre post (at /.monoid composite pre static))))
(_.coverage [/.split_by]
- (case (/.split_by static (all (at /.monoid composite) pre static post))
+ (when (/.split_by static (all (at /.monoid composite) pre static post))
{.#Some [left right]}
(and (at /.equivalence = pre left)
(at /.equivalence = post right))
@@ -883,7 +883,7 @@
(all _.and
(_.coverage [/.split_at]
(|> (/.split_at sizeL sample)
- (pipe.case
+ (pipe.when
{.#Right [_l _r]}
(and (/#= sampleL _l)
(/#= sampleR _r)
@@ -896,7 +896,7 @@
(/.clip sizeL (nat.- sizeL (/.size sample)) sample)
(/.clip_since sizeL sample)
(/.clip_since 0 sample)]
- (pipe.case
+ (pipe.when
[{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}]
(and (/#= sampleL _l)
(/#= sampleR _r)
diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux
index 1ac4b1904..554aaa16f 100644
--- a/stdlib/source/test/lux/data/text/escape.lux
+++ b/stdlib/source/test/lux/data/text/escape.lux
@@ -107,7 +107,7 @@
(if (or (/.escapable? left)
(/.escapable? right))
(let [escaped (/.escaped expected)]
- (case (/.un_escaped escaped)
+ (when (/.un_escaped escaped)
{try.#Success un_escaped}
(and (not (text#= escaped expected))
(text#= un_escaped expected))
@@ -119,7 +119,7 @@
[dummy (|> (random.char unicode.character)
(at ! each text.of_char))]
(_.coverage [/.dangling_escape]
- (case (/.un_escaped (format (/.escaped dummy) "\"))
+ (when (/.un_escaped (format (/.escaped dummy) "\"))
{try.#Success _}
false
@@ -130,7 +130,7 @@
(random.only (|>> (set.member? ..valid_sigils) not))
(at ! each text.of_char))]
(_.coverage [/.invalid_escape]
- (case (/.un_escaped (format "\" dummy))
+ (when (/.un_escaped (format "\" dummy))
{try.#Success _}
false
@@ -141,12 +141,12 @@
(at ! each (n.% (hex "1000"))))
code (|> (random.unicode 4)
(random.only (function (_ code)
- (case (at n.hex decoded code)
+ (when (at n.hex decoded code)
{try.#Failure error} true
{try.#Success _} false))))]
(_.coverage [/.invalid_unicode_escape]
(template.let [(!invalid <code>)
- [(case (/.un_escaped (format "\u" <code>))
+ [(when (/.un_escaped (format "\u" <code>))
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index d5be70ce1..1b1b8ec95 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -28,7 +28,7 @@
(-> (Parser Text) Text Bit)
(|> input
(<text>.result regex)
- (pipe.case
+ (pipe.when
{try.#Success parsed}
(text#= parsed input)
@@ -39,7 +39,7 @@
(-> Text (Parser Text) Text Bit)
(|> input
(<text>.result regex)
- (pipe.case
+ (pipe.when
{try.#Success parsed}
(text#= test parsed)
@@ -50,7 +50,7 @@
(All (_ a) (-> (Parser a) Text Bit))
(|> input
(<text>.result regex)
- (pipe.case
+ (pipe.when
{try.#Failure _}
true
@@ -64,7 +64,7 @@
(macro.with_symbols [g!message g!_]
(in (list (` (|> (, input)
(<text>.result (, regex))
- (pipe.case
+ (pipe.when
{try.#Success (, pattern)}
true
@@ -282,7 +282,7 @@
(def expands?
(syntax (_ [form <code>.any])
(function (_ lux)
- {try.#Success [lux (list (code.bit (case (expansion.single form lux)
+ {try.#Success [lux (list (code.bit (when (expansion.single form lux)
{try.#Success _}
true
@@ -310,7 +310,7 @@
sample2 (random.unicode 3)
sample3 (random.unicode 4)]
(_.coverage [/.pattern]
- (case (format sample1 "-" sample2 "-" sample3)
+ (when (format sample1 "-" sample2 "-" sample3)
(/.pattern "(.{3})-(.{3})-(.{4})"
[_ match1 match2 match3])
(and (text#= sample1 match1)
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index 6332cfa59..1612f17b4 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -78,7 +78,7 @@
[sample_bit random.bit
sample_int random.int
sample_frac random.frac]
- (in (`` (and (case (/.representation (type_literal [Bit Int Frac])
+ (in (`` (and (when (/.representation (type_literal [Bit Int Frac])
[sample_bit sample_int sample_frac])
{try.#Success actual}
(text#= (format "[" (%.bit sample_bit)
@@ -186,7 +186,7 @@
))
)))
(_.coverage [/.cannot_represent_value]
- (case (/.representation (-> Nat Nat) (|>>))
+ (when (/.representation (-> Nat Nat) (|>>))
{try.#Success representation}
false
@@ -221,7 +221,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- (case ((expansion.complete macro) compiler)
+ (when ((expansion.complete macro) compiler)
{try.#Failure error}
{try.#Success [compiler (list (code.text error))]}
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux
index 2d162fb2a..f691453e1 100644
--- a/stdlib/source/test/lux/documentation.lux
+++ b/stdlib/source/test/lux/documentation.lux
@@ -25,7 +25,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- {try.#Success [compiler (list (code.bit (case ((expansion.complete macro) compiler)
+ {try.#Success [compiler (list (code.bit (when ((expansion.complete macro) compiler)
{try.#Failure error}
true
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 5b3e2bb80..d7d05321d 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -78,7 +78,7 @@
(function (_ lux)
(|> (expansion.single expression)
(meta.result lux)
- (pipe.case
+ (pipe.when
{try.#Success expansion}
{try.#Failure "OOPS!"}
@@ -169,10 +169,10 @@
bit/0 random.bit]
(all _.and
(_.coverage [/.as]
- (and (case (/.as java/lang/String sample) {.#Some _} true {.#None} false)
- (case (/.as java/lang/Long sample) {.#Some _} false {.#None} true)
- (case (/.as java/lang/Object sample) {.#Some _} true {.#None} false)
- (case (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true)))
+ (and (when (/.as java/lang/String sample) {.#Some _} true {.#None} false)
+ (when (/.as java/lang/Long sample) {.#Some _} false {.#None} true)
+ (when (/.as java/lang/Object sample) {.#Some _} true {.#None} false)
+ (when (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true)))
(_.coverage [/.synchronized]
(/.synchronized sample true))
(_.coverage [/.class_for]
@@ -183,7 +183,7 @@
(_.coverage [/.???]
(and (|> (/.??? (/.null))
(is (Maybe java/lang/Object))
- (pipe.case
+ (pipe.when
{.#None}
true
@@ -191,7 +191,7 @@
false))
(|> (/.??? sample)
(is (Maybe java/lang/Object))
- (pipe.case
+ (pipe.when
{.#Some _}
true
@@ -331,14 +331,14 @@
(/.as_long (.int expected))
(panic! "YOLO"))))
example/1!
- (and (case (test/TestInterface1::actual1 (/.as_boolean false) object/1)
+ (and (when (test/TestInterface1::actual1 (/.as_boolean false) object/1)
{try.#Success actual}
(same? (is Any expected)
(is Any actual))
{try.#Failure error}
false)
- (case (test/TestInterface1::actual1 (/.as_boolean true) object/1)
+ (when (test/TestInterface1::actual1 (/.as_boolean true) object/1)
{try.#Success actual}
false
@@ -572,14 +572,14 @@
object/1 (test/TestClass1::new (/.as_long (.int expected)))
example/1!
- (and (case (test/TestInterface1::actual1 (/.as_boolean false) object/1)
+ (and (when (test/TestInterface1::actual1 (/.as_boolean false) object/1)
{try.#Success actual}
(n.= expected
(.nat (/.of_long actual)))
{try.#Failure error}
false)
- (case (test/TestInterface1::actual1 (/.as_boolean true) object/1)
+ (when (test/TestInterface1::actual1 (/.as_boolean true) object/1)
{try.#Success actual}
false
@@ -680,7 +680,7 @@
(function (_ lux)
(|> (expansion.single expression)
(meta.result lux)
- (pipe.case
+ (pipe.when
{try.#Success expansion}
true
@@ -720,7 +720,7 @@
(try.else false))
(|> (list (code.local var/2))
(<code>.result type_variable)
- (pipe.case
+ (pipe.when
{try.#Failure error}
(exception.match? /.unknown_type_variable error)
diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux
index a3a036d34..d2d81a6b3 100644
--- a/stdlib/source/test/lux/ffi.lua.lux
+++ b/stdlib/source/test/lux/ffi.lua.lux
@@ -58,7 +58,7 @@
(is (Ex (_ a) (/.Object a))))
true))
(_.coverage [/.import]
- (case (io.run! (..os/getenv string))
+ (when (io.run! (..os/getenv string))
{.#Some _} true
{.#None} true))
diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux
index ce7164514..5feb469ec 100644
--- a/stdlib/source/test/lux/ffi.old.lux
+++ b/stdlib/source/test/lux/ffi.old.lux
@@ -184,14 +184,14 @@
(not (/.null? sample))))
(_.coverage [/.???]
(and (|> (is (Maybe java/lang/Object) (/.??? (/.null)))
- (pipe.case
+ (pipe.when
{.#None}
true
_
false))
(|> (is (Maybe java/lang/Object) (/.??? sample))
- (pipe.case
+ (pipe.when
{.#Some _}
true
@@ -210,10 +210,10 @@
increase random.int]
(all _.and
(_.coverage [/.as]
- (and (case (/.as java/lang/String sample) {.#Some _} true {.#None} false)
- (case (/.as java/lang/Long sample) {.#Some _} false {.#None} true)
- (case (/.as java/lang/Object sample) {.#Some _} true {.#None} false)
- (case (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true)))
+ (and (when (/.as java/lang/String sample) {.#Some _} true {.#None} false)
+ (when (/.as java/lang/Long sample) {.#Some _} false {.#None} true)
+ (when (/.as java/lang/Object sample) {.#Some _} true {.#None} false)
+ (when (/.as java/lang/Object (/.null)) {.#Some _} false {.#None} true)))
(_.coverage [/.synchronized]
(/.synchronized sample true))
(_.coverage [/.class_for /.import]
diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux
index dd2f7d00a..345578ead 100644
--- a/stdlib/source/test/lux/math/logic/fuzzy.lux
+++ b/stdlib/source/test/lux/math/logic/fuzzy.lux
@@ -92,7 +92,7 @@
(random.set r.hash 4)
(at ! each (|>> set.list (list.sorted r.<)))
(random.one (function (_ thresholds)
- (case thresholds
+ (when thresholds
(list threshold_0 threshold_1 threshold_2 threshold_3)
{.#Some [threshold_0 threshold_1 threshold_2 threshold_3]}
@@ -176,7 +176,7 @@
(random.set r.hash 4)
(at ! each (|>> set.list (list.sorted r.<)))
(random.one (function (_ thresholds)
- (case thresholds
+ (when thresholds
(list threshold_0 threshold_1 threshold_2 threshold_3)
{.#Some [threshold_0 threshold_1 threshold_2 threshold_3]}
diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux
index 2e959b428..44610bd3c 100644
--- a/stdlib/source/test/lux/math/modular.lux
+++ b/stdlib/source/test/lux/math/modular.lux
@@ -66,7 +66,7 @@
($codec.spec /.equivalence (/.codec subject::%) (..random subject::%)))
(_.coverage [/.incorrect_modulus]
- (case (|> param
+ (when (|> param
(at (/.codec param::%) encoded)
(at (/.codec subject::%) decoded))
{try.#Failure error}
@@ -98,7 +98,7 @@
(let [one (/.modular (/.modulus subject) +1)
co_prime? (i.co_prime? (//.divisor (/.modulus subject))
(/.value subject))]
- (case (/.inverse subject)
+ (when (/.inverse subject)
{.#Some subject^-1}
(and co_prime?
(|> subject
@@ -118,7 +118,7 @@
adapt
(/.= subject))))))
(_.coverage [/.moduli_are_not_equal]
- (case (/.adapter subject::% param::%)
+ (when (/.adapter subject::% param::%)
{try.#Failure error}
(exception.match? /.moduli_are_not_equal error)
diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux
index c1f61a289..49c406b9b 100644
--- a/stdlib/source/test/lux/math/modulus.lux
+++ b/stdlib/source/test/lux/math/modulus.lux
@@ -23,7 +23,7 @@
(syntax (_ [])
(do meta.monad
[divisor meta.seed]
- (in (list (code.int (case divisor
+ (in (list (code.int (when divisor
0 +1
_ (.int divisor))))))))
@@ -43,14 +43,14 @@
dividend random.int]
(all _.and
(_.coverage [/.modulus /.divisor]
- (case (/.modulus divisor)
+ (when (/.modulus divisor)
{try.#Success modulus}
(i.= divisor (/.divisor modulus))
{try.#Failure error}
(i.= +0 divisor)))
(_.coverage [/.zero_cannot_be_a_modulus]
- (case (/.modulus +0)
+ (when (/.modulus +0)
{try.#Failure error}
(exception.match? /.zero_cannot_be_a_modulus error)
diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux
index d5d9fb557..536448d48 100644
--- a/stdlib/source/test/lux/math/number.lux
+++ b/stdlib/source/test/lux/math/number.lux
@@ -35,7 +35,7 @@
(all _.and
(_.coverage [/.bin]
(`` (and (,, (with_template [<=> <codec> <number>]
- [(case (at <codec> decoded (..clean_commas <number>))
+ [(when (at <codec> decoded (..clean_commas <number>))
{try.#Success actual}
(<=> (/.bin <number>) actual)
@@ -54,7 +54,7 @@
)))))
(_.coverage [/.oct]
(`` (and (,, (with_template [<=> <codec> <number>]
- [(case (at <codec> decoded (..clean_commas <number>))
+ [(when (at <codec> decoded (..clean_commas <number>))
{try.#Success actual}
(<=> (/.oct <number>) actual)
@@ -73,7 +73,7 @@
)))))
(_.coverage [/.hex]
(`` (and (,, (with_template [<=> <codec> <number>]
- [(case (at <codec> decoded (..clean_commas <number>))
+ [(when (at <codec> decoded (..clean_commas <number>))
{try.#Success actual}
(<=> (/.hex <number>) actual)
diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux
index 6b4081342..025c41346 100644
--- a/stdlib/source/test/lux/math/number/i64.lux
+++ b/stdlib/source/test/lux/math/number/i64.lux
@@ -103,7 +103,7 @@
.let [spare (n.- size /.width)]
offset (at ! each (n.% spare) random.nat)]
(_.coverage [/.region]
- (case size
+ (when size
0 (/#= /.false (/.region offset size))
_ (/#= (|> pattern
... NNNNYYYYNNNN
@@ -124,7 +124,7 @@
(_.for [/.Sub]
(do [! random.monad]
[size (at ! each (n.% /.width) random.nat)]
- (case (/.sub size)
+ (when (/.sub size)
{.#None}
(_.coverage [/.sub]
(n.= 0 size))
diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux
index b81cc91c6..74c9a9ca7 100644
--- a/stdlib/source/test/lux/math/number/ratio.lux
+++ b/stdlib/source/test/lux/math/number/ratio.lux
@@ -79,7 +79,7 @@
(maybe.else false))
with_denominator!
- (case (/.nat (/.ratio numerator denominator))
+ (when (/.nat (/.ratio numerator denominator))
{.#Some factor}
(and (n.= 0 (n.% denominator numerator))
(n.= numerator (n.* factor denominator)))
@@ -111,7 +111,7 @@
div (|> right (/.- rem) (/./ left))]
(and (/.= right
(|> div (/.* left) (/.+ rem)))
- (case (/.nat div)
+ (when (/.nat div)
{.#Some _} true
{.#None} false)))))
(do random.monad
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 98081de7f..fa3fd7f7a 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -77,7 +77,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern> true
_ false)]))
@@ -432,7 +432,7 @@
(list [expected_short
{.#Alias [expected_macro_module expected_short]}]))
macro_globals (is (List [Text .Global])
- (case def_type
+ (when def_type
{.#Some def_type}
(list [expected_short
{.#Definition [exported? def_type expected_value]}])
@@ -548,7 +548,7 @@
(list [expected_short
{.#Alias [expected_macro_module expected_short]}]))
macro_globals (is (List [Text .Global])
- (case def_type
+ (when def_type
{.#Some def_type}
(list [expected_short
{.#Definition [exported? def_type expected_value]}])
@@ -846,7 +846,7 @@
(random.set text.hash 5)
(at ! each set.list)
(random.one (function (_ values)
- (case values
+ (when values
(list name_0 name_1 name_2 name_3 name_4)
{.#Some [name_0 name_1 name_2 name_3 name_4]}
@@ -971,7 +971,7 @@
(def (comparison init)
(-> Lux (Comparison Meta))
(function (_ == left right)
- (case [(/.result init left)
+ (when [(/.result init left)
(/.result init right)]
[{try.#Success left} {try.#Success right}]
(== left right)
diff --git a/stdlib/source/test/lux/meta/code.lux b/stdlib/source/test/lux/meta/code.lux
index 80c1bbe65..7e35b1c9f 100644
--- a/stdlib/source/test/lux/meta/code.lux
+++ b/stdlib/source/test/lux/meta/code.lux
@@ -39,7 +39,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
@@ -207,7 +207,7 @@
(text.size source_code))
start (is Source
[location.dummy 0 source_code])]
- (case (parse start)
+ (when (parse start)
{.#Left [end error]}
{try.#Failure error}
@@ -250,7 +250,7 @@
[(do [! random.monad]
[expected <random>]
(_.coverage [<coverage>]
- (and (case (..read (/.format (<coverage> expected)))
+ (and (when (..read (/.format (<coverage> expected)))
{try.#Success actual}
(at /.equivalence =
actual
@@ -276,7 +276,7 @@
[(do [! random.monad]
[expected <random>]
(_.coverage [<coverage>]
- (and (case (..read (/.format (<coverage> expected)))
+ (and (when (..read (/.format (<coverage> expected)))
{try.#Success actual}
(at /.equivalence =
actual
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux
index 4fdb983a1..69e3885f8 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux
@@ -67,7 +67,7 @@
(def !expect
(template (_ <expectation> <computation>)
- [(case <computation>
+ [(when <computation>
<expectation>
true
@@ -91,7 +91,7 @@
(_.coverage [\\parser.result \\parser.any]
(|> (list expected)
(\\parser.result \\parser.any)
- (pipe.case
+ (pipe.when
{try.#Success actual}
(at /.equivalence = expected actual)
@@ -103,7 +103,7 @@
(_.coverage [<query>]
(|> (list (<analysis> expected))
(\\parser.result <query>)
- (pipe.case
+ (pipe.when
{try.#Success actual}
(<=> expected actual)
@@ -131,7 +131,7 @@
(_.coverage [\\parser.tuple]
(|> (list (/.tuple (list (/.bit expected))))
(\\parser.result (\\parser.tuple \\parser.bit))
- (pipe.case
+ (pipe.when
{try.#Success actual}
(bit#= expected actual)
@@ -160,7 +160,7 @@
(_.coverage [\\parser.cannot_parse]
(and (|> (list (/.bit expected))
(\\parser.result \\parser.nat)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -168,7 +168,7 @@
(exception.match? \\parser.cannot_parse error)))
(|> (list)
(\\parser.result \\parser.bit)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -179,7 +179,7 @@
(_.coverage [\\parser.unconsumed_input]
(|> (list (/.bit expected) (/.bit expected))
(\\parser.result \\parser.bit)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -205,7 +205,7 @@
(-> Nat (Random /.Analysis))
(<| random.rec
(function (_ random))
- (let [random|case (all random.and
+ (let [random|when (all random.and
random
(..random_match multiplicity random)
)
@@ -225,7 +225,7 @@
/simple.random
(/complex.random multiplicity random)
/reference.random
- random|case
+ random|when
random|function
random|apply
random|extension
@@ -242,7 +242,7 @@
text (random.lower_case 1)]
(`` (all _.and
(_.coverage [/.unit]
- (case (/.unit)
+ (when (/.unit)
(/.unit)
true
@@ -250,7 +250,7 @@
false))
(,, (with_template [<tag> <expected>]
[(_.coverage [<tag>]
- (case (<tag> <expected>)
+ (when (<tag> <expected>)
(<tag> actual)
(same? <expected> actual)
@@ -277,7 +277,7 @@
(let [expected (if expected_right?
expected_right
expected_left)]
- (case (/.variant [expected_lefts expected_right? expected])
+ (when (/.variant [expected_lefts expected_right? expected])
(/.variant [actual_lefts actual_right? actual])
(and (same? expected_lefts actual_lefts)
(same? expected_right? actual_right?)
@@ -286,7 +286,7 @@
_
false)))
(_.coverage [/.tuple]
- (case (/.tuple (list expected_left expected_right))
+ (when (/.tuple (list expected_left expected_right))
(/.tuple (list actual_left actual_right))
(and (same? expected_left actual_left)
(same? expected_right actual_right))
@@ -304,7 +304,7 @@
(`` (all _.and
(,, (with_template [<tag> <expected>]
[(_.coverage [<tag>]
- (case (<tag> <expected>)
+ (when (<tag> <expected>)
(<tag> actual)
(same? <expected> actual)
@@ -320,7 +320,7 @@
(def tagged?
(template (_ <tag> <it>)
- [(case <it>
+ [(when <it>
{<tag> _}
true
@@ -336,7 +336,7 @@
expected_parameter/1 (..random 2)]
(all _.and
(_.coverage [/.reified /.reification]
- (case (|> [expected_abstraction (list expected_parameter/0 expected_parameter/1)]
+ (when (|> [expected_abstraction (list expected_parameter/0 expected_parameter/1)]
/.reified
/.reification)
[actual_abstraction (list actual_parameter/0 actual_parameter/1)]
@@ -347,7 +347,7 @@
_
false))
(_.coverage [/.no_op]
- (case (/.no_op expected_parameter/0)
+ (when (/.no_op expected_parameter/0)
(/.no_op actual)
(same? expected_parameter/0 actual)
@@ -355,15 +355,15 @@
false))
)))
-(def test|case
+(def test|when
Test
(do random.monad
[expected_input (..random 2)
expected_match (random_match 2 (..random 2))]
(all _.and
- (_.coverage [/.case]
- (case (/.case [expected_input expected_match])
- (/.case [actual_input actual_match])
+ (_.coverage [/.when]
+ (when (/.when [expected_input expected_match])
+ (/.when [actual_input actual_match])
(and (same? expected_input actual_input)
(same? expected_match actual_match))
@@ -405,7 +405,7 @@
(|> (/.failure expected_error)
(phase.result [extension.#bundle extension.empty
extension.#state state/0])
- (pipe.case
+ (pipe.when
{try.#Failure actual_error}
(and (text.contains? expected_error actual_error)
(text.contains? (location.format location/0) actual_error))
@@ -416,7 +416,7 @@
(|> (/.except <exception> [])
(phase.result [extension.#bundle extension.empty
extension.#state state/0])
- (pipe.case
+ (pipe.when
{try.#Failure actual_error}
(and (text.contains? (exception.error <exception> []) actual_error)
(text.contains? (location.format location/0) actual_error))
@@ -428,7 +428,7 @@
(/.with_exception <exception> [])
(phase.result [extension.#bundle extension.empty
extension.#state state/0])
- (pipe.case
+ (pipe.when
{try.#Failure actual_error}
(and (text.contains? expected_error actual_error)
(text.contains? (exception.error <exception> []) actual_error)
@@ -440,7 +440,7 @@
(and (|> (/.assertion <exception> [] false)
(phase.result [extension.#bundle extension.empty
extension.#state state/0])
- (pipe.case
+ (pipe.when
{try.#Failure actual_error}
(and (text.contains? (exception.error <exception> []) actual_error)
(text.contains? (location.format location/0) actual_error))
@@ -450,7 +450,7 @@
(|> (/.assertion <exception> [] true)
(phase.result [extension.#bundle extension.empty
extension.#state state/0])
- (pipe.case
+ (pipe.when
{try.#Success _}
true
@@ -496,7 +496,7 @@
(list.empty? (the .#modules it))
(list.empty? (the .#scopes it))
(list.empty? (the [.#type_context .#var_bindings] it))
- (case (the .#source it)
+ (when (the .#source it)
[location 0 ""]
(same? location.dummy location)
@@ -508,7 +508,7 @@
(extension.read (|>> (the .#current_module) (maybe.else ""))))
(phase.result [extension.#bundle extension.empty
extension.#state state])
- (pipe.case
+ (pipe.when
{try.#Success actual}
(same? expected_module actual)
@@ -535,7 +535,7 @@
(extension.read (the .#location)))
(phase.result [extension.#bundle extension.empty
extension.#state state])
- (pipe.case
+ (pipe.when
{try.#Success actual}
(same? expected actual)
@@ -564,7 +564,7 @@
(extension.read (the .#source)))
(phase.result [extension.#bundle extension.empty
extension.#state state])
- (pipe.case
+ (pipe.when
{try.#Success actual}
(same? expected actual)
@@ -605,7 +605,7 @@
(_.for [/.Reification]
..test|reification)
(_.for [/.Branch /.Branch' /.Match /.Match']
- ..test|case)
+ ..test|when)
(_.for [/.Operation /.Phase /.Handler /.Bundle]
..test|phase)
(_.for [/.State+]
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux
index 7272d6c98..0268893df 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux
@@ -60,11 +60,11 @@
(all random.and
(random.maybe (random#in ..spread))
(do [! random.monad]
- [cases ..random_tag
- cases (random.set n.hash cases ..random_tag)]
- (|> cases
+ [whens ..random_tag
+ whens (random.set n.hash whens ..random_tag)]
+ (|> whens
set.list
- (monad.each ! (function (_ case) (at ! each (|>> [case]) again)))
+ (monad.each ! (function (_ when) (at ! each (|>> [when]) again)))
(at ! each (dictionary.of_list n.hash))))
)
(random.and again again)
@@ -121,7 +121,7 @@
(in [(|> coverages
(list.only (|>> /.exhaustive? not))
list.reversed
- (pipe.case
+ (pipe.when
{.#End}
{/.#Exhaustive}
@@ -140,7 +140,7 @@
(def (failure? exception it)
(All (_ a) (-> (Exception a) (Try /.Coverage) Bit))
- (case it
+ (when it
{try.#Failure error}
(exception.match? exception error)
@@ -212,22 +212,22 @@
.let [random_tag (random#each (n.% expected_maximum) random.nat)]
tag/0 random_tag
tag/1 (random.only (|>> (n.= tag/0) not) random_tag)
- .let [cases (dictionary.of_list n.hash (list [tag/0 expected/0]
+ .let [whens (dictionary.of_list n.hash (list [tag/0 expected/0]
[tag/1 expected/1]))
expected_minimum (++ (n.max tag/0 tag/1))]]
(all _.and
(_.coverage [/.minimum]
- (and (n.= expected_minimum (/.minimum [{.#None} cases]))
- (n.= expected_maximum (/.minimum [{.#Some expected_maximum} cases]))))
+ (and (n.= expected_minimum (/.minimum [{.#None} whens]))
+ (n.= expected_maximum (/.minimum [{.#Some expected_maximum} whens]))))
(_.coverage [/.maximum]
- (and (n.= n#top (/.maximum [{.#None} cases]))
- (n.= expected_maximum (/.maximum [{.#Some expected_maximum} cases]))))
+ (and (n.= n#top (/.maximum [{.#None} whens]))
+ (n.= expected_maximum (/.maximum [{.#Some expected_maximum} whens]))))
))))
(def random_value_pattern
(Random [/.Coverage Pattern])
(random.only (function (_ [coverage pattern])
- (case coverage
+ (when coverage
(^.or {/.#Alt _} {/.#Seq _})
false
@@ -245,7 +245,7 @@
[expected/2 pattern/2] (random.only (all predicate.and
(|>> product.left (/#= expected/0) not)
(|>> product.left (/#= expected/1) not)
- (|>> product.left (pipe.case {/.#Variant _} false _ true)))
+ (|>> product.left (pipe.when {/.#Variant _} false _ true)))
..random_value_pattern)
bit random.bit
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux
index 127af213b..9fa7c48ba 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux
@@ -75,7 +75,7 @@
(def (fails? exception try)
(All (_ e a) (-> (Exception e) (Try a) Bit))
- (case try
+ (when try
{try.#Success _}
false
@@ -239,7 +239,7 @@
[inferT (/.variant lefts right? variant)
[_ [it _]] (|> (/.general archive.empty ..analysis inferT (list term))
//type.inferring)]
- (case inferred
+ (when inferred
{.#Some inferred}
(//type.check
(do check.monad
@@ -339,7 +339,7 @@
[inference (/.record arity record)
[_ [it _]] (|> (/.general archive.empty ..analysis inference terms)
//type.inferring)]
- (case expected
+ (when expected
{.#Some expected}
(//type.check
(do check.monad
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux
index 2d29df1d8..8c93097e9 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/macro.lux
@@ -65,7 +65,7 @@
.let [singular (<| (as Macro)
(is Macro')
(function (_ inputs state)
- (case (list.item choice inputs)
+ (when (list.item choice inputs)
{.#Some it}
{try.#Success [state (list it)]}
@@ -87,7 +87,7 @@
(_.coverage [/.expansion_failed]
(|> (/.expansion ..expander name singular (list))
(meta.result lux)
- (pipe.case
+ (pipe.when
{try.#Failure it}
(and (text.contains? expected_error it)
(text.contains? (the exception.#label /.expansion_failed) it))
@@ -102,7 +102,7 @@
(_.coverage [/.must_have_single_expansion]
(|> (/.single_expansion ..expander name multiple (list mono))
(meta.result lux)
- (pipe.case
+ (pipe.when
{try.#Failure it}
(text.contains? (the exception.#label /.must_have_single_expansion) it)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux
index 4bb9269cf..58a2e03fa 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux
@@ -51,7 +51,7 @@
(list.empty? (the .#module_aliases it))
(list.empty? (the .#definitions it))
(list.empty? (the .#imports it))
- (case (the .#module_state it)
+ (when (the .#module_state it)
{.#Active}
true
@@ -122,7 +122,7 @@
(in it))
(/phase.result state)
(try#each (|>> (the .#module_aliases)
- (pipe.case
+ (pipe.when
(list [actual_alias actual_import])
(and (same? expected_alias actual_alias)
(same? expected_import actual_import))
@@ -166,7 +166,7 @@
[_ (<pre> name)]
(<post> name)))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -184,7 +184,7 @@
(and (,, (with_template [<set>]
[(|> (<set> name)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -225,7 +225,7 @@
[(|> (/.with hash module_name
(/.define def_name <global>))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure _} false))]
@@ -239,7 +239,7 @@
[_ (/.define def_name definition)]
(/.define alias_name alias)))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure _} false)))))
(_.coverage [/.cannot_define_more_than_once]
@@ -249,7 +249,7 @@
[_ (/.define def_name <global>)]
(/.define def_name <global>)))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} false
{try.#Failure _} true))]
@@ -264,7 +264,7 @@
_ (/.define alias_name alias)]
(/.define alias_name alias)))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} false
{try.#Failure _} true)))))
)))
@@ -299,7 +299,7 @@
(monad.each ! (|>> [module_name] <query> /extension.lifted)
(list.partial labels|head labels|tail))))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} <on_success>
{try.#Failure _} (not <on_success>)))]
@@ -315,7 +315,7 @@
_ (/.define def_name {.#Type [public? it {<side> [labels|head labels|tail]}]})]
(/.declare_labels <record?> (list.partial labels|head labels|tail) public? it)))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -332,7 +332,7 @@
_ (/.define def_name {.#Type [public? it {<side> [labels|head labels|tail]}]})]
(/.declare_labels <record?> (list.partial labels|head labels|tail) public? it)))
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux
index 74faec932..a228e3fd3 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/pattern.lux
@@ -56,7 +56,7 @@
(bit#= (at /.equivalence = left right)
(text#= (/.format left) (/.format right))))
(_.coverage [/.unit]
- (case (/.unit)
+ (when (/.unit)
(/.unit)
true
@@ -64,7 +64,7 @@
false))
(,, (with_template [<tag> <value>]
[(_.coverage [<tag>]
- (case (<tag> <value>)
+ (when (<tag> <value>)
(<tag> actual)
(same? <value> actual)
@@ -80,7 +80,7 @@
[/.text expected_text]
))
(_.coverage [/.variant]
- (case (/.variant [expected_lefts expected_right? (/.text expected_text)])
+ (when (/.variant [expected_lefts expected_right? (/.text expected_text)])
(/.variant [actual_lefts actual_right? (/.text actual_text)])
(and (same? expected_lefts actual_lefts)
(same? expected_right? actual_right?)
@@ -89,7 +89,7 @@
_
false))
(_.coverage [/.tuple]
- (case (/.tuple (list (/.bit expected_bit)
+ (when (/.tuple (list (/.bit expected_bit)
(/.nat expected_nat)
(/.int expected_int)
(/.rev expected_rev)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux
index bc2c63519..fe46fa6ae 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/scope.lux
@@ -38,7 +38,7 @@
[(def (<name> expected_type expected_register [actual_type actual_var])
(-> Type Register [Type Variable] Bit)
(and (same? expected_type actual_type)
- (case actual_var
+ (when actual_var
{<tag> actual_register}
(n.= expected_register actual_register)
@@ -66,7 +66,7 @@
/.with
(//phase.result state)
(try#each (|>> product.right
- (pipe.case
+ (pipe.when
{.#None} true
{.#Some _} false)))
(try.else false)))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux
index 8afc7c8fc..c360ea593 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux
@@ -59,7 +59,7 @@
(/module.with 0 module)
(/phase#each product.right)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure _} false))
(|> (/.inference dummy)
@@ -67,7 +67,7 @@
(/module.with 0 module)
(/phase#each product.right)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} false
{try.#Failure _} true))
(|> (/.inference expected)
@@ -75,7 +75,7 @@
(/module.with 0 module)
(/phase#each product.right)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} false
{try.#Failure _} true))))
(_.coverage [/.inferring]
@@ -96,7 +96,7 @@
(/module.with 0 module)
(/phase#each product.right)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure _} false)))
(_.coverage [/.existential /.existential?]
@@ -117,7 +117,7 @@
(/module.with 0 module)
(/phase#each product.right)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure _} false))
(|> (do /phase.monad
@@ -130,7 +130,7 @@
(/module.with 0 module)
(/phase#each product.right)
(/phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success _} false
{try.#Failure _} true))))
))))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux
index 7595b7a87..06fc6be98 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis.lux
@@ -46,7 +46,7 @@
["[1][0]" complex]
["[1][0]" reference]
["[1][0]" function]
- ["[1][0]" case]])
+ ["[1][0]" when]])
(def (eval archive type term)
Eval
@@ -65,7 +65,7 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Any :it:)
- (case it
+ (when it
(//.unit)
true
@@ -88,7 +88,7 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= <type> :it:)
- (case it
+ (when it
(<analysis> it)
(same? <expected> it)
@@ -129,7 +129,7 @@
[it (|> (code.variant (list (code.nat 0) (code.bit false) (` [])))
(/.phase ..expander archive.empty)
(//type.expecting :variant:))]
- (in (case it
+ (in (when it
(//.variant [0 .false (//.unit)])
true
@@ -145,7 +145,7 @@
[it (|> (code.variant (list (code.nat <lefts>) (code.bit <right>) (<code> <expected>)))
(/.phase ..expander archive.empty)
(//type.expecting :variant:))]
- (in (case it
+ (in (when it
(//.variant [<lefts> <right> (<analysis> actual)])
(same? <expected> actual)
@@ -171,7 +171,7 @@
it (|> (code.variant (list (code.nat 0) (code.bit false)))
(/.phase ..expander archive.empty)
(//type.expecting :either:))]
- (in (case it
+ (in (when it
(//.variant [0 .false (//.unit)])
true
@@ -197,7 +197,7 @@
(code.text text/0)))
(/.phase ..expander archive.empty)
(//type.expecting :either:))]
- (in (case it
+ (in (when it
(//.variant [0 #1 (//.tuple (list (//.unit)
(//.bit bit/?)
(//.nat nat/?)
@@ -243,7 +243,7 @@
//type.inferring)]
(in (and (type#= :variant:
:it:)
- (case it
+ (when it
(//.variant [0 .false (//.unit)])
true
@@ -262,7 +262,7 @@
//type.inferring)]
(in (and (type#= :variant:
:it:)
- (case it
+ (when it
(//.variant [<lefts> <right> (<analysis> actual)])
(same? <expected> actual)
@@ -293,7 +293,7 @@
//type.inferring)]
(in (and (type#= :either:
:it:)
- (case it
+ (when it
(//.variant [0 .false (//.unit)])
true
@@ -323,7 +323,7 @@
//type.inferring)]
(in (and (type#= :either:
:it:)
- (case it
+ (when it
(//.variant [0 #1 (//.tuple (list (//.unit)
(//.bit bit/?)
(//.nat nat/?)
@@ -365,7 +365,7 @@
//type.inferring)]
(in (and (type#= (type_literal [.Any .Bit .Nat .Int .Rev .Frac .Text])
:it:)
- (case it
+ (when it
(//.tuple (list (//.unit)
(//.bit bit/?)
(//.nat nat/?)
@@ -408,7 +408,7 @@
//type.inferring)]
(in (and (type#= :record:
:it:)
- (case it
+ (when it
(//.tuple (list (//.unit)
(//.bit bit/?)
(//.nat nat/?)
@@ -443,7 +443,7 @@
//type.inferring)]
(in (and (type#= (All (_ a) (-> a .Nat))
:it:)
- (case it
+ (when it
{//.#Function (list) (//.nat nat/?)}
(same? nat/0 nat/?)
@@ -464,7 +464,7 @@
//type.inferring)]
(in (and (type#= (All (_ a) (-> a (All (_ b) (-> b .Nat))))
:it:)
- (case it
+ (when it
{//.#Function (list) {//.#Function (list) (//.nat nat/?)}}
(same? nat/0 nat/?)
@@ -485,7 +485,7 @@
//type.inferring)]
(in (and (type#= (All (_ a) (-> a (All (_ b) (-> b b))))
:it:)
- (case it
+ (when it
{//.#Function (list) {//.#Function (list) (//.local 1)}}
true
@@ -504,7 +504,7 @@
(, $parameter/0))))
(/.phase ..expander archive.empty)
//type.inferring)]
- (in (and (case it
+ (in (and (when it
{//.#Function (list) {//.#Function (list (//.local 1)) (//.foreign 0)}}
true
@@ -530,7 +530,7 @@
... (, $abstraction/1))))
... (/.phase ..expander archive.empty)
... //type.inferring)]
- ... (in (case it
+ ... (in (when it
... {//.#Function (list) {//.#Function (list) (//.local 0)}}
... true
@@ -548,7 +548,7 @@
... (, $abstraction/0))))
... (/.phase ..expander archive.empty)
... //type.inferring)]
- ... (in (case it
+ ... (in (when it
... {//.#Function (list) {//.#Function (list (//.local 0)) (//.foreign 0)}}
... true
@@ -573,7 +573,7 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Bit :it:)
- (case it
+ (when it
{//.#Apply (//.nat nat/?)
{//.#Function (list) (//.bit bit/?)}}
(and (same? bit/0 bit/?)
@@ -594,7 +594,7 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Nat :it:)
- (case it
+ (when it
{//.#Apply (//.nat nat/?)
{//.#Function (list) (//.local 1)}}
(same? nat/0 nat/?)
@@ -616,7 +616,7 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (check.subsumes? (All (_ a) (-> a Bit)) :it:)
- (case it
+ (when it
{//.#Apply (//.nat nat/?)
{//.#Function (list)
{//.#Function (list) (//.bit bit/?)}}}
@@ -643,7 +643,7 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Text :it:)
- (case it
+ (when it
{//.#Extension "lux text concat" (list (//.text left) (//.text right))}
(and (same? text/0 left)
(same? text/0 right))
@@ -676,8 +676,8 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Frac :it:)
- (case it
- {//.#Case (<analysis> input/?)
+ (when it
+ {//.#When (<analysis> input/?)
[[//.#when (//pattern.bind 0)
//.#then (//.frac frac/?)]
(list)]}
@@ -701,8 +701,8 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Frac :it:)
- (case it
- {//.#Case (<analysis> input/?)
+ (when it
+ {//.#When (<analysis> input/?)
[[//.#when (<pattern> pattern/?)
//.#then (//.frac frac/?)]
(list [//.#when (//pattern.bind 0)
@@ -738,8 +738,8 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Frac :it:)
- (case it
- {//.#Case (//.bit bit/?)
+ (when it
+ {//.#When (//.bit bit/?)
[[//.#when (//pattern.bit .false)
//.#then (//.frac false/?)]
(list [//.#when (//pattern.bit .true)
@@ -769,8 +769,8 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Frac :it:)
- (case it
- {//.#Case (//.variant [<lefts> <right?> (<analysis> analysis/?)])
+ (when it
+ {//.#When (//.variant [<lefts> <right?> (<analysis> analysis/?)])
[[//.#when (//pattern.variant [<lefts> <right?> (<pattern> pattern/?)])
//.#then (//.frac match/?)]
(list [//.#when (//pattern.bind 0)
@@ -808,8 +808,8 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Frac :it:)
- (case it
- {//.#Case (//.tuple (list (//.bit bit/?) (//.nat nat/?)))
+ (when it
+ {//.#When (//.tuple (list (//.bit bit/?) (//.nat nat/?)))
[[//.#when (//pattern.tuple (list (//pattern.bit .false) (//pattern.bind 0)))
//.#then (//.frac false/?)]
(list [//.#when (//pattern.tuple (list (//pattern.bit .true) (//pattern.bind 0)))
@@ -851,8 +851,8 @@
(/.phase ..expander archive.empty)
//type.inferring)]
(in (and (type#= .Frac :it:)
- (case it
- {//.#Case (//.tuple (list (//.unit)
+ (when it
+ {//.#When (//.tuple (list (//.unit)
(//.bit bit/?)
(//.nat nat/?)
(//.int int/?)
@@ -964,5 +964,5 @@
/complex.test
/reference.test
/function.test
- /case.test
+ /when.test
)))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux
index 294251023..6586ac1db 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux
@@ -81,7 +81,7 @@
(def (failure? exception try)
(All (_ e a) (-> (Exception e) (Try a) Bit))
- (case try
+ (when try
{try.#Success _}
false
@@ -105,7 +105,7 @@
(def (analysed? expected actual)
(-> Code Analysis Bit)
- (case [expected actual]
+ (when [expected actual]
[[_ {.#Tuple (list)}] (//analysis.unit)]
true
@@ -150,7 +150,7 @@
(|> (do //phase.monad
[analysis (|> (/.sum ..analysis lefts right? archive.empty code)
(//type.expecting type))]
- (in (case analysis
+ (in (when analysis
(//analysis.variant [lefts' right?' analysis])
(and (n.= lefts lefts')
(bit#= right? right?')
@@ -169,7 +169,7 @@
_ (//type.check (check.check varT variantT))
analysis (|> (/.sum ..analysis lefts right? archive.empty tagC)
(//type.expecting varT))]
- (in (case analysis
+ (in (when analysis
(//analysis.variant [lefts' right?' it])
(and (n.= lefts lefts')
(bit#= right? right?')
@@ -242,7 +242,7 @@
[_ (//module.declare_labels false tags false variantT)
analysis (|> (/.variant ..analysis tag archive.empty tagC)
(//type.expecting variantT))]
- (in (case analysis
+ (in (when analysis
(//analysis.variant [lefts' right?' analysis])
(and (n.= lefts lefts')
(bit#= right? right?')
@@ -260,7 +260,7 @@
[_ (//module.declare_labels false tags false variantT)
[actualT analysis] (|> (/.variant ..analysis tag archive.empty tagC)
//type.inferring)]
- (in (case analysis
+ (in (when analysis
(//analysis.variant [lefts' right?' analysis])
(and (n.= lefts lefts')
(bit#= right? right?')
@@ -307,7 +307,7 @@
[analysis (|> expected
(/.product ..analysis archive.empty)
(//type.expecting type))]
- (in (case analysis
+ (in (when analysis
(//analysis.tuple actual)
(and (n.= (list.size expected)
(list.size actual))
@@ -332,7 +332,7 @@
analysis (|> expected
(/.product ..analysis archive.empty)
(//type.expecting varT))]
- (in (case analysis
+ (in (when analysis
(//analysis.tuple actual)
(and (n.= (list.size expected)
(list.size actual))
@@ -350,7 +350,7 @@
[[:inferred: analysis] (|> expected
(/.product ..analysis archive.empty)
//type.inferring)]
- (in (case analysis
+ (in (when analysis
(//analysis.tuple actual)
(and (n.= (list.size expected)
(list.size actual))
@@ -373,7 +373,7 @@
(/.product ..analysis archive.empty
(list term/0 term/1 term/2 term/2 term/2))))
:inferred: (//type.check (check.clean (list @var) :inferred:))]
- (in (case analysis
+ (in (when analysis
(//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4))))
(and (type#= (Tuple type/0 type/1 type/2 type/2 type/2)
:inferred:)
@@ -393,7 +393,7 @@
[analysis (|> (list term/0 term/1 (code.tuple (list term/2 term/2 term/2)))
(/.product ..analysis archive.empty)
(//type.expecting (Tuple type/0 type/1 type/2 type/2 type/2)))]
- (in (case analysis
+ (in (when analysis
(//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4))))
(and (..analysed? term/0 analysis/0)
(..analysed? term/1 analysis/1)
@@ -465,7 +465,7 @@
head_slot/0 (|> slots/0 list.head maybe.trusted)
head_term/0 (|> types/*,terms/* list.head maybe.trusted product.right)
head_slot/1 (|> slots/1 list.head maybe.trusted)
- slots/01 (case slots/1
+ slots/01 (when slots/1
{.#Item _ tail}
{.#Item head_slot/0 tail}
@@ -481,7 +481,7 @@
(//module.with 0 module)
(//phase#each product.right)
(//phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success {.#Some actual}}
(let [(open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))]
(list#= expected (list.reversed actual)))
@@ -493,7 +493,7 @@
(normal? expected_record local_record)
(|> (/.normal false tuple)
(//phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success {.#None}}
true
@@ -511,7 +511,7 @@
(//module.with 0 module)
(//phase#each (|>> product.right product.right))
(//phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success {.#Some [actual_arity actual_tuple actual_type]}}
(and (n.= arity actual_arity)
(at code.equivalence = (code.tuple tuple) (code.tuple actual_tuple))
@@ -523,7 +523,7 @@
(function (_ pattern_matching?)
(|> (/.order false (list))
(//phase.result state)
- (pipe.case
+ (pipe.when
{try.#Success {.#Some [0 (list) actual_type]}}
(same? .Any actual_type)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux
index 41d0ff3f1..ad9af9331 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/function.lux
@@ -89,7 +89,7 @@
[analysis (|> (/.function ..analysis function/0 argument/0 archive.empty
output_term)
(//type.expecting function_type))]
- (in (case analysis
+ (in (when analysis
{//analysis.#Function it}
(? it)
@@ -108,7 +108,7 @@
[[:actual: analysis] (|> (/.function ..analysis function/0 argument/0 archive.empty
term)
//type.inferring)]
- (in (case analysis
+ (in (when analysis
{//analysis.#Function [actual_env actual_body]}
(type#= :expected: :actual:)
@@ -138,7 +138,7 @@
(function?' (-> input/0 input/1 input/0) (` ([(, $function/1) (, $argument/1)] (, $argument/0)))
(function (_ [outer body])
(and (list.empty? outer)
- (case body
+ (when body
{//analysis.#Function [inner body]}
(n.= 1 (list.size inner))
@@ -147,7 +147,7 @@
(function?' (-> input/0 input/1 input/1) (` ([(, $function/1) (, $argument/1)] (, $argument/1)))
(function (_ [outer body])
(and (list.empty? outer)
- (case body
+ (when body
{//analysis.#Function [inner body]}
(n.= 0 (list.size inner))
@@ -160,7 +160,7 @@
analysis (|> (/.function ..analysis function/0 argument/0 archive.empty
term/0)
(//type.expecting :var:))]
- (in (case analysis
+ (in (when analysis
{//analysis.#Function [actual_env actual_body]}
true
@@ -182,7 +182,7 @@
[analysis (|> (/.function ..analysis function/0 argument/0 archive.empty
term/1)
(//type.expecting (-> input/0 output/0)))]
- (in (case analysis
+ (in (when analysis
{//analysis.#Function [actual_env actual_body]}
true
@@ -217,7 +217,7 @@
(' []))
//type.inferring)]
(in (and (check.subsumes? :expected: :actual:)
- (case analysis
+ (when analysis
{//analysis.#Apply _}
true
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux
index 060f7cbd1..613cfb643 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/reference.lux
@@ -55,7 +55,7 @@
(//phase#each product.right)
(//phase.result state)
(try#each (|>> product.right
- (pipe.case
+ (pipe.when
[actual_type (//analysis.local 0)]
(type#= expected_type actual_type)
@@ -74,7 +74,7 @@
(//phase.result state)
(try#each (|>> product.right
product.right
- (pipe.case
+ (pipe.when
[actual_type (//analysis.foreign 0)]
(type#= expected_type actual_type)
@@ -90,7 +90,7 @@
(//module.with 0 expected_module)
(//phase.result state)
(try#each (|>> product.right
- (pipe.case
+ (pipe.when
[actual_type (//analysis.constant [actual_module actual_name])]
(and (type#= expected_type actual_type)
(same? expected_module actual_module)
@@ -110,7 +110,7 @@
(//module.with 0 expected_module)
(//phase.result state)
(try#each (|>> product.right
- (pipe.case
+ (pipe.when
[actual_type (//analysis.constant [actual_module actual_name])]
(and (type#= expected_type actual_type)
(same? import actual_module)
@@ -131,7 +131,7 @@
(//module.with 0 expected_module)
(//phase.result state)
(try#each (|>> product.right
- (pipe.case
+ (pipe.when
[actual_type (//analysis.constant [actual_module actual_name])]
(and (type#= expected_type actual_type)
(same? import actual_module)
@@ -152,7 +152,7 @@
(//module.with 0 expected_module)
(//phase.result state)
(try#each (|>> product.right
- (pipe.case
+ (pipe.when
[actual_type (//analysis.constant [actual_module actual_name])]
(and (type#= .Type actual_type)
(same? expected_module actual_module)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux
index d4b76212d..f8adedaa1 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/simple.lux
@@ -35,7 +35,7 @@
(/phase#each product.right)
(/phase.result [/extension.#bundle /extension.empty
/extension.#state state])
- (pipe.case
+ (pipe.when
{try.#Success analysis}
(? analysis)
@@ -47,7 +47,7 @@
(/phase#each product.right)
(/phase.result [/extension.#bundle /extension.empty
/extension.#state state])
- (pipe.case
+ (pipe.when
{try.#Failure error}
true
@@ -59,7 +59,7 @@
(/phase#each product.right)
(/phase.result [/extension.#bundle /extension.empty
/extension.#state state])
- (pipe.case
+ (pipe.when
{try.#Success [inferred analysis]}
(and (type#= type inferred)
(? analysis))
@@ -71,7 +71,7 @@
(template (_ <type> <tag>)
[(is (-> <type> Analysis Bit)
(function (_ expected)
- (|>> (pipe.case
+ (|>> (pipe.when
(<tag> actual)
(same? expected actual)
@@ -89,7 +89,7 @@
(`` (all _.and
(_.coverage [/.unit]
(..analysis state module .Any /.unit
- (|>> (pipe.case
+ (|>> (pipe.when
(/analysis.unit)
true
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/when.lux
index 16d10e01a..03b491fa7 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/when.lux
@@ -142,14 +142,14 @@
(exception.otherwise (text.contains? (the exception.#label /.non_tuple))))))
)))
-(def (test|case lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0])
+(def (test|when lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0])
(-> Lux Symbol [Type Code] [Type Code] [Type Code] [Code Code Code] [Type Code] [Type Code] [Bit Nat] Bit)
(let [state [//extension.#bundle (//extension/analysis.bundle ..eval)
//extension.#state lux]
- case? (is (-> Code (List [Code Code]) Bit)
+ when? (is (-> Code (List [Code Code]) Bit)
(function (_ input branches)
(|> (do //phase.monad
- [analysis (|> (/.case ..analysis branches archive.empty input)
+ [analysis (|> (/.when ..analysis branches archive.empty input)
(//type.expecting output/0))]
(in true))
//scope.with
@@ -159,28 +159,28 @@
(try.else false))))
body_types_mismatch!
- (and (not (case? (code.bit bit/0) (list [(` #0) body/1]
+ (and (not (when? (code.bit bit/0) (list [(` #0) body/1]
[(` #1) body/1])))
- (not (case? (code.bit bit/0) (list [(` #0) body/0]
+ (not (when? (code.bit bit/0) (list [(` #0) body/0]
[(` #1) body/1]))))
input_types_mismatch!
- (and (not (case? (code.nat nat/0) (list [(` #0) body/0]
+ (and (not (when? (code.nat nat/0) (list [(` #0) body/0]
[(` #1) body/0])))
- (not (case? (code.bit bit/0) (list [(code.nat nat/0) body/0]
+ (not (when? (code.bit bit/0) (list [(code.nat nat/0) body/0]
[$binding/0 body/0]))))
handles_singletons!
- (and (case? simple/0 (list [(` [(, $binding/0)]) body/0]))
- (case? simple/0 (list [(` [(, simple/0)]) body/0]
+ (and (when? simple/0 (list [(` [(, $binding/0)]) body/0]))
+ (when? simple/0 (list [(` [(, simple/0)]) body/0]
[(` [(, $binding/0)]) body/0]))
- (case? (code.bit bit/0) (list [(` [#0]) body/0]
+ (when? (code.bit bit/0) (list [(` [#0]) body/0]
[(` [#1]) body/0])))
can_infer_body!
(|> (do //phase.monad
[[:actual: analysis] (|> (code.bit bit/0)
- (/.case ..analysis
+ (/.when ..analysis
(list [(` #0) body/0]
[(` #1) body/0])
archive.empty)
@@ -195,7 +195,7 @@
ensures_consistent_bodies!
(|> (do //phase.monad
[[:actual: analysis] (|> (code.bit bit/0)
- (/.case ..analysis
+ (/.when ..analysis
(list [(` #0) body/0]
[(` #1) body/1])
archive.empty)
@@ -212,25 +212,25 @@
can_infer_body!
ensures_consistent_bodies!
- (case? (` [])
+ (when? (` [])
(list [(` []) body/0]))
- (case? (` [])
+ (when? (` [])
(list [$binding/0 body/0]))
- (case? (code.bit bit/0) (list [(` #0) body/0]
+ (when? (code.bit bit/0) (list [(` #0) body/0]
[(` #1) body/0]))
- (case? (code.bit bit/0) (list [(` #1) body/0]
+ (when? (code.bit bit/0) (list [(` #1) body/0]
[(` #0) body/0]))
- (case? simple/0 (list [$binding/0 body/0]))
- (case? simple/0 (list [simple/0 body/0]
+ (when? simple/0 (list [$binding/0 body/0]))
+ (when? simple/0 (list [simple/0 body/0]
[$binding/0 body/0]))
- (case? (` [(, simple/0) (, simple/1) (, simple/2)])
+ (when? (` [(, simple/0) (, simple/1) (, simple/2)])
(list [$binding/0 body/0]))
- (case? (` [(, simple/0) (, simple/1) (, simple/2)])
+ (when? (` [(, simple/0) (, simple/1) (, simple/2)])
(list [(` [(, $binding/0) (, $binding/1)]) body/0]))
- (case? (` [(, simple/0) (, simple/1) (, simple/2)])
+ (when? (` [(, simple/0) (, simple/1) (, simple/2)])
(list [(` [(, simple/0) (, simple/1) (, simple/2)]) body/0]
... 000
[(` [(, $binding/0) (, simple/1) (, simple/2)]) body/0]
@@ -256,7 +256,7 @@
redundant? (is (-> Code (List [Code Code]) Bit)
(function (_ input branches)
(|> (do //phase.monad
- [analysis (|> (/.case ..analysis branches archive.empty input)
+ [analysis (|> (/.when ..analysis branches archive.empty input)
(//type.expecting output/0))]
(in true))
//scope.with
@@ -319,7 +319,7 @@
(function (_ input branches)
(|> (do //phase.monad
[_ (//module.declare_labels false tags/* false :variant:)
- analysis (|> (/.case ..analysis branches archive.empty input)
+ analysis (|> (/.when ..analysis branches archive.empty input)
(//type.expecting output/0))]
(in true))
//scope.with
@@ -390,7 +390,7 @@
(function (_ input branches)
(|> (do //phase.monad
[_ (//module.declare_labels true slots/* false :record:)
- analysis (|> (/.case ..analysis branches archive.empty input)
+ analysis (|> (/.when ..analysis branches archive.empty input)
(//type.expecting output/0))]
(in true))
//scope.with
@@ -517,14 +517,14 @@
bit/0 random.bit
nat/0 random.nat]
(all _.and
- (_.coverage [/.case]
- (and (test|case lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0])
+ (_.coverage [/.when]
+ (and (test|when lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0])
(test|redundancy lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/1] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [bit/0])
(test|variant lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0])
(test|record lux [module/0 name/0] [input/0 simple/0] [input/1 simple/1] [input/2 simple/2] [$binding/0 $binding/1 $binding/2] [output/0 body/0] [output/1 body/1] [bit/0 nat/0])))
(_.coverage [/.empty_branches]
(|> (do //phase.monad
- [analysis (|> (/.case ..analysis (list) archive.empty simple/0)
+ [analysis (|> (/.when ..analysis (list) archive.empty simple/0)
(//type.expecting output/0))]
(in false))
//scope.with
@@ -536,7 +536,7 @@
(let [non_exhaustive? (is (-> (List [Code Code]) Bit)
(function (_ branches)
(|> (do //phase.monad
- [analysis (|> (/.case ..analysis branches archive.empty simple/0)
+ [analysis (|> (/.when ..analysis branches archive.empty simple/0)
(//type.expecting output/0))]
(in false))
//scope.with
@@ -551,7 +551,7 @@
(let [invalid? (is (-> (List [Code Code]) Bit)
(function (_ branches)
(|> (do //phase.monad
- [analysis (|> (/.case ..analysis branches archive.empty simple/0)
+ [analysis (|> (/.when ..analysis branches archive.empty simple/0)
(//type.expecting output/0))]
(in false))
//scope.with
@@ -579,7 +579,7 @@
(|> (do //phase.monad
[_ (//module.declare_labels false tags/* false :variant:)
analysis (|> (` {(, tag/0) (, simple/0)})
- (/.case ..analysis
+ (/.when ..analysis
(list [(` {0 #0 (, $binding/0)}) body/0]
[(` {1 #0 (, $binding/1)}) body/0]
[(` {2 #0 (, $binding/2)}) body/0]
@@ -605,7 +605,7 @@
slot/2 (code.symbol [module/0 slot/2])]
(and (|> (do //phase.monad
[analysis (|> (` (, simple/0))
- (/.case ..analysis
+ (/.when ..analysis
(list [(` {0 #0 (, $binding/0)}) body/0]
[(` {1 #0 (, $binding/1)}) body/0]
[(` {1 #1 (, $binding/2)}) body/0])
@@ -620,7 +620,7 @@
(|> (do //phase.monad
[_ (//module.declare_labels true slots/* false :record:)
analysis (|> (` (, simple/0))
- (/.case ..analysis
+ (/.when ..analysis
(list [(` [(, slot/0) (, $binding/0)
(, slot/1) (, $binding/1)
(, slot/2) (, $binding/2)]) body/0])
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux
index 8daf0cd19..e884cd858 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux
@@ -123,7 +123,7 @@
(/.install extender extension handler/1))
(phase.result [/.#bundle /.empty
/.#state state])
- (pipe.case
+ (pipe.when
{try.#Failure error}
(exception.match? /.cannot_overwrite error)
@@ -135,7 +135,7 @@
[extension (list left right)])
(phase.result [/.#bundle /.empty
/.#state state])
- (pipe.case
+ (pipe.when
{try.#Failure error}
(exception.match? /.unknown error)
@@ -200,7 +200,7 @@
(/.apply archive.empty phase [extension (list)]))
(phase.result [/.#bundle /.empty
/.#state state])
- (pipe.case
+ (pipe.when
{try.#Failure error}
(exception.match? /.incorrect_arity error)
@@ -215,7 +215,7 @@
(/.apply archive.empty phase [extension (list left right)]))
(phase.result [/.#bundle /.empty
/.#state state])
- (pipe.case
+ (pipe.when
{try.#Failure error}
(exception.match? /.invalid_syntax error)
@@ -257,7 +257,7 @@
(/.lifted (phase.lifted {try.#Failure expected_error})))
(phase.result [/.#bundle /.empty
/.#state state])
- (pipe.case
+ (pipe.when
{try.#Failure actual_error}
(same? expected_error actual_error)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
index 5eff1f2b9..f100c1e07 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -41,7 +41,7 @@
(////type.with_type output_type
(_primitive.phase archive.empty (` ((, (code.text procedure)) (,* params))))))
(phase.result _primitive.state)
- (pipe.case
+ (pipe.when
{try.#Success _}
<success>
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux
index 35acd02b6..33b02eaf7 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/function.lux
@@ -56,7 +56,7 @@
(def (n_abstraction arity body)
(-> Arity Analysis Analysis)
(list#mix (function (_ arity_1 body)
- (case arity_1
+ (when arity_1
0 {analysis.#Function (list) body}
_ {analysis.#Function (all list#composite
(list#each (|>> {variable.#Foreign})
@@ -68,7 +68,7 @@
(def !expect
(template (_ <pattern> <value>)
- (case <value>
+ (when <value>
<pattern>
true
@@ -174,7 +174,7 @@
(random.either (..random_variable arity output?)
(..random_constant output?)))
-(def (random_case arity random_value output?)
+(def (random_when arity random_value output?)
(-> Arity Scenario Scenario)
(do [! random.monad]
[bit_test random.bit
@@ -190,7 +190,7 @@
{.#Left lefts})]]
(in [(and loop?_input
loop?_output)
- (synthesis.branch/case [expected_input
+ (synthesis.branch/when [expected_input
(all synthesis.path/alt
(synthesis.path/then expected_output)
(synthesis.path/seq (synthesis.path/bit bit_test)
@@ -217,7 +217,7 @@
(synthesis.path/bind (++ arity))
synthesis.path/pop
(synthesis.path/then expected_output))))])
- {analysis.#Case actual_input
+ {analysis.#When actual_input
[[analysis.#when (analysis.pattern/unit)
analysis.#then actual_output]
(list [analysis.#when (analysis.pattern/bit bit_test)
@@ -252,7 +252,7 @@
(synthesis.branch/let [expected_input
(++ arity)
expected_output])
- {analysis.#Case actual_input
+ {analysis.#When actual_input
[[analysis.#when {analysis.#Bind 2}
analysis.#then actual_output]
(list)]}])))
@@ -271,12 +271,12 @@
expected_then
expected_else])
(if flip?
- {analysis.#Case actual_test
+ {analysis.#When actual_test
[[analysis.#when (analysis.pattern/bit false)
analysis.#then actual_else]
(list [analysis.#when (analysis.pattern/bit true)
analysis.#then actual_then])]}
- {analysis.#Case actual_test
+ {analysis.#When actual_test
[[analysis.#when (analysis.pattern/bit true)
analysis.#then actual_then]
(list [analysis.#when (analysis.pattern/bit false)
@@ -293,7 +293,7 @@
{.#Right lefts}
{.#Left lefts}))
expected_record])
- {analysis.#Case actual_record
+ {analysis.#When actual_record
[[analysis.#when (analysis.pattern/tuple
(list#composite (list.repeated lefts (analysis.pattern/unit))
(if right?
@@ -304,7 +304,7 @@
(def (random_branch arity random_value output?)
(-> Arity Scenario Scenario)
- (random.either (random.either (..random_case arity random_value output?)
+ (random.either (random.either (..random_when arity random_value output?)
(..random_let arity random_value output?))
(random.either (..random_if random_value output?)
(..random_get random_value output?))))
@@ -315,7 +315,7 @@
[resets (random.list arity (random_value false))]
(in [true
(synthesis.loop/again (list#each (|>> product.right product.left) resets))
- (analysis.apply [{analysis.#Reference (case arity
+ (analysis.apply [{analysis.#Reference (when arity
1 (reference.local 0)
_ (reference.foreign 0))}
(list#each (|>> product.right product.right) resets)])])))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux
index d2fa415a0..2fa13fdb7 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/loop.lux
@@ -61,7 +61,7 @@
(in [next
[{variable.#Local (/.register_optimization offset register)}
{variable.#Local register}]]))]
- (case offset
+ (when offset
0 local
_ (all random.either
local
@@ -193,8 +193,8 @@
[[next [inputE inputA]] (..reference offset arity next)
[next [pathE pathA]] (..path offset arity next)]
(in [next
- [(//.branch/case [inputE pathE])
- (//.branch/case [inputA pathA])]])))
+ [(//.branch/when [inputE pathE])
+ (//.branch/when [inputA pathA])]])))
)))
(def (loop offset arity next)
@@ -275,7 +275,7 @@
(random.list arity))
[_ [expected iteration]] (..scenario expected_offset arity 0)]
(_.coverage [/.Transform /.optimization /.register_optimization]
- (case (/.optimization true expected_offset expected_inits
+ (when (/.optimization true expected_offset expected_inits
[//.#environment (|> expected_offset
list.indices
(list#each (|>> {variable.#Local})))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux
index e9d5451ef..a12f284a3 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux
@@ -46,7 +46,7 @@
(def .public (corresponds? analysis synthesis)
(-> Analysis Synthesis Bit)
- (`` (case [analysis synthesis]
+ (`` (when [analysis synthesis]
(,, (with_template [<analysis> <post_analysis> <synthesis> <post_synthesis>]
[[{////analysis.#Primitive {<analysis> expected}}
{////synthesis.#Primitive {<synthesis> actual}}]
@@ -84,7 +84,7 @@
(|> {////analysis.#Primitive {<analysis> expected}}
(//.phase archive.empty)
(phase.result [///bundle.empty ////synthesis.init])
- (pipe.case
+ (pipe.when
{try.#Success {////synthesis.#Primitive {<synthesis> actual}}}
(same? expected actual)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux
index 904f98b43..055f1440a 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux
@@ -50,7 +50,7 @@
(|> (////analysis.variant [lefts right? memberA])
(//.phase archive.empty)
(phase.result [///bundle.empty ////synthesis.init])
- (pipe.case
+ (pipe.when
{try.#Success (////synthesis.variant [leftsS right?S valueS])}
(let [tagS (if right?S (++ leftsS) leftsS)]
(and (n.= tagA tagS)
@@ -69,7 +69,7 @@
(|> (////analysis.tuple membersA)
(//.phase archive.empty)
(phase.result [///bundle.empty ////synthesis.init])
- (pipe.case
+ (pipe.when
{try.#Success (////synthesis.tuple membersS)}
(and (n.= size (list.size membersS))
(list.every? (product.uncurried //primitive.corresponds?)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux
index fe6ec126b..ff011a319 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/variable.lux
@@ -32,7 +32,7 @@
(def !expect
(template (_ <pattern> <value>)
- (case <value>
+ (when <value>
<pattern>
true
@@ -78,12 +78,12 @@
.let [fake_register (n.+ (the #redundants context)
(dictionary.size (the #necessary context)))]
[expected_output actual_output] (scenario (revised #redundants ++ context))]
- (in [(synthesis.branch/case [expected_input
+ (in [(synthesis.branch/when [expected_input
{synthesis.#Seq {synthesis.#Pop}
{synthesis.#Then expected_output}}])
(if let?
(synthesis.branch/let [actual_input fake_register actual_output])
- (synthesis.branch/case [actual_input
+ (synthesis.branch/when [actual_input
{synthesis.#Seq {synthesis.#Bind fake_register}
{synthesis.#Seq {synthesis.#Pop}
{synthesis.#Then actual_output}}}]))]))
@@ -219,14 +219,14 @@
{synthesis.#Alt actual_left actual_right}]))
)))
-(def (case_scenario scenario context)
+(def (when_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do [! random.monad]
[_ (in [])
[expected_input actual_input] (scenario context)
[expected_path actual_path] (..path_scenario scenario context)]
- (in [(synthesis.branch/case [expected_input expected_path])
- (synthesis.branch/case [actual_input actual_path])])))
+ (in [(synthesis.branch/when [expected_input expected_path])
+ (synthesis.branch/when [actual_input actual_path])])))
(def (branch_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
@@ -234,7 +234,7 @@
(..let_scenario scenario context)
(..if_scenario scenario context)
(..get_scenario scenario context)
- (..case_scenario scenario context)
+ (..when_scenario scenario context)
))
(def scope_arity 5)
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/when.lux
index 8df7f087c..65350ce95 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/when.lux
@@ -46,7 +46,7 @@
(do [! random.monad]
[maskedA //primitive.primitive
temp (|> random.nat (at ! each (n.% 100)))
- .let [maskA (analysis.case
+ .let [maskA (analysis.when
[maskedA
[[{analysis.#Bind temp}
{analysis.#Reference (////reference.local temp)}]
@@ -64,7 +64,7 @@
[registerA random.nat
inputA //primitive.primitive
outputA //primitive.primitive
- .let [letA (analysis.case
+ .let [letA (analysis.when
[inputA
[[{analysis.#Bind registerA}
outputA]
@@ -73,7 +73,7 @@
(|> letA
(//.phase archive.empty)
(phase.result [///bundle.empty synthesis.init])
- (pipe.case
+ (pipe.when
{try.#Success (synthesis.branch/let [inputS registerS outputS])}
(and (n.= registerA registerS)
(//primitive.corresponds? inputA inputS)
@@ -96,13 +96,13 @@
[{analysis.#Simple {analysis.#Bit false}}
elseA])
ifA (if then|else
- (analysis.case [inputA [thenB (list elseB)]])
- (analysis.case [inputA [elseB (list thenB)]]))]]
+ (analysis.when [inputA [thenB (list elseB)]])
+ (analysis.when [inputA [elseB (list thenB)]]))]]
(_.coverage [/.synthesize_if]
(|> ifA
(//.phase archive.empty)
(phase.result [///bundle.empty synthesis.init])
- (pipe.case
+ (pipe.when
{try.#Success (synthesis.branch/if [inputS thenS elseS])}
(and (//primitive.corresponds? inputA inputS)
(//primitive.corresponds? thenA thenS)
@@ -132,7 +132,7 @@
(do random.monad
[@member random.nat]
(in [(list#mix (function (_ member inner)
- (case member
+ (when member
{.#Left lefts}
(analysis.pattern/tuple
(list#composite (list.repeated lefts (analysis.pattern/unit))
@@ -155,14 +155,14 @@
(at ! each (|>> analysis.tuple)))
pathA ..random_path
[pattern @member] (get_pattern pathA)
- .let [getA (analysis.case [recordA [[pattern
+ .let [getA (analysis.when [recordA [[pattern
{analysis.#Reference (////reference.local @member)}]
(list)]])]]
(_.coverage [/.synthesize_get]
(|> getA
(//.phase archive.empty)
(phase.result [///bundle.empty synthesis.init])
- (pipe.case
+ (pipe.when
{try.#Success (synthesis.branch/get [pathS recordS])}
(and (at (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS)
(//primitive.corresponds? recordA recordS))
@@ -190,7 +190,7 @@
(|> random_element
(random.set hash 5)
(at random.monad each (|>> set.list
- (pipe.case
+ (pipe.when
(list s0 s1 s2 s3 s4)
[s0 s1 s2 s3 s4]
@@ -325,22 +325,22 @@
..random_tuple
))
-(def random_case
+(def random_when
(all random.either
..random_simple
..random_complex
))
-(def case_test
+(def when_test
Test
(do [! random.monad]
[expected_input (at ! each (|>> .i64 synthesis.i64) random.nat)
- [expected_path match] ..random_case]
- (_.coverage [/.synthesize_case]
- (|> (/.synthesize_case //.phase archive.empty expected_input match)
+ [expected_path match] ..random_when]
+ (_.coverage [/.synthesize_when]
+ (|> (/.synthesize_when //.phase archive.empty expected_input match)
(phase.result [///bundle.empty synthesis.init])
- (pipe.case
- {try.#Success (synthesis.branch/case [actual_input actual_path])}
+ (pipe.when
+ {try.#Success (synthesis.branch/when [actual_input actual_path])}
(and (at synthesis.equivalence = expected_input actual_input)
(at synthesis.path_equivalence = expected_path actual_path))
@@ -356,5 +356,5 @@
..let_test
..if_test
..get_test
- ..case_test
+ ..when_test
)))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux
index d2c6a2a1f..ea75c4274 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux
@@ -77,7 +77,7 @@
[sample code^]
(all _.and
(_.test "Can parse Lux code."
- (case (let [source_code (%.code sample)]
+ (when (let [source_code (%.code sample)]
(/.parse "" (dictionary.empty text.hash) (text.size source_code)
[location.dummy 0 source_code]))
{.#Left error}
@@ -90,13 +90,13 @@
(_.test "Can parse multiple Lux code nodes."
(let [source_code (format (%.code sample) " " (%.code other))
source_code//size (text.size source_code)]
- (case (/.parse "" (dictionary.empty text.hash) source_code//size
+ (when (/.parse "" (dictionary.empty text.hash) source_code//size
[location.dummy 0 source_code])
{.#Left error}
false
{.#Right [remaining =sample]}
- (case (/.parse "" (dictionary.empty text.hash) source_code//size
+ (when (/.parse "" (dictionary.empty text.hash) source_code//size
remaining)
{.#Left error}
false
@@ -126,7 +126,7 @@
comment comment^]
(all _.and
(_.test "Can handle comments."
- (case (let [source_code (format comment (%.code sample))
+ (when (let [source_code (format comment (%.code sample))
source_code//size (text.size source_code)]
(/.parse "" (dictionary.empty text.hash) source_code//size
[location.dummy 0 source_code]))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux
index 151567041..f1c85f69d 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/synthesis.lux
@@ -38,7 +38,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive.lux b/stdlib/source/test/lux/meta/compiler/meta/archive.lux
index 8195a009a..0f1db62b4 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/archive.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/archive.lux
@@ -150,7 +150,7 @@
/.#registry /registry.empty]]
archive (/.has module/0 entry archive)]
(in (and (list.empty? pre)
- (case (/.entries archive)
+ (when (/.entries archive)
(list [module/0' @module/0' entry'])
(and (same? module/0 module/0')
(same? @module/0 @module/0')
diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux b/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux
index 4bd52fa23..3f31abaf7 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/archive/module/document.lux
@@ -52,20 +52,20 @@
(and (|> expected
(/.document key/0)
(/.marked? key/0)
- (pipe.case
+ (pipe.when
{try.#Success it} true
{try.#Failure error} false))
(|> expected
(/.document key/0)
(/.marked? key/1)
- (pipe.case
+ (pipe.when
{try.#Success it} false
{try.#Failure error} true))))
(_.coverage [/.invalid_signature]
(and (|> expected
(/.document key/0)
(/.content key/1)
- (pipe.case
+ (pipe.when
{try.#Success it}
false
@@ -74,7 +74,7 @@
(|> expected
(/.document key/0)
(/.marked? key/1)
- (pipe.case
+ (pipe.when
{try.#Success it}
false
@@ -85,7 +85,7 @@
(/.document key/0)
(binaryF.result (/.format binaryF.nat))
(<binary>.result (/.parser key/0 <binary>.nat))
- (pipe.case
+ (pipe.when
{try.#Success it}
(and (/signature#= signature/0 (/.signature it))
(|> it
diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux
index b7e4e73b3..5cfb94750 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/archive/registry.lux
@@ -31,7 +31,7 @@
(def tagged?
(template (_ <tag> <it>)
- [(case <it>
+ [(when <it>
{<tag> _}
true
@@ -70,7 +70,7 @@
(n.= 0)))
(_.coverage [/.resource]
(let [[@it registry] (/.resource mandatory? expected_dependencies /.empty)]
- (case (sequence.list (/.artifacts registry))
+ (when (sequence.list (/.artifacts registry))
(list [artifact actual_dependencies])
(and (same? @it (the artifact.#id artifact))
(same? mandatory? (the artifact.#mandatory? artifact))
@@ -84,17 +84,17 @@
(let [<expected> <expected>'
<wrong_expected> <wrong_expected>']
(and (let [[@it registry] (<new> <expected> mandatory? expected_dependencies /.empty)]
- (and (case (<query> registry)
+ (and (when (<query> registry)
(list actual_name)
(same? <expected> actual_name)
_
false)
- (case (sequence.list (/.artifacts registry))
+ (when (sequence.list (/.artifacts registry))
(list [artifact actual_dependencies])
(and (same? @it (the artifact.#id artifact))
(same? mandatory? (the artifact.#mandatory? artifact))
- (case (the artifact.#category artifact)
+ (when (the artifact.#category artifact)
{<tag> actual_name}
(same? <expected> actual_name)
@@ -105,7 +105,7 @@
_
false)))
(let [[@it registry] (<wrong_new> <wrong_expected> mandatory? expected_dependencies /.empty)]
- (case (<query> registry)
+ (when (<query> registry)
(list)
true
diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache.lux b/stdlib/source/test/lux/meta/compiler/meta/cache.lux
index fbff46fd2..53e8cd328 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/cache.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/cache.lux
@@ -42,7 +42,7 @@
(and (not pre/0)
(not pre/1)
- (case outcome
+ (when outcome
{try.#Success _} true
{try.#Failure _} false)
diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux
index 29a5f85b5..bf0faa128 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux
@@ -45,11 +45,11 @@
read! (/.cache fs context @module @artifact)]
(unit.coverage [/.path /.cache! /.cache]
(and (not pre)
- (case write!
+ (when write!
{try.#Success _} true
{try.#Failure _} false)
post
- (case read!
+ (when read!
{try.#Success actual} (binary#= expected actual)
{try.#Failure _} false)))))
))))
diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux
index dbfb86c7f..243d395fc 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux
@@ -66,7 +66,7 @@
(and (not pre/0)
(not pre/1)
- (case outcome
+ (when outcome
{try.#Success _} true
{try.#Failure _} false)
@@ -84,7 +84,7 @@
(and (not pre/0)
(not pre/1)
- (case outcome
+ (when outcome
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux
index 25d61d664..2a97eef8a 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux
@@ -133,7 +133,7 @@
(in (and (at set.equivalence =
(set.of_list text.hash pre)
(set.of_list text.hash (list file/0 file/1)))
- (case post
+ (when post
{try.#Failure error}
(exception.match? file.cannot_find_directory error)
diff --git a/stdlib/source/test/lux/meta/compiler/meta/cli.lux b/stdlib/source/test/lux/meta/compiler/meta/cli.lux
index b30db36b6..099f0344d 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/cli.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/cli.lux
@@ -62,7 +62,7 @@
[(_.coverage [<type>]
(|> (list.partial "build" compilation')
(<program>.result /.service)
- (try#each (|>> (pipe.case
+ (try#each (|>> (pipe.when
{/.#Compilation it}
(|> it
(the <slot>)
@@ -85,7 +85,7 @@
(`` (and (,, (with_template [<slot> <?>]
[(|> (list.partial "repl" compilation')
(<program>.result /.service)
- (try#each (|>> (pipe.case
+ (try#each (|>> (pipe.when
{/.#Interpretation it}
(|> it
(the <slot>)
@@ -107,7 +107,7 @@
(`` (and (,, (with_template [<side> <?>]
[(|> (list.partial "export" export)
(<program>.result /.service)
- (try#each (|>> (pipe.case
+ (try#each (|>> (pipe.when
{/.#Export it}
(|> it
<side>
diff --git a/stdlib/source/test/lux/meta/compiler/meta/export.lux b/stdlib/source/test/lux/meta/compiler/meta/export.lux
index 484a411b1..ac3841ecc 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/export.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/export.lux
@@ -80,7 +80,7 @@
(|> it
(try#each (|>> product.left
sequence.list
- (pipe.case
+ (pipe.when
(list {tar.#Normal [actual_path/0 when/0 mode/0 ownership/0 actual_content/0]}
{tar.#Normal [actual_path/1 when/1 mode/1 ownership/1 actual_content/1]})
(with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0))
@@ -103,7 +103,7 @@
(|> it
(try#each (|>> product.right
sequence.list
- (pipe.case
+ (pipe.when
(list {tar.#Normal [actual_path/0 _ _ _ actual_content/0]}
{tar.#Normal [actual_path/1 _ _ _ actual_content/1]})
(with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0))
diff --git a/stdlib/source/test/lux/meta/compiler/phase.lux b/stdlib/source/test/lux/meta/compiler/phase.lux
index b4ace0f20..18cad7805 100644
--- a/stdlib/source/test/lux/meta/compiler/phase.lux
+++ b/stdlib/source/test/lux/meta/compiler/phase.lux
@@ -34,7 +34,7 @@
(def (comparison init)
(All (_ s) (-> s (Comparison (/.Operation s))))
(function (_ == left right)
- (case [(/.result init left)
+ (when [(/.result init left)
(/.result init right)]
[{try.#Success left}
{try.#Success right}]
@@ -55,7 +55,7 @@
(_.coverage [/.failure]
(|> (/.failure expected_error)
(/.result state)
- (pipe.case {try.#Failure actual_error}
+ (pipe.when {try.#Failure actual_error}
(same? expected_error actual_error)
_
@@ -63,7 +63,7 @@
(_.coverage [/.lifted]
(and (|> (/.lifted {try.#Failure expected_error})
(/.result state)
- (pipe.case {try.#Failure actual_error}
+ (pipe.when {try.#Failure actual_error}
(same? expected_error actual_error)
_
@@ -75,7 +75,7 @@
(_.coverage [/.except]
(|> (/.except ..oops [])
(/.result state)
- (pipe.case {try.#Failure error}
+ (pipe.when {try.#Failure error}
(exception.match? ..oops error)
_
@@ -83,14 +83,14 @@
(_.coverage [/.assertion]
(and (|> (/.assertion ..oops [] false)
(/.result state)
- (pipe.case {try.#Failure error}
+ (pipe.when {try.#Failure error}
(exception.match? ..oops error)
_
false))
(|> (/.assertion ..oops [] true)
(/.result state)
- (pipe.case {try.#Success _}
+ (pipe.when {try.#Success _}
true
_
@@ -126,7 +126,7 @@
(at n.hex encoded)
(text#= state/hex)))))
(/.result' state)
- (pipe.case {try.#Success [state' verdict]}
+ (pipe.when {try.#Success [state' verdict]}
(and verdict
(n.= state state'))
@@ -148,7 +148,7 @@
(_.coverage [/.result]
(|> (at /.monad in expected)
(/.result state)
- (pipe.case {try.#Success actual}
+ (pipe.when {try.#Success actual}
(same? expected actual)
_
@@ -156,7 +156,7 @@
(_.coverage [/.result']
(|> (at /.monad in expected)
(/.result' state)
- (pipe.case {try.#Success [state' actual]}
+ (pipe.when {try.#Success [state' actual]}
(and (same? state state')
(same? expected actual))
@@ -187,7 +187,7 @@
(at /.monad in (%.frac input)))))]
(|> (phase archive.empty expected)
(/.result' [state/0 state/1])
- (pipe.case {try.#Success [[state/0' state/1'] actual]}
+ (pipe.when {try.#Success [[state/0' state/1'] actual]}
(and (text#= (%.frac (i.frac expected)) actual)
(same? state/0 state/0')
(same? state/1 state/1'))
diff --git a/stdlib/source/test/lux/meta/compiler/reference.lux b/stdlib/source/test/lux/meta/compiler/reference.lux
index 9cbd38424..139ee891e 100644
--- a/stdlib/source/test/lux/meta/compiler/reference.lux
+++ b/stdlib/source/test/lux/meta/compiler/reference.lux
@@ -52,7 +52,7 @@
(,, (with_template [<tag>]
[(_.coverage [<tag>]
- (case (<tag> expected_register)
+ (when (<tag> expected_register)
(<tag> actual_register)
(n.= expected_register actual_register)
@@ -65,20 +65,20 @@
(_.coverage [/.variable /.self]
(and (at /.equivalence = (/.self) (/.variable (variable.self)))
- (case (/.self)
+ (when (/.self)
(/.self)
true
_
false)
- (case (/.variable (variable.self))
+ (when (/.variable (variable.self))
(/.self)
true
_
false)))
(_.coverage [/.constant]
- (case (/.constant expected_constant)
+ (when (/.constant expected_constant)
(/.constant actual_constant)
(symbol#= expected_constant actual_constant)
diff --git a/stdlib/source/test/lux/meta/compiler/reference/variable.lux b/stdlib/source/test/lux/meta/compiler/reference/variable.lux
index 6cb7c7c10..9fe14eec1 100644
--- a/stdlib/source/test/lux/meta/compiler/reference/variable.lux
+++ b/stdlib/source/test/lux/meta/compiler/reference/variable.lux
@@ -34,7 +34,7 @@
(_.for [/.hash]
($hash.spec /.hash ..random))
(_.coverage [/.self]
- (case (/.self)
+ (when (/.self)
(/.self) true
_ false))
(_.coverage [/.self?]
diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux
index e8ebe4980..8bc88d2d7 100644
--- a/stdlib/source/test/lux/meta/configuration.lux
+++ b/stdlib/source/test/lux/meta/configuration.lux
@@ -30,7 +30,7 @@
(def .public (random amount)
(-> Nat (Random /.Configuration))
- (case amount
+ (when amount
0 (random#in /.empty)
_ (do [! random.monad]
[feature (random.upper_case amount)
@@ -41,7 +41,7 @@
(def failure
(syntax (_ [it <code>.any])
(function (_ lux)
- (case (expansion.complete it lux)
+ (when (expansion.complete it lux)
{try.#Failure error}
{try.#Success [lux (list (code.text error))]}
diff --git a/stdlib/source/test/lux/meta/macro.lux b/stdlib/source/test/lux/meta/macro.lux
index 792ed49eb..29f993f3a 100644
--- a/stdlib/source/test/lux/meta/macro.lux
+++ b/stdlib/source/test/lux/meta/macro.lux
@@ -38,7 +38,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern> true
_ false)]))
@@ -114,7 +114,7 @@
(def iterated
(syntax (_ [cycle <code>.nat
it <code>.any])
- (in (list (case cycle
+ (in (list (when cycle
0 it
_ (` (..iterated (, (code.nat (-- cycle))) (, it))))))))
@@ -164,7 +164,7 @@
<cycles> (static.random code.nat
(random#each (|>> (n.% 5) ++) random.nat))
<actual> (/.final (..iterated <cycles> <expected>))]
- (case (' <actual>)
+ (when (' <actual>)
[_ {.#Nat actual}]
(n.= <expected> actual)
@@ -178,7 +178,7 @@
(random#each (|>> (n.% <max>) ++) random.nat))
<actual> (/.times <cycles> (..iterated <max> <expected>))]
(let [expected_remaining (n.- <cycles> <max>)]
- (case (` <actual>)
+ (when (` <actual>)
(^.` (..iterated (^., [_ {.#Nat actual_remaining}]) (^., [_ {.#Nat actual}])))
(and (n.= expected_remaining actual_remaining)
(n.= <expected> actual))
@@ -191,7 +191,7 @@
(macro (_ tokens)
(loop (again [tokens tokens
output 0])
- (case tokens
+ (when tokens
{.#End}
(at meta.monad in (list (code.nat output)))
diff --git a/stdlib/source/test/lux/meta/macro/local.lux b/stdlib/source/test/lux/meta/macro/local.lux
index eb58f416b..244c8ddd7 100644
--- a/stdlib/source/test/lux/meta/macro/local.lux
+++ b/stdlib/source/test/lux/meta/macro/local.lux
@@ -37,7 +37,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- (case ((expansion.complete macro) compiler)
+ (when ((expansion.complete macro) compiler)
{try.#Failure error}
{try.#Success [compiler (list (code.text error))]}
diff --git a/stdlib/source/test/lux/meta/macro/pattern.lux b/stdlib/source/test/lux/meta/macro/pattern.lux
index 0b443cfd6..362cf42ba 100644
--- a/stdlib/source/test/lux/meta/macro/pattern.lux
+++ b/stdlib/source/test/lux/meta/macro/pattern.lux
@@ -44,7 +44,7 @@
(do [! random.monad]
[sample (at ! each (n.% 5) random.nat)]
(_.coverage [/.with_template]
- (case sample
+ (when sample
(/.with_template [<case>]
[<case> true])
([0] [1] [2] [3] [4])
@@ -52,19 +52,19 @@
_
false)))
(_.coverage [/.or]
- (and (/.case expected_rev
+ (and (/.when expected_rev
(/.or .5 .25) true
_ false)
- (/.case expected_frac
+ (/.when expected_frac
(/.or +0.5 +1.25) true
_ false)
- (/.case expected_text
+ (/.when expected_text
(/.or "+0.5" "+1.25") true
_ false)))
(_.coverage [/.let]
(let [expected_pair (is (Pair Nat Int)
[..#left expected_nat ..#right expected_int])]
- (/.case expected_pair
+ (/.when expected_pair
(/.let actual_pair (!pair actual_left actual_right))
(and (/.same? expected_pair actual_pair)
(/.same? expected_nat actual_left)
@@ -72,7 +72,7 @@
(_.coverage [/.multi]
(let [expected_pair (is (Pair Nat Int)
[..#left expected_nat ..#right expected_int])]
- (and (/.case expected_pair
+ (and (/.when expected_pair
(/.multi (!pair 0 actual_right)
[actual_right
+0])
@@ -80,7 +80,7 @@
_
false)
- (/.case expected_pair
+ (/.when expected_pair
(/.multi (!pair 0 actual_right)
(i.= +0 actual_right))
true
@@ -88,12 +88,12 @@
_
false))))
(_.coverage [/.|>]
- (case expected_frac
+ (when expected_frac
(/.|> actual_frac [(f.* +2.0) (f.* +2.0)])
(f.= (f.* +4.0 expected_frac)
actual_frac)))
(_.coverage [/.`]
- (case (code.text expected_text)
+ (when (code.text expected_text)
(/.` "+0.5") true
(/.` "+1.25") true
_ false))
diff --git a/stdlib/source/test/lux/meta/macro/syntax/check.lux b/stdlib/source/test/lux/meta/macro/syntax/check.lux
index 72a8753f1..aac4bc781 100644
--- a/stdlib/source/test/lux/meta/macro/syntax/check.lux
+++ b/stdlib/source/test/lux/meta/macro/syntax/check.lux
@@ -38,7 +38,7 @@
(do random.monad
[[type value] ..random]
(_.coverage [/.format /.parser]
- (case (<code>.result /.parser
+ (when (<code>.result /.parser
(list (/.format [/.#type type
/.#value value])))
{try.#Failure _}
diff --git a/stdlib/source/test/lux/meta/macro/syntax/declaration.lux b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux
index 9a06513ed..090518338 100644
--- a/stdlib/source/test/lux/meta/macro/syntax/declaration.lux
+++ b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux
@@ -40,7 +40,7 @@
(do random.monad
[expected ..random]
(_.coverage [/.format /.parser]
- (case (<code>.result /.parser
+ (when (<code>.result /.parser
(list (/.format expected)))
{try.#Failure _}
false
diff --git a/stdlib/source/test/lux/meta/macro/syntax/definition.lux b/stdlib/source/test/lux/meta/macro/syntax/definition.lux
index 28aa3653d..929f841d6 100644
--- a/stdlib/source/test/lux/meta/macro/syntax/definition.lux
+++ b/stdlib/source/test/lux/meta/macro/syntax/definition.lux
@@ -68,7 +68,7 @@
untyped_value $////code.random]
(all _.and
(_.coverage [/.format /.parser]
- (case (<code>.result (/.parser compiler)
+ (when (<code>.result (/.parser compiler)
(list (/.format expected)))
{try.#Failure error}
false
@@ -77,7 +77,7 @@
(at /.equivalence = expected actual)))
(_.coverage [/.typed]
(let [expected (has /.#value {.#Left [type untyped_value]} expected)]
- (case (<code>.result (/.typed compiler)
+ (when (<code>.result (/.typed compiler)
(list (/.format expected)))
{try.#Failure error}
false
@@ -86,7 +86,7 @@
(at /.equivalence = expected actual))))
(_.coverage [/.lacks_type]
(let [expected (has /.#value {.#Right untyped_value} expected)]
- (case (<code>.result (/.typed compiler)
+ (when (<code>.result (/.typed compiler)
(list (/.format expected)))
{try.#Failure error}
(exception.match? /.lacks_type error)
diff --git a/stdlib/source/test/lux/meta/macro/syntax/export.lux b/stdlib/source/test/lux/meta/macro/syntax/export.lux
index b8109c5b6..e074f64ae 100644
--- a/stdlib/source/test/lux/meta/macro/syntax/export.lux
+++ b/stdlib/source/test/lux/meta/macro/syntax/export.lux
@@ -32,7 +32,7 @@
(do random.monad
[[expected_export_policy expected_un_exported] ..export]
(_.coverage [/.parser /.default_policy]
- (|> (case expected_export_policy
+ (|> (when expected_export_policy
{.#Some expected_export_policy}
(list expected_export_policy (code.nat expected_un_exported))
diff --git a/stdlib/source/test/lux/meta/macro/syntax/input.lux b/stdlib/source/test/lux/meta/macro/syntax/input.lux
index fffc345da..7f84d403d 100644
--- a/stdlib/source/test/lux/meta/macro/syntax/input.lux
+++ b/stdlib/source/test/lux/meta/macro/syntax/input.lux
@@ -42,7 +42,7 @@
(do random.monad
[expected ..random]
(_.coverage [/.format /.parser]
- (case (<code>.result /.parser (list (/.format (list expected))))
+ (when (<code>.result /.parser (list (/.format (list expected))))
{try.#Failure _}
false
diff --git a/stdlib/source/test/lux/meta/macro/template.lux b/stdlib/source/test/lux/meta/macro/template.lux
index c9edbd035..655c52d73 100644
--- a/stdlib/source/test/lux/meta/macro/template.lux
+++ b/stdlib/source/test/lux/meta/macro/template.lux
@@ -33,7 +33,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- (case ((expansion.complete macro) compiler)
+ (when ((expansion.complete macro) compiler)
{try.#Failure error}
{try.#Success [compiler (list (code.text error))]}
@@ -57,18 +57,18 @@
(list left mid right)
(`` (list (,, (/.spliced [left mid right]))))))
(_.coverage [/.amount]
- (case (/.amount [left mid right])
+ (when (/.amount [left mid right])
3 true
_ false))
(_.coverage [/.text]
- (case (/.text <short>)
+ (when (/.text <short>)
<short>' true
_ false))
(_.coverage [/.symbol]
- (and (case (`` (symbol (,, (/.symbol <short>))))
+ (and (when (`` (symbol (,, (/.symbol <short>))))
["" <short>'] true
_ false)
- (case (`` (symbol (,, (/.symbol <module> <short>))))
+ (when (`` (symbol (,, (/.symbol <module> <short>))))
[<module>' <short>'] true
_ false)
))
diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux
index e030d74ac..a7169d6af 100644
--- a/stdlib/source/test/lux/meta/static.lux
+++ b/stdlib/source/test/lux/meta/static.lux
@@ -32,7 +32,7 @@
(with_expansions [<left> (<random>)
<right> (<random>)
<l+r> (<static> (<+> <left> <right>))]
- (case (' <l+r>)
+ (when (' <l+r>)
[_ {<tag> l+r}]
(<=> l+r (<+> <left> <right>))
@@ -47,7 +47,7 @@
(with_expansions [<left> (/.random_frac)
<right> (/.random_frac)
<l+r> (/.frac (f.+ <left> <right>))]
- (case (' <l+r>)
+ (when (' <l+r>)
[_ {.#Frac l+r}]
(or (f.= l+r (f.+ <left> <right>))
(and (f.not_a_number? l+r)
@@ -61,7 +61,7 @@
(with_expansions [<left> (/.random code.text (random.alpha_numeric 1))
<right> (/.random code.text (random.alpha_numeric 1))
<l+r> (/.text (format <left> <right>))]
- (case (' <l+r>)
+ (when (' <l+r>)
[_ {.#Text l+r}]
(text#= l+r (format <left> <right>))
@@ -78,7 +78,7 @@
(with_expansions [<left> (/.random code.text (random.alpha_numeric 1))
<right> (/.random code.text (random.alpha_numeric 1))
<l+r> (/.literal code.text (format <left> <right>))]
- (case (' <l+r>)
+ (when (' <l+r>)
[_ {.#Text l+r}]
(text#= l+r (format <left> <right>))
diff --git a/stdlib/source/test/lux/meta/target/js.lux b/stdlib/source/test/lux/meta/target/js.lux
index 759e0af3c..9867d5085 100644
--- a/stdlib/source/test/lux/meta/target/js.lux
+++ b/stdlib/source/test/lux/meta/target/js.lux
@@ -80,7 +80,7 @@
(|> /.null
..eval
(try#each (function (_ it)
- (case it
+ (when it
{.#None} true
{.#Some _} false)))
(try.else false)))
@@ -471,7 +471,7 @@
(/.while (/.< (/.int (.int full_inner_iterations)) $inner_index)
(all /.then
(/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index)
- /.break)
+ /.break)
(/.set $output (/.+ $input $output))
(/.set $inner_index (/.+ (/.int +1) $inner_index))
))
@@ -488,7 +488,7 @@
(all /.then
(/.set $inner_index (/.+ (/.int +1) $inner_index))
(/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index)
- /.continue)
+ /.continue)
(/.set $output (/.+ $input $output))
))
(/.return $output)))
@@ -511,9 +511,9 @@
(/.while (/.< (/.int (.int full_inner_iterations)) $inner_index)
(all /.then
(/.when (/.= (/.int (.int expected_outer_iterations)) $outer_index)
- (/.break_at @outer))
+ (/.break_at @outer))
(/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index)
- /.break)
+ /.break)
(/.set $output (/.+ $input $output))
(/.set $inner_index (/.+ (/.int +1) $inner_index))
))
@@ -539,9 +539,9 @@
(all /.then
(/.set $inner_index (/.+ (/.int +1) $inner_index))
(/.when (/.<= (/.int (.int expected_outer_iterations)) $outer_index)
- (/.continue_at @outer))
+ (/.continue_at @outer))
(/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index)
- /.continue)
+ /.continue)
(/.set $output (/.+ $input $output))
))
)
@@ -733,7 +733,7 @@
(/.apply (/.closure (list)
(all /.then
(/.when (/.boolean ???)
- (/.return (/.number number/0)))
+ (/.return (/.number number/0)))
(/.return (/.number number/1))))
(list))))
(_.coverage [/.switch]
@@ -819,7 +819,7 @@
(/.return $arg/0)))
(list))
..eval
- (pipe.case
+ (pipe.when
{try.#Success it}
false
diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux
index 0e0da91da..b7c487680 100644
--- a/stdlib/source/test/lux/meta/target/jvm.lux
+++ b/stdlib/source/test/lux/meta/target/jvm.lux
@@ -125,7 +125,7 @@
(do random.monad
[class_name ..class_name
method_name (random.upper_case 10)]
- (in (case (do try.monad
+ (in (when (do try.monad
[class (/class.class /version.v6_0 /class.public
(/name.internal class_name)
{.#None}
@@ -914,7 +914,7 @@
(binary.result /class.format))
loader (/loader.memory (/loader.new_library []))]]
(_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC"
- (case (do try.monad
+ (when (do try.monad
[_ (/loader.define class_name bytecode loader)
class (io.run! (/loader.load class_name loader))
method (try (get_method static_method class))
@@ -1047,7 +1047,7 @@
.let [type (loop (again [dimensions dimensions
type (is (Type Object)
..$Object)])
- (case dimensions
+ (when dimensions
0 type
_ (again (-- dimensions) (/type.array type))))]]
(<| (_.lifted "MULTIANEWARRAY")
@@ -1351,7 +1351,7 @@
(random.only (|>> (text#= primitive_method_name) not)))
expected (the #random primitive)
.let [$Self (/type.class class_name (list))]]
- (in (case (do try.monad
+ (in (when (do try.monad
[class (/class.class /version.v6_0 /class.public
(/name.internal class_name)
{.#None}
@@ -1371,7 +1371,7 @@
(list)
{.#Some (do /.monad
[_ (/.invokestatic $Self primitive_method_name primitive_method_type)
- _ (case substitute
+ _ (when substitute
{.#None}
(in [])
@@ -1734,7 +1734,7 @@
(binary.result /class.format))
loader (/loader.memory (/loader.new_library []))]]
(_.test "Class & interface inheritance"
- (case (do try.monad
+ (when (do try.monad
[_ (/loader.define abstract_class abstract_bytecode loader)
_ (/loader.define interface_class interface_bytecode loader)
_ (/loader.define concrete_class concrete_bytecode loader)
diff --git a/stdlib/source/test/lux/meta/target/lua.lux b/stdlib/source/test/lux/meta/target/lua.lux
index 9b2cd6642..6d1ba7cb3 100644
--- a/stdlib/source/test/lux/meta/target/lua.lux
+++ b/stdlib/source/test/lux/meta/target/lua.lux
@@ -58,7 +58,7 @@
(|> /.nil
/.code
..load
- (pipe.case
+ (pipe.when
{.#None} true
{.#Some _} false)))
(_.coverage [/.boolean]
@@ -432,7 +432,7 @@
(/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated full_iterations $input)))
(all /.then
(/.when (/.> expected_iterations $index)
- /.break)
+ /.break)
(/.set (list $output) (/.+ $input $output))))
(/.return $output))
(/.closure (list $input))
@@ -446,7 +446,7 @@
(/.while (/.< full_iterations $index)
(all /.then
(/.when (/.= expected_iterations $index)
- /.break)
+ /.break)
(/.set (list $output) (/.+ $input $output))
(/.set (list $index) (/.+ (/.int +1) $index))
))
@@ -460,7 +460,7 @@
(/.repeat (/.= full_iterations $index)
(all /.then
(/.when (/.= expected_iterations $index)
- /.break)
+ /.break)
(/.set (list $output) (/.+ $input $output))
(/.set (list $index) (/.+ (/.int +1) $index))
))
@@ -473,7 +473,7 @@
(/.for_step $index (/.int +0) full_iterations (/.int +1)
(all /.then
(/.when (/.= expected_iterations $index)
- /.break)
+ /.break)
(/.set (list $output) (/.+ $input $output))))
(/.return $output))
(/.closure (list $input))
@@ -660,7 +660,7 @@
(expression (|>> (as Frac) (f.= (if ??? float/0 float/1)))
(|> (all /.then
(/.when (/.boolean ???)
- (/.return (/.float float/0)))
+ (/.return (/.float float/0)))
(/.return (/.float float/1)))
(/.closure (list))
(/.apply (list)))))
diff --git a/stdlib/source/test/lux/meta/target/python.lux b/stdlib/source/test/lux/meta/target/python.lux
index fdc5ef219..b346cb53a 100644
--- a/stdlib/source/test/lux/meta/target/python.lux
+++ b/stdlib/source/test/lux/meta/target/python.lux
@@ -57,7 +57,7 @@
/.code
..eval
(try#each (function (_ it)
- (case it
+ (when it
{.#None} true
{.#Some _} false)))
(try.else false)))
@@ -364,7 +364,7 @@
keyword/0 (keyword 0)
keyword/1 (keyword 1)
keyword_choice (keyword poly_choice)]
- .let [expected/? (case poly_choice
+ .let [expected/? (when poly_choice
0 expected/0
_ expected/1)]
$var (at ! each (|>> %.nat (format "v") /.var) random.nat)
@@ -602,7 +602,7 @@
$ex (at ! each (|>> %.nat (format "ex_") /.var) random.nat)]
(all _.and
(_.coverage [/.raise /.Exception/1]
- (case (try (..statement
+ (when (try (..statement
(function (_ $output)
(all /.then
(/.raise (/.Exception/1 (/.string expected_error)))
@@ -623,7 +623,7 @@
/.#handler (/.set (list $output) (/.float expected))]))))
(as Frac)
(f.= expected))
- (case (try (..statement
+ (when (try (..statement
(function (_ $output)
(/.try (all /.then
(/.raise (/.Exception/1 (/.string expected_error)))
@@ -781,7 +781,7 @@
(/.def $def (list)
(all /.then
(/.when (/.bool test)
- (/.return (/.float then)))
+ (/.return (/.float then)))
(/.return (/.float else))))
(/.set (list $output) (/.apply (list) $def)))))
(as Frac)
diff --git a/stdlib/source/test/lux/meta/target/ruby.lux b/stdlib/source/test/lux/meta/target/ruby.lux
index 37395eeb2..779af9f0b 100644
--- a/stdlib/source/test/lux/meta/target/ruby.lux
+++ b/stdlib/source/test/lux/meta/target/ruby.lux
@@ -53,7 +53,7 @@
(-> /.Expression Bit)
(|>> /.code
..eval
- (try#each (|>> (pipe.case
+ (try#each (|>> (pipe.when
{.#None} true
{.#Some _} false)))
(try.else false)))
@@ -739,7 +739,7 @@
(/.while (/.< (/.int (.int full_inner_iterations)) $inner_index)
(all /.then
(/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index)
- /.break)
+ /.break)
(/.set (list $output) (/.+ $input $output))
(/.set (list $inner_index) (/.+ (/.int +1) $inner_index))
))
@@ -756,7 +756,7 @@
(all /.then
(/.set (list $inner_index) (/.+ (/.int +1) $inner_index))
(/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index)
- /.next)
+ /.next)
(/.set (list $output) (/.+ $input $output))
))
(/.return $output))
@@ -772,7 +772,7 @@
(all /.then
(/.set (list $inner_index) (/.+ (/.int +1) $inner_index))
(/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index)
- /.redo)
+ /.redo)
(/.set (list $output) (/.+ $input $output))
))
(/.return $output))
@@ -981,7 +981,7 @@
(expression (|>> (as Frac) (f.= (if ??? float/0 float/1)))
(|> (all /.then
(/.when (/.bool ???)
- (/.return (/.float float/0)))
+ (/.return (/.float float/0)))
(/.return (/.float float/1)))
[(list)] (/.lambda {.#None})
(/.apply_lambda (list)))))
diff --git a/stdlib/source/test/lux/meta/type.lux b/stdlib/source/test/lux/meta/type.lux
index 226533dd1..3c6872d26 100644
--- a/stdlib/source/test/lux/meta/type.lux
+++ b/stdlib/source/test/lux/meta/type.lux
@@ -45,7 +45,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
@@ -364,7 +364,7 @@
(random#each (|>> {.#Product}) pairG)
(random#each (|>> {.#Function}) pairG)
))]
- (case parameters
+ (when parameters
0 un_parameterized
_ (|> random.nat
(random#each (|>> (n.% parameters) {.#Parameter}))
@@ -385,7 +385,7 @@
($equivalence.spec /.equivalence (..random 0)))
(do [! random.monad]
- [anonymousT (random.only (|>> (pipe.case {.#Named _ _} false
+ [anonymousT (random.only (|>> (pipe.when {.#Named _ _} false
_ true))
(..random 0))
symbol/0 ..symbol
@@ -401,7 +401,7 @@
[size (|> random.nat (at ! each (n.% 3)))
members (|> (..random 0)
(random.only (function (_ type)
- (case type
+ (when type
(^.or {.#Sum _} {.#Product _})
false
@@ -430,7 +430,7 @@
full (/.applied (list Int) partial)]
(in (at /.equivalence = full {.#Product Bit Int}))))
(|> (/.applied (list Bit) Text)
- (pipe.case
+ (pipe.when
{.#None}
true
@@ -441,7 +441,7 @@
members (monad.all ! (list.repeated size (..random 0)))
extra (|> (..random 0)
(random.only (function (_ type)
- (case type
+ (when type
(^.or {.#Function _} {.#Apply _})
false
@@ -462,7 +462,7 @@
[size (|> random.nat (at ! each (|>> (n.% 3) ++)))
body_type (|> (..random 0)
(random.only (function (_ type)
- (case type
+ (when type
(^.or {.#UnivQ _} {.#ExQ _})
false
@@ -488,7 +488,7 @@
[depth (|> random.nat (at ! each (|>> (n.% 3) ++)))
element_type (|> (..random 0)
(random.only (function (_ type)
- (case type
+ (when type
{.#Primitive name (list element_type)}
(not (text#= array.primitive name))
diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux
index f6874ae5f..b6459169f 100644
--- a/stdlib/source/test/lux/meta/type/check.lux
+++ b/stdlib/source/test/lux/meta/type/check.lux
@@ -54,7 +54,7 @@
(random#each (|>> {.#Apply}) pairG)))
random_id (let [random_id (random.either (random#each (|>> {.#Var}) random.nat)
(random#each (|>> {.#Ex}) random.nat))]
- (case num_vars
+ (when num_vars
0 random_id
_ (random.either (random#each (|>> (n.% num_vars) (n.* 2) ++ {.#Parameter}) random.nat)
random_id)))
@@ -74,7 +74,7 @@
(def (valid_type? type)
(-> Type Bit)
- (case type
+ (when type
{.#Primitive name params}
(list.every? valid_type? params)
@@ -100,7 +100,7 @@
(def comparison
(Comparison (All (_ a) (/.Check a)))
(function (_ == left right)
- (case [(/.result /.fresh_context left) (/.result /.fresh_context right)]
+ (when [(/.result /.fresh_context left) (/.result /.fresh_context right)]
[{try.#Success left} {try.#Success right}]
(== left right)
@@ -141,7 +141,7 @@
(do random.monad
[expected (random.upper_case 10)]
(_.coverage [/.failure]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(is (/.Check Any)
(/.failure expected)))
{try.#Success _} false
@@ -149,16 +149,16 @@
(do random.monad
[expected (random.upper_case 10)]
(_.coverage [/.assertion]
- (and (case (/.result /.fresh_context
+ (and (when (/.result /.fresh_context
(is (/.Check Any)
(/.assertion expected true)))
{try.#Success _} true
{try.#Failure actual} false)
- (case (/.result /.fresh_context (/.assertion expected false))
+ (when (/.result /.fresh_context (/.assertion expected false))
{try.#Success _} false
{try.#Failure actual} (same? expected actual)))))
(_.coverage [/.except]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(is (/.Check Any)
(/.except ..yolo [])))
{try.#Success _} false
@@ -168,12 +168,12 @@
(and (|> (/.check <left> <right>)
(is (/.Check Any))
(/.result /.fresh_context)
- (pipe.case {try.#Failure error} (? error)
+ (pipe.when {try.#Failure error} (? error)
{try.#Success _} false))
(|> (/.check <right> <left>)
(is (/.Check Any))
(/.result /.fresh_context)
- (pipe.case {try.#Failure error} (? error)
+ (pipe.when {try.#Failure error} (? error)
{try.#Success _} false)))))]
(all _.and
(_.coverage [/.type_check_failed]
@@ -202,7 +202,7 @@
(<| (_.for [/.Var])
(all _.and
(_.coverage [/.var]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[[var_id var_type] /.var]
(in (//#= var_type {.#Var var_id}))))
@@ -211,7 +211,7 @@
(do random.monad
[nominal (random.upper_case 10)]
(_.coverage [/.bind]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[[var_id var_type] /.var
_ (/.bind {.#Primitive nominal (list)}
@@ -245,7 +245,7 @@
(do random.monad
[nominal (random.upper_case 10)]
(_.coverage [/.cannot_rebind_var]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[[var_id var_type] /.var
_ (/.bind {.#Primitive nominal (list)}
@@ -261,7 +261,7 @@
[nominal (random.upper_case 10)
var_id random.nat]
(_.coverage [/.unknown_type_var]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(/.bind {.#Primitive nominal (list)}
var_id))
{try.#Success _}
@@ -277,7 +277,7 @@
[[var_id var_type] /.var]
(/.peek var_id))
(/.result /.fresh_context)
- (pipe.case {try.#Success {.#None}} true
+ (pipe.when {try.#Success {.#None}} true
_ false))
(|> (do /.monad
[[var_id var/0] /.var
@@ -285,14 +285,14 @@
_ (/.check var/0 var/1)]
(/.peek var_id))
(/.result /.fresh_context)
- (pipe.case {try.#Success {.#None}} true
+ (pipe.when {try.#Success {.#None}} true
_ false))
(|> (do /.monad
[[var_id var_type] /.var
_ (/.bind expected var_id)]
(/.peek var_id))
(/.result /.fresh_context)
- (pipe.case {try.#Success {.#Some actual}}
+ (pipe.when {try.#Success {.#Some actual}}
(same? expected actual)
_
@@ -301,7 +301,7 @@
[nominal (random.upper_case 10)
.let [expected {.#Primitive nominal (list)}]]
(_.coverage [/.read]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[[var_id var_type] /.var
_ (/.bind expected var_id)]
@@ -315,7 +315,7 @@
[nominal (random.upper_case 10)
.let [expected {.#Primitive nominal (list)}]]
(_.coverage [/.unbound_type_var]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[[var_id var_type] /.var]
(/.read var_id)))
@@ -334,13 +334,13 @@
(n.= 0 (the .#ex_counter /.fresh_context))
(list.empty? (the .#var_bindings /.fresh_context))))
(_.coverage [/.context]
- (and (case (/.result /.fresh_context /.context)
+ (and (when (/.result /.fresh_context /.context)
{try.#Success actual}
(same? /.fresh_context actual)
{try.#Failure error}
false)
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[_ /.var]
/.context))
@@ -352,7 +352,7 @@
{try.#Failure error}
false)))
(_.coverage [/.existential]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(do /.monad
[_ /.existential]
/.context))
@@ -368,7 +368,7 @@
(def succeeds?
(All (_ a) (-> (/.Check a) Bit))
(|>> (/.result /.fresh_context)
- (pipe.case {try.#Success _}
+ (pipe.when {try.#Success _}
true
{try.#Failure error}
@@ -457,7 +457,7 @@
(def (verdict check)
(All (_ _) (-> (/.Check _) (/.Check Bit)))
(function (_ context)
- {try.#Success [context (case (check context)
+ {try.#Success [context (when (check context)
{try.#Success _}
true
@@ -889,7 +889,7 @@
(do random.monad
[expected random.nat]
(_.coverage [/.result]
- (case (/.result /.fresh_context
+ (when (/.result /.fresh_context
(at /.monad in expected))
{try.#Success actual} (same? expected actual)
{try.#Failure error} false)))
diff --git a/stdlib/source/test/lux/meta/type/dynamic.lux b/stdlib/source/test/lux/meta/type/dynamic.lux
index 78382883f..d14bbbb19 100644
--- a/stdlib/source/test/lux/meta/type/dynamic.lux
+++ b/stdlib/source/test/lux/meta/type/dynamic.lux
@@ -26,21 +26,21 @@
[expected random.nat]
(all _.and
(_.coverage [/.dynamic /.static]
- (case (/.static Nat (/.dynamic expected))
+ (when (/.static Nat (/.dynamic expected))
{try.#Success actual}
(n.= expected actual)
{try.#Failure _}
false))
(_.coverage [/.wrong_type]
- (case (/.static Text (/.dynamic expected))
+ (when (/.static Text (/.dynamic expected))
{try.#Success actual}
false
{try.#Failure error}
(exception.match? /.wrong_type error)))
(_.coverage [/.format]
- (case (/.format (/.dynamic expected))
+ (when (/.format (/.dynamic expected))
{try.#Success actual}
(text#= (%.nat expected) actual)
diff --git a/stdlib/source/test/lux/meta/type/refinement.lux b/stdlib/source/test/lux/meta/type/refinement.lux
index 845c878fd..2921ff8c2 100644
--- a/stdlib/source/test/lux/meta/type/refinement.lux
+++ b/stdlib/source/test/lux/meta/type/refinement.lux
@@ -40,7 +40,7 @@
(_.for [/.Refiner]
(all _.and
(_.coverage [/.refiner]
- (case (/.refiner predicate raw)
+ (when (/.refiner predicate raw)
{.#Some refined}
(predicate raw)
diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux
index 25c44d81a..33859dd4e 100644
--- a/stdlib/source/test/lux/meta/type/resource.lux
+++ b/stdlib/source/test/lux/meta/type/resource.lux
@@ -164,7 +164,7 @@
[[_ _ exception] (meta.export exception)]
(function (_ compiler)
{.#Right [compiler
- (list (code.bit (case ((expansion.single to_expand) compiler)
+ (list (code.bit (when ((expansion.single to_expand) compiler)
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux
index 999e2f2e1..2182f3197 100644
--- a/stdlib/source/test/lux/meta/version.lux
+++ b/stdlib/source/test/lux/meta/version.lux
@@ -27,7 +27,7 @@
(def failure
(syntax (_ [it <code>.any])
(function (_ lux)
- (case (expansion.complete it lux)
+ (when (expansion.complete it lux)
{try.#Failure error}
{try.#Success [lux (list (code.text error))]}
diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux
index 62ab2204e..a4382595d 100644
--- a/stdlib/source/test/lux/program.lux
+++ b/stdlib/source/test/lux/program.lux
@@ -29,7 +29,7 @@
(def !expect
(template (_ <pattern> <value>)
- [(case <value>
+ [(when <value>
<pattern>
true
@@ -122,7 +122,7 @@
inputs)]
(list#= inputs
(as (List Text) (io.run! outcome))))
- (case (try ((is /.Program
+ (when (try ((is /.Program
(/.program [arg/0 \\parser.any
arg/1 \\parser.any
arg/2 \\parser.any
diff --git a/stdlib/source/test/lux/world/environment.lux b/stdlib/source/test/lux/world/environment.lux
index c2a9ac384..df434f657 100644
--- a/stdlib/source/test/lux/world/environment.lux
+++ b/stdlib/source/test/lux/world/environment.lux
@@ -54,7 +54,7 @@
(do random.monad
[property (random.alphabetic 1)]
(_.coverage [\\parser.unknown_property]
- (case (\\parser.result (\\parser.property property) \\parser.empty)
+ (when (\\parser.result (\\parser.property property) \\parser.empty)
{try.#Success _}
false
@@ -104,7 +104,7 @@
(|> unknown
(at it variable)
io.run!
- (pipe.case {try.#Success _}
+ (pipe.when {try.#Success _}
false
{try.#Failure error}
diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux
index 3eec4fa19..477b09110 100644
--- a/stdlib/source/test/lux/world/file.lux
+++ b/stdlib/source/test/lux/world/file.lux
@@ -41,7 +41,7 @@
(-> (Atom Disk) (-> /.Path (IO Bit)))
(do io.monad
[disk (atom.read! disk)]
- (in (case (dictionary.value @ disk)
+ (in (when (dictionary.value @ disk)
{.#None} false
{.#Some {.#Left _}} true
{.#Some {.#Right _}} false))))
@@ -50,7 +50,7 @@
(-> (Atom Disk) (-> /.Path (IO Bit)))
(do io.monad
[disk (atom.read! disk)]
- (in (case (dictionary.value @ disk)
+ (in (when (dictionary.value @ disk)
{.#None} false
{.#Some {.#Left _}} false
{.#Some {.#Right _}} true))))
@@ -61,7 +61,7 @@
(-> /.Path (IO (Try Any))))
(do [! io.monad]
[disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#Some {.#Right siblings}}
(do !
[_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Right (alert siblings)} disk') disk)]
@@ -75,12 +75,12 @@
(do [! io.monad]
[now instant.now
disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
(^.or {.#None}
{.#Some {.#Left _}})
(do !
[_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [now it]} disk') disk)]
- (case (/.parent fs @)
+ (when (/.parent fs @)
{.#Some parent}
(alert_parent! disk (|>> (list.partial @)) parent)
@@ -94,7 +94,7 @@
(-> (Atom Disk) (-> /.Path (IO (Try Binary))))
(do io.monad
[disk (atom.read! disk)]
- (in (case (dictionary.value @ disk)
+ (in (when (dictionary.value @ disk)
{.#Some {.#Left [_ it]}}
{try.#Success it}
@@ -106,7 +106,7 @@
(-> /.Path (IO (Try Any))))
(do [! io.monad]
[disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#Some {.#Right children}}
(if (list.empty? children)
(do !
@@ -117,7 +117,7 @@
{.#Some {.#Left [_ data]}}
(do !
[_ (atom.compare_and_swap! disk' (dictionary.lacks @ disk') disk)]
- (case (/.parent fs @)
+ (when (/.parent fs @)
{.#Some parent}
(alert_parent! disk (list.only (|>> (text#= @) not)) parent)
@@ -144,7 +144,7 @@
(def (file_size @)
(do [! io.monad]
[disk (atom.read! disk)]
- (in (case (dictionary.value @ disk)
+ (in (when (dictionary.value @ disk)
{.#Some {.#Left [_ it]}}
{try.#Success (binary.size it)}
@@ -153,7 +153,7 @@
(def (last_modified @)
(do [! io.monad]
[disk (atom.read! disk)]
- (in (case (dictionary.value @ disk)
+ (in (when (dictionary.value @ disk)
{.#Some {.#Left [it _]}}
{try.#Success it}
@@ -162,7 +162,7 @@
(def (can_execute? @)
(do [! io.monad]
[disk (atom.read! disk)]
- (in (case (dictionary.value @ disk)
+ (in (when (dictionary.value @ disk)
{.#Some {.#Left _}}
{try.#Success false}
@@ -172,11 +172,11 @@
(def (make_directory @)
(do [! io.monad]
[disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#None}
(do !
[_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Right (list)} disk') disk)]
- (case (/.parent mock @)
+ (when (/.parent mock @)
{.#Some parent}
(alert_parent! disk (|>> (list.partial @)) parent)
@@ -188,7 +188,7 @@
(def (directory_files @)
(do [! io.monad]
[disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#Some {.#Right children}}
(|> children
(monad.only ! (..file? disk))
@@ -199,7 +199,7 @@
(def (sub_directories @)
(do [! io.monad]
[disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#Some {.#Right children}}
(|> children
(monad.only ! (..directory? disk))
@@ -211,7 +211,7 @@
(do [! io.monad]
[now instant.now
disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#None}
(..write mock disk @ it)
@@ -227,7 +227,7 @@
(def (modify @ it)
(do [! io.monad]
[disk' (atom.read! disk)]
- (case (dictionary.value @ disk')
+ (when (dictionary.value @ disk')
{.#Some {.#Left [_ data]}}
(do !
[_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [it data]} disk') disk)]
@@ -258,7 +258,7 @@
[.let [fs (/.mock /)]
? (at fs delete file)]
(unit.coverage [/.cannot_delete]
- (case ?
+ (when ?
{try.#Failure error}
(exception.match? /.cannot_delete error)
@@ -268,7 +268,7 @@
[.let [fs (/.mock /)]
? (at fs read file)]
(unit.coverage [/.cannot_find_file]
- (case ?
+ (when ?
{try.#Failure error}
(exception.match? /.cannot_find_file error)
@@ -279,7 +279,7 @@
?/0 (at fs directory_files file)
?/1 (at fs sub_directories file)]
(unit.coverage [/.cannot_find_directory]
- (case [?/0 ?/1]
+ (when [?/0 ?/1]
[{try.#Failure error/0} {try.#Failure error/1}]
(and (exception.match? /.cannot_find_directory error/0)
(exception.match? /.cannot_find_directory error/1))
diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux
index 73f7755ca..e8ce8182e 100644
--- a/stdlib/source/test/lux/world/file/watch.lux
+++ b/stdlib/source/test/lux/world/file/watch.lux
@@ -77,13 +77,13 @@
[?concern (at watcher concern directory)
?stop (at watcher stop directory)]
(unit.coverage [/.not_being_watched]
- (and (case ?concern
+ (and (when ?concern
{try.#Failure error}
(exception.match? /.not_being_watched error)
{try.#Success _}
false)
- (case ?stop
+ (when ?stop
{try.#Failure error}
(exception.match? /.not_being_watched error)
@@ -106,7 +106,7 @@
(//.make_file async.monad fs (binary.empty 0) expected_path))
poll/pre (at watcher poll [])
poll/post (at watcher poll [])]
- (in (and (case poll/pre
+ (in (and (when poll/pre
(list [concern actual_path])
(and (text#= expected_path actual_path)
(and (/.creation? concern)
@@ -124,7 +124,7 @@
_ (at fs write expected_path data)
poll/2 (at watcher poll [])
poll/2' (at watcher poll [])]
- (in (and (case poll/2
+ (in (and (when poll/2
(list [concern actual_path])
(and (text#= expected_path actual_path)
(and (not (/.creation? concern))
@@ -141,7 +141,7 @@
[_ (at fs delete expected_path)
poll/3 (at watcher poll [])
poll/3' (at watcher poll [])]
- (in (and (case poll/3
+ (in (and (when poll/3
(list [concern actual_path])
(and (not (/.creation? concern))
(not (/.modification? concern))
@@ -193,7 +193,7 @@
(in (do async.monad
[started? (at watcher start /.all directory)]
(unit.coverage [/.cannot_poll_a_non_existent_directory]
- (case started?
+ (when started?
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index 01bd03616..aa8ed3b58 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -37,7 +37,7 @@
(! Bit)))
(do !
[response response]
- (case response
+ (when response
{try.#Success response}
(|> response
product.right
@@ -72,7 +72,7 @@
.let [mock (is (/.Client IO)
(implementation
(def (request method url headers data)
- (io.io (let [value (case method
+ (io.io (let [value (when method
{//.#Post} on_post
{//.#Get} on_get
{//.#Put} on_put
diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux
index 8b3da3a10..ce6b1b984 100644
--- a/stdlib/source/test/lux/world/shell.lux
+++ b/stdlib/source/test/lux/world/shell.lux
@@ -105,7 +105,7 @@
failure (at process fail [])
wrote! (do !
[write (at process write input)]
- (in {try.#Success (case write
+ (in {try.#Success (when write
{try.#Success _}
false
@@ -113,7 +113,7 @@
(text#= input write))}))
destroyed! (do !
[destroy (at process destroy [])]
- (in {try.#Success (case destroy
+ (in {try.#Success (when destroy
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux
index 6e3bbff5b..4ca58afca 100644
--- a/stdlib/source/test/lux/world/time.lux
+++ b/stdlib/source/test/lux/world/time.lux
@@ -76,7 +76,7 @@
(text.prefix <prefix>)
(text.suffix <suffix>)
(at /.codec decoded)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure error} false))
@@ -86,7 +86,7 @@
(text.prefix <prefix>)
(text.suffix <suffix>)
(at /.codec decoded)
- (pipe.case
+ (pipe.when
{try.#Success _}
false
@@ -104,7 +104,7 @@
%.nat
(format "00:00:00.")
(at /.codec decoded)
- (pipe.case
+ (pipe.when
{try.#Success _} true
{try.#Failure error} false)))
))))
@@ -129,7 +129,7 @@
(try#each (at /.equivalence = expected))
(try.else false)))
(_.coverage [/.time_exceeds_a_day]
- (case (/.of_millis out_of_bounds)
+ (when (/.of_millis out_of_bounds)
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/world/time/date.lux b/stdlib/source/test/lux/world/time/date.lux
index e6887f9e0..3dd22343b 100644
--- a/stdlib/source/test/lux/world/time/date.lux
+++ b/stdlib/source/test/lux/world/time/date.lux
@@ -50,7 +50,7 @@
(do random.monad
[expected random.date]
(_.coverage [/.invalid_day]
- (case (/.date (/.year expected)
+ (when (/.date (/.year expected)
(/.month expected)
(n.+ 31 (/.day_of_month expected)))
{try.#Failure error}
@@ -87,7 +87,7 @@
"-" (%.nat month)
"-" (%.nat day))]]
(_.coverage [/.invalid_month]
- (case (<text>.result /.parser input)
+ (when (<text>.result /.parser input)
{try.#Failure error}
(exception.match? /.invalid_month error)
diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux
index f69727234..c6471ffae 100644
--- a/stdlib/source/test/lux/world/time/day.lux
+++ b/stdlib/source/test/lux/world/time/day.lux
@@ -61,7 +61,7 @@
(do random.monad
[not_a_day (random.upper_case 1)]
(_.coverage [/.not_a_day_of_the_week]
- (case (at /.codec decoded not_a_day)
+ (when (at /.codec decoded not_a_day)
{try.#Failure error}
(exception.match? /.not_a_day_of_the_week error)
@@ -74,7 +74,7 @@
(try#each (at /.equivalence = expected))
(try.else false)))
(_.coverage [/.invalid_day]
- (case (/.by_number invalid)
+ (when (/.by_number invalid)
{try.#Failure error}
(exception.match? /.invalid_day error)
diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux
index cebba07ff..32b4c71f3 100644
--- a/stdlib/source/test/lux/world/time/instant.lux
+++ b/stdlib/source/test/lux/world/time/instant.lux
@@ -98,7 +98,7 @@
(apply duration.inverse day#pred 6)
(apply duration.inverse day#pred 7)))))
(_.coverage [/.now]
- (case (try (io.run! /.now))
+ (when (try (io.run! /.now))
{try.#Success _}
true
diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux
index e7b5f09a2..29117b8d3 100644
--- a/stdlib/source/test/lux/world/time/month.lux
+++ b/stdlib/source/test/lux/world/time/month.lux
@@ -65,7 +65,7 @@
(try#each (at /.equivalence = expected))
(try.else false)))
(_.coverage [/.invalid_month]
- (case (/.by_number invalid)
+ (when (/.by_number invalid)
{try.#Failure error}
(exception.match? /.invalid_month error)
@@ -93,7 +93,7 @@
(do random.monad
[not_a_month (random.upper_case 1)]
(_.coverage [/.not_a_month_of_the_year]
- (case (at /.codec decoded not_a_month)
+ (when (at /.codec decoded not_a_month)
{try.#Failure error}
(exception.match? /.not_a_month_of_the_year error)
diff --git a/stdlib/source/test/lux/world/time/year.lux b/stdlib/source/test/lux/world/time/year.lux
index 32c19dccf..ec4638abd 100644
--- a/stdlib/source/test/lux/world/time/year.lux
+++ b/stdlib/source/test/lux/world/time/year.lux
@@ -49,14 +49,14 @@
(all _.and
(_.coverage [/.year]
(bit#= (i.= +0 expected)
- (case (/.year expected)
+ (when (/.year expected)
{try.#Success _}
false
{try.#Failure _}
true)))
(_.coverage [/.value]
- (case (/.year expected)
+ (when (/.year expected)
{try.#Success year}
(i.= expected (/.value year))
@@ -64,7 +64,7 @@
(i.= +0 expected)))
))
(_.coverage [/.there_is_no_year_0]
- (case (/.year +0)
+ (when (/.year +0)
{try.#Success _}
false
diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux
index 0a292ad64..870e9eb4b 100644
--- a/stdlib/source/unsafe/lux/data/collection/array.lux
+++ b/stdlib/source/unsafe/lux/data/collection/array.lux
@@ -287,7 +287,7 @@
output (..empty size)]
(.loop (again [index 0
input input])
- (.case input
+ (.when input
{.#End}
output
@@ -335,7 +335,7 @@
(template (list <default> <array>)
[((.is (.All (_ r w) (.-> (.Maybe r) (..Array' r w) (.List r)))
(.function (list default array)
- (.case default
+ (.when default
{.#Some default}
(,, (..list|+default default array))
@@ -429,7 +429,7 @@
(with_expansions [<again> (again ("lux i64 +" 1 index))]
(.if (..lacks? index it)
<again>
- (.case (? (..item index it))
+ (.when (? (..item index it))
{.#None}
<again>