aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--documentation/book/the_lux_programming_language/chapter_1.md101
-rw-r--r--documentation/book/the_lux_programming_language/introduction.md4
-rw-r--r--documentation/bookmark/floating_point.md1
-rw-r--r--documentation/bookmark/math.md8
-rw-r--r--documentation/bookmark/math/number/dual.md12
-rw-r--r--documentation/bookmark/math/number/real.md (renamed from documentation/bookmark/math/real numbers.md)0
-rw-r--r--documentation/bookmark/memory_management.md (renamed from documentation/bookmark/Memory Management.md)1
-rw-r--r--stdlib/source/library/lux.lux306
-rw-r--r--stdlib/source/library/lux/abstract/apply.lux16
-rw-r--r--stdlib/source/library/lux/abstract/codec.lux10
-rw-r--r--stdlib/source/library/lux/abstract/comonad/cofree.lux2
-rw-r--r--stdlib/source/library/lux/abstract/equivalence.lux1
-rw-r--r--stdlib/source/library/lux/abstract/fold.lux1
-rw-r--r--stdlib/source/library/lux/abstract/functor.lux7
-rw-r--r--stdlib/source/library/lux/abstract/interval.lux41
-rw-r--r--stdlib/source/library/lux/abstract/monad.lux4
-rw-r--r--stdlib/source/library/lux/abstract/monad/indexed.lux27
-rw-r--r--stdlib/source/library/lux/abstract/order.lux7
-rw-r--r--stdlib/source/library/lux/abstract/predicate.lux17
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux91
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux (renamed from stdlib/source/library/lux/control/concurrency/promise.lux)118
-rw-r--r--stdlib/source/library/lux/control/concurrency/frp.lux78
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux34
-rw-r--r--stdlib/source/library/lux/control/concurrency/stm.lux28
-rw-r--r--stdlib/source/library/lux/control/function/mutual.lux16
-rw-r--r--stdlib/source/library/lux/control/parser.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/analysis.lux50
-rw-r--r--stdlib/source/library/lux/control/parser/binary.lux74
-rw-r--r--stdlib/source/library/lux/control/parser/cli.lux3
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux20
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux26
-rw-r--r--stdlib/source/library/lux/control/region.lux4
-rw-r--r--stdlib/source/library/lux/control/remember.lux4
-rw-r--r--stdlib/source/library/lux/control/security/capability.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux54
-rw-r--r--stdlib/source/library/lux/data/color.lux24
-rw-r--r--stdlib/source/library/lux/data/format/css/property.lux138
-rw-r--r--stdlib/source/library/lux/data/format/css/selector.lux60
-rw-r--r--stdlib/source/library/lux/data/format/html.lux121
-rw-r--r--stdlib/source/library/lux/data/format/json.lux34
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux10
-rw-r--r--stdlib/source/library/lux/data/format/xml.lux2
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux2
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux4
-rw-r--r--stdlib/source/library/lux/debug.lux48
-rw-r--r--stdlib/source/library/lux/extension.lux2
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux34
-rw-r--r--stdlib/source/library/lux/ffi.old.lux38
-rw-r--r--stdlib/source/library/lux/macro.lux10
-rw-r--r--stdlib/source/library/lux/macro/local.lux4
-rw-r--r--stdlib/source/library/lux/macro/poly.lux6
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux4
-rw-r--r--stdlib/source/library/lux/macro/syntax/definition.lux10
-rw-r--r--stdlib/source/library/lux/macro/template.lux4
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux48
-rw-r--r--stdlib/source/library/lux/meta.lux36
-rw-r--r--stdlib/source/library/lux/target/common_lisp.lux4
-rw-r--r--stdlib/source/library/lux/target/js.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/name.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/type/lux.lux2
-rw-r--r--stdlib/source/library/lux/target/lua.lux4
-rw-r--r--stdlib/source/library/lux/target/php.lux4
-rw-r--r--stdlib/source/library/lux/target/python.lux6
-rw-r--r--stdlib/source/library/lux/target/r.lux4
-rw-r--r--stdlib/source/library/lux/target/ruby.lux6
-rw-r--r--stdlib/source/library/lux/target/scheme.lux4
-rw-r--r--stdlib/source/library/lux/test.lux126
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux48
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux94
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux80
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux53
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux66
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/context.lux44
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/phase.lux4
-rw-r--r--stdlib/source/library/lux/tool/interpreter.lux234
-rw-r--r--stdlib/source/library/lux/type.lux7
-rw-r--r--stdlib/source/library/lux/type/check.lux6
-rw-r--r--stdlib/source/library/lux/type/dynamic.lux2
-rw-r--r--stdlib/source/library/lux/type/implicit.lux46
-rw-r--r--stdlib/source/library/lux/type/resource.lux16
-rw-r--r--stdlib/source/library/lux/world/console.lux6
-rw-r--r--stdlib/source/library/lux/world/db/jdbc.lux42
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/output.lux6
-rw-r--r--stdlib/source/library/lux/world/file.lux72
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux58
-rw-r--r--stdlib/source/library/lux/world/net/http.lux1
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux12
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux22
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/route.lux10
-rw-r--r--stdlib/source/library/lux/world/program.lux6
-rw-r--r--stdlib/source/library/lux/world/shell.lux50
-rw-r--r--stdlib/source/poly/lux/abstract/equivalence.lux4
-rw-r--r--stdlib/source/poly/lux/abstract/functor.lux2
-rw-r--r--stdlib/source/poly/lux/data/format/json.lux6
-rw-r--r--stdlib/source/program/aedifex.lux20
-rw-r--r--stdlib/source/program/aedifex/action.lux6
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/version.lux8
-rw-r--r--stdlib/source/program/aedifex/artifact/versioning.lux4
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux18
-rw-r--r--stdlib/source/program/aedifex/command/build.lux56
-rw-r--r--stdlib/source/program/aedifex/command/clean.lux8
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux6
-rw-r--r--stdlib/source/program/aedifex/command/deps.lux6
-rw-r--r--stdlib/source/program/aedifex/command/install.lux6
-rw-r--r--stdlib/source/program/aedifex/command/pom.lux6
-rw-r--r--stdlib/source/program/aedifex/command/test.lux8
-rw-r--r--stdlib/source/program/aedifex/command/version.lux4
-rw-r--r--stdlib/source/program/aedifex/dependency/deployment.lux18
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux38
-rw-r--r--stdlib/source/program/aedifex/metadata/artifact.lux28
-rw-r--r--stdlib/source/program/aedifex/metadata/snapshot.lux20
-rw-r--r--stdlib/source/program/aedifex/repository.lux10
-rw-r--r--stdlib/source/program/aedifex/repository/local.lux14
-rw-r--r--stdlib/source/program/compositor.lux42
-rw-r--r--stdlib/source/program/compositor/export.lux12
-rw-r--r--stdlib/source/program/compositor/import.lux12
-rw-r--r--stdlib/source/program/scriptum.lux8
-rw-r--r--stdlib/source/specification/aedifex/repository.lux6
-rw-r--r--stdlib/source/specification/compositor.lux2
-rw-r--r--stdlib/source/specification/compositor/generation/common.lux44
-rw-r--r--stdlib/source/specification/compositor/generation/structure.lux2
-rw-r--r--stdlib/source/specification/lux/world/console.lux8
-rw-r--r--stdlib/source/specification/lux/world/file.lux60
-rw-r--r--stdlib/source/specification/lux/world/program.lux6
-rw-r--r--stdlib/source/specification/lux/world/shell.lux26
-rw-r--r--stdlib/source/test/aedifex/artifact.lux3
-rw-r--r--stdlib/source/test/aedifex/cache.lux10
-rw-r--r--stdlib/source/test/aedifex/cli.lux6
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux16
-rw-r--r--stdlib/source/test/aedifex/command/build.lux12
-rw-r--r--stdlib/source/test/aedifex/command/clean.lux32
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux12
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux4
-rw-r--r--stdlib/source/test/aedifex/command/install.lux22
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux4
-rw-r--r--stdlib/source/test/aedifex/command/test.lux6
-rw-r--r--stdlib/source/test/aedifex/command/version.lux8
-rw-r--r--stdlib/source/test/aedifex/dependency/deployment.lux10
-rw-r--r--stdlib/source/test/aedifex/dependency/resolution.lux12
-rw-r--r--stdlib/source/test/aedifex/input.lux10
-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.lux4
-rw-r--r--stdlib/source/test/aedifex/repository/local.lux4
-rw-r--r--stdlib/source/test/lux.lux117
-rw-r--r--stdlib/source/test/lux/abstract/enum.lux20
-rw-r--r--stdlib/source/test/lux/control.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/actor.lux102
-rw-r--r--stdlib/source/test/lux/control/concurrency/async.lux (renamed from stdlib/source/test/lux/control/concurrency/promise.lux)24
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux80
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux32
-rw-r--r--stdlib/source/test/lux/control/concurrency/stm.lux22
-rw-r--r--stdlib/source/test/lux/control/concurrency/thread.lux12
-rw-r--r--stdlib/source/test/lux/control/io.lux2
-rw-r--r--stdlib/source/test/lux/control/parser.lux6
-rw-r--r--stdlib/source/test/lux/control/parser/binary.lux4
-rw-r--r--stdlib/source/test/lux/control/parser/json.lux4
-rw-r--r--stdlib/source/test/lux/control/region.lux4
-rw-r--r--stdlib/source/test/lux/control/security/capability.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/ordered.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/plist.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux46
-rw-r--r--stdlib/source/test/lux/data/collection/set/multi.lux4
-rw-r--r--stdlib/source/test/lux/data/collection/tree/finger.lux2
-rw-r--r--stdlib/source/test/lux/data/format/json.lux4
-rw-r--r--stdlib/source/test/lux/debug.lux32
-rw-r--r--stdlib/source/test/lux/macro/code.lux4
-rw-r--r--stdlib/source/test/lux/macro/local.lux2
-rw-r--r--stdlib/source/test/lux/meta.lux18
-rw-r--r--stdlib/source/test/lux/test.lux50
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux124
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux28
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux2
-rw-r--r--stdlib/source/test/lux/type/check.lux4
-rw-r--r--stdlib/source/test/lux/type/resource.lux8
-rw-r--r--stdlib/source/test/lux/world/file/watch.lux30
-rw-r--r--stdlib/source/test/lux/world/shell.lux4
213 files changed, 2473 insertions, 2239 deletions
diff --git a/documentation/book/the_lux_programming_language/chapter_1.md b/documentation/book/the_lux_programming_language/chapter_1.md
new file mode 100644
index 000000000..3b3f024f4
--- /dev/null
+++ b/documentation/book/the_lux_programming_language/chapter_1.md
@@ -0,0 +1,101 @@
+# Chapter 1: Getting Started
+
+_Where you will learn how to set up a development environment for Lux._
+
+---
+
+Before any coding can happen, it is necessary to set-up everything you need to become a productive Lux programmer.
+
+## Question #1: How do I write Lux code?
+
+Text editor support is a fundamental thing for any language, and Lux already covers some of that.
+The catch is that there's only support for Emacs at the moment.
+
+The plugin is called [lux-mode](https://github.com/LuxLang/lux/tree/master/lux-mode).
+
+The instructions for how to install it are at the link and it won't take much time.
+
+**Note**: If you've already installed _lux-mode_ before while using a previous version of Lux, you should install it again, as the language has changed a lot between previous versions and v0.6.
+
+## Question #2: How do I build Lux programs?
+
+Lux uses a custom-made build tool named Aedifex which is configured using a declarative Lux-based syntax.
+To install Aedifex, go to https://github.com/LuxLang/lux/tree/master/shell and download either `lux.bat` or `lux.sh` depending on whether you're on Windows or Linux/Mac.
+Also download the `aedifex.jar` file, and place it (along with either of the scripts you downloaded) somewhere in your `PATH`.
+Now, you'll have access to the `lux` command, which allows you to run Aedifex to build and test Lux projects.
+
+## Question #3: How do I use Aedifex?
+
+To find out, let's create a sample project that will have everything we need.
+
+These are the steps:
+
+1. Create a directory called `my_project`.
+1. Create a new project file at `my_project/project.lux`.
+1. Add this to the project file:
+
+```
+{#identity ["my.group" "my_project" "0.1.0-SNAPSHOT"]
+ #repositories ["https://oss.sonatype.org/content/repositories/snapshots/"
+ "https://oss.sonatype.org/service/local/staging/deploy/maven2/"]
+
+ #dependencies [["com.github.luxlang" "stdlib" "0.6.0" "tar"]]
+ #compiler ["com.github.luxlang" "lux-jvm" "0.6.0" "jar"]
+
+ #program "main"}
+
+## By default, Aedifex uses the "source" directory for finding your source-code.
+## The file containing our program will be my_project/source/main.lux.
+
+```
+
+1. Create `my_project/source/main.lux` and add this code to it:
+
+```
+(.module:
+ {#.doc "This will be our program's main module."}
+ [library
+ [lux #*
+ [program (#+ program:)]
+ ["." debug]
+ [control
+ ["." io]]]])
+
+(program: args
+ (io.io (debug.log! "Hello, world!")))
+
+## As you can see, this is nothing more than a very simple "Hello, world!" program to test things out.
+## Everything will be explained later in the rest of the book.
+```
+
+1. In your terminal, go to `my_project`, and execute `lux build`.
+
+When it's done, you should see a message like this:
+
+```
+...
+Compilation complete!
+Duration: +15s26ms
+[BUILD ENDED]
+```
+
+A directory named `target` will have been created, containing everything that was compiled, alongside an executable JAR file.
+
+1. Run the program with this command: `java -jar target/jvm/program.jar`
+1. Smile :)
+
+## Question #4: Where can I find documentation for Lux?
+
+A specially useful source of information is [the documentation for the standard library](https://luxlang.github.io/lux/).
+You can also explore [the Lux repository on GitHub](https://github.com/LuxLang/lux) for more information.
+
+## Question #5: Where do I talk about Lux?
+
+The place to talk about Lux is at [the Lux forum](http://luxlang.freeforums.net/).
+
+---
+
+Now, we can proceed to the actual teaching of the language!
+
+See you in the next chapter!
+
diff --git a/documentation/book/the_lux_programming_language/introduction.md b/documentation/book/the_lux_programming_language/introduction.md
index 11ee6b52a..1f904df2b 100644
--- a/documentation/book/the_lux_programming_language/introduction.md
+++ b/documentation/book/the_lux_programming_language/introduction.md
@@ -29,3 +29,7 @@ It is my hope that within these pages the reader will find both a host of new id
I wish you, my dear reader, good luck on this journey, and much fun!
+---
+
+Click here to [read](../chapter_1.md) the 1st chapter.
+
diff --git a/documentation/bookmark/floating_point.md b/documentation/bookmark/floating_point.md
index 56cbc3eb9..5e212c08f 100644
--- a/documentation/bookmark/floating_point.md
+++ b/documentation/bookmark/floating_point.md
@@ -8,6 +8,7 @@
# Correctness
+1. [Floating point expression inspector](https://github.com/graphitemaster/fpinspect)
1. [Herbie: Find and fix floating-point problems.](https://herbie.uwplse.org/)
# Format
diff --git a/documentation/bookmark/math.md b/documentation/bookmark/math.md
index 333fd6591..e7e3deec0 100644
--- a/documentation/bookmark/math.md
+++ b/documentation/bookmark/math.md
@@ -58,7 +58,6 @@
# Number Theory
1. https://twitter.com/johncarlosbaez/status/1184492139897507840
-1. https://en.wikipedia.org/wiki/Dual_number
1. https://en.wikipedia.org/wiki/Division_algebra
1. [Division algebras](https://www.youtube.com/watch?v=3BZyds_KFWM&list=PLNxhIPHaOTRZMO1VjJcs7_3dgyJ2qU1yZ)
1. https://www.quantamagazine.org/the-octonion-math-that-could-underpin-physics-20180720
@@ -72,10 +71,8 @@
# Quaternions
1. [Maths - Quaternions](http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm)
-1. [Dual Quaternions for Mere Mortals](https://www.jeremyong.com/math/2019/08/05/dual-quaternions-for-mere-mortals/)
1. [Stepping into a New Dimension: Using Quaternions to See the Invisible](https://medium.com/@vieyrasoftware/stepping-into-a-new-dimension-using-quaternions-to-see-the-invisible-478087c9ebbf)
1. [How Quaternions Produce 3D Rotation](https://penguinmaths.blogspot.com/2019/06/how-quaternions-produce-3d-rotation.html)
-1. [APPLICATION OF DUAL QUATERNIONS ON SELECTED PROBLEMS](https://otik.uk.zcu.cz/bitstream/11025/28563/1/phd_Application%20of%20dual%20quaternions%20on%20selected%20problems.pdf)
1. https://www.3dgep.com/understanding-quaternions/
1. https://probablydance.com/2017/08/05/intuitive-quaternions/
1. [Quaternion algebras](https://math.dartmouth.edu/~jvoight/quat.html)
@@ -182,7 +179,6 @@
1. [Siggraph2019 Geometric Algebra](https://www.youtube.com/watch?v=tX4H_ctggYo)
1. [Dr Leo Dorst' Keynote talk at CGI2020](https://www.youtube.com/watch?v=T7xVTBpHMjA)
-1. [GAME2020 0. Steven De Keninck. Dual Quaternions Demystified](https://www.youtube.com/watch?v=ichOiuBoBoQ)
1. [GAME2020 - 1. Dr. Leo Dorst. Get Real!](https://www.youtube.com/watch?v=0fF2xToQmgs)
1. [GAME2020 3. Professor Anthony Lasenby. A new language for physics.](https://www.youtube.com/watch?v=x7eLEtmq6PY)
1. [HestenesJMM2019](https://www.youtube.com/watch?v=zsQQ7djCg_Y)
@@ -366,10 +362,6 @@
1. [Intuitive Guide to Hyperbolic Functions](https://betterexplained.com/articles/hyperbolic-functions/)
1. [Hyperbolic Functions and Non-Hyperbolic Claims](https://elliptigon.com/hyperbolic-functions-explained/)
-# Dual numbers
-
-1. [The Dual Numbers](https://www.youtube.com/watch?v=4nU-09e3iP8)
-
# **Temp Cache**
1. https://mathlets.org/mathlets/
diff --git a/documentation/bookmark/math/number/dual.md b/documentation/bookmark/math/number/dual.md
new file mode 100644
index 000000000..508adae9a
--- /dev/null
+++ b/documentation/bookmark/math/number/dual.md
@@ -0,0 +1,12 @@
+# Reference
+
+1. [Ditching Backpropagation: Automatic Differentiation and Dual Numbers](https://matiasmorant.wordpress.com/2017/12/29/dual-numbers/)
+1. [The Dual Numbers](https://www.youtube.com/watch?v=4nU-09e3iP8)
+1. [Dual number](https://en.wikipedia.org/wiki/Dual_number)
+
+# Dual Quaternions
+
+1. [Dual Quaternions for Mere Mortals](https://www.jeremyong.com/math/2019/08/05/dual-quaternions-for-mere-mortals/)
+1. [APPLICATION OF DUAL QUATERNIONS ON SELECTED PROBLEMS](https://otik.uk.zcu.cz/bitstream/11025/28563/1/phd_Application%20of%20dual%20quaternions%20on%20selected%20problems.pdf)
+1. [GAME2020 0. Steven De Keninck. Dual Quaternions Demystified](https://www.youtube.com/watch?v=ichOiuBoBoQ)
+
diff --git a/documentation/bookmark/math/real numbers.md b/documentation/bookmark/math/number/real.md
index 2daa1873b..2daa1873b 100644
--- a/documentation/bookmark/math/real numbers.md
+++ b/documentation/bookmark/math/number/real.md
diff --git a/documentation/bookmark/Memory Management.md b/documentation/bookmark/memory_management.md
index 8905c6b20..8a5a1c0a9 100644
--- a/documentation/bookmark/Memory Management.md
+++ b/documentation/bookmark/memory_management.md
@@ -12,6 +12,7 @@
# Reference counting
+1. [Perceus: Garbage Free Reference Counting with Reuse (Extended version)](https://www.microsoft.com/en-us/research/publication/perceus-garbage-free-reference-counting-with-reuse/)
1. [Introducing --gc:arc](https://forum.nim-lang.org/t/5734)
1. [Counting Immutable Beans: Reference Counting Optimized for Purely Functional Programming](https://arxiv.org/abs/1908.05647)
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index eb2676ee3..4ed6dd7aa 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -749,7 +749,7 @@
(record$ #Nil)
#0)
-("lux def" fail
+("lux def" failure
("lux type check"
(#UnivQ #Nil
(#Function Text
@@ -771,7 +771,7 @@
#Nil))
_
- (fail "Wrong syntax for let''")}
+ (failure "Wrong syntax for let''")}
tokens)))
(record$ #.Nil)
#0)
@@ -808,7 +808,7 @@
#Nil))
_
- (fail "Wrong syntax for function''")}
+ (failure "Wrong syntax for function''")}
tokens)))
(record$ #.Nil)
#0)
@@ -916,7 +916,7 @@
#Nil]))
_
- (fail "Wrong syntax for def''")}
+ (failure "Wrong syntax for def''")}
tokens)))
(record$ #.Nil)
#0)
@@ -949,7 +949,7 @@
#Nil))
_
- (fail "Wrong syntax for macro:'")}
+ (failure "Wrong syntax for macro:'")}
tokens)))
(record$ #.Nil)
#0)
@@ -976,7 +976,7 @@
#Nil))
_
- (fail "Wrong syntax for $'")}
+ (failure "Wrong syntax for $'")}
tokens))
(def:'' (list\map f xs)
@@ -1102,7 +1102,7 @@
(quantified_args_parser args' (function'' [names] (next (#Cons arg_name names))))
_
- (fail "Expected identifier.")}
+ (failure "Expected identifier.")}
args))
(def:'' (make_parameter idx)
@@ -1173,7 +1173,7 @@
#Nil)))))
_
- (fail "Wrong syntax for All")}
+ (failure "Wrong syntax for All")}
tokens)))
(macro:' #export (Ex tokens)
@@ -1217,7 +1217,7 @@
#Nil)))))
_
- (fail "Wrong syntax for Ex")}
+ (failure "Wrong syntax for Ex")}
tokens)))
(def:'' (list\reverse list)
@@ -1244,7 +1244,7 @@
#Nil))
_
- (fail "Wrong syntax for ->")}
+ (failure "Wrong syntax for ->")}
(list\reverse tokens)))
(macro:' #export (list xs)
@@ -1277,7 +1277,7 @@
init)))
_
- (fail "Wrong syntax for list&")}
+ (failure "Wrong syntax for list&")}
(list\reverse xs)))
(macro:' #export (& tokens)
@@ -1327,7 +1327,7 @@
tokens)
({(#Cons [[_ (#Tuple args)] (#Cons [body #Nil])])
({#Nil
- (fail "function' requires a non-empty arguments tuple.")
+ (failure "function' requires a non-empty arguments tuple.")
(#Cons [harg targs])
(return (list (form$ (list (tuple$ (list (local_identifier$ name)
@@ -1341,7 +1341,7 @@
args)
_
- (fail "Wrong syntax for function'")}
+ (failure "Wrong syntax for function'")}
tokens')))
(macro:' (def:''' tokens)
@@ -1397,7 +1397,7 @@
(bit$ #0)))))
_
- (fail "Wrong syntax for def:'''")}
+ (failure "Wrong syntax for def:'''")}
tokens))
(def:''' (as_pairs xs)
@@ -1422,7 +1422,7 @@
(list\reverse (as_pairs bindings)))))
_
- (fail "Wrong syntax for let'")}
+ (failure "Wrong syntax for let'")}
tokens))
(def:''' (any? p xs)
@@ -1496,11 +1496,11 @@
(return (list (list\fold (function/flip (_$_joiner op)) first nexts)))
_
- (fail "Wrong syntax for _$")}
+ (failure "Wrong syntax for _$")}
tokens')
_
- (fail "Wrong syntax for _$")}
+ (failure "Wrong syntax for _$")}
tokens))
(macro:' #export ($_ tokens)
@@ -1518,11 +1518,11 @@
(return (list (list\fold (_$_joiner op) last prevs)))
_
- (fail "Wrong syntax for $_")}
+ (failure "Wrong syntax for $_")}
(list\reverse tokens'))
_
- (fail "Wrong syntax for $_")}
+ (failure "Wrong syntax for $_")}
tokens))
## (interface: (Monad m)
@@ -1593,7 +1593,7 @@
monad)))))
_
- (fail "Wrong syntax for do")}
+ (failure "Wrong syntax for do")}
tokens))
(def:''' (monad\map m f xs)
@@ -1648,7 +1648,7 @@
test))))
_
- (fail "Wrong syntax for if")}
+ (failure "Wrong syntax for if")}
tokens))
(def:''' (get k plist)
@@ -1899,7 +1899,7 @@
(return (list (form$ (list (tag$ ["library/lux" "Primitive"]) (text$ class_name) (untemplate_list params)))))
_
- (fail "Wrong syntax for primitive")}
+ (failure "Wrong syntax for primitive")}
tokens))
(def:'' (current_module_name state)
@@ -1932,7 +1932,7 @@
=template)))))
_
- (fail "Wrong syntax for `")}
+ (failure "Wrong syntax for `")}
tokens))
(macro:' #export (`' tokens)
@@ -1946,7 +1946,7 @@
(wrap (list (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) =template)))))
_
- (fail "Wrong syntax for `")}
+ (failure "Wrong syntax for `")}
tokens))
(macro:' #export (' tokens)
@@ -1960,7 +1960,7 @@
(wrap (list (form$ (list (text$ "lux type check") (identifier$ ["library/lux" "Code"]) =template)))))
_
- (fail "Wrong syntax for '")}
+ (failure "Wrong syntax for '")}
tokens))
(macro:' #export (|> tokens)
@@ -1986,7 +1986,7 @@
apps)))
_
- (fail "Wrong syntax for |>")}
+ (failure "Wrong syntax for |>")}
tokens))
(macro:' #export (<| tokens)
@@ -2012,7 +2012,7 @@
apps)))
_
- (fail "Wrong syntax for <|")}
+ (failure "Wrong syntax for <|")}
(list\reverse tokens)))
(def:''' (compose f g)
@@ -2156,15 +2156,15 @@
(list\map (compose apply (make_env bindings')))
list\join
return)
- (fail "Irregular arguments tuples for template.")))
+ (failure "Irregular arguments tuples for template.")))
_
- (fail "Wrong syntax for template")}
+ (failure "Wrong syntax for template")}
[(monad\map maybe_monad get_short bindings)
(monad\map maybe_monad tuple_to_list data)])
_
- (fail "Wrong syntax for template")}
+ (failure "Wrong syntax for template")}
tokens))
(def:''' (n// param subject)
@@ -2439,7 +2439,7 @@
(return [key val''])
_
- (fail "The value-part of a KV-pair in a record must macro-expand to a single Code.")}
+ (failure "The value-part of a KV-pair in a record must macro-expand to a single Code.")}
val'))))
pairs)]
(wrap (list (record$ pairs'))))
@@ -2488,11 +2488,11 @@
(wrap (list (walk_type type')))
_
- (fail "The expansion of the type-syntax had to yield a single element.")}
+ (failure "The expansion of the type-syntax had to yield a single element.")}
type+))
_
- (fail "Wrong syntax for type")}
+ (failure "Wrong syntax for type")}
tokens))
(macro:' #export (: tokens)
@@ -2504,7 +2504,7 @@
(return (list (` ("lux type check" (type (~ type)) (~ value)))))
_
- (fail "Wrong syntax for :")}
+ (failure "Wrong syntax for :")}
tokens))
(macro:' #export (:as tokens)
@@ -2516,7 +2516,7 @@
(return (list (` ("lux type as" (type (~ type)) (~ value)))))
_
- (fail "Wrong syntax for :as")}
+ (failure "Wrong syntax for :as")}
tokens))
(def:''' (empty? xs)
@@ -2547,7 +2547,7 @@
(return [member_name member_type])
_
- (fail "Wrong syntax for variant case.")}
+ (failure "Wrong syntax for variant case.")}
pair)))
pairs)]
(return [(` (& (~+ (list\map second members))))
@@ -2579,14 +2579,14 @@
(return [member_name (` (& (~+ member_types)))])
_
- (fail "Wrong syntax for variant case.")}
+ (failure "Wrong syntax for variant case.")}
case)))
(list& case cases))]
(return [(` (| (~+ (list\map second members))))
(#Some (list\map first members))]))
_
- (fail "Improper type-definition syntax")}
+ (failure "Improper type-definition syntax")}
type_codes))
(def:''' (gensym prefix state)
@@ -2617,7 +2617,7 @@
(return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body')))))))
_
- (fail "Wrong syntax for Rec")}
+ (failure "Wrong syntax for Rec")}
tokens))
(macro:' #export (exec tokens)
@@ -2638,7 +2638,7 @@
actions))))
_
- (fail "Wrong syntax for exec")}
+ (failure "Wrong syntax for exec")}
(list\reverse tokens)))
(macro:' (def:' tokens)
@@ -2684,7 +2684,7 @@
(~ (bit$ export?)))))))
#None
- (fail "Wrong syntax for def'")}
+ (failure "Wrong syntax for def'")}
parts)))
(def:' (rejoin_pair pair)
@@ -2775,11 +2775,11 @@
(do meta_monad [] (wrap (list)))
_
- (fail ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
- (list\map code\encode)
- (interpose " ")
- list\reverse
- (list\fold text\compose ""))))}
+ (failure ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
+ (list\map code\encode)
+ (interpose " ")
+ list\reverse
+ (list\fold text\compose ""))))}
branches))
(macro:' #export (case tokens)
@@ -2798,7 +2798,7 @@
(wrap (list (` ((~ (record$ (as_pairs expansion))) (~ value))))))
_
- (fail "Wrong syntax for case")}
+ (failure "Wrong syntax for case")}
tokens))
(macro:' #export (^ tokens)
@@ -2821,10 +2821,10 @@
(wrap (list& pattern' body branches))
_
- (fail "^ can only expand to 1 pattern.")))
+ (failure "^ can only expand to 1 pattern.")))
_
- (fail "Wrong syntax for ^ macro")))
+ (failure "Wrong syntax for ^ macro")))
(macro:' #export (^or tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2845,7 +2845,7 @@
(^ (list& [_ (#Form patterns)] body branches))
(case patterns
#Nil
- (fail "^or cannot have 0 patterns")
+ (failure "^or cannot have 0 patterns")
_
(let' [pairs (|> patterns
@@ -2853,7 +2853,7 @@
(list\join))]
(return (list\compose pairs branches))))
_
- (fail "Wrong syntax for ^or")))
+ (failure "Wrong syntax for ^or")))
(def:' (identifier? code)
(-> Code Bit)
@@ -2885,10 +2885,10 @@
body)
list
return)
- (fail "let requires an even number of parts"))
+ (failure "let requires an even number of parts"))
_
- (fail "Wrong syntax for let")))
+ (failure "Wrong syntax for let")))
(macro:' #export (function tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2920,7 +2920,7 @@
(list\fold (nest g!blank) body (list\reverse tail))))))
#None
- (fail "Wrong syntax for function")))
+ (failure "Wrong syntax for function")))
(def:' (process_def_meta_value code)
(-> Code Code)
@@ -3069,7 +3069,7 @@
(~ (bit$ exported?)))))))
#None
- (fail "Wrong syntax for def:"))))
+ (failure "Wrong syntax for def:"))))
(def: (meta_code_add addition meta)
(-> [Code Code] Code Code)
@@ -3101,7 +3101,7 @@
" ([#Identifier] [#Tag])"
__paragraph
" _" ..\n
- " (fail ''Wrong syntax for name_of'')))"))])
+ " (failure ''Wrong syntax for name_of'')))"))])
(let [[exported? tokens] (export^ tokens)
name+args+meta+body?? (: (Maybe [Name (List Code) (List [Code Code]) Code])
(case tokens
@@ -3137,7 +3137,7 @@
(~ (bit$ exported?)))))))
#None
- (fail "Wrong syntax for macro:"))))
+ (failure "Wrong syntax for macro:"))))
(macro: #export (interface: tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -3184,7 +3184,7 @@
(wrap [name type])
_
- (fail "Signatures require typed members!"))))
+ (failure "Signatures require typed members!"))))
(list\join sigs')))
#let [[_module _name] name+
def_name (identifier$ name)
@@ -3203,7 +3203,7 @@
(return (list (` (..type: (~+ (export exported?)) (~ usage) (~ sig_meta) (~ sig_type))))))
#None
- (fail "Wrong syntax for interface:"))))
+ (failure "Wrong syntax for interface:"))))
(def: (find f xs)
(All [a b]
@@ -3231,7 +3231,7 @@
init)))
_
- (fail <message>)))]
+ (failure <message>)))]
[and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses." "Short-circuiting 'and': (and #1 #0 #1) ## => #0"]
[or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses." "Short-circuiting 'or': (or #1 #0 #1) ## => #1"])
@@ -3444,7 +3444,7 @@
(return output)
_
- (fail (text\compose "Unknown tag: " (name\encode [module name]))))))
+ (failure (text\compose "Unknown tag: " (name\encode [module name]))))))
(def: (resolve_type_tags type)
(-> Type (Meta (Maybe [(List Name) (List Type)])))
@@ -3503,7 +3503,7 @@
(return tags)
_
- (fail "No tags available for type.")))
+ (failure "No tags available for type.")))
#let [tag_mappings (: (List [Text Code])
(list\map (function (_ tag) [(second tag) (tag$ tag)])
tags))]
@@ -3517,10 +3517,10 @@
(wrap [tag value])
_
- (fail (text\compose "Unknown implementation member: " tag_name)))
+ (failure (text\compose "Unknown implementation member: " tag_name)))
_
- (fail "Invalid implementation member."))))
+ (failure "Invalid implementation member."))))
(list\join tokens'))]
(wrap (list (record$ members)))))
@@ -3583,7 +3583,7 @@
(implementation (~+ definitions)))))))
#None
- (fail "Wrong syntax for implementation:"))))
+ (failure "Wrong syntax for implementation:"))))
(def: (function\identity x) (All [a] (-> a a)) x)
@@ -3669,10 +3669,10 @@
(~ (bit$ exported?))))))))
#None
- (fail "Wrong syntax for type:"))))
+ (failure "Wrong syntax for type:"))))
#None
- (fail "Wrong syntax for type:"))
+ (failure "Wrong syntax for type:"))
))
(template [<name> <to>]
@@ -3715,7 +3715,7 @@
(return name)
_
- (fail "#only/#+ and #exclude/#- require identifiers."))))
+ (failure "#only/#+ and #exclude/#- require identifiers."))))
defs))
(def: (referrals_parser tokens)
@@ -3759,7 +3759,7 @@
(return struct_name)
_
- (fail "Expected all implementations of opening form to be identifiers.")))
+ (failure "Expected all implementations of opening form to be identifiers.")))
structs)
next+remainder (openings_parser parts')]
(let [[next remainder] next+remainder]
@@ -3809,24 +3809,24 @@
(def: parallel_hierarchy_sigil
"\")
-(def: (normalize_parallel_path' hierarchy root)
+(def: (normal_parallel_path' hierarchy root)
(-> Text Text Text)
(case [(text\split_with ..module_separator hierarchy)
(text\split_with ..parallel_hierarchy_sigil root)]
[(#.Some [_ hierarchy'])
(#.Some ["" root'])]
- (normalize_parallel_path' hierarchy' root')
+ (normal_parallel_path' hierarchy' root')
_
(case root
"" hierarchy
_ ($_ text\compose root ..module_separator hierarchy))))
-(def: (normalize_parallel_path hierarchy root)
+(def: (normal_parallel_path hierarchy root)
(-> Text Text (Maybe Text))
(case (text\split_with ..parallel_hierarchy_sigil root)
(#.Some ["" root'])
- (#.Some (normalize_parallel_path' hierarchy root'))
+ (#.Some (normal_parallel_path' hierarchy root'))
_
#.None))
@@ -3883,10 +3883,10 @@
0 prefix
_ ($_ text\compose prefix ..module_separator clean))]
(return output))
- (fail ($_ "lux text concat"
- "Cannot climb the module hierarchy..." ..\n
- "Importing module: " module ..\n
- " Relative Root: " relative_root ..\n))))))
+ (failure ($_ "lux text concat"
+ "Cannot climb the module hierarchy..." ..\n
+ "Importing module: " module ..\n
+ " Relative Root: " relative_root ..\n))))))
(def: (alter_domain alteration domain import)
(-> Nat Text Importation Importation)
@@ -3922,7 +3922,7 @@
## Nested
(^ [_ (#Tuple (list& [_ (#Identifier ["" m_name])] extra))])
(do meta_monad
- [import_name (case (normalize_parallel_path relative_root m_name)
+ [import_name (case (normal_parallel_path relative_root m_name)
(#.Some parallel_path)
(wrap parallel_path)
@@ -3946,7 +3946,7 @@
(^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Identifier ["" m_name])] extra))])
(do meta_monad
- [import_name (case (normalize_parallel_path relative_root m_name)
+ [import_name (case (normal_parallel_path relative_root m_name)
(#.Some parallel_path)
(wrap parallel_path)
@@ -3973,9 +3973,9 @@
_
(do meta_monad
[current_module current_module_name]
- (fail ($_ text\compose
- "Wrong syntax for import @ " current_module
- ..\n (code\encode token)))))))
+ (failure ($_ text\compose
+ "Wrong syntax for import @ " current_module
+ ..\n (code\encode token)))))))
imports)]
(wrap (list\join imports'))))
@@ -4171,13 +4171,13 @@
temp))
)))
-(def: (zip/2 xs ys)
+(def: (zipped/2 xs ys)
(All [a b] (-> (List a) (List b) (List [a b])))
(case xs
(#Cons x xs')
(case ys
(#Cons y ys')
- (list& [x y] (zip/2 xs' ys'))
+ (list& [x y] (zipped/2 xs' ys'))
_
(list))
@@ -4250,7 +4250,7 @@
struct_evidence (resolve_type_tags init_type)]
(case struct_evidence
#None
- (fail (text\compose "Can only 'open' structs: " (type\encode init_type)))
+ (failure (text\compose "Can only 'open' structs: " (type\encode init_type)))
(#Some tags&members)
(do meta_monad
@@ -4274,13 +4274,13 @@
#None
(wrap enhanced_target))))
target
- (zip/2 locals members))]
+ (zipped/2 locals members))]
(wrap (` ({(~ pattern) (~ enhanced_target)} (~ (identifier$ source)))))))))
name tags&members body)]
(wrap (list full_body)))))
_
- (fail "Wrong syntax for ^open")))
+ (failure "Wrong syntax for ^open")))
(macro: #export (cond tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4291,7 +4291,7 @@
" ## else_branch" ..\n
" ''???'')"))}
(if ("lux i64 =" 0 (n/% 2 (list\size tokens)))
- (fail "cond requires an uneven number of arguments.")
+ (failure "cond requires an uneven number of arguments.")
(case (list\reverse tokens)
(^ (list& else branches'))
(return (list (list\fold (: (-> [Code Code] Code Code)
@@ -4302,7 +4302,7 @@
(as_pairs branches'))))
_
- (fail "Wrong syntax for cond"))))
+ (failure "Wrong syntax for cond"))))
(def: (enumeration' idx xs)
(All [a] (-> Nat (List a) (List [Nat a])))
@@ -4344,11 +4344,11 @@
(if ("lux i64 =" idx r_idx)
g!output
g!_)]))
- (zip/2 tags (enumeration members))))]
+ (zipped/2 tags (enumeration members))))]
(return (list (` ({(~ pattern) (~ g!output)} (~ record))))))
_
- (fail "get@ can only use records.")))
+ (failure "get@ can only use records.")))
(^ (list [_ (#Tuple slots)] record))
(return (list (list\fold (: (-> Code Code Code)
@@ -4364,7 +4364,7 @@
(wrap (list (` (function ((~ g!_) (~ g!record)) (..get@ (~ selector) (~ g!record)))))))
_
- (fail "Wrong syntax for get@")))
+ (failure "Wrong syntax for get@")))
(def: (open_field alias tags my_tag_index [module short] source type)
(-> Text (List Name) Nat Name Code Type (Meta (List Code)))
@@ -4387,7 +4387,7 @@
(: (-> [Nat Name Type] (Meta (List Code)))
(function (_ [sub_tag_index sname stype])
(open_field alias tags' sub_tag_index sname source+ stype)))
- (enumeration (zip/2 tags' members')))]
+ (enumeration (zipped/2 tags' members')))]
(return (list\join decls')))
_
@@ -4422,11 +4422,11 @@
[decls' (monad\map meta_monad (: (-> [Nat Name Type] (Meta (List Code)))
(function (_ [tag_index sname stype])
(open_field alias tags tag_index sname source stype)))
- (enumeration (zip/2 tags members)))]
+ (enumeration (zipped/2 tags members)))]
(return (list\join decls')))
_
- (fail (text\compose "Can only 'open:' structs: " (type\encode struct_type)))))
+ (failure (text\compose "Can only 'open:' structs: " (type\encode struct_type)))))
_
(do meta_monad
@@ -4437,7 +4437,7 @@
(` (..open: (~ (text$ alias)) (~ g!struct)))))))
_
- (fail "Wrong syntax for open:")))
+ (failure "Wrong syntax for open:")))
(macro: #export (|>> tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4482,11 +4482,11 @@
#refer_open openings})
_
- (fail ($_ text\compose "Wrong syntax for refer @ " current_module
- ..\n (|> options
- (list\map code\encode)
- (interpose " ")
- (list\fold text\compose "")))))))
+ (failure ($_ text\compose "Wrong syntax for refer @ " current_module
+ ..\n (|> options
+ (list\map code\encode)
+ (interpose " ")
+ (list\fold text\compose "")))))))
(def: (write_refer module_name [r_defs r_opens])
(-> Text Refer (Meta (List Code)))
@@ -4499,7 +4499,7 @@
(function (_ _def)
(if (is_member? all_defs _def)
(return [])
- (fail ($_ text\compose _def " is not defined in module " module_name " @ " current_module)))))
+ (failure ($_ text\compose _def " is not defined in module " module_name " @ " current_module)))))
referred_defs)))]
defs' (case r_defs
#All
@@ -4544,7 +4544,7 @@
(write_refer module_name =refer))
_
- (fail "Wrong syntax for refer")))
+ (failure "Wrong syntax for refer")))
(def: (refer_to_code module_name module_alias' [r_defs r_opens])
(-> Text (Maybe Text) Refer Code)
@@ -4630,7 +4630,7 @@
(return (list (` ((..\ (~ struct) (~ member)) (~+ args)))))
_
- (fail "Wrong syntax for \")))
+ (failure "Wrong syntax for \")))
(macro: #export (set@ tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4658,7 +4658,7 @@
(do meta_monad
[g!slot (gensym "")]
(return [r_slot_name r_idx g!slot]))))
- (zip/2 tags (enumeration members)))]
+ (zipped/2 tags (enumeration members)))]
(let [pattern (record$ (list\map (: (-> [Name Nat Code] [Code Code])
(function (_ [r_slot_name r_idx r_var])
[(tag$ r_slot_name)
@@ -4674,12 +4674,12 @@
(return (list (` ({(~ pattern) (~ output)} (~ record)))))))
_
- (fail "set@ can only use records.")))
+ (failure "set@ can only use records.")))
(^ (list [_ (#Tuple slots)] value record))
(case slots
#Nil
- (fail "Wrong syntax for set@")
+ (failure "Wrong syntax for set@")
_
(do meta_monad
@@ -4687,7 +4687,7 @@
(: (-> Code (Meta Code))
(function (_ _) (gensym "temp")))
slots)
- #let [pairs (zip/2 slots bindings)
+ #let [pairs (zipped/2 slots bindings)
update_expr (list\fold (: (-> [Code Code] Code Code)
(function (_ [s b] v)
(` (..set@ (~ s) (~ v) (~ b)))))
@@ -4719,7 +4719,7 @@
(..set@ (~ selector) (~ g!value) (~ g!record)))))))
_
- (fail "Wrong syntax for set@")))
+ (failure "Wrong syntax for set@")))
(macro: #export (update@ tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4747,7 +4747,7 @@
(do meta_monad
[g!slot (gensym "")]
(return [r_slot_name r_idx g!slot]))))
- (zip/2 tags (enumeration members)))]
+ (zipped/2 tags (enumeration members)))]
(let [pattern (record$ (list\map (: (-> [Name Nat Code] [Code Code])
(function (_ [r_slot_name r_idx r_var])
[(tag$ r_slot_name)
@@ -4763,12 +4763,12 @@
(return (list (` ({(~ pattern) (~ output)} (~ record)))))))
_
- (fail "update@ can only use records.")))
+ (failure "update@ can only use records.")))
(^ (list [_ (#Tuple slots)] fun record))
(case slots
#Nil
- (fail "Wrong syntax for update@")
+ (failure "Wrong syntax for update@")
_
(do meta_monad
@@ -4794,7 +4794,7 @@
(..update@ (~ selector) (~ g!fun) (~ g!record)))))))
_
- (fail "Wrong syntax for update@")))
+ (failure "Wrong syntax for update@")))
(macro: #export (^template tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4854,10 +4854,10 @@
(return (list\compose output branches))
#None
- (fail "Wrong syntax for ^template"))
+ (failure "Wrong syntax for ^template"))
_
- (fail "Wrong syntax for ^template")))
+ (failure "Wrong syntax for ^template")))
(def: (find_baseline_column code)
(-> Code Nat)
@@ -5097,7 +5097,7 @@
[inits' (: (Meta (List Name))
(case (monad\map maybe_monad get_name inits)
(#Some inits') (return inits')
- #None (fail "Wrong syntax for loop")))
+ #None (failure "Wrong syntax for loop")))
init_types (monad\map meta_monad find_type inits')
expected get_expected_type]
(return (list (` (("lux type check"
@@ -5117,7 +5117,7 @@
(~ body)))))))))
#.None
- (fail "Wrong syntax for loop"))))
+ (failure "Wrong syntax for loop"))))
(macro: #export (^slots tokens)
{#.doc (doc "Allows you to extract record members as local variables with the same names."
@@ -5137,7 +5137,7 @@
(return slots)
#None
- (fail "Wrong syntax for ^slots")))
+ (failure "Wrong syntax for ^slots")))
#let [[hslot tslots] slots]
hslot (normalize hslot)
tslots (monad\map meta_monad normalize tslots)
@@ -5158,7 +5158,7 @@
(return (list& pattern body branches)))
_
- (fail "Wrong syntax for ^slots")))
+ (failure "Wrong syntax for ^slots")))
(def: (place_tokens label tokens target)
(-> Text (List Code) Code (Maybe (List Code)))
@@ -5231,16 +5231,16 @@
(wrap output)
_
- (fail "[with_expansions] Improper macro expansion.")))
+ (failure "[with_expansions] Improper macro expansion.")))
#Nil
(return bodies)
_
- (fail "Wrong syntax for with_expansions"))
+ (failure "Wrong syntax for with_expansions"))
_
- (fail "Wrong syntax for with_expansions")))
+ (failure "Wrong syntax for with_expansions")))
(def: (flat_alias type)
(-> Type Type)
@@ -5278,7 +5278,7 @@
["Text" Text text$])
_
- (fail (text\compose "Cannot anti-quote type: " (name\encode name))))))
+ (failure (text\compose "Cannot anti-quote type: " (name\encode name))))))
(def: (anti_quote token)
(-> Code (Meta Code))
@@ -5323,7 +5323,7 @@
(wrap (list pattern')))
_
- (fail "Wrong syntax for 'static'.")))
+ (failure "Wrong syntax for 'static'.")))
(type: Multi_Level_Case
[Code (List [Code Code])])
@@ -5342,7 +5342,7 @@
(-> (List Code) (Meta Multi_Level_Case))
(case levels
#Nil
- (fail "Multi-level patterns cannot be empty.")
+ (failure "Multi-level patterns cannot be empty.")
(#Cons init extras)
(do meta_monad
@@ -5419,7 +5419,7 @@
(wrap output)))
_
- (fail "Wrong syntax for ^multi")))
+ (failure "Wrong syntax for ^multi")))
## TODO: Allow asking the compiler for the name of the definition
## currently being defined. That name can then be fed into
@@ -5441,7 +5441,7 @@
([#Identifier] [#Tag])
_
- (fail (..wrong_syntax_error ["library/lux" "name_of"]))))
+ (failure (..wrong_syntax_error ["library/lux" "name_of"]))))
(def: (get_scope_type_vars state)
(Meta (List Nat))
@@ -5471,10 +5471,10 @@
(wrap (list (` (#Ex (~ (nat$ var_id))))))
#None
- (fail (text\compose "Indexed-type does not exist: " (nat\encode idx)))))
+ (failure (text\compose "Indexed-type does not exist: " (nat\encode idx)))))
_
- (fail (..wrong_syntax_error (name_of ..$)))))
+ (failure (..wrong_syntax_error (name_of ..$)))))
(def: #export (is? reference sample)
{#.doc (doc "Tests whether the 2 values are identical (not just 'equal')."
@@ -5501,7 +5501,7 @@
branches)))
_
- (fail (..wrong_syntax_error (name_of ..^@)))))
+ (failure (..wrong_syntax_error (name_of ..^@)))))
(macro: #export (^|> tokens)
{#.doc (doc "Pipes the value being pattern-matched against prior to binding it to a variable."
@@ -5517,7 +5517,7 @@
branches)))
_
- (fail (..wrong_syntax_error (name_of ..^|>)))))
+ (failure (..wrong_syntax_error (name_of ..^|>)))))
(macro: #export (:assume tokens)
{#.doc (doc "Coerces the given expression to the type of whatever is expected."
@@ -5529,7 +5529,7 @@
(wrap (list (` ("lux type as" (~ (type_to_code type)) (~ expr))))))
_
- (fail (..wrong_syntax_error (name_of ..:assume)))))
+ (failure (..wrong_syntax_error (name_of ..:assume)))))
(def: location
{#.doc "The location of the current expression being analyzed."}
@@ -5554,7 +5554,7 @@
(wrap (list (` (..error! (~ (text$ message)))))))
_
- (fail (..wrong_syntax_error (name_of ..undefined)))))
+ (failure (..wrong_syntax_error (name_of ..undefined)))))
(macro: #export (:of tokens)
{#.doc (doc "Generates the type corresponding to a given expression."
@@ -5581,7 +5581,7 @@
(..:of (~ g!temp)))))))
_
- (fail (..wrong_syntax_error (name_of ..:of)))))
+ (failure (..wrong_syntax_error (name_of ..:of)))))
(def: (complex_declaration_parser tokens)
(-> (List Code) (Meta [[Text (List Text)] (List Code)]))
@@ -5595,12 +5595,12 @@
(wrap arg_name)
_
- (fail "Could not parse an argument.")))
+ (failure "Could not parse an argument.")))
args')]
(wrap [[name args] tokens']))
_
- (fail "Could not parse a complex declaration.")
+ (failure "Could not parse a complex declaration.")
))
(def: (any_parser tokens)
@@ -5610,7 +5610,7 @@
(return [token tokens'])
_
- (fail "Could not parse anything.")
+ (failure "Could not parse anything.")
))
(def: (many_parser tokens)
@@ -5620,7 +5620,7 @@
(return [tokens (list)])
_
- (fail "Could not parse anything.")
+ (failure "Could not parse anything.")
))
(def: (end_parser tokens)
@@ -5630,7 +5630,7 @@
(return [])
_
- (fail "Expected input Codes to be empty.")
+ (failure "Expected input Codes to be empty.")
))
(def: (anns_parser tokens)
@@ -5715,14 +5715,14 @@
(wrap (:as ..Text value))
_
- (fail ($_ text\compose
- "Invalid target platform (must be a value of type Text): " (name\encode identifier)
- " : " (..code\encode (..type_to_code type))))))
+ (failure ($_ text\compose
+ "Invalid target platform (must be a value of type Text): " (name\encode identifier)
+ " : " (..code\encode (..type_to_code type))))))
_
- (fail ($_ text\compose
- "Invalid target platform syntax: " (..code\encode choice)
- ..\n "Must be either a text literal or an identifier."))))
+ (failure ($_ text\compose
+ "Invalid target platform syntax: " (..code\encode choice)
+ ..\n "Must be either a text literal or an identifier."))))
(def: (target_pick target options default)
(-> Text (List [Code Code]) (Maybe Code) (Meta (List Code)))
@@ -5730,7 +5730,7 @@
#Nil
(case default
#.None
- (fail ($_ text\compose "No code for target platform: " target))
+ (failure ($_ text\compose "No code for target platform: " target))
(#.Some default)
(return (list default)))
@@ -5753,7 +5753,7 @@
(target_pick target options (#.Some default))
_
- (fail (..wrong_syntax_error (name_of ..for))))))
+ (failure (..wrong_syntax_error (name_of ..for))))))
(template [<name> <type> <output>]
[(def: (<name> xy)
@@ -5809,7 +5809,7 @@
(~ labelled))))))
_
- (fail (..wrong_syntax_error (name_of ..``)))
+ (failure (..wrong_syntax_error (name_of ..``)))
))
(def: (name$ [module name])
@@ -5879,7 +5879,7 @@
(return unquoted)
[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))]
- (fail "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.")
+ (failure "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.")
(^template [<tag> <untemplate>]
[[_ (<tag> elems)]
@@ -5904,7 +5904,7 @@
(wrap (list pattern)))
_
- (fail (..wrong_syntax_error (name_of ..^code)))))
+ (failure (..wrong_syntax_error (name_of ..^code)))))
(def: #export false
Bit
@@ -5924,10 +5924,10 @@
(list localT (` (..as_is (~ valueT))))))
(list\fold list\compose (list))))]
(~ bodyT)))))
- (..fail ":let requires an even number of parts"))
+ (..failure ":let requires an even number of parts"))
_
- (..fail (..wrong_syntax_error (name_of ..:let)))))
+ (..failure (..wrong_syntax_error (name_of ..:let)))))
(macro: #export (try tokens)
{#.doc (doc (case (try (risky_computation input))
@@ -5945,4 +5945,4 @@
(~ expression)))))))
_
- (..fail (..wrong_syntax_error (name_of ..try)))))
+ (..failure (..wrong_syntax_error (name_of ..try)))))
diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux
index 0f63efc65..da787a54a 100644
--- a/stdlib/source/library/lux/abstract/apply.lux
+++ b/stdlib/source/library/lux/abstract/apply.lux
@@ -13,25 +13,25 @@
(-> (f (-> a b)) (f a) (f b)))
apply))
-(implementation: #export (compose f-monad f-apply g-apply)
+(implementation: #export (compose f_monad f_apply g_apply)
{#.doc "Applicative functor composition."}
(All [F G]
(-> (Monad F) (Apply F) (Apply G)
## TODO: Replace (All [a] (F (G a))) with (functor.Then F G)
(Apply (All [a] (F (G a))))))
- (def: &functor (functor.compose (get@ #&functor f-apply) (get@ #&functor g-apply)))
+ (def: &functor (functor.compose (get@ #&functor f_apply) (get@ #&functor g_apply)))
(def: (apply fgf fgx)
## TODO: Switch from this version to the one below (in comments) ASAP.
- (let [fgf' (\ f-apply apply
- (\ f-monad wrap (\ g-apply apply))
+ (let [fgf' (\ f_apply apply
+ (\ f_monad wrap (\ g_apply apply))
fgf)]
- (\ f-apply apply fgf' fgx))
- ## (let [applyF (\ f-apply apply)
- ## applyG (\ g-apply apply)]
+ (\ f_apply apply fgf' fgx))
+ ## (let [applyF (\ f_apply apply)
+ ## applyG (\ g_apply apply)]
## ($_ applyF
- ## (\ f-monad wrap applyG)
+ ## (\ f_monad wrap applyG)
## fgf
## fgx))
))
diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux
index 2d734673f..097c8ca84 100644
--- a/stdlib/source/library/lux/abstract/codec.lux
+++ b/stdlib/source/library/lux/abstract/codec.lux
@@ -14,16 +14,16 @@
(: (-> m (Try a))
decode))
-(implementation: #export (compose cb-codec ba-codec)
+(implementation: #export (compose cb_codec ba_codec)
{#.doc "Codec composition."}
(All [a b c]
(-> (Codec c b) (Codec b a)
(Codec c a)))
(def: encode
- (|>> (\ ba-codec encode)
- (\ cb-codec encode)))
+ (|>> (\ ba_codec encode)
+ (\ cb_codec encode)))
(def: (decode cy)
(do try.monad
- [by (\ cb-codec decode cy)]
- (\ ba-codec decode by))))
+ [by (\ cb_codec decode cy)]
+ (\ ba_codec decode by))))
diff --git a/stdlib/source/library/lux/abstract/comonad/cofree.lux b/stdlib/source/library/lux/abstract/comonad/cofree.lux
index c0236f079..88c4ce50a 100644
--- a/stdlib/source/library/lux/abstract/comonad/cofree.lux
+++ b/stdlib/source/library/lux/abstract/comonad/cofree.lux
@@ -6,7 +6,7 @@
[functor (#+ Functor)]]])
(type: #export (CoFree F a)
- {#.doc "The CoFree CoMonad."}
+ {#.doc (doc "The CoFree CoMonad.")}
[a (F (CoFree F a))])
(implementation: #export (functor dsl)
diff --git a/stdlib/source/library/lux/abstract/equivalence.lux b/stdlib/source/library/lux/abstract/equivalence.lux
index bb21f7711..b1e570713 100644
--- a/stdlib/source/library/lux/abstract/equivalence.lux
+++ b/stdlib/source/library/lux/abstract/equivalence.lux
@@ -11,6 +11,7 @@
=))
(def: #export (rec sub)
+ {#.doc (doc "A recursive equivalence combinator.")}
(All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a)))
(implementation
(def: (= left right)
diff --git a/stdlib/source/library/lux/abstract/fold.lux b/stdlib/source/library/lux/abstract/fold.lux
index 58059e634..fca10ecb2 100644
--- a/stdlib/source/library/lux/abstract/fold.lux
+++ b/stdlib/source/library/lux/abstract/fold.lux
@@ -11,6 +11,7 @@
fold))
(def: #export (with_monoid monoid fold value)
+ {#.doc (doc "Fold over a foldable structure using the monoid's identity as the initial value.")}
(All [F a]
(-> (Monoid a) (Fold F) (F a) a))
(let [(^open "/\.") monoid]
diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux
index fb56625e8..f168eebe0 100644
--- a/stdlib/source/library/lux/abstract/functor.lux
+++ b/stdlib/source/library/lux/abstract/functor.lux
@@ -1,5 +1,6 @@
-(.module: [library
- lux])
+(.module:
+ [library
+ [lux #*]])
(interface: #export (Functor f)
(: (All [a b]
@@ -14,6 +15,7 @@
(All [a] (| (f a) (g a))))
(def: #export (sum (^open "f\.") (^open "g\."))
+ {#.doc (doc "Co-product (sum) composition for functors.")}
(All [F G] (-> (Functor F) (Functor G) (Functor (..Or F G))))
(implementation
(def: (map f fa|ga)
@@ -28,6 +30,7 @@
(All [a] (& (f a) (g a))))
(def: #export (product (^open "f\.") (^open "g\."))
+ {#.doc (doc "Product composition for functors.")}
(All [F G] (-> (Functor F) (Functor G) (Functor (..And F G))))
(implementation
(def: (map f [fa ga])
diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux
index 5fbf26109..4d4e5f643 100644
--- a/stdlib/source/library/lux/abstract/interval.lux
+++ b/stdlib/source/library/lux/abstract/interval.lux
@@ -26,6 +26,7 @@
(def: top top)))
(def: #export (singleton enum elem)
+ {#.doc (doc "An interval where both top and bottom are the same value.")}
(All [a] (-> (Enum a) a (Interval a)))
(implementation
(def: &enum enum)
@@ -69,31 +70,34 @@
)
(def: #export (borders? interval elem)
+ {#.doc (doc "Where a value is at the border of an interval.")}
(All [a] (-> (Interval a) a Bit))
(or (starts_with? elem interval)
(ends_with? elem interval)))
-(def: #export (union left right)
+(implementation: #export (union left right)
+ {#.doc (doc "An interval that spans both predecessors.")}
(All [a] (-> (Interval a) (Interval a) (Interval a)))
- (implementation
- (def: &enum (get@ #&enum right))
- (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom)))
- (def: top (order.max (\ right &order) (\ left top) (\ right top)))))
-(def: #export (intersection left right)
+ (def: &enum (get@ #&enum right))
+ (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom)))
+ (def: top (order.max (\ right &order) (\ left top) (\ right top))))
+
+(implementation: #export (intersection left right)
+ {#.doc (doc "An interval spanned by both predecessors.")}
(All [a] (-> (Interval a) (Interval a) (Interval a)))
- (implementation
- (def: &enum (get@ #&enum right))
- (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom)))
- (def: top (order.min (\ right &order) (\ left top) (\ right top)))))
-(def: #export (complement interval)
+ (def: &enum (get@ #&enum right))
+ (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom)))
+ (def: top (order.min (\ right &order) (\ left top) (\ right top))))
+
+(implementation: #export (complement interval)
+ {#.doc (doc "The inverse of an interval.")}
(All [a] (-> (Interval a) (Interval a)))
- (let [(^open ".") interval]
- (implementation
- (def: &enum (get@ #&enum interval))
- (def: bottom (succ top))
- (def: top (pred bottom)))))
+
+ (def: &enum (get@ #&enum interval))
+ (def: bottom (\ interval succ (\ interval top)))
+ (def: top (\ interval pred (\ interval bottom))))
(def: #export (precedes? reference sample)
(All [a] (-> (Interval a) (Interval a) Bit))
@@ -118,6 +122,7 @@
)
(def: #export (meets? reference sample)
+ {#.doc (doc "Whether an interval meets another one on its bottom/lower side.")}
(All [a] (-> (Interval a) (Interval a) Bit))
(let [(^open ",\.") reference
limit (\ reference bottom)]
@@ -143,7 +148,9 @@
[finishes? ,\top order.>= ,\bottom]
)
-(implementation: #export equivalence (All [a] (Equivalence (Interval a)))
+(implementation: #export equivalence
+ (All [a] (Equivalence (Interval a)))
+
(def: (= reference sample)
(let [(^open ",\.") reference]
(and (,\= ,\bottom (\ sample bottom))
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux
index ef7138593..567234801 100644
--- a/stdlib/source/library/lux/abstract/monad.lux
+++ b/stdlib/source/library/lux/abstract/monad.lux
@@ -44,6 +44,9 @@
#.Nil))
(interface: #export (Monad m)
+ {#.doc (doc "A monad is a monoid in the category of endofunctors."
+ "What's the problem?")}
+
(: (Functor m)
&functor)
(: (All [a]
@@ -108,6 +111,7 @@
(#.Left "Wrong syntax for 'do'")))
(def: #export (bind monad f)
+ {#.doc (doc "Apply a function with monadic effects to a monadic value and yield a new monadic value.")}
(All [! a b]
(-> (Monad !) (-> a (! b))
(-> (! a) (! b))))
diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux
index 92db5f045..5d18ba0ac 100644
--- a/stdlib/source/library/lux/abstract/monad/indexed.lux
+++ b/stdlib/source/library/lux/abstract/monad/indexed.lux
@@ -3,8 +3,8 @@
[lux #*
[control
[monad]
- ["p" parser
- ["s" code (#+ Parser)]]]
+ ["<>" parser
+ ["<.>" code (#+ Parser)]]]
[data
[collection
["." list ("#\." functor fold)]]]
@@ -23,11 +23,12 @@
(m ii io vo)))
bind))
-(type: Binding [Code Code])
+(type: Binding
+ [Code Code])
(def: binding
(Parser Binding)
- (p.and s.any s.any))
+ (<>.and <code>.any <code>.any))
(type: Context
(#Let (List Binding))
@@ -35,9 +36,9 @@
(def: context
(Parser Context)
- (p.or (p.after (s.this! (' #let))
- (s.tuple (p.some binding)))
- binding))
+ (<>.or (<>.after (<code>.this! (' #let))
+ (<code>.tuple (<>.some binding)))
+ binding))
(def: (pair_list [binding value])
(All [a] (-> [a a] (List a)))
@@ -45,14 +46,14 @@
(def: named_monad
(Parser [(Maybe Text) Code])
- (p.either (s.record (p.and (\ p.monad map (|>> #.Some)
- s.local_identifier)
- s.any))
- (\ p.monad map (|>> [#.None])
- s.any)))
+ (<>.either (<code>.record (<>.and (\ <>.monad map (|>> #.Some)
+ <code>.local_identifier)
+ <code>.any))
+ (\ <>.monad map (|>> [#.None])
+ <code>.any)))
(syntax: #export (do {[?name monad] ..named_monad}
- {context (s.tuple (p.some context))}
+ {context (<code>.tuple (<>.some context))}
expression)
(macro.with_gensyms [g!_ g!bind]
(let [body (list\fold (function (_ context next)
diff --git a/stdlib/source/library/lux/abstract/order.lux b/stdlib/source/library/lux/abstract/order.lux
index 3eaafaf3a..280226ccd 100644
--- a/stdlib/source/library/lux/abstract/order.lux
+++ b/stdlib/source/library/lux/abstract/order.lux
@@ -19,30 +19,37 @@
)
(type: #export (Comparison a)
+ {#.doc (doc "An arbitrary comparison between two values, with the knowledge of how to order them.")}
(-> (Order a) a a Bit))
(def: #export (<= order parameter subject)
+ {#.doc (doc "Less than or equal.")}
Comparison
(or (\ order < parameter subject)
(\ order = parameter subject)))
(def: #export (> order parameter subject)
+ {#.doc (doc "Greater than.")}
Comparison
(\ order < subject parameter))
(def: #export (>= order parameter subject)
+ {#.doc (doc "Greater than or equal.")}
Comparison
(or (\ order < subject parameter)
(\ order = subject parameter)))
(type: #export (Choice a)
+ {#.doc (doc "A choice comparison between two values, with the knowledge of how to order them.")}
(-> (Order a) a a a))
(def: #export (min order x y)
+ {#.doc (doc "Minimum.")}
Choice
(if (\ order < y x) x y))
(def: #export (max order x y)
+ {#.doc (doc "Maximum.")}
Choice
(if (\ order < y x) y x))
diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux
index 205ccc316..d53a9a3cb 100644
--- a/stdlib/source/library/lux/abstract/predicate.lux
+++ b/stdlib/source/library/lux/abstract/predicate.lux
@@ -9,21 +9,29 @@
["." contravariant]]])
(type: #export (Predicate a)
+ {#.doc (doc "A question that can be asked of a value, yield either false (#0) or true (#1).")}
(-> a Bit))
-(template [<identity_name> <identity_value> <composition_name> <composition>]
+(template [<identity_name> <identity_value> <composition_name> <composition>
+ <identity_doc> <composition_doc>]
[(def: #export <identity_name>
+ {#.doc <identity_doc>}
Predicate
(function.constant <identity_value>))
(def: #export (<composition_name> left right)
+ {#.doc <composition_doc>}
(All [a] (-> (Predicate a) (Predicate a) (Predicate a)))
(function (_ value)
(<composition> (left value)
(right value))))]
- [none #0 unite or]
- [all #1 intersect and]
+ [none #0 unite or
+ (doc "A predicate that always fails.")
+ (doc "A predicate that meets either predecessor.")]
+ [all #1 intersect and
+ (doc "A predicate that always succeeds.")
+ (doc "A predicate that meets both predecessors.")]
)
(template [<name> <identity> <composition>]
@@ -38,16 +46,19 @@
)
(def: #export (complement predicate)
+ {#.doc (doc "The opposite of a predicate.")}
(All [a] (-> (Predicate a) (Predicate a)))
(|>> predicate not))
(def: #export (difference sub base)
+ {#.doc (doc "A predicate that meeds 'base', but not 'sub'.")}
(All [a] (-> (Predicate a) (Predicate a) (Predicate a)))
(function (_ value)
(and (base value)
(not (sub value)))))
(def: #export (rec predicate)
+ {#.doc (doc "Ties the knot for a recursive predicate.")}
(All [a]
(-> (-> (Predicate a) (Predicate a))
(Predicate a)))
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 3ab6c0f05..0d87210c3 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -65,8 +65,8 @@
(wrap singleton)
_
- (meta.fail (format "Cannot expand to more than a single AST/Code node:" text.new_line
- (|> expansion (list\map %.code) (text.join_with " ")))))))
+ (meta.failure (format "Cannot expand to more than a single AST/Code node:" text.new_line
+ (|> expansion (list\map %.code) (text.join_with " ")))))))
(syntax: #export (=> {aliases aliases^}
{inputs stack^}
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index 355a7885e..b2b619735 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -1,4 +1,5 @@
-(.module: {#.doc "The actor model of concurrency."}
+(.module:
+ {#.doc "The actor model of concurrency."}
[library
[lux #*
["." debug]
@@ -34,27 +35,27 @@
["." abstract (#+ abstract: :representation :abstraction)]]]]
[//
["." atom (#+ Atom atom)]
- ["." promise (#+ Promise Resolver) ("#\." monad)]
+ ["." async (#+ Async Resolver) ("#\." monad)]
["." frp (#+ Channel)]])
(exception: #export poisoned)
(exception: #export dead)
(with_expansions
- [<Mail> (as_is (-> s (Actor s) (Promise (Try s))))
+ [<Mail> (as_is (-> s (Actor s) (Async (Try s))))
<Obituary> (as_is [Text s (List <Mail>)])
<Mailbox> (as_is (Rec Mailbox
- [(Promise [<Mail> Mailbox])
+ [(Async [<Mail> Mailbox])
(Resolver [<Mail> Mailbox])]))]
(def: (pending [read write])
(All [a]
(-> (Rec Mailbox
- [(Promise [a Mailbox])
+ [(Async [a Mailbox])
(Resolver [a Mailbox])])
(IO (List a))))
(do {! io.monad}
- [current (promise.poll read)]
+ [current (async.poll read)]
(case current
(#.Some [head tail])
(\ ! map (|>> (#.Cons head))
@@ -64,7 +65,7 @@
(wrap #.Nil))))
(abstract: #export (Actor s)
- {#obituary [(Promise <Obituary>)
+ {#obituary [(Async <Obituary>)
(Resolver <Obituary>)]
#mailbox (Atom <Mailbox>)}
@@ -81,7 +82,7 @@
(type: #export (Behavior o s)
{#.doc (doc "An actor's behavior when mail is received and when a fatal error occurs.")}
{#on_init (-> o s)
- #on_mail (-> (Mail s) s (Actor s) (Promise (Try s)))})
+ #on_mail (-> (Mail s) s (Actor s) (Async (Try s)))})
(def: #export (spawn! behavior init)
{#.doc (doc "Given a behavior and initial state, spawns an actor and returns it.")}
@@ -92,11 +93,11 @@
behavior
(Actor s)
- (:abstraction {#obituary (promise.promise [])
- #mailbox (atom (promise.promise []))}))
+ (:abstraction {#obituary (async.async [])
+ #mailbox (atom (async.async []))}))
process (loop [state (on_init init)
[|mailbox| _] (io.run (atom.read (get@ #mailbox (:representation self))))]
- (do {! promise.monad}
+ (do {! async.monad}
[[head tail] |mailbox|
?state' (on_mail head state self)]
(case ?state'
@@ -116,7 +117,7 @@
(All [s] (-> (Actor s) (IO Bit)))
(let [[obituary _] (get@ #obituary (:representation actor))]
(|> obituary
- promise.poll
+ async.poll
(\ io.functor map
(|>> (case> #.None
bit.yes
@@ -127,11 +128,11 @@
(def: #export (obituary actor)
(All [s] (-> (Actor s) (IO (Maybe (Obituary s)))))
(let [[obituary _] (get@ #obituary (:representation actor))]
- (promise.poll obituary)))
+ (async.poll obituary)))
(def: #export await
{#.doc (doc "Await for an actor to end working.")}
- (All [s] (-> (Actor s) (Promise (Obituary s))))
+ (All [s] (-> (Actor s) (Async (Obituary s))))
(|>> :representation
(get@ #obituary)
product.left))
@@ -142,12 +143,12 @@
(do {! io.monad}
[alive? (..alive? actor)]
(if alive?
- (let [entry [mail (promise.promise [])]]
+ (let [entry [mail (async.async [])]]
(do !
[|mailbox|&resolve (atom.read (get@ #mailbox (:representation actor)))]
(loop [[|mailbox| resolve] |mailbox|&resolve]
(do !
- [|mailbox| (promise.poll |mailbox|)]
+ [|mailbox| (async.poll |mailbox|)]
(case |mailbox|
#.None
(do !
@@ -164,39 +165,39 @@
(type: #export (Message s o)
{#.doc (doc "A two-way message sent to an actor, expecting a reply.")}
- (-> s (Actor s) (Promise (Try [s o]))))
+ (-> s (Actor s) (Async (Try [s o]))))
(def: (mail message)
- (All [s o] (-> (Message s o) [(Promise (Try o)) (Mail s)]))
- (let [[promise resolve] (:sharing [s o]
- (Message s o)
- message
-
- [(Promise (Try o))
- (Resolver (Try o))]
- (promise.promise []))]
- [promise
+ (All [s o] (-> (Message s o) [(Async (Try o)) (Mail s)]))
+ (let [[async resolve] (:sharing [s o]
+ (Message s o)
+ message
+
+ [(Async (Try o))
+ (Resolver (Try o))]
+ (async.async []))]
+ [async
(function (_ state self)
- (do {! promise.monad}
+ (do {! async.monad}
[outcome (message state self)]
(case outcome
(#try.Success [state' return])
(exec (io.run (resolve (#try.Success return)))
- (promise.resolved (#try.Success state')))
+ (async.resolved (#try.Success state')))
(#try.Failure error)
(exec (io.run (resolve (#try.Failure error)))
- (promise.resolved (#try.Failure error))))))]))
+ (async.resolved (#try.Failure error))))))]))
(def: #export (tell! message actor)
{#.doc (doc "Communicate with an actor through message-passing.")}
- (All [s o] (-> (Message s o) (Actor s) (Promise (Try o))))
- (let [[promise mail] (..mail message)]
- (do promise.monad
- [outcome (promise.future (..mail! mail actor))]
+ (All [s o] (-> (Message s o) (Actor s) (Async (Try o))))
+ (let [[async mail] (..mail message)]
+ (do async.monad
+ [outcome (async.future (..mail! mail actor))]
(case outcome
(#try.Success)
- promise
+ async
(#try.Failure error)
(wrap (#try.Failure error))))))
@@ -204,7 +205,7 @@
)
(def: (default_on_mail mail state self)
- (All [s] (-> (Mail s) s (Actor s) (Promise (Try s))))
+ (All [s] (-> (Mail s) s (Actor s) (Async (Try s))))
(mail state self))
(def: #export default
@@ -218,7 +219,7 @@
"but allows the actor to handle previous mail.")}
(All [s] (-> (Actor s) (IO (Try Any))))
(..mail! (function (_ state self)
- (promise.resolved (exception.throw ..poisoned [])))
+ (async.resolved (exception.throw ..poisoned [])))
actor))
(def: actor_decl^
@@ -261,7 +262,7 @@
(List a)
((on_mail mail state self)
- (do (try.with promise.monad)
+ (do (try.with async.monad)
[#let [_ (debug.log! "BEFORE")]
output (mail state self)
#let [_ (debug.log! "AFTER")]]
@@ -270,7 +271,7 @@
(message: #export (push {value a} state self)
(List a)
(let [state' (#.Cons value state)]
- (promise.resolved (#try.Success [state' state'])))))
+ (async.resolved (#try.Success [state' state'])))))
(actor: #export Counter
Nat
@@ -278,11 +279,11 @@
(message: #export (count! {increment Nat} state self)
Any
(let [state' (n.+ increment state)]
- (promise.resolved (#try.Success [state' state']))))
+ (async.resolved (#try.Success [state' state']))))
(message: #export (read! state self)
Nat
- (promise.resolved (#try.Success [state state])))))]
+ (async.resolved (#try.Success [state state])))))]
(syntax: #export (actor:
{export |export|.parser}
{[name vars] actor_decl^}
@@ -353,7 +354,7 @@
body)
{#.doc (doc "A message can access the actor's state through the state parameter."
"A message can also access the actor itself through the self parameter."
- "A message's output must be a promise containing a 2-tuple with the updated state and a return value."
+ "A message's output must be an async containing a 2-tuple with the updated state and a return value."
"A message may succeed or fail (in case of failure, the actor dies)."
<examples>)}
@@ -378,10 +379,10 @@
(let [(~ g!state) (:as (~ (get@ #abstract.representation actor_scope))
(~ g!state))]
(|> (~ body)
- (: ((~! promise.Promise) ((~! try.Try) [(~ (get@ #abstract.representation actor_scope))
- (~ output_type)])))
- (:as ((~! promise.Promise) ((~! try.Try) [(~ (get@ #abstract.abstraction actor_scope))
- (~ output_type)]))))))))
+ (: ((~! async.Async) ((~! try.Try) [(~ (get@ #abstract.representation actor_scope))
+ (~ output_type)])))
+ (:as ((~! async.Async) ((~! try.Try) [(~ (get@ #abstract.abstraction actor_scope))
+ (~ output_type)]))))))))
))))))
(type: #export Stop
diff --git a/stdlib/source/library/lux/control/concurrency/promise.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index 24618fa5a..875602eff 100644
--- a/stdlib/source/library/lux/control/concurrency/promise.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -17,23 +17,23 @@
["." thread]
["." atom (#+ Atom atom)]])
-(abstract: #export (Promise a)
+(abstract: #export (Async a)
(Atom [(Maybe a) (List (-> a (IO Any)))])
{#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."}
(type: #export (Resolver a)
- {#.doc (doc "The function used to give a value to a promise."
- "Will signal 'true' if the promise has been resolved for the 1st time, 'false' otherwise.")}
+ {#.doc (doc "The function used to give a value to an async."
+ "Will signal 'true' if the async has been resolved for the 1st time, 'false' otherwise.")}
(-> a (IO Bit)))
- (def: (resolver promise)
- {#.doc "Sets a promise's value if it has not been done yet."}
- (All [a] (-> (Promise a) (Resolver a)))
+ (def: (resolver async)
+ {#.doc "Sets an async's value if it has not been done yet."}
+ (All [a] (-> (Async a) (Resolver a)))
(function (resolve value)
- (let [promise (:representation promise)]
+ (let [async (:representation async)]
(do {! io.monad}
- [(^@ old [_value _observers]) (atom.read promise)]
+ [(^@ old [_value _observers]) (atom.read async)]
(case _value
(#.Some _)
(wrap #0)
@@ -41,7 +41,7 @@
#.None
(do !
[#let [new [(#.Some value) #.None]]
- succeeded? (atom.compare_and_swap old new promise)]
+ succeeded? (atom.compare_and_swap old new async)]
(if succeeded?
(do !
[_ (monad.map ! (function (_ f) (f value))
@@ -50,29 +50,29 @@
(resolve value))))))))
(def: #export (resolved value)
- {#.doc (doc "Produces a promise that has already been resolved to the given value.")}
- (All [a] (-> a (Promise a)))
+ {#.doc (doc "Produces an async that has already been resolved to the given value.")}
+ (All [a] (-> a (Async a)))
(:abstraction (atom [(#.Some value) (list)])))
- (def: #export (promise _)
- {#.doc (doc "Creates a fresh promise that has not been resolved yet.")}
- (All [a] (-> Any [(Promise a) (Resolver a)]))
- (let [promise (:abstraction (atom [#.None (list)]))]
- [promise (..resolver promise)]))
+ (def: #export (async _)
+ {#.doc (doc "Creates a fresh async that has not been resolved yet.")}
+ (All [a] (-> Any [(Async a) (Resolver a)]))
+ (let [async (:abstraction (atom [#.None (list)]))]
+ [async (..resolver async)]))
(def: #export poll
- {#.doc "Polls a promise for its value."}
- (All [a] (-> (Promise a) (IO (Maybe a))))
+ {#.doc "Polls an async for its value."}
+ (All [a] (-> (Async a) (IO (Maybe a))))
(|>> :representation
atom.read
(\ io.functor map product.left)))
- (def: #export (await f promise)
- {#.doc (doc "Executes the given function as soon as the promise has been resolved.")}
- (All [a] (-> (-> a (IO Any)) (Promise a) (IO Any)))
+ (def: #export (await f async)
+ {#.doc (doc "Executes the given function as soon as the async has been resolved.")}
+ (All [a] (-> (-> a (IO Any)) (Async a) (IO Any)))
(do {! io.monad}
- [#let [promise (:representation promise)]
- (^@ old [_value _observers]) (atom.read promise)]
+ [#let [async (:representation async)]
+ (^@ old [_value _observers]) (atom.read async)]
(case _value
(#.Some value)
(f value)
@@ -80,15 +80,15 @@
#.None
(let [new [_value (#.Cons f _observers)]]
(do !
- [swapped? (atom.compare_and_swap old new promise)]
+ [swapped? (atom.compare_and_swap old new async)]
(if swapped?
(wrap [])
- (await f (:abstraction promise))))))))
+ (await f (:abstraction async))))))))
)
(def: #export resolved?
- {#.doc "Checks whether a promise's value has already been resolved."}
- (All [a] (-> (Promise a) (IO Bit)))
+ {#.doc "Checks whether an async's value has already been resolved."}
+ (All [a] (-> (Async a) (IO Bit)))
(|>> ..poll
(\ io.functor map
(|>> (case> #.None
@@ -98,47 +98,47 @@
#1)))))
(implementation: #export functor
- (Functor Promise)
+ (Functor Async)
(def: (map f fa)
- (let [[fb resolve] (..promise [])]
+ (let [[fb resolve] (..async [])]
(exec (io.run (..await (|>> f resolve) fa))
fb))))
(implementation: #export apply
- (Apply Promise)
+ (Apply Async)
(def: &functor ..functor)
(def: (apply ff fa)
- (let [[fb resolve] (..promise [])]
+ (let [[fb resolve] (..async [])]
(exec (io.run (..await (function (_ f)
(..await (|>> f resolve) fa))
ff))
fb))))
(implementation: #export monad
- (Monad Promise)
+ (Monad Async)
(def: &functor ..functor)
(def: wrap ..resolved)
(def: (join mma)
- (let [[ma resolve] (promise [])]
+ (let [[ma resolve] (async [])]
(exec (io.run (..await (..await resolve) mma))
ma))))
(def: #export (and left right)
- {#.doc (doc "Combines the results of both promises, in-order.")}
- (All [a b] (-> (Promise a) (Promise b) (Promise [a b])))
+ {#.doc (doc "Combines the results of both asyncs, in-order.")}
+ (All [a b] (-> (Async a) (Async b) (Async [a b])))
(let [[read! write!] (:sharing [a b]
- [(Promise a) (Promise b)]
+ [(Async a) (Async b)]
[left right]
- [(Promise [a b])
+ [(Async [a b])
(Resolver [a b])]
- (..promise []))
+ (..async []))
_ (io.run (..await (function (_ left)
(..await (function (_ right)
(write! [left right]))
@@ -147,13 +147,13 @@
read!))
(def: #export (or left right)
- {#.doc (doc "Yields the results of whichever promise gets resolved first."
+ {#.doc (doc "Yields the results of whichever async gets resolved first."
"You can tell which one was resolved first through pattern-matching.")}
- (All [a b] (-> (Promise a) (Promise b) (Promise (| a b))))
- (let [[a|b resolve] (..promise [])]
+ (All [a b] (-> (Async a) (Async b) (Async (| a b))))
+ (let [[a|b resolve] (..async [])]
(with_expansions
- [<sides> (template [<promise> <tag>]
- [(io.run (await (|>> <tag> resolve) <promise>))]
+ [<sides> (template [<async> <tag>]
+ [(io.run (await (|>> <tag> resolve) <async>))]
[left #.Left]
[right #.Right]
@@ -162,12 +162,12 @@
a|b))))
(def: #export (either left right)
- {#.doc (doc "Yields the results of whichever promise gets resolved first."
+ {#.doc (doc "Yields the results of whichever async gets resolved first."
"You cannot tell which one was resolved first.")}
- (All [a] (-> (Promise a) (Promise a) (Promise a)))
- (let [[left||right resolve] (..promise [])]
- (`` (exec (~~ (template [<promise>]
- [(io.run (await resolve <promise>))]
+ (All [a] (-> (Async a) (Async a) (Async a)))
+ (let [[left||right resolve] (..async [])]
+ (`` (exec (~~ (template [<async>]
+ [(io.run (await resolve <async>))]
[left]
[right]))
@@ -176,8 +176,8 @@
(def: #export (schedule millis_delay computation)
{#.doc (doc "Runs an I/O computation on its own thread (after a specified delay)."
"Returns a aromise that will eventually host its result.")}
- (All [a] (-> Nat (IO a) (Promise a)))
- (let [[!out resolve] (..promise [])]
+ (All [a] (-> Nat (IO a) (Async a)))
+ (let [[!out resolve] (..async [])]
(exec (|> (do io.monad
[value computation]
(resolve value))
@@ -187,21 +187,21 @@
(def: #export future
{#.doc (doc "Runs an I/O computation on its own thread."
- "Returns a promise that will eventually host its result.")}
- (All [a] (-> (IO a) (Promise a)))
+ "Returns an async that will eventually host its result.")}
+ (All [a] (-> (IO a) (Async a)))
(..schedule 0))
(def: #export (delay time_millis value)
{#.doc "Delivers a value after a certain period has passed."}
- (All [a] (-> Nat a (Promise a)))
+ (All [a] (-> Nat a (Async a)))
(..schedule time_millis (io value)))
(def: #export (wait time_millis)
- {#.doc "Returns a promise that will be resolved after the specified amount of milliseconds."}
- (-> Nat (Promise Any))
+ {#.doc "Returns an async that will be resolved after the specified amount of milliseconds."}
+ (-> Nat (Async Any))
(..delay time_millis []))
-(def: #export (time_out time_millis promise)
- {#.doc "Wait for a promise to be resolved within the specified amount of milliseconds."}
- (All [a] (-> Nat (Promise a) (Promise (Maybe a))))
- (..or (wait time_millis) promise))
+(def: #export (time_out time_millis async)
+ {#.doc "Wait for an async to be resolved within the specified amount of milliseconds."}
+ (All [a] (-> Nat (Async a) (Async (Maybe a))))
+ (..or (wait time_millis) async))
diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux
index f69a88369..fee1a5dda 100644
--- a/stdlib/source/library/lux/control/concurrency/frp.lux
+++ b/stdlib/source/library/lux/control/concurrency/frp.lux
@@ -16,11 +16,11 @@
abstract]]]
[//
["." atom (#+ Atom)]
- ["." promise (#+ Promise) ("#\." functor)]])
+ ["." async (#+ Async) ("#\." functor)]])
(type: #export (Channel a)
{#.doc "An asynchronous channel to distribute values."}
- (Promise (Maybe [a (Channel a)])))
+ (Async (Maybe [a (Channel a)])))
(exception: #export channel_is_already_closed)
@@ -33,7 +33,7 @@
(def: (sink resolve)
(All [a]
- (-> (promise.Resolver (Maybe [a (Channel a)]))
+ (-> (async.Resolver (Maybe [a (Channel a)]))
(Sink a)))
(let [sink (atom.atom resolve)]
(implementation
@@ -59,12 +59,12 @@
(do {! io.monad}
[current (atom.read sink)
#let [[next resolve_next] (:sharing [a]
- (promise.Resolver (Maybe [a (Channel a)]))
+ (async.Resolver (Maybe [a (Channel a)]))
current
- [(Promise (Maybe [a (Channel a)]))
- (promise.Resolver (Maybe [a (Channel a)]))]
- (promise.promise []))]
+ [(Async (Maybe [a (Channel a)]))
+ (async.Resolver (Maybe [a (Channel a)]))]
+ (async.async []))]
fed? (current (#.Some [value next]))]
(if fed?
## I fed the sink.
@@ -83,14 +83,14 @@
(def: #export (channel _)
{#.doc (doc "Creates a brand-new channel and hands it over, along with the sink to write to it.")}
(All [a] (-> Any [(Channel a) (Sink a)]))
- (let [[promise resolve] (promise.promise [])]
- [promise (..sink resolve)]))
+ (let [[async resolve] (async.async [])]
+ [async (..sink resolve)]))
(implementation: #export functor
(Functor Channel)
(def: (map f)
- (promise\map
+ (async\map
(maybe\map
(function (_ [head tail])
[(f head) (map f tail)])))))
@@ -101,7 +101,7 @@
(def: &functor ..functor)
(def: (apply ff fa)
- (do promise.monad
+ (do async.monad
[cons_f ff
cons_a fa]
(case [cons_f cons_a]
@@ -113,7 +113,7 @@
(def: empty
Channel
- (promise.resolved #.None))
+ (async.resolved #.None))
(implementation: #export monad
(Monad Channel)
@@ -121,13 +121,13 @@
(def: &functor ..functor)
(def: (wrap a)
- (promise.resolved (#.Some [a ..empty])))
+ (async.resolved (#.Some [a ..empty])))
(def: (join mma)
(let [[output sink] (channel [])]
- (exec (: (Promise Any)
+ (exec (: (Async Any)
(loop [mma mma]
- (do {! promise.monad}
+ (do {! async.monad}
[?mma mma]
(case ?mma
(#.Some [ma mma'])
@@ -154,9 +154,9 @@
(def: #export (subscribe subscriber channel)
(All [a] (-> (Subscriber a) (Channel a) (IO Any)))
- (io (exec (: (Promise Any)
+ (io (exec (: (Async Any)
(loop [channel channel]
- (do promise.monad
+ (do async.monad
[cons channel]
(case cons
(#.Some [head tail])
@@ -175,7 +175,7 @@
{#.doc (doc "Produces a new channel based on the old one, only with values"
"that pass the test.")}
(All [a] (-> (-> a Bit) (Channel a) (Channel a)))
- (do promise.monad
+ (do async.monad
[cons channel]
(case cons
(#.Some [head tail])
@@ -187,19 +187,19 @@
#.None
(wrap #.None))))
-(def: #export (of_promise promise)
- {#.doc (doc "A one-element channel containing the output from a promise.")}
- (All [a] (-> (Promise a) (Channel a)))
- (promise\map (function (_ value)
- (#.Some [value ..empty]))
- promise))
+(def: #export (of_async async)
+ {#.doc (doc "A one-element channel containing the output from an async.")}
+ (All [a] (-> (Async a) (Channel a)))
+ (async\map (function (_ value)
+ (#.Some [value ..empty]))
+ async))
(def: #export (fold f init channel)
{#.doc "Asynchronous fold over channels."}
(All [a b]
- (-> (-> b a (Promise a)) a (Channel b)
- (Promise a)))
- (do {! promise.monad}
+ (-> (-> b a (Async a)) a (Channel b)
+ (Async a)))
+ (do {! async.monad}
[cons channel]
(case cons
#.None
@@ -212,9 +212,9 @@
(def: #export (folds f init channel)
(All [a b]
- (-> (-> b a (Promise a)) a (Channel b)
+ (-> (-> b a (Async a)) a (Channel b)
(Channel a)))
- (do {! promise.monad}
+ (do {! async.monad}
[cons channel]
(case cons
#.None
@@ -233,7 +233,7 @@
(do io.monad
[value action
_ (\ sink feed value)]
- (promise.await recur (promise.wait milli_seconds)))))
+ (async.await recur (async.wait milli_seconds)))))
[output sink])))
(def: #export (periodic milli_seconds)
@@ -241,8 +241,8 @@
(..poll milli_seconds (io [])))
(def: #export (iterate f init)
- (All [s o] (-> (-> s (Promise (Maybe [s o]))) s (Channel o)))
- (do promise.monad
+ (All [s o] (-> (-> s (Async (Maybe [s o]))) s (Channel o)))
+ (do async.monad
[?next (f init)]
(case ?next
(#.Some [state output])
@@ -253,7 +253,7 @@
(def: (distinct' equivalence previous channel)
(All [a] (-> (Equivalence a) a (Channel a) (Channel a)))
- (do promise.monad
+ (do async.monad
[cons channel]
(case cons
(#.Some [head tail])
@@ -266,7 +266,7 @@
(def: #export (distinct equivalence channel)
(All [a] (-> (Equivalence a) (Channel a) (Channel a)))
- (do promise.monad
+ (do async.monad
[cons channel]
(case cons
(#.Some [head tail])
@@ -276,8 +276,8 @@
(wrap #.None))))
(def: #export (consume channel)
- (All [a] (-> (Channel a) (Promise (List a))))
- (do {! promise.monad}
+ (All [a] (-> (Channel a) (Async (List a))))
+ (do {! async.monad}
[cons channel]
(case cons
(#.Some [head tail])
@@ -295,6 +295,6 @@
..empty
(#.Cons head tail)
- (promise.resolved (#.Some [head (do promise.monad
- [_ (promise.wait milli_seconds)]
- (sequential milli_seconds tail))]))))
+ (async.resolved (#.Some [head (do async.monad
+ [_ (async.wait milli_seconds)]
+ (sequential milli_seconds tail))]))))
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index 821250fb3..56b70bbc1 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -22,7 +22,7 @@
["." refinement]]]]
[//
["." atom (#+ Atom)]
- ["." promise (#+ Promise Resolver)]])
+ ["." async (#+ Async Resolver)]])
(type: State
{#max_positions Nat
@@ -48,10 +48,10 @@
(def: #export (wait semaphore)
{#.doc (doc "Wait on a semaphore until there are open positions."
"After finishing your work, you must 'signal' to the semaphore that you're done.")}
- (Ex [k] (-> Semaphore (Promise Any)))
+ (Ex [k] (-> Semaphore (Async Any)))
(let [semaphore (:representation semaphore)
- [signal sink] (: [(Promise Any) (Resolver Any)]
- (promise.promise []))]
+ [signal sink] (: [(Async Any) (Resolver Any)]
+ (async.async []))]
(exec (io.run
(with_expansions [<had_open_position?> (as_is (get@ #open_positions) (i.> -1))]
(do io.monad
@@ -73,9 +73,9 @@
(def: #export (signal semaphore)
{#.doc (doc "Signal to a semaphore that you're done with your work, and that there is a new open position.")}
- (Ex [k] (-> Semaphore (Promise (Try Int))))
+ (Ex [k] (-> Semaphore (Async (Try Int))))
(let [semaphore (:representation semaphore)]
- (promise.future
+ (async.future
(do {! io.monad}
[[pre post] (atom.update (function (_ state)
(if (i.= (.int (get@ #max_positions state))
@@ -108,17 +108,17 @@
(:abstraction (semaphore 1)))
(def: acquire
- (-> Mutex (Promise Any))
+ (-> Mutex (Async Any))
(|>> :representation ..wait))
(def: release
- (-> Mutex (Promise Any))
+ (-> Mutex (Async Any))
(|>> :representation ..signal))
(def: #export (synchronize mutex procedure)
{#.doc (doc "Runs the procedure with exclusive control of the mutex.")}
- (All [a] (-> Mutex (IO (Promise a)) (Promise a)))
- (do promise.monad
+ (All [a] (-> Mutex (IO (Async a)) (Async a)))
+ (do async.monad
[_ (..acquire mutex)
output (io.run procedure)
_ (..release mutex)]
@@ -149,18 +149,18 @@
#end_turnstile (..semaphore 0)}))
(def: (un_block times turnstile)
- (-> Nat Semaphore (Promise Any))
+ (-> Nat Semaphore (Async Any))
(loop [step 0]
(if (n.< times step)
- (do promise.monad
+ (do async.monad
[outcome (..signal turnstile)]
(recur (inc step)))
- (\ promise.monad wrap []))))
+ (\ async.monad wrap []))))
(template [<phase> <update> <goal> <turnstile>]
[(def: (<phase> (^:representation barrier))
- (-> Barrier (Promise Any))
- (do promise.monad
+ (-> Barrier (Async Any))
+ (do async.monad
[#let [limit (refinement.un_refine (get@ #limit barrier))
goal <goal>
[_ count] (io.run (atom.update <update> (get@ #count barrier)))
@@ -175,8 +175,8 @@
(def: #export (block barrier)
{#.doc (doc "Wait on a barrier until all processes have arrived and met the barrier's limit.")}
- (-> Barrier (Promise Any))
- (do promise.monad
+ (-> Barrier (Async Any))
+ (do async.monad
[_ (..start barrier)]
(..end barrier)))
)
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux
index 833dff059..3f912c3de 100644
--- a/stdlib/source/library/lux/control/concurrency/stm.lux
+++ b/stdlib/source/library/lux/control/concurrency/stm.lux
@@ -17,7 +17,7 @@
abstract]]]
[//
["." atom (#+ Atom atom)]
- ["." promise (#+ Promise Resolver)]
+ ["." async (#+ Async Resolver)]
["." frp (#+ Channel Sink)]])
(type: (Observer a)
@@ -200,14 +200,14 @@
(type: (Commit a)
[(STM a)
- (Promise a)
+ (Async a)
(Resolver a)])
(def: pending_commits
(Atom (Rec Commits
- [(Promise [(Ex [a] (Commit a)) Commits])
+ [(Async [(Ex [a] (Commit a)) Commits])
(Resolver [(Ex [a] (Commit a)) Commits])]))
- (atom (promise.promise [])))
+ (atom (async.async [])))
(def: commit_processor_flag
(Atom Bit)
@@ -215,12 +215,12 @@
(def: (issue_commit commit)
(All [a] (-> (Commit a) (IO Any)))
- (let [entry [commit (promise.promise [])]]
+ (let [entry [commit (async.async [])]]
(do {! io.monad}
[|commits|&resolve (atom.read pending_commits)]
(loop [[|commits| resolve] |commits|&resolve]
(do !
- [|commits| (promise.poll |commits|)]
+ [|commits| (async.poll |commits|)]
(case |commits|
#.None
(do io.monad
@@ -252,12 +252,12 @@
[was_first? (atom.compare_and_swap flag #1 commit_processor_flag)]
(if was_first?
(do !
- [[promise resolve] (atom.read pending_commits)]
- (promise.await (function (recur [head [tail _resolve]])
- (do !
- [_ (process_commit head)]
- (promise.await recur tail)))
- promise))
+ [[async resolve] (atom.read pending_commits)]
+ (async.await (function (recur [head [tail _resolve]])
+ (do !
+ [_ (process_commit head)]
+ (async.await recur tail)))
+ async))
(wrap [])))
)))
@@ -265,8 +265,8 @@
{#.doc (doc "Commits a transaction and returns its result (asynchronously)."
"Note that a transaction may be re-run an indeterminate number of times if other transactions involving the same variables successfully commit first."
"For this reason, it's important to note that transactions must be free from side-effects, such as I/O.")}
- (All [a] (-> (STM a) (Promise a)))
- (let [[output resolver] (promise.promise [])]
+ (All [a] (-> (STM a) (Async a)))
+ (let [[output resolver] (async.async [])]
(exec (io.run (do io.monad
[_ init_processor!]
(issue_commit [stm_proc output resolver])))
diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux
index 4ceaaa61f..97d2c3ac1 100644
--- a/stdlib/source/library/lux/control/function/mutual.lux
+++ b/stdlib/source/library/lux/control/function/mutual.lux
@@ -87,8 +87,8 @@
hidden_names (monad.map ! (//.constant (macro.gensym "mutual_function#"))
functions)
#let [definitions (list\map (..mutual_definition hidden_names g!context)
- (list.zip/2 hidden_names
- functions))
+ (list.zipped/2 hidden_names
+ functions))
context_types (list\map (function (_ mutual)
(` (-> (~ g!context) (~ (get@ #type mutual)))))
functions)
@@ -97,8 +97,8 @@
g!pop (local.push (list\map (function (_ [g!name mutual])
[[here_name (get@ [#declaration #declaration.name] mutual)]
(..macro g!context g!name)])
- (list.zip/2 hidden_names
- functions)))]
+ (list.zipped/2 hidden_names
+ functions)))]
(wrap (list (` (.let [(~ g!context) (: (Rec (~ g!context)
[(~+ context_types)])
[(~+ definitions)])
@@ -153,8 +153,8 @@
hidden_names (monad.map ! (//.constant (macro.gensym "mutual_function#"))
functions)
#let [definitions (list\map (..mutual_definition hidden_names g!context)
- (list.zip/2 hidden_names
- (list\map (get@ #mutual) functions)))
+ (list.zipped/2 hidden_names
+ (list\map (get@ #mutual) functions)))
context_types (list\map (function (_ mutual)
(` (-> (~ g!context) (~ (get@ [#mutual #type] mutual)))))
functions)
@@ -163,8 +163,8 @@
g!pop (local.push (list\map (function (_ [g!name mutual])
[[here_name (get@ [#mutual #declaration #declaration.name] mutual)]
(..macro g!context g!name)])
- (list.zip/2 hidden_names
- functions)))]
+ (list.zipped/2 hidden_names
+ functions)))]
(wrap (list& (` (.def: (~ g!context)
[(~+ (list\map (get@ [#mutual #type]) functions))]
(.let [(~ g!context) (: (Rec (~ g!context)
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index 3dc90e1d2..d017e9dd4 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -221,7 +221,7 @@
_
(#try.Failure "Expected to fail; yet succeeded."))))
-(def: #export (fail message)
+(def: #export (failure message)
(All [s a] (-> Text (Parser s a)))
(function (_ input)
(#try.Failure message)))
diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux
index cdfb18504..df8d140ab 100644
--- a/stdlib/source/library/lux/control/parser/analysis.lux
+++ b/stdlib/source/library/lux/control/parser/analysis.lux
@@ -13,6 +13,8 @@
["%" format (#+ format)]]
[collection
["." list ("#\." functor)]]]
+ [macro
+ ["." template]]
[math
[number
["." i64]
@@ -47,9 +49,11 @@
["Input" (exception.enumerate /.%analysis input)]))
(type: #export Parser
+ {#.doc (doc "A parser for Lux code analysis nodes.")}
(//.Parser (List Analysis)))
(def: #export (run parser input)
+ {#.doc (doc "Executes a parser and makes sure no inputs go unconsumed.")}
(All [a] (-> (Parser a) (List Analysis) (Try a)))
(case (parser input)
(#try.Failure error)
@@ -62,6 +66,7 @@
(exception.throw ..unconsumed_input unconsumed)))
(def: #export any
+ {#.doc (doc "Matches any value, without discrimination.")}
(Parser Analysis)
(function (_ input)
(case input
@@ -89,27 +94,29 @@
_ false)])))
(template [<query> <assertion> <tag> <type> <eq>]
- [(def: #export <query>
- (Parser <type>)
- (function (_ input)
- (case input
- (^ (list& (<tag> x) input'))
- (#try.Success [input' x])
-
- _
- (exception.throw ..cannot_parse input))))
-
- (def: #export (<assertion> expected)
- (-> <type> (Parser Any))
- (function (_ input)
- (case input
- (^ (list& (<tag> actual) input'))
- (if (\ <eq> = expected actual)
- (#try.Success [input' []])
- (exception.throw ..cannot_parse input))
-
- _
- (exception.throw ..cannot_parse input))))]
+ [(`` (as_is (def: #export <query>
+ {#.doc (doc (~~ (template.text ["Queries for a " <query> " value."])))}
+ (Parser <type>)
+ (function (_ input)
+ (case input
+ (^ (list& (<tag> x) input'))
+ (#try.Success [input' x])
+
+ _
+ (exception.throw ..cannot_parse input))))
+
+ (def: #export (<assertion> expected)
+ {#.doc (doc (~~ (template.text ["Assert a specific " <query> " value."])))}
+ (-> <type> (Parser Any))
+ (function (_ input)
+ (case input
+ (^ (list& (<tag> actual) input'))
+ (if (\ <eq> = expected actual)
+ (#try.Success [input' []])
+ (exception.throw ..cannot_parse input))
+
+ _
+ (exception.throw ..cannot_parse input))))))]
[bit bit! /.bit Bit bit.equivalence]
[nat nat! /.nat Nat nat.equivalence]
@@ -123,6 +130,7 @@
)
(def: #export (tuple parser)
+ {#.doc (doc "Parses only within the context of a tuple's contents.")}
(All [a] (-> (Parser a) (Parser a)))
(function (_ input)
(case input
diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux
index ec06bec54..f7a2cb94a 100644
--- a/stdlib/source/library/lux/control/parser/binary.lux
+++ b/stdlib/source/library/lux/control/parser/binary.lux
@@ -26,9 +26,12 @@
["." frac]]]]]
["." // ("#\." monad)])
-(type: #export Offset Nat)
+(type: #export Offset
+ {#.doc (doc "An offset for reading within binary data.")}
+ Nat)
(type: #export Parser
+ {#.doc (doc "A parser for raw binary data.")}
(//.Parser [Offset Binary]))
(exception: #export (binary_was_not_fully_read {binary_length Nat} {bytes_read Nat})
@@ -37,6 +40,7 @@
["Bytes read" (%.nat bytes_read)]))
(def: #export (run parser input)
+ {#.doc (doc "Runs a parser and checks that all the binary data was read by it.")}
(All [a] (-> (Parser a) Binary (Try a)))
(case (parser [0 input])
(#try.Failure msg)
@@ -49,21 +53,26 @@
(exception.throw ..binary_was_not_fully_read [length end])))))
(def: #export end?
+ {#.doc (doc "Checks whether there is no more data to read.")}
(Parser Bit)
(function (_ (^@ input [offset data]))
(#try.Success [input (n.= offset (/.size data))])))
(def: #export offset
+ {#.doc (doc "The current offset (i.e. how much data has been read).")}
(Parser Offset)
(function (_ (^@ input [offset data]))
(#try.Success [input offset])))
(def: #export remaining
+ {#.doc (doc "How much of the data remains to be read.")}
(Parser Nat)
(function (_ (^@ input [offset data]))
(#try.Success [input (n.- offset (/.size data))])))
-(type: #export Size Nat)
+(type: #export Size
+ {#.doc (doc "The size of a chunk of data within a binary array.")}
+ Nat)
(def: #export size/8 Size 1)
(def: #export size/16 Size (n.* 2 size/8))
@@ -120,12 +129,14 @@
[1 #.Right right]]))
(def: #export (rec body)
+ {#.doc (doc "Tie the knot for a recursive parser.")}
(All [a] (-> (-> (Parser a) (Parser a)) (Parser a)))
(function (_ input)
(let [parser (body (rec body))]
(parser input))))
(def: #export any
+ {#.doc (doc "Does no parsing, and just returns a dummy value.")}
(Parser Any)
(//\wrap []))
@@ -145,6 +156,7 @@
_ (//.lift (exception.throw ..not_a_bit [value])))))
(def: #export (segment size)
+ {#.doc (doc "Parses a chunk of data of a given size.")}
(-> Nat (Parser Binary))
(function (_ [offset binary])
(case size
@@ -153,36 +165,39 @@
(/.slice offset size)
(\ try.monad map (|>> [[(n.+ size offset) binary]]))))))
-(template [<name> <bits>]
- [(def: #export <name>
- (Parser Binary)
- (do //.monad
- [size (//\map .nat <bits>)]
- (..segment size)))]
-
- [binary/8 ..bits/8]
- [binary/16 ..bits/16]
- [binary/32 ..bits/32]
- [binary/64 ..bits/64]
+(template [<size> <name> <bits>]
+ [(`` (def: #export <name>
+ {#.doc (doc (~~ (template.text ["Parses a block of data prefixed with a size that is " <size> " bytes long."])))}
+ (Parser Binary)
+ (do //.monad
+ [size (//\map .nat <bits>)]
+ (..segment size))))]
+
+ [08 binary/8 ..bits/8]
+ [16 binary/16 ..bits/16]
+ [32 binary/32 ..bits/32]
+ [64 binary/64 ..bits/64]
)
-(template [<name> <binary>]
- [(def: #export <name>
- (Parser Text)
- (do //.monad
- [utf8 <binary>]
- (//.lift (\ utf8.codec decode utf8))))]
-
- [utf8/8 ..binary/8]
- [utf8/16 ..binary/16]
- [utf8/32 ..binary/32]
- [utf8/64 ..binary/64]
+(template [<size> <name> <binary>]
+ [(`` (def: #export <name>
+ {#.doc (doc (~~ (template.text ["Parses a block of (UTF-8 encoded) text prefixed with a size that is " <size> " bytes long."])))}
+ (Parser Text)
+ (do //.monad
+ [utf8 <binary>]
+ (//.lift (\ utf8.codec decode utf8)))))]
+
+ [08 utf8/8 ..binary/8]
+ [16 utf8/16 ..binary/16]
+ [32 utf8/32 ..binary/32]
+ [64 utf8/64 ..binary/64]
)
(def: #export text ..utf8/64)
-(template [<name> <bits>]
+(template [<size> <name> <bits>]
[(def: #export (<name> valueP)
+ {#.doc (doc (~~ (template.text ["Parses a row of values prefixed with a size that is " <size> " bytes long."])))}
(All [v] (-> (Parser v) (Parser (Row v))))
(do //.monad
[amount (: (Parser Nat)
@@ -201,10 +216,10 @@
(row.add value output)))
(//\wrap output)))))]
- [row/8 ..bits/8]
- [row/16 ..bits/16]
- [row/32 ..bits/32]
- [row/64 ..bits/64]
+ [08 row/8 ..bits/8]
+ [16 row/16 ..bits/16]
+ [32 row/32 ..bits/32]
+ [64 row/64 ..bits/64]
)
(def: #export maybe
@@ -212,6 +227,7 @@
(..or ..any))
(def: #export (list value)
+ {#.doc (doc "Parses an arbitrarily long list of values.")}
(All [a] (-> (Parser a) (Parser (List a))))
(..rec
(|>> (//.and value)
diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux
index 7cacdd086..5a66208b4 100644
--- a/stdlib/source/library/lux/control/parser/cli.lux
+++ b/stdlib/source/library/lux/control/parser/cli.lux
@@ -15,6 +15,7 @@
(//.Parser (List Text) a))
(def: #export (run parser inputs)
+ {#.doc (doc "Executes the parser and verifies that all inputs are processed.")}
(All [a] (-> (Parser a) (List Text) (Try a)))
(case (//.run parser inputs)
(#try.Success [remaining output])
@@ -87,12 +88,14 @@
_ (#try.Failure (format "Unknown parameters: " (text.join_with " " inputs))))))
(def: #export (named name value)
+ {#.doc (doc "Parses a named parameter and yields its value.")}
(All [a] (-> Text (Parser a) (Parser a)))
(|> value
(//.after (..this name))
..somewhere))
(def: #export (parameter [short long] value)
+ {#.doc (doc "Parses a parameter that can have either a short or a long name.")}
(All [a] (-> [Text Text] (Parser a) (Parser a)))
(|> value
(//.after (//.either (..this short) (..this long)))
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index 0c53041b9..2e9935480 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -72,7 +72,7 @@
(wrap value)
_
- (//.fail (exception.construct ..unexpected_value [head])))))]
+ (//.failure (exception.construct ..unexpected_value [head])))))]
[null /.Null #/.Null "null"]
[boolean /.Boolean #/.Boolean "boolean"]
@@ -96,7 +96,7 @@
(wrap (\ <equivalence> = test value))
_
- (//.fail (exception.construct ..unexpected_value [head])))))
+ (//.failure (exception.construct ..unexpected_value [head])))))
(def: #export (<check> test)
{#.doc (code.text ($_ text\compose "Ensures a JSON value is a " <desc> "."))}
@@ -107,10 +107,10 @@
(<tag> value)
(if (\ <equivalence> = test value)
(wrap [])
- (//.fail (exception.construct ..value_mismatch [(<tag> test) (<tag> value)])))
+ (//.failure (exception.construct ..value_mismatch [(<tag> test) (<tag> value)])))
_
- (//.fail (exception.construct ..unexpected_value [head])))))]
+ (//.failure (exception.construct ..unexpected_value [head])))))]
[boolean? boolean! /.Boolean bit.equivalence #/.Boolean "boolean"]
[number? number! /.Number frac.equivalence #/.Number "number"]
@@ -131,7 +131,7 @@
(#/.Array values)
(case (//.run parser (row.to_list values))
(#try.Failure error)
- (//.fail error)
+ (//.failure error)
(#try.Success [remainder output])
(case remainder
@@ -139,10 +139,10 @@
(wrap output)
_
- (//.fail (exception.construct ..unconsumed_input remainder))))
+ (//.failure (exception.construct ..unconsumed_input remainder))))
_
- (//.fail (exception.construct ..unexpected_value [head])))))
+ (//.failure (exception.construct ..unexpected_value [head])))))
(def: #export (object parser)
{#.doc "Parses a JSON object. Use this with the 'field' combinator."}
@@ -158,7 +158,7 @@
list.concat
(//.run parser))
(#try.Failure error)
- (//.fail error)
+ (//.failure error)
(#try.Success [remainder output])
(case remainder
@@ -166,10 +166,10 @@
(wrap output)
_
- (//.fail (exception.construct ..unconsumed_input remainder))))
+ (//.failure (exception.construct ..unconsumed_input remainder))))
_
- (//.fail (exception.construct ..unexpected_value [head])))))
+ (//.failure (exception.construct ..unexpected_value [head])))))
(def: #export (field field_name parser)
{#.doc "Parses a field inside a JSON object. Use this inside the 'object' combinator."}
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 73a4a9e4e..d76254fe8 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -156,7 +156,7 @@
(let [members (<flattener> (type.anonymous headT))]
(if (n.> 1 (list.size members))
(local members poly)
- (//.fail (exception.construct <exception> headT))))))]
+ (//.failure (exception.construct <exception> headT))))))]
[variant type.flat_variant #.Sum ..not_variant]
[tuple type.flat_tuple #.Product ..not_tuple]
@@ -168,7 +168,7 @@
[headT any
#let [[num_arg bodyT] (type.flat_univ_q (type.anonymous headT))]]
(if (n.= 0 num_arg)
- (//.fail (exception.construct ..not_polymorphic headT))
+ (//.failure (exception.construct ..not_polymorphic headT))
(wrap [num_arg bodyT]))))
(def: #export (polymorphic poly)
@@ -216,7 +216,7 @@
(if (n.> 0 (list.size inputsT))
(//.and (local inputsT in_poly)
(local (list outputT) out_poly))
- (//.fail (exception.construct ..not_function headT)))))
+ (//.failure (exception.construct ..not_function headT)))))
(def: #export (applied poly)
(All [a] (-> (Parser a) (Parser a)))
@@ -224,7 +224,7 @@
[headT any
#let [[funcT paramsT] (type.flat_application (type.anonymous headT))]]
(if (n.= 0 (list.size paramsT))
- (//.fail (exception.construct ..not_application headT))
+ (//.failure (exception.construct ..not_application headT))
(..local (#.Cons funcT paramsT) poly))))
(template [<name> <test>]
@@ -234,7 +234,7 @@
[actual any]
(if (<test> expected actual)
(wrap [])
- (//.fail (exception.construct ..types_do_not_match [expected actual])))))]
+ (//.failure (exception.construct ..types_do_not_match [expected actual])))))]
[exactly type\=]
[sub check.checks?]
@@ -260,10 +260,10 @@
(wrap poly_code)
#.None
- (//.fail (exception.construct ..unknown_parameter headT)))
+ (//.failure (exception.construct ..unknown_parameter headT)))
_
- (//.fail (exception.construct ..not_parameter headT)))))
+ (//.failure (exception.construct ..not_parameter headT)))))
(def: #export (parameter! id)
(-> Nat (Parser Any))
@@ -274,10 +274,10 @@
(#.Parameter idx)
(if (n.= id (adjusted_idx env idx))
(wrap [])
- (//.fail (exception.construct ..wrong_parameter [(#.Parameter id) headT])))
+ (//.failure (exception.construct ..wrong_parameter [(#.Parameter id) headT])))
_
- (//.fail (exception.construct ..not_parameter headT)))))
+ (//.failure (exception.construct ..not_parameter headT)))))
(def: #export existential
(Parser Nat)
@@ -288,7 +288,7 @@
(wrap ex_id)
_
- (//.fail (exception.construct ..not_existential headT)))))
+ (//.failure (exception.construct ..not_existential headT)))))
(def: #export named
(Parser [Name Type])
@@ -299,7 +299,7 @@
(wrap [name anonymousT])
_
- (//.fail (exception.construct ..not_named inputT)))))
+ (//.failure (exception.construct ..not_named inputT)))))
(`` (template: (|nothing|)
(#.Named [(~~ (static .prelude_module)) "Nothing"]
@@ -320,7 +320,7 @@
(wrap [recT output]))
_
- (//.fail (exception.construct ..not_recursive headT)))))
+ (//.failure (exception.construct ..not_recursive headT)))))
(def: #export recursive_self
(Parser Code)
@@ -334,7 +334,7 @@
(wrap self_call)
_
- (//.fail (exception.construct ..not_recursive headT)))))
+ (//.failure (exception.construct ..not_recursive headT)))))
(def: #export recursive_call
(Parser Code)
diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux
index ff6247418..83a0fe84d 100644
--- a/stdlib/source/library/lux/control/region.lux
+++ b/stdlib/source/library/lux/control/region.lux
@@ -135,7 +135,7 @@
(#try.Failure error)
(wrap [cleaners (#try.Failure error)]))))))
-(def: #export (fail monad error)
+(def: #export (failure monad error)
(All [! a]
(-> (Monad !) Text
(All [r] (Region r ! a))))
@@ -146,7 +146,7 @@
(All [! e a]
(-> (Monad !) (Exception e) e
(All [r] (Region r ! a))))
- (fail monad (exception.construct exception message)))
+ (failure monad (exception.construct exception message)))
(def: #export (lift monad operation)
(All [! a]
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index f004f109e..c2cc446ed 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -44,7 +44,7 @@
(wrap date)
(#try.Failure message)
- (<>.fail message)))))
+ (<>.failure message)))))
(syntax: #export (remember {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)})
(let [now (io.run instant.now)
@@ -56,7 +56,7 @@
#.None
(list)))
- (meta.fail (exception.construct ..must_remember [deadline today message focus])))))
+ (meta.failure (exception.construct ..must_remember [deadline today message focus])))))
(template [<name> <message>]
[(syntax: #export (<name> {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)})
diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux
index 13ae40d15..100eea37e 100644
--- a/stdlib/source/library/lux/control/security/capability.lux
+++ b/stdlib/source/library/lux/control/security/capability.lux
@@ -8,7 +8,7 @@
["<c>" code]]
["." io (#+ IO)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[text
["%" format (#+ format)]]
@@ -66,6 +66,6 @@
(def: #export (async capability)
(All [brand input output]
(-> (Capability brand input (IO output))
- (Capability brand input (Promise output))))
- (..forge (|>> ((:representation capability)) promise.future)))
+ (Capability brand input (Async output))))
+ (..forge (|>> ((:representation capability)) async.future)))
)
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index 7ef0d0e31..92b77bdf4 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -455,21 +455,21 @@
output'
(recur input' output')))))
-(macro: #export (zip tokens state)
+(macro: #export (zipped tokens state)
{#.doc (doc "Create list zippers with the specified number of input lists."
- (def: #export zip/2 (zip 2))
- (def: #export zip/3 (zip 3))
- ((zip 3) xs ys zs))}
+ (def: #export zipped/2 (zipped 2))
+ (def: #export zipped/3 (zipped 3))
+ ((zipped 3) xs ys zs))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
(let [(^open ".") ..functor
indices (..indices num_lists)
type_vars (: (List Code) (map (|>> nat@encode identifier$) indices))
- zip_type (` (All [(~+ type_vars)]
- (-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
- type_vars))
- (List [(~+ type_vars)]))))
+ zipped_type (` (All [(~+ type_vars)]
+ (-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
+ type_vars))
+ (List [(~+ type_vars)]))))
vars+lists (|> indices
(map inc)
(map (function (_ idx)
@@ -481,7 +481,7 @@
g!step (identifier$ "0step0")
g!blank (identifier$ "0,0")
list_vars (map product.right vars+lists)
- code (` (: (~ zip_type)
+ code (` (: (~ zipped_type)
(function ((~ g!step) (~+ list_vars))
(case [(~+ list_vars)]
(~ pattern)
@@ -491,19 +491,19 @@
(~ g!blank)
#.Nil))))]
(#.Right [state (list code)]))
- (#.Left "Cannot zip 0 lists."))
+ (#.Left "Cannot zipped 0 lists."))
_
- (#.Left "Wrong syntax for zip")))
+ (#.Left "Wrong syntax for zipped")))
-(def: #export zip/2 (zip 2))
-(def: #export zip/3 (zip 3))
+(def: #export zipped/2 (zipped 2))
+(def: #export zipped/3 (zipped 3))
-(macro: #export (zip_with tokens state)
+(macro: #export (zipped_with tokens state)
{#.doc (doc "Create list zippers with the specified number of input lists."
- (def: #export zip_with/2 (zip_with 2))
- (def: #export zip_with/3 (zip_with 3))
- ((zip_with 2) + xs ys))}
+ (def: #export zipped_with/2 (zipped_with 2))
+ (def: #export zipped_with/3 (zipped_with 3))
+ ((zipped_with 2) + xs ys))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
@@ -512,11 +512,11 @@
g!return_type (identifier$ "0return_type0")
g!func (identifier$ "0func0")
type_vars (: (List Code) (map (|>> nat@encode identifier$) indices))
- zip_type (` (All [(~+ type_vars) (~ g!return_type)]
- (-> (-> (~+ type_vars) (~ g!return_type))
- (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
- type_vars))
- (List (~ g!return_type)))))
+ zipped_type (` (All [(~+ type_vars) (~ g!return_type)]
+ (-> (-> (~+ type_vars) (~ g!return_type))
+ (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
+ type_vars))
+ (List (~ g!return_type)))))
vars+lists (|> indices
(map inc)
(map (function (_ idx)
@@ -528,7 +528,7 @@
g!step (identifier$ "0step0")
g!blank (identifier$ "0,0")
list_vars (map product.right vars+lists)
- code (` (: (~ zip_type)
+ code (` (: (~ zipped_type)
(function ((~ g!step) (~ g!func) (~+ list_vars))
(case [(~+ list_vars)]
(~ pattern)
@@ -538,13 +538,13 @@
(~ g!blank)
#.Nil))))]
(#.Right [state (list code)]))
- (#.Left "Cannot zip_with 0 lists."))
+ (#.Left "Cannot zipped_with 0 lists."))
_
- (#.Left "Wrong syntax for zip_with")))
+ (#.Left "Wrong syntax for zipped_with")))
-(def: #export zip_with/2 (zip_with 2))
-(def: #export zip_with/3 (zip_with 3))
+(def: #export zipped_with/2 (zipped_with 2))
+(def: #export zipped_with/3 (zipped_with 3))
(def: #export (last xs)
(All [a] (-> (List a) (Maybe a)))
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index 5e6f20eb6..68cf97171 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -284,7 +284,7 @@
#green (..up green)
#blue (..up blue)}))))
-(def: (normalize ratio)
+(def: (normal ratio)
(-> Frac Frac)
(cond (f.> +1.0 ratio)
(f.% +1.0 ratio)
@@ -297,7 +297,7 @@
(def: #export (interpolate ratio end start)
(-> Frac Color Color Color)
- (let [dS (..normalize ratio)
+ (let [dS (..normal ratio)
dE (|> +1.0 (f.- dS))
interpolate' (: (-> Nat Nat Nat)
(function (_ end start)
@@ -326,7 +326,7 @@
(let [[hue saturation luminance] (to_hsl color)]
(of_hsl [hue
(|> saturation
- (f.* (|> +1.0 (<op> (..normalize ratio))))
+ (f.* (|> +1.0 (<op> (..normal ratio))))
(f.min +1.0))
luminance])))]
@@ -346,10 +346,10 @@
(-> Color [Color Color Color])
(let [[hue saturation luminance] (to_hsl color)]
[color
- (of_hsl [(|> hue (f.+ <1>) ..normalize)
+ (of_hsl [(|> hue (f.+ <1>) ..normal)
saturation
luminance])
- (of_hsl [(|> hue (f.+ <2>) ..normalize)
+ (of_hsl [(|> hue (f.+ <2>) ..normal)
saturation
luminance])]))]
@@ -363,13 +363,13 @@
(-> Color [Color Color Color Color])
(let [[hue saturation luminance] (to_hsb color)]
[color
- (of_hsb [(|> hue (f.+ <1>) ..normalize)
+ (of_hsb [(|> hue (f.+ <1>) ..normal)
saturation
luminance])
- (of_hsb [(|> hue (f.+ <2>) ..normalize)
+ (of_hsb [(|> hue (f.+ <2>) ..normal)
saturation
luminance])
- (of_hsb [(|> hue (f.+ <3>) ..normalize)
+ (of_hsb [(|> hue (f.+ <3>) ..normal)
saturation
luminance])]))]
@@ -386,9 +386,9 @@
(def: #export (analogous spread variations color)
(-> Spread Nat Color (List Color))
(let [[hue saturation brightness] (to_hsb color)
- spread (..normalize spread)]
+ spread (..normal spread)]
(list\map (function (_ idx)
- (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normalize)
+ (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normal)
saturation
brightness]))
(list.indices variations))))
@@ -396,12 +396,12 @@
(def: #export (monochromatic spread variations color)
(-> Spread Nat Color (List Color))
(let [[hue saturation brightness] (to_hsb color)
- spread (..normalize spread)]
+ spread (..normal spread)]
(|> (list.indices variations)
(list\map (|>> inc .int int.frac
(f.* spread)
(f.+ brightness)
- ..normalize
+ ..normal
[hue saturation]
of_hsb)))))
diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux
index 132aea2e2..73544c26a 100644
--- a/stdlib/source/library/lux/data/format/css/property.lux
+++ b/stdlib/source/library/lux/data/format/css/property.lux
@@ -17,43 +17,43 @@
Color
Location Fit
Slice
- Alignment Animation-Direction
- Animation Animation-Fill
- Column-Fill Column-Span
+ Alignment Animation_Direction
+ Animation Animation_Fill
+ Column_Fill Column_Span
Iteration Count
Play
Timing Visibility Attachment
Blend Span Image
Angle Repeat Border
- Collapse Box-Decoration-Break Caption
+ Collapse Box_Decoration_Break Caption
Float Clear
Content
Cursor
Shadow Clip
- Text-Direction
+ Text_Direction
Display Empty
Filter
- Flex-Direction Flex-Wrap
- Font Font-Kerning Font-Size Font-Variant
- Grid Grid-Content Grid-Flow Grid-Span Grid-Template
- Hanging-Punctuation Hyphens Isolation
- List-Style-Position List-Style-Type
- Overflow Page-Break Pointer-Events
+ Flex_Direction Flex_Wrap
+ Font Font_Kerning Font_Size Font_Variant
+ Grid Grid_Content Grid_Flow Grid_Span Grid_Template
+ Hanging_Punctuation Hyphens Isolation
+ List_Style_Position List_Style_Type
+ Overflow Page_Break Pointer_Events
Position
Quotes
- Resize Scroll-Behavior Table-Layout
- Text-Align Text-Align-Last
- Text-Decoration-Line Text-Decoration-Style
- Text-Justification Text-Overflow Text-Transform
- Transform Transform-Origin Transform-Style
+ Resize Scroll_Behavior Table_Layout
+ Text_Align Text_Align_Last
+ Text_Decoration_Line Text_Decoration_Style
+ Text_Justification Text_Overflow Text_Transform
+ Transform Transform_Origin Transform_Style
Transition
- Bidi User-Select
- Vertical-Align
- White-Space Word-Break Word-Wrap Writing-Mode
- Z-Index)]])
+ Bidi User_Select
+ Vertical_Align
+ White_Space Word_Break Word_Wrap Writing_Mode
+ Z_Index)]])
-(syntax: (text-identifier {identifier s.text})
- (wrap (list (code.local-identifier identifier))))
+(syntax: (text_identifier {identifier s.text})
+ (wrap (list (code.local_identifier (text.replace_all "-" "_" identifier)))))
(abstract: #export (Property brand)
Text
@@ -70,13 +70,13 @@
(~~ (template.spliced <alias>+))))
- (with-expansions [<rows> (template.spliced <property>+)]
- (template [<property>]
- [(`` (def: #export (~~ (text-identifier <property>))
- (Property <brand>)
- (:abstraction <property>)))]
-
- <rows>))]
+ (with_expansions [<rows> (template.spliced <property>+)]
+ (template [<property>]
+ [(`` (def: #export (~~ (text_identifier <property>))
+ (Property <brand>)
+ (:abstraction <property>)))]
+
+ <rows>))]
[All
[]
@@ -131,7 +131,7 @@
[["border-image-slice"]]]
[Color
- [[text-color "color"]]
+ [[text_color "color"]]
[["background-color"]
["border-color"]
["border-bottom-color"]
@@ -154,19 +154,19 @@
[]
[["animation-name"]]]
- [Animation-Direction
+ [Animation_Direction
[]
[["animation-direction"]]]
- [Animation-Fill
+ [Animation_Fill
[]
[["animation-fill-mode"]]]
- [Column-Fill
+ [Column_Fill
[]
[["column-fill"]]]
- [Column-Span
+ [Column_Span
[]
[["column-span"]]]
@@ -263,7 +263,7 @@
[]
[["border-collapse"]]]
- [Box-Decoration-Break
+ [Box_Decoration_Break
[]
[["box-decoration-break"]]]
@@ -293,8 +293,8 @@
[]
[["cursor"]]]
- [Text-Direction
- [[text-direction "direction"]]
+ [Text_Direction
+ [[text_direction "direction"]]
[]]
[Display
@@ -309,11 +309,11 @@
[]
[["filter"]]]
- [Flex-Direction
+ [Flex_Direction
[]
[["flex-direction"]]]
- [Flex-Wrap
+ [Flex_Wrap
[]
[["flex-wrap"]]]
@@ -325,11 +325,11 @@
[]
[["font-family"]]]
- [Font-Kerning
+ [Font_Kerning
[]
[["font-kerning"]]]
- [Font-Size
+ [Font_Size
[]
[["font-size"]]]
@@ -338,7 +338,7 @@
[["font-size-adjust"]
["opacity"]]]
- [Font-Variant
+ [Font_Variant
[]
[["font-variant"]]]
@@ -346,29 +346,29 @@
[]
[["grid-area"]]]
- [Grid-Content
+ [Grid_Content
[]
[["grid-auto-columns"]
["grid-auto-rows"]
["grid-template-columns"]
["grid-template-rows"]]]
- [Grid-Flow
+ [Grid_Flow
[]
[["grid-auto-flow"]]]
- [Grid-Span
+ [Grid_Span
[]
[["grid-column-end"]
["grid-column-start"]
["grid-row-end"]
["grid-row-start"]]]
- [Grid-Template
+ [Grid_Template
[]
[["grid-template-areas"]]]
- [Hanging-Punctuation
+ [Hanging_Punctuation
[]
[["hanging-punctuation"]]]
@@ -380,11 +380,11 @@
[]
[["isolation"]]]
- [List-Style-Position
+ [List_Style_Position
[]
[["list-style-position"]]]
- [List-Style-Type
+ [List_Style_Type
[]
[["list-style-type"]]]
@@ -394,13 +394,13 @@
["overflow-x"]
["overflow-y"]]]
- [Page-Break
+ [Page_Break
[]
[["page-break-after"]
["page-break-before"]
["page-break-inside"]]]
- [Pointer-Events
+ [Pointer_Events
[]
[["pointer-events"]]]
@@ -416,39 +416,39 @@
[]
[["resize"]]]
- [Scroll-Behavior
+ [Scroll_Behavior
[]
[["scroll-behavior"]]]
- [Table-Layout
+ [Table_Layout
[]
[["table-layout"]]]
- [Text-Align
+ [Text_Align
[]
[["text-align"]]]
- [Text-Align-Last
+ [Text_Align_Last
[]
[["text-align-last"]]]
- [Text-Decoration-Line
+ [Text_Decoration_Line
[]
[["text-decoration-line"]]]
- [Text-Decoration-Style
+ [Text_Decoration_Style
[]
[["text-decoration-style"]]]
- [Text-Justification
+ [Text_Justification
[]
[["text-justify"]]]
- [Text-Overflow
+ [Text_Overflow
[]
[["text-overflow"]]]
- [Text-Transform
+ [Text_Transform
[]
[["text-transform"]]]
@@ -456,11 +456,11 @@
[]
[["transform"]]]
- [Transform-Origin
+ [Transform_Origin
[]
[["transform-origin"]]]
- [Transform-Style
+ [Transform_Style
[]
[["transform-style"]]]
@@ -472,31 +472,31 @@
[]
[["unicode-bidi"]]]
- [User-Select
+ [User_Select
[]
[["user-select"]]]
- [Vertical-Align
+ [Vertical_Align
[]
[["vertical-align"]]]
- [White-Space
+ [White_Space
[]
[["white-space"]]]
- [Word-Break
+ [Word_Break
[]
[["word-break"]]]
- [Word-Wrap
+ [Word_Wrap
[]
[["word-wrap"]]]
- [Writing-Mode
+ [Writing_Mode
[]
[["writing-mode"]]]
- [Z-Index
+ [Z_Index
[]
[["z-index"]]]
)
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index 36f9b7796..330f6a907 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -25,8 +25,8 @@
[(abstract: <brand> Any)
(type: #export <generic> (Generic <brand>))]
- [Can-Chain Can-Chain']
- [Cannot-Chain Cannot-Chain']
+ [Can_Chain Can_Chain']
+ [Cannot_Chain Cannot_Chain']
)
(abstract: #export Unique Any)
@@ -41,11 +41,11 @@
(|>> :representation))
(def: #export any
- (Selector Cannot-Chain)
+ (Selector Cannot_Chain)
(:abstraction "*"))
(def: #export tag
- (-> Tag (Selector Cannot-Chain))
+ (-> Tag (Selector Cannot_Chain))
(|>> :abstraction))
(template [<name> <type> <prefix> <kind>]
@@ -54,7 +54,7 @@
(|>> (format <prefix>) :abstraction))]
[id ID "#" Unique]
- [class Class "." Can-Chain]
+ [class Class "." Can_Chain]
)
(template [<right> <left> <combo> <combinator>+]
@@ -67,7 +67,7 @@
(~~ (template.spliced <combinator>+))))]
- [Can-Chain (Generic Any) Can-Chain
+ [Can_Chain (Generic Any) Can_Chain
[["" and]]]
[Unique (Generic Any) Composite
[["" for]]]
@@ -85,17 +85,17 @@
(-> (Selector Any) (Selector Any) (Selector Composite)))
(def: #export (with? attribute)
- (-> Attribute (Selector Can-Chain))
+ (-> Attribute (Selector Can_Chain))
(:abstraction (format "[" attribute "]")))
(template [<check> <name>]
[(def: #export (<name> attribute value)
- (-> Attribute Text (Selector Can-Chain))
+ (-> Attribute Text (Selector Can_Chain))
(:abstraction (format "[" attribute <check> value "]")))]
["=" is?]
["~=" has?]
- ["|=" has-start?]
+ ["|=" has_start?]
["^=" starts?]
["$=" ends?]
["*=" contains?]
@@ -104,34 +104,34 @@
(template [<kind> <pseudo>+]
[(`` (template [<name> <pseudo>]
[(def: #export <name>
- (Selector Can-Chain)
+ (Selector Can_Chain)
(:abstraction <pseudo>))]
(~~ (template.spliced <pseudo>+))))]
- [Can-Chain
+ [Can_Chain
[[active ":active"]
[checked ":checked"]
[default ":default"]
[disabled ":disabled"]
[empty ":empty"]
[enabled ":enabled"]
- [first-child ":first-child"]
- [first-of-type ":first-of-type"]
+ [first_child ":first-child"]
+ [first_of_type ":first-of-type"]
[focused ":focus"]
[hovered ":hover"]
- [in-range ":in-range"]
+ [in_range ":in-range"]
[indeterminate ":indeterminate"]
[invalid ":invalid"]
- [last-child ":last-child"]
- [last-of-type ":last-of-type"]
+ [last_child ":last-child"]
+ [last_of_type ":last-of-type"]
[link ":link"]
- [only-of-type ":only-of-type"]
- [only-child ":only-child"]
+ [only_of_type ":only-of-type"]
+ [only_child ":only-child"]
[optional ":optional"]
- [out-of-range ":out-of-range"]
- [read-only ":read-only"]
- [read-write ":read-write"]
+ [out_of_range ":out-of-range"]
+ [read_only ":read-only"]
+ [read_write ":read-write"]
[required ":required"]
[root ":root"]
[target ":target"]
@@ -141,14 +141,14 @@
[Specific
[[after "::after"]
[before "::before"]
- [first-letter "::first-letter"]
- [first-line "::first-line"]
+ [first_letter "::first-letter"]
+ [first_line "::first-line"]
[placeholder "::placeholder"]
[selection "::selection"]]]
)
(def: #export (language locale)
- (-> Locale (Selector Can-Chain))
+ (-> Locale (Selector Can_Chain))
(|> locale
locale.code
(text.enclose ["(" ")"])
@@ -156,7 +156,7 @@
:abstraction))
(def: #export not
- (-> (Selector Any) (Selector Can-Chain))
+ (-> (Selector Any) (Selector Can_Chain))
(|>> :representation
(text.enclose ["(" ")"])
(format ":not")
@@ -190,16 +190,16 @@
(template [<name> <pseudo>]
[(def: #export (<name> index)
- (-> Index (Selector Can-Chain))
+ (-> Index (Selector Can_Chain))
(|> (:representation index)
(text.enclose ["(" ")"])
(format <pseudo>)
(:abstraction Selector)))]
- [nth-child ":nth-child"]
- [nth-last-child ":nth-last-child"]
- [nth-last-of-type ":nth-last-of-type"]
- [nth-of-type ":nth-of-type"]
+ [nth_child ":nth-child"]
+ [nth_last_child ":nth-last-child"]
+ [nth_last_of_type ":nth-last-of-type"]
+ [nth_of_type ":nth-of-type"]
)
)
)
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 7cbf607ce..6cd460f9d 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -49,21 +49,21 @@
#Top "_top"
(#Frame name) name))
-(def: sanitize
+(def: safe
{#.doc "Properly formats text to ensure no injection can happen on the HTML."}
(-> Text Text)
- (|>> (text.replace-all "&" "&amp;")
- (text.replace-all "<" "&lt;")
- (text.replace-all ">" "&gt;")
- (text.replace-all text.double-quote "&quot;")
- (text.replace-all "'" "&#x27;")
- (text.replace-all "/" "&#x2F;")))
+ (|>> (text.replace_all "&" "&amp;")
+ (text.replace_all "<" "&lt;")
+ (text.replace_all ">" "&gt;")
+ (text.replace_all text.double_quote "&quot;")
+ (text.replace_all "'" "&#x27;")
+ (text.replace_all "/" "&#x2F;")))
(def: attributes
(-> Attributes Text)
(|>> (list\map (function (_ [key val])
- (format key "=" text.double-quote (..sanitize val) text.double-quote)))
- (text.join-with " ")))
+ (format key "=" text.double_quote (..safe val) text.double_quote)))
+ (text.join_with " ")))
(def: (open tag attributes)
(-> Tag Attributes Text)
@@ -97,13 +97,13 @@
[Document Document']
)
- (template [<super> <super-raw> <sub>+]
- [(abstract: #export (<super-raw> brand) Any)
- (type: #export <super> (HTML (<super-raw> Any)))
+ (template [<super> <super_raw> <sub>+]
+ [(abstract: #export (<super_raw> brand) Any)
+ (type: #export <super> (HTML (<super_raw> Any)))
- (`` (template [<sub> <sub-raw>]
- [(abstract: #export <sub-raw> Any)
- (type: #export <sub> (HTML (<super-raw> <sub-raw>)))]
+ (`` (template [<sub> <sub_raw>]
+ [(abstract: #export <sub_raw> Any)
+ (type: #export <sub> (HTML (<super_raw> <sub_raw>)))]
(~~ (template.spliced <sub>+))))]
@@ -193,7 +193,7 @@
(def: #export text
(-> Text Content)
- (|>> ..sanitize
+ (|>> ..safe
:abstraction))
(template [<tag> <alias> <name>]
@@ -202,8 +202,8 @@
(..simple <tag> (list)))
(def: #export <alias> <name>)]
- ["br" br line-break]
- ["wbr" wbr word-break]
+ ["br" br line_break]
+ ["wbr" wbr word_break]
["hr" hr separator]
)
@@ -223,12 +223,12 @@
{#horizontal Nat
#vertical Nat})
- (def: metric-separator ",")
- (def: coord-separator ",")
+ (def: metric_separator ",")
+ (def: coord_separator ",")
(def: (%coord [horizontal vertical])
(Format Coord)
- (format (%.nat horizontal) ..metric-separator (%.nat vertical)))
+ (format (%.nat horizontal) ..metric_separator (%.nat vertical)))
(type: #export Rectangle
{#start Coord
@@ -246,17 +246,17 @@
(def: (%rectangle [start end])
(Format Rectangle)
- (format (%coord start) ..coord-separator (%coord end)))
+ (format (%coord start) ..coord_separator (%coord end)))
(def: (%circle [center radius])
(Format Circle)
- (format (%coord center) ..metric-separator (%.nat radius)))
+ (format (%coord center) ..metric_separator (%.nat radius)))
(def: (%polygon [first second third extra])
(Format Polygon)
(|> (list& first second third extra)
(list\map %coord)
- (text.join-with ..coord-separator)))
+ (text.join_with ..coord_separator)))
(type: #export Shape
(#Rectangle Rectangle)
@@ -312,10 +312,10 @@
)
(template [<name> <tag>]
- [(def: #export (<name> attributes media on-unsupported)
+ [(def: #export (<name> attributes media on_unsupported)
(-> Attributes Media (Maybe Content) Element)
(..tag <tag> attributes
- (|> on-unsupported
+ (|> on_unsupported
(maybe.default (..text ""))
(..and media))))]
@@ -335,21 +335,21 @@
(-> ID Input)
(|>> ["for"] list (..empty "label")))
- (template [<name> <container-tag> <description-tag> <type>]
+ (template [<name> <container_tag> <description_tag> <type>]
[(def: #export (<name> description attributes content)
(-> (Maybe Content) Attributes <type> <type>)
- (..tag <container-tag> attributes
+ (..tag <container_tag> attributes
(case description
(#.Some description)
($_ ..and
- (..tag <description-tag> (list) description)
+ (..tag <description_tag> (list) description)
content)
#.None
content)))]
[details "details" "summary" Element]
- [field-set "fieldset" "legend" Input]
+ [field_set "fieldset" "legend" Input]
[figure "figure" "figcaption" Element]
)
@@ -360,7 +360,7 @@
(maybe.default (..text ""))
(..tag <tag> attributes)))]
- [text-area "textarea" Input]
+ [text_area "textarea" Input]
[iframe "iframe" Element]
)
@@ -372,7 +372,7 @@
(..tag <tag>))]
[abbrebiation "abbr"]
- [block-quote "blockquote"]
+ [block_quote "blockquote"]
[bold "b"]
[cite "cite"]
[code "code"]
@@ -405,7 +405,7 @@
(def: #export incorrect ..struck)
- (def: (ruby-pronunciation pronunciation)
+ (def: (ruby_pronunciation pronunciation)
(-> Content (HTML Any))
(..tag "rt" (list)
($_ ..and
@@ -418,9 +418,10 @@
(..tag "ruby" attributes
($_ ..and
content
- (ruby-pronunciation pronunciation))))
+ (ruby_pronunciation pronunciation))))
- (type: #export Composite (-> Attributes Element Element))
+ (type: #export Composite
+ (-> Attributes Element Element))
(template [<name> <tag>]
[(def: #export <name>
@@ -449,7 +450,7 @@
["dd" description Element]
)
- (def: #export (description-list attributes descriptions)
+ (def: #export (description_list attributes descriptions)
(-> Attributes (List [Content Element]) Element)
(case (list\map (function (_ [term description])
($_ ..and
@@ -472,11 +473,11 @@
[button "button" Element Input]
[item "li" Element Item]
- [ordered-list "ol" Item Element]
- [unordered-list "ul" Item Element]
+ [ordered_list "ol" Item Element]
+ [unordered_list "ul" Item Element]
[option "option" Content Option]
- [option-group "optgroup" Option Option]
- [data-list "datalist" Option Element]
+ [option_group "optgroup" Option Option]
+ [data_list "datalist" Option Element]
[select "select" Option Input]
[address "address" Element Element]
[form "form" Input Element]
@@ -490,10 +491,10 @@
(..tag <tag> (list)))]
[title "title" Content Meta]
- [no-script "noscript" Content Meta]
+ [no_script "noscript" Content Meta]
[template "template" (HTML Any) (HTML Nothing)]
- [table-header "th" Element Header]
- [table-cell "td" Element Cell]
+ [table_header "th" Element Header]
+ [table_cell "td" Element Cell]
[head "head" Meta Head]
[body "body" Element Body]
)
@@ -503,23 +504,23 @@
(-> <input> <output>)
(..tag <tag> (list)))]
- [table-row "tr" (HTML Any) Row]
- [table-head "thead" Row HTML]
- [table-body "tbody" Row HTML]
- [table-foot "tfoot" Row HTML]
- [columns-group "colgroup" Column HTML]
+ [table_row "tr" (HTML Any) Row]
+ [table_head "thead" Row HTML]
+ [table_body "tbody" Row HTML]
+ [table_foot "tfoot" Row HTML]
+ [columns_group "colgroup" Column HTML]
)
(def: #export (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\map table-row rows)
+ (let [head (..table_head (..table_row headers))
+ content (case (list\map table_row rows)
#.Nil
head
(#.Cons first rest)
(..and head
- (..table-body
+ (..table_body
(list\fold (function.flip ..and) first rest))))
content (case footer
#.None
@@ -527,13 +528,13 @@
(#.Some footer)
(..and content
- (..table-foot (..table-row footer))))
+ (..table_foot (..table_row footer))))
content (case columns
#.None
content
(#.Some columns)
- (..and (..columns-group columns)
+ (..and (..columns_group columns)
content))
content (case caption
#.None
@@ -545,19 +546,19 @@
(..tag "table" attributes
content)))
- (template [<name> <doc-type>]
+ (template [<name> <doc_type>]
[(def: #export <name>
(-> Head Body Document)
- (let [doc-type <doc-type>]
+ (let [doc_type <doc_type>]
(function (_ head body)
(|> (..tag "html" (list) (..and head body))
:representation
- (format doc-type)
+ (format doc_type)
:abstraction))))]
- [html-5 "<!DOCTYPE html>"]
- [html-4_01 (format "<!DOCTYPE HTML PUBLIC " text.double-quote "-//W3C//DTD HTML 4.01//EN" text.double-quote " " text.double-quote "http://www.w3.org/TR/html4/strict.dtd" text.double-quote ">")]
- [xhtml-1_0 (format "<!DOCTYPE html PUBLIC " text.double-quote "-//W3C//DTD XHTML 1.0 Strict//EN" text.double-quote " " text.double-quote "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" text.double-quote ">")]
- [xhtml-1_1 (format "<!DOCTYPE html PUBLIC " text.double-quote "-//W3C//DTD XHTML 1.1//EN" text.double-quote " " text.double-quote "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" text.double-quote ">")]
+ [html/5 "<!DOCTYPE html>"]
+ [html/4_01 (format "<!DOCTYPE HTML PUBLIC " text.double_quote "-//W3C//DTD HTML 4.01//EN" text.double_quote " " text.double_quote "http://www.w3.org/TR/html4/strict.dtd" text.double_quote ">")]
+ [xhtml/1_0 (format "<!DOCTYPE html PUBLIC " text.double_quote "-//W3C//DTD XHTML 1.0 Strict//EN" text.double_quote " " text.double_quote "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" text.double_quote ">")]
+ [xhtml/1_1 (format "<!DOCTYPE html PUBLIC " text.double_quote "-//W3C//DTD XHTML 1.1//EN" text.double_quote " " text.double_quote "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" text.double_quote ">")]
)
)
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 638048599..30903df3c 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -99,7 +99,7 @@
(wrap (` [(~ (code.text key_name)) (~ (wrapper value))]))
_
- (meta.fail "Wrong syntax for JSON object.")))
+ (meta.failure "Wrong syntax for JSON object.")))
pairs)]
(wrap (list (` (: JSON (#..Object ((~! dictionary.of_list)
(~! text.hash)
@@ -208,17 +208,17 @@
############################################################
############################################################
-(def: (format_null _)
+(def: (null_format _)
(-> Null Text)
"null")
-(def: format_boolean
+(def: boolean_format
(-> Boolean Text)
(|>> (case>
#0 "false"
#1 "true")))
-(def: format_number
+(def: number_format
(-> Number Text)
(|>> (case>
(^or +0.0 -0.0) "0.0"
@@ -230,7 +230,7 @@
(def: escape "\")
(def: escaped_dq (text\compose ..escape text.double_quote))
-(def: format_string
+(def: string_format
(-> String Text)
(|>> (text.replace_all text.double_quote ..escaped_dq)
(text.enclose [text.double_quote text.double_quote])))
@@ -250,25 +250,25 @@
["}" close_object]
)
-(def: (format_array format)
+(def: (array_format format)
(-> (-> JSON Text) (-> Array Text))
(|>> (row\map format)
row.to_list
(text.join_with ..separator)
(text.enclose [..open_array ..close_array])))
-(def: (format_kv format [key value])
+(def: (kv_format format [key value])
(-> (-> JSON Text) (-> [String JSON] Text))
($_ text\compose
- (..format_string key)
+ (..string_format key)
..entry_separator
(format value)
))
-(def: (format_object format)
+(def: (object_format format)
(-> (-> JSON Text) (-> Object Text))
(|>> dictionary.entries
- (list\map (..format_kv format))
+ (list\map (..kv_format format))
(text.join_with ..separator)
(text.enclose [..open_object ..close_object])))
@@ -278,12 +278,12 @@
(^template [<tag> <format>]
[(<tag> value)
(<format> value)])
- ([#Null ..format_null]
- [#Boolean ..format_boolean]
- [#Number ..format_number]
- [#String ..format_string]
- [#Array (..format_array format)]
- [#Object (..format_object format)])
+ ([#Null ..null_format]
+ [#Boolean ..boolean_format]
+ [#Number ..number_format]
+ [#String ..string_format]
+ [#Array (..array_format format)]
+ [#Object (..object_format format)])
))
############################################################
@@ -341,7 +341,7 @@
(wrap ($_ text\compose mark (if signed?' "-" "") offset))))]
(case (f\decode ($_ text\compose (if signed? "-" "") digits "." decimals exp))
(#try.Failure message)
- (<>.fail message)
+ (<>.failure message)
(#try.Success value)
(wrap value))))
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 5dba35fed..68af40458 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -13,7 +13,7 @@
## https://www.markdownguide.org/basic-syntax/
-(def: sanitize
+(def: safe
(-> Text Text)
(|>> (text.replace_all "\" "\\")
(text.replace_all "`" "\`")
@@ -43,7 +43,7 @@
(def: #export text
(-> Text (Markdown Span))
- (|>> ..sanitize :abstraction))
+ (|>> ..safe :abstraction))
(def: blank_line
(format text.new_line text.new_line))
@@ -51,7 +51,7 @@
(template [<name> <prefix>]
[(def: #export (<name> content)
(-> Text Markdown)
- (:abstraction (format <prefix> " " (..sanitize content) ..blank_line)))]
+ (:abstraction (format <prefix> " " (..safe content) ..blank_line)))]
[heading/1 "#"]
[heading/2 "##"]
@@ -135,7 +135,7 @@
(def: #export snippet
{#.doc "A snippet of code."}
(-> Text (Markdown Span))
- (|>> ..sanitize (text.enclose ["`" "`"]) :abstraction))
+ (|>> ..safe (text.enclose ["`" "`"]) :abstraction))
(def: #export code
{#.doc "A block of code."}
@@ -146,7 +146,7 @@
(def: #export (image description url)
(-> Text URL (Markdown Span))
- (:abstraction (format "![" (..sanitize description) "](" url ")")))
+ (:abstraction (format "![" (..safe description) "](" url ")")))
(def: #export horizontal_rule
(Markdown Block)
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index 867b24cb6..7dd861762 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -292,7 +292,7 @@
(\ (dictionary.equivalence text.equivalence) = reference/attrs sample/attrs)
(n.= (list.size reference/children)
(list.size sample/children))
- (|> (list.zip/2 reference/children sample/children)
+ (|> (list.zipped/2 reference/children sample/children)
(list.every? (product.uncurry =))))
_
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 1002859cc..08724a881 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -241,4 +241,4 @@
(wrap (list (code.text un_escaped)))
(#try.Failure error)
- (meta.fail error)))
+ (meta.failure error)))
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 506dca6ab..c390e1c08 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -466,8 +466,8 @@
(case (<t>.run (regex^ current_module)
pattern)
(#try.Failure error)
- (meta.fail (format "Error while parsing regular-expression:" //.new_line
- error))
+ (meta.failure (format "Error while parsing regular-expression:" //.new_line
+ error))
(#try.Success regex)
(wrap (list regex))
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 93506c541..4ca51d344 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -129,18 +129,18 @@
(#.Cons member (recur (inc idx))))))))}
(as_is))
-(def: (inspect_tuple inspect)
+(def: (tuple_inspection inspection)
(-> Inspector Inspector)
(with_expansions [<adaption> (for {@.lua (~~ (as_is ..tuple_array))}
(~~ (as_is)))]
(`` (|>> (:as (array.Array Any))
<adaption>
array.to_list
- (list\map inspect)
+ (list\map inspection)
(text.join_with " ")
(text.enclose ["[" "]"])))))
-(def: #export (inspect value)
+(def: #export (inspection value)
Inspector
(with_expansions [<jvm> (let [object (:as java/lang/Object value)]
(`` (<| (~~ (template [<class> <processing>]
@@ -170,11 +170,11 @@
#.None #0)]
(|> (%.format (%.nat (.nat (java/lang/Integer::longValue tag)))
" " (%.bit last?)
- " " (inspect choice))
+ " " (inspection choice))
(text.enclose ["(" ")"])))
_
- (inspect_tuple inspect value)))
+ (tuple_inspection inspection value)))
#.None)
(java/lang/Object::toString object))))]
(for {@.old <jvm>
@@ -199,7 +199,7 @@
("js object undefined?" variant_value)))
(|> (%.format (JSON::stringify variant_tag)
" " (%.bit (not ("js object null?" variant_flag)))
- " " (inspect variant_value))
+ " " (inspection variant_value))
(text.enclose ["(" ")"]))
(not (or ("js object undefined?" ("js object get" "_lux_low" value))
@@ -207,7 +207,7 @@
(|> value (:as .Int) %.int)
(Array::isArray value)
- (inspect_tuple inspect value)
+ (tuple_inspection inspection value)
## else
(JSON::stringify value)))
@@ -227,7 +227,7 @@
["<type 'unicode'>" "<class 'unicode'>" [(:as .Text) %.text]])
(^or "<type 'list'>" "<class 'list'>")
- (inspect_tuple inspect value)
+ (tuple_inspection inspection value)
(^or "<type 'tuple'>" "<type 'tuple'>")
(let [variant (:as (array.Array Any) value)]
@@ -240,7 +240,7 @@
(..str value)
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (|> variant_flag "python object none?" not %.bit)
- " " (inspect variant_value))
+ " " (inspection variant_value))
(text.enclose ["(" ")"]))))
_ (..str value)))
@@ -270,10 +270,10 @@
variant_value ("lua object get" "_lux_value" value)]
(if (or ("lua object nil?" variant_tag)
("lua object nil?" variant_value))
- (inspect_tuple inspect value)
+ (tuple_inspection inspection value)
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("lua object nil?" variant_flag)))
- " " (inspect variant_value))
+ " " (inspection variant_value))
(text.enclose ["(" ")"]))))
_
@@ -308,14 +308,14 @@
variant_value ("ruby object get" "_lux_value" value)]
(if (or ("ruby object nil?" variant_tag)
("ruby object nil?" variant_value))
- (inspect_tuple inspect value)
+ (tuple_inspection inspection value)
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("ruby object nil?" variant_flag)))
- " " (inspect variant_value))
+ " " (inspection variant_value))
(text.enclose ["(" ")"]))))
(is? (class_of [[] []]) value_class)
- (inspect_tuple inspect value)
+ (tuple_inspection inspection value)
## else
(to_s value)))))
@@ -330,7 +330,7 @@
["double" [(:as .Frac) %.frac]]
["string" [(:as .Text) %.text]]
["NULL" [(new> "null" [])]]
- ["array" [(inspect_tuple inspect)]])
+ ["array" [(tuple_inspection inspection)]])
"object"
(let [variant_tag ("php object get" "_lux_tag" value)
@@ -341,7 +341,7 @@
(..strval value)
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("php object null?" variant_flag)))
- " " (inspect variant_value))
+ " " (inspection variant_value))
(text.enclose ["(" ")"]))))
_
@@ -357,7 +357,7 @@
[..real? [(:as .Frac) %.frac]]
[..string? [(:as .Text) %.text]]
["scheme object nil?" [(new> "()" [])]]
- [..vector? [(inspect_tuple inspect)]]))
+ [..vector? [(tuple_inspection inspection)]]))
(..pair? value)
(let [variant_tag (..car value)
@@ -369,7 +369,7 @@
variant_value (..cdr variant_rest)]
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("scheme object nil?" variant_flag)))
- " " (inspect variant_value))
+ " " (inspection variant_value))
(text.enclose ["(" ")"])))
(..format ["~s" value])))
@@ -485,7 +485,7 @@
(%.format (headR leftV) " " (recur tailR rightV)))))]
(%.format "[" tuple_body "]"))))))
-(def: representation
+(def: representation_parser
(Parser Representation)
(<>.rec
(function (_ representation)
@@ -502,18 +502,18 @@
(<type>.local (list outputT) representation)
#.None
- (<>.fail "")))
+ (<>.failure "")))
(do <>.monad
[[name anonymous] <type>.named]
(<type>.local (list anonymous) representation))
- (<>.fail "")
+ (<>.failure "")
))))
-(def: #export (represent type value)
+(def: #export (representation type value)
(-> Type Any (Try Text))
- (case (<type>.run ..representation type)
+ (case (<type>.run ..representation_parser type)
(#try.Success representation)
(#try.Success (representation value))
@@ -589,7 +589,7 @@
(~+ (list\map (function (_ [name format])
(let [format (case format
#.None
- (` (~! ..inspect))
+ (` (~! ..inspection))
(#.Some format)
format)]
diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux
index 5cad0158c..23be093ac 100644
--- a/stdlib/source/library/lux/extension.lux
+++ b/stdlib/source/library/lux/extension.lux
@@ -79,7 +79,7 @@
(~ body)
(#.Left (~ g!error))
- ((~! phase.fail) (~ g!error)))
+ ((~! phase.failure) (~ g!error)))
))))))))]
[<c>.any <c>.end! <c>.and <c>.run "lux def analysis" analysis:]
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index 6b45f2fbe..76983acd5 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -466,7 +466,7 @@
(<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))]
(wrap (` ("jvm member invoke constructor" (~ (code.text class_name))
(~+ (|> args
- (list.zip/2 (list\map product.right arguments))
+ (list.zipped/2 (list\map product.right arguments))
(list\map ..decorate_input))))))))
(def: (make_static_method_parser class_name method_name arguments)
@@ -478,7 +478,7 @@
(<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))]
(wrap (` ("jvm member invoke static" (~ (code.text class_name)) (~ (code.text method_name))
(~+ (|> args
- (list.zip/2 (list\map product.right arguments))
+ (list.zipped/2 (list\map product.right arguments))
(list\map ..decorate_input))))))))
(template [<name> <jvm_op>]
@@ -492,7 +492,7 @@
(wrap (` (<jvm_op> (~ (code.text class_name)) (~ (code.text method_name))
(~ (code.local_identifier self_name))
(~+ (|> args
- (list.zip/2 (list\map product.right arguments))
+ (list.zipped/2 (list\map product.right arguments))
(list\map ..decorate_input))))))))]
[make_special_method_parser "jvm member invoke special"]
@@ -574,7 +574,7 @@
(<>\wrap (list)))
(<code>.form (<>.and <code>.local_identifier
(<>.some (parameter^ type_vars))))))]
- (wrap (type.class (name.sanitize name) parameters))))
+ (wrap (type.class (name.safe name) parameters))))
(exception: #export (unexpected_type_variable {name Text}
{type_vars (List (Type Var))})
@@ -1141,7 +1141,7 @@
(~ (code.text name))
(~ (code.local_identifier self_name))
(~+ (|> args
- (list.zip/2 (list\map product.right arguments))
+ (list.zipped/2 (list\map product.right arguments))
(list\map ..decorate_input)))))))))]
(` ("override"
(~ (declaration$ declaration))
@@ -1159,7 +1159,7 @@
)))
(#StaticMethod strict_fp? type_vars arguments return_type body exs)
- (let [replacer (parser->replacer (<>.fail ""))]
+ (let [replacer (parser->replacer (<>.failure ""))]
(` ("static"
(~ (code.text name))
(~ (privacy_modifier$ pm))
@@ -1247,7 +1247,7 @@
method_parser (: (Parser Code)
(|> methods
(list\map (method->parser fully_qualified_class_name))
- (list\fold <>.either (<>.fail ""))))]]
+ (list\fold <>.either (<>.failure ""))))]]
(wrap (list (` ("jvm class"
(~ (declaration$ (type.declaration full_class_name class_vars)))
(~ (class$ super))
@@ -1297,7 +1297,7 @@
(~ (class$ super))
[(~+ (list\map class$ interfaces))]
[(~+ (list\map constructor_arg$ constructor_args))]
- [(~+ (list\map (method_def$ "" (<>.fail "") super (list)) methods))])))))
+ [(~+ (list\map (method_def$ "" (<>.failure "") super (list)) methods))])))))
(syntax: #export (null)
{#.doc (doc "Null object reference."
@@ -1551,7 +1551,7 @@
(def: (jvm_invoke_inputs mode classes inputs)
(-> Primitive_Mode (List (Type Value)) (List [Bit Code]) (List Code))
(|> inputs
- (list.zip/2 classes)
+ (list.zipped/2 classes)
(list\map (function (_ [class [maybe? input]])
(|> (if maybe?
(` (: (.primitive (~ (code.text (..reflection class))))
@@ -1598,7 +1598,7 @@
(~ (code.text full_name))
[(~+ (list\map ..var$ (get@ #import_member_tvars commons)))]
(~+ (|> (jvm_invoke_inputs (get@ #import_member_mode commons) input_jvm_types arg_function_inputs)
- (list.zip/2 input_jvm_types)
+ (list.zipped/2 input_jvm_types)
(list\map ..decorate_input)))))]
(auto_convert_output (get@ #import_member_mode commons))
(decorate_return_maybe member true classT)
@@ -1638,10 +1638,10 @@
[(~+ (list\map ..var$ (get@ #import_member_tvars commons)))]
(~+ (|> object_ast
(list\map ..un_quote)
- (list.zip/2 (list (type.class full_name (list))))
+ (list.zipped/2 (list (type.class full_name (list))))
(list\map (auto_convert_input (get@ #import_member_mode commons)))))
(~+ (|> (jvm_invoke_inputs (get@ #import_member_mode commons) input_jvm_types arg_function_inputs)
- (list.zip/2 input_jvm_types)
+ (list.zipped/2 input_jvm_types)
(list\map ..decorate_input))))))
jvm_interop (: Code
(case (type.void? method_return)
@@ -1738,7 +1738,7 @@
#Class))
(#.Left _)
- (meta.fail (format "Unknown class: " class_name)))))
+ (meta.failure (format "Unknown class: " class_name)))))
(syntax: #export (import:
{declaration ..declaration^}
@@ -1781,13 +1781,13 @@
"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-vars."
"Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes)."
- (import: (lux/concurrency/promise/JvmPromise A)
+ (import: (lux/concurrency/async/JvmAsync A)
["#::."
(resolve [A] boolean)
(poll [] A)
(wasResolved [] boolean)
(waitOn [lux/Function] void)
- (#static [A] make [A] (lux/concurrency/promise/JvmPromise A))])
+ (#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 [])
@@ -1833,7 +1833,7 @@
(exception.report
["Lux Type" (%.type type)]))
-(with_expansions [<failure> (as_is (meta.fail (exception.construct ..cannot_convert_to_jvm_type [type])))]
+(with_expansions [<failure> (as_is (meta.failure (exception.construct ..cannot_convert_to_jvm_type [type])))]
(def: (lux_type->jvm_type type)
(-> .Type (Meta (Type Value)))
(if (lux_type\= .Any type)
@@ -2059,4 +2059,4 @@
("jvm object cast" (~ object))))))
_
- (meta.fail (exception.construct ..cannot_cast_to_non_object [type]))))
+ (meta.failure (exception.construct ..cannot_cast_to_non_object [type]))))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 5b4d49084..a023d3afe 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -264,7 +264,7 @@
_
#.None))
-(def: sanitize
+(def: safe
(-> Text Text)
(text.replace_all "/" "."))
@@ -283,7 +283,7 @@
output
[[name params] _ _]
- (let [name (sanitize name)
+ (let [name (safe name)
=params (list\map (class_to_type' mode type_params in_array?) params)]
(` (primitive (~ (code.text name)) [(~+ =params)])))))
@@ -335,7 +335,7 @@
(#.Cons bound1 _)
(class_to_type #ManualPrM class_params bound1))))
class_params)]
- (` (primitive (~ (code.text (sanitize class_name)))
+ (` (primitive (~ (code.text (safe class_name)))
[(~+ =params)]))))
(def: type_var_class Text "java.lang.Object")
@@ -361,7 +361,7 @@
(simple_class$ env upper_bound)
(#GenericClass name env)
- (sanitize name)
+ (safe name)
(#GenericArray param')
(case param'
@@ -987,7 +987,7 @@
name
(#GenericClass name params)
- (format "(" (sanitize name) " " (spaced (list\map generic_type$ params)) ")")
+ (format "(" (safe name) " " (spaced (list\map generic_type$ params)) ")")
(#GenericArray param)
(format "(" array.type_name " " (generic_type$ param) ")")
@@ -1004,11 +1004,11 @@
(def: (class_decl$ (^open "."))
(-> Class_Declaration JVM_Code)
- (format "(" (sanitize class_name) " " (spaced (list\map type_param$ class_params)) ")"))
+ (format "(" (safe class_name) " " (spaced (list\map type_param$ class_params)) ")"))
(def: (super_class_decl$ (^slots [#super_class_name #super_class_params]))
(-> Super_Class_Decl JVM_Code)
- (format "(" (sanitize super_class_name) " " (spaced (list\map generic_type$ super_class_params)) ")"))
+ (format "(" (safe super_class_name) " " (spaced (list\map generic_type$ super_class_params)) ")"))
(def: (method_decl$ [[name pm anns] method_decl])
(-> [Member_Declaration MethodDecl] JVM_Code)
@@ -1209,11 +1209,11 @@
)}
(do meta.monad
[current_module meta.current_module_name
- #let [fully_qualified_class_name (format (sanitize current_module) "." full_class_name)
+ #let [fully_qualified_class_name (format (safe current_module) "." full_class_name)
field_parsers (list\map (field_to_parser fully_qualified_class_name) fields)
method_parsers (list\map (method_to_parser (product.right class_decl) fully_qualified_class_name) methods)
replacer (parser_to_replacer (list\fold <>.either
- (<>.fail "")
+ (<>.failure "")
(list\compose field_parsers method_parsers)))
def_code (format "jvm class:"
(spaced (list (class_decl$ class_decl)
@@ -1362,7 +1362,7 @@
{#..jvm_class (~ (code.text full_name))}
Type
(All [(~+ params')]
- (primitive (~ (code.text (sanitize full_name)))
+ (primitive (~ (code.text (safe full_name)))
[(~+ params')]))))))
(def: (member_type_vars class_tvars member)
@@ -1483,7 +1483,7 @@
(if maybe?
(` ((~! !!!) (~ (un_quote input))))
(un_quote input))))
- (list.zip/2 classes)
+ (list.zipped/2 classes)
(list\map (auto_convert_input mode))))
(def: (import_name format class member)
@@ -1495,7 +1495,7 @@
(def: (member_def_interop type_params kind class [arg_function_inputs arg_classes arg_types] member method_prefix import_format)
(-> (List Type_Parameter) Class_Kind Class_Declaration [(List [Bit Code]) (List Text) (List Code)] Import_Member_Declaration Text Text (Meta (List Code)))
(let [[full_name class_tvars] class
- full_name (sanitize full_name)
+ full_name (safe full_name)
all_params (|> (member_type_vars class_tvars member)
(list.only free_type_param?)
(list\map type_param_to_type_arg))]
@@ -1641,7 +1641,7 @@
(def: (class_kind [class_name _])
(-> Class_Declaration (Meta Class_Kind))
- (let [class_name (..sanitize class_name)]
+ (let [class_name (..safe class_name)]
(case (..load_class class_name)
(#try.Success class)
(\ meta.monad wrap (if (interface? class)
@@ -1649,8 +1649,8 @@
#Class))
(#try.Failure error)
- (meta.fail (format "Cannot load class: " class_name text.new_line
- error)))))
+ (meta.failure (format "Cannot load class: " class_name text.new_line
+ error)))))
(syntax: #export (import:
{class_decl ..class_decl^}
@@ -1692,13 +1692,13 @@
"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/promise/JvmPromise A)
+ (import: (lux/concurrency/async/JvmAsync A)
["#::."
(resolve [A] boolean)
(poll [] A)
(wasResolved [] boolean)
(waitOn [lux/Function] void)
- (#static [A] make [A] (lux/concurrency/promise/JvmPromise A))])
+ (#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 [])
@@ -1751,7 +1751,7 @@
(#.Apply A F)
(case (type.applied (list A) F)
#.None
- (meta.fail (format "Cannot apply type: " (type.format F) " to " (type.format A)))
+ (meta.failure (format "Cannot apply type: " (type.format F) " to " (type.format A)))
(#.Some type')
(type_to_class_name type'))
@@ -1760,7 +1760,7 @@
(type_to_class_name type')
_
- (meta.fail (format "Cannot convert to JvmType: " (type.format type))))))
+ (meta.failure (format "Cannot convert to JvmType: " (type.format type))))))
(syntax: #export (array_read idx array)
{#.doc (doc "Loads an element from an array."
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index 0c72af316..275401a61 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -99,7 +99,7 @@
(wrap [left right])
_
- (//.fail "Record members must expand into singletons.")))))
+ (//.failure "Record members must expand into singletons.")))))
(\ //.monad map (|>> code.record list)))
_
@@ -123,7 +123,7 @@
(\ //.monad wrap name)
_
- (//.fail (text\compose "Code is not a local identifier: " (code.format ast)))))
+ (//.failure (text\compose "Code is not a local identifier: " (code.format ast)))))
(def: #export wrong_syntax_error
(-> Name Text)
@@ -152,7 +152,7 @@
(~ body))))))
_
- (//.fail (..wrong_syntax_error (name_of ..with_gensyms)))))
+ (//.failure (..wrong_syntax_error (name_of ..with_gensyms)))))
(def: #export (expand_1 token)
{#.doc "Works just like expand, except that it ensures that the output is a single Code token."}
@@ -164,7 +164,7 @@
(wrap token')
_
- (//.fail "Macro expanded to more than 1 element."))))
+ (//.failure "Macro expanded to more than 1 element."))))
(template [<macro> <func>]
[(macro: #export (<macro> tokens)
@@ -202,7 +202,7 @@
output)))
#.None
- (//.fail (..wrong_syntax_error macro_name)))))]
+ (//.failure (..wrong_syntax_error macro_name)))))]
[log_expand_once! ..expand_once]
[log_expand! ..expand]
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index 4eb9c35c6..1fc16815f 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -50,7 +50,7 @@
(def: (push_one [name macro])
(-> [Name Macro] (Meta Any))
(do meta.monad
- [[module_name definition_name] (meta.normalize name)
+ [[module_name definition_name] (meta.normal name)
#let [definition (: Global (#.Definition [false .Macro (' {}) macro]))
add_macro! (: (-> (PList Global) (PList Global))
(plist.put definition_name definition))]]
@@ -67,7 +67,7 @@
(def: (pop_one name)
(-> Name (Meta Any))
(do meta.monad
- [[module_name definition_name] (meta.normalize name)
+ [[module_name definition_name] (meta.normal name)
#let [remove_macro! (: (-> (PList Global) (PList Global))
(plist.remove definition_name))]]
(..with_module module_name
diff --git a/stdlib/source/library/lux/macro/poly.lux b/stdlib/source/library/lux/macro/poly.lux
index b40f29a8c..a9f4a5744 100644
--- a/stdlib/source/library/lux/macro/poly.lux
+++ b/stdlib/source/library/lux/macro/poly.lux
@@ -38,7 +38,7 @@
(~ body)))
(~ g!type)))
(#.Left (~ g!output))
- ((~! meta.fail) (~ g!output))
+ ((~! meta.failure) (~ g!output))
(#.Right (~ g!output))
((~' wrap) (.list (~ g!output))))))))))))
@@ -58,7 +58,7 @@
{[poly_func poly_args] (<code>.form (<>.and <code>.identifier (<>.many <code>.identifier)))}
{?custom_impl (<>.maybe <code>.any)})
(do {! meta.monad}
- [poly_args (monad.map ! meta.normalize poly_args)
+ [poly_args (monad.map ! meta.normal poly_args)
name (case ?name
(#.Some name)
(wrap name)
@@ -69,7 +69,7 @@
(wrap derived_name)
_
- (<>.fail "derived: was given no explicit name, and cannot generate one from given information."))
+ (<>.failure "derived: was given no explicit name, and cannot generate one from given information."))
#let [impl (case ?custom_impl
(#.Some custom_impl)
custom_impl
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index c2ddeefe5..3ad402530 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -102,7 +102,7 @@
(~! </>.any)))])
_
- (meta.fail "Syntax pattern expects records or identifiers."))))
+ (meta.failure "Syntax pattern expects records or identifiers."))))
args)
this_module meta.current_module_name
#let [g!state (code.identifier ["" "*compiler*"])
@@ -126,4 +126,4 @@
(~ g!tokens)))))))))
_
- (meta.fail (macro.wrong_syntax_error (name_of ..syntax:))))))
+ (meta.failure (macro.wrong_syntax_error (name_of ..syntax:))))))
diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux
index 1e309a306..7f9e9583f 100644
--- a/stdlib/source/library/lux/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/macro/syntax/definition.lux
@@ -47,21 +47,21 @@
(def: extension
"lux def")
-(def: (format_tag [module short])
+(def: (tag_format [module short])
(-> Name Code)
(` [(~ (code.text module))
(~ (code.text short))]))
-(def: (format_annotations value)
+(def: (annotations_format value)
(-> Annotations Code)
(case value
#.Nil
(` #.Nil)
(#.Cons [name value] tail)
- (` (#.Cons [(~ (..format_tag name))
+ (` (#.Cons [(~ (..tag_format name))
(~ value)]
- (~ (format_annotations tail))))))
+ (~ (annotations_format tail))))))
(def: dummy
Code
@@ -79,7 +79,7 @@
(#.Right value)
value))
- [(~ ..dummy) (#.Record (~ (..format_annotations anns)))]
+ [(~ ..dummy) (#.Record (~ (..annotations_format anns)))]
(~ (code.bit export?)))))
(def: tag_parser
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index 36edd6a1e..c835b8fd9 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -38,7 +38,7 @@
[g!locals (|> locals
(list\map //.gensym)
(monad.seq !))]
- (wrap (list (` (.with_expansions [(~+ (|> (list.zip/2 locals g!locals)
+ (wrap (list (` (.with_expansions [(~+ (|> (list.zipped/2 locals g!locals)
(list\map (function (_ [name identifier])
(list (code.local_identifier name) (as_is identifier))))
list\join))]
@@ -145,7 +145,7 @@
inputs_amount (list.size inputs)]
(if (nat.= parameters_amount inputs_amount)
(.let [environment (: Environment
- (|> (list.zip/2 parameters inputs)
+ (|> (list.zipped/2 parameters inputs)
(dictionary.of_list text.hash)))]
(#.Right [compiler (list\map (..applied environment) template)]))
(exception.throw ..irregular_arguments [parameters_amount inputs_amount]))))))
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index ecfdf30a0..ca122b00d 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -33,7 +33,7 @@
1 (#.Some (get@ #numerator value))
_ #.None))
-(def: (normalize (^slots [#numerator #denominator]))
+(def: (normal (^slots [#numerator #denominator]))
(-> Ratio Ratio)
(let [common (n.gcd numerator denominator)]
{#numerator (n./ common numerator)
@@ -42,11 +42,11 @@
(syntax: #export (ratio numerator {?denominator (<>.maybe <code>.any)})
{#.doc (doc "Rational literals."
(ratio numerator denominator)
- "The denominator can be omitted if it's 1."
+ "The denominator can be omitted if it is 1."
(ratio numerator))}
- (wrap (list (` ((~! ..normalize) {#..numerator (~ numerator)
- #..denominator (~ (maybe.default (' 1)
- ?denominator))})))))
+ (wrap (list (` ((~! ..normal) {#..numerator (~ numerator)
+ #..denominator (~ (maybe.default (' 1)
+ ?denominator))})))))
(def: #export (= parameter subject)
(-> Ratio Ratio Bit)
@@ -60,7 +60,7 @@
(def: = ..=))
-(def: (equalize parameter subject)
+(def: (equalized parameter subject)
(-> Ratio Ratio [Nat Nat])
[(n.* (get@ #denominator subject)
(get@ #numerator parameter))
@@ -69,7 +69,7 @@
(def: #export (< parameter subject)
(-> Ratio Ratio Bit)
- (let [[parameter' subject'] (..equalize parameter subject)]
+ (let [[parameter' subject'] (..equalized parameter subject)]
(n.< parameter' subject')))
(def: #export (<= parameter subject)
@@ -94,33 +94,33 @@
(def: #export (+ parameter subject)
(-> Ratio Ratio Ratio)
- (let [[parameter' subject'] (..equalize parameter subject)]
- (normalize [(n.+ parameter' subject')
- (n.* (get@ #denominator parameter)
- (get@ #denominator subject))])))
+ (let [[parameter' subject'] (..equalized parameter subject)]
+ (normal [(n.+ parameter' subject')
+ (n.* (get@ #denominator parameter)
+ (get@ #denominator subject))])))
(def: #export (- parameter subject)
(-> Ratio Ratio Ratio)
- (let [[parameter' subject'] (..equalize parameter subject)]
- (normalize [(n.- parameter' subject')
- (n.* (get@ #denominator parameter)
- (get@ #denominator subject))])))
+ (let [[parameter' subject'] (..equalized parameter subject)]
+ (normal [(n.- parameter' subject')
+ (n.* (get@ #denominator parameter)
+ (get@ #denominator subject))])))
(def: #export (* parameter subject)
(-> Ratio Ratio Ratio)
- (normalize [(n.* (get@ #numerator parameter)
- (get@ #numerator subject))
- (n.* (get@ #denominator parameter)
- (get@ #denominator subject))]))
+ (normal [(n.* (get@ #numerator parameter)
+ (get@ #numerator subject))
+ (n.* (get@ #denominator parameter)
+ (get@ #denominator subject))]))
(def: #export (/ parameter subject)
(-> Ratio Ratio Ratio)
- (let [[parameter' subject'] (..equalize parameter subject)]
- (normalize [subject' parameter'])))
+ (let [[parameter' subject'] (..equalized parameter subject)]
+ (normal [subject' parameter'])))
(def: #export (% parameter subject)
(-> Ratio Ratio Ratio)
- (let [[parameter' subject'] (..equalize parameter subject)
+ (let [[parameter' subject'] (..equalized parameter subject)
quot (n./ parameter' subject')]
(..- (update@ #numerator (n.* quot) parameter)
subject)))
@@ -144,8 +144,8 @@
(do try.monad
[numerator (n\decode num)
denominator (n\decode denom)]
- (wrap (normalize {#numerator numerator
- #denominator denominator})))
+ (wrap (normal {#numerator numerator
+ #denominator denominator})))
#.None
(#.Left (text\compose "Invalid syntax for ratio: " input)))))
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 5415b7c9e..97cfe8c9e 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -109,7 +109,7 @@
(#try.Success [compiler []])
(#try.Failure message))))
-(def: #export (fail error)
+(def: #export (failure error)
{#.doc "Fails with the given error message."}
(All [a]
(-> Text (Meta a)))
@@ -152,7 +152,7 @@
_
false)))
-(def: #export (normalize name)
+(def: #export (normal name)
{#.doc (doc "If given a name without a module prefix, gives it the current module's name as prefix."
"Otherwise, returns the name as-is.")}
(-> Name (Meta Name))
@@ -186,7 +186,7 @@
(def: #export (find_macro full_name)
(-> Name (Meta (Maybe Macro)))
(do ..monad
- [[module name] (normalize full_name)]
+ [[module name] (..normal full_name)]
(: (Meta (Maybe Macro))
(function (_ compiler)
(let [macro (case (..current_module_name compiler)
@@ -277,7 +277,7 @@
{#.doc "Looks-up a definition's whole data in the available modules (including the current one)."}
(-> Name (Meta Global))
(do ..monad
- [name (normalize name)
+ [name (..normal name)
#let [[normal_module normal_short] name]]
(function (_ compiler)
(case (: (Maybe Global)
@@ -337,15 +337,15 @@
[definition (..find_def name)]
(case definition
(#.Left de_aliased)
- (fail ($_ text\compose
- "Aliases are not considered exports: "
- (name\encode name)))
+ (failure ($_ text\compose
+ "Aliases are not considered exports: "
+ (name\encode name)))
(#.Right definition)
(let [[exported? def_type def_data def_value] definition]
(if exported?
(wrap definition)
- (fail ($_ text\compose "Definition is not an export: " (name\encode name))))))))
+ (failure ($_ text\compose "Definition is not an export: " (name\encode name))))))))
(def: #export (find_def_type name)
{#.doc "Looks-up a definition's type in the available modules (including the current one)."}
@@ -388,7 +388,7 @@
(type_to_code .Type)
(type_to_code def_type)))
(wrap (:as Type def_value))
- (..fail ($_ text\compose "Definition is not a type: " (name\encode name))))))))
+ (..failure ($_ text\compose "Definition is not a type: " (name\encode name))))))))
(def: #export (globals module)
{#.doc "The entire list of globals in a module (including the non-exported/private ones)."}
@@ -496,16 +496,16 @@
(if (or (text\= this_module_name module)
(and imported! exported?))
(wrap [idx tag_list type])
- (..fail ($_ text\compose "Cannot access tag: " (name\encode tag) " from module " this_module_name)))
+ (..failure ($_ text\compose "Cannot access tag: " (name\encode tag) " from module " this_module_name)))
_
- (..fail ($_ text\compose
- "Unknown tag: " (name\encode tag) text.new_line
- " Known tags: " (|> =module
- (get@ #.tags)
- (list\map (|>> product.left [module] name\encode (text.prefix text.new_line)))
- (text.join_with ""))
- )))))
+ (..failure ($_ text\compose
+ "Unknown tag: " (name\encode tag) text.new_line
+ " Known tags: " (|> =module
+ (get@ #.tags)
+ (list\map (|>> product.left [module] name\encode (text.prefix text.new_line)))
+ (text.join_with ""))
+ )))))
(def: #export (tag_lists module)
{#.doc "All the tag-lists defined in a module, with their associated types."}
@@ -565,4 +565,4 @@
(\ ..monad wrap output)
(#try.Failure error)
- (..fail error)))
+ (..failure error)))
diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux
index 2ebcb6a8e..a83162d28 100644
--- a/stdlib/source/library/lux/target/common_lisp.lux
+++ b/stdlib/source/library/lux/target/common_lisp.lux
@@ -115,7 +115,7 @@
(text.replace_once "E" "d" raw)
(format raw "d0"))))))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -134,7 +134,7 @@
(def: #export string
(-> Text Literal)
- (|>> ..sanitize
+ (|>> ..safe
(text.enclose' text.double_quote)
:abstraction))
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index 26c2e7b41..d19bb0b8b 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -84,7 +84,7 @@
## else
(|> value %.frac ..expression))))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<replace> <find>]
[(text.replace_all <find> <replace>)]
@@ -104,7 +104,7 @@
(def: #export string
(-> Text Literal)
- (|>> ..sanitize
+ (|>> ..safe
(text.enclose [text.double_quote text.double_quote])
:abstraction))
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index 0d94ae9f1..ba09af5bb 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -162,13 +162,13 @@
(: (Monad Try))
try.monad))
-(def: #export fail
+(def: #export failure
(-> Text Bytecode)
(|>> #try.Failure function.constant))
(def: #export (throw exception value)
(All [e] (-> (exception.Exception e) e Bytecode))
- (..fail (exception.construct exception value)))
+ (..failure (exception.construct exception value)))
(def: #export (resolve environment bytecode)
(All [a] (-> Environment (Bytecode a) (Resource [Environment (Row Exception) Instruction a])))
@@ -907,7 +907,7 @@
[>default (\ ! map ..big_jump (..jump @from @default))
>cases (|> @cases
(monad.map ! (|>> (..jump @from) (\ ! map ..big_jump)))
- (\ ! map (|>> (list.zip/2 (list\map product.left cases)))))]
+ (\ ! map (|>> (list.zipped/2 (list\map product.left cases)))))]
(wrap [..no_exceptions (bytecode >default >cases)]))
#.None
diff --git a/stdlib/source/library/lux/target/jvm/encoding/name.lux b/stdlib/source/library/lux/target/jvm/encoding/name.lux
index 5a1982d3e..02507ceb6 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/name.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux
@@ -31,10 +31,10 @@
(text.replace_all ..internal_separator
..external_separator))))
-(def: #export sanitize
+(def: #export safe
(-> Text External)
(|>> ..internal ..external))
(def: #export (qualify package class)
(-> Text External External)
- (format (..sanitize package) ..external_separator class))
+ (format (..safe package) ..external_separator class))
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index 50bb2b974..5745ecd89 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -303,8 +303,8 @@
(if (text\= class_name name)
(if (n.= num_class_params num_type_params)
(|> params
- (list.zip/2 (list\map (|>> java/lang/reflect/TypeVariable::getName)
- class_params))
+ (list.zipped/2 (list\map (|>> java/lang/reflect/TypeVariable::getName)
+ class_params))
(list\fold (function (_ [name paramT] mapping)
(dictionary.put name paramT mapping))
/lux.fresh)
diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux
index b4abe4093..ea9df2259 100644
--- a/stdlib/source/library/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/target/jvm/type/lux.lux
@@ -233,4 +233,4 @@
check
(#try.Failure error)
- (check.fail error)))
+ (check.failure error)))
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index 11f2c285e..3c76ad6c4 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -115,7 +115,7 @@
[%.frac (text.replace_all "+" "")])
:abstraction))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -134,7 +134,7 @@
(def: #export string
(-> Text Literal)
- (|>> ..sanitize (text.enclose' text.double_quote) :abstraction))
+ (|>> ..safe (text.enclose' text.double_quote) :abstraction))
(def: #export multi
(-> (List Expression) Literal)
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 5008eae43..5ca2e0d58 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -155,7 +155,7 @@
[%.frac])
:abstraction))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -175,7 +175,7 @@
(def: #export string
(-> Text Literal)
- (|>> ..sanitize
+ (|>> ..safe
(text.enclose [text.double_quote text.double_quote])
:abstraction))
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index 0cf6d2c27..3c8450b31 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -150,7 +150,7 @@
[%.frac])
:abstraction)))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -169,7 +169,7 @@
(def: #export string
(-> Text Literal)
- (|>> ..sanitize
+ (|>> ..safe
(text.enclose [text.double_quote text.double_quote])
:abstraction))
@@ -444,7 +444,7 @@
(def: #export (comment commentary on)
(All [brand] (-> Text (Code brand) (Code brand)))
- (:abstraction (format "# " (..sanitize commentary) text.new_line
+ (:abstraction (format "# " (..safe commentary) text.new_line
(:representation on))))
)
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index 06f516e75..f6180c45c 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -133,7 +133,7 @@
[%.frac])
..self_contained))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -151,7 +151,7 @@
(def: #export string
(-> Text Expression)
- (|>> ..sanitize %.text :abstraction))
+ (|>> ..safe %.text :abstraction))
(def: #export (slice from to list)
(-> Expression Expression Expression Expression)
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index a7dd6907f..1d28af979 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -147,7 +147,7 @@
#1 "true")
:abstraction))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -170,7 +170,7 @@
(|>> <prep> <format> :abstraction))]
[%.int int Int (<|)]
- [%.text string Text ..sanitize]
+ [%.text string Text ..safe]
[(<|) symbol Text (format ":")]
)
@@ -416,7 +416,7 @@
(def: #export (comment commentary on)
(All [brand] (-> Text (Code brand) (Code brand)))
- (:abstraction (format "# " (..sanitize commentary) text.new_line
+ (:abstraction (format "# " (..safe commentary) text.new_line
(:representation on))))
)
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index 43b94d459..6ebc254db 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -128,7 +128,7 @@
(def: #export negative_infinity Computation (..float f.negative_infinity))
(def: #export not_a_number Computation (..float f.not_a_number))
- (def: sanitize
+ (def: safe
(-> Text Text)
(`` (|>> (~~ (template [<find> <replace>]
[(text.replace_all <find> <replace>)]
@@ -146,7 +146,7 @@
(def: #export string
(-> Text Computation)
- (|>> ..sanitize %.text :abstraction))
+ (|>> ..safe %.text :abstraction))
(def: #export symbol
(-> Text Computation)
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index e14505e13..c3c67ff82 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -12,7 +12,7 @@
["." io]
[concurrency
["." atom (#+ Atom)]
- ["." promise (#+ Promise) ("#\." monad)]]
+ ["." async (#+ Async) ("#\." monad)]]
["<>" parser
["<.>" code]]]
[data
@@ -67,12 +67,12 @@
Tally
(update@ <category> .inc ..start))]
- [success #successes]
- [failure #failures]
+ [success_tally #successes]
+ [failure_tally #failures]
)
(type: #export Assertion
- (Promise [Tally Text]))
+ (Async [Tally Text]))
(type: #export Test
(Random Assertion))
@@ -83,15 +83,15 @@
(def: #export (and' left right)
{#.doc "Sequencing combinator."}
(-> Assertion Assertion Assertion)
- (let [[read! write!] (: [(Promise [Tally Text])
- (promise.Resolver [Tally Text])]
- (promise.promise []))
+ (let [[read! write!] (: [(Async [Tally Text])
+ (async.Resolver [Tally Text])]
+ (async.async []))
_ (|> left
- (promise.await (function (_ [l_tally l_documentation])
- (promise.await (function (_ [r_tally r_documentation])
- (write! [(add_tally l_tally r_tally)
- (format l_documentation ..separator r_documentation)]))
- right)))
+ (async.await (function (_ [l_tally l_documentation])
+ (async.await (function (_ [r_tally r_documentation])
+ (write! [(add_tally l_tally r_tally)
+ (format l_documentation ..separator r_documentation)]))
+ right)))
io.run)]
read!))
@@ -107,30 +107,30 @@
(def: #export (context description)
(-> Text Test Test)
- (random\map (promise\map (function (_ [tally documentation])
- [tally (|> documentation
- (text.split_all_with ..separator)
- (list\map (|>> (format context_prefix)))
- (text.join_with ..separator)
- (format description ..separator))]))))
+ (random\map (async\map (function (_ [tally documentation])
+ [tally (|> documentation
+ (text.split_all_with ..separator)
+ (list\map (|>> (format context_prefix)))
+ (text.join_with ..separator)
+ (format description ..separator))]))))
(def: failure_prefix "[Failure] ")
(def: success_prefix "[Success] ")
-(def: #export fail
+(def: #export failure
(-> Text Test)
(|>> (format ..failure_prefix)
- [..failure]
- promise\wrap
+ [..failure_tally]
+ async\wrap
random\wrap))
(def: #export (assert message condition)
{#.doc "Check that a condition is #1, and fail with the given message otherwise."}
(-> Text Bit Assertion)
- (<| promise\wrap
+ (<| async\wrap
(if condition
- [..success (format ..success_prefix message)]
- [..failure (format ..failure_prefix message)])))
+ [..success_tally (format ..success_prefix message)]
+ [..failure_tally (format ..failure_prefix message)])))
(def: #export (test message condition)
{#.doc "Check that a condition is #1, and fail with the given message otherwise."}
@@ -170,12 +170,12 @@
(def: #export (times amount test)
(-> Nat Test Test)
(case amount
- 0 (..fail (exception.construct ..must_try_test_at_least_once []))
+ 0 (..failure (exception.construct ..must_try_test_at_least_once []))
_ (do random.monad
[seed random.nat]
(function (recur prng)
(let [[prng' instance] (random.run (random.pcg32 [..pcg32_magic_inc seed]) test)]
- [prng' (do {! promise.monad}
+ [prng' (do {! async.monad}
[[tally documentation] instance]
(if (..failed? tally)
(wrap [tally (times_failure seed documentation)])
@@ -240,21 +240,21 @@
(def: success_exit_code +0)
(def: #export (run! test)
- (-> Test (Promise Nothing))
- (do promise.monad
- [pre (promise.future instant.now)
+ (-> Test (Async Nothing))
+ (do async.monad
+ [pre (async.future instant.now)
#let [seed (instant.to_millis pre)
prng (random.pcg32 [..pcg32_magic_inc seed])]
[tally documentation] (|> test (random.run prng) product.right)
- post (promise.future instant.now)
+ post (async.future instant.now)
#let [duration (instant.span pre post)
_ (debug.log! (format documentation text.new_line text.new_line
(..description duration tally)
text.new_line))]]
- (promise.future (\ program.default exit
- (case (get@ #failures tally)
- 0 ..success_exit_code
- _ ..failure_exit_code)))))
+ (async.future (\ program.default exit
+ (case (get@ #failures tally)
+ 0 ..success_exit_code
+ _ ..failure_exit_code)))))
(def: (|cover'| coverage condition)
(-> (List Name) Bit Assertion)
@@ -263,9 +263,9 @@
(text.join_with " & "))
coverage (set.of_list name.hash coverage)]
(|> (..assert message condition)
- (promise\map (function (_ [tally documentation])
- [(update@ #actual_coverage (set.union coverage) tally)
- documentation])))))
+ (async\map (function (_ [tally documentation])
+ [(update@ #actual_coverage (set.union coverage) tally)
+ documentation])))))
(def: (|cover| coverage condition)
(-> (List Name) Bit Test)
@@ -278,9 +278,9 @@
(list\map %.name)
(text.join_with " & "))
coverage (set.of_list name.hash coverage)]
- (random\map (promise\map (function (_ [tally documentation])
- [(update@ #actual_coverage (set.union coverage) tally)
- documentation]))
+ (random\map (async\map (function (_ [tally documentation])
+ [(update@ #actual_coverage (set.union coverage) tally)
+ documentation]))
(..context context test))))
(def: (name_code name)
@@ -345,9 +345,9 @@
(-> Text Text Test Test)
(let [coverage (..decode_coverage module coverage)]
(|> (..context module test)
- (random\map (promise\map (function (_ [tally documentation])
- [(update@ #expected_coverage (set.union coverage) tally)
- documentation]))))))
+ (random\map (async\map (function (_ [tally documentation])
+ [(update@ #expected_coverage (set.union coverage) tally)
+ documentation]))))))
(syntax: #export (covering {module <code>.identifier}
test)
@@ -374,7 +374,7 @@
(-> (List Test) Test)
(case (list.size tests)
0
- (random\wrap (promise\wrap [..start ""]))
+ (random\wrap (async\wrap [..start ""]))
expected_tests
(do random.monad
@@ -391,29 +391,29 @@
(#try.Failure error)
(..assert (exception.construct ..error_during_execution [error]) false))
io.io
- promise.future
- promise\join))
+ async.future
+ async\join))
state (: (Atom (Dictionary Nat [Tally Text]))
(atom.atom (dictionary.new n.order)))
[read! write!] (: [Assertion
- (promise.Resolver [Tally Text])]
- (promise.promise []))
+ (async.Resolver [Tally Text])]
+ (async.async []))
_ (io.run (monad.map io.monad
(function (_ [index test])
- (promise.await (function (_ assertion)
- (do io.monad
- [[_ results] (atom.update (dictionary.put index assertion) state)]
- (if (n.= expected_tests (dictionary.size results))
- (let [assertions (|> results
- dictionary.entries
- (list\map product.right))]
- (write! [(|> assertions
- (list\map product.left)
- (list\fold ..add_tally ..start))
- (|> assertions
- (list\map product.right)
- (text.join_with ..separator))]))
- (wrap []))))
- (run! test)))
+ (async.await (function (_ assertion)
+ (do io.monad
+ [[_ results] (atom.update (dictionary.put index assertion) state)]
+ (if (n.= expected_tests (dictionary.size results))
+ (let [assertions (|> results
+ dictionary.entries
+ (list\map product.right))]
+ (write! [(|> assertions
+ (list\map product.left)
+ (list\fold ..add_tally ..start))
+ (|> assertions
+ (list\map product.right)
+ (text.join_with ..separator))]))
+ (wrap []))))
+ (run! test)))
(list.enumeration tests)))]]
(wrap read!))))
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 2e5fb6fed..c60700019 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -11,7 +11,7 @@
["." try (#+ Try) ("#\." functor)]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise Resolver) ("#\." monad)]
+ ["." async (#+ Async Resolver) ("#\." monad)]
["." stm (#+ Var STM)]]]
[data
["." binary (#+ Binary)]
@@ -68,7 +68,7 @@
(All [s i o] (-> (Phase s i o) Any)))
(type: #export (Platform <type_vars>)
- {#&file_system (file.System Promise)
+ {#&file_system (file.System Async)
#host (///generation.Host expression directive)
#phase (///generation.Phase <type_vars>)
#runtime (<Operation> [Registry Output])
@@ -77,12 +77,12 @@
## TODO: Get rid of this
(type: (Action a)
- (Promise (Try a)))
+ (Async (Try a)))
## TODO: Get rid of this
(def: monad
(:as (Monad Action)
- (try.with promise.monad)))
+ (try.with async.monad)))
(with_expansions [<Platform> (as_is (Platform <type_vars>))
<State+> (as_is (///directive.State+ <type_vars>))
@@ -96,7 +96,7 @@
(def: (cache_module static platform module_id [descriptor document output])
(All [<type_vars>]
(-> Static <Platform> archive.ID [Descriptor (Document Any) Output]
- (Promise (Try Any))))
+ (Async (Try Any))))
(let [system (get@ #&file_system platform)
write_artifact! (: (-> [artifact.ID (Maybe Text) Binary] (Action Any))
(function (_ [artifact_id custom content])
@@ -112,7 +112,7 @@
row.to_list
(monad.map ..monad write_artifact!)
(: (Action (List Any)))))
- document (\ promise.monad wrap
+ document (\ async.monad wrap
(document.check $.key document))]
(ioW.cache system static module_id
(_.run ..writer [descriptor document])))))
@@ -234,8 +234,8 @@
(Program expression directive)
[Type Type Type] (-> Phase_Wrapper Extender)
Import (List Context)
- (Promise (Try [<State+> Archive]))))
- (do {! (try.with promise.monad)}
+ (Async (Try [<State+> Archive]))))
+ (do {! (try.with async.monad)}
[#let [state (//init.state (get@ #static.host static)
module
expander
@@ -247,9 +247,9 @@
[archive analysis_state bundles] (ioW.thaw (get@ #host platform) (get@ #&file_system platform) static import compilation_sources)
#let [with_missing_extensions
(: (All [<type_vars>]
- (-> <Platform> (Program expression directive) <State+> (Promise (Try <State+>))))
+ (-> <Platform> (Program expression directive) <State+> (Async (Try <State+>))))
(function (_ platform program state)
- (promise\wrap
+ (async\wrap
(do try.monad
[[state phase_wrapper] (..phase_wrapper archive platform state)]
(|> state
@@ -264,7 +264,7 @@
(do !
[[state [archive payload]] (|> (..process_runtime archive platform)
(///phase.run' state)
- promise\wrap)
+ async\wrap)
_ (..cache_module static platform 0 payload)
state (with_missing_extensions platform program state)]
@@ -379,7 +379,7 @@
(with_expansions [<Context> (as_is [Archive <State+>])
<Result> (as_is (Try <Context>))
- <Return> (as_is (Promise <Result>))
+ <Return> (as_is (Async <Result>))
<Signal> (as_is (Resolver <Result>))
<Pending> (as_is [<Return> <Signal>])
<Importer> (as_is (-> Module Module <Return>))
@@ -399,14 +399,14 @@
(stm.var ..independence))]
(function (_ compile)
(function (import! importer module)
- (do {! promise.monad}
+ (do {! async.monad}
[[return signal] (:sharing [<type_vars>]
<Context>
initial
- (Promise [<Return> (Maybe [<Context>
- archive.ID
- <Signal>])])
+ (Async [<Return> (Maybe [<Context>
+ archive.ID
+ <Signal>])])
(:assume
(stm.commit
(do {! stm.monad}
@@ -417,14 +417,14 @@
(wrap dependence)))]
(case (..verify_dependencies importer module dependence)
(#try.Failure error)
- (wrap [(promise.resolved (#try.Failure error))
+ (wrap [(async.resolved (#try.Failure error))
#.None])
(#try.Success _)
(do !
[[archive state] (stm.read current)]
(if (archive.archived? archive module)
- (wrap [(promise\wrap (#try.Success [archive state]))
+ (wrap [(async\wrap (#try.Success [archive state]))
#.None])
(do !
[@pending (stm.read pending)]
@@ -447,7 +447,7 @@
initial
<Pending>
- (promise.promise []))]
+ (async.async []))]
_ (stm.update (dictionary.put module [return signal]) pending)]
(wrap [return
(#.Some [[archive state]
@@ -455,7 +455,7 @@
signal])]))
(#try.Failure error)
- (wrap [(promise\wrap (#try.Failure error))
+ (wrap [(async\wrap (#try.Failure error))
#.None])))))))))))
_ (case signal
#.None
@@ -475,7 +475,7 @@
state])
current)]
(wrap (#try.Success [merged_archive resulting_state])))))
- _ (promise.future (resolver result))]
+ _ (async.future (resolver result))]
(wrap [])))]
return)))))
@@ -531,7 +531,7 @@
compiler (..parallel
context
(function (_ importer import! module_id [archive state] module)
- (do {! (try.with promise.monad)}
+ (do {! (try.with async.monad)}
[#let [state (..set_current_module module state)]
input (context.read (get@ #&file_system platform)
importer
@@ -592,11 +592,11 @@
(..with_reset_log state)])
(#try.Failure error)
- (promise\wrap (#try.Failure error)))))
+ (async\wrap (#try.Failure error)))))
(#try.Failure error)
(do !
[_ (ioW.freeze (get@ #&file_system platform) static archive)]
- (promise\wrap (#try.Failure error))))))))))]
+ (async\wrap (#try.Failure error))))))))))]
(compiler archive.runtime_module compilation_module)))
)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index c29eaaf54..0fc5d90fc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -464,14 +464,14 @@
(format (%.location location) text.new_line
error))
-(def: #export (fail error)
+(def: #export (failure error)
(-> Text Operation)
(function (_ [bundle state])
(#try.Failure (locate_error (get@ #.location state) error))))
(def: #export (throw exception parameters)
(All [e] (-> (Exception e) e Operation))
- (..fail (exception.construct exception parameters)))
+ (..failure (exception.construct exception parameters)))
(def: #export (assert exception parameters condition)
(All [e] (-> (Exception e) e Bit (Operation Any)))
@@ -479,14 +479,14 @@
(\ phase.monad wrap [])
(..throw exception parameters)))
-(def: #export (fail' error)
+(def: #export (failure' error)
(-> Text (phase.Operation Lux))
(function (_ state)
(#try.Failure (locate_error (get@ #.location state) error))))
(def: #export (throw' exception parameters)
(All [e] (-> (Exception e) e (phase.Operation Lux)))
- (..fail' (exception.construct exception parameters)))
+ (..failure' (exception.construct exception parameters)))
(def: #export (with_stack exception message action)
(All [e o] (-> (Exception e) e (Operation o) (Operation o)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux
index d0957820c..f8f295429 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux
@@ -38,7 +38,7 @@
(#try.Success output)
(#try.Failure error)
- ((meta.fail (exception.construct ..expansion_failed [name inputs error])) state)))))
+ ((meta.failure (exception.construct ..expansion_failed [name inputs error])) state)))))
(def: #export (expand_one expander name macro inputs)
(-> Expander Name Macro (List Code) (Meta Code))
@@ -49,4 +49,4 @@
(wrap single)
_
- (meta.fail (exception.construct ..must_have_single_expansion [name inputs expansion])))))
+ (meta.failure (exception.construct ..must_have_single_expansion [name inputs expansion])))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
index 327488817..54e4e90d6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -199,14 +199,14 @@
num_sub_patterns (list.size sub_patterns)
matches (cond (n.< num_subs num_sub_patterns)
(let [[prefix suffix] (list.split (dec num_sub_patterns) subs)]
- (list.zip/2 (list\compose prefix (list (type.tuple suffix))) sub_patterns))
+ (list.zipped/2 (list\compose prefix (list (type.tuple suffix))) sub_patterns))
(n.> num_subs num_sub_patterns)
(let [[prefix suffix] (list.split (dec num_subs) sub_patterns)]
- (list.zip/2 subs (list\compose prefix (list (code.tuple suffix)))))
+ (list.zipped/2 subs (list\compose prefix (list (code.tuple suffix)))))
## (n.= num_subs num_sub_patterns)
- (list.zip/2 subs sub_patterns))]
+ (list.zipped/2 subs sub_patterns))]
(do !
[[memberP+ thenA] (list\fold (: (All [a]
(-> [Type Code] (Operation [(List Pattern) a])
@@ -230,7 +230,7 @@
[location (#.Record record)]
(do ///.monad
- [record (//structure.normalize record)
+ [record (//structure.normal record)
[members recordT] (//structure.order record)
_ (.case inputT
(#.Var _id)
@@ -287,7 +287,7 @@
(^ [location (#.Form (list& [_ (#.Tag tag)] values))])
(/.with_location location
(do ///.monad
- [tag (///extension.lift (meta.normalize tag))
+ [tag (///extension.lift (meta.normal tag))
[idx group variantT] (///extension.lift (meta.resolve_tag tag))
_ (//type.with_env
(check.check inputT variantT))
@@ -318,7 +318,7 @@
(/coverage.exhaustive? coverage))
(#try.Failure error)
- (/.fail error))]
+ (/.failure error))]
(wrap (#/.Case inputA [outputH outputT])))
#.Nil
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
index bc4fad3d3..2bb0fe957 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
@@ -202,7 +202,7 @@
(and (n.= (list.size flatR) (list.size flatS))
(list.every? (function (_ [coverageR coverageS])
(= coverageR coverageS))
- (list.zip/2 flatR flatS))))
+ (list.zipped/2 flatR flatS))))
_
#0)))
@@ -344,7 +344,7 @@
(wrap [(#.Some altMSF) altsSF']))
(#try.Failure error)
- (try.fail error))
+ (try.failure error))
))))]
[successA possibilitiesSF] (fuse_once addition (flat_alt so_far))]
(loop [successA successA
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
index 5e41e907e..1ef5c88c4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
@@ -58,7 +58,7 @@
(recur value)
#.None
- (/.fail (ex.construct cannot_analyse [expectedT function_name arg_name body])))
+ (/.failure (ex.construct cannot_analyse [expectedT function_name arg_name body])))
(^template [<tag> <instancer>]
[(<tag> _)
@@ -102,7 +102,7 @@
(analyse archive body))
_
- (/.fail "")
+ (/.failure "")
)))))
(def: #export (apply analyse argsC+ functionT functionA archive functionC)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux
index 9ce2b1faa..4e085a6b9 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux
@@ -41,7 +41,7 @@
(#.Right [exported? actualT def_anns _])
(do !
[_ (//type.infer actualT)
- (^@ def_name [::module ::name]) (///extension.lift (meta.normalize def_name))
+ (^@ def_name [::module ::name]) (///extension.lift (meta.normal def_name))
current (///extension.lift meta.current_module_name)]
(if (text\= current ::module)
<return>
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
index c49e936ec..ca42337d5 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
@@ -262,7 +262,7 @@
(def: #export (tagged_sum analyse tag archive valueC)
(-> Phase Name Phase)
(do {! ///.monad}
- [tag (///extension.lift (meta.normalize tag))
+ [tag (///extension.lift (meta.normal tag))
[idx group variantT] (///extension.lift (meta.resolve_tag tag))
#let [case_size (list.size group)
[lefts right?] (/.choice case_size idx)]
@@ -281,14 +281,14 @@
## records, so they must be normalized for further analysis.
## Normalization just means that all the tags get resolved to their
## canonical form (with their corresponding module identified).
-(def: #export (normalize record)
+(def: #export (normal record)
(-> (List [Code Code]) (Operation (List [Name Code])))
(monad.map ///.monad
(function (_ [key val])
(case key
[_ (#.Tag key)]
(do ///.monad
- [key (///extension.lift (meta.normalize key))]
+ [key (///extension.lift (meta.normal key))]
(wrap [key val]))
_
@@ -307,7 +307,7 @@
(#.Cons [head_k head_v] _)
(do {! ///.monad}
- [head_k (///extension.lift (meta.normalize head_k))
+ [head_k (///extension.lift (meta.normal head_k))
[_ tag_set recordT] (///extension.lift (meta.resolve_tag head_k))
#let [size_record (list.size record)
size_ts (list.size tag_set)]
@@ -315,11 +315,11 @@
(wrap [])
(/.throw ..record_size_mismatch [size_ts size_record recordT record]))
#let [tuple_range (list.indices size_ts)
- tag->idx (dictionary.of_list name.hash (list.zip/2 tag_set tuple_range))]
+ tag->idx (dictionary.of_list name.hash (list.zipped/2 tag_set tuple_range))]
idx->val (monad.fold !
(function (_ [key val] idx->val)
(do !
- [key (///extension.lift (meta.normalize key))]
+ [key (///extension.lift (meta.normal key))]
(case (dictionary.get key tag->idx)
(#.Some idx)
(if (dictionary.key? idx->val idx)
@@ -347,7 +347,7 @@
_
(do {! ///.monad}
- [members (normalize members)
+ [members (normal members)
[membersC recordT] (order members)
expectedT (///extension.lift meta.expected_type)]
(case expectedT
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux
index 61948e7c2..c9227aa31 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux
@@ -30,7 +30,7 @@
output])
(#try.Failure error)
- ((/.fail error) stateE))))
+ ((/.failure error) stateE))))
(def: #export with_fresh_env
(All [a] (-> (Operation a) (Operation a)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
index f47ca7aea..bd49944a1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -851,7 +851,7 @@
check)
(#try.Failure error)
- (phase.fail error)))]
+ (phase.failure error)))]
[boxed_reflection_type Value luxT.boxed_type]
[reflection_type Value luxT.type]
@@ -1123,7 +1123,7 @@
#.None
actualJC)))))
true
- (list.zip/2 parameters inputsJT)))]]
+ (list.zipped/2 parameters inputsJT)))]]
(wrap (and correct_class?
correct_method?
static_matches?
@@ -1153,7 +1153,7 @@
#.None
actualJC)))))
true
- (list.zip/2 parameters inputsJT))))))
+ (list.zipped/2 parameters inputsJT))))))
(def: idx_to_parameter
(-> Nat .Type)
@@ -1278,8 +1278,8 @@
(def: (aliasing expected actual)
(-> (List (Type Var)) (List (Type Var)) Aliasing)
- (|> (list.zip/2 (list\map jvm_parser.name actual)
- (list\map jvm_parser.name expected))
+ (|> (list.zipped/2 (list\map jvm_parser.name actual)
+ (list\map jvm_parser.name expected))
(dictionary.of_list text.hash)))
(def: (method_candidate class_loader actual_class_tvars class_name actual_method_tvars method_name method_style inputsJT)
@@ -1360,7 +1360,7 @@
(def: (decorate_inputs typesT inputsA)
(-> (List (Type Value)) (List Analysis) (List Analysis))
(|> inputsA
- (list.zip/2 (list\map (|>> ..signature /////analysis.text) typesT))
+ (list.zipped/2 (list\map (|>> ..signature /////analysis.text) typesT))
(list\map (function (_ [type value])
(/////analysis.tuple (list type value))))))
@@ -1917,7 +1917,7 @@
phase.lift)]
(|> super_parameters
(monad.map ! (..reflection_type mapping))
- (\ ! map (|>> (list.zip/2 parent_parameters)))))
+ (\ ! map (|>> (list.zipped/2 parent_parameters)))))
(phase.lift (exception.throw ..mismatched_super_parameters [parent_name expected_count actual_count]))))
#.None
@@ -2067,7 +2067,7 @@
_ (phase.assert ..class_parameter_mismatch [expected_parameters actual_parameters]
(n.= (list.size expected_parameters)
(list.size actual_parameters)))]
- (wrap (|> (list.zip/2 expected_parameters actual_parameters)
+ (wrap (|> (list.zipped/2 expected_parameters actual_parameters)
(list\fold (function (_ [expected actual] mapping)
(case (jvm_parser.var? actual)
(#.Some actual)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
index a5e924af1..2804d568f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -59,7 +59,7 @@
(function (_ [argT argC])
(typeA.with_type argT
(analyse archive argC)))
- (list.zip/2 inputsT+ args))]
+ (list.zipped/2 inputsT+ args))]
(wrap (#////analysis.Extension extension_name argsA)))
(////analysis.throw ///.incorrect_arity [extension_name num_expected num_actual]))))))
@@ -91,7 +91,7 @@
[raw <code>.text]
(case (text.size raw)
1 (wrap (|> raw (text.nth 0) maybe.assume))
- _ (<>.fail (exception.construct ..char_text_must_be_size_1 [raw])))))
+ _ (<>.failure (exception.construct ..char_text_must_be_size_1 [raw])))))
(def: lux::syntax_char_case!
(..custom
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
index 079fc96ec..bcab57722 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -345,7 +345,7 @@
(wrap elementJT)
#.None
- (<>.fail (exception.construct ..not-an-object-array arrayJT)))
+ (<>.failure (exception.construct ..not-an-object-array arrayJT)))
#.None
(undefined))))
@@ -1053,7 +1053,7 @@
bodyS])
(do !
[bodyG (//////generation.with-context artifact-id
- (generate archive bodyS))]
+ (generate archive bodyS))]
(wrap (method.method ($_ modifier\compose
method.public
method.final
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
index 41e7cda43..4febcca3c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
@@ -92,7 +92,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index bfd952cc9..a4c5ebd10 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -90,7 +90,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
index 7d2416d67..74cbae5c8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
@@ -29,22 +29,22 @@
[reference
[variable (#+ Register)]]]]])
-(def: equals-name
+(def: equals_name
"equals")
-(def: equals-type
+(def: equals_type
(type.method [(list //type.value) type.boolean (list)]))
-(def: (pop-alt stack-depth)
+(def: (pop_alt stack_depth)
(-> Nat (Bytecode Any))
- (.case stack-depth
+ (.case stack_depth
0 (_\wrap [])
1 _.pop
2 _.pop2
_ ## (n.> 2)
($_ _.compose
_.pop2
- (pop-alt (n.- 2 stack-depth)))))
+ (pop_alt (n.- 2 stack_depth)))))
(def: int
(-> (I64 Any) (Bytecode Any))
@@ -62,15 +62,15 @@
(Bytecode Any)
($_ _.compose
_.dup
- (//runtime.get //runtime.stack-head)))
+ (//runtime.get //runtime.stack_head)))
(def: pop
(Bytecode Any)
($_ _.compose
- (//runtime.get //runtime.stack-tail)
+ (//runtime.get //runtime.stack_tail)
(_.checkcast //type.stack)))
-(def: (left-projection lefts)
+(def: (left_projection lefts)
(-> Nat (Bytecode Any))
($_ _.compose
(_.checkcast //type.tuple)
@@ -80,16 +80,16 @@
_.aaload
lefts
- //runtime.left-projection)))
+ //runtime.left_projection)))
-(def: (right-projection lefts)
+(def: (right_projection lefts)
(-> Nat (Bytecode Any))
($_ _.compose
(_.checkcast //type.tuple)
(..int lefts)
- //runtime.right-projection))
+ //runtime.right_projection))
-(def: (path' stack-depth @else @end phase archive path)
+(def: (path' stack_depth @else @end phase archive path)
(-> Nat Label Label (Generator Path))
(.case path
#synthesis.Pop
@@ -104,7 +104,7 @@
(do phase.monad
[bodyG (phase archive bodyS)]
(wrap ($_ _.compose
- (..pop-alt stack-depth)
+ (..pop_alt stack_depth)
bodyG
(_.goto @end))))
@@ -112,8 +112,8 @@
[(^ (<pattern> lefts))
(operation\wrap
(do _.monad
- [@success _.new-label
- @fail _.new-label]
+ [@success _.new_label
+ @fail _.new_label]
($_ _.compose
..peek
(_.checkcast //type.variant)
@@ -123,10 +123,10 @@
_.dup
(_.ifnull @fail)
(_.goto @success)
- (_.set-label @fail)
+ (_.set_label @fail)
_.pop
(_.goto @else)
- (_.set-label @success)
+ (_.set_label @success)
//runtime.push)))])
([synthesis.side/left false]
[synthesis.side/right true])
@@ -137,19 +137,19 @@
..peek
(<projection> lefts)
//runtime.push))])
- ([synthesis.member/left ..left-projection]
- [synthesis.member/right ..right-projection])
+ ([synthesis.member/left ..left_projection]
+ [synthesis.member/right ..right_projection])
## Extra optimization
(^ (synthesis.path/seq
(synthesis.member/left 0)
- (synthesis.!bind-top register thenP)))
+ (synthesis.!bind_top register thenP)))
(do phase.monad
- [thenG (path' stack-depth @else @end phase archive thenP)]
+ [thenG (path' stack_depth @else @end phase archive thenP)]
(wrap ($_ _.compose
..peek
(_.checkcast //type.tuple)
- _.iconst-0
+ _.iconst_0
_.aaload
(_.astore register)
thenG)))
@@ -158,9 +158,9 @@
(^template [<pm> <projection>]
[(^ (synthesis.path/seq
(<pm> lefts)
- (synthesis.!bind-top register thenP)))
+ (synthesis.!bind_top register thenP)))
(do phase.monad
- [then! (path' stack-depth @else @end phase archive thenP)]
+ [then! (path' stack_depth @else @end phase archive thenP)]
(wrap ($_ _.compose
..peek
(_.checkcast //type.tuple)
@@ -168,25 +168,25 @@
<projection>
(_.astore register)
then!)))])
- ([synthesis.member/left //runtime.left-projection]
- [synthesis.member/right //runtime.right-projection])
+ ([synthesis.member/left //runtime.left_projection]
+ [synthesis.member/right //runtime.right_projection])
(#synthesis.Alt leftP rightP)
(do phase.monad
- [@alt-else //runtime.forge-label
- left! (path' (inc stack-depth) @alt-else @end phase archive leftP)
- right! (path' stack-depth @else @end phase archive rightP)]
+ [@alt_else //runtime.forge_label
+ left! (path' (inc stack_depth) @alt_else @end phase archive leftP)
+ right! (path' stack_depth @else @end phase archive rightP)]
(wrap ($_ _.compose
_.dup
left!
- (_.set-label @alt-else)
+ (_.set_label @alt_else)
_.pop
right!)))
(#synthesis.Seq leftP rightP)
(do phase.monad
- [left! (path' stack-depth @else @end phase archive leftP)
- right! (path' stack-depth @else @end phase archive rightP)]
+ [left! (path' stack_depth @else @end phase archive leftP)
+ right! (path' stack_depth @else @end phase archive rightP)]
(wrap ($_ _.compose
left!
right!)))
@@ -198,14 +198,14 @@
(def: (path @end phase archive path)
(-> Label (Generator Path))
(do phase.monad
- [@else //runtime.forge-label
+ [@else //runtime.forge_label
pathG (..path' 1 @else @end phase archive path)]
(wrap ($_ _.compose
pathG
- (_.set-label @else)
+ (_.set_label @else)
_.pop
- //runtime.pm-failure
- _.aconst-null
+ //runtime.pm_failure
+ _.aconst_null
(_.goto @end)))))
(def: #export (if phase archive [conditionS thenS elseS])
@@ -215,17 +215,17 @@
thenG (phase archive thenS)
elseG (phase archive elseS)]
(wrap (do _.monad
- [@else _.new-label
- @end _.new-label]
+ [@else _.new_label
+ @end _.new_label]
($_ _.compose
conditionG
(//value.unwrap type.boolean)
(_.ifeq @else)
thenG
(_.goto @end)
- (_.set-label @else)
+ (_.set_label @else)
elseG
- (_.set-label @end))))))
+ (_.set_label @end))))))
(def: #export (let phase archive [inputS register bodyS])
(Generator [Synthesis Register Synthesis])
@@ -241,26 +241,26 @@
(Generator [(List synthesis.Member) Synthesis])
(do phase.monad
[recordG (phase archive recordS)]
- (wrap (list\fold (function (_ step so-far)
+ (wrap (list\fold (function (_ step so_far)
(.let [next (.case step
(#.Left lefts)
- (..left-projection lefts)
+ (..left_projection lefts)
(#.Right lefts)
- (..right-projection lefts))]
- (_.compose so-far next)))
+ (..right_projection lefts))]
+ (_.compose so_far next)))
recordG
(list.reverse path)))))
(def: #export (case phase archive [valueS path])
(Generator [Synthesis Path])
(do phase.monad
- [@end //runtime.forge-label
+ [@end //runtime.forge_label
valueG (phase archive valueS)
pathG (..path @end phase archive path)]
(wrap ($_ _.compose
- _.aconst-null
+ _.aconst_null
valueG
//runtime.push
pathG
- (_.set-label @end)))))
+ (_.set_label @end)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
index da80cbfdd..943604bbc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux
@@ -75,80 +75,80 @@
(_\wrap []))
)))
-(def: this-offset 1)
+(def: this_offset 1)
-(def: #export (method class environment function-arity @begin body apply-arity)
+(def: #export (method class environment function_arity @begin body apply_arity)
(-> (Type Class) (Environment Synthesis) Arity Label (Bytecode Any) Arity (Resource Method))
- (let [num-partials (dec function-arity)
- over-extent (i.- (.int apply-arity)
- (.int function-arity))]
+ (let [num_partials (dec function_arity)
+ over_extent (i.- (.int apply_arity)
+ (.int function_arity))]
(method.method //.modifier ////runtime.apply::name
- (////runtime.apply::type apply-arity)
+ (////runtime.apply::type apply_arity)
(list)
- (#.Some (case num-partials
+ (#.Some (case num_partials
0 ($_ _.compose
////reference.this
- (..inputs ..this-offset apply-arity)
- (_.invokevirtual class //implementation.name (//implementation.type function-arity))
+ (..inputs ..this_offset apply_arity)
+ (_.invokevirtual class //implementation.name (//implementation.type function_arity))
_.areturn)
_ (do _.monad
- [@default _.new-label
- @labelsH _.new-label
- @labelsT (|> _.new-label
- (list.repeat (dec num-partials))
+ [@default _.new_label
+ @labelsH _.new_label
+ @labelsT (|> _.new_label
+ (list.repeat (dec num_partials))
(monad.seq _.monad))
#let [cases (|> (list\compose (#.Cons [@labelsH @labelsT])
(list @default))
list.enumeration
(list\map (function (_ [stage @case])
- (let [current-partials (|> (list.indices stage)
+ (let [current_partials (|> (list.indices stage)
(list\map (///partial.get class))
(monad.seq _.monad))
- already-partial? (n.> 0 stage)
- exact-match? (i.= over-extent (.int stage))
- has-more-than-necessary? (i.> over-extent (.int stage))]
+ already_partial? (n.> 0 stage)
+ exact_match? (i.= over_extent (.int stage))
+ has_more_than_necessary? (i.> over_extent (.int stage))]
($_ _.compose
- (_.set-label @case)
- (cond exact-match?
+ (_.set_label @case)
+ (cond exact_match?
($_ _.compose
////reference.this
- (if already-partial?
+ (if already_partial?
(_.invokevirtual class //reset.name (//reset.type class))
(_\wrap []))
- current-partials
- (..inputs ..this-offset apply-arity)
- (_.invokevirtual class //implementation.name (//implementation.type function-arity))
+ current_partials
+ (..inputs ..this_offset apply_arity)
+ (_.invokevirtual class //implementation.name (//implementation.type function_arity))
_.areturn)
- has-more-than-necessary?
- (let [inputs-to-completion (|> function-arity (n.- stage))
- inputs-left (|> apply-arity (n.- inputs-to-completion))]
+ has_more_than_necessary?
+ (let [inputs_to_completion (|> function_arity (n.- stage))
+ inputs_left (|> apply_arity (n.- inputs_to_completion))]
($_ _.compose
////reference.this
(_.invokevirtual class //reset.name (//reset.type class))
- current-partials
- (..inputs ..this-offset inputs-to-completion)
- (_.invokevirtual class //implementation.name (//implementation.type function-arity))
- (apply (n.+ ..this-offset inputs-to-completion) inputs-left)
+ current_partials
+ (..inputs ..this_offset inputs_to_completion)
+ (_.invokevirtual class //implementation.name (//implementation.type function_arity))
+ (apply (n.+ ..this_offset inputs_to_completion) inputs_left)
_.areturn))
- ## (i.< over-extent (.int stage))
- (let [current-environment (|> (list.indices (list.size environment))
+ ## (i.< over_extent (.int stage))
+ (let [current_environment (|> (list.indices (list.size environment))
(list\map (///foreign.get class))
(monad.seq _.monad))
- missing-partials (|> _.aconst-null
- (list.repeat (|> num-partials (n.- apply-arity) (n.- stage)))
+ missing_partials (|> _.aconst_null
+ (list.repeat (|> num_partials (n.- apply_arity) (n.- stage)))
(monad.seq _.monad))]
($_ _.compose
(_.new class)
_.dup
- current-environment
+ current_environment
///partial/count.value
- (..increment apply-arity)
- current-partials
- (..inputs ..this-offset apply-arity)
- missing-partials
- (_.invokevirtual class //init.name (//init.type environment function-arity))
+ (..increment apply_arity)
+ current_partials
+ (..inputs ..this_offset apply_arity)
+ missing_partials
+ (_.invokevirtual class //init.name (//init.type environment function_arity))
_.areturn)))))))
(monad.seq _.monad))]]
($_ _.compose
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux
index ef5717521..f44d62118 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux
@@ -56,18 +56,18 @@
type.void
(list)]))
-(def: no-partials (|> 0 unsigned.u1 try.assumed _.bipush))
+(def: no_partials (|> 0 unsigned.u1 try.assumed _.bipush))
-(def: #export (super environment-size arity)
+(def: #export (super environment_size arity)
(-> Nat Arity (Bytecode Any))
- (let [arity-register (inc environment-size)]
+ (let [arity_register (inc environment_size)]
($_ _.compose
(if (arity.unary? arity)
- ..no-partials
- (_.iload arity-register))
+ ..no_partials
+ (_.iload arity_register))
(_.invokespecial ///abstract.class ..name ///abstract.init))))
-(def: (store-all amount put offset)
+(def: (store_all amount put offset)
(-> Nat
(-> Register (Bytecode Any) (Bytecode Any))
(-> Register Register)
@@ -80,19 +80,19 @@
(def: #export (method class environment arity)
(-> (Type Class) (Environment Synthesis) Arity (Resource Method))
- (let [environment-size (list.size environment)
- offset-foreign (: (-> Register Register)
+ (let [environment_size (list.size environment)
+ offset_foreign (: (-> Register Register)
(n.+ 1))
- offset-arity (: (-> Register Register)
- (|>> offset-foreign (n.+ environment-size)))
- offset-partial (: (-> Register Register)
- (|>> offset-arity (n.+ 1)))]
+ offset_arity (: (-> Register Register)
+ (|>> offset_foreign (n.+ environment_size)))
+ offset_partial (: (-> Register Register)
+ (|>> offset_arity (n.+ 1)))]
(method.method //.modifier ..name
(..type environment arity)
(list)
(#.Some ($_ _.compose
////reference.this
- (..super environment-size arity)
- (store-all environment-size (///foreign.put class) offset-foreign)
- (store-all (dec arity) (///partial.put class) offset-partial)
+ (..super environment_size arity)
+ (store_all environment_size (///foreign.put class) offset_foreign)
+ (store_all (dec arity) (///partial.put class) offset_partial)
_.return)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux
index f6bfa0278..19c84c828 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux
@@ -42,12 +42,12 @@
["." arity (#+ Arity)]
["." phase]]]]]])
-(def: #export (instance' foreign-setup class environment arity)
+(def: #export (instance' foreign_setup class environment arity)
(-> (List (Bytecode Any)) (Type Class) (Environment Synthesis) Arity (Bytecode Any))
($_ _.compose
(_.new class)
_.dup
- (monad.seq _.monad foreign-setup)
+ (monad.seq _.monad foreign_setup)
(///partial.new arity)
(_.invokespecial class //init.name (//init.type environment arity))))
@@ -59,23 +59,23 @@
(def: #export (method class environment arity)
(-> (Type Class) (Environment Synthesis) Arity (Resource Method))
- (let [after-this (: (-> Nat Nat)
+ (let [after_this (: (-> Nat Nat)
(n.+ 1))
- environment-size (list.size environment)
- after-environment (: (-> Nat Nat)
- (|>> after-this (n.+ environment-size)))
- after-arity (: (-> Nat Nat)
- (|>> after-environment (n.+ 1)))]
+ environment_size (list.size environment)
+ after_environment (: (-> Nat Nat)
+ (|>> after_this (n.+ environment_size)))
+ after_arity (: (-> Nat Nat)
+ (|>> after_environment (n.+ 1)))]
(method.method //.modifier //init.name
(//init.type environment arity)
(list)
(#.Some ($_ _.compose
////reference.this
- (//init.super environment-size arity)
+ (//init.super environment_size arity)
(monad.map _.monad (function (_ register)
- (///foreign.put class register (_.aload (after-this register))))
- (list.indices environment-size))
+ (///foreign.put class register (_.aload (after_this register))))
+ (list.indices environment_size))
(monad.map _.monad (function (_ register)
- (///partial.put class register (_.aload (after-arity register))))
+ (///partial.put class register (_.aload (after_arity register))))
(list.indices (n.- ///arity.minimum arity)))
_.areturn)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
index 2f6b8041c..c0fb1765f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
@@ -137,7 +137,7 @@
(def: (define! library loader [module name] valueG)
(-> Library java/lang/ClassLoader Name (Bytecode Any) (Try [Text Any Definition]))
(let [class-name (format (text.replace-all .module-separator class-path-separator module)
- class-path-separator (name.normalize name)
+ class-path-separator (name.normal name)
"___" (%.nat (text\hash name)))]
(do try.monad
[[value definition] (evaluate! library loader class-name valueG)]
@@ -150,7 +150,7 @@
(: //runtime.Host
(implementation
(def: (evaluate! temp-label valueG)
- (let [eval-class (|> temp-label name.normalize (text.replace-all " " "$"))]
+ (let [eval-class (|> temp-label name.normal (text.replace-all " " "$"))]
(\ try.monad map product.left
(..evaluate! library loader eval-class valueG))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux
index 67a384781..e87a3f0df 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux
@@ -48,58 +48,58 @@
class.final
))
-(def: nil //runtime.none-injection)
+(def: nil //runtime.none_injection)
-(def: amount-of-inputs
+(def: amount_of_inputs
(Bytecode Any)
($_ _.compose
- _.aload-0
+ _.aload_0
_.arraylength))
(def: decrease
(Bytecode Any)
($_ _.compose
- _.iconst-1
+ _.iconst_1
_.isub))
(def: head
(Bytecode Any)
($_ _.compose
_.dup
- _.aload-0
+ _.aload_0
_.swap
_.aaload
_.swap
- _.dup-x2
+ _.dup_x2
_.pop))
(def: pair
(Bytecode Any)
($_ _.compose
- _.iconst-2
+ _.iconst_2
(_.anewarray ^Object)
- _.dup-x1
+ _.dup_x1
_.swap
- _.iconst-0
+ _.iconst_0
_.swap
_.aastore
- _.dup-x1
+ _.dup_x1
_.swap
- _.iconst-1
+ _.iconst_1
_.swap
_.aastore))
-(def: cons //runtime.right-injection)
+(def: cons //runtime.right_injection)
-(def: input-list
+(def: input_list
(Bytecode Any)
(do _.monad
- [@loop _.new-label
- @end _.new-label]
+ [@loop _.new_label
+ @end _.new_label]
($_ _.compose
..nil
- ..amount-of-inputs
- (_.set-label @loop)
+ ..amount_of_inputs
+ (_.set_label @loop)
..decrease
_.dup
(_.iflt @end)
@@ -108,28 +108,29 @@
..cons
_.swap
(_.goto @loop)
- (_.set-label @end)
+ (_.set_label @end)
_.pop)))
-(def: feed-inputs //runtime.apply)
+(def: feed_inputs
+ //runtime.apply)
-(def: run-io
+(def: run_io
(Bytecode Any)
($_ _.compose
(_.checkcast //function/abstract.class)
- _.aconst-null
+ _.aconst_null
//runtime.apply))
(def: #export (program program)
(-> (Bytecode Any) Definition)
- (let [super-class (|> ..^Object type.reflection reflection.reflection name.internal)
+ (let [super_class (|> ..^Object type.reflection reflection.reflection name.internal)
main (method.method ..main::modifier "main" ..main::type
(list)
(#.Some ($_ _.compose
program
- ..input-list
- ..feed-inputs
- ..run-io
+ ..input_list
+ ..feed_inputs
+ ..run_io
_.return)))]
[..class
(<| (format.run class.writer)
@@ -137,7 +138,7 @@
(class.class version.v6_0
..program::modifier
(name.internal ..class)
- super-class
+ super_class
(list)
(list)
(list main)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
index c41e5c16a..441cf5c63 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
@@ -28,26 +28,26 @@
(def: #export this
(Bytecode Any)
- _.aload-0)
+ _.aload_0)
(template [<name> <prefix>]
[(def: #export <name>
(-> Register Text)
(|>> %.nat (format <prefix>)))]
- [foreign-name "f"]
- [partial-name "p"]
+ [foreign_name "f"]
+ [partial_name "p"]
)
(def: (foreign archive variable)
(-> Archive Register (Operation (Bytecode Any)))
(do {! ////.monad}
- [bytecode-name (\ ! map //runtime.class-name
+ [bytecode_name (\ ! map //runtime.class_name
(generation.context archive))]
(wrap ($_ _.compose
..this
- (_.getfield (type.class bytecode-name (list))
- (..foreign-name variable)
+ (_.getfield (type.class bytecode_name (list))
+ (..foreign_name variable)
//type.value)))))
(def: #export (variable archive variable)
@@ -62,6 +62,6 @@
(def: #export (constant archive name)
(-> Archive Name (Operation (Bytecode Any)))
(do {! ////.monad}
- [bytecode-name (\ ! map //runtime.class-name
+ [bytecode_name (\ ! map //runtime.class_name
(generation.remember archive name))]
- (wrap (_.getstatic (type.class bytecode-name (list)) //value.field //type.value))))
+ (wrap (_.getstatic (type.class bytecode_name (list)) //value.field //type.value))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux
index 4ff9bdb81..6bc0ffe91 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux
@@ -57,12 +57,12 @@
(case (if right?
(.inc lefts)
lefts)
- 0 _.iconst-0
- 1 _.iconst-1
- 2 _.iconst-2
- 3 _.iconst-3
- 4 _.iconst-4
- 5 _.iconst-5
+ 0 _.iconst_0
+ 1 _.iconst_1
+ 2 _.iconst_2
+ 3 _.iconst_3
+ 4 _.iconst_4
+ 5 _.iconst_5
tag (case (signed.s1 (.int tag))
(#try.Success value)
(_.bipush value)
@@ -78,8 +78,8 @@
(def: #export (flag right?)
(-> Bit (Bytecode Any))
(if right?
- //runtime.right-flag
- //runtime.left-flag))
+ //runtime.right_flag
+ //runtime.left_flag))
(def: #export (variant generate archive [lefts right? valueS])
(Generator (Variant Synthesis))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
index 3e2ff3d09..36edc060a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
@@ -27,23 +27,23 @@
## else
(undefined))))]
- [primitive-wrapper
+ [primitive_wrapper
box.boolean box.byte box.short box.int
box.long box.float box.double box.char]
- [primitive-unwrap
+ [primitive_unwrap
"booleanValue" "byteValue" "shortValue" "intValue"
"longValue" "floatValue" "doubleValue" "charValue"]
)
(def: #export (wrap type)
(-> (Type Primitive) (Bytecode Any))
- (let [wrapper (type.class (primitive-wrapper type) (list))]
+ (let [wrapper (type.class (primitive_wrapper type) (list))]
(_.invokestatic wrapper "valueOf"
(type.method [(list) (list type) wrapper (list)]))))
(def: #export (unwrap type)
(-> (Type Primitive) (Bytecode Any))
- (let [wrapper (type.class (primitive-wrapper type) (list))]
+ (let [wrapper (type.class (primitive_wrapper type) (list))]
($_ _.compose
(_.checkcast wrapper)
- (_.invokevirtual wrapper (primitive-unwrap type) (type.method [(list) (list) type (list)])))))
+ (_.invokevirtual wrapper (primitive_unwrap type) (type.method [(list) (list) type (list)])))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index 8f1e5b117..f01c90d7a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -107,7 +107,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
index 231bb4a29..07b72e742 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
@@ -75,7 +75,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 34009976f..26aeb7f76 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -114,7 +114,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
index 4917eb90f..f646f82cd 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
@@ -81,7 +81,7 @@
((~' wrap) ((~ g!proc) [(~+ g!input+)])))
(~' _)
- (macro.fail (wrong-arity (~ g!name) +1 (list.size (~ g!inputs))))))))))))))
+ (macro.failure (wrong-arity (~ g!name) +1 (list.size (~ g!inputs))))))))))))))
(arity: nullary +0)
(arity: unary +1)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
index 40ef044f6..017a7a547 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
@@ -81,7 +81,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 3e8e09d8c..9e4f78b29 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -76,7 +76,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.local (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
index ec3def7fd..f383839f3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
@@ -63,7 +63,7 @@
(do {! meta.monad}
[ids (monad.seq ! (list.repeat (list.size vars) meta.count))]
(wrap (list (` (let [(~+ (|> vars
- (list.zip/2 ids)
+ (list.zipped/2 ids)
(list\map (function (_ [id var])
(list (code.local_identifier var)
(` (_.var (~ (code.text (format "v" (%.nat id)))))))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
index 2c6deeb27..c7f699f87 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
@@ -141,7 +141,7 @@
[5 #Directive <binary>.text]
[6 #Custom <binary>.text])
- _ (<>.fail (exception.construct ..invalid_category [tag])))))]
+ _ (<>.failure (exception.construct ..invalid_category [tag])))))]
(|> (<binary>.row/64 category)
(\ <>.monad map (row\fold (function (_ artifact registry)
(product.right
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
index cb52004f4..ba2cec5c2 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -10,7 +10,7 @@
["." try (#+ Try)]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]
+ ["." async (#+ Async) ("#\." monad)]]
["<>" parser
["<.>" binary (#+ Parser)]]]
[data
@@ -91,16 +91,16 @@
(get@ #static.artifact_extension static)))
(def: (ensure_directory fs path)
- (-> (file.System Promise) file.Path (Promise (Try Any)))
- (do promise.monad
+ (-> (file.System Async) file.Path (Async (Try Any)))
+ (do async.monad
[? (\ fs directory? path)]
(if ?
(wrap (#try.Success []))
(\ fs make_directory path))))
(def: #export (prepare fs static module_id)
- (-> (file.System Promise) Static archive.ID (Promise (Try Any)))
- (do {! promise.monad}
+ (-> (file.System Async) Static archive.ID (Async (Try Any)))
+ (do {! async.monad}
[#let [module (..module fs static module_id)]
module_exists? (\ fs directory? module)]
(if module_exists?
@@ -119,40 +119,40 @@
error])))))))))
(def: #export (write fs static module_id artifact_id content)
- (-> (file.System Promise) Static archive.ID artifact.ID Binary (Promise (Try Any)))
+ (-> (file.System Async) Static archive.ID artifact.ID Binary (Async (Try Any)))
(\ fs write content (..artifact fs static module_id artifact_id)))
(def: #export (enable fs static)
- (-> (file.System Promise) Static (Promise (Try Any)))
- (do (try.with promise.monad)
+ (-> (file.System Async) Static (Async (Try Any)))
+ (do (try.with async.monad)
[_ (..ensure_directory fs (get@ #static.target static))]
(..ensure_directory fs (..archive fs static))))
(def: (general_descriptor fs static)
- (-> (file.System Promise) Static file.Path)
+ (-> (file.System Async) Static file.Path)
(format (..archive fs static)
(\ fs separator)
"general_descriptor"))
(def: #export (freeze fs static archive)
- (-> (file.System Promise) Static Archive (Promise (Try Any)))
+ (-> (file.System Async) Static Archive (Async (Try Any)))
(\ fs write (archive.export ///.version archive) (..general_descriptor fs static)))
(def: module_descriptor_file
"module_descriptor")
(def: (module_descriptor fs static module_id)
- (-> (file.System Promise) Static archive.ID file.Path)
+ (-> (file.System Async) Static archive.ID file.Path)
(format (..module fs static module_id)
(\ fs separator)
..module_descriptor_file))
(def: #export (cache fs static module_id content)
- (-> (file.System Promise) Static archive.ID Binary (Promise (Try Any)))
+ (-> (file.System Async) Static archive.ID Binary (Async (Try Any)))
(\ fs write content (..module_descriptor fs static module_id)))
(def: (read_module_descriptor fs static module_id)
- (-> (file.System Promise) Static archive.ID (Promise (Try Binary)))
+ (-> (file.System Async) Static archive.ID (Async (Try Binary)))
(\ fs read (..module_descriptor fs static module_id)))
(def: parser
@@ -177,8 +177,8 @@
(wrap (set@ #.modules modules (fresh_analysis_state host)))))
(def: (cached_artifacts fs static module_id)
- (-> (file.System Promise) Static archive.ID (Promise (Try (Dictionary Text Binary))))
- (let [! (try.with promise.monad)]
+ (-> (file.System Async) Static archive.ID (Async (Try (Dictionary Text Binary))))
+ (let [! (try.with async.monad)]
(|> (..module fs static module_id)
(\ fs directory_files)
(\ ! map (|>> (list\map (function (_ file)
@@ -339,19 +339,19 @@
(def: (load_definitions fs static module_id host_environment descriptor document)
(All [expression directive]
- (-> (file.System Promise) Static archive.ID (generation.Host expression directive)
+ (-> (file.System Async) Static archive.ID (generation.Host expression directive)
Descriptor (Document .Module)
- (Promise (Try [[Descriptor (Document .Module) Output]
- Bundles]))))
- (do (try.with promise.monad)
+ (Async (Try [[Descriptor (Document .Module) Output]
+ Bundles]))))
+ (do (try.with async.monad)
[actual (cached_artifacts fs static module_id)
#let [expected (|> descriptor (get@ #descriptor.registry) artifact.artifacts)]
- [document bundles output] (promise\wrap (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))]
+ [document bundles output] (async\wrap (loaded_document (get@ #static.artifact_extension static) host_environment module_id expected actual document))]
(wrap [[descriptor document output] bundles])))
(def: (purge! fs static [module_name module_id])
- (-> (file.System Promise) Static [Module archive.ID] (Promise (Try Any)))
- (do {! (try.with promise.monad)}
+ (-> (file.System Async) Static [Module archive.ID] (Async (Try Any)))
+ (do {! (try.with async.monad)}
[#let [cache (..module fs static module_id)]
_ (|> cache
(\ fs directory_files)
@@ -404,15 +404,15 @@
(def: (load_every_reserved_module host_environment fs static import contexts archive)
(All [expression directive]
- (-> (generation.Host expression directive) (file.System Promise) Static Import (List Context) Archive
- (Promise (Try [Archive .Lux Bundles]))))
- (do {! (try.with promise.monad)}
+ (-> (generation.Host expression directive) (file.System Async) Static Import (List Context) Archive
+ (Async (Try [Archive .Lux Bundles]))))
+ (do {! (try.with async.monad)}
[pre_loaded_caches (|> archive
archive.reservations
(monad.map ! (function (_ [module_name module_id])
(do !
[data (..read_module_descriptor fs static module_id)
- [descriptor document] (promise\wrap (<binary>.run ..parser data))]
+ [descriptor document] (async\wrap (<binary>.run ..parser data))]
(if (text\= archive.runtime_module module_name)
(wrap [true
[module_name [module_id [descriptor document]]]])
@@ -428,7 +428,7 @@
archive)
(\ try.monad map (dependency.load_order $.key))
(\ try.monad join)
- promise\wrap)
+ async\wrap)
#let [purge (..full_purge pre_loaded_caches load_order)]
_ (|> purge
dictionary.entries
@@ -440,7 +440,7 @@
[[descriptor,document,output bundles] (..load_definitions fs static module_id host_environment descriptor document)]
(wrap [[module_name descriptor,document,output]
bundles])))))]
- (promise\wrap
+ (async\wrap
(do {! try.monad}
[archive (monad.fold !
(function (_ [[module descriptor,document,output] _bundle] archive)
@@ -461,14 +461,14 @@
(def: #export (thaw host_environment fs static import contexts)
(All [expression directive]
- (-> (generation.Host expression directive) (file.System Promise) Static Import (List Context)
- (Promise (Try [Archive .Lux Bundles]))))
- (do promise.monad
+ (-> (generation.Host expression directive) (file.System Async) Static Import (List Context)
+ (Async (Try [Archive .Lux Bundles]))))
+ (do async.monad
[binary (\ fs read (..general_descriptor fs static))]
(case binary
(#try.Success binary)
- (do (try.with promise.monad)
- [archive (promise\wrap (archive.import ///.version binary))]
+ (do (try.with async.monad)
+ [archive (async\wrap (archive.import ///.version binary))]
(..load_every_reserved_module host_environment fs static import contexts archive))
(#try.Failure error)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
index 6e619d93d..f62d00cf2 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
@@ -9,7 +9,7 @@
["." try (#+ Try)]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]]
+ ["." async (#+ Async) ("#\." monad)]]]
[data
[binary (#+ Binary)]
["." text ("#\." hash)
@@ -48,19 +48,19 @@
(def: #export (path fs context module)
(All [m] (-> (file.System m) Context Module file.Path))
(|> module
- (//.sanitize fs)
+ (//.safe fs)
(format context (\ fs separator))))
(def: (find_source_file fs importer contexts module extension)
- (-> (file.System Promise) Module (List Context) Module Extension
- (Promise (Try file.Path)))
+ (-> (file.System Async) Module (List Context) Module Extension
+ (Async (Try file.Path)))
(case contexts
#.Nil
- (promise\wrap (exception.throw ..cannot_find_module [importer module]))
+ (async\wrap (exception.throw ..cannot_find_module [importer module]))
(#.Cons context contexts')
(let [path (format (..path fs context module) extension)]
- (do promise.monad
+ (do async.monad
[? (\ fs file? path)]
(if ?
(wrap (#try.Success path))
@@ -71,11 +71,11 @@
(format partial_host_extension ..lux_extension))
(def: (find_local_source_file fs importer import contexts partial_host_extension module)
- (-> (file.System Promise) Module Import (List Context) Extension Module
- (Promise (Try [file.Path Binary])))
+ (-> (file.System Async) Module Import (List Context) Extension Module
+ (Async (Try [file.Path Binary])))
## Preference is explicitly being given to Lux files that have a host extension.
## Normal Lux files (i.e. without a host extension) are then picked as fallback files.
- (do {! promise.monad}
+ (do {! async.monad}
[outcome (..find_source_file fs importer contexts module (..full_host_extension partial_host_extension))]
(case outcome
(#try.Success path)
@@ -107,11 +107,11 @@
(exception.throw ..cannot_find_module [importer module]))))))
(def: (find_any_source_file fs importer import contexts partial_host_extension module)
- (-> (file.System Promise) Module Import (List Context) Extension Module
- (Promise (Try [file.Path Binary])))
+ (-> (file.System Async) Module Import (List Context) Extension Module
+ (Async (Try [file.Path Binary])))
## Preference is explicitly being given to Lux files that have a host extension.
## Normal Lux files (i.e. without a host extension) are then picked as fallback files.
- (do {! promise.monad}
+ (do {! async.monad}
[outcome (find_local_source_file fs importer import contexts partial_host_extension module)]
(case outcome
(#try.Success [path data])
@@ -121,9 +121,9 @@
(wrap (..find_library_source_file importer import partial_host_extension module)))))
(def: #export (read fs importer import contexts partial_host_extension module)
- (-> (file.System Promise) Module Import (List Context) Extension Module
- (Promise (Try Input)))
- (do (try.with promise.monad)
+ (-> (file.System Async) Module Import (List Context) Extension Module
+ (Async (Try Input)))
+ (do (try.with async.monad)
[[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)]
(case (\ utf8.codec decode binary)
(#try.Success code)
@@ -133,21 +133,21 @@
#////.code code})
(#try.Failure _)
- (promise\wrap (exception.throw ..cannot_read_module [module])))))
+ (async\wrap (exception.throw ..cannot_read_module [module])))))
(type: #export Enumeration
(Dictionary file.Path Binary))
(def: (enumerate_context fs directory enumeration)
- (-> (file.System Promise) Context Enumeration (Promise (Try Enumeration)))
- (do {! (try.with promise.monad)}
+ (-> (file.System Async) Context Enumeration (Async (Try Enumeration)))
+ (do {! (try.with async.monad)}
[enumeration (|> directory
(\ fs directory_files)
(\ ! map (monad.fold ! (function (_ file enumeration)
(if (text.ends_with? ..lux_extension file)
(do !
[source_code (\ fs read file)]
- (promise\wrap
+ (async\wrap
(dictionary.try_put (file.name fs file) source_code enumeration)))
(wrap enumeration)))
enumeration))
@@ -158,12 +158,12 @@
(\ ! join))))
(def: Action
- (type (All [a] (Promise (Try a)))))
+ (type (All [a] (Async (Try a)))))
(def: #export (enumerate fs contexts)
- (-> (file.System Promise) (List Context) (Action Enumeration))
+ (-> (file.System Async) (List Context) (Action Enumeration))
(monad.fold (: (Monad Action)
- (try.with promise.monad))
+ (try.with async.monad))
(..enumerate_context fs)
(: Enumeration
(dictionary.new text.hash))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
index 60c50db11..8f0b9ee68 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -5,9 +5,7 @@
[abstract
["." monad (#+ Monad do)]]
[control
- ["." try (#+ Try)]
- [concurrency
- ["." promise (#+ Promise)]]]
+ ["." try (#+ Try)]]
[data
["." binary (#+ Binary)]
["." maybe ("#\." functor)]
diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux
index f7e3ddf03..522b564ab 100644
--- a/stdlib/source/library/lux/tool/compiler/phase.lux
+++ b/stdlib/source/library/lux/tool/compiler/phase.lux
@@ -68,13 +68,13 @@
[[state' output] (operation (get state))]
(wrap [(set state' state) output]))))
-(def: #export fail
+(def: #export failure
(-> Text Operation)
(|>> #try.Failure (state.lift try.monad)))
(def: #export (throw exception parameters)
(All [e] (-> (Exception e) e Operation))
- (..fail (ex.construct exception parameters)))
+ (..failure (ex.construct exception parameters)))
(def: #export (lift error)
(All [s a] (-> (Try a) (Operation s a)))
diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux
index 8008dea25..05daa46aa 100644
--- a/stdlib/source/library/lux/tool/interpreter.lux
+++ b/stdlib/source/library/lux/tool/interpreter.lux
@@ -34,34 +34,38 @@
(def: #export module "<INTERPRETER>")
-(def: fresh-source Source [[..module 1 0] 0 ""])
+(def: fresh_source
+ Source
+ [[..module 1 0] 0 ""])
-(def: (add-line line [where offset input])
+(def: (add_line line [where offset input])
(-> Text Source Source)
- [where offset (format input text.new-line line)])
+ [where offset (format input text.new_line line)])
-(def: exit-command Text "exit")
+(def: exit_command
+ Text
+ "exit")
-(def: welcome-message
+(def: welcome_message
Text
- (format text.new-line
- "Welcome to the interpreter!" text.new-line
- "Type '" ..exit-command "' to leave." text.new-line
- text.new-line))
+ (format text.new_line
+ "Welcome to the interpreter!" text.new_line
+ "Type '" ..exit_command "' to leave." text.new_line
+ text.new_line))
-(def: farewell-message
+(def: farewell_message
Text
"Till next time...")
-(def: enter-module
+(def: enter_module
(All [anchor expression directive]
(Operation anchor expression directive Any))
- (directive.lift-analysis
+ (directive.lift_analysis
(do phase.monad
[_ (module.create 0 ..module)]
- (analysis.set-current-module ..module))))
+ (analysis.set_current_module ..module))))
-(def: (initialize Monad<!> Console<!> platform configuration generation-bundle)
+(def: (initialize Monad<!> Console<!> platform configuration generation_bundle)
(All [! anchor expression directive]
(-> (Monad !)
(Console !) (Platform ! anchor expression directive)
@@ -69,7 +73,7 @@
(generation.Bundle anchor expression directive)
(! (State+ anchor expression directive))))
(do Monad<!>
- [state (platform.initialize platform generation-bundle)
+ [state (platform.initialize platform generation_bundle)
state (platform.compile platform
(set@ #cli.module syntax.prelude configuration)
(set@ [#extension.state
@@ -78,78 +82,78 @@
#.info #.mode]
#.Interpreter
state))
- [state _] (\ (get@ #platform.file-system platform)
- lift (phase.run' state enter-module))
- _ (\ Console<!> write ..welcome-message)]
+ [state _] (\ (get@ #platform.file_system platform)
+ lift (phase.run' state enter_module))
+ _ (\ Console<!> write ..welcome_message)]
(wrap state)))
-(with-expansions [<Interpretation> (as-is (Operation anchor expression directive [Type Any]))]
-
- (def: (interpret-directive code)
- (All [anchor expression directive]
- (-> Code <Interpretation>))
- (do phase.monad
- [_ (total.phase code)
- _ init.refresh]
- (wrap [Any []])))
-
- (def: (interpret-expression code)
- (All [anchor expression directive]
- (-> Code <Interpretation>))
- (do {! phase.monad}
- [state (extension.lift phase.get-state)
- #let [analyse (get@ [#directive.analysis #directive.phase] state)
- synthesize (get@ [#directive.synthesis #directive.phase] state)
- generate (get@ [#directive.generation #directive.phase] state)]
- [_ codeT codeA] (directive.lift-analysis
- (analysis.with-scope
- (type.with-fresh-env
- (do !
- [[codeT codeA] (type.with-inference
- (analyse code))
- codeT (type.with-env
- (check.clean codeT))]
- (wrap [codeT codeA])))))
- codeS (directive.lift-synthesis
- (synthesize codeA))]
- (directive.lift-generation
- (generation.with-buffer
- (do !
- [codeH (generate codeS)
- count generation.next
- codeV (generation.evaluate! (format "interpretation_" (%.nat count)) codeH)]
- (wrap [codeT codeV]))))))
-
- (def: (interpret configuration code)
- (All [anchor expression directive]
- (-> Configuration Code <Interpretation>))
- (function (_ state)
- (case (<| (phase.run' state)
- (:sharing [anchor expression directive]
- {(State+ anchor expression directive)
- state}
- {<Interpretation>
- (interpret-directive code)}))
- (#try.Success [state' output])
- (#try.Success [state' output])
-
- (#try.Failure error)
- (if (ex.match? total.not-a-directive error)
- (<| (phase.run' state)
- (:sharing [anchor expression directive]
- {(State+ anchor expression directive)
- state}
- {<Interpretation>
- (interpret-expression code)}))
- (#try.Failure error)))))
- )
+(with_expansions [<Interpretation> (as_is (Operation anchor expression directive [Type Any]))]
+
+ (def: (interpret_directive code)
+ (All [anchor expression directive]
+ (-> Code <Interpretation>))
+ (do phase.monad
+ [_ (total.phase code)
+ _ init.refresh]
+ (wrap [Any []])))
+
+ (def: (interpret_expression code)
+ (All [anchor expression directive]
+ (-> Code <Interpretation>))
+ (do {! phase.monad}
+ [state (extension.lift phase.get_state)
+ #let [analyse (get@ [#directive.analysis #directive.phase] state)
+ synthesize (get@ [#directive.synthesis #directive.phase] state)
+ generate (get@ [#directive.generation #directive.phase] state)]
+ [_ codeT codeA] (directive.lift_analysis
+ (analysis.with_scope
+ (type.with_fresh_env
+ (do !
+ [[codeT codeA] (type.with_inference
+ (analyse code))
+ codeT (type.with_env
+ (check.clean codeT))]
+ (wrap [codeT codeA])))))
+ codeS (directive.lift_synthesis
+ (synthesize codeA))]
+ (directive.lift_generation
+ (generation.with_buffer
+ (do !
+ [codeH (generate codeS)
+ count generation.next
+ codeV (generation.evaluate! (format "interpretation_" (%.nat count)) codeH)]
+ (wrap [codeT codeV]))))))
+
+ (def: (interpret configuration code)
+ (All [anchor expression directive]
+ (-> Configuration Code <Interpretation>))
+ (function (_ state)
+ (case (<| (phase.run' state)
+ (:sharing [anchor expression directive]
+ {(State+ anchor expression directive)
+ state}
+ {<Interpretation>
+ (interpret_directive code)}))
+ (#try.Success [state' output])
+ (#try.Success [state' output])
+
+ (#try.Failure error)
+ (if (ex.match? total.not_a_directive error)
+ (<| (phase.run' state)
+ (:sharing [anchor expression directive]
+ {(State+ anchor expression directive)
+ state}
+ {<Interpretation>
+ (interpret_expression code)}))
+ (#try.Failure error)))))
+ )
(def: (execute configuration code)
(All [anchor expression directive]
(-> Configuration Code (Operation anchor expression directive Text)))
(do phase.monad
[[codeT codeV] (interpret configuration code)
- state phase.get-state]
+ state phase.get_state]
(wrap (/type.represent (get@ [#extension.state
#directive.analysis #directive.state
#extension.state]
@@ -162,32 +166,32 @@
#state (State+ anchor expression directive)
#source Source})
-(with-expansions [<Context> (as-is (Context anchor expression directive))]
- (def: (read-eval-print context)
- (All [anchor expression directive]
- (-> <Context> (Try [<Context> Text])))
- (do try.monad
- [#let [[_where _offset _code] (get@ #source context)]
- [source' input] (syntax.parse ..module syntax.no-aliases (text.size _code) (get@ #source context))
- [state' representation] (let [## TODO: Simplify ASAP
- state (:sharing [anchor expression directive]
- {<Context>
- context}
- {(State+ anchor expression directive)
- (get@ #state context)})]
- (<| (phase.run' state)
- ## TODO: Simplify ASAP
- (:sharing [anchor expression directive]
- {<Context>
- context}
- {(Operation anchor expression directive Text)
- (execute (get@ #configuration context) input)})))]
- (wrap [(|> context
- (set@ #state state')
- (set@ #source source'))
- representation]))))
-
-(def: #export (run Monad<!> Console<!> platform configuration generation-bundle)
+(with_expansions [<Context> (as_is (Context anchor expression directive))]
+ (def: (read_eval_print context)
+ (All [anchor expression directive]
+ (-> <Context> (Try [<Context> Text])))
+ (do try.monad
+ [#let [[_where _offset _code] (get@ #source context)]
+ [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (get@ #source context))
+ [state' representation] (let [## TODO: Simplify ASAP
+ state (:sharing [anchor expression directive]
+ {<Context>
+ context}
+ {(State+ anchor expression directive)
+ (get@ #state context)})]
+ (<| (phase.run' state)
+ ## TODO: Simplify ASAP
+ (:sharing [anchor expression directive]
+ {<Context>
+ context}
+ {(Operation anchor expression directive Text)
+ (execute (get@ #configuration context) input)})))]
+ (wrap [(|> context
+ (set@ #state state')
+ (set@ #source source'))
+ representation]))))
+
+(def: #export (run Monad<!> Console<!> platform configuration generation_bundle)
(All [! anchor expression directive]
(-> (Monad !)
(Console !) (Platform ! anchor expression directive)
@@ -198,25 +202,25 @@
[state (initialize Monad<!> Console<!> platform configuration)]
(loop [context {#configuration configuration
#state state
- #source ..fresh-source}
- multi-line? #0]
+ #source ..fresh_source}
+ multi_line? #0]
(do !
- [_ (if multi-line?
+ [_ (if multi_line?
(\ Console<!> write " ")
(\ Console<!> write "> "))
- line (\ Console<!> read-line)]
- (if (and (not multi-line?)
- (text\= ..exit-command line))
- (\ Console<!> write ..farewell-message)
- (case (read-eval-print (update@ #source (add-line line) context))
+ line (\ Console<!> read_line)]
+ (if (and (not multi_line?)
+ (text\= ..exit_command line))
+ (\ Console<!> write ..farewell_message)
+ (case (read_eval_print (update@ #source (add_line line) context))
(#try.Success [context' representation])
(do !
[_ (\ Console<!> write representation)]
(recur context' #0))
(#try.Failure error)
- (if (ex.match? syntax.end-of-file error)
+ (if (ex.match? syntax.end_of_file error)
(recur context #1)
(exec (log! (ex.construct ..error error))
- (recur (set@ #source ..fresh-source context) #0))))))
+ (recur (set@ #source ..fresh_source context) #0))))))
)))
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 60ef3a4a2..fbf41c94d 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -1,4 +1,5 @@
-(.module: {#.doc "Basic functionality for working with types."}
+(.module:
+ {#.doc "Basic functionality for working with types."}
[library
[lux (#- function)
["@" target]
@@ -187,7 +188,7 @@
(n.= (list.size yparams) (list.size xparams))
(list\fold (.function (_ [x y] prev) (and prev (= x y)))
#1
- (list.zip/2 xparams yparams)))
+ (list.zipped/2 xparams yparams)))
(^template [<tag>]
[[(<tag> xid) (<tag> yid)]
@@ -214,7 +215,7 @@
(= xbody ybody)
(list\fold (.function (_ [x y] prev) (and prev (= x y)))
#1
- (list.zip/2 xenv yenv)))
+ (list.zipped/2 xenv yenv)))
_
#0
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 24335b7bb..f01edbe64 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -165,7 +165,7 @@
(#try.Failure error)
(#try.Failure error)))
-(def: #export (fail message)
+(def: #export (failure message)
(All [a] (-> Text (Check a)))
(function (_ context)
(#try.Failure message)))
@@ -179,7 +179,7 @@
(def: #export (throw exception message)
(All [e a] (-> (Exception e) e (Check a)))
- (..fail (exception.construct exception message)))
+ (..failure (exception.construct exception message)))
(def: #export existential
{#.doc "A producer of existential types."}
@@ -460,7 +460,7 @@
(def: silent_failure!
(All [a] (Check a))
- (..fail ""))
+ (..failure ""))
## TODO: "check_apply" can be optimized...
(def: (check_apply check' assumptions expected actual)
diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux
index b5a6e7fc0..5c5d79c81 100644
--- a/stdlib/source/library/lux/type/dynamic.lux
+++ b/stdlib/source/library/lux/type/dynamic.lux
@@ -47,5 +47,5 @@
(def: #export (format value)
(-> Dynamic (Try Text))
(let [[type value] (:representation value)]
- (debug.represent type value)))
+ (debug.representation type value)))
)
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index fb2598ab8..f405062e3 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -40,10 +40,10 @@
(\ meta.monad wrap type))
(#.Some [_ #.None])
- (meta.fail (format "Unbound type-var " (%.nat id)))
+ (meta.failure (format "Unbound type-var " (%.nat id)))
#.None
- (meta.fail (format "Unknown type-var " (%.nat id)))
+ (meta.failure (format "Unknown type-var " (%.nat id)))
))
(def: (resolve_type var_name)
@@ -67,7 +67,7 @@
(#.Apply arg func)
(case (type.applied (list arg) func)
#.None
- (check.fail (format "Cannot apply type " (%.type func) " to type " (%.type arg)))
+ (check.failure (format "Cannot apply type " (%.type func) " to type " (%.type arg)))
(#.Some sig_type')
(find_member_type idx sig_type'))
@@ -80,14 +80,14 @@
_
(if (n.= 0 idx)
(\ check.monad wrap sig_type)
- (check.fail (format "Cannot find member type " (%.nat idx) " for " (%.type sig_type))))))
+ (check.failure (format "Cannot find member type " (%.nat idx) " for " (%.type sig_type))))))
(def: (find_member_name member)
(-> Name (Meta Name))
(case member
["" simple_name]
(meta.either (do meta.monad
- [member (meta.normalize member)
+ [member (meta.normal member)
_ (meta.resolve_tag member)]
(wrap member))
(do {! meta.monad}
@@ -99,13 +99,13 @@
tag_lists)]]
(case candidates
#.Nil
- (meta.fail (format "Unknown tag: " (%.name member)))
+ (meta.failure (format "Unknown tag: " (%.name member)))
(#.Cons winner #.Nil)
(wrap winner)
_
- (meta.fail (format "Too many candidate tags: " (%.list %.name candidates))))))
+ (meta.failure (format "Too many candidate tags: " (%.list %.name candidates))))))
_
(\ meta.monad wrap member)))
@@ -157,7 +157,7 @@
(wrap (list\fold (function (_ [imported_module definitions] tail)
(prepare_definitions imported_module this_module_name definitions tail))
#.Nil
- (list.zip/2 imported_modules accessible_definitions)))))
+ (list.zipped/2 imported_modules accessible_definitions)))))
(def: (apply_function_type func arg)
(-> Type Type (Check Type))
@@ -177,7 +177,7 @@
(wrap output))
_
- (check.fail (format "Invalid function type: " (%.type func)))))
+ (check.failure (format "Invalid function type: " (%.type func)))))
(def: (concrete_type type)
(-> Type (Check [(List Nat) Type]))
@@ -229,7 +229,7 @@
(list [alt_name =deps]))))
list\join)
#.Nil
- (meta.fail (format "No candidates for provisioning: " (%.type dep)))
+ (meta.failure (format "No candidates for provisioning: " (%.type dep)))
found
(wrap found))))
@@ -242,18 +242,18 @@
(do meta.monad [alts ..local_structs] (..test_provision provision context dep alts))
(do meta.monad [alts ..imported_structs] (..test_provision provision context dep alts))))
(#.Left error)
- (check.fail error)
+ (check.failure error)
(#.Right candidates)
(case candidates
#.Nil
- (check.fail (format "No candidates for provisioning: " (%.type dep)))
+ (check.failure (format "No candidates for provisioning: " (%.type dep)))
(#.Cons winner #.Nil)
(\ check.monad wrap winner)
_
- (check.fail (format "Too many candidates for provisioning: " (%.type dep) " --- " (%.list (|>> product.left %.name) candidates))))
+ (check.failure (format "Too many candidates for provisioning: " (%.type dep) " --- " (%.list (|>> product.left %.name) candidates))))
))
(def: (test_alternatives sig_type member_idx input_types output_type alts)
@@ -280,7 +280,7 @@
(list [alt_name =deps]))))
list\join)
#.Nil
- (meta.fail (format "No alternatives for " (%.type (type.function input_types output_type))))
+ (meta.failure (format "No alternatives for " (%.type (type.function input_types output_type))))
found
(wrap found))))
@@ -351,7 +351,7 @@
chosen_ones (find_alternatives sig_type member_idx input_types output_type)]
(case chosen_ones
#.Nil
- (meta.fail (format "No implementation could be found for member: " (%.name member)))
+ (meta.failure (format "No implementation could be found for member: " (%.name member)))
(#.Cons chosen #.Nil)
(wrap (list (` (\ (~ (instance$ chosen))
@@ -359,16 +359,16 @@
(~+ (list\map code.identifier args))))))
_
- (meta.fail (format "Too many implementations available: "
- (|> chosen_ones
- (list\map (|>> product.left %.name))
- (text.join_with ", "))
- " --- for type: " (%.type sig_type)))))
+ (meta.failure (format "Too many implementations available: "
+ (|> chosen_ones
+ (list\map (|>> product.left %.name))
+ (text.join_with ", "))
+ " --- for type: " (%.type sig_type)))))
(#.Right [args _])
(do {! meta.monad}
[labels (|> (macro.gensym "") (list.repeat (list.size args)) (monad.seq !))]
- (wrap (list (` (let [(~+ (|> (list.zip/2 labels args) (list\map join_pair) list\join))]
+ (wrap (list (` (let [(~+ (|> (list.zipped/2 labels args) (list\map join_pair) list\join))]
(..\\ (~ (code.identifier member)) (~+ labels)))))))
))
@@ -385,7 +385,7 @@
(syntax: #export (with {implementations ..implicits} body)
(do meta.monad
[g!implicit+ (implicit_bindings (list.size implementations))]
- (wrap (list (` (let [(~+ (|> (list.zip/2 g!implicit+ implementations)
+ (wrap (list (` (let [(~+ (|> (list.zipped/2 g!implicit+ implementations)
(list\map (function (_ [g!implicit implementation])
(list g!implicit implementation)))
list\join))]
@@ -394,7 +394,7 @@
(syntax: #export (implicit: {implementations ..implicits})
(do meta.monad
[g!implicit+ (implicit_bindings (list.size implementations))]
- (wrap (|> (list.zip/2 g!implicit+ implementations)
+ (wrap (|> (list.zipped/2 g!implicit+ implementations)
(list\map (function (_ [g!implicit implementation])
(` (def: (~ g!implicit)
{#.implementation? #1}
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index 5a2b79c1d..5fc4e760a 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -9,7 +9,7 @@
["." exception (#+ exception:)]
["." io (#+ IO)]
[concurrency
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
["<>" parser
["<.>" code (#+ Parser)]]]
[data
@@ -78,7 +78,7 @@
[pure Identity identity.monad run_pure lift_pure]
[sync IO io.monad run_sync lift_sync]
- [async Promise promise.monad run_async lift_async]
+ [async Async async.monad run_async lift_async]
)
(abstract: #export Ordered Any)
@@ -110,10 +110,10 @@
[ordered_pure Identity identity.monad Ordered ordered_key]
[ordered_sync IO io.monad Ordered ordered_key]
- [ordered_async Promise promise.monad Ordered ordered_key]
+ [ordered_async Async async.monad Ordered ordered_key]
[commutative_sync IO io.monad Commutative commutative_key]
[commutative_pure Identity identity.monad Commutative commutative_key]
- [commutative_async Promise promise.monad Commutative commutative_key]
+ [commutative_async Async async.monad Commutative commutative_key]
)
(template [<name> <m> <monad>]
@@ -125,7 +125,7 @@
[read_pure Identity identity.monad]
[read_sync IO io.monad]
- [read_async Promise promise.monad]
+ [read_async Async async.monad]
))
(exception: #export (index_cannot_be_repeated {index Nat})
@@ -185,7 +185,7 @@
[exchange_pure Identity identity.monad]
[exchange_sync IO io.monad]
- [exchange_async Promise promise.monad]
+ [exchange_async Async async.monad]
)
(def: amount
@@ -211,8 +211,8 @@
[group_pure Identity identity.monad (~+ g!keys) [(~+ g!keys)]]
[group_sync IO io.monad (~+ g!keys) [(~+ g!keys)]]
- [group_async Promise promise.monad (~+ g!keys) [(~+ g!keys)]]
+ [group_async Async async.monad (~+ g!keys) [(~+ g!keys)]]
[un_group_pure Identity identity.monad [(~+ g!keys)] (~+ g!keys)]
[un_group_sync IO io.monad [(~+ g!keys)] (~+ g!keys)]
- [un_group_async Promise promise.monad [(~+ g!keys)] (~+ g!keys)]
+ [un_group_async Async async.monad [(~+ g!keys)] (~+ g!keys)]
)
diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux
index 5020554a1..ee52d4029 100644
--- a/stdlib/source/library/lux/world/console.lux
+++ b/stdlib/source/library/lux/world/console.lux
@@ -10,7 +10,7 @@
["." exception (#+ exception:)]
["." io (#+ IO io)]
[concurrency
- ["." promise (#+ Promise)]
+ ["." async (#+ Async)]
["." atom]]]
[data
["." text (#+ Char)
@@ -27,11 +27,11 @@
close))
(def: #export (async console)
- (-> (Console IO) (Console Promise))
+ (-> (Console IO) (Console Async))
(`` (implementation
(~~ (template [<capability>]
[(def: <capability>
- (|>> (\ console <capability>) promise.future))]
+ (|>> (\ console <capability>) async.future))]
[read]
[read_line]
diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux
index 5ef233daf..4fed0df0e 100644
--- a/stdlib/source/library/lux/world/db/jdbc.lux
+++ b/stdlib/source/library/lux/world/db/jdbc.lux
@@ -8,7 +8,7 @@
["." try (#+ Try)]
["ex" exception]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]
+ ["." async (#+ Async) ("#\." monad)]]
[security
["!" capability (#+ capability:)]]]
[data
@@ -101,10 +101,10 @@
(wrap result)))
(def: #export (async db)
- (-> (DB IO) (DB Promise))
+ (-> (DB IO) (DB Async))
(`` (implementation
(~~ (template [<name> <forge>]
- [(def: <name> (<forge> (|>> (!.use (\ db <name>)) promise.future)))]
+ [(def: <name> (<forge> (|>> (!.use (\ db <name>)) async.future)))]
[execute can-execute]
[insert can-insert]
@@ -123,20 +123,20 @@
(..can-execute
(function (execute statement)
(with-statement statement connection
- (function (_ prepared)
- (do (try.with io.monad)
- [row-count (java/sql/PreparedStatement::executeUpdate prepared)]
- (wrap (.nat row-count))))))))
+ (function (_ prepared)
+ (do (try.with io.monad)
+ [row-count (java/sql/PreparedStatement::executeUpdate prepared)]
+ (wrap (.nat row-count))))))))
(def: insert
(..can-insert
(function (insert statement)
(with-statement statement connection
- (function (_ prepared)
- (do (try.with io.monad)
- [_ (java/sql/PreparedStatement::executeUpdate prepared)
- result-set (io.io (java/sql/Statement::getGeneratedKeys prepared))]
- (/output.rows /output.long result-set)))))))
+ (function (_ prepared)
+ (do (try.with io.monad)
+ [_ (java/sql/PreparedStatement::executeUpdate prepared)
+ result-set (io.io (java/sql/Statement::getGeneratedKeys prepared))]
+ (/output.rows /output.long result-set)))))))
(def: close
(..can-close
@@ -147,10 +147,10 @@
(..can-query
(function (query [statement output])
(with-statement statement connection
- (function (_ prepared)
- (do (try.with io.monad)
- [result-set (java/sql/PreparedStatement::executeQuery prepared)]
- (/output.rows output result-set)))))))
+ (function (_ prepared)
+ (do (try.with io.monad)
+ [result-set (java/sql/PreparedStatement::executeQuery prepared)]
+ (/output.rows output result-set)))))))
)))))
(def: #export (with-db creds action)
@@ -167,10 +167,10 @@
(def: #export (with-async-db creds action)
(All [a]
(-> Credentials
- (-> (DB Promise) (Promise (Try a)))
- (Promise (Try a))))
- (do (try.with promise.monad)
- [db (promise.future (..connect creds))
+ (-> (DB Async) (Async (Try a)))
+ (Async (Try a))))
+ (do (try.with async.monad)
+ [db (async.future (..connect creds))
result (action (..async db))
- _ (promise\wrap (io.run (!.use (\ db close) [])))]
+ _ (async\wrap (io.run (!.use (\ db close) [])))]
(wrap result)))
diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux
index b172a1ac9..e6aae5c1e 100644
--- a/stdlib/source/library/lux/world/db/jdbc/output.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/output.lux
@@ -172,14 +172,14 @@
[temp (java/sql/ResultSet::close results)]
(wrap (do try.monad
[_ temp]
- (try.fail error))))))
+ (try.failure error))))))
(#try.Failure error)
(do io.monad
[temp (java/sql/ResultSet::close results)]
(wrap (do try.monad
[_ temp]
- (try.fail error)))))
+ (try.failure error)))))
(do io.monad
[temp (java/sql/ResultSet::close results)]
(wrap (do try.monad
@@ -191,5 +191,5 @@
[temp (java/sql/ResultSet::close results)]
(wrap (do try.monad
[_ temp]
- (try.fail error))))
+ (try.failure error))))
))
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index ac2912f16..d34904eea 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -12,7 +12,7 @@
["." io (#+ IO) ("#\." functor)]
["." function]
[concurrency
- ["." promise (#+ Promise)]
+ ["." async (#+ Async)]
["." stm (#+ Var STM)]]]
[data
["." bit ("#\." equivalence)]
@@ -101,7 +101,7 @@
(maybe.default path)))
(def: #export (async fs)
- (-> (System IO) (System Promise))
+ (-> (System IO) (System Async))
(`` (implementation
(def: separator
(\ fs separator))
@@ -109,7 +109,7 @@
(~~ (template [<name>]
[(def: <name>
(|>> (\ fs <name>)
- promise.future))]
+ async.future))]
[file?]
[directory?]
@@ -126,7 +126,7 @@
(~~ (template [<name>]
[(def: (<name> input path)
- (promise.future (\ fs <name> input path)))]
+ (async.future (\ fs <name> input path)))]
[modify]
[write]
@@ -321,10 +321,10 @@
["#::."
(toString [] ffi.String)])
- (template: (with_promise <write> <type> <body>)
+ (template: (with_async <write> <type> <body>)
(template.with_locals [<read>]
- (let [[<read> <write>] (: [(Promise <type>) (promise.Resolver <type>)]
- (promise.promise []))]
+ (let [[<read> <write>] (: [(Async <type>) (async.Resolver <type>)]
+ (async.async []))]
(exec
<body>
<read>))))
@@ -345,7 +345,7 @@
(rmdir [ffi.String ffi.Function] Any)])
(def: (any_callback write!)
- (-> (promise.Resolver (Try Any)) ffi.Function)
+ (-> (async.Resolver (Try Any)) ffi.Function)
(<| (ffi.closure [error])
io.run
write!
@@ -354,7 +354,7 @@
(#try.Failure (Error::toString [] (:as Error error))))))
(def: (value_callback write!)
- (All [a] (-> (promise.Resolver (Try a)) ffi.Function))
+ (All [a] (-> (async.Resolver (Try a)) ffi.Function))
(<| (ffi.closure [error datum])
io.run
write!
@@ -402,15 +402,15 @@
"/"))
(`` (implementation: #export default
- (System Promise)
+ (System Async)
(def: separator
..js_separator)
(~~ (template [<name> <method>]
[(def: (<name> path)
- (do promise.monad
- [?stats (with_promise write! (Try Stats)
+ (do async.monad
+ [?stats (with_async write! (Try Stats)
(Fs::stat [path (..value_callback write!)]
(..node_fs [])))]
(wrap (case ?stats
@@ -425,9 +425,9 @@
))
(def: (make_directory path)
- (do promise.monad
+ (do async.monad
[#let [node_fs (..node_fs [])]
- outcome (with_promise write! (Try Any)
+ outcome (with_async write! (Try Any)
(Fs::access [path
(|> node_fs Fs::constants FsConstants::F_OK)
(..any_callback write!)]
@@ -437,21 +437,21 @@
(wrap (exception.throw ..cannot_make_directory [path]))
(#try.Failure _)
- (with_promise write! (Try Any)
+ (with_async write! (Try Any)
(Fs::mkdir [path (..any_callback write!)] node_fs)))))
(~~ (template [<name> <method>]
[(def: (<name> path)
- (do {! (try.with promise.monad)}
+ (do {! (try.with async.monad)}
[#let [node_fs (..node_fs [])]
- subs (with_promise write! (Try (Array ffi.String))
+ subs (with_async write! (Try (Array ffi.String))
(Fs::readdir [path (..value_callback write!)] node_fs))]
(|> subs
array.to_list
(list\map (|>> (format path ..js_separator)))
(monad.map ! (function (_ sub)
(\ ! map (|>> (<method> []) [sub])
- (with_promise write! (Try Stats)
+ (with_async write! (Try Stats)
(Fs::stat [sub (..value_callback write!)] node_fs)))))
(\ ! map (|>> (list.only product.right)
(list\map product.left))))))]
@@ -461,8 +461,8 @@
))
(def: (file_size path)
- (do (try.with promise.monad)
- [stats (with_promise write! (Try Stats)
+ (do (try.with async.monad)
+ [stats (with_async write! (Try Stats)
(Fs::stat [path (..value_callback write!)]
(..node_fs [])))]
(wrap (|> stats
@@ -470,8 +470,8 @@
f.nat))))
(def: (last_modified path)
- (do (try.with promise.monad)
- [stats (with_promise write! (Try Stats)
+ (do (try.with async.monad)
+ [stats (with_async write! (Try Stats)
(Fs::stat [path (..value_callback write!)]
(..node_fs [])))]
(wrap (|> stats
@@ -482,43 +482,43 @@
(def: (can_execute? path)
(let [node_fs (..node_fs [])]
- (\ promise.monad map
+ (\ async.monad map
(|>> (case> (#try.Success _)
true
(#try.Failure _)
false)
#try.Success)
- (with_promise write! (Try Any)
+ (with_async write! (Try Any)
(Fs::access [path
(|> node_fs Fs::constants FsConstants::X_OK)
(..any_callback write!)]
node_fs)))))
(def: (read path)
- (with_promise write! (Try Binary)
+ (with_async write! (Try Binary)
(Fs::readFile [path (..value_callback write!)]
(..node_fs []))))
(def: (delete path)
- (do (try.with promise.monad)
+ (do (try.with async.monad)
[#let [node_fs (..node_fs [])]
- stats (with_promise write! (Try Stats)
+ stats (with_async write! (Try Stats)
(Fs::stat [path (..value_callback write!)] node_fs))]
- (with_promise write! (Try Any)
+ (with_async write! (Try Any)
(if (Stats::isFile [] stats)
(Fs::unlink [path (..any_callback write!)] node_fs)
(Fs::rmdir [path (..any_callback write!)] node_fs)))))
(def: (modify time_stamp path)
- (with_promise write! (Try Any)
+ (with_async write! (Try Any)
(let [when (|> time_stamp instant.relative duration.to_millis i.frac)]
(Fs::utimes [path when when (..any_callback write!)]
(..node_fs [])))))
(~~ (template [<name> <method>]
[(def: (<name> data path)
- (with_promise write! (Try Any)
+ (with_async write! (Try Any)
(<method> [path (Buffer::from data) (..any_callback write!)]
(..node_fs []))))]
@@ -527,7 +527,7 @@
))
(def: (move destination origin)
- (with_promise write! (Try Any)
+ (with_async write! (Try Any)
(Fs::rename [origin destination (..any_callback write!)]
(..node_fs []))))
)))
@@ -1168,7 +1168,7 @@
(recur sub_directory tail)))))))
(def: #export (mock separator)
- (-> Text (System Promise))
+ (-> Text (System Async))
(let [store (stm.var ..empty_mock)]
(`` (implementation
(def: separator
@@ -1271,14 +1271,14 @@
store)))
(def: (write content path)
- (do promise.monad
- [now (promise.future instant.now)]
+ (do async.monad
+ [now (async.future instant.now)]
(stm.commit
(..try_update! (..update_mock_file! separator path now content) store))))
(def: (append content path)
- (do promise.monad
- [now (promise.future instant.now)]
+ (do async.monad
+ [now (async.future instant.now)]
(stm.commit
(..try_update! (function (_ |store|)
(do try.monad
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 721e9b059..60b4f630c 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -11,7 +11,7 @@
["." try (#+ Try)]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise)]
+ ["." async (#+ Async)]
["." stm (#+ STM Var)]]]
[data
["." product]
@@ -119,8 +119,8 @@
(wrap false))))
(def: (file_tracker fs directory)
- (-> (//.System Promise) //.Path (Promise (Try File_Tracker)))
- (do {! (try.with promise.monad)}
+ (-> (//.System Async) //.Path (Async (Try File_Tracker)))
+ (do {! (try.with async.monad)}
[files (\ fs directory_files directory)]
(monad.fold !
(function (_ file tracker)
@@ -132,8 +132,8 @@
files)))
(def: (poll_files fs directory)
- (-> (//.System Promise) //.Path (Promise (Try (List [//.Path Instant]))))
- (do {! (try.with promise.monad)}
+ (-> (//.System Async) //.Path (Async (Try (List [//.Path Instant]))))
+ (do {! (try.with async.monad)}
[files (\ fs directory_files directory)]
(monad.map ! (function (_ file)
(|> file
@@ -142,12 +142,12 @@
files)))
(def: (poll_directory_changes fs [directory [concern file_tracker]])
- (-> (//.System Promise) [//.Path [Concern File_Tracker]]
- (Promise (Try [[//.Path [Concern File_Tracker]]
- [(List [//.Path Instant])
- (List [//.Path Instant Instant])
- (List //.Path)]])))
- (do {! (try.with promise.monad)}
+ (-> (//.System Async) [//.Path [Concern File_Tracker]]
+ (Async (Try [[//.Path [Concern File_Tracker]]
+ [(List [//.Path Instant])
+ (List [//.Path Instant Instant])
+ (List //.Path)]])))
+ (do {! (try.with async.monad)}
[current_files (..poll_files fs directory)
#let [creations (if (..creation? concern)
(list.only (|>> product.left (dictionary.key? file_tracker) not)
@@ -183,12 +183,12 @@
deletions]])))
(def: #export (polling fs)
- (-> (//.System Promise) (Watcher Promise))
+ (-> (//.System Async) (Watcher Async))
(let [tracker (: (Var Directory_Tracker)
(stm.var (dictionary.new text.hash)))]
(implementation
(def: (start new_concern path)
- (do {! promise.monad}
+ (do {! async.monad}
[exists? (\ fs directory? path)]
(if exists?
(do !
@@ -224,13 +224,13 @@
#.None
(wrap (exception.throw ..not_being_watched [path]))))))
(def: (poll _)
- (do promise.monad
+ (do async.monad
[@tracker (stm.commit (stm.read tracker))]
- (do {! (try.with promise.monad)}
+ (do {! (try.with async.monad)}
[changes (|> @tracker
dictionary.entries
(monad.map ! (..poll_directory_changes fs)))
- _ (do promise.monad
+ _ (do async.monad
[_ (stm.commit (stm.write (|> changes
(list\map product.left)
(dictionary.of_list text.hash))
@@ -255,7 +255,7 @@
)))
(def: #export (mock separator)
- (-> Text [(//.System Promise) (Watcher Promise)])
+ (-> Text [(//.System Async) (Watcher Async)])
(let [fs (//.mock separator)]
[fs
(..polling fs)]))
@@ -355,13 +355,13 @@
(java/nio/file/WatchEvent$Kind java/lang/Object))
(def: (default_start watch_events watcher path)
- (-> (List Watch_Event) java/nio/file/WatchService //.Path (Promise (Try java/nio/file/WatchKey)))
+ (-> (List Watch_Event) java/nio/file/WatchService //.Path (Async (Try java/nio/file/WatchKey)))
(let [watch_events' (list\fold (function (_ [index watch_event] watch_events')
(ffi.array_write index watch_event watch_events'))
(ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object)
(list.size watch_events))
(list.enumeration watch_events))]
- (promise.future
+ (async.future
(java/nio/file/Path::register watcher
watch_events'
(|> path java/io/File::new java/io/File::toPath)))))
@@ -406,42 +406,42 @@
))
(def: #export default
- (IO (Try (Watcher Promise)))
+ (IO (Try (Watcher Async)))
(do (try.with io.monad)
[watcher (java/nio/file/FileSystem::newWatchService
(java/nio/file/FileSystems::getDefault))
#let [tracker (stm.var (: (Dictionary //.Path [Concern java/nio/file/WatchKey])
(dictionary.new text.hash)))
- stop (: (-> //.Path (Promise (Try Concern)))
+ stop (: (-> //.Path (Async (Try Concern)))
(function (_ path)
- (do {! promise.monad}
+ (do {! async.monad}
[@tracker (stm.commit (stm.read tracker))]
(case (dictionary.get path @tracker)
(#.Some [concern key])
(do !
- [_ (promise.future
+ [_ (async.future
(java/nio/file/WatchKey::cancel key))
_ (stm.commit (stm.update (dictionary.remove path) tracker))]
(wrap (#try.Success concern)))
#.None
(wrap (exception.throw ..not_being_watched [path]))))))]]
- (wrap (: (Watcher Promise)
+ (wrap (: (Watcher Async)
(implementation
(def: (start concern path)
- (do promise.monad
+ (do async.monad
[?concern (stop path)]
- (do (try.with promise.monad)
+ (do (try.with async.monad)
[key (..default_start (..watch_events (..also (try.default ..none ?concern)
concern))
watcher
path)]
- (do promise.monad
+ (do async.monad
[_ (stm.commit (stm.update (dictionary.put path [concern key]) tracker))]
(wrap (#try.Success []))))))
(def: (concern path)
- (do promise.monad
+ (do async.monad
[@tracker (stm.commit (stm.read tracker))]
(case (dictionary.get path @tracker)
(#.Some [concern key])
@@ -451,7 +451,7 @@
(wrap (exception.throw ..not_being_watched [path])))))
(def: stop stop)
(def: (poll _)
- (promise.future (..default_poll watcher)))
+ (async.future (..default_poll watcher)))
)))))
)]
(for {@.old (as_is <jvm>)
diff --git a/stdlib/source/library/lux/world/net/http.lux b/stdlib/source/library/lux/world/net/http.lux
index 8e205e2a0..c526e6c97 100644
--- a/stdlib/source/library/lux/world/net/http.lux
+++ b/stdlib/source/library/lux/world/net/http.lux
@@ -4,7 +4,6 @@
[control
[try (#+ Try)]
[concurrency
- [promise (#+ Promise)]
[frp (#+ Channel)]]
[parser
["." environment (#+ Environment)]]]
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index 95dbde0dc..2a160d0fd 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -10,7 +10,7 @@
["." io (#+ IO)]
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." binary (#+ Binary)]
["." maybe ("#\." functor)]
@@ -207,16 +207,16 @@
(as_is)))
(implementation: #export (async client)
- (-> (Client IO) (Client Promise))
+ (-> (Client IO) (Client Async))
(def: (request method url headers data)
(|> (\ client request method url headers data)
- promise.future
- (\ promise.monad map
+ async.future
+ (\ async.monad map
(|>> (case> (#try.Success [status message])
- (#try.Success [status (update@ #//.body (: (-> (//.Body IO) (//.Body Promise))
+ (#try.Success [status (update@ #//.body (: (-> (//.Body IO) (//.Body Async))
(function (_ body)
- (|>> body promise.future)))
+ (|>> body async.future)))
message)])
(#try.Failure error)
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index 80ce2bbf5..b51e1af60 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -6,7 +6,7 @@
["." monad (#+ do)]
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]
+ ["." async (#+ Async)]
["." frp]]
[parser
["<.>" json]]]
@@ -45,8 +45,8 @@
output))
(def: (read-text-body body)
- (-> Body (Promise (Try Text)))
- (do promise.monad
+ (-> Body (Async (Try Text)))
+ (do async.monad
[blobs (frp.consume body)]
(wrap (\ encoding.utf8 decode (merge blobs)))))
@@ -55,7 +55,7 @@
(def: #export (json reader server)
(All [a] (-> (<json>.Reader a) (-> a Server) Server))
(function (_ (^@ request [identification protocol resource message]))
- (do promise.monad
+ (do async.monad
[?raw (read-text-body (get@ #//.body message))]
(case (do try.monad
[raw ?raw
@@ -65,19 +65,19 @@
(server input request)
(#try.Failure error)
- (promise.resolved ..failure)))))
+ (async.resolved ..failure)))))
(def: #export (text server)
(-> (-> Text Server) Server)
(function (_ (^@ request [identification protocol resource message]))
- (do promise.monad
+ (do async.monad
[?raw (read-text-body (get@ #//.body message))]
(case ?raw
(#try.Success content)
(server content request)
(#try.Failure error)
- (promise.resolved ..failure)))))
+ (async.resolved ..failure)))))
(def: #export (query property server)
(All [a] (-> (Property a) (-> a Server) Server))
@@ -95,12 +95,12 @@
(server input request)
(#try.Failure error)
- (promise.resolved ..failure)))))
+ (async.resolved ..failure)))))
(def: #export (form property server)
(All [a] (-> (Property a) (-> a Server) Server))
(function (_ (^@ request [identification protocol resource message]))
- (do promise.monad
+ (do async.monad
[?body (read-text-body (get@ #//.body message))]
(case (do try.monad
[body ?body
@@ -110,7 +110,7 @@
(server input request)
(#try.Failure error)
- (promise.resolved ..failure)))))
+ (async.resolved ..failure)))))
(def: #export (cookies property server)
(All [a] (-> (Property a) (-> a Server) Server))
@@ -125,4 +125,4 @@
(server input request)
(#try.Failure error)
- (promise.resolved ..failure))))
+ (async.resolved ..failure))))
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index 0ca825a44..ae96134b9 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -3,7 +3,7 @@
[lux (#- static)
[control
[concurrency
- ["." promise]
+ ["." async]
["." frp ("#\." monad)]]]
[data
["." text
@@ -25,7 +25,7 @@
(def: #export (static response)
(-> Response Server)
(function (_ request)
- (promise.resolved response)))
+ (async.resolved response)))
(def: #export empty
(-> Status Response)
diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux
index 456ed9e36..857503a20 100644
--- a/stdlib/source/library/lux/world/net/http/route.lux
+++ b/stdlib/source/library/lux/world/net/http/route.lux
@@ -4,7 +4,7 @@
[control
[monad (#+ do)]
[concurrency
- ["." promise]]]
+ ["." async]]]
[data
["." maybe]
["." text]
@@ -23,7 +23,7 @@
(server request)
_
- (promise.resolved //response.not-found))))]
+ (async.resolved //response.not-found))))]
[#//.HTTP http]
[#//.HTTPS https]
@@ -38,7 +38,7 @@
(server request)
_
- (promise.resolved //response.not-found))))]
+ (async.resolved //response.not-found))))]
[#//.Get get]
[#//.Post post]
@@ -61,12 +61,12 @@
(|>> (text.clip' (text.size path)) maybe.assume)
resource)
message])
- (promise.resolved //response.not-found))))
+ (async.resolved //response.not-found))))
(def: #export (or primary alternative)
(-> Server Server Server)
(function (_ request)
- (do promise.monad
+ (do async.monad
[response (primary request)
#let [[status message] response]]
(if (n.= //status.not-found status)
diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux
index 1607e14c3..a540bf2b1 100644
--- a/stdlib/source/library/lux/world/program.lux
+++ b/stdlib/source/library/lux/world/program.lux
@@ -12,7 +12,7 @@
["." exception (#+ exception:)]
[concurrency
["." atom]
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
["." environment (#+ Environment)]]]
[data
@@ -69,7 +69,7 @@
(dictionary.of_list text.hash)))))
(`` (implementation: #export (async program)
- (-> (Program IO) (Program Promise))
+ (-> (Program IO) (Program Async))
(~~ (template [<method>]
[(def: <method>
@@ -81,7 +81,7 @@
(~~ (template [<method>]
[(def: <method>
- (|>> (\ program <method>) promise.future))]
+ (|>> (\ program <method>) async.future))]
[available_variables]
[variable]
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index 00cba51fe..b186f27a8 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -14,7 +14,7 @@
["?" policy (#+ Context Safety Safe)]]
[concurrency
["." atom (#+ Atom)]
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
[environment (#+ Environment)]]]
[data
@@ -58,12 +58,12 @@
await))
(def: (async_process process)
- (-> (Process IO) (Process Promise))
+ (-> (Process IO) (Process Async))
(`` (implementation
(~~ (template [<method>]
[(def: <method>
(|>> (\ process <method>)
- promise.future))]
+ async.future))]
[read]
[error]
@@ -83,10 +83,10 @@
execute))
(def: #export (async shell)
- (-> (Shell IO) (Shell Promise))
+ (-> (Shell IO) (Shell Async))
(implementation
(def: (execute input)
- (promise.future
+ (async.future
(do (try.with io.monad)
[process (\ shell execute input)]
(wrap (..async_process process)))))))
@@ -110,7 +110,7 @@
(-> Text Replacer (-> Text Text))
(text.replace_all bad (replacer bad)))
-(def: sanitize_common_command
+(def: safe_common_command
(-> Replacer (Sanitizer Command))
(let [x0A (text.of_code (hex "0A"))
xFF (text.of_code (hex "FF"))]
@@ -133,39 +133,39 @@
(..replace "[" replacer) (..replace "]" replacer)
(..replace "{" replacer) (..replace "}" replacer)))))
-(def: (policy sanitize_command sanitize_argument)
+(def: (policy safe_command safe_argument)
(Ex [?] (-> (Sanitizer Command) (Sanitizer Argument) (Policy ?)))
(?.with_policy
(: (Context Safety Policy)
(function (_ (^open "?\."))
(implementation
- (def: command (|>> sanitize_command ?\can_upgrade))
- (def: argument (|>> sanitize_argument ?\can_upgrade))
+ (def: command (|>> safe_command ?\can_upgrade))
+ (def: argument (|>> safe_argument ?\can_upgrade))
(def: value ?\can_downgrade))))))
(def: unix_policy
(let [replacer (: Replacer
(|>> (format "\")))
- sanitize_command (: (Sanitizer Command)
- (..sanitize_common_command replacer))
- sanitize_argument (: (Sanitizer Argument)
- (|>> (..replace "'" replacer)
- (text.enclose' "'")))]
- (..policy sanitize_command sanitize_argument)))
+ safe_command (: (Sanitizer Command)
+ (..safe_common_command replacer))
+ safe_argument (: (Sanitizer Argument)
+ (|>> (..replace "'" replacer)
+ (text.enclose' "'")))]
+ (..policy safe_command safe_argument)))
(def: windows_policy
(let [replacer (: Replacer
(function.constant " "))
- sanitize_command (: (Sanitizer Command)
- (|>> (..sanitize_common_command replacer)
- (..replace "%" replacer)
- (..replace "!" replacer)))
- sanitize_argument (: (Sanitizer Argument)
- (|>> (..replace "%" replacer)
- (..replace "!" replacer)
- (..replace text.double_quote replacer)
- (text.enclose' text.double_quote)))]
- (..policy sanitize_command sanitize_argument)))
+ safe_command (: (Sanitizer Command)
+ (|>> (..safe_common_command replacer)
+ (..replace "%" replacer)
+ (..replace "!" replacer)))
+ safe_argument (: (Sanitizer Argument)
+ (|>> (..replace "%" replacer)
+ (..replace "!" replacer)
+ (..replace text.double_quote replacer)
+ (text.enclose' text.double_quote)))]
+ (..policy safe_command safe_argument)))
(with_expansions [<jvm> (as_is (import: java/lang/String
["#::."
diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux
index 15795ffcf..1f414e197 100644
--- a/stdlib/source/poly/lux/abstract/equivalence.lux
+++ b/stdlib/source/poly/lux/abstract/equivalence.lux
@@ -135,7 +135,7 @@
g!rights (list\map (|>> nat\encode (text\compose "right") code.local_identifier) indices)]]
(wrap (` (: (~ (@Equivalence inputT))
(function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)])
- (and (~+ (|> (list.zip/3 g!eqs g!lefts g!rights)
+ (and (~+ (|> (list.zipped/3 g!eqs g!lefts g!rights)
(list\map (function (_ [g!eq g!left g!right])
(` ((~ g!eq) (~ g!left) (~ g!right)))))))))))))
## Type recursion
@@ -163,6 +163,6 @@
<type>.recursive_call
## If all else fails...
(|> <type>.any
- (\ ! map (|>> %.type (format "Cannot create Equivalence for: ") <>.fail))
+ (\ ! map (|>> %.type (format "Cannot create Equivalence for: ") <>.failure))
(\ ! join))
))))
diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux
index fbd3e2519..363b43b8a 100644
--- a/stdlib/source/poly/lux/abstract/functor.lux
+++ b/stdlib/source/poly/lux/abstract/functor.lux
@@ -103,7 +103,7 @@
[_ _ outputC] (: (<type>.Parser [Code (List Code) Code])
(p.either (<type>.polymorphic
(Arg<?> inputC))
- (p.fail (format "Cannot create Functor for: " (%.type inputT)))))]
+ (p.failure (format "Cannot create Functor for: " (%.type inputT)))))]
(wrap (` (: (~ (@Functor inputT))
(implementation
(def: ((~' map) (~ funcC) (~ inputC))
diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux
index 5c63c58e1..1aa793323 100644
--- a/stdlib/source/poly/lux/data/format/json.lux
+++ b/stdlib/source/poly/lux/data/format/json.lux
@@ -194,7 +194,7 @@
(function ((~ g!_) [(~+ g!members)])
((~! /.json) [(~+ (list\map (function (_ [g!member g!encode])
(` ((~ g!encode) (~ g!member))))
- (list.zip/2 g!members g!encoders)))]))))))
+ (list.zipped/2 g!members g!encoders)))]))))))
## Type recursion
(do !
[[selfC non_recC] (<type>.recursive encode)
@@ -220,7 +220,7 @@
<type>.parameter
<type>.recursive_call
## If all else fails...
- (<>.fail (format "Cannot create JSON encoder for: " (type.format inputT)))
+ (<>.failure (format "Cannot create JSON encoder for: " (type.format inputT)))
))))
(poly: decode
@@ -322,7 +322,7 @@
<type>.parameter
<type>.recursive_call
## If all else fails...
- (<>.fail (format "Cannot create JSON decoder for: " (type.format inputT)))
+ (<>.failure (format "Cannot create JSON decoder for: " (type.format inputT)))
))))
(syntax: #export (codec inputT)
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index b046a7ace..c84f57170 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -13,7 +13,7 @@
[parser
[environment (#+ Environment)]]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]]
+ ["." async (#+ Async) ("#\." monad)]]]
[data
[binary (#+ Binary)]
["." text
@@ -65,15 +65,15 @@
["#/." deploy]]])
(def: repositories
- (-> /.Profile (List (Repository Promise)))
+ (-> /.Profile (List (Repository Async)))
(|>> (get@ #/.repositories)
set.to_list
(list\map (|>> (/repository/remote.repository http.default #.None) /repository.async))))
(def: (with_dependencies program console command profile)
(All [a]
- (-> (Program Promise) (Console Promise)
- (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit a]))
+ (-> (Program Async) (Console Async)
+ (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a]))
(Command a)))
(do /action.monad
[resolution (/command/deps.do! console
@@ -88,7 +88,7 @@
(wrap [])
_
- (do promise.monad
+ (do async.monad
[_ (\ program exit exit_code)]
(wrap (#try.Failure ""))))]
(wrap output)))
@@ -112,10 +112,10 @@
(\ program.default exit shell.error)))
(def: (command action)
- (All [a] (-> (Promise (Try a)) (IO Any)))
- (exec (do promise.monad
+ (All [a] (-> (Async (Try a)) (IO Any)))
+ (exec (do async.monad
[outcome action]
- (promise.future
+ (async.future
(case outcome
(#try.Success _)
..succeed!
@@ -175,10 +175,10 @@
profile)
[#.None _]
- (promise\wrap (exception.throw /.no_identity []))
+ (async\wrap (exception.throw /.no_identity []))
[_ #.None]
- (promise\wrap (exception.throw ..cannot_find_repository [repository (get@ #/.deploy_repositories profile)]))))
+ (async\wrap (exception.throw ..cannot_find_repository [repository (get@ #/.deploy_repositories profile)]))))
#/cli.Dependencies
(..command
diff --git a/stdlib/source/program/aedifex/action.lux b/stdlib/source/program/aedifex/action.lux
index 61c5ba3de..2da97fde2 100644
--- a/stdlib/source/program/aedifex/action.lux
+++ b/stdlib/source/program/aedifex/action.lux
@@ -6,11 +6,11 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]]])
+ ["." async (#+ Async)]]]]])
(type: #export (Action a)
- (Promise (Try a)))
+ (Async (Try a)))
(def: #export monad
(Monad Action)
- (:assume (try.with promise.monad)))
+ (:assume (try.with async.monad)))
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux
index a1a50fcc2..89af452e2 100644
--- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux
+++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux
@@ -40,16 +40,16 @@
[<snapshot_version> "snapshotVersion"]
)
-(def: (format_text tag value)
+(def: (text_format tag value)
(-> xml.Tag Text XML)
(|> value #xml.Text list (#xml.Node tag xml.attributes)))
(def: #export (format (^slots [#extension #value #updated]))
(-> Version XML)
(<| (#xml.Node ..<snapshot_version> xml.attributes)
- (list (..format_text ..<extension> extension)
- (..format_text ..<value> value)
- (..format_text ..<updated> (///time.format updated)))))
+ (list (..text_format ..<extension> extension)
+ (..text_format ..<value> value)
+ (..text_format ..<updated> (///time.format updated)))))
(def: (text tag)
(-> xml.Tag (Parser Text))
diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux
index 9fdc2d84d..9c9805571 100644
--- a/stdlib/source/program/aedifex/artifact/versioning.lux
+++ b/stdlib/source/program/aedifex/artifact/versioning.lux
@@ -57,7 +57,7 @@
[<versioning> "versioning"]
)
-(def: format_last_updated
+(def: last_updated_format
(-> //time.Time XML)
(|>> //time.format #xml.Text list (#xml.Node ..<last_updated> xml.attributes)))
@@ -65,7 +65,7 @@
(-> Versioning XML)
(<| (#xml.Node ..<versioning> xml.attributes)
(list (//snapshot.format snapshot)
- (..format_last_updated last_updated)
+ (..last_updated_format last_updated)
(|> versions
(list\map //snapshot/version.format)
(#xml.Node ..<snapshot_versions> xml.attributes)))))
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 2460215b4..a80193663 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -6,7 +6,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[collection
["." list]
@@ -26,8 +26,8 @@
[resolution (#+ Resolution)]]]])
(def: (targets fs path)
- (-> (file.System Promise) file.Path (Promise (List file.Path)))
- (let [! promise.monad]
+ (-> (file.System Async) file.Path (Async (List file.Path)))
+ (let [! async.monad]
(|> path
(\ fs sub_directories)
(\ ! map (|>> (try.default (list))
@@ -40,18 +40,18 @@
1,000)
(def: (pause delay)
- (-> Nat (Promise (Try Any)))
- (promise.delay delay (#try.Success [])))
+ (-> Nat (Async (Try Any)))
+ (async.delay delay (#try.Success [])))
(def: #export (do! delay watcher command)
(All [a]
- (-> Nat (Watcher Promise)
- (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit a]))
- (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Any]))))
+ (-> Nat (Watcher Async)
+ (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a]))
+ (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any]))))
(function (_ console program fs shell resolution)
(function (_ profile)
(with_expansions [<call> ((command console program fs shell resolution) profile)]
- (do {! promise.monad}
+ (do {! async.monad}
[targets (|> profile
(get@ #///.sources)
set.to_list
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index 52804be43..b5df31411 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -10,7 +10,7 @@
["." exception (#+ exception:)]
["." io (#+ IO)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]]
+ ["." async (#+ Async) ("#\." monad)]]]
[data
["." product]
["." maybe]
@@ -192,32 +192,32 @@
(template [<name> <capability>]
[(def: #export (<name> console process)
- (-> (Console Promise) (Process Promise) (Promise (Try Any)))
+ (-> (Console Async) (Process Async) (Async (Try Any)))
## This is a very odd way of implementing this function.
- ## But it's written this way because the more straightforward way (i.e. by using (try.with promise.monad))
+ ## But it's written this way because the more straightforward way (i.e. by using (try.with async.monad))
## eventually led to the function hanging/freezing.
## I'm not sure why it happened, but I got this weirder implementation to work.
- (let [[read! write!] (: [(Promise (Try Any))
- (promise.Resolver (Try Any))]
- (promise.promise []))
+ (let [[read! write!] (: [(Async (Try Any))
+ (async.Resolver (Try Any))]
+ (async.async []))
_ (|> (\ process <capability> [])
- (promise.await (function (recur ?line)
- (case ?line
- (#try.Failure error)
- (if (exception.match? shell.no_more_output error)
- (write! (#try.Success []))
- (promise.await write! (console.write_line error console)))
-
- (#try.Success line)
- (promise.await (function (_ outcome)
- (case outcome
- (#try.Failure error)
- (write! (#try.Failure error))
-
- (#try.Success _)
- (promise.await recur
- (\ process <capability> []))))
- (console.write_line line console)))))
+ (async.await (function (recur ?line)
+ (case ?line
+ (#try.Failure error)
+ (if (exception.match? shell.no_more_output error)
+ (write! (#try.Success []))
+ (async.await write! (console.write_line error console)))
+
+ (#try.Success line)
+ (async.await (function (_ outcome)
+ (case outcome
+ (#try.Failure error)
+ (write! (#try.Failure error))
+
+ (#try.Success _)
+ (async.await recur
+ (\ process <capability> []))))
+ (console.write_line line console)))))
io.run)]
read!))]
@@ -261,20 +261,20 @@
runtime)))
(def: #export (do! console program fs shell resolution)
- (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Compiler Path]))
+ (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Compiler Path]))
(function (_ profile)
(let [target (get@ #///.target profile)]
(case (get@ #///.program profile)
#.None
- (promise\wrap (exception.throw ..no_specified_program []))
+ (async\wrap (exception.throw ..no_specified_program []))
(#.Some program_module)
- (do promise.monad
- [environment (program.environment promise.monad program)
+ (do async.monad
+ [environment (program.environment async.monad program)
#let [home (\ program home)
working_directory (\ program directory)]]
(do ///action.monad
- [[resolution compiler] (promise\wrap (..compiler resolution (get@ #///.compiler profile)))
+ [[resolution compiler] (async\wrap (..compiler resolution (get@ #///.compiler profile)))
#let [host_dependencies (..host_dependencies fs home resolution)
[[command compiler_params] output] (case compiler
(#JVM dependency)
diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux
index 3a27e400a..2ff701d2b 100644
--- a/stdlib/source/program/aedifex/command/clean.lux
+++ b/stdlib/source/program/aedifex/command/clean.lux
@@ -6,7 +6,7 @@
[control
[try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[text
["%" format (#+ format)]]]
@@ -19,7 +19,7 @@
["#." action (#+ Action)]])
(def: (clean_files! fs root)
- (-> (file.System Promise) Path (Promise (Try Any)))
+ (-> (file.System Async) Path (Async (Try Any)))
(let [! ///action.monad]
(|> root
(\ fs directory_files)
@@ -31,8 +31,8 @@
(|>> (format "Successfully cleaned target directory: ")))
(def: #export (do! console fs profile)
- (-> (Console Promise) (file.System Promise) (Command Any))
- (do {! promise.monad}
+ (-> (Console Async) (file.System Async) (Command Any))
+ (do {! async.monad}
[#let [target (get@ #///.target profile)]
? (\ fs directory? target)
_ (let [! ///action.monad]
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index e70e6f762..79f6e4f2f 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -7,7 +7,7 @@
[pipe (#+ do>)]
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]
+ ["." async (#+ Async) ("#\." monad)]]
["<>" parser
["<.>" xml]]]
[data
@@ -57,14 +57,14 @@
"Successfully deployed the project.")
(def: #export (do! console repository fs artifact profile)
- (-> (Console Promise) (Repository Promise) (file.System Promise) Artifact (Command Any))
+ (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any))
(do {! ///action.monad}
[library (|> profile
(get@ #/.sources)
set.to_list
(export.library fs)
(\ ! map (binary.run tar.writer)))
- pom (\ promise.monad wrap (///pom.write profile))
+ pom (\ async.monad wrap (///pom.write profile))
_ (///dependency/deployment.one
repository
[artifact ///artifact/type.lux_library]
diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux
index a7db4af20..7e0d655e9 100644
--- a/stdlib/source/program/aedifex/command/deps.lux
+++ b/stdlib/source/program/aedifex/command/deps.lux
@@ -6,7 +6,7 @@
[control
["." exception]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[collection
["." set (#+ Set)]
@@ -38,8 +38,8 @@
%.text))
(def: #export (do! console local remotes new_repository profile)
- (-> (Console Promise) (Repository Promise) (List (Repository Promise)) (-> URL (Repository Promise)) (Command Resolution))
- (do promise.monad
+ (-> (Console Async) (Repository Async) (List (Repository Async)) (-> URL (Repository Async)) (Command Resolution))
+ (do async.monad
[#let [dependencies (|> (get@ #///.dependencies profile)
set.to_list
(#.Cons (get@ #///.compiler profile)))]
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index 4cc4ede68..142829a8c 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -7,7 +7,7 @@
["." try (#+ Try)]
["." exception]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[binary (#+ Binary)]
[text
@@ -50,7 +50,7 @@
"Failure: No 'identity' defined for the project.")
(def: #export (do! console fs repository profile)
- (-> (Console Promise) (file.System Promise) (Repository Promise) (Command Any))
+ (-> (Console Async) (file.System Async) (Repository Async) (Command Any))
(case (get@ #/.identity profile)
(#.Some identity)
(do ///action.monad
@@ -60,7 +60,7 @@
(export.library fs))
pom (|> profile
///pom.write
- (\ promise.monad wrap))
+ (\ async.monad wrap))
_ (///dependency/deployment.one repository
[identity ///artifact/type.lux_library]
(let [pom_data (|> pom
diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux
index 6d26f4792..73e10f0fc 100644
--- a/stdlib/source/program/aedifex/command/pom.lux
+++ b/stdlib/source/program/aedifex/command/pom.lux
@@ -6,7 +6,7 @@
[control
["." try ("#\." functor)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]]
+ ["." async (#+ Async) ("#\." monad)]]]
[data
[text
["%" format (#+ format)]
@@ -26,11 +26,11 @@
(format "Successfully created POM file: " ///pom.file))
(def: #export (do! console fs profile)
- (-> (Console Promise) (file.System Promise) (Command Any))
+ (-> (Console Async) (file.System Async) (Command Any))
(do ///action.monad
[content (|> (///pom.write profile)
(try\map (|>> (\ xml.codec encode)
(\ utf8.codec encode)))
- promise\wrap)
+ async\wrap)
_ (\ fs write content ///pom.file)]
(console.write_line ..success console)))
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index 1f32b2fc2..e159a48f2 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -5,7 +5,7 @@
[monad (#+ do)]]
[control
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]]
+ ["." async (#+ Async) ("#\." monad)]]]
[math
[number
["i" int]]]
@@ -29,9 +29,9 @@
(def: #export failure "[TEST FAILED]")
(def: #export (do! console program fs shell resolution profile)
- (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Any]))
- (do promise.monad
- [environment (program.environment promise.monad program)
+ (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any]))
+ (do async.monad
+ [environment (program.environment async.monad program)
#let [working_directory (\ program directory)]]
(do {! ///action.monad}
[#let [home (\ program home)]
diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux
index cd724843c..0c5c944b5 100644
--- a/stdlib/source/program/aedifex/command/version.lux
+++ b/stdlib/source/program/aedifex/command/version.lux
@@ -3,7 +3,7 @@
[lux #*
[control
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[tool
[compiler
["." version]
@@ -16,6 +16,6 @@
[command (#+ Command)]])
(def: #export (do! console profile)
- (-> (Console Promise) (Command Any))
+ (-> (Console Async) (Command Any))
(console.write_line (version.format language/lux.version)
console))
diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux
index 150055cf3..3a7cba41f 100644
--- a/stdlib/source/program/aedifex/dependency/deployment.lux
+++ b/stdlib/source/program/aedifex/dependency/deployment.lux
@@ -7,7 +7,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[binary (#+ Binary)]
["." product]
@@ -41,16 +41,16 @@
["#/." status (#+ Status)]]])
(def: (with_status repository version_template [artifact type] [data status])
- (-> (Repository Promise) ///artifact.Version Dependency [Binary Status] (Promise (Try Any)))
+ (-> (Repository Async) ///artifact.Version Dependency [Binary Status] (Async (Try Any)))
(let [artifact (format (///artifact.uri version_template artifact)
(///artifact/extension.extension type))
- deploy_hash (: (All [h] (-> (Codec Text (Hash h)) Extension (Hash h) (Promise (Try Any))))
+ deploy_hash (: (All [h] (-> (Codec Text (Hash h)) Extension (Hash h) (Async (Try Any))))
(function (_ codec extension hash)
(|> hash
(\ codec encode)
(\ utf8.codec encode)
(\ repository upload (format artifact extension)))))]
- (do {! (try.with promise.monad)}
+ (do {! (try.with async.monad)}
[_ (\ repository upload artifact data)]
(case status
#///dependency/status.Unverified
@@ -116,9 +116,9 @@
))))
(def: #export (one repository [artifact type] package)
- (-> (Repository Promise) Dependency Package (Promise (Try Artifact)))
- (do {! promise.monad}
- [now (promise.future instant.now)
+ (-> (Repository Async) Dependency Package (Async (Try Artifact)))
+ (do {! async.monad}
+ [now (async.future instant.now)
#let [version_template (get@ #///artifact.version artifact)]]
(do (try.with !)
[_ (with_status repository version_template [artifact type] (get@ #///package.library package))
@@ -141,8 +141,8 @@
(wrap artifact))))
(def: #export (all repository resolution)
- (-> (Repository Promise) Resolution (Promise (Try (Set Artifact))))
- (let [! (try.with promise.monad)]
+ (-> (Repository Async) Resolution (Async (Try (Set Artifact))))
+ (let [! (try.with async.monad)]
(|> (dictionary.entries resolution)
(monad.map ! (function (_ [dependency package])
(..one repository dependency package)))
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index 1e0c522b9..1a97dad34 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -13,7 +13,7 @@
["<>" parser
["<.>" xml (#+ Parser)]]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." binary (#+ Binary)]
["." name]
@@ -74,11 +74,11 @@
(def: (verified_hash library repository version_template artifact extension hash codec exception)
(All [h]
- (-> Binary (Repository Promise) Version Artifact Extension
+ (-> Binary (Repository Async) Version Artifact Extension
(-> Binary (Hash h)) (Codec Text (Hash h))
(Exception [Artifact Extension Text])
- (Promise (Try (Maybe (Hash h))))))
- (do promise.monad
+ (Async (Try (Maybe (Hash h))))))
+ (do async.monad
[?actual (\ repository download (///repository/remote.uri version_template artifact extension))]
(case ?actual
(#try.Success actual)
@@ -100,8 +100,8 @@
(wrap (#try.Success #.None)))))
(def: (hashed repository version_template artifact extension)
- (-> (Repository Promise) Version Artifact Extension (Promise (Try [Binary Status])))
- (do (try.with promise.monad)
+ (-> (Repository Async) Version Artifact Extension (Async (Try [Binary Status])))
+ (do (try.with async.monad)
[data (\ repository download (///repository/remote.uri version_template artifact extension))
?sha-1 (..verified_hash data
repository version_template artifact (format extension ///artifact/extension.sha-1)
@@ -123,10 +123,10 @@
#//status.Unverified)])))
(def: #export (one repository dependency)
- (-> (Repository Promise) Dependency (Promise (Try Package)))
+ (-> (Repository Async) Dependency (Async (Try Package)))
(let [[artifact type] dependency
extension (///artifact/extension.extension type)]
- (do (try.with promise.monad)
+ (do (try.with async.monad)
[snapshot (///metadata/snapshot.read repository artifact)
#let [version_template (get@ [#///metadata/snapshot.artifact #///artifact.version] snapshot)
artifact_version (value.format {#value.version version_template
@@ -134,7 +134,7 @@
artifact (set@ #///artifact.version artifact_version artifact)]
[pom_data pom_status] (..hashed repository version_template artifact ///artifact/extension.pom)
library_&_status (..hashed repository version_template artifact extension)]
- (\ promise.monad wrap
+ (\ async.monad wrap
(do try.monad
[pom (\ utf8.codec decode pom_data)
pom (\ xml.codec decode pom)
@@ -161,7 +161,7 @@
(template [<sigil> <name> <doing> <at>]
[(def: (<name> console repository artifact)
- (-> (Console Promise) (Repository Promise) Artifact (Promise (Try Any)))
+ (-> (Console Async) (Repository Async) Artifact (Async (Try Any)))
(\ console write (format "[" <sigil> "]"
" " <doing>
" " (///artifact.format artifact)
@@ -175,15 +175,15 @@
)
(def: #export (any console repositories dependency)
- (-> (Console Promise) (List (Repository Promise)) Dependency (Promise (Try Package)))
+ (-> (Console Async) (List (Repository Async)) Dependency (Async (Try Package)))
(case repositories
#.Nil
(|> dependency
(exception.throw ..cannot_resolve)
- (\ promise.monad wrap))
+ (\ async.monad wrap))
(#.Cons repository alternatives)
- (do {! promise.monad}
+ (do {! async.monad}
[_ (..announce_fetching console repository (get@ #//.artifact dependency))
outcome (..one repository dependency)]
(case outcome
@@ -198,10 +198,10 @@
(any console alternatives dependency))))))
(def: #export (all console repositories new_repository dependencies resolution)
- (-> (Console Promise) (List (Repository Promise)) (-> URL (Repository Promise)) (List Dependency) Resolution
- (Promise [(List Dependency)
- (List Dependency)
- Resolution]))
+ (-> (Console Async) (List (Repository Async)) (-> URL (Repository Async)) (List Dependency) Resolution
+ (Async [(List Dependency)
+ (List Dependency)
+ Resolution]))
(loop [repositories repositories
successes (: (List Dependency) (list))
failures (: (List Dependency) (list))
@@ -209,7 +209,7 @@
resolution resolution]
(case dependencies
#.Nil
- (\ promise.monad wrap
+ (\ async.monad wrap
[successes failures resolution])
(#.Cons head tail)
@@ -220,7 +220,7 @@
failures
tail
resolution)
- _ (do {! promise.monad}
+ _ (do {! async.monad}
[?package (case (dictionary.get head resolution)
(#.Some package)
(wrap (#try.Success package))
diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux
index 524272559..55659f391 100644
--- a/stdlib/source/program/aedifex/metadata/artifact.lux
+++ b/stdlib/source/program/aedifex/metadata/artifact.lux
@@ -11,7 +11,7 @@
["<.>" xml (#+ Parser)]
["<.>" text]]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." product]
["." text
@@ -85,26 +85,26 @@
(-> <type> XML)
(|>> <pre> #xml.Text list (#xml.Node <tag> xml.attributes)))]
- [format_group Group ..<group> (|>)]
- [format_name Name ..<name> (|>)]
- [format_version Version ..<version> (|>)]
- [format_last_updated Instant ..<last_updated> ..instant_format]
+ [group_format Group ..<group> (|>)]
+ [name_format Name ..<name> (|>)]
+ [version_format Version ..<version> (|>)]
+ [last_updated_format Instant ..<last_updated> ..instant_format]
)
-(def: format_versions
+(def: versions_format
(-> (List Version) XML)
- (|>> (list\map ..format_version) (#xml.Node ..<versions> xml.attributes)))
+ (|>> (list\map ..version_format) (#xml.Node ..<versions> xml.attributes)))
(def: #export (format value)
(-> Metadata XML)
(#xml.Node ..<metadata>
xml.attributes
- (list (..format_group (get@ #group value))
- (..format_name (get@ #name value))
+ (list (..group_format (get@ #group value))
+ (..name_format (get@ #name value))
(#xml.Node ..<versioning>
xml.attributes
- (list (..format_versions (get@ #versions value))
- (..format_last_updated (get@ #last_updated value)))))))
+ (list (..versions_format (get@ #versions value))
+ (..last_updated_format (get@ #last_updated value)))))))
(def: (text tag)
(-> xml.Tag (Parser Text))
@@ -173,8 +173,8 @@
(instant.of_millis +0))
(def: #export (read repository artifact)
- (-> (Repository Promise) Artifact (Promise (Try Metadata)))
- (do promise.monad
+ (-> (Repository Async) Artifact (Async (Try Metadata)))
+ (do async.monad
[project (\ repository download (..uri artifact))]
(case project
(#try.Success project)
@@ -193,7 +193,7 @@
#last_updated ..epoch}))))))
(def: #export (write repository artifact metadata)
- (-> (Repository Promise) Artifact Metadata (Promise (Try Any)))
+ (-> (Repository Async) Artifact Metadata (Async (Try Any)))
(|> metadata
..format
(\ xml.codec encode)
diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux
index 032214c90..6faab7b3b 100644
--- a/stdlib/source/program/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/program/aedifex/metadata/snapshot.lux
@@ -12,7 +12,7 @@
["<.>" xml (#+ Parser)]
["<.>" text]]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." product]
["." text
@@ -63,9 +63,9 @@
(-> <type> XML)
(|>> <pre> #xml.Text list (#xml.Node <tag> xml.attributes)))]
- [format_group Group ..<group> (|>)]
- [format_name Name ..<name> (|>)]
- [format_version Version ..<version> (|>)]
+ [group_format Group ..<group> (|>)]
+ [name_format Name ..<name> (|>)]
+ [version_format Version ..<version> (|>)]
)
(def: #export (format (^slots [#artifact #versioning]))
@@ -73,9 +73,9 @@
(let [(^slots [#///artifact.group #///artifact.name #///artifact.version]) artifact]
(#xml.Node ..<metadata>
xml.attributes
- (list (..format_group group)
- (..format_name name)
- (..format_version version)
+ (list (..group_format group)
+ (..name_format name)
+ (..version_format version)
(///artifact/versioning.format versioning)))))
(def: (text tag)
@@ -123,8 +123,8 @@
//.remote_artifact_uri)
(def: #export (read repository artifact)
- (-> (Repository Promise) Artifact (Promise (Try Metadata)))
- (do promise.monad
+ (-> (Repository Async) Artifact (Async (Try Metadata)))
+ (do async.monad
[project (\ repository download (..uri artifact))]
(case project
(#try.Success project)
@@ -140,7 +140,7 @@
#versioning ///artifact/versioning.init})))))
(def: #export (write repository artifact metadata)
- (-> (Repository Promise) Artifact Metadata (Promise (Try Any)))
+ (-> (Repository Async) Artifact Metadata (Async (Try Any)))
(|> metadata
..format
(\ xml.codec encode)
diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux
index 7ae07e9b5..8f92be270 100644
--- a/stdlib/source/program/aedifex/repository.lux
+++ b/stdlib/source/program/aedifex/repository.lux
@@ -7,7 +7,7 @@
[io (#+ IO)]
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]
+ ["." async (#+ Async)]
["." stm]]]
[data
[binary (#+ Binary)]]
@@ -24,15 +24,15 @@
upload))
(def: #export (async repository)
- (-> (Repository IO) (Repository Promise))
+ (-> (Repository IO) (Repository Async))
(implementation
(def: description
(\ repository description))
(def: (download uri)
- (promise.future (\ repository download uri)))
+ (async.future (\ repository download uri)))
(def: (upload uri content)
- (promise.future (\ repository upload uri content)))
+ (async.future (\ repository upload uri content)))
))
(interface: #export (Mock s)
@@ -44,7 +44,7 @@
on_upload))
(def: #export (mock mock init)
- (All [s] (-> (Mock s) s (Repository Promise)))
+ (All [s] (-> (Mock s) s (Repository Async)))
(let [state (stm.var init)]
(implementation
(def: description
diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux
index e7dbb7d4d..4620a1363 100644
--- a/stdlib/source/program/aedifex/repository/local.lux
+++ b/stdlib/source/program/aedifex/repository/local.lux
@@ -6,7 +6,7 @@
[control
["." try]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." text
["%" format (#+ format)]]]
@@ -21,7 +21,7 @@
["#." metadata]]])
(def: (root program /)
- (-> (Program Promise) Text file.Path)
+ (-> (Program Async) Text file.Path)
(|> ///local.repository
(text.replace_all uri.separator /)
(format (\ program home) /)))
@@ -31,13 +31,13 @@
(text.replace_all uri.separator /))
(def: (absolute_path program /)
- (-> (Program Promise) Text (-> URI file.Path))
+ (-> (Program Async) Text (-> URI file.Path))
(|>> ///metadata.local_uri
(..path /)
(format (..root program /) /)))
(implementation: #export (repository program fs)
- (-> (Program Promise) (file.System Promise) (//.Repository Promise))
+ (-> (Program Async) (file.System Async) (//.Repository Async))
(def: description
(..root program (\ fs separator)))
@@ -47,16 +47,16 @@
(\ fs read)))
(def: (upload uri content)
- (do {! promise.monad}
+ (do {! async.monad}
[#let [absolute_path (..absolute_path program (\ fs separator) uri)]
? (\ fs file? absolute_path)
_ (if ?
(wrap [])
(case (file.parent fs absolute_path)
(#.Some parent)
- (file.make_directories promise.monad fs parent)
+ (file.make_directories async.monad fs parent)
_
- (let [! (try.with promise.monad)]
+ (let [! (try.with async.monad)]
(\ ! wrap []))))]
(\ fs write content absolute_path))))
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index bb102224d..8d9874216 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -10,7 +10,7 @@
["." io (#+ IO io)]
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]]
+ ["." async (#+ Async) ("#\." monad)]]]
[data
[binary (#+ Binary)]
["." product]
@@ -59,8 +59,8 @@
(def: (or_crash! failure_description action)
(All [a]
- (-> Text (Promise (Try a)) (Promise a)))
- (do promise.monad
+ (-> Text (Async (Try a)) (Async a)))
+ (do async.monad
[?output action]
(case ?output
(#try.Failure error)
@@ -74,8 +74,8 @@
(def: (timed process)
(All [a]
- (-> (Promise (Try a)) (Promise (Try a))))
- (do promise.monad
+ (-> (Async (Try a)) (Async (Try a))))
+ (do async.monad
[#let [start (io.run instant.now)]
output process
#let [_ ("lux io log" (|> (io.run instant.now)
@@ -85,17 +85,17 @@
(wrap output)))
(def: (package! fs host_dependencies [packager package] static archive context)
- (-> (file.System Promise) (Dictionary file.Path Binary) [Packager file.Path] Static Archive Context (Promise (Try Any)))
+ (-> (file.System Async) (Dictionary file.Path Binary) [Packager file.Path] Static Archive Context (Async (Try Any)))
(case (packager host_dependencies archive context)
(#try.Success content)
(\ fs write content package)
(#try.Failure error)
- (\ promise.monad wrap (#try.Failure error))))
+ (\ async.monad wrap (#try.Failure error))))
(def: (load_host_dependencies fs host_dependencies)
- (-> (file.System Promise) (List file.Path) (Promise (Try (Dictionary file.Path Binary))))
- (do {! (try.with promise.monad)}
+ (-> (file.System Async) (List file.Path) (Async (Try (Dictionary file.Path Binary))))
+ (do {! (try.with async.monad)}
[]
(loop [pending host_dependencies
output (: (Dictionary file.Path Binary)
@@ -127,32 +127,32 @@
(-> platform.Phase_Wrapper Extender)
Service
[Packager file.Path]
- (Promise Any)))
- (do {! promise.monad}
- [platform (promise.future platform)]
+ (Async Any)))
+ (do {! async.monad}
+ [platform (async.future platform)]
(case service
(#/cli.Compilation compilation)
(<| (or_crash! "Compilation failed:")
..timed
- (do (try.with promise.monad)
+ (do (try.with async.monad)
[#let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation]
import (/import.import (get@ #platform.&file_system platform) compilation_libraries)
[state archive] (:sharing [<parameters>]
(Platform <parameters>)
platform
- (Promise (Try [(directive.State+ <parameters>)
- Archive]))
+ (Async (Try [(directive.State+ <parameters>)
+ Archive]))
(:assume (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender
import compilation_sources)))
[archive state] (:sharing [<parameters>]
(Platform <parameters>)
platform
- (Promise (Try [Archive (directive.State+ <parameters>)]))
+ (Async (Try [Archive (directive.State+ <parameters>)]))
(:assume (platform.compile import static expander platform compilation [archive state])))
_ (ioW.freeze (get@ #platform.&file_system platform) static archive)
- program_context (promise\wrap ($/program.context archive))
+ program_context (async\wrap ($/program.context archive))
host_dependencies (..load_host_dependencies (get@ #platform.&file_system platform) compilation_host_dependencies)
_ (..package! (for {@.old (file.async file.default)
@.jvm (file.async file.default)
@@ -166,7 +166,7 @@
(#/cli.Export export)
(<| (or_crash! "Export failed:")
- (do (try.with promise.monad)
+ (do (try.with async.monad)
[_ (/export.export (get@ #platform.&file_system platform)
export)]
(wrap (debug.log! "Export complete!"))))
@@ -175,9 +175,9 @@
## TODO: Fix the interpreter...
(undefined)
## (<| (or_crash! "Interpretation failed:")
- ## (do {! promise.monad}
+ ## (do {! async.monad}
## [console (|> console.default
- ## promise.future
+ ## async.future
## (\ ! map (|>> try.assumed console.async)))]
- ## (interpreter.run (try.with promise.monad) console platform interpretation generation_bundle)))
+ ## (interpreter.run (try.with async.monad) console platform interpretation generation_bundle)))
))))
diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux
index 9fe95684e..f17feaf22 100644
--- a/stdlib/source/program/compositor/export.lux
+++ b/stdlib/source/program/compositor/export.lux
@@ -6,7 +6,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." text
["%" format (#+ format)]]
@@ -40,8 +40,8 @@
#tar.group commons}))
(def: #export (library fs sources)
- (-> (file.System Promise) (List Source) (Promise (Try tar.Tar)))
- (do (try.with promise.monad)
+ (-> (file.System Async) (List Source) (Async (Try tar.Tar)))
+ (do (try.with async.monad)
[files (io.enumerate fs sources)]
(|> (dictionary.entries files)
(monad.map try.monad
@@ -60,11 +60,11 @@
..no_ownership
source_code])))))
(\ try.monad map row.of_list)
- (\ promise.monad wrap))))
+ (\ async.monad wrap))))
(def: #export (export fs [sources target])
- (-> (file.System Promise) Export (Promise (Try Any)))
- (do {! (try.with promise.monad)}
+ (-> (file.System Async) Export (Async (Try Any)))
+ (do {! (try.with async.monad)}
[tar (\ ! map (binary.run tar.writer)
(..library fs sources))]
(|> ..file
diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux
index 4edb82a5e..db46d6c13 100644
--- a/stdlib/source/program/compositor/import.lux
+++ b/stdlib/source/program/compositor/import.lux
@@ -7,7 +7,7 @@
["." try (#+ Try)]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]
+ ["." async (#+ Async) ("#\." monad)]]
["<>" parser
["<.>" binary]]]
[data
@@ -30,7 +30,7 @@
[cli (#+ Library)]])
(def: Action
- (type (All [a] (Promise (Try a)))))
+ (type (All [a] (Async (Try a)))))
(exception: #export useless_tar_entry)
@@ -43,8 +43,8 @@
(Dictionary file.Path Binary))
(def: (import_library system library import)
- (-> (file.System Promise) Library Import (Action Import))
- (let [! promise.monad]
+ (-> (file.System Async) Library Import (Action Import))
+ (let [! async.monad]
(|> library
(\ system read)
(\ ! map (let [! try.monad]
@@ -68,9 +68,9 @@
(\ ! join)))))))
(def: #export (import system libraries)
- (-> (file.System Promise) (List Library) (Action Import))
+ (-> (file.System Async) (List Library) (Action Import))
(monad.fold (: (Monad Action)
- (try.with promise.monad))
+ (try.with async.monad))
(..import_library system)
(dictionary.new text.hash)
libraries))
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index 708db73dd..5d3117062 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -127,7 +127,7 @@
_
(|> members
- (list.zip/2 tags)
+ (list.zipped/2 tags)
(list\map (function (_ [[_ t_name] type])
(case type
(#.Product _)
@@ -150,7 +150,7 @@
_
(let [member_docs (|> members
- (list.zip/2 tags)
+ (list.zipped/2 tags)
(list\map (function (_ [[_ t_name] type])
(if signature?
(format "(: " (pprint_type_definition level type_func_info #.None module signature? recursive_type? type) text.new_line " " t_name ")")
@@ -378,7 +378,7 @@
")"))))
_
- (meta.fail (exception.construct anonymous_type_definition type))))
+ (meta.failure (exception.construct anonymous_type_definition type))))
(def: (document_types module types)
(-> Text (List Value) (Meta (Markdown Block)))
@@ -510,7 +510,7 @@
lux_exports (monad.map ! (function.compose meta.exports product.left)
lux_modules)
module_documentation (|> (list\map organize_definitions lux_exports)
- (list.zip/2 lux_modules)
+ (list.zipped/2 lux_modules)
(monad.map ! document_module))
#let [_ (io.run (monad.map io.monad save_documentation! module_documentation))]]
(wrap (list))))
diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux
index de9a05fde..8a2965d51 100644
--- a/stdlib/source/specification/aedifex/repository.lux
+++ b/stdlib/source/specification/aedifex/repository.lux
@@ -7,7 +7,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." binary
["_#" \\test]]]
@@ -24,11 +24,11 @@
["#." artifact]]])
(def: #export (spec valid_artifact invalid_artifact subject)
- (-> Artifact Artifact (/.Repository Promise) Test)
+ (-> Artifact Artifact (/.Repository Async) Test)
(do random.monad
[expected (_binary.random 100)]
(wrap ($_ _.and'
- (do promise.monad
+ (do async.monad
[#let [good_uri (/remote.uri (get@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)]
good_upload! (\ subject upload good_uri expected)
good_download! (\ subject download good_uri)
diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux
index 08a294282..8ccf1e02f 100644
--- a/stdlib/source/specification/compositor.lux
+++ b/stdlib/source/specification/compositor.lux
@@ -64,4 +64,4 @@
expander)
(#try.Failure error)
- (_.fail error))))
+ (_.failure error))))
diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux
index e14aa8e52..bea185b99 100644
--- a/stdlib/source/specification/compositor/generation/common.lux
+++ b/stdlib/source/specification/compositor/generation/common.lux
@@ -28,7 +28,7 @@
[//
[common (#+ Runner)]]])
-(def: sanitize
+(def: safe
(-> Text Text)
(text.replace-all " " "_"))
@@ -41,7 +41,7 @@
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject)))
- (run (..sanitize <extension>))
+ (run (..safe <extension>))
(case> (#try.Success valueT)
(n.= (<reference> param subject) (:as Nat valueT))
@@ -61,7 +61,7 @@
(|> (#synthesis.Extension "lux i64 arithmetic-right-shift"
(list (synthesis.i64 subject)
(synthesis.i64 param)))
- (run (..sanitize "lux i64 arithmetic-right-shift"))
+ (run (..safe "lux i64 arithmetic-right-shift"))
(case> (#try.Success valueT)
("lux i64 ="
(i64.arithmetic-right-shift param subject)
@@ -81,7 +81,7 @@
(~~ (template [<extension> <type> <prepare> <comp> <subject-expr>]
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list (synthesis.i64 subject)))
- (run (..sanitize <extension>))
+ (run (..safe <extension>))
(case> (#try.Success valueT)
(<comp> (<prepare> subject) (:as <type> valueT))
@@ -99,7 +99,7 @@
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject)))
- (run (..sanitize <extension>))
+ (run (..safe <extension>))
(case> (#try.Success valueT)
(<comp> (<reference> param subject) (:as <outputT> valueT))
@@ -130,7 +130,7 @@
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject)))
- (run (..sanitize <extension>))
+ (run (..safe <extension>))
(//case.verify (<reference> param subject))))]
["lux f64 +" f.+ f.=]
@@ -143,7 +143,7 @@
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject)))
- (run (..sanitize <extension>))
+ (run (..safe <extension>))
(case> (#try.Success valueV)
(bit\= (<text> param subject)
(:as Bit valueV))
@@ -157,7 +157,7 @@
(~~ (template [<extension> <reference>]
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list))
- (run (..sanitize <extension>))
+ (run (..safe <extension>))
(//case.verify <reference>)))]
["lux f64 min" ("lux f64 min")]
@@ -165,7 +165,7 @@
["lux f64 smallest" ("lux f64 smallest")]
))
(_.test "'lux f64 i64 && 'lux i64 f64'"
- (|> (run (..sanitize "lux f64 i64")
+ (|> (run (..safe "lux f64 i64")
(|> subject synthesis.f64
(list) (#synthesis.Extension "lux f64 i64")
(list) (#synthesis.Extension "lux i64 f64")))
@@ -192,14 +192,14 @@
($_ _.and
(_.test "Can compare texts for equality."
(and (|> (#synthesis.Extension "lux text =" (list sample-lowerS sample-lowerS))
- (run (..sanitize "lux text ="))
+ (run (..safe "lux text ="))
(case> (#try.Success valueV)
(:as Bit valueV)
_
false))
(|> (#synthesis.Extension "lux text =" (list sample-upperS sample-lowerS))
- (run (..sanitize "lux text ="))
+ (run (..safe "lux text ="))
(case> (#try.Success valueV)
(not (:as Bit valueV))
@@ -207,7 +207,7 @@
false))))
(_.test "Can compare texts for order."
(|> (#synthesis.Extension "lux text <" (list sample-lowerS sample-upperS))
- (run (..sanitize "lux text <"))
+ (run (..safe "lux text <"))
(case> (#try.Success valueV)
(:as Bit valueV)
@@ -215,7 +215,7 @@
false)))
(_.test "Can get length of text."
(|> (#synthesis.Extension "lux text size" (list sample-lowerS))
- (run (..sanitize "lux text size"))
+ (run (..safe "lux text size"))
(case> (#try.Success valueV)
(n.= sample-size (:as Nat valueV))
@@ -223,7 +223,7 @@
false)))
(_.test "Can concatenate text."
(|> (#synthesis.Extension "lux text size" (list concatenatedS))
- (run (..sanitize "lux text size"))
+ (run (..safe "lux text size"))
(case> (#try.Success valueV)
(n.= (n.* 2 sample-size) (:as Nat valueV))
@@ -233,7 +233,7 @@
(and (|> (#synthesis.Extension "lux text index"
(list concatenatedS sample-lowerS
(synthesis.i64 +0)))
- (run (..sanitize "lux text index"))
+ (run (..safe "lux text index"))
(case> (^multi (#try.Success valueV)
{(:as (Maybe Nat) valueV) (#.Some valueV)})
(n.= 0 valueV)
@@ -243,7 +243,7 @@
(|> (#synthesis.Extension "lux text index"
(list concatenatedS sample-upperS
(synthesis.i64 +0)))
- (run (..sanitize "lux text index"))
+ (run (..safe "lux text index"))
(case> (^multi (#try.Success valueV)
{(:as (Maybe Nat) valueV) (#.Some valueV)})
(n.= sample-size valueV)
@@ -256,7 +256,7 @@
(list concatenatedS
(synthesis.i64 offset)
(synthesis.i64 length)))
- (run (..sanitize "lux text clip"))
+ (run (..safe "lux text clip"))
(case> (^multi (#try.Success valueV)
{(:as (Maybe Text) valueV) (#.Some valueV)})
(text\= expected valueV)
@@ -270,7 +270,7 @@
(|> (#synthesis.Extension "lux text char"
(list sample-lowerS
(synthesis.i64 char-idx)))
- (run (..sanitize "lux text char"))
+ (run (..safe "lux text char"))
(case> (^multi (#try.Success valueV)
{(:as (Maybe Int) valueV) (#.Some valueV)})
(text.contains? ("lux i64 char" valueV)
@@ -288,7 +288,7 @@
(_.test "Can log messages."
(|> (#synthesis.Extension "lux io log"
(list (synthesis.text (format "LOG: " message))))
- (run (..sanitize "lux io log"))
+ (run (..safe "lux io log"))
(case> (#try.Success valueV)
true
@@ -301,7 +301,7 @@
#synthesis.arity 1
#synthesis.body (#synthesis.Extension "lux io error"
(list (synthesis.text message)))})))
- (run (..sanitize "lux try"))
+ (run (..safe "lux try"))
(case> (^multi (#try.Success valueV)
{(:as (Try Text) valueV) (#try.Failure error)})
(text.contains? message error)
@@ -313,7 +313,7 @@
{#synthesis.environment (list)
#synthesis.arity 1
#synthesis.body (synthesis.text message)})))
- (run (..sanitize "lux try"))
+ (run (..safe "lux try"))
(case> (^multi (#try.Success valueV)
{(:as (Try Text) valueV) (#try.Success valueV)})
(text\= message valueV)
@@ -323,7 +323,7 @@
(_.test "Can obtain current time in milli-seconds."
(|> (synthesis.tuple (list (#synthesis.Extension "lux io current-time" (list))
(#synthesis.Extension "lux io current-time" (list))))
- (run (..sanitize "lux io current-time"))
+ (run (..safe "lux io current-time"))
(case> (#try.Success valueV)
(let [[pre post] (:as [Nat Nat] valueV)]
(n.>= pre post))
diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux
index c8482aff2..355b98409 100644
--- a/stdlib/source/specification/compositor/generation/structure.lux
+++ b/stdlib/source/specification/compositor/generation/structure.lux
@@ -76,7 +76,7 @@
(and (n.= size (array.size tuple-out))
(list.every? (function (_ [left right])
(i.= left (:as Int right)))
- (list.zip/2 tuple-in (array.to_list tuple-out)))))
+ (list.zipped/2 tuple-in (array.to_list tuple-out)))))
(#try.Failure _)
false)))))
diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux
index f454b61c9..cd2f88485 100644
--- a/stdlib/source/specification/lux/world/console.lux
+++ b/stdlib/source/specification/lux/world/console.lux
@@ -8,7 +8,7 @@
[io (#+ IO)]
["." try]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." text
["%" format (#+ format)]]]
@@ -18,11 +18,11 @@
["." /]])
(def: #export (spec console)
- (-> (IO (/.Console Promise)) Test)
+ (-> (IO (/.Console Async)) Test)
(do random.monad
[message (random.ascii/alpha 10)]
- (wrap (do promise.monad
- [console (promise.future console)
+ (wrap (do async.monad
+ [console (async.future console)
?write (\ console write (format message text.new_line))
?read (\ console read [])
?read_line (\ console read_line [])
diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux
index c70e23441..fd1585c34 100644
--- a/stdlib/source/specification/lux/world/file.lux
+++ b/stdlib/source/specification/lux/world/file.lux
@@ -11,7 +11,7 @@
["." try ("#\." functor)]
["." exception]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." maybe ("#\." functor)]
["." text ("#\." equivalence)
@@ -32,14 +32,14 @@
["." /]])
(def: (for_path fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
(<| (_.for [/.Path])
(do {! random.monad}
[parent (random.ascii/numeric 2)
child (random.ascii/numeric 2)])
wrap
- (do promise.monad
- [fs (promise.future fs)]
+ (do async.monad
+ [fs (async.future fs)]
($_ _.and'
(_.cover' [/.un_nest]
(and (|> (/.un_nest fs parent)
@@ -75,8 +75,8 @@
))))
(def: (directory?&make_directory fs parent)
- (-> (/.System Promise) /.Path (Promise Bit))
- (do promise.monad
+ (-> (/.System Async) /.Path (Async Bit))
+ (do async.monad
[directory_pre! (\ fs directory? parent)
made? (\ fs make_directory parent)
directory_post! (\ fs directory? parent)]
@@ -87,8 +87,8 @@
directory_post!))))
(def: (file?&write fs content path)
- (-> (/.System Promise) Binary /.Path (Promise Bit))
- (do promise.monad
+ (-> (/.System Async) Binary /.Path (Async Bit))
+ (do async.monad
[file_pre! (\ fs file? path)
made? (\ fs write content path)
file_post! (\ fs file? path)]
@@ -99,8 +99,8 @@
file_post!))))
(def: (file_size&read&append fs expected_file_size content appendix path)
- (-> (/.System Promise) Nat Binary Binary /.Path (Promise Bit))
- (do promise.monad
+ (-> (/.System Async) Nat Binary Binary /.Path (Async Bit))
+ (do async.monad
[pre_file_size (\ fs file_size path)
pre_content (\ fs read path)
appended? (\ fs append appendix path)
@@ -127,8 +127,8 @@
post_content!)))))))
(def: (modified?&last_modified fs expected_time path)
- (-> (/.System Promise) Instant /.Path (Promise Bit))
- (do promise.monad
+ (-> (/.System Async) Instant /.Path (Async Bit))
+ (do async.monad
[modified? (\ fs modify expected_time path)
last_modified (\ fs last_modified path)]
(wrap (<| (try.default false)
@@ -137,10 +137,10 @@
(\ ! map (instant\= expected_time) last_modified))))))
(def: (directory_files&sub_directories fs parent sub_dir child)
- (-> (/.System Promise) /.Path /.Path /.Path (Promise Bit))
+ (-> (/.System Async) /.Path /.Path /.Path (Async Bit))
(let [sub_dir (/.nest fs parent sub_dir)
child (/.nest fs parent child)]
- (do promise.monad
+ (do async.monad
[made_sub? (\ fs make_directory sub_dir)
directory_files (\ fs directory_files parent)
sub_directories (\ fs sub_directories parent)
@@ -156,10 +156,10 @@
(try.default false))))))))))
(def: (move&delete fs parent child alternate_child)
- (-> (/.System Promise) /.Path Text Text (Promise Bit))
+ (-> (/.System Async) /.Path Text Text (Async Bit))
(let [origin (/.nest fs parent child)
destination (/.nest fs parent alternate_child)]
- (do {! promise.monad}
+ (do {! async.monad}
[moved? (\ fs move destination origin)
lost? (|> origin
(\ fs file?)
@@ -174,7 +174,7 @@
found?))))))))
(def: (for_system fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
(<| (do {! random.monad}
[parent (random.ascii/numeric 2)
child (random.ascii/numeric 2)
@@ -189,8 +189,8 @@
appendix ($binary.random expected_file_size)
expected_time random.instant])
wrap
- (do {! promise.monad}
- [fs (promise.future fs)
+ (do {! async.monad}
+ [fs (async.future fs)
#let [path (/.nest fs parent child)]
directory?&make_directory
@@ -225,14 +225,14 @@
move&delete))))
(def: (make_directories&cannot_make_directory fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
(<| (do {! random.monad}
[dir/0 (random.ascii/numeric 2)
dir/1 (random.ascii/numeric 2)
dir/2 (random.ascii/numeric 2)])
wrap
- (do {! promise.monad}
- [fs (promise.future fs)
+ (do {! async.monad}
+ [fs (async.future fs)
#let [dir/1 (/.nest fs dir/0 dir/1)
dir/2 (/.nest fs dir/1 dir/2)]
pre_dir/0 (\ fs directory? dir/0)
@@ -272,12 +272,12 @@
)))
(def: (make_file&cannot_make_file fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
(<| (do {! random.monad}
[file/0 (random.ascii/numeric 3)])
wrap
- (do {! promise.monad}
- [fs (promise.future fs)
+ (do {! async.monad}
+ [fs (async.future fs)
make_file!/0 (/.make_file ! fs (utf8\encode file/0) file/0)
make_file!/1 (/.make_file ! fs (utf8\encode file/0) file/0)])
($_ _.and'
@@ -295,21 +295,21 @@
)))
(def: (for_utilities fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
($_ _.and
(..make_directories&cannot_make_directory fs)
(..make_file&cannot_make_file fs)
))
(def: (exists? fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
(<| (do {! random.monad}
[file (random.ascii/numeric 2)
dir (random.only (|>> (text\= file) not)
(random.ascii/numeric 2))])
wrap
- (do {! promise.monad}
- [fs (promise.future fs)
+ (do {! async.monad}
+ [fs (async.future fs)
pre_file/0 (\ fs file? file)
pre_file/1 (/.exists? ! fs file)
@@ -342,7 +342,7 @@
post_dir/1))))
(def: #export (spec fs)
- (-> (IO (/.System Promise)) Test)
+ (-> (IO (/.System Async)) Test)
($_ _.and
(..for_path fs)
(..for_utilities fs)
diff --git a/stdlib/source/specification/lux/world/program.lux b/stdlib/source/specification/lux/world/program.lux
index e79429627..411f29fe9 100644
--- a/stdlib/source/specification/lux/world/program.lux
+++ b/stdlib/source/specification/lux/world/program.lux
@@ -7,7 +7,7 @@
[control
["." try]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." text]
[collection
@@ -19,10 +19,10 @@
["." /]])
(def: #export (spec subject)
- (-> (/.Program Promise) Test)
+ (-> (/.Program Async) Test)
(do random.monad
[exit random.int]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[environment (/.environment ! subject)]
(_.cover' [/.Program]
(and (not (dictionary.empty? environment))
diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux
index c4fc51b99..55197a307 100644
--- a/stdlib/source/specification/lux/world/shell.lux
+++ b/stdlib/source/specification/lux/world/shell.lux
@@ -7,7 +7,7 @@
[control
["." try ("#\." functor)]
[concurrency
- ["." promise (#+ Promise) ("#\." monad)]]
+ ["." async (#+ Async) ("#\." monad)]]
[parser
["." environment (#+ Environment)]]]
[data
@@ -34,22 +34,22 @@
)
(def: (can_wait! process)
- (-> (/.Process Promise) _.Assertion)
+ (-> (/.Process Async) _.Assertion)
(|> (\ process await [])
- (promise\map (|>> (try\map (i.= /.normal))
- (try.default false)
- (_.cover' [/.Exit /.normal])))
- promise\join))
+ (async\map (|>> (try\map (i.= /.normal))
+ (try.default false)
+ (_.cover' [/.Exit /.normal])))
+ async\join))
(def: (can_read! expected process)
- (-> Text (/.Process Promise) (Promise Bit))
+ (-> Text (/.Process Async) (Async Bit))
(|> (\ process read [])
- (promise\map (|>> (try\map (text\= expected))
- (try.default false)))))
+ (async\map (|>> (try\map (text\= expected))
+ (try.default false)))))
(def: (can_destroy! process)
- (-> (/.Process Promise) (Promise Bit))
- (do promise.monad
+ (-> (/.Process Async) (Async Bit))
+ (do async.monad
[?destroy (\ process destroy [])
?await (\ process await [])]
(wrap (and (case ?destroy
@@ -67,12 +67,12 @@
(with_expansions [<shell_coverage> (as_is [/.Command /.Argument])]
(def: #export (spec shell)
- (-> (/.Shell Promise) Test)
+ (-> (/.Shell Async) Test)
(<| (_.for [/.Shell /.Process])
(do {! random.monad}
[message (random.ascii/alpha 10)
seconds (\ ! map (|>> (n.% 5) (n.+ 5)) random.nat)]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[?echo (\ shell execute (..echo! message))
?sleep (\ shell execute (..sleep! seconds))]
(case [?echo ?sleep]
diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux
index 9152a3d22..9a55ccb59 100644
--- a/stdlib/source/test/aedifex/artifact.lux
+++ b/stdlib/source/test/aedifex/artifact.lux
@@ -9,9 +9,6 @@
["$." equivalence]
["$." order]
["$." hash]]]
- [control
- [concurrency
- [promise (#+ Promise)]]]
[data
["." text ("#\." equivalence)]]
[math
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux
index 2f52b1d7b..19fd23203 100644
--- a/stdlib/source/test/aedifex/cache.lux
+++ b/stdlib/source/test/aedifex/cache.lux
@@ -7,7 +7,7 @@
[control
["." try]
[concurrency
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
["." environment]]]
[data
@@ -104,10 +104,10 @@
[[dependency expected_package] ..package
home (random.ascii/alpha 5)
working_directory (random.ascii/alpha 5)
- #let [fs (: (file.System Promise)
+ #let [fs (: (file.System Async)
(file.mock (\ file.default separator)))
program (program.async (program.mock environment.empty home working_directory))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[wrote! (/.write_one program fs dependency expected_package)
read! (/.read_one program fs dependency)]
(_.cover' [/.write_one /.read_one]
@@ -125,10 +125,10 @@
[expected ..resolution
home (random.ascii/alpha 5)
working_directory (random.ascii/alpha 5)
- #let [fs (: (file.System Promise)
+ #let [fs (: (file.System Async)
(file.mock (\ file.default separator)))
program (program.async (program.mock environment.empty home working_directory))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[wrote! (/.write_all program fs expected)
read! (/.read_all program fs (dictionary.keys expected) //dependency/resolution.empty)]
(_.cover' [/.write_all /.read_all]
diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux
index 4239644aa..6f83f5a11 100644
--- a/stdlib/source/test/aedifex/cli.lux
+++ b/stdlib/source/test/aedifex/cli.lux
@@ -48,7 +48,7 @@
## #Auto
..compilation))
-(def: (format_compilation value)
+(def: (compilation_format value)
(-> /.Compilation (List Text))
(case value
#/.Build (list "build")
@@ -63,8 +63,8 @@
#/.Dependencies (list "deps")
#/.Install (list "install")
(#/.Deploy repository [user password]) (list "deploy" repository user password)
- (#/.Compilation compilation) (..format_compilation compilation)
- (#/.Auto compilation) (list& "auto" (..format_compilation compilation))))
+ (#/.Compilation compilation) (..compilation_format compilation)
+ (#/.Auto compilation) (list& "auto" (..compilation_format compilation))))
(def: without_profile
Test
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index 474a8dd1f..27b12bc42 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -11,7 +11,7 @@
["." environment]]
[concurrency
["." atom (#+ Atom)]
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." binary]
["." text
@@ -45,15 +45,15 @@
[resolution (#+ Resolution)]]]]])
(def: (command expected_runs end_signal fs dummy_file)
- (-> Nat Text (file.System Promise) file.Path
+ (-> Nat Text (file.System Async) file.Path
[(Atom Nat)
- (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Exit Any]))])
+ (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any]))])
(let [@runs (: (Atom Nat)
(atom.atom 0))]
[@runs
(function (_ console program fs shell resolution profile)
- (do {! promise.monad}
- [[_ actual_runs] (promise.future (atom.update inc @runs))]
+ (do {! async.monad}
+ [[_ actual_runs] (async.future (atom.update inc @runs))]
(if (n.= expected_runs actual_runs)
(wrap (#try.Failure end_signal))
(do (try.with !)
@@ -95,13 +95,13 @@
($_ _.and
(_.cover [/.delay]
(n.> 0 /.delay))
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do ///action.monad
[_ (\ fs make_directory source)
_ (\ fs write (binary.create 0) dummy_path)
#let [[@runs command] (..command expected_runs end_signal fs dummy_path)]
_ (\ watcher poll [])]
- (do {! promise.monad}
+ (do {! async.monad}
[no_dangling_process! (|> profile
(set@ #///.compiler compiler)
((/.do! 1 watcher command)
@@ -117,7 +117,7 @@
false))))
correct_number_of_runs! (|> @runs
atom.read
- promise.future
+ async.future
(\ ! map (n.= expected_runs)))]
(wrap (#try.Success (and correct_number_of_runs!
no_dangling_process!)))))]
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 4b0960d32..3bc7f86dc 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -10,7 +10,7 @@
["." try]
["." exception]
[concurrency
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
["." environment]]]
[data
@@ -159,7 +159,7 @@
with_program
with_target)]]
($_ _.and
- (wrap (do promise.monad
+ (wrap (do async.monad
[outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty
(with_target empty_profile))]
(_.cover' [/.no_specified_program]
@@ -169,7 +169,7 @@
(#try.Failure error)
(exception.match? /.no_specified_program error)))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)]
(_.cover' [/.Compiler /.no_available_compiler]
(case outcome
@@ -181,7 +181,7 @@
(do !
[#let [console (@version.echo "")]
[compiler resolution] ..resolution]
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do ///action.monad
[_ (/.do! console (program.async (program.mock environment.empty home working_directory))
fs shell resolution
@@ -203,7 +203,7 @@
(do !
[#let [console (@version.echo "")]
[compiler resolution] ..resolution]
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do ///action.monad
[_ (/.do! console (program.async (program.mock environment.empty home working_directory))
fs (shell.async (..bad_shell [])) resolution
@@ -224,7 +224,7 @@
shell (|> (list expected/0 expected/1 expected/2)
(..reader_shell <error?>)
shell.async)]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[verdict (do ///action.monad
[process (shell [environment.empty working_directory "" (list "")])
_ (<log!> console process)
diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux
index f0a5f4b58..568c6fb76 100644
--- a/stdlib/source/test/aedifex/command/clean.lux
+++ b/stdlib/source/test/aedifex/command/clean.lux
@@ -7,7 +7,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[binary (#+ Binary)]
["." product]
@@ -46,32 +46,32 @@
[count (\ ! map (n.% 10) random.nat)
names (random.set text.hash count ..node_name)
contents (random.list count ($binary.random 100))]
- (wrap (list.zip/2 (list\map (|>> (format prefix)) (set.to_list names))
- contents))))
+ (wrap (list.zipped/2 (list\map (|>> (format prefix)) (set.to_list names))
+ contents))))
(def: (create_file! fs [path content])
- (-> (file.System Promise) [Path Binary] (Promise (Try Any)))
+ (-> (file.System Async) [Path Binary] (Async (Try Any)))
(\ fs write content path))
(def: (create_directory! fs path files)
- (-> (file.System Promise) Path (List [Path Binary]) (Promise (Try Any)))
- (do {! (try.with promise.monad)}
- [_ (: (Promise (Try Any))
- (file.make_directories promise.monad fs path))
+ (-> (file.System Async) Path (List [Path Binary]) (Async (Try Any)))
+ (do {! (try.with async.monad)}
+ [_ (: (Async (Try Any))
+ (file.make_directories async.monad fs path))
_ (monad.map ! (..create_file! fs) files)]
(wrap [])))
(def: (directory_exists? fs)
- (-> (file.System Promise) Path (Promise (Try Bit)))
- (|>> (\ fs directory?) (try.lift promise.monad)))
+ (-> (file.System Async) Path (Async (Try Bit)))
+ (|>> (\ fs directory?) (try.lift async.monad)))
(def: (file_exists? fs)
- (-> (file.System Promise) Path (Promise (Try Bit)))
- (|>> (\ fs file?) (try.lift promise.monad)))
+ (-> (file.System Async) Path (Async (Try Bit)))
+ (|>> (\ fs file?) (try.lift async.monad)))
(def: (assets_exist? fs directory_path files)
- (-> (file.System Promise) Path (List [Path Binary]) (Promise (Try Bit)))
- (do {! (try.with promise.monad)}
+ (-> (file.System Async) Path (List [Path Binary]) (Async (Try Bit)))
+ (do {! (try.with async.monad)}
[directory_exists? (..directory_exists? fs directory_path)
files_exist? (: (Action (List Bit))
(|> files
@@ -95,9 +95,9 @@
sub_files (..files (format sub_path /))
dummy @profile.random]
- (wrap (do promise.monad
+ (wrap (do async.monad
[#let [console (@version.echo "")]
- verdict (do {! (try.with promise.monad)}
+ verdict (do {! (try.with async.monad)}
[_ (..create_directory! fs target_path direct_files)
_ (..create_directory! fs sub_path sub_files)
context_exists!/pre (..directory_exists? fs context)
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index d1b955c77..e2f7cfa4a 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -7,7 +7,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
["." environment]]]
[data
@@ -50,9 +50,9 @@
["#/." extension]]]]])
(def: (execute! program repository fs artifact profile)
- (-> (Program Promise) (Repository Promise) (file.System Promise)
+ (-> (Program Async) (Repository Async) (file.System Async)
Artifact ///.Profile
- (Promise (Try Text)))
+ (Async (Try Text)))
(do ///action.monad
[#let [console ($version.echo "")]
_ ($install.make_sources! fs (get@ #///.sources profile))
@@ -77,7 +77,7 @@
$repository.empty)
fs (file.mock (\ file.default separator))
program (program.async (program.mock environment.empty home working_directory))]]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[verdict (do {! ///action.monad}
[logging (..execute! program repository fs artifact profile)
expected_library (|> profile
@@ -89,12 +89,12 @@
actual_pom (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact ///artifact/extension.pom))
actual_library (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact ///artifact/extension.lux_library))
actual_sha-1 (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1)))
- actual_sha-1 (\ promise.monad wrap
+ actual_sha-1 (\ async.monad wrap
(do try.monad
[actual_sha-1 (\ utf8.codec decode actual_sha-1)]
(\ ///hash.sha-1_codec decode actual_sha-1)))
actual_md5 (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5)))
- actual_md5 (\ promise.monad wrap
+ actual_md5 (\ async.monad wrap
(do try.monad
[actual_md5 (\ utf8.codec decode actual_md5)]
(\ ///hash.md5_codec decode actual_md5)))
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
index 40645b731..1a54ae89d 100644
--- a/stdlib/source/test/aedifex/command/deps.lux
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -8,7 +8,7 @@
[control
["." try]
[concurrency
- ["." promise]]
+ ["." async]]
[parser
["." environment]]]
[data
@@ -95,7 +95,7 @@
fs (file.mock (\ file.default separator))
program (program.async (program.mock environment.empty home working_directory))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do ///action.monad
[#let [console (@version.echo "")
local (///repository/local.repository program fs)]
diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux
index 70df9b7a3..3ba225206 100644
--- a/stdlib/source/test/aedifex/command/install.lux
+++ b/stdlib/source/test/aedifex/command/install.lux
@@ -8,7 +8,7 @@
["." try (#+ Try) ("#\." functor)]
["." exception]
[concurrency
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
["." environment]]]
[data
@@ -40,20 +40,20 @@
["#/." local]]]]]])
(def: #export (make_sources! fs sources)
- (-> (file.System Promise) (Set file.Path) (Action (List Any)))
+ (-> (file.System Async) (Set file.Path) (Action (List Any)))
(let [/ (\ fs separator)
! ///action.monad]
(|> sources
set.to_list
(monad.map ! (function (_ head)
(do !
- [_ (: (Promise (Try Any))
- (file.make_directories promise.monad fs head))]
- (: (Promise (Try Any))
- (file.make_file promise.monad fs (binary.create 0) (format head / head ".lux")))))))))
+ [_ (: (Async (Try Any))
+ (file.make_directories async.monad fs head))]
+ (: (Async (Try Any))
+ (file.make_file async.monad fs (binary.create 0) (format head / head ".lux")))))))))
(def: (execute! program fs sample)
- (-> (Program Promise) (file.System Promise) ///.Profile (Promise (Try Text)))
+ (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text)))
(do ///action.monad
[#let [console ($version.echo "")]
_ (..make_sources! fs (get@ #///.sources sample))
@@ -71,7 +71,7 @@
working_directory (random.ascii/alpha 5)
#let [/ (\ file.default separator)]]
($_ _.and
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[#let [fs (file.mock /)
program (program.async (program.mock environment.empty home working_directory))
@@ -84,17 +84,17 @@
library_exists! (|> library_path
(format home /)
(\ fs file?)
- (\ promise.monad map exception.return))
+ (\ async.monad map exception.return))
pom_exists! (|> pom_path
(format home /)
(\ fs file?)
- (\ promise.monad map exception.return))]
+ (\ async.monad map exception.return))]
(wrap (and succeeded!
library_exists!
pom_exists!)))]
(_.cover' [/.do! /.success]
(try.default false verdict))))
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[#let [fs (file.mock /)
program (program.async (program.mock environment.empty home working_directory))]
logging (..execute! program fs (set@ #///.identity #.None sample))]
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index 624be95bd..4ee1c49f4 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -7,7 +7,7 @@
[control
["." try ("#\." functor)]
[concurrency
- ["." promise]]]
+ ["." async]]]
[data
["." binary ("#\." equivalence)]
["." text ("#\." equivalence)
@@ -36,7 +36,7 @@
(do random.monad
[sample @profile.random
#let [fs (file.mock (\ file.default separator))]]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[#let [console (@version.echo "")]
outcome (/.do! console fs sample)]
(case outcome
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
index 4621028ae..5882992a9 100644
--- a/stdlib/source/test/aedifex/command/test.lux
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -8,7 +8,7 @@
["." try]
["." exception]
[concurrency
- ["." promise]]
+ ["." async]]
[parser
["." environment]]]
[data
@@ -61,7 +61,7 @@
($_ _.and
(let [fs (file.mock (\ file.default separator))
console (@version.echo "")]
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do ///action.monad
[_ (/.do! console (program.async (program.mock environment.empty home working_directory))
fs (shell.async (@build.good_shell [])) resolution
@@ -79,7 +79,7 @@
(try.default false verdict)))))
(let [fs (file.mock (\ file.default separator))
console (@version.echo "")]
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do ///action.monad
[#let [bad_shell (shell.mock
(function (_ [actual_environment actual_working_directory actual_command actual_arguments])
diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux
index d0d172a7a..739a02fef 100644
--- a/stdlib/source/test/aedifex/command/version.lux
+++ b/stdlib/source/test/aedifex/command/version.lux
@@ -8,7 +8,7 @@
["." try]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." maybe]
["." text ("#\." equivalence)
@@ -58,7 +58,7 @@
(exception.throw ..console_is_closed! []))))
(def: #export echo
- (-> Text (Console Promise))
+ (-> Text (Console Async))
(|>> [true]
(console.mock ..mock)
console.async))
@@ -68,9 +68,9 @@
(<| (_.covering /._)
(do random.monad
[profile @profile.random]
- (wrap (do promise.monad
+ (wrap (do async.monad
[#let [console (..echo "")]
- verdict (do (try.with promise.monad)
+ verdict (do (try.with async.monad)
[_ (/.do! console profile)
logging (\ console read_line [])]
(wrap (text\= (version.format language/lux.version)
diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux
index a99f37ca1..218bbaf07 100644
--- a/stdlib/source/test/aedifex/dependency/deployment.lux
+++ b/stdlib/source/test/aedifex/dependency/deployment.lux
@@ -10,7 +10,7 @@
["." try ("#\." functor)]
[concurrency
["." atom (#+ Atom)]
- ["." promise]]]
+ ["." async]]]
[data
["." product]
["." maybe ("#\." functor)]
@@ -156,9 +156,9 @@
(atom.atom (dictionary.new text.hash)))
http (..http cache)
repository (repository.async (remote.repository http #.None address))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[?outcome (/.one repository dependency package)
- cache (promise.future (atom.read cache))]
+ cache (async.future (atom.read cache))]
(_.cover' [/.one]
(|> ?outcome
(try\map (verify_one 1 address package cache expected_artifact))
@@ -179,9 +179,9 @@
(atom.atom (dictionary.new text.hash)))
http (..http cache)
repository (repository.async (remote.repository http #.None address))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[?outcome (/.all repository resolution)
- cache (promise.future (atom.read cache))]
+ cache (async.future (atom.read cache))]
(_.cover' [/.all]
(|> ?outcome
(try\map (function (_ actual_artifacts)
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux
index 9d1f287c6..ea468f851 100644
--- a/stdlib/source/test/aedifex/dependency/resolution.lux
+++ b/stdlib/source/test/aedifex/dependency/resolution.lux
@@ -11,7 +11,7 @@
["." try]
["." exception]
[concurrency
- ["." promise]]]
+ ["." async]]]
[data
[binary (#+ Binary)]
["." product]
@@ -259,7 +259,7 @@
bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]]
(`` ($_ _.and
(wrap
- (do promise.monad
+ (do async.monad
[actual_package (/.one (///repository.mock good [])
{#///dependency.artifact expected_artifact
#///dependency.type ///artifact/type.lux_library})]
@@ -274,7 +274,7 @@
false))))
(~~ (template [<exception> <bad>]
[(wrap
- (do promise.monad
+ (do async.monad
[actual_package (/.one (///repository.mock <bad> [])
{#///dependency.artifact expected_artifact
#///dependency.type ///artifact/type.lux_library})]
@@ -306,7 +306,7 @@
bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]]
($_ _.and
(wrap
- (do promise.monad
+ (do async.monad
[#let [console ($///version.echo "")]
actual_package (/.any console
(list (///repository.mock bad_sha-1 [])
@@ -324,7 +324,7 @@
(#try.Failure _)
false))))
(wrap
- (do promise.monad
+ (do async.monad
[#let [console ($///version.echo "")]
actual_package (/.any console
(list (///repository.mock bad_sha-1 [])
@@ -411,7 +411,7 @@
(..packages [dependee_artifact depender_artifact ignored_artifact])]
($_ _.and
(wrap
- (do promise.monad
+ (do async.monad
[#let [console ($///version.echo "")]
[successes failures resolution] (/.all console
(list (///repository.mock (..single dependee_artifact dependee_package) [])
diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux
index 529185320..e7f02569f 100644
--- a/stdlib/source/test/aedifex/input.lux
+++ b/stdlib/source/test/aedifex/input.lux
@@ -7,7 +7,7 @@
[control
["." try (#+ Try)]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
[text
["%" format]
@@ -46,17 +46,17 @@
(<| (_.covering /._)
(do {! random.monad}
[expected (\ ! map (set@ #//.parents (list)) $profile.random)
- #let [fs (: (file.System Promise)
+ #let [fs (: (file.System Async)
(file.mock (\ file.default separator)))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[verdict (do //action.monad
[#let [profile (|> expected
//format.profile
%.code
(\ utf8.codec encode))]
_ (\ fs write profile //project.file)
- actual (: (Promise (Try Profile))
- (/.read promise.monad fs //.default))]
+ actual (: (Async (Try Profile))
+ (/.read async.monad fs //.default))]
(wrap (\ //.equivalence =
(|> expected
(update@ #//.sources ..with_default_source)
diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux
index cc2d78db7..6a2106ad3 100644
--- a/stdlib/source/test/aedifex/metadata/artifact.lux
+++ b/stdlib/source/test/aedifex/metadata/artifact.lux
@@ -12,7 +12,7 @@
["." environment]
["<.>" xml]]
[concurrency
- ["." promise]]]
+ ["." async]]]
[data
["." maybe]
["." text ("#\." equivalence)]
@@ -100,7 +100,7 @@
#let [program (program.async (program.mock environment.empty home working_directory))
fs (file.mock (\ file.default separator))
repository (///repository/local.repository program fs)]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[wrote? (/.write repository artifact expected)
actual (/.read repository artifact)]
(_.cover' [/.write /.read]
diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux
index 48738522a..ea0a26a5a 100644
--- a/stdlib/source/test/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/test/aedifex/metadata/snapshot.lux
@@ -12,7 +12,7 @@
["." environment]
["<.>" xml]]
[concurrency
- ["." promise]]]
+ ["." async]]]
[data
["." maybe]
["." text ("#\." equivalence)]
@@ -112,7 +112,7 @@
#let [program (program.async (program.mock environment.empty home working_directory))
fs (file.mock (\ file.default separator))
repository (///repository/local.repository program fs)]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[wrote? (/.write repository artifact expected)
actual (/.read repository artifact)]
(_.cover' [/.write /.read]
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index 55bca8ce3..61201456a 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -7,9 +7,7 @@
[\\specification
["$." equivalence]]]
[control
- ["." try]
- [concurrency
- [promise (#+ Promise)]]]
+ ["." try]]
[data
["." product]
["." text
diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux
index 1bbf2f7bb..a40924dea 100644
--- a/stdlib/source/test/aedifex/repository/local.lux
+++ b/stdlib/source/test/aedifex/repository/local.lux
@@ -9,7 +9,7 @@
[parser
["." environment]]
[concurrency
- ["." promise]]]
+ ["." async]]]
[data
["." binary ("#\." equivalence)]
[text
@@ -38,7 +38,7 @@
expected (\ ! map (\ utf8.codec encode)
(random.ascii/lower 10))]
($_ _.and
- (wrap (do promise.monad
+ (wrap (do async.monad
[before_upload (\ repo download uri)
_ (\ repo upload uri expected)
actual (\ repo download uri)]
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 8cd7a7695..cd77beb6f 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -445,39 +445,100 @@
(is? expected (..identity_macro expected)))
))))
+(/.type: for_type/variant
+ #Case/0
+ (#Case/1 Nat)
+ (#Case/2 Int Text))
+
+(/.type: for_type/record
+ {#slot/0 Bit
+ #slot/1 Rev})
+
+(/.type: (for_type/all parameter)
+ [parameter parameter])
+
(def: for_type
Test
- (do random.monad
+ (do {! random.monad}
[expected random.nat
expected_left random.nat
- expected_right random.nat]
- ($_ _.and
- (_.cover [/.:]
- (|> expected
- (/.: Any)
- (is? (/.: Any expected))))
- (_.cover [/.:as]
- (|> expected
- (/.: Any)
- (/.:as /.Nat)
- (is? expected)))
- (_.cover [/.:assume]
- (|> expected
- (/.: Any)
- /.:assume
- (/.: /.Nat)
- (is? expected)))
- (_.cover [/.:let]
- (let [[actual_left actual_right]
- (: (/.:let [side /.Nat]
- (& side side))
- [expected_left expected_right])]
- (and (is? expected_left actual_left)
- (is? expected_right actual_right))))
- (_.cover [/.:of]
- (is? /.Nat (/.:of expected)))
- )))
+ expected_right random.nat
+
+ #let [existential_type (: (Random /.Type)
+ (\ ! map (|>> #.Ex) random.nat))]
+ expected/0 existential_type
+ expected/1 existential_type]
+ (<| (_.for [/.Type])
+ ($_ _.and
+ (_.cover [/.:]
+ (|> expected
+ (/.: Any)
+ (is? (/.: Any expected))))
+ (_.cover [/.:as]
+ (|> expected
+ (/.: Any)
+ (/.:as /.Nat)
+ (is? expected)))
+ (_.cover [/.:assume]
+ (|> expected
+ (/.: Any)
+ /.:assume
+ (/.: /.Nat)
+ (is? expected)))
+ (_.cover [/.:let]
+ (let [[actual_left actual_right]
+ (: (/.:let [side /.Nat]
+ (& side side))
+ [expected_left expected_right])]
+ (and (is? expected_left actual_left)
+ (is? expected_right actual_right))))
+ (_.cover [/.:of]
+ (is? /.Nat (/.:of expected)))
+ (_.cover [/.primitive]
+ (case (/.primitive "foo" [expected/0 expected/1])
+ (^ (#.Primitive "foo" (list actual/0 actual/1)))
+ (and (is? expected/0 actual/0)
+ (is? expected/1 actual/1))
+
+ _
+ false))
+ (_.cover [/.type]
+ (and (case (/.type [expected/0 expected/1])
+ (#.Product actual/0 actual/1)
+ (and (is? expected/0 actual/0)
+ (is? expected/1 actual/1))
+
+ _
+ false)
+ (case (/.type (| expected/0 expected/1))
+ (#.Sum actual/0 actual/1)
+ (and (is? expected/0 actual/0)
+ (is? expected/1 actual/1))
+
+ _
+ false)
+ (case (/.type (-> expected/0 expected/1))
+ (#.Function actual/0 actual/1)
+ (and (is? expected/0 actual/0)
+ (is? expected/1 actual/1))
+
+ _
+ false)
+ (case (/.type (expected/0 expected/1))
+ (#.Apply actual/1 actual/0)
+ (and (is? expected/0 actual/0)
+ (is? expected/1 actual/1))
+
+ _
+ false)))
+ (_.cover [/.type:]
+ (exec
+ (: /.Type ..for_type/variant)
+ (: /.Type ..for_type/record)
+ (: /.Type ..for_type/all)
+ true))
+ ))))
(def: for_i64
Test
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux
index 09ef32175..b5c39ad75 100644
--- a/stdlib/source/test/lux/abstract/enum.lux
+++ b/stdlib/source/test/lux/abstract/enum.lux
@@ -30,13 +30,13 @@
(<| (_.covering /._)
($_ _.and
(_.cover [/.range]
- (let [expected-size (|> end (n.- start) inc)
- expected-start? (|> range list.head (maybe\map (n.= start)) (maybe.default false))
- expected-end? (|> range list.last (maybe\map (n.= end)) (maybe.default false))
- can-be-backwards? (\ (list.equivalence n.equivalence) =
+ (let [expected_size (|> end (n.- start) inc)
+ expected_start? (|> range list.head (maybe\map (n.= start)) (maybe.default false))
+ expected_end? (|> range list.last (maybe\map (n.= end)) (maybe.default false))
+ can_be_backwards? (\ (list.equivalence n.equivalence) =
(/.range n.enum start end)
(list.reverse (/.range n.enum end start)))
- every-element-is-a-successor? (case range
+ every_element_is_a_successor? (case range
(#.Cons head tail)
(|> (list\fold (function (_ next [verdict prev])
[(and verdict
@@ -48,9 +48,9 @@
#.Nil
false)]
- (and (n.= expected-size (list.size range))
- expected-start?
- expected-end?
- can-be-backwards?
- every-element-is-a-successor?)))
+ (and (n.= expected_size (list.size range))
+ expected_start?
+ expected_end?
+ can_be_backwards?
+ every_element_is_a_successor?)))
)))))
diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux
index e1ab4f5f1..a4bb2c5f2 100644
--- a/stdlib/source/test/lux/control.lux
+++ b/stdlib/source/test/lux/control.lux
@@ -9,7 +9,7 @@
["#/." atom]
["#/." frp]
["#/." thread]
- ["#/." promise]
+ ["#/." async]
["#/." semaphore]
["#/." stm]]
["#." continuation]
@@ -36,7 +36,7 @@
/concurrency/atom.test
/concurrency/frp.test
/concurrency/thread.test
- /concurrency/promise.test
+ /concurrency/async.test
/concurrency/semaphore.test
/concurrency/stm.test
))
diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux
index 3ceac0c4b..5ca5d7659 100644
--- a/stdlib/source/test/lux/control/concurrency/actor.lux
+++ b/stdlib/source/test/lux/control/concurrency/actor.lux
@@ -22,7 +22,7 @@
["." / (#+ actor: message:)
[//
["." atom (#+ Atom)]
- ["." promise (#+ Promise Resolver) ("#\." monad)]
+ ["." async (#+ Async Resolver) ("#\." monad)]
["." frp]]]])
(exception: got_wrecked)
@@ -36,7 +36,7 @@
(message: (count! {increment Nat} state self)
Nat
(let [state' (n.+ increment state)]
- (promise\wrap (#try.Success [state' state']))))
+ (async\wrap (#try.Success [state' state']))))
)
(def: (mailed? outcome)
@@ -52,7 +52,7 @@
#let [as_mail (: (All [a] (-> (-> a a) (/.Mail a)))
(function (_ transform)
(function (_ state actor)
- (|> state transform #try.Success promise\wrap))))
+ (|> state transform #try.Success async\wrap))))
inc! (: (/.Mail Nat) (as_mail inc))
dec! (: (/.Mail Nat) (as_mail dec))]]
(<| (_.covering /._)
@@ -82,27 +82,27 @@
(and poisoned_actors_die!
cannot_poison_more_than_once!)))
- (let [[read write] (: [(Promise Text) (Resolver Text)]
- (promise.promise []))]
- (wrap (do promise.monad
- [_ (promise.future (do io.monad
- [actor (/.spawn! (: (/.Behavior Any Any)
- {#/.on_init (|>>)
- #/.on_mail (function (_ message state self)
- (do {! promise.monad}
- [outcome (message state self)]
- (case outcome
- (#try.Failure cause)
- (do !
- [_ (promise.future (write cause))]
- (wrap outcome))
-
- (#try.Success _)
- (wrap outcome))))})
- [])]
- (/.poison! actor)))
- _ (promise.wait 100)
- result (promise.future (promise.poll read))]
+ (let [[read write] (: [(Async Text) (Resolver Text)]
+ (async.async []))]
+ (wrap (do async.monad
+ [_ (async.future (do io.monad
+ [actor (/.spawn! (: (/.Behavior Any Any)
+ {#/.on_init (|>>)
+ #/.on_mail (function (_ message state self)
+ (do {! async.monad}
+ [outcome (message state self)]
+ (case outcome
+ (#try.Failure cause)
+ (do !
+ [_ (async.future (write cause))]
+ (wrap outcome))
+
+ (#try.Success _)
+ (wrap outcome))))})
+ [])]
+ (/.poison! actor)))
+ _ (async.wait 100)
+ result (async.future (async.poll read))]
(_.cover' [/.poisoned]
(case result
(#.Some error)
@@ -111,20 +111,20 @@
#.None
false)))))
- (wrap (do promise.monad
- [sent? (promise.future (do io.monad
- [actor (/.spawn! /.default 0)
- sent? (/.mail! inc! actor)]
- (wrap (..mailed? sent?))))]
+ (wrap (do async.monad
+ [sent? (async.future (do io.monad
+ [actor (/.spawn! /.default 0)
+ sent? (/.mail! inc! actor)]
+ (wrap (..mailed? sent?))))]
(_.cover' [/.Behavior /.Mail
/.default /.spawn! /.mail!]
sent?)))
- (wrap (do promise.monad
- [result (promise.future (do io.monad
- [counter (/.spawn! /.default 0)
- _ (/.poison! counter)]
- (/.mail! inc! counter)))]
+ (wrap (do async.monad
+ [result (async.future (do io.monad
+ [counter (/.spawn! /.default 0)
+ _ (/.poison! counter)]
+ (/.mail! inc! counter)))]
(_.cover' [/.dead]
(case result
(#try.Success outcome)
@@ -135,14 +135,14 @@
(let [die! (: (/.Mail Nat)
(function (_ state actor)
- (promise\wrap (exception.throw ..got_wrecked []))))]
- (wrap (do promise.monad
- [result (promise.future (do io.monad
- [actor (/.spawn! /.default initial_state)
- sent? (/.mail! die! actor)
- alive? (/.alive? actor)
- obituary (/.obituary actor)]
- (wrap (#try.Success [actor sent? alive? obituary]))))]
+ (async\wrap (exception.throw ..got_wrecked []))))]
+ (wrap (do async.monad
+ [result (async.future (do io.monad
+ [actor (/.spawn! /.default initial_state)
+ sent? (/.mail! die! actor)
+ alive? (/.alive? actor)
+ obituary (/.obituary actor)]
+ (wrap (#try.Success [actor sent? alive? obituary]))))]
(_.cover' [/.Obituary /.obituary]
(case result
(^ (#try.Success [actor sent? alive? (#.Some [error state (list single_pending_message)])]))
@@ -155,9 +155,9 @@
_
false)))))
- (wrap (do promise.monad
- [counter (promise.future (/.spawn! ..counter 0))
- result (do (try.with promise.monad)
+ (wrap (do async.monad
+ [counter (async.future (/.spawn! ..counter 0))
+ result (do (try.with async.monad)
[output_1 (/.tell! (count! 1) counter)
output_2 (/.tell! (count! 1) counter)
output_3 (/.tell! (count! 1) counter)]
@@ -172,8 +172,8 @@
(#try.Failure error)
false))))
- (wrap (do promise.monad
- [verdict (promise.future
+ (wrap (do async.monad
+ [verdict (async.future
(do io.monad
[anonymous (/.actor {Nat
initial_state}
@@ -204,13 +204,13 @@
#let [expected (list.take num_observations events)
sink (: (Atom (Row Nat))
(atom.atom row.empty))]]
- (wrap (do promise.monad
- [agent (promise.future
+ (wrap (do async.monad
+ [agent (async.future
(do {! io.monad}
[agent (/.actor {Nat 0})
_ (/.observe (function (_ event stop)
(function (_ events_seen self)
- (promise.future
+ (async.future
(if (n.< num_observations events_seen)
(do !
[_ (atom.update (row.add event) sink)]
@@ -222,7 +222,7 @@
agent)]
(wrap agent)))
_ (/.await agent)
- actual (promise.future (atom.read sink))]
+ actual (async.future (atom.read sink))]
(_.cover' [/.Stop /.observe /.await]
(\ (list.equivalence n.equivalence) = expected (row.to_list actual))))))
))))
diff --git a/stdlib/source/test/lux/control/concurrency/promise.lux b/stdlib/source/test/lux/control/concurrency/async.lux
index 3cc1a42c9..1c7d075f4 100644
--- a/stdlib/source/test/lux/control/concurrency/promise.lux
+++ b/stdlib/source/test/lux/control/concurrency/async.lux
@@ -27,11 +27,11 @@
["." atom (#+ Atom)]]]])
(def: injection
- (Injection /.Promise)
+ (Injection /.Async)
/.resolved)
(def: comparison
- (Comparison /.Promise)
+ (Comparison /.Async)
(function (_ == left right)
(io.run
(do io.monad
@@ -69,11 +69,11 @@
($monad.spec ..injection ..comparison /.monad))
(wrap (do /.monad
- [#let [[promise resolver] (: [(/.Promise Nat) (/.Resolver Nat)]
- (/.promise []))]
+ [#let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
+ (/.async []))]
resolved? (/.future (resolver expected))
- actual promise]
- (_.cover' [/.Promise /.Resolver /.promise]
+ actual async]
+ (_.cover' [/.Async /.Resolver /.async]
(and resolved?
(n.= expected actual)))))
(wrap (do /.monad
@@ -136,9 +136,9 @@
(n.+ leftA rightA)))))
(wrap (do /.monad
[?actual (/.future (/.poll (/.resolved expected)))
- #let [[promise resolver] (: [(/.Promise Nat) (/.Resolver Nat)]
- (/.promise []))]
- ?never (/.future (/.poll promise))]
+ #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
+ (/.async []))]
+ ?never (/.future (/.poll async))]
(_.cover' [/.poll]
(case [?actual ?never]
[(#.Some actual) #.None]
@@ -148,9 +148,9 @@
false))))
(wrap (do /.monad
[yep (/.future (/.resolved? (/.resolved expected)))
- #let [[promise resolver] (: [(/.Promise Nat) (/.Resolver Nat)]
- (/.promise []))]
- nope (/.future (/.resolved? promise))]
+ #let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)]
+ (/.async []))]
+ nope (/.future (/.resolved? async))]
(_.cover' [/.resolved?]
(and yep
(not nope)))))
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index 813ceb7ed..e9eabb5bc 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -23,21 +23,21 @@
[\\library
["." /
[//
- ["." promise (#+ Promise) ("#\." monad)]
+ ["." async (#+ Async) ("#\." monad)]
["." atom (#+ Atom atom)]]]])
(def: injection
(Injection /.Channel)
- (|>> promise.resolved
- /.of_promise))
+ (|>> async.resolved
+ /.of_async))
(def: comparison
(Comparison /.Channel)
(function (_ == left right)
(io.run
(do io.monad
- [?left (promise.poll left)
- ?right (promise.poll right)]
+ [?left (async.poll left)
+ ?right (async.poll right)]
(wrap (case [?left ?right]
[(#.Some (#.Some [left _]))
(#.Some (#.Some [right _]))]
@@ -47,12 +47,12 @@
false))))))
(def: (take_amount amount_of_polls [channel sink])
- (All [a] (-> Nat [(/.Channel a) (/.Sink a)] (Promise (List a))))
+ (All [a] (-> Nat [(/.Channel a) (/.Sink a)] (Async (List a))))
(case amount_of_polls
- 0 (do promise.monad
- [_ (promise.future (\ sink close))]
+ 0 (do async.monad
+ [_ (async.future (\ sink close))]
(wrap #.Nil))
- _ (do {! promise.monad}
+ _ (do {! async.monad}
[event channel]
(case event
#.None
@@ -93,7 +93,7 @@
(#try.Success channel)
(io.run
(do io.monad
- [?actual (promise.poll channel)]
+ [?actual (async.poll channel)]
(wrap (case ?actual
(#.Some (#.Some [actual _]))
(n.= sample actual)
@@ -114,22 +114,22 @@
(#try.Failure error)
(exception.match? /.channel_is_already_closed error)))
- (wrap (do promise.monad
+ (wrap (do async.monad
[output (|> sample
- promise.resolved
- /.of_promise
+ async.resolved
+ /.of_async
/.consume)]
- (_.cover' [/.of_promise /.consume]
+ (_.cover' [/.of_async /.consume]
(list\= (list sample)
output))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[output (|> inputs
(/.sequential 0)
/.consume)]
(_.cover' [/.sequential]
(list\= inputs
output))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[output (|> inputs
(/.sequential 0)
(/.only n.even?)
@@ -137,48 +137,48 @@
(_.cover' [/.only]
(list\= (list.only n.even? inputs)
output))))
- (wrap (do {! promise.monad}
- [#let [[?signal !signal] (: [(promise.Promise Any) (promise.Resolver Any)]
- (promise.promise []))
+ (wrap (do {! async.monad}
+ [#let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)]
+ (async.async []))
sink (: (Atom (Row Nat))
(atom.atom row.empty))]
- _ (promise.future (/.subscribe (function (_ value)
- (do {! io.monad}
- [current (atom.read sink)
- _ (atom.update (row.add value) sink)]
- (if (n.< (list.size inputs)
- (inc (row.size current)))
- (wrap (#.Some []))
- (do !
- [_ (!signal [])]
- (wrap #.None)))))
- (/.sequential 0 (list\compose inputs inputs))))
+ _ (async.future (/.subscribe (function (_ value)
+ (do {! io.monad}
+ [current (atom.read sink)
+ _ (atom.update (row.add value) sink)]
+ (if (n.< (list.size inputs)
+ (inc (row.size current)))
+ (wrap (#.Some []))
+ (do !
+ [_ (!signal [])]
+ (wrap #.None)))))
+ (/.sequential 0 (list\compose inputs inputs))))
_ ?signal
listened (|> sink
atom.read
- promise.future
+ async.future
(\ ! map row.to_list))]
(_.cover' [/.Subscriber /.subscribe]
(list\= inputs listened))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[actual (/.fold (function (_ input total)
- (promise.resolved (n.+ input total)))
+ (async.resolved (n.+ input total)))
0
(/.sequential 0 inputs))]
(_.cover' [/.fold]
(n.= (list\fold n.+ 0 inputs)
actual))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[actual (|> inputs
(/.sequential 0)
(/.folds (function (_ input total)
- (promise.resolved (n.+ input total)))
+ (async.resolved (n.+ input total)))
0)
/.consume)]
(_.cover' [/.folds]
(list\= (list.folds n.+ 0 inputs)
actual))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[actual (|> (list distint/0 distint/0 distint/0
distint/1
distint/2 distint/2)
@@ -192,7 +192,7 @@
[polling_delay (\ ! map (|>> (n.% 10) inc) random.nat)
amount_of_polls (\ ! map (|>> (n.% 10) inc) random.nat)]
($_ _.and
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[actual (..take_amount amount_of_polls (/.poll polling_delay (: (IO Nat) (io.io sample))))
#let [correct_values!
(list.every? (n.= sample) actual)
@@ -202,15 +202,15 @@
(_.cover' [/.poll]
(and correct_values!
enough_polls!))))
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[actual (..take_amount amount_of_polls (/.periodic polling_delay))]
(_.cover' [/.periodic]
(n.= amount_of_polls (list.size actual)))))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[#let [max_iterations 10]
actual (|> [0 sample]
(/.iterate (function (_ [iterations current])
- (promise.resolved
+ (async.resolved
(if (n.< max_iterations iterations)
(#.Some [[(inc iterations) (n.+ shift current)]
current])
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 38e152456..d1077ae53 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -11,7 +11,7 @@
["." try]
["." exception (#+ exception:)]
[concurrency
- ["." promise (#+ Promise)]
+ ["." async (#+ Async)]
["." atom (#+ Atom)]]]
[data
["." maybe]
@@ -41,8 +41,8 @@
(do {! random.monad}
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial_open_positions)]]
- (wrap (do promise.monad
- [result (promise.time_out ..delay (/.wait semaphore))]
+ (wrap (do async.monad
+ [result (async.time_out ..delay (/.wait semaphore))]
(_.cover' [/.semaphore]
(case result
(#.Some _)
@@ -53,9 +53,9 @@
(do {! random.monad}
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial_open_positions)]]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore))
- result (promise.time_out ..delay (/.wait semaphore))]
+ result (async.time_out ..delay (/.wait semaphore))]
(_.cover' [/.wait]
(case result
(#.Some _)
@@ -66,12 +66,12 @@
(do {! random.monad}
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial_open_positions)]]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore))
#let [block (/.wait semaphore)]
- result/0 (promise.time_out ..delay block)
+ result/0 (async.time_out ..delay block)
open_positions (/.signal semaphore)
- result/1 (promise.time_out ..delay block)]
+ result/1 (async.time_out ..delay block)]
(_.cover' [/.signal]
(case [result/0 result/1 open_positions]
[#.None (#.Some _) (#try.Success +0)]
@@ -82,7 +82,7 @@
(do {! random.monad}
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial_open_positions)]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[outcome (/.signal semaphore)]
(_.cover' [/.semaphore_is_maxed_out]
(case outcome
@@ -105,7 +105,7 @@
mutex (/.mutex [])
processA (<| (/.synchronize mutex)
io.io
- promise.future
+ async.future
(do {! io.monad}
[_ (<| (monad.seq !)
(list.repeat repetitions)
@@ -113,13 +113,13 @@
(wrap [])))
processB (<| (/.synchronize mutex)
io.io
- promise.future
+ async.future
(do {! io.monad}
[_ (<| (monad.seq !)
(list.repeat repetitions)
(atom.update (|>> (format "B")) resource))]
(wrap [])))]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[_ processA
_ processB
#let [outcome (io.run (atom.read resource))]]
@@ -131,10 +131,10 @@
)))
(def: (waiter resource barrier id)
- (-> (Atom Text) /.Barrier Nat (Promise Any))
- (do promise.monad
+ (-> (Atom Text) /.Barrier Nat (Async Any))
+ (do async.monad
[_ (/.block barrier)
- _ (promise.future (atom.update (|>> (format (%.nat id))) resource))]
+ _ (async.future (atom.update (|>> (format (%.nat id))) resource))]
(wrap [])))
(def: barrier
@@ -158,7 +158,7 @@
[limit (\ ! map (|>> (n.% 9) inc) random.nat)
#let [barrier (/.barrier (maybe.assume (/.limit limit)))
resource (atom.atom "")]]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[#let [suffix "_"
expected_ending (|> suffix
(list.repeat limit)
diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux
index 23248f387..053cc7dd8 100644
--- a/stdlib/source/test/lux/control/concurrency/stm.lux
+++ b/stdlib/source/test/lux/control/concurrency/stm.lux
@@ -22,7 +22,7 @@
["." /
[//
["." atom (#+ Atom atom)]
- ["." promise]
+ ["." async]
["." frp (#+ Channel)]]]])
(def: injection
@@ -41,7 +41,7 @@
(do {! random.monad}
[dummy random.nat
expected random.nat
- iterations-per-process (|> random.nat (\ ! map (n.% 100)))]
+ iterations_per_process (|> random.nat (\ ! map (n.% 100)))]
($_ _.and
(_.for [/.functor]
($functor.spec ..injection ..comparison /.functor))
@@ -50,15 +50,15 @@
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
- (wrap (do promise.monad
+ (wrap (do async.monad
[actual (/.commit (\ /.monad wrap expected))]
(_.cover' [/.commit]
(n.= expected actual))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[actual (/.commit (/.read (/.var expected)))]
(_.cover' [/.Var /.var /.read]
(n.= expected actual))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[actual (let [box (/.var dummy)]
(/.commit (do /.monad
[_ (/.write expected box)]
@@ -71,7 +71,7 @@
(_.cover' [/.write]
(and (n.= expected actual)
verdict))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[#let [box (/.var dummy)]
output (/.commit (do /.monad
[_ (/.update (n.+ expected) box)]
@@ -79,12 +79,12 @@
(_.cover' [/.update]
(n.= (n.+ expected dummy)
output))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[#let [box (/.var dummy)
[follower sink] (io.run (/.follow box))]
_ (/.commit (/.write expected box))
_ (/.commit (/.update (n.* 2) box))
- _ (promise.future (\ sink close))
+ _ (async.future (\ sink close))
_ (/.commit (/.update (n.* 3) box))
changes (frp.consume follower)]
(_.cover' [/.follow]
@@ -92,12 +92,12 @@
(list expected (n.* 2 expected))
changes))))
(wrap (let [var (/.var 0)]
- (do {! promise.monad}
- [_ (|> (list.repeat iterations-per-process [])
+ (do {! async.monad}
+ [_ (|> (list.repeat iterations_per_process [])
(list\map (function (_ _) (/.commit (/.update inc var))))
(monad.seq !))
cummulative (/.commit (/.read var))]
(_.cover' [/.STM]
- (n.= iterations-per-process
+ (n.= iterations_per_process
cummulative)))))
))))
diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux
index 557b6a80b..cb4e7d889 100644
--- a/stdlib/source/test/lux/control/concurrency/thread.lux
+++ b/stdlib/source/test/lux/control/concurrency/thread.lux
@@ -18,7 +18,7 @@
["." /
[//
["." atom (#+ Atom)]
- ["." promise]]]])
+ ["." async]]]])
(def: #export test
Test
@@ -31,15 +31,15 @@
($_ _.and
(_.cover [/.parallelism]
(n.> 0 /.parallelism))
- (wrap (do promise.monad
- [reference_time (promise.future instant.now)
+ (wrap (do async.monad
+ [reference_time (async.future instant.now)
#let [box (atom.atom [reference_time dummy])]
- _ (promise.future
+ _ (async.future
(/.schedule delay (do io.monad
[execution_time instant.now]
(atom.write [execution_time expected] box))))
- _ (promise.wait (n.* 2 delay))
- [execution_time actual] (promise.future (atom.read box))]
+ _ (async.wait (n.* 2 delay))
+ [execution_time actual] (async.future (atom.read box))]
(_.cover' [/.schedule]
(let [expected_delay!
(i.>= (.int delay)
diff --git a/stdlib/source/test/lux/control/io.lux b/stdlib/source/test/lux/control/io.lux
index e101459c2..05642a19f 100644
--- a/stdlib/source/test/lux/control/io.lux
+++ b/stdlib/source/test/lux/control/io.lux
@@ -32,7 +32,7 @@
(_.for [/.IO])
(do random.monad
[sample random.nat
- exit-code random.int]
+ exit_code random.int]
($_ _.and
(_.for [/.functor]
($functor.spec ..injection ..comparison /.functor))
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index 003024197..1fed0e4cb 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -249,7 +249,7 @@
(and (|> (/.run (/.default wrong (\ /.monad wrap expected)) (list))
(match actual (n.= expected actual)))
(|> (/.run (/.default expected (: (Parser (List Code) Nat)
- (/.fail "yolo")))
+ (/.failure "yolo")))
(list))
(match actual (n.= expected actual)))
))
@@ -362,9 +362,9 @@
(_.cover [/.run]
(|> (/.run (\ /.monad wrap expected) (list))
(match actual (n.= expected actual))))
- (_.cover [/.fail]
+ (_.cover [/.failure]
(|> (list)
- (/.run (/.fail failure))
+ (/.run (/.failure failure))
(should_fail failure)))
(_.cover [/.lift]
(and (|> (list)
diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux
index d49640f37..ebba6bc28 100644
--- a/stdlib/source/test/lux/control/parser/binary.lux
+++ b/stdlib/source/test/lux/control/parser/binary.lux
@@ -255,10 +255,10 @@
[/.code format.code random_code code.equivalence]
[/.type format.type random_type type.equivalence]
))
- (~~ (template [<parser_coverage> <parser> <format_coverage> <format> <random> <equivalence>]
+ (~~ (template [<parser_coverage> <parser> <coverage_format> <format> <random> <equivalence>]
[(do {! random.monad}
[expected <random>]
- (_.cover [<parser_coverage> <format_coverage>]
+ (_.cover [<parser_coverage> <coverage_format>]
(|> expected
(format.run <format>)
(/.run <parser>)
diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux
index 142e0cd42..f0b63bfd5 100644
--- a/stdlib/source/test/lux/control/parser/json.lux
+++ b/stdlib/source/test/lux/control/parser/json.lux
@@ -150,13 +150,13 @@
[size (\ ! map (n.% 10) random.nat)
keys (random.list size (random.unicode 1))
values (random.list size (random.unicode 1))
- #let [expected (dictionary.of_list text.hash (list.zip/2 keys values))]]
+ #let [expected (dictionary.of_list text.hash (list.zipped/2 keys values))]]
(_.cover [/.dictionary]
(|> (/.run (/.dictionary /.string)
(#json.Object
(|> values
(list\map (|>> #json.String))
- (list.zip/2 keys)
+ (list.zipped/2 keys)
(dictionary.of_list text.hash))))
(!expect (^multi (#try.Success actual)
(\ (dictionary.equivalence text.equivalence) = expected actual))))))
diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux
index bd6351ded..61e67e81f 100644
--- a/stdlib/source/test/lux/control/region.lux
+++ b/stdlib/source/test/lux/control/region.lux
@@ -114,7 +114,7 @@
(wrap (and (..success? outcome)
(n.= expected_clean_ups
actual_clean_ups))))))
- (_.cover [/.fail]
+ (_.cover [/.failure]
(thread.run
(do {! thread.monad}
[clean_up_counter (thread.box 0)
@@ -127,7 +127,7 @@
(do {! (/.monad !)}
[_ (monad.map ! (/.acquire //@ count_clean_up)
(enum.range n.enum 1 expected_clean_ups))
- _ (/.fail //@ (exception.construct ..oops []))]
+ _ (/.failure //@ (exception.construct ..oops []))]
(wrap [])))
actual_clean_ups (thread.read clean_up_counter)]
(wrap (and (..throws? ..oops outcome)
diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux
index ec2d91d20..3547b27b1 100644
--- a/stdlib/source/test/lux/control/security/capability.lux
+++ b/stdlib/source/test/lux/control/security/capability.lux
@@ -7,7 +7,7 @@
[control
["." io (#+ IO)]
[concurrency
- ["." promise]]]
+ ["." async]]]
[math
["." random]
[number
@@ -38,7 +38,7 @@
(and (is? pass_through untouched)
(n.= expected actual))))
(wrap (let [capability (..can_io (function (_ _) (io.io expected)))]
- (do promise.monad
+ (do async.monad
[actual (/.use (/.async capability) [])]
(_.cover' [/.async]
(n.= expected actual)))))
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux
index fb82ed6c9..d51067799 100644
--- a/stdlib/source/test/lux/data/collection/dictionary.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary.lux
@@ -121,8 +121,8 @@
(_.cover [/.merge_with]
(list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2))
- (list.zip/2 (/.values dict)
- (/.values (/.merge_with n.+ dict dict)))))
+ (list.zipped/2 (/.values dict)
+ (/.values (/.merge_with n.+ dict dict)))))
(_.cover [/.of_list]
(let [(^open ".") (/.equivalence n.equivalence)]
diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
index 6884c0e28..19c6bfde6 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
@@ -49,8 +49,8 @@
random.nat)
extra_value random.nat
shift random.nat
- #let [pairs (list.zip/2 (set.to_list keys)
- (set.to_list values))
+ #let [pairs (list.zipped/2 (set.to_list keys)
+ (set.to_list values))
sample (/.of_list n.order pairs)
sorted_pairs (list.sort (function (_ [left _] [right _])
(n.< left right))
@@ -97,7 +97,7 @@
sorted_pairs))
(_.cover [/.keys /.values]
(list\= (/.entries sample)
- (list.zip/2 (/.keys sample) (/.values sample))))
+ (list.zipped/2 (/.keys sample) (/.values sample))))
(_.cover [/.of_list]
(|> sample
/.entries (/.of_list n.order)
diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
index f86f4c13c..f7450e3d1 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
@@ -26,7 +26,7 @@
(do random.monad
[keys (random.set text.hash size gen_key)
values (random.list size gen_value)]
- (wrap (list.zip/2 (set.to_list keys) values))))
+ (wrap (list.zipped/2 (set.to_list keys) values))))
(def: #export test
Test
@@ -57,8 +57,8 @@
(_.cover [/.keys /.values]
(\ (/.equivalence n.equivalence) =
sample
- (list.zip/2 (/.keys sample)
- (/.values sample))))
+ (list.zipped/2 (/.keys sample)
+ (/.values sample))))
(_.cover [/.contains?]
(and (list.every? (function (_ key)
(/.contains? key sample))
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index a19738802..f3175fbb5 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -147,9 +147,9 @@
expected_numbers!
(/.every? (n.= (dec size))
- (/.zip_with/2 n.+
- indices
- (/.sort n.> indices)))]
+ (/.zipped_with/2 n.+
+ indices
+ (/.sort n.> indices)))]
(and expected_amount!
already_sorted!
expected_numbers!)))
@@ -283,8 +283,8 @@
(_.cover [/.as_pairs]
(n.= (n./ 2 (/.size sample/0))
(/.size (/.as_pairs sample/0))))
- (_.cover [/.zip/2]
- (let [zipped (/.zip/2 sample/0 sample/1)
+ (_.cover [/.zipped/2]
+ (let [zipped (/.zipped/2 sample/0 sample/1)
zipped::size (/.size zipped)
size_of_smaller_list!
@@ -298,8 +298,8 @@
(/\map product.right zipped)))]
(and size_of_smaller_list!
can_extract_values!)))
- (_.cover [/.zip/3]
- (let [zipped (/.zip/3 sample/0 sample/1 sample/2)
+ (_.cover [/.zipped/3]
+ (let [zipped (/.zipped/3 sample/0 sample/1 sample/2)
zipped::size (/.size zipped)
size_of_smaller_list!
@@ -318,29 +318,29 @@
(/\map (|>> product.right product.right) zipped)))]
(and size_of_smaller_list!
can_extract_values!)))
- (_.cover [/.zip]
+ (_.cover [/.zipped]
(and (\ (/.equivalence (product.equivalence n.equivalence n.equivalence)) =
- (/.zip/2 sample/0 sample/1)
- ((/.zip 2) sample/0 sample/1))
+ (/.zipped/2 sample/0 sample/1)
+ ((/.zipped 2) sample/0 sample/1))
(\ (/.equivalence ($_ product.equivalence n.equivalence n.equivalence n.equivalence)) =
- (/.zip/3 sample/0 sample/1 sample/2)
- ((/.zip 3) sample/0 sample/1 sample/2))))
+ (/.zipped/3 sample/0 sample/1 sample/2)
+ ((/.zipped 3) sample/0 sample/1 sample/2))))
- (_.cover [/.zip_with/2]
+ (_.cover [/.zipped_with/2]
(/\= (/\map (function (_ [left right])
(+/2 left right))
- (/.zip/2 sample/0 sample/1))
- (/.zip_with/2 +/2 sample/0 sample/1)))
- (_.cover [/.zip_with/3]
+ (/.zipped/2 sample/0 sample/1))
+ (/.zipped_with/2 +/2 sample/0 sample/1)))
+ (_.cover [/.zipped_with/3]
(/\= (/\map (function (_ [left mid right])
(+/3 left mid right))
- (/.zip/3 sample/0 sample/1 sample/2))
- (/.zip_with/3 +/3 sample/0 sample/1 sample/2)))
- (_.cover [/.zip_with]
- (and (/\= (/.zip_with/2 +/2 sample/0 sample/1)
- ((/.zip_with 2) +/2 sample/0 sample/1))
- (/\= (/.zip_with/3 +/3 sample/0 sample/1 sample/2)
- ((/.zip_with 3) +/3 sample/0 sample/1 sample/2))))
+ (/.zipped/3 sample/0 sample/1 sample/2))
+ (/.zipped_with/3 +/3 sample/0 sample/1 sample/2)))
+ (_.cover [/.zipped_with]
+ (and (/\= (/.zipped_with/2 +/2 sample/0 sample/1)
+ ((/.zipped_with 2) +/2 sample/0 sample/1))
+ (/\= (/.zipped_with/3 +/3 sample/0 sample/1 sample/2)
+ ((/.zipped_with 3) +/3 sample/0 sample/1 sample/2))))
(_.cover [/.concat]
(and (/\= (/\compose sample/0 sample/1)
(/.concat (list sample/0 sample/1)))
diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux
index aa85116f6..05752d6fa 100644
--- a/stdlib/source/test/lux/data/collection/set/multi.lux
+++ b/stdlib/source/test/lux/data/collection/set/multi.lux
@@ -33,8 +33,8 @@
(wrap (list\fold (function (_ [count element] set)
(/.add count element set))
(/.new hash)
- (list.zip/2 element_counts
- (set.to_list elements))))))
+ (list.zipped/2 element_counts
+ (set.to_list elements))))))
(def: signature
Test
diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux
index f92d75440..d14c4d27f 100644
--- a/stdlib/source/test/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/test/lux/data/collection/tree/finger.lux
@@ -88,7 +88,7 @@
(let [tree (list\fold (function (_ [tag value] tree)
(\ builder branch tree (\ builder leaf tag value)))
(\ builder leaf tags/H values/H)
- (list.zip/2 tags/T values/T))]
+ (list.zipped/2 tags/T values/T))]
(and (\ tags_equivalence = (list& tags/H tags/T) (/.tags tree))
(\ values_equivalence = (list& values/H values/T) (/.values tree))))))
(_.cover [/.one]
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index 2fe36607d..22dce27f1 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -90,8 +90,8 @@
(do random.monad
[keys (random.set text.hash 3 (random.ascii/alpha 1))
values (random.set frac.hash 3 random.safe_frac)
- #let [expected (list.zip/2 (set.to_list keys)
- (list\map (|>> #/.Number) (set.to_list values)))
+ #let [expected (list.zipped/2 (set.to_list keys)
+ (list\map (|>> #/.Number) (set.to_list values)))
object (/.object expected)]]
($_ _.and
(_.cover [/.object /.fields]
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index bbbf299d8..c55928c15 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -56,7 +56,7 @@
sample_nat random.nat
sample_rev random.rev]
(wrap (`` (and (~~ (template [<type> <format> <sample>]
- [(|> (/.represent <type> <sample>)
+ [(|> (/.representation <type> <sample>)
(try\map (text\= (<format> <sample>)))
(try.default false))]
@@ -74,8 +74,8 @@
[sample_bit random.bit
sample_int random.int
sample_frac random.frac]
- (wrap (`` (and (case (/.represent (type [Bit Int Frac])
- [sample_bit sample_int sample_frac])
+ (wrap (`` (and (case (/.representation (type [Bit Int Frac])
+ [sample_bit sample_int sample_frac])
(#try.Success actual)
(text\= (format "[" (%.bit sample_bit)
" " (%.int sample_int)
@@ -87,7 +87,7 @@
false)
## TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants
## (~~ (template [<lefts> <right?> <value> <format>]
- ## [(|> (/.represent (type (| Bit Int Frac))
+ ## [(|> (/.representation (type (| Bit Int Frac))
## (: (| Bit Int Frac)
## (<lefts> <right?> <value>)))
## (try\map (text\= (format "(" (%.nat <lefts>)
@@ -112,7 +112,7 @@
sample_xml $//xml.random
sample_json $//json.random]
(wrap (`` (and (~~ (template [<type> <format> <sample>]
- [(|> (/.represent <type> <sample>)
+ [(|> (/.representation <type> <sample>)
(try\map (text\= (<format> <sample>)))
(try.default false))]
@@ -135,7 +135,7 @@
sample_time random.time
sample_day random.day]
(wrap (`` (and (~~ (template [<type> <format> <sample>]
- [(|> (/.represent <type> <sample>)
+ [(|> (/.representation <type> <sample>)
(try\map (text\= (<format> <sample>)))
(try.default false))]
@@ -160,20 +160,20 @@
can_represent_complex_types! ..can_represent_complex_types
can_represent_time_types! ..can_represent_time_types]
($_ _.and
- (_.cover [/.represent]
+ (_.cover [/.representation]
(`` (and can_represent_simple_types!
can_represent_structure_types!
can_represent_complex_types!
can_represent_time_types!
- (|> (/.represent .Any sample_frac)
+ (|> (/.representation .Any sample_frac)
(try\map (text\= "[]"))
(try.default false))
- (|> (/.represent (type (List Nat)) (: (List Nat) (list sample_nat)))
+ (|> (/.representation (type (List Nat)) (: (List Nat) (list sample_nat)))
(try\map (text\= (%.list %.nat (list sample_nat))))
(try.default false))
(~~ (template [<sample>]
- [(|> (/.represent (type (Maybe Nat)) (: (Maybe Nat) <sample>))
+ [(|> (/.representation (type (Maybe Nat)) (: (Maybe Nat) <sample>))
(try\map (text\= (%.maybe %.nat <sample>)))
(try.default false))]
@@ -182,7 +182,7 @@
))
)))
(_.cover [/.cannot_represent_value]
- (case (/.represent (-> Nat Nat) (|>>))
+ (case (/.representation (-> Nat Nat) (|>>))
(#try.Success representation)
false
@@ -197,9 +197,9 @@
sample_int random.int
sample_frac random.frac
sample_text (random.ascii/upper 10)]
- (_.cover [/.inspect]
+ (_.cover [/.inspection]
(`` (and (~~ (template [<format> <sample>]
- [(text\= (<format> <sample>) (/.inspect <sample>))]
+ [(text\= (<format> <sample>) (/.inspection <sample>))]
[%.bit sample_bit]
[%.int sample_int]
@@ -208,10 +208,10 @@
))
(text\= (|> (list sample_bit sample_int sample_frac sample_text)
(: (List Any))
- (list\map /.inspect)
+ (list\map /.inspection)
(text.join_with " ")
(text.enclose ["[" "]"]))
- (/.inspect [sample_bit sample_int sample_frac sample_text]))
+ (/.inspection [sample_bit sample_int sample_frac sample_text]))
)))))
(syntax: (macro_error macro)
@@ -256,7 +256,7 @@
(_.cover [/.private]
(exec
(: (/.private /.Inspector)
- /.inspect)
+ /.inspection)
true))
(_.cover [/.log!]
(exec
diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux
index 2ce231e61..1a99aae83 100644
--- a/stdlib/source/test/lux/macro/code.lux
+++ b/stdlib/source/test/lux/macro/code.lux
@@ -108,9 +108,9 @@
(do {! random.monad}
[parts (..random_sequence replace_simulation)]
(wrap [(/.record (let [parts' (list\map product.left parts)]
- (list.zip/2 parts' parts')))
+ (list.zipped/2 parts' parts')))
(/.record (let [parts' (list\map product.right parts)]
- (list.zip/2 parts' parts')))]))
+ (list.zipped/2 parts' parts')))]))
)))))
(def: for_format
diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux
index cbe6f0e3a..65e8e62f5 100644
--- a/stdlib/source/test/lux/macro/local.lux
+++ b/stdlib/source/test/lux/macro/local.lux
@@ -49,7 +49,7 @@
(macro.with_gensyms [g!output]
(do meta.monad
[pop! (/.push (list [name (..constant constant)]))
- [module short] (meta.normalize name)
+ [module short] (meta.normal name)
_ (if pre_remove
(let [remove_macro! (: (-> .Module .Module)
(update@ #.definitions (plist.remove short)))]
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 67529dcca..4010b9ce1 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -114,8 +114,8 @@
#.extensions []
#.host []}]]
($_ _.and
- (_.cover [/.fail]
- (|> (/.fail expected_error)
+ (_.cover [/.failure]
+ (|> (/.failure expected_error)
(: (Meta Any))
(/.run expected_lux)
(!expect (^multi (#try.Failure actual_error)
@@ -133,20 +133,20 @@
(_.cover [/.either]
(and (|> (/.either (\ /.monad wrap expected)
(: (Meta Nat)
- (/.fail expected_error)))
+ (/.failure expected_error)))
(/.run expected_lux)
(!expect (^multi (#try.Success actual)
(n.= expected actual))))
(|> (/.either (: (Meta Nat)
- (/.fail expected_error))
+ (/.failure expected_error))
(\ /.monad wrap expected))
(/.run expected_lux)
(!expect (^multi (#try.Success actual)
(n.= expected actual))))
(|> (/.either (: (Meta Nat)
- (/.fail expected_error))
+ (/.failure expected_error))
(: (Meta Nat)
- (/.fail expected_error)))
+ (/.failure expected_error)))
(/.run expected_lux)
(!expect (^multi (#try.Failure actual_error)
(text\= (location.with location.dummy expected_error)
@@ -261,13 +261,13 @@
(|> (/.imported? imported_module_name)
(/.run expected_lux)
(try.default false)))
- (_.cover [/.normalize]
- (and (|> (/.normalize ["" expected_short])
+ (_.cover [/.normal]
+ (and (|> (/.normal ["" expected_short])
(/.run expected_lux)
(!expect (^multi (#try.Success [actual_module actual_short])
(and (text\= expected_current_module actual_module)
(is? expected_short actual_short)))))
- (|> (/.normalize [dummy_module expected_short])
+ (|> (/.normal [dummy_module expected_short])
(/.run expected_lux)
(!expect (^multi (#try.Success [actual_module actual_short])
(and (text\= dummy_module actual_module)
diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux
index 45dc68c97..95004b2c4 100644
--- a/stdlib/source/test/lux/test.lux
+++ b/stdlib/source/test/lux/test.lux
@@ -7,7 +7,7 @@
["." io]
["." exception]
[concurrency
- ["." promise]
+ ["." async]
["." atom (#+ Atom)]]]
[data
["." text ("#\." equivalence)]
@@ -35,7 +35,7 @@
expected_message/1 (random.only (|>> (text\= expected_message/0) not)
(random.ascii/lower 5))]
($_ /.and
- (wrap (do promise.monad
+ (wrap (do async.monad
[[success_tally success_message] (/.assert expected_message/0 true)
[failure_tally failure_message] (/.assert expected_message/0 false)]
(/.cover' [/.assert /.Tally]
@@ -45,7 +45,7 @@
(n.= 0 (get@ #/.failures success_tally)))
(and (n.= 0 (get@ #/.successes failure_tally))
(n.= 1 (get@ #/.failures failure_tally)))))))
- (wrap (do promise.monad
+ (wrap (do async.monad
[tt (/.and' (/.assert expected_message/0 true)
(/.assert expected_message/1 true))
ff (/.and' (/.assert expected_message/0 false)
@@ -65,8 +65,8 @@
/.Test
(do {! random.monad}
[seed random.nat
- #let [[read write] (: [(promise.Promise Nat) (promise.Resolver Nat)]
- (promise.promise []))]
+ #let [[read write] (: [(async.Async Nat) (async.Resolver Nat)]
+ (async.async []))]
pre (<| (/.seed seed)
(do !
[sample random.nat
@@ -75,10 +75,10 @@
post (<| (/.seed seed)
(do !
[actual random.nat]
- (wrap (do promise.monad
+ (wrap (do async.monad
[expected read]
(/.assert "" (n.= expected actual))))))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[pre_tally pre_message] pre
[post_tally post_message] post]
(/.cover' [/.seed]
@@ -92,7 +92,7 @@
($_ /.and
(do {! random.monad}
[times_assertion (/.times 0 (/.test "" true))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[tally error] times_assertion]
(/.cover' [/.must_try_test_at_least_once]
(and (text.contains? (get@ #exception.label /.must_try_test_at_least_once) error)
@@ -107,9 +107,9 @@
[_ (wrap [])
#let [_ (io.run (atom.update inc counter))]]
(/.test "" true)))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[tally error] times_assertion
- actual (promise.future (atom.read counter))]
+ actual (async.future (atom.read counter))]
(/.cover' [/.times]
(and (n.= expected actual)
(n.= 1 (get@ #/.successes tally))
@@ -130,9 +130,9 @@
[_ (wrap [])
#let [_ (io.run (atom.update inc counter))]]
(/.test "" true)))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[tally error] assertion
- actual (promise.future (atom.read counter))]
+ actual (async.future (atom.read counter))]
(/.cover' [/.in_parallel]
(and (n.= expected actual)
(n.= expected (get@ #/.successes tally))
@@ -149,9 +149,9 @@
#let [_ (undefined)
_ (io.run (atom.update inc counter))]]
(/.test "" true)))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[tally error] assertion
- actual (promise.future (atom.read counter))]
+ actual (async.future (atom.read counter))]
(/.cover' [/.error_during_execution]
(let [correct_error! (text.contains? (get@ #exception.label /.error_during_execution) error)
no_complete_run! (n.= 0 actual)
@@ -172,7 +172,7 @@
(do random.monad
[not_covering (/.test "" true)
covering (/.covering .._ (/.test "" true))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.covering]
@@ -183,7 +183,7 @@
(do random.monad
[not_covering (/.covering .._ (/.test "" true))
covering (/.covering .._ (/.cover [..dummy_target] true))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.cover]
@@ -194,7 +194,7 @@
(do random.monad
[not_covering (/.covering .._ (/.test "" true))
covering (/.covering .._ (wrap (/.cover' [..dummy_target] true)))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.cover']
@@ -205,7 +205,7 @@
(do random.monad
[not_covering (/.covering .._ (/.test "" true))
covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[not_covering _] not_covering
[covering _] covering]
(/.cover' [/.for]
@@ -233,7 +233,7 @@
(do !
[success_assertion (/.test expected_message/0 true)
failure_assertion (/.test expected_message/0 false)]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[success_tally success_message] success_assertion
[failure_tally failure_message] failure_assertion]
(/.cover' [/.test]
@@ -252,7 +252,7 @@
(/.test expected_message/1 false))
ft (/.and (/.test expected_message/0 false)
(/.test expected_message/1 true))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[tt tt
ff ff
tf tf
@@ -265,7 +265,7 @@
(do !
[success_assertion (/.context expected_context (/.test expected_message/0 true))
failure_assertion (/.context expected_context (/.test expected_message/0 false))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[success_tally success_message] success_assertion
[failure_tally failure_message] failure_assertion]
(/.cover' [/.context]
@@ -278,17 +278,17 @@
(and (n.= 0 (get@ #/.successes failure_tally))
(n.= 1 (get@ #/.failures failure_tally))))))))
(do !
- [failure_assertion (/.fail expected_message/0)]
- (wrap (do promise.monad
+ [failure_assertion (/.failure expected_message/0)]
+ (wrap (do async.monad
[[failure_tally failure_message] failure_assertion]
- (/.cover' [/.fail]
+ (/.cover' [/.failure]
(and (text.contains? expected_message/0 failure_message)
(and (n.= 0 (get@ #/.successes failure_tally))
(n.= 1 (get@ #/.failures failure_tally))))))))
(do !
[success_assertion (/.lift expected_message/0 (wrap true))
failure_assertion (/.lift expected_message/0 (wrap false))]
- (wrap (do promise.monad
+ (wrap (do async.monad
[[success_tally success_message] success_assertion
[failure_tally failure_message] failure_assertion]
(/.cover' [/.lift]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
index 62330114a..31507f067 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -37,7 +37,7 @@
[meta
["." archive]]]]]]]])
-(def: (exhaustive-weaving branchings)
+(def: (exhaustive_weaving branchings)
(-> (List (List Code)) (List (List Code)))
(case branchings
#.Nil
@@ -48,11 +48,11 @@
(#.Cons head+ tail++)
(do list.monad
- [tail+ (exhaustive-weaving tail++)
+ [tail+ (exhaustive_weaving tail++)
head head+]
(wrap (#.Cons head tail+)))))
-(def: #export (exhaustive-branches allow-literals? variantTC inputC)
+(def: #export (exhaustive_branches allow_literals? variantTC inputC)
(-> Bit (List [Code Code]) Code (Random (List Code)))
(case inputC
[_ (#.Bit _)]
@@ -60,13 +60,13 @@
(^template [<tag> <gen> <wrapper>]
[[_ (<tag> _)]
- (if allow-literals?
+ (if allow_literals?
(do {! r.monad}
[?sample (r.maybe <gen>)]
(case ?sample
(#.Some sample)
(do !
- [else (exhaustive-branches allow-literals? variantTC inputC)]
+ [else (exhaustive_branches allow_literals? variantTC inputC)]
(wrap (list& (<wrapper> sample) else)))
#.None
@@ -83,9 +83,9 @@
[_ (#.Tuple members)]
(do {! r.monad}
- [member-wise-patterns (monad.map ! (exhaustive-branches allow-literals? variantTC) members)]
- (wrap (|> member-wise-patterns
- exhaustive-weaving
+ [member_wise_patterns (monad.map ! (exhaustive_branches allow_literals? variantTC) members)]
+ (wrap (|> member_wise_patterns
+ exhaustive_weaving
(list\map code.tuple))))
(^ [_ (#.Record (list))])
@@ -95,19 +95,19 @@
(do {! r.monad}
[#let [ks (list\map product.left kvs)
vs (list\map product.right kvs)]
- member-wise-patterns (monad.map ! (exhaustive-branches allow-literals? variantTC) vs)]
- (wrap (|> member-wise-patterns
- exhaustive-weaving
- (list\map (|>> (list.zip/2 ks) code.record)))))
+ member_wise_patterns (monad.map ! (exhaustive_branches allow_literals? variantTC) vs)]
+ (wrap (|> member_wise_patterns
+ exhaustive_weaving
+ (list\map (|>> (list.zipped/2 ks) code.record)))))
(^ [_ (#.Form (list [_ (#.Tag _)] _))])
(do {! r.monad}
[bundles (monad.map !
(function (_ [_tag _code])
(do !
- [v-branches (exhaustive-branches allow-literals? variantTC _code)]
+ [v_branches (exhaustive_branches allow_literals? variantTC _code)]
(wrap (list\map (function (_ pattern) (` ((~ _tag) (~ pattern))))
- v-branches))))
+ v_branches))))
variantTC)]
(wrap (list\join bundles)))
@@ -115,22 +115,22 @@
(r\wrap (list))
))
-(def: #export (input variant-tags record-tags primitivesC)
+(def: #export (input variant_tags record_tags primitivesC)
(-> (List Code) (List Code) (List Code) (Random Code))
(r.rec
(function (_ input)
($_ r.either
(r\map product.right _primitive.primitive)
(do {! r.monad}
- [choice (|> r.nat (\ ! map (n.% (list.size variant-tags))))
- #let [choiceT (maybe.assume (list.nth choice variant-tags))
+ [choice (|> r.nat (\ ! map (n.% (list.size variant_tags))))
+ #let [choiceT (maybe.assume (list.nth choice variant_tags))
choiceC (maybe.assume (list.nth choice primitivesC))]]
(wrap (` ((~ choiceT) (~ choiceC)))))
(do {! r.monad}
[size (|> r.nat (\ ! map (n.% 3)))
elems (r.list size input)]
(wrap (code.tuple elems)))
- (r\wrap (code.record (list.zip/2 record-tags primitivesC)))
+ (r\wrap (code.record (list.zipped/2 record_tags primitivesC)))
))))
(def: (branch body pattern)
@@ -138,71 +138,71 @@
[pattern body])
(def: #export test
- (<| (_.context (name.module (name-of /._)))
+ (<| (_.context (name.module (name_of /._)))
(do {! r.monad}
- [module-name (r.unicode 5)
- variant-name (r.unicode 5)
- record-name (|> (r.unicode 5) (r.only (|>> (text\= variant-name) not)))
+ [module_name (r.unicode 5)
+ variant_name (r.unicode 5)
+ record_name (|> (r.unicode 5) (r.only (|>> (text\= variant_name) not)))
size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2))))
- variant-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list))
- record-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list))
+ variant_tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list))
+ record_tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list))
primitivesTC (r.list size _primitive.primitive)
#let [primitivesT (list\map product.left primitivesTC)
primitivesC (list\map product.right primitivesTC)
- code-tag (|>> [module-name] code.tag)
- variant-tags+ (list\map code-tag variant-tags)
- record-tags+ (list\map code-tag record-tags)
- variantTC (list.zip/2 variant-tags+ primitivesC)]
- inputC (input variant-tags+ record-tags+ primitivesC)
+ code_tag (|>> [module_name] code.tag)
+ variant_tags+ (list\map code_tag variant_tags)
+ record_tags+ (list\map code_tag record_tags)
+ variantTC (list.zipped/2 variant_tags+ primitivesC)]
+ inputC (input variant_tags+ record_tags+ primitivesC)
[outputT outputC] (r.only (|>> product.left (is? Any) not)
_primitive.primitive)
- #let [analyse-pm (function (_ branches)
+ #let [analyse_pm (function (_ branches)
(|> (/.case _primitive.phase branches archive.empty inputC)
- (//type.with-type outputT)
- ////analysis.with-scope
+ (//type.with_type outputT)
+ ////analysis.with_scope
(do phase.monad
- [_ (//module.declare-tags variant-tags false
- (#.Named [module-name variant-name]
+ [_ (//module.declare_tags variant_tags false
+ (#.Named [module_name variant_name]
(type.variant primitivesT)))
- _ (//module.declare-tags record-tags false
- (#.Named [module-name record-name]
+ _ (//module.declare_tags record_tags false
+ (#.Named [module_name record_name]
(type.tuple primitivesT)))])
- (//module.with-module 0 module-name)))]
- exhaustive-patterns (exhaustive-branches true variantTC inputC)
- #let [exhaustive-branchesC (list\map (branch outputC)
- exhaustive-patterns)]]
+ (//module.with_module 0 module_name)))]
+ exhaustive_patterns (exhaustive_branches true variantTC inputC)
+ #let [exhaustive_branchesC (list\map (branch outputC)
+ exhaustive_patterns)]]
($_ _.and
(_.test "Will reject empty pattern-matching (no branches)."
- (|> (analyse-pm (list))
- _structure.check-fails))
+ (|> (analyse_pm (list))
+ _structure.check_fails))
(_.test "Can analyse exhaustive pattern-matching."
- (|> (analyse-pm exhaustive-branchesC)
- _structure.check-succeeds))
- (let [non-exhaustive-branchesC (list.take (dec (list.size exhaustive-branchesC))
- exhaustive-branchesC)]
+ (|> (analyse_pm exhaustive_branchesC)
+ _structure.check_succeeds))
+ (let [non_exhaustive_branchesC (list.take (dec (list.size exhaustive_branchesC))
+ exhaustive_branchesC)]
(_.test "Will reject non-exhaustive pattern-matching."
- (|> (analyse-pm non-exhaustive-branchesC)
- _structure.check-fails)))
+ (|> (analyse_pm non_exhaustive_branchesC)
+ _structure.check_fails)))
(do !
- [redundant-patterns (exhaustive-branches false variantTC inputC)
- redundancy-idx (|> r.nat (\ ! map (n.% (list.size redundant-patterns))))
- #let [redundant-branchesC (<| (list!map (branch outputC))
+ [redundant_patterns (exhaustive_branches false variantTC inputC)
+ redundancy_idx (|> r.nat (\ ! map (n.% (list.size redundant_patterns))))
+ #let [redundant_branchesC (<| (list!map (branch outputC))
list.concat
- (list (list.take redundancy-idx redundant-patterns)
- (list (maybe.assume (list.nth redundancy-idx redundant-patterns)))
- (list.drop redundancy-idx redundant-patterns)))]]
+ (list (list.take redundancy_idx redundant_patterns)
+ (list (maybe.assume (list.nth redundancy_idx redundant_patterns)))
+ (list.drop redundancy_idx redundant_patterns)))]]
(_.test "Will reject redundant pattern-matching."
- (|> (analyse-pm redundant-branchesC)
- _structure.check-fails)))
+ (|> (analyse_pm redundant_branchesC)
+ _structure.check_fails)))
(do !
[[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.checks? outputT) not)
_primitive.primitive)
- heterogeneous-idx (|> r.nat (\ ! map (n.% (list.size exhaustive-patterns))))
- #let [heterogeneous-branchesC (list.concat (list (list.take heterogeneous-idx exhaustive-branchesC)
- (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous-idx exhaustive-branchesC))]
+ heterogeneous_idx (|> r.nat (\ ! map (n.% (list.size exhaustive_patterns))))
+ #let [heterogeneous_branchesC (list.concat (list (list.take heterogeneous_idx exhaustive_branchesC)
+ (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous_idx exhaustive_branchesC))]
[_pattern heterogeneousC]))
- (list.drop (inc heterogeneous-idx) exhaustive-branchesC)))]]
+ (list.drop (inc heterogeneous_idx) exhaustive_branchesC)))]]
(_.test "Will reject pattern-matching if the bodies of the branches do not all have the same type."
- (|> (analyse-pm heterogeneous-branchesC)
- _structure.check-fails)))
+ (|> (analyse_pm heterogeneous_branchesC)
+ _structure.check_fails)))
))))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux
index 3782e861f..c4f35feea 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux
@@ -140,9 +140,9 @@
(|> (do phase.monad
[[_ varT] (//type.with_env check.var)
_ (//type.with_env
- (check.check varT variantT))]
+ (check.check varT variantT))]
(//type.with_type varT
- (/.sum _primitive.phase choice archive.empty valueC)))
+ (/.sum _primitive.phase choice archive.empty valueC)))
(phase.run _primitive.state)
(case> (^ (#try.Success (////analysis.variant variant)))
(check_sum' choice size variant)
@@ -153,18 +153,18 @@
(|> (do phase.monad
[[_ varT] (//type.with_env check.var)]
(//type.with_type varT
- (/.sum _primitive.phase choice archive.empty valueC)))
+ (/.sum _primitive.phase choice archive.empty valueC)))
check_fails))
(_.test "Can analyse through existential quantification."
(|> (//type.with_type (type.ex_q 1 +variantT)
- (/.sum _primitive.phase +choice archive.empty +valueC))
+ (/.sum _primitive.phase +choice archive.empty +valueC))
check_succeeds))
(_.test "Can analyse through universal quantification."
(let [check_outcome (if (not (n.= choice +choice))
check_succeeds
check_fails)]
(|> (//type.with_type (type.univ_q 1 +variantT)
- (/.sum _primitive.phase +choice archive.empty +valueC))
+ (/.sum _primitive.phase +choice archive.empty +valueC))
check_outcome)))
))))
@@ -184,7 +184,7 @@
($_ _.and
(_.test "Can analyse."
(|> (//type.with_type tupleT
- (/.product archive.empty _primitive.phase (list\map product.right primitives)))
+ (/.product archive.empty _primitive.phase (list\map product.right primitives)))
(phase.run _primitive.state)
(case> (#try.Success tupleA)
(correct_size? size tupleA)
@@ -193,7 +193,7 @@
false)))
(_.test "Can infer."
(|> (//type.with_inference
- (/.product archive.empty _primitive.phase (list\map product.right primitives)))
+ (/.product archive.empty _primitive.phase (list\map product.right primitives)))
(phase.run _primitive.state)
(case> (#try.Success [_type tupleA])
(and (check.checks? tupleT _type)
@@ -203,15 +203,15 @@
false)))
(_.test "Can analyse singleton."
(|> (//type.with_type singletonT
- (_primitive.phase archive.empty (` [(~ singletonC)])))
+ (_primitive.phase archive.empty (` [(~ singletonC)])))
check_succeeds))
(_.test "Can analyse through bound type-vars."
(|> (do phase.monad
[[_ varT] (//type.with_env check.var)
_ (//type.with_env
- (check.check varT (type.tuple (list\map product.left primitives))))]
+ (check.check varT (type.tuple (list\map product.left primitives))))]
(//type.with_type varT
- (/.product archive.empty _primitive.phase (list\map product.right primitives))))
+ (/.product archive.empty _primitive.phase (list\map product.right primitives))))
(phase.run _primitive.state)
(case> (#try.Success tupleA)
(correct_size? size tupleA)
@@ -220,11 +220,11 @@
false)))
(_.test "Can analyse through existential quantification."
(|> (//type.with_type (type.ex_q 1 +tupleT)
- (/.product archive.empty _primitive.phase (list\map product.right +primitives)))
+ (/.product archive.empty _primitive.phase (list\map product.right +primitives)))
check_succeeds))
(_.test "Cannot analyse through universal quantification."
(|> (//type.with_type (type.univ_q 1 +tupleT)
- (/.product archive.empty _primitive.phase (list\map product.right +primitives)))
+ (/.product archive.empty _primitive.phase (list\map product.right +primitives)))
check_fails))
))))
@@ -263,7 +263,7 @@
other_choice)))
(_.test "Can specialize."
(|> (//type.with_type monoT
- (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC))
+ (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC))
(check_variant module_name tags
monoT (with_name polyT)
other_choice)))
@@ -287,7 +287,7 @@
primitivesT (list\map product.left primitives)
primitivesC (list\map product.right primitives)
monoT (#.Named [module_name type_name] (type.tuple primitivesT))
- recordC (list.zip/2 tagsC primitivesC)
+ recordC (list.zipped/2 tagsC primitivesC)
polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT)
(list varT)
(list.drop (inc choice) primitivesT))))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index 0a7a9d9c5..ae8292476 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -300,14 +300,14 @@
(wrap [(list\fold (function (_ left right)
(#synthesis.Alt left right))
(path (inc mid-size) true value/last body/last)
- (|> (list.zip/2 value/mid body/mid)
+ (|> (list.zipped/2 value/mid body/mid)
(#.Cons [value/first body/first])
list.enumeration
(list\map (function (_ [lefts' [value body]])
(path lefts' false value body)))
list.reverse))
[(branch 0 false value/first body/first)
- (list\compose (|> (list.zip/2 value/mid body/mid)
+ (list\compose (|> (list.zipped/2 value/mid body/mid)
list.enumeration
(list\map (function (_ [lefts' [value body]])
(branch (inc lefts') false value body))))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index 841f941db..d07a63f00 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -448,7 +448,7 @@
(!expect (^multi (^ (#try.Success (synthesis.function/apply [funcS argsS])))
(and (//primitive.corresponds? funcA funcS)
(list.every? (product.uncurry //primitive.corresponds?)
- (list.zip/2 argsA argsS))))))
+ (list.zipped/2 argsA argsS))))))
(|> (analysis.apply [funcA (list)])
(//.phase archive.empty)
(phase.run [///bundle.empty synthesis.init])
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
index 7a652d26c..7908da928 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
@@ -65,7 +65,7 @@
(list.size actual))
(list.every? (function (_ [expected actual])
(corresponds? expected actual))
- (list.zip/2 expected actual)))
+ (list.zipped/2 expected actual)))
_
false)))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
index a3a476959..af665dd7a 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
@@ -67,7 +67,7 @@
(case> (^ (#try.Success (////synthesis.tuple membersS)))
(and (n.= size (list.size membersS))
(list.every? (product.uncurry //primitive.corresponds?)
- (list.zip/2 membersA membersS)))
+ (list.zipped/2 membersA membersS)))
_
false)))))
diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux
index 1807046e5..8ced5e3eb 100644
--- a/stdlib/source/test/lux/type/check.lux
+++ b/stdlib/source/test/lux/type/check.lux
@@ -121,10 +121,10 @@
($_ _.and
(do random.monad
[expected (random.ascii/upper 10)]
- (_.cover [/.fail]
+ (_.cover [/.failure]
(case (/.run /.fresh_context
(: (/.Check Any)
- (/.fail expected)))
+ (/.failure expected)))
(#try.Success _) false
(#try.Failure actual) (is? expected actual))))
(do random.monad
diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux
index 859e8ca3f..9e5da1d8a 100644
--- a/stdlib/source/test/lux/type/resource.lux
+++ b/stdlib/source/test/lux/type/resource.lux
@@ -11,7 +11,7 @@
["." try]
["." exception (#+ Exception)]
[concurrency
- ["." promise]]
+ ["." async]]
[parser
["<.>" code]]]
[data
@@ -114,7 +114,7 @@
(_.for [/.Linear /.async /.run_async]
(`` ($_ _.and
(~~ (template [<coverage> <bindings>]
- [(wrap (monad.do promise.monad
+ [(wrap (monad.do async.monad
[outcome (/.run_async
(do /.async
<bindings>
@@ -143,8 +143,8 @@
right (/.read_async res|right)
left (/.read_async res|left)]]
[[/.lift_async]
- [left (/.lift_async (promise.resolved pre))
- right (/.lift_async (promise.resolved post))]]
+ [left (/.lift_async (async.resolved pre))
+ right (/.lift_async (async.resolved post))]]
))
)))))
diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux
index ebb9a374d..cb24e89b7 100644
--- a/stdlib/source/test/lux/world/file/watch.lux
+++ b/stdlib/source/test/lux/world/file/watch.lux
@@ -9,7 +9,7 @@
["." try (#+ Try)]
["." exception]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." async (#+ Async)]]]
[data
["." binary (#+ Binary) ("#\." equivalence)]
["." text ("#\." equivalence)
@@ -71,7 +71,7 @@
[directory (random.ascii/alpha 5)
#let [[fs watcher] (/.mock "/")]]
($_ _.and
- (wrap (do promise.monad
+ (wrap (do async.monad
[?concern (\ watcher concern directory)
?stop (\ watcher stop directory)]
(_.cover' [/.not_being_watched]
@@ -90,18 +90,18 @@
)))
(def: (no_events_prior_to_creation! fs watcher directory)
- (-> (//.System Promise) (/.Watcher Promise) //.Path (Promise (Try Bit)))
- (do {! (try.with promise.monad)}
+ (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit)))
+ (do {! (try.with async.monad)}
[_ (\ fs make_directory directory)
_ (\ watcher start /.all directory)]
(|> (\ watcher poll [])
(\ ! map list.empty?))))
(def: (after_creation! fs watcher expected_path)
- (-> (//.System Promise) (/.Watcher Promise) //.Path (Promise (Try Bit)))
- (do (try.with promise.monad)
- [_ (: (Promise (Try Any))
- (//.make_file promise.monad fs (binary.create 0) expected_path))
+ (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit)))
+ (do (try.with async.monad)
+ [_ (: (Async (Try Any))
+ (//.make_file async.monad fs (binary.create 0) expected_path))
poll/pre (\ watcher poll [])
poll/post (\ watcher poll [])]
(wrap (and (case poll/pre
@@ -116,9 +116,9 @@
(list.empty? poll/post)))))
(def: (after_modification! fs watcher data expected_path)
- (-> (//.System Promise) (/.Watcher Promise) Binary //.Path (Promise (Try Bit)))
- (do (try.with promise.monad)
- [_ (promise.delay 1 (#try.Success "Delay to make sure the over_write time-stamp always changes."))
+ (-> (//.System Async) (/.Watcher Async) Binary //.Path (Async (Try Bit)))
+ (do (try.with async.monad)
+ [_ (async.delay 1 (#try.Success "Delay to make sure the over_write time-stamp always changes."))
_ (\ fs write data expected_path)
poll/2 (\ watcher poll [])
poll/2' (\ watcher poll [])]
@@ -134,8 +134,8 @@
(list.empty? poll/2')))))
(def: (after_deletion! fs watcher expected_path)
- (-> (//.System Promise) (/.Watcher Promise) //.Path (Promise (Try Bit)))
- (do (try.with promise.monad)
+ (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit)))
+ (do (try.with async.monad)
[_ (\ fs delete expected_path)
poll/3 (\ watcher poll [])
poll/3' (\ watcher poll [])]
@@ -164,7 +164,7 @@
expected_path (\ ! map (|>> (format directory /))
(random.ascii/alpha 5))
data ($binary.random 10)]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[verdict (do (try.with !)
[no_events_prior_to_creation!
(..no_events_prior_to_creation! fs watcher directory)
@@ -187,7 +187,7 @@
[directory (random.ascii/alpha 5)
#let [/ "/"
[fs watcher] (/.mock /)]]
- (wrap (do promise.monad
+ (wrap (do async.monad
[started? ( \ watcher start /.all directory)]
(_.cover' [/.cannot_poll_a_non_existent_directory]
(case started?
diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux
index d86683c5f..1cd1473e8 100644
--- a/stdlib/source/test/lux/world/shell.lux
+++ b/stdlib/source/test/lux/world/shell.lux
@@ -9,7 +9,7 @@
["." exception (#+ exception:)]
["." io (#+ IO)]
[concurrency
- ["." promise (#+ Promise)]]
+ ["." async (#+ Async)]]
[parser
["." environment (#+ Environment)]]]
[data
@@ -96,7 +96,7 @@
destruction (random.ascii/alpha 5)
exit random.int
#let [shell (/.async (..io_shell command oops input destruction exit))]]
- (wrap (do {! promise.monad}
+ (wrap (do {! async.monad}
[verdict (do (try.with !)
[process (\ shell execute [environment.empty "~" command (list)])
read (\ process read [])