aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--documentation/book/the_lux_programming_language/chapter_12.md2
-rw-r--r--documentation/book/the_lux_programming_language/chapter_13.md199
-rw-r--r--documentation/bookmark/database/storage.md4
-rw-r--r--documentation/bookmark/debugging.md11
-rw-r--r--documentation/bookmark/format/base64.md4
-rw-r--r--documentation/bookmark/tool/debugger.md12
-rw-r--r--licentia/source/program/licentia.lux10
-rw-r--r--lux-cl/source/program.lux6
-rw-r--r--lux-js/source/program.lux4
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux2
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux16
-rw-r--r--lux-jvm/source/program.lux2
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/jvm.lux2
-rw-r--r--lux-lua/source/program.lux4
-rw-r--r--lux-mode/lux-mode.el2
-rw-r--r--lux-php/source/program.lux8
-rw-r--r--lux-python/source/program.lux6
-rw-r--r--lux-r/source/program.lux6
-rw-r--r--lux-ruby/source/program.lux8
-rw-r--r--lux-scheme/source/program.lux4
-rw-r--r--stdlib/source/library/lux.lux328
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux14
-rw-r--r--stdlib/source/library/lux/control/concurrency/atom.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/frp.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/stm.lux19
-rw-r--r--stdlib/source/library/lux/control/function.lux8
-rw-r--r--stdlib/source/library/lux/control/function/memo.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/environment.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux6
-rw-r--r--stdlib/source/library/lux/control/parser/xml.lux2
-rw-r--r--stdlib/source/library/lux/control/pipe.lux26
-rw-r--r--stdlib/source/library/lux/control/security/capability.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux44
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux16
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux40
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux66
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux23
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css.lux2
-rw-r--r--stdlib/source/library/lux/data/format/css/selector.lux4
-rw-r--r--stdlib/source/library/lux/data/format/html.lux6
-rw-r--r--stdlib/source/library/lux/data/format/json.lux20
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux2
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux2
-rw-r--r--stdlib/source/library/lux/data/name.lux2
-rw-r--r--stdlib/source/library/lux/data/text.lux12
-rw-r--r--stdlib/source/library/lux/data/text/encoding/utf8.lux4
-rw-r--r--stdlib/source/library/lux/debug.lux6
-rw-r--r--stdlib/source/library/lux/ffi.js.lux10
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux14
-rw-r--r--stdlib/source/library/lux/ffi.lua.lux8
-rw-r--r--stdlib/source/library/lux/ffi.old.lux16
-rw-r--r--stdlib/source/library/lux/ffi.php.lux6
-rw-r--r--stdlib/source/library/lux/ffi.py.lux10
-rw-r--r--stdlib/source/library/lux/ffi.rb.lux6
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux2
-rw-r--r--stdlib/source/library/lux/locale/language.lux2
-rw-r--r--stdlib/source/library/lux/locale/territory.lux2
-rw-r--r--stdlib/source/library/lux/macro.lux4
-rw-r--r--stdlib/source/library/lux/macro/local.lux12
-rw-r--r--stdlib/source/library/lux/macro/poly.lux4
-rw-r--r--stdlib/source/library/lux/macro/template.lux58
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux8
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux12
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux2
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux4
-rw-r--r--stdlib/source/library/lux/meta.lux215
-rw-r--r--stdlib/source/library/lux/program.lux30
-rw-r--r--stdlib/source/library/lux/target.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux30
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/loader.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/alias.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/lux.lux2
-rw-r--r--stdlib/source/library/lux/test.lux34
-rw-r--r--stdlib/source/library/lux/time.lux16
-rw-r--r--stdlib/source/library/lux/time/date.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/document.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/context.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/script.lux2
-rw-r--r--stdlib/source/library/lux/type.lux60
-rw-r--r--stdlib/source/library/lux/type/abstract.lux18
-rw-r--r--stdlib/source/library/lux/type/check.lux18
-rw-r--r--stdlib/source/library/lux/type/implicit.lux10
-rw-r--r--stdlib/source/library/lux/type/resource.lux22
-rw-r--r--stdlib/source/library/lux/world/db/sql.lux2
-rw-r--r--stdlib/source/library/lux/world/file.lux24
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux24
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux4
-rw-r--r--stdlib/source/library/lux/world/program.lux4
-rw-r--r--stdlib/source/program/aedifex.lux4
-rw-r--r--stdlib/source/program/aedifex/action.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact.lux4
-rw-r--r--stdlib/source/program/aedifex/command/build.lux8
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux4
-rw-r--r--stdlib/source/program/aedifex/parser.lux4
-rw-r--r--stdlib/source/program/aedifex/pom.lux8
-rw-r--r--stdlib/source/program/aedifex/project.lux6
-rw-r--r--stdlib/source/program/compositor.lux6
-rw-r--r--stdlib/source/program/scriptum.lux12
-rw-r--r--stdlib/source/specification/compositor/generation/primitive.lux2
-rw-r--r--stdlib/source/test/aedifex/artifact/time/date.lux2
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux2
-rw-r--r--stdlib/source/test/aedifex/command/version.lux2
-rw-r--r--stdlib/source/test/aedifex/dependency/deployment.lux4
-rw-r--r--stdlib/source/test/aedifex/package.lux4
-rw-r--r--stdlib/source/test/aedifex/profile.lux4
-rw-r--r--stdlib/source/test/aedifex/repository.lux2
-rw-r--r--stdlib/source/test/aedifex/repository/remote.lux6
-rw-r--r--stdlib/source/test/lux.lux296
-rw-r--r--stdlib/source/test/lux/abstract/codec.lux2
-rw-r--r--stdlib/source/test/lux/control/concurrency/actor.lux2
-rw-r--r--stdlib/source/test/lux/control/concurrency/atom.lux12
-rw-r--r--stdlib/source/test/lux/control/continuation.lux4
-rw-r--r--stdlib/source/test/lux/control/function.lux4
-rw-r--r--stdlib/source/test/lux/control/function/contract.lux2
-rw-r--r--stdlib/source/test/lux/control/lazy.lux8
-rw-r--r--stdlib/source/test/lux/control/maybe.lux10
-rw-r--r--stdlib/source/test/lux/control/parser/type.lux6
-rw-r--r--stdlib/source/test/lux/control/region.lux4
-rw-r--r--stdlib/source/test/lux/control/remember.lux2
-rw-r--r--stdlib/source/test/lux/control/security/capability.lux2
-rw-r--r--stdlib/source/test/lux/data/binary.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux22
-rw-r--r--stdlib/source/test/lux/data/collection/bits.lux40
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary.lux24
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/ordered.lux8
-rw-r--r--stdlib/source/test/lux/data/collection/dictionary/plist.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux16
-rw-r--r--stdlib/source/test/lux/data/collection/row.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/sequence.lux16
-rw-r--r--stdlib/source/test/lux/data/collection/set.lux2
-rw-r--r--stdlib/source/test/lux/data/collection/stack.lux4
-rw-r--r--stdlib/source/test/lux/data/format/json.lux42
-rw-r--r--stdlib/source/test/lux/data/name.lux4
-rw-r--r--stdlib/source/test/lux/data/text.lux8
-rw-r--r--stdlib/source/test/lux/data/text/format.lux2
-rw-r--r--stdlib/source/test/lux/debug.lux2
-rw-r--r--stdlib/source/test/lux/ffi.js.lux2
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux20
-rw-r--r--stdlib/source/test/lux/ffi.rb.lux4
-rw-r--r--stdlib/source/test/lux/math/number/i64.lux38
-rw-r--r--stdlib/source/test/lux/meta.lux52
-rw-r--r--stdlib/source/test/lux/program.lux16
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux6
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux6
-rw-r--r--stdlib/source/test/lux/type.lux55
-rw-r--r--stdlib/source/test/lux/type/check.lux12
-rw-r--r--stdlib/source/test/lux/type/quotient.lux8
-rw-r--r--stdlib/source/test/lux/type/refinement.lux2
-rw-r--r--stdlib/source/test/lux/world/console.lux2
-rw-r--r--stdlib/source/test/lux/world/file/watch.lux2
-rw-r--r--stdlib/source/test/lux/world/program.lux2
195 files changed, 1616 insertions, 1158 deletions
diff --git a/documentation/book/the_lux_programming_language/chapter_12.md b/documentation/book/the_lux_programming_language/chapter_12.md
index a14cfcfdf..8e4c0b8c0 100644
--- a/documentation/book/the_lux_programming_language/chapter_12.md
+++ b/documentation/book/the_lux_programming_language/chapter_12.md
@@ -109,5 +109,5 @@ Here, you have learned how to walk outside and yell.
Next, I shall teach you how to walk inside and whisper... to the host platform.
-See you in the next chapter!
+See you in [the next chapter](chapter_13.md)!
diff --git a/documentation/book/the_lux_programming_language/chapter_13.md b/documentation/book/the_lux_programming_language/chapter_13.md
new file mode 100644
index 000000000..e61c3b798
--- /dev/null
+++ b/documentation/book/the_lux_programming_language/chapter_13.md
@@ -0,0 +1,199 @@
+# Chapter 13: JVM inter-operation
+
+_Where you will cross the great divide._
+
+---
+
+No language is an island, and even _compiled-to-native_ languages need to have some _FFI_ (or _foreign function interface_) to interact with C, Fortran or some other language.
+
+There's a ton of awesome infrastructure out there that was implemented in other technologies, and there is no reason for us not to take a piece of that pie.
+
+The beautiful thing about the inter-operation mechanism offered by Lux is that it can be used to interact with _any_ language running on the JVM (not only Java).
+
+ Although, due to its simplicity, it's better suited for interacting with programs originally written in Java, as other languages tend to implement some tricks that make the classes they generate a little bit... _funky_.
+
+_So, what do I **need** to work with the JVM?_
+
+Basically, just 3 things:
+
+1. The means to consume the resources it provides (i.e. classes, methods, fields, and objects).
+2. The means to create your own resources (i.e. class definitions).
+3. The means to access its special features (such as synchronization).
+
+Let's explore them.
+
+ By the way, the only module relevant to this chapter is `library/lux/ffi`.
+
+## Importing classes, methods, and fields
+
+It's all done with the help of the `import:` macro:
+
+```
+... Allows importing JVM classes, and using them as types.
+... Their methods, fields and enum options can also be imported.
+(import: java/lang/Object
+ ["#::."
+ (new [])
+ (equals [java/lang/Object] boolean)
+ (wait [int] #io #try void)])
+
+... Special options can also be given for the return values.
+... #? means that the values will be returned inside a Maybe type. That way, null becomes #.None.
+... #try means that the computation might throw an exception, and the return value will be wrapped by the Try type.
+... #io means the computation has side effects, and will be wrapped by the IO type.
+... These options must show up in the following order [#io #try #?] (although, each option can be used independently).
+(import: java/lang/String
+ ["#::."
+ (new [[byte]])
+ (#static valueOf [char] java/lang/String)
+ (#static valueOf #as int_valueOf [int] java/lang/String)])
+
+(import: (java/util/List e)
+ ["#::."
+ (size [] int)
+ (get [int] e)])
+
+(import: (java/util/ArrayList a)
+ ["#::."
+ ([T] toArray [[T]] [T])])
+
+... The class-type that is generated is of the fully-qualified name.
+... This avoids a clash between the java.util.List type, and Lux's own List type.
+... All enum options to be imported must be specified.
+(import: java/lang/Character$UnicodeScript
+ ["#::."
+ (#enum ARABIC CYRILLIC LATIN)])
+
+... It should also be noted, the only types that may show up in method arguments or return values may be Java classes, arrays, primitives, void or type-vars.
+... Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes).
+(import: (lux/concurrency/async/JvmAsync A)
+ ["#::."
+ (resolve [A] boolean)
+ (poll [] A)
+ (wasResolved [] boolean)
+ (waitOn [lux/Function] void)
+ (#static [A] make [A] (lux/concurrency/async/JvmAsync A))])
+
+... Also, the names of the imported members will look like Class::member
+(java/lang/Object::new [])
+
+(java/lang/Object::equals [other_object] my_object)
+
+(java/util/List::size [] my_list)
+
+java/lang/Character$UnicodeScript::LATIN
+```
+
+This will be the tool you use the most when working with the JVM.
+
+As you have noticed, it works by creating functions (and constant values) for all the class members you need. It also creates Lux type definitions matching the classes you import, so that you may easily refer to them when you write your own types later in regular Lux code.
+
+ It must be noted that `import:` requires that you only import methods and fields from their original declaring classes/interfaces.
+
+ What that means is that if class `A` declares/defines method `foo`, and class `B` extends `A`; to import `foo`, you must do it by importing it from `A`, instead of `B`.
+
+## Writing classes
+
+Normally, you'd use the `class:` macro:
+
+```
+... Allows defining JVM classes in Lux code.
+... For example:
+(class: #final (TestClass A) [Runnable]
+ ... Fields
+ (#private foo boolean)
+ (#private bar A)
+ (#private baz java/lang/Object)
+ ... Methods
+ (#public [] (new [value A]) []
+ (exec
+ (:= ::foo #1)
+ (:= ::bar value)
+ (:= ::baz "")
+ []))
+ (#public (virtual) java/lang/Object
+ "")
+ (#public #static (static) java/lang/Object
+ "")
+ (Runnable [] (run) void
+ [])
+ )
+
+... The tuple corresponds to parent interfaces.
+... An optional super-class can be specified before the tuple. If not specified, java.lang.Object will be assumed.
+... Fields and methods defined in the class can be used with special syntax.
+... For example:
+... ::resolved, for accessing the 'resolved' field.
+... (:= ::resolved #1) for modifying it.
+... (::new! []) for calling the class's constructor.
+... (::resolve! container [value]) for calling the 'resolve' method.
+```
+
+And, for anonymous classes, you'd use `object`:
+
+```
+... Allows defining anonymous classes.
+... The 1st tuple corresponds to class-level type-variables.
+... The 2nd tuple corresponds to parent interfaces.
+... The 3rd tuple corresponds to arguments to the super class constructor.
+... An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed.
+(object [] [Runnable]
+ []
+ (Runnable [] (run self) void
+ (exec
+ (do_something some_value)
+ [])))
+```
+
+## Special features
+
+* Accessing class objects.
+
+```
+... Loads the class as a java.lang.Class object.
+(class_for java/lang/String)
+```
+
+* Test instances.
+
+```
+... Checks whether an object is an instance of a particular class.
+... Caveat emptor: Can't check for polymorphism, so avoid using parameterized classes.
+(case (check java/lang/String "YOLO")
+ (#.Some value_as_string)
+ #.None)
+```
+
+* Synchronizing threads.
+
+```
+... Evaluates body, while holding a lock on a given object.
+(synchronized object-to-be-locked
+(exec
+ (do something)
+ (do something else)
+ (finish the computation)))
+```
+
+Calling multiple methods consecutively
+
+```
+... Call a variety of methods on an object. Then, return the object.
+(do_to object
+ (ClassName::method1 arg0 arg1 arg2)
+ (ClassName::method2 arg3 arg4 arg5))
+```
+
+ `do_to` is inspired by Clojure's own doto macro.
+ The difference is that, whereas Clojure's version pipes the object as the first argument to the method, Lux's pipes it at the end (which is where method functions take their object values).
+
+The `library/lux/ffi` module offers much more, but you'll have to discover it yourself by heading over to the documentation for the Standard Library.
+
+---
+
+Host platform inter-operation is a feature whose value can never be understated, for there are many **important** features that could never be implemented without the means provided by it.
+
+We're actually going to explore one such feature in the next chapter, when we abandon our old notions of sequential program execution and explore the curious world of concurrency.
+
+See you in the next chapter!
+
diff --git a/documentation/bookmark/database/storage.md b/documentation/bookmark/database/storage.md
new file mode 100644
index 000000000..ac125911f
--- /dev/null
+++ b/documentation/bookmark/database/storage.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [Damn Cool Algorithms: Log structured storage](http://blog.notdot.net/2009/12/Damn-Cool-Algorithms-Log-structured-storage)
+
diff --git a/documentation/bookmark/debugging.md b/documentation/bookmark/debugging.md
index d2fe2693d..60227f63c 100644
--- a/documentation/bookmark/debugging.md
+++ b/documentation/bookmark/debugging.md
@@ -14,17 +14,6 @@
1. https://pernos.co/
-# Tool
-
-1. [drgn: Scriptable debugger library](https://github.com/osandov/drgn)
-1. [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/)
-1. https://github.com/srg-imperial/SaBRe
-1. https://developer.mozilla.org/en-US/docs/Mozilla/Projects/WebReplay
-1. https://umaar.github.io/performance-debugging-devtools-2018/#/
-1. http://plasma-umass.org/BLeak/
-1. https://clinicjs.org/
-1. http://pev.sourceforge.net/
-
# Tracing
1. ["Understanding Microservices with Distributed Tracing" by Lita Cho](https://www.youtube.com/watch?v=URCLeycMrhU)
diff --git a/documentation/bookmark/format/base64.md b/documentation/bookmark/format/base64.md
new file mode 100644
index 000000000..47ebe02a1
--- /dev/null
+++ b/documentation/bookmark/format/base64.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [fast-base64](https://github.com/mitschabaude/fast-base64)
+
diff --git a/documentation/bookmark/tool/debugger.md b/documentation/bookmark/tool/debugger.md
new file mode 100644
index 000000000..fb4283d67
--- /dev/null
+++ b/documentation/bookmark/tool/debugger.md
@@ -0,0 +1,12 @@
+# Reference
+
+1. [Ruby Jard: Just Another Ruby Debugger](https://rubyjard.org/)
+1. [drgn: Scriptable debugger library](https://github.com/osandov/drgn)
+1. [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/)
+1. https://github.com/srg-imperial/SaBRe
+1. https://developer.mozilla.org/en-US/docs/Mozilla/Projects/WebReplay
+1. https://umaar.github.io/performance-debugging-devtools-2018/#/
+1. http://plasma-umass.org/BLeak/
+1. https://clinicjs.org/
+1. http://pev.sourceforge.net/
+
diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux
index e421fe344..50fb066e9 100644
--- a/licentia/source/program/licentia.lux
+++ b/licentia/source/program/licentia.lux
@@ -57,11 +57,11 @@
(format "Your license has been made!" text.new_line
"Check the file " output "."))
-(program: [{input (<| (<cli>.named "--input")
- <cli>.any)}
- {output (<| (parser.default ..default_output_file)
- (<cli>.named "--output")
- <cli>.any)}]
+(program: [input (<| (<cli>.named "--input")
+ <cli>.any)
+ output (<| (parser.default ..default_output_file)
+ (<cli>.named "--output")
+ <cli>.any)]
(do io.monad
[?done (: (IO (Try Any))
(do (try.with io.monad)
diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux
index 0eaa41989..41e588f56 100644
--- a/lux-cl/source/program.lux
+++ b/lux-cl/source/program.lux
@@ -266,7 +266,7 @@
[program/LuxADT [program/LuxADT::getValue #try.Success]]))
(case (ffi.check org/armedbear/lisp/Symbol host_object)
(#.Some host_object)
- (if (is? (org/armedbear/lisp/Symbol::T) host_object)
+ (if (same? (org/armedbear/lisp/Symbol::T) host_object)
(#try.Success true)
(exception.throw ..unknown_kind_of_object (:as java/lang/Object host_object)))
@@ -386,7 +386,7 @@
@.common_lisp
(def: (extender handler)
Extender
- (:assume handler))})
+ (:expected handler))})
(def: (declare_success! _)
(-> Any (Promise Any))
@@ -406,7 +406,7 @@
(_.call/* @program (list))
)))
-(`` (program: [{service /cli.service}]
+(`` (program: [service /cli.service]
(let [extension ".cl"]
(do io.monad
[platform ..platform]
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index e81892170..03e673af9 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -633,7 +633,7 @@
@.js
(def: (extender phase_wrapper handler)
(-> platform.Phase_Wrapper Extender)
- (:assume handler))})
+ (:expected handler))})
(def: (declare_success! _)
(-> Any (Async Any))
@@ -644,7 +644,7 @@
(_.statement (_.apply/* (_.closure (list) body)
(list))))
-(program: [{service /cli.service}]
+(program: [service /cli.service]
(let [extension ".js"]
(exec (do async.monad
[_ (/.compiler {#/static.host @.js
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index bc038bc92..7f1df4db3 100644
--- a/lux-jvm/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
@@ -420,7 +420,7 @@
(def: (relabel [mapping label])
(Re_labeler Identity)
- (case (dictionary.get label mapping)
+ (case (dictionary.value label mapping)
(#.Some label)
[mapping label]
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
index 6fc52a0ab..b25d37fd7 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -120,7 +120,7 @@
(template [<conversion> <name>]
[(def: (<name> inputI)
(Unary Inst)
- (if (is? _.NOP <conversion>)
+ (if (same? _.NOP <conversion>)
inputI
(|>> inputI
<conversion>)))]
@@ -628,7 +628,7 @@
(function (_ extension_name generate archive [class field unboxed])
(do phase.monad
[]
- (case (dictionary.get unboxed ..primitives)
+ (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(in (_.GETSTATIC (type.class class (list)) field primitive))
@@ -643,7 +643,7 @@
(do phase.monad
[valueI (generate archive valueS)
.let [$class (type.class class (list))]]
- (case (dictionary.get unboxed ..primitives)
+ (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(in (|>> valueI
(_.PUTSTATIC $class field primitive)
@@ -663,7 +663,7 @@
(do phase.monad
[objectI (generate archive objectS)
.let [$class (type.class class (list))
- getI (case (dictionary.get unboxed ..primitives)
+ getI (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(_.GETFIELD $class field primitive)
@@ -682,7 +682,7 @@
[valueI (generate archive valueS)
objectI (generate archive objectS)
.let [$class (type.class class (list))
- putI (case (dictionary.get unboxed ..primitives)
+ putI (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(_.PUTFIELD $class field primitive)
@@ -917,7 +917,7 @@
(^ (synthesis.variable var))
(|> mapping
- (dictionary.get body)
+ (dictionary.value body)
(maybe.else var)
synthesis.variable)
@@ -944,7 +944,7 @@
(case captured
(^ (synthesis.variable var))
(|> mapping
- (dictionary.get captured)
+ (dictionary.value captured)
(maybe.else var)
synthesis.variable)
@@ -1114,7 +1114,7 @@
(list\map (function (_ [foreign_id capture])
[(synthesis.variable/foreign foreign_id)
(|> global_mapping
- (dictionary.get capture)
+ (dictionary.value capture)
maybe.assume)]))
(dictionary.of_list synthesis.hash))]
[ownerT name
diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux
index e14cfbb27..72a245f9d 100644
--- a/lux-jvm/source/program.lux
+++ b/lux-jvm/source/program.lux
@@ -276,7 +276,7 @@
(-> Any (Async Any))
(async.future (\ world/program.default exit +0)))
-(program: [{service /cli.service}]
+(program: [service /cli.service]
(let [static {#/static.host @.jvm
#/static.host_module_extension ".jvm"
#/static.target (/cli.target service)
diff --git a/lux-jvm/test/test/luxc/lang/translation/jvm.lux b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
index 233178409..b4781b637 100644
--- a/lux-jvm/test/test/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
@@ -544,7 +544,7 @@
(lang.with-current-module "")
(macro.result (io.run! init-jvm))
(case> (#e.Success outputT)
- (is? hostL.unit (:coerce Text outputT))
+ (same? hostL.unit (:coerce Text outputT))
(#e.Error error)
#0)))
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index e55f4169a..fc02693cf 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -757,7 +757,7 @@
@.lua
(def: (extender phase_wrapper handler)
(-> platform.Phase_Wrapper Extender)
- (:assume handler))})
+ (:expected handler))})
(def: (phase_wrapper archive)
(-> Archive (runtime.Operation platform.Phase_Wrapper))
@@ -800,7 +800,7 @@
(-> Any (Async Any))
(async.future (\ world/program.default exit +0)))
-(`` (program: [{service /cli.service}]
+(`` (program: [service /cli.service]
(let [extension ".lua"]
(do io.monad
[(~~ (for {@.old [baggage platform]
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el
index 60dab4d8c..c49229be8 100644
--- a/lux-mode/lux-mode.el
+++ b/lux-mode/lux-mode.el
@@ -369,7 +369,7 @@ Called by `imenu--generic-function'."
(control//contract (altRE "pre" "post"))
;; Type
(type//syntax (altRE "Variant" "Or" "Tuple" "And" "->" "All" "Ex" "Rec" "primitive" "type"))
- (type//checking (altRE ":" ":as" ":let" ":~" ":assume" ":of" ":cast" ":sharing" ":by_example" ":hole"))
+ (type//checking (altRE ":" ":as" ":let" ":~" ":expected" ":of" ":cast" ":sharing" ":by_example" ":hole"))
(type//abstract (altRE "abstract:" ":abstraction" ":representation" ":transmutation" "\\^:representation"))
(type//unit (altRE "unit:" "scale:"))
(type//poly (altRE "poly:" "derived:"))
diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux
index 25fc3fefa..dc3d270a7 100644
--- a/lux-php/source/program.lux
+++ b/lux-php/source/program.lux
@@ -230,7 +230,7 @@
... Methods
(program/StructureValue
[] (getValue self) java/lang/Object
- (:assume value))
+ (:expected value))
(php/runtime/Memory
[] (toString self)
@@ -446,7 +446,7 @@
(def: (call_macro inputs lux macro)
(-> (List Code) Lux php/runtime/memory/ObjectMemory (Try (Try [Lux (List Code)])))
- (<| :assume
+ (<| :expected
(do try.monad
[output (php/runtime/lang/Closure::call ..default_environment
(|> (ffi.array php/runtime/Memory 3)
@@ -550,13 +550,13 @@
@.php
(def: (extender handler)
Extender
- (:assume handler))})
+ (:expected handler))})
(def: (declare_success! _)
(-> Any (Promise Any))
(promise.future (\ world/program.default exit +0)))
-(`` (program: [{service /cli.service}]
+(`` (program: [service /cli.service]
(let [extension ".php"]
(do io.monad
[platform ..platform]
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index 6ae2a4aa2..547a1cd24 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -230,7 +230,7 @@
(for {@.old
(as_is (def: (call_macro inputs lux macro)
(-> (List Code) Lux org/python/core/PyFunction (Try (Try [Lux (List Code)])))
- (:assume
+ (:expected
(do try.monad
[expansion (org/python/core/PyFunction::__call__ (|> (ffi.array org/python/core/PyObject 2)
(ffi.array_write 0 (..to_host inputs))
@@ -445,7 +445,7 @@
@.python
(def: (extender phase_wrapper handler)
(-> platform.Phase_Wrapper Extender)
- (:assume handler))})
+ (:expected handler))})
(def: (phase_wrapper archive)
(-> Archive (runtime.Operation platform.Phase_Wrapper))
@@ -495,7 +495,7 @@
(; (_.apply/* @program (list)))
))))
-(program: [{service /cli.service}]
+(program: [service /cli.service]
(let [extension ".py"]
(exec (do async.monad
[_ (/.compiler {#/static.host @.python
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux
index de859ba50..ec796e0d2 100644
--- a/lux-r/source/program.lux
+++ b/lux-r/source/program.lux
@@ -214,7 +214,7 @@
(ffi.array org/renjin/sexp/SEXP 0)
... (java/util/List java/lang/Object)
- ... (:assume (..fake_list []))
+ ... (:expected (..fake_list []))
}]
... Methods
... (program/LuxADT
@@ -575,7 +575,7 @@
@.r
(def: (extender handler)
Extender
- (:assume handler))})
+ (:expected handler))})
(def: (declare_success! _)
(-> Any (Promise Any))
@@ -589,7 +589,7 @@
(_.apply/0 $program [])
)))
-(`` (program: [{service /cli.service}]
+(`` (program: [service /cli.service]
(let [extension ".r"]
(do io.monad
[[interpreter platform] ..platform]
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 5c16bdd36..5d8c81858 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -454,7 +454,7 @@
(let [reference (ffi.array_read 0 args)]
(case (..read (:as java/lang/Object reference))
(#try.Success reference)
- (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime (is? (: Any reference) (: Any value)))
+ (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime (same? (: Any reference) (: Any value)))
(#try.Failure error)
(org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime false))))))
@@ -583,7 +583,7 @@
(def: (call_macro inputs lux macro)
(-> (List Code) Lux org/jruby/RubyProc (Try (Try [Lux (List Code)])))
- (:assume
+ (:expected
(do try.monad
[expansion (org/jruby/RubyProc::call (!ruby_thread_context)
(|> (ffi.array org/jruby/runtime/builtin/IRubyObject 2)
@@ -789,7 +789,7 @@
@.ruby
(def: (extender phase_wrapper handler)
(-> platform.Phase_Wrapper Extender)
- (:assume handler))})
+ (:expected handler))})
(def: (phase_wrapper archive)
(-> Archive (runtime.Operation platform.Phase_Wrapper))
@@ -820,7 +820,7 @@
(-> Any (Async Any))
(async.future (\ world/program.default exit +0)))
-(program: [{service /cli.service}]
+(program: [service /cli.service]
(let [extension ".rb"]
(exec (do async.monad
[_ (/.compiler {#/static.host @.ruby
diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux
index 53b6bbabc..f25a71bbe 100644
--- a/lux-scheme/source/program.lux
+++ b/lux-scheme/source/program.lux
@@ -438,13 +438,13 @@
@.scheme
(def: (extender handler)
Extender
- (:assume handler))})
+ (:expected handler))})
(def: (declare_success! _)
(-> Any (Promise Any))
(promise.future (\ world/program.default exit +0)))
-(`` (program: [{service /cli.service}]
+(`` (program: [service /cli.service]
(let [extension ".scm"]
(do io.monad
[platform ..platform
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 8b03f390b..16123c586 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1283,40 +1283,40 @@
(failure "Wrong syntax for list&")}
(list\reverse xs)))
-(macro:' .public (Tuple tokens)
+(macro:' .public (Variant tokens)
(#Item [(tag$ ["library/lux" "doc"])
(text$ ("lux text concat"
- ("lux text concat" "... Tuple types:" __paragraph)
+ ("lux text concat" "... Variant types:" __paragraph)
("lux text concat"
- ("lux text concat" "(Tuple Text Int Bit)" __paragraph)
+ ("lux text concat" "(Variant Text Int Bit)" __paragraph)
("lux text concat"
- ("lux text concat" "... Any." __paragraph)
- "(&)"))))]
+ ("lux text concat" "... Nothing." __paragraph)
+ "(Variant)"))))]
#End)
({#End
- (in_meta (list (identifier$ ["library/lux" "Any"])))
+ (in_meta (list (identifier$ ["library/lux" "Nothing"])))
(#Item last prevs)
- (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
+ (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
last
prevs)))}
(list\reverse tokens)))
-(macro:' .public (Variant tokens)
+(macro:' .public (Tuple tokens)
(#Item [(tag$ ["library/lux" "doc"])
(text$ ("lux text concat"
- ("lux text concat" "... Variant types:" __paragraph)
+ ("lux text concat" "... Tuple types:" __paragraph)
("lux text concat"
- ("lux text concat" "(Variant Text Int Bit)" __paragraph)
+ ("lux text concat" "(Tuple Text Int Bit)" __paragraph)
("lux text concat"
- ("lux text concat" "... Nothing." __paragraph)
- "(Variant)"))))]
+ ("lux text concat" "... Any." __paragraph)
+ "(&)"))))]
#End)
({#End
- (in_meta (list (identifier$ ["library/lux" "Nothing"])))
+ (in_meta (list (identifier$ ["library/lux" "Any"])))
(#Item last prevs)
- (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
+ (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
last
prevs)))}
(list\reverse tokens)))
@@ -1380,12 +1380,16 @@
tokens))
(def:''' .public Or
- #End
+ (#Item [(tag$ ["library/lux" "doc"])
+ (text$ "An alias for the Variant type constructor.")]
+ #End)
Macro
..Variant)
(def:''' .public And
- #End
+ (#Item [(tag$ ["library/lux" "doc"])
+ (text$ "An alias for the Tuple type constructor.")]
+ #End)
Macro
..Tuple)
@@ -1463,7 +1467,7 @@
(form$ (list op a1 a2))}
op))
-(def:''' .private (function\flip func)
+(def:''' .private (function\flipped func)
#End
(All [a b c]
(-> (-> a b c) (-> b a c)))
@@ -1482,7 +1486,7 @@
#End)
({(#Item op tokens')
({(#Item first nexts)
- (in_meta (list (list\fold (function\flip (right_associativity op)) first nexts)))
+ (in_meta (list (list\fold (function\flipped (right_associativity op)) first nexts)))
_
(failure "Wrong syntax for _$")}
@@ -1653,14 +1657,14 @@
Type
(All [a] ($' List (Tuple Text a))))
-(def:''' .private (get k plist)
+(def:''' .private (plist\value k plist)
#End
(All [a]
(-> Text ($' PList a) ($' Maybe a)))
({(#Item [[k' v] plist'])
(if (text\= k k')
(#Some v)
- (get k plist'))
+ (plist\value k plist'))
#End
#None}
@@ -1679,33 +1683,6 @@
_ ($_ text\compose module "." name)}
module)))
-(def:''' .private (get_meta tag def_meta)
- #End
- (-> Name Code ($' Maybe Code))
- (let' [[module name] tag]
- ({[_ (#Record def_meta)]
- ({(#Item [key value] def_meta')
- ({[_ (#Tag [module' name'])]
- ({[#1 #1]
- (#Some value)
-
- _
- (get_meta tag (record$ def_meta'))}
- [(text\= module module')
- (text\= name name')])
-
- _
- (get_meta tag (record$ def_meta'))}
- key)
-
- #End
- #None}
- def_meta)
-
- _
- #None}
- def_meta)))
-
(def:''' .private (global_identifier full_name state)
#End
(-> Name ($' Meta Name))
@@ -1725,11 +1702,11 @@
#None
(#Left ($_ text\compose "Unknown definition: " (name\encode full_name)))}
- (get name definitions))
+ (plist\value name definitions))
#None
(#Left ($_ text\compose "Unknown module: " module " @ " (name\encode full_name)))}
- (get module modules))))
+ (plist\value module modules))))
(def:''' .private (code_list expression)
#End
@@ -2011,7 +1988,7 @@
(-> (-> b c) (-> a b) (-> a c)))
(function' [x] (f (g x))))
-(def:''' .private (get_name x)
+(def:''' .private (identifier_name x)
#End
(-> Code ($' Maybe Name))
({[_ (#Identifier sname)]
@@ -2021,7 +1998,7 @@
#None}
x))
-(def:''' .private (get_tag x)
+(def:''' .private (tag_name x)
#End
(-> Code ($' Maybe Name))
({[_ (#Tag sname)]
@@ -2031,7 +2008,7 @@
#None}
x))
-(def:''' .private (get_short x)
+(def:''' .private (identifier_short x)
#End
(-> Code ($' Maybe Text))
({[_ (#Identifier "" sname)]
@@ -2149,7 +2126,7 @@
_
(failure "Wrong syntax for template")}
- [(monad\map maybe_monad get_short bindings)
+ [(monad\map maybe_monad identifier_short bindings)
(monad\map maybe_monad tuple_list data)])
_
@@ -2282,9 +2259,9 @@
Text Text Text
($' Maybe Macro))
(do maybe_monad
- [$module (get module modules)
+ [$module (plist\value module modules)
gdef (let' [{#module_hash _ #module_aliases _ #definitions bindings #imports _ #tags tags #types types #module_annotations _ #module_state _} ("lux type check" Module $module)]
- (get name bindings))]
+ (plist\value name bindings))]
({(#Left [r_module r_name])
(macro' modules current_module r_module r_name)
@@ -3265,7 +3242,7 @@
#.None
(failure "Wrong syntax for macro:")))
-(def: (find f xs)
+(def: (list\one f xs)
(All [a b]
(-> (-> a (Maybe b)) (List a) (Maybe b)))
(case xs
@@ -3275,7 +3252,7 @@
(#Item x xs')
(case (f x)
#None
- (find f xs')
+ (list\one f xs')
(#Some y)
(#Some y))))
@@ -3329,7 +3306,7 @@
_
(#Left "Wrong syntax for else")))
-(def: (text\split_all_with splitter input)
+(def: (text\all_split_by splitter input)
(-> Text Text (List Text))
(case (..index splitter input)
#None
@@ -3337,12 +3314,12 @@
(#Some idx)
(list& ("lux text clip" 0 idx input)
- (text\split_all_with splitter
- (let [after_offset ("lux i64 +" 1 idx)
- after_length ("lux i64 -"
- after_offset
- ("lux text size" input))]
- ("lux text clip" after_offset after_length input))))))
+ (text\all_split_by splitter
+ (let [after_offset ("lux i64 +" 1 idx)
+ after_length ("lux i64 -"
+ after_offset
+ ("lux text size" input))]
+ ("lux text clip" after_offset after_length input))))))
(def: (item idx xs)
(All [a]
@@ -3481,25 +3458,19 @@
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
#scope_type_vars scope_type_vars} state]
- (case (get name modules)
+ (case (plist\value name modules)
(#Some module)
(#Right state module)
_
(#Left ($_ text\compose "Unknown module: " name))))))
-(def: get_current_module
- (Meta Module)
- (do meta_monad
- [module_name current_module_name]
- (module module_name)))
-
(def: (type_tag [module name])
(-> Name (Meta [Nat (List Name) Bit Type]))
(do meta_monad
[=module (..module module)
.let [{#module_hash _ #module_aliases _ #definitions bindings #imports _ #tags tags_table #types types #module_annotations _ #module_state _} =module]]
- (case (get name tags_table)
+ (case (plist\value name tags_table)
(#Some output)
(in_meta output)
@@ -3522,7 +3493,7 @@
(do meta_monad
[=module (..module module)
.let [{#module_hash _ #module_aliases _ #definitions bindings #imports _ #tags tags #types types #module_annotations _ #module_state _} =module]]
- (case (get name types)
+ (case (plist\value name types)
(#Some [tags exported? (#Named _ _type)])
(case (interface_methods _type)
(#Some members)
@@ -3537,7 +3508,7 @@
_
(in_meta #None)))
-(def: get_expected_type
+(def: expected_type
(Meta Type)
(function (_ state)
(let [{#info info #source source #current_module _ #modules modules
@@ -3552,10 +3523,25 @@
(#Left "Not expecting any type.")))))
(macro: .public (implementation tokens)
- {#.doc "Not meant to be used directly. Prefer 'implementation:'."}
+ {#.doc (text$ ($_ "lux text concat"
+ "... Express a value that implements an interface." ..\n
+ "(: (Order Int)" ..\n
+ " (implementation" ..\n
+ " (def: &equivalence equivalence)" ..\n
+ " (def: (< test subject)" ..\n
+ " (< test subject))" ..\n
+ " (def: (<= test subject)" ..\n
+ " (or (< test subject)" ..\n
+ " (= test subject)))" ..\n
+ " (def: (> test subject)" ..\n
+ " (> test subject))" ..\n
+ " (def: (>= test subject)" ..\n
+ " (or (> test subject)" ..\n
+ " (= test subject)))" ..\n
+ " ))"))}
(do meta_monad
[tokens' (monad\map meta_monad expansion tokens)
- struct_type get_expected_type
+ struct_type ..expected_type
tags+type (record_slots struct_type)
tags (: (Meta (List Name))
(case tags+type
@@ -3572,7 +3558,7 @@
(function (_ token)
(case token
(^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag_name)] value meta export_policy))])
- (case (get tag_name tag_mappings)
+ (case (plist\value tag_name tag_mappings)
(#Some tag)
(in [tag value])
@@ -3640,9 +3626,10 @@
(macro: .public (implementation: tokens)
{#.doc (text$ ($_ "lux text concat"
- "... Definition of structures ala ML." ..\n
+ "... Interface implementation." ..\n
"(implementation: .public order" ..\n
" (Order Int)" ..\n
+ ..\n
" (def: &equivalence equivalence)" ..\n
" (def: (< test subject)" ..\n
" (< test subject))" ..\n
@@ -3814,7 +3801,7 @@
(macro: .public (interface: tokens)
{#.doc (text$ ($_ "lux text concat"
- "... Definition of interfaces/signatures ala ML." ..\n
+ "... Interface definition." ..\n
"(interface: .public (Order a)" ..\n
" (: (Equivalence a)" ..\n
" &equivalence)" ..\n
@@ -3855,6 +3842,7 @@
(template [<name> <to>]
[(def: .public (<name> value)
+ {#.doc "Safe type-casting for I64 values."}
(-> (I64 Any) <to>)
(:as <to> value))]
@@ -3947,24 +3935,24 @@
_
(in_meta [#.End parts])))
-(def: (text\split! at x)
+(def: (text\split_at' at x)
(-> Nat Text [Text Text])
[("lux text clip" 0 at x)
("lux text clip" at (|> x "lux text size" ("lux i64 -" at)) x)])
-(def: (text\split_with token sample)
+(def: (text\split_by token sample)
(-> Text Text (Maybe [Text Text]))
(do ..maybe_monad
[index (..index token sample)
- .let [[pre post'] (text\split! index sample)
- [_ post] (text\split! ("lux text size" token) post')]]
+ .let [[pre post'] (text\split_at' index sample)
+ [_ post] (text\split_at' ("lux text size" token) post')]]
(in [pre post])))
(def: (replaced pattern replacement template)
(-> Text Text Text Text)
((: (-> Text Text Text)
(function (recur left right)
- (case (..text\split_with pattern right)
+ (case (..text\split_by pattern right)
(#.Some [pre post])
(recur ($_ "lux text concat" left pre replacement) post)
@@ -3982,6 +3970,7 @@
(replaced ..contextual_reference context)))
(def: .public module_separator
+ {#.doc "Character used to separate the parts of module names."}
"/")
(def: parallel_hierarchy_sigil
@@ -3989,8 +3978,8 @@
(def: (normal_parallel_path' hierarchy root)
(-> Text Text Text)
- (case [(text\split_with ..module_separator hierarchy)
- (text\split_with ..parallel_hierarchy_sigil root)]
+ (case [(text\split_by ..module_separator hierarchy)
+ (text\split_by ..parallel_hierarchy_sigil root)]
[(#.Some [_ hierarchy'])
(#.Some ["" root'])]
(normal_parallel_path' hierarchy' root')
@@ -4002,7 +3991,7 @@
(def: (normal_parallel_path hierarchy root)
(-> Text Text (Maybe Text))
- (case (text\split_with ..parallel_hierarchy_sigil root)
+ (case (text\split_by ..parallel_hierarchy_sigil root)
(#.Some ["" root'])
(#.Some (normal_parallel_path' hierarchy root'))
@@ -4047,7 +4036,7 @@
module))
relatives
- (let [parts (text\split_all_with ..module_separator relative_root)
+ (let [parts (text\all_split_by ..module_separator relative_root)
jumps ("lux i64 -" 1 relatives)]
(if (n/< (list\size parts) jumps)
(let [prefix (|> parts
@@ -4150,7 +4139,7 @@
#seed seed #expected expected #location location #extensions extensions
#scope_type_vars scope_type_vars}
[current_module modules])]
- (case (get module modules)
+ (case (plist\value module modules)
(#Some =module)
(let [to_alias (list\map (: (-> [Text Global]
(List Text))
@@ -4217,21 +4206,21 @@
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
#scope_type_vars scope_type_vars}
- (find (: (-> Scope (Maybe Type))
- (function (_ env)
- (case env
- {#name _
- #inner _
- #locals {#counter _ #mappings locals}
- #captured {#counter _ #mappings closure}}
- (on_either (find (: (-> [Text [Type Any]] (Maybe Type))
- (function (_ [bname [type _]])
- (if (text\= name bname)
- (#Some type)
- #None))))
- (: (List [Text [Type Any]]) locals)
- (: (List [Text [Type Any]]) closure)))))
- scopes)))
+ (list\one (: (-> Scope (Maybe Type))
+ (function (_ env)
+ (case env
+ {#name _
+ #inner _
+ #locals {#counter _ #mappings locals}
+ #captured {#counter _ #mappings closure}}
+ (on_either (list\one (: (-> [Text [Type Any]] (Maybe Type))
+ (function (_ [bname [type _]])
+ (if (text\= name bname)
+ (#Some type)
+ #None))))
+ (: (List [Text [Type Any]]) locals)
+ (: (List [Text [Type Any]]) closure)))))
+ scopes)))
(def: (definition_type name state)
(-> Name Lux (Maybe Type))
@@ -4240,12 +4229,12 @@
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
#scope_type_vars scope_type_vars} state]
- (case (get v_module modules)
+ (case (plist\value v_module modules)
#None
#None
(#Some {#definitions definitions #module_hash _ #module_aliases _ #imports _ #tags tags #types types #module_annotations _ #module_state _})
- (case (get v_name definitions)
+ (case (plist\value v_name definitions)
#None
#None
@@ -4264,12 +4253,12 @@
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
#scope_type_vars scope_type_vars} state]
- (case (get v_module modules)
+ (case (plist\value v_module modules)
#None
(#Left (text\compose "Unknown definition: " (name\encode name)))
(#Some {#definitions definitions #module_hash _ #module_aliases _ #imports _ #tags tags #types types #module_annotations _ #module_state _})
- (case (get v_name definitions)
+ (case (plist\value v_name definitions)
#None
(#Left (text\compose "Unknown definition: " (name\encode name)))
@@ -4698,7 +4687,7 @@
list\join)]]
(in (list\compose defs openings))))
-(macro: .public (refer tokens)
+(macro: (refer tokens)
(case tokens
(^ (list& [_ (#Text module_name)] options))
(do meta_monad
@@ -4731,9 +4720,9 @@
(form$ (list& (text$ (..replaced ..contextual_reference module_alias alias))
(list\map local_identifier$ structs))))
r_opens)]
- (` (..refer (~ (text$ module_name))
- (~+ localizations)
- (~+ openings)))))
+ (` ((~! ..refer) (~ (text$ module_name))
+ (~+ localizations)
+ (~+ openings)))))
(macro: .public (module: tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -5000,7 +4989,7 @@
branches))
(case (: (Maybe (List Code))
(do maybe_monad
- [bindings' (monad\map maybe_monad get_short bindings)
+ [bindings' (monad\map maybe_monad identifier_short bindings)
data' (monad\map maybe_monad tuple_list data)]
(let [num_bindings (list\size bindings')]
(if (every? (|>> ("lux i64 =" num_bindings))
@@ -5156,7 +5145,7 @@
(case fragment
(#Documentation_Comment comment)
(|> comment
- (text\split_all_with ..\n)
+ (text\all_split_by ..\n)
(list\map (function (_ line) ($_ text\compose "... " line ..\n)))
(text\join_with ""))
@@ -5262,11 +5251,11 @@
(if (every? identifier? inits)
(do meta_monad
[inits' (: (Meta (List Name))
- (case (monad\map maybe_monad get_name inits)
+ (case (monad\map maybe_monad identifier_name inits)
(#Some inits') (in_meta inits')
#None (failure "Wrong syntax for loop")))
init_types (monad\map meta_monad type_definition inits')
- expected get_expected_type]
+ expected ..expected_type]
(in_meta (list (` (("lux type check"
(-> (~+ (list\map type_code init_types))
(~ (type_code expected)))
@@ -5297,8 +5286,8 @@
[slots (: (Meta [Name (List Name)])
(case (: (Maybe [Name (List Name)])
(do maybe_monad
- [hslot (get_tag hslot')
- tslots (monad\map maybe_monad get_tag tslots')]
+ [hslot (..tag_name hslot')
+ tslots (monad\map maybe_monad ..tag_name tslots')]
(in [hslot tslots])))
(#Some slots)
(in_meta slots)
@@ -5318,7 +5307,7 @@
pattern (record$ (list\map (: (-> Name [Code Code])
(function (_ [module name])
(let [tag (tag$ [module name])]
- (case (get name slot_pairings)
+ (case (plist\value name slot_pairings)
(#Some binding) [tag binding]
#None [tag g!_]))))
tags))]]
@@ -5483,6 +5472,27 @@
))
(macro: .public (static tokens)
+ {#.doc (example "Resolves the names of definitions to their values at compile-time, assuming their values are either:"
+ "* Bit"
+ "* Nat"
+ "* Int"
+ "* Rev"
+ "* Frac"
+ "* Text"
+ (def: my_nat 123)
+ (def: my_text "456")
+ (and (case [my_nat my_text]
+ (^ (static [..my_nat ..my_text]))
+ true
+
+ _
+ false)
+ (case [my_nat my_text]
+ (^ [(static ..my_nat) (static ..my_text)])
+ true
+
+ _
+ false)))}
(case tokens
(^ (list pattern))
(do meta_monad
@@ -5567,7 +5577,7 @@
_
#0)]
- expected get_expected_type
+ expected ..expected_type
g!temp (..identifier "temp")]
(let [output (list g!temp
(` ({(#Some (~ g!temp))
@@ -5610,18 +5620,18 @@
_
(failure (..wrong_syntax_error ["library/lux" "name_of"]))))
-(def: (get_scope_type_vars state)
+(def: (scope_type_vars state)
(Meta (List Nat))
(case state
{#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
#seed seed #expected expected #location location #extensions extensions
#scope_type_vars scope_type_vars}
- (#Right state scope_type_vars)
- ))
+ (#Right [state scope_type_vars])))
(macro: .public (:parameter tokens)
- {#.doc (example "Allows you to refer to the type-variables in a polymorphic function's type, by their index."
+ {#.doc (example "NOTE: Please stay away from this macro. It's very likely to be removed in a future version of Lux."
+ "Allows you to refer to the type-variables in a polymorphic function's type, by their index."
"In the example below, 0 corresponds to the 'a' variable."
(def: .public (of_list list)
(All [a] (-> (List a) (Row a)))
@@ -5632,7 +5642,7 @@
(case tokens
(^ (list [_ (#Nat idx)]))
(do meta_monad
- [stvs get_scope_type_vars]
+ [stvs ..scope_type_vars]
(case (..item idx (list\reverse stvs))
(#Some var_id)
(in (list (` (#Ex (~ (nat$ var_id))))))
@@ -5643,14 +5653,14 @@
_
(failure (..wrong_syntax_error (name_of ..$)))))
-(def: .public (is? reference sample)
+(def: .public (same? reference sample)
{#.doc (example "Tests whether the 2 values are identical (not just 'equal')."
"This one should succeed:"
(let [value +5]
- (is? value value))
+ (same? value value))
"This one should fail:"
- (is? +5 (+ +2 +3)))}
+ (same? +5 (+ +2 +3)))}
(All [a] (-> a a Bit))
("lux is" reference sample))
@@ -5686,17 +5696,19 @@
_
(failure (..wrong_syntax_error (name_of ..^|>)))))
-(macro: .public (:assume tokens)
+(macro: .public (:expected tokens)
{#.doc (example "Coerces the given expression to the type of whatever is expected."
- (: Dinosaur (:assume (list +1 +2 +3))))}
+ (: Dinosaur
+ (:expected (: (List Nat)
+ (list 1 2 3)))))}
(case tokens
(^ (list expr))
(do meta_monad
- [type get_expected_type]
+ [type ..expected_type]
(in (list (` ("lux type as" (~ (type_code type)) (~ expr))))))
_
- (failure (..wrong_syntax_error (name_of ..:assume)))))
+ (failure (..wrong_syntax_error (name_of ..:expected)))))
(def: location
{#.doc "The location of the current expression being analyzed."}
@@ -5823,9 +5835,21 @@
(failure (..wrong_syntax_error (name_of ..template:)))))
(macro: .public (as_is tokens compiler)
+ {#.doc (example "Given a (potentially empty) list of codes, just returns them immediately, without any work done."
+ "This may seen useless, but it has its utility when dealing with controlled-macro-expansion macros."
+ (with_expansions [<operands> (as_is 1
+ 2
+ 3
+ 4)]
+ (+ <operands>)))}
(#Right [compiler tokens]))
(macro: .public (char tokens compiler)
+ {#.doc (example "If given a 1-character text literal, yields the char-code of the sole character."
+ (: Nat
+ (char "A"))
+ "=>"
+ 65)}
(case tokens
(^multi (^ (list [_ (#Text input)]))
(|> input "lux text size" ("lux i64 =" 1)))
@@ -5886,6 +5910,12 @@
(target_pick target options' default)))))
(macro: .public (for tokens)
+ {#.doc (example "Selects the appropriate code for a given target-platform when compiling Lux to it."
+ (def: js "JavaScript")
+ (for {"JVM" (do jvm stuff)
+ ..js (do js stuff)}
+ (do default stuff))
+ "Look-up the available targets in library/lux/target.")}
(do meta_monad
[target ..target]
(case tokens
@@ -5940,6 +5970,10 @@
(in_meta [(list) code])))
(macro: .public (`` tokens)
+ {#.doc (example "Delimits a controlled (spliced) macro-expansion."
+ "Uses a (~~) special form to specify where to expand."
+ (`` (some expression
+ (~~ (some macro which may yield 0 or more results)))))}
(case tokens
(^ (list raw))
(do meta_monad
@@ -6033,6 +6067,14 @@
)))
(macro: .public (^code tokens)
+ {#.doc (example "Generates pattern-matching code for Code values in a way that looks like code-templating."
+ (: (Maybe Nat)
+ (case (` (#0 123 +456.789))
+ (^code (#0 (~ [_ (#.Nat number)]) +456.789))
+ (#.Some number)
+
+ _
+ #.None)))}
(case tokens
(^ (list& [_meta (#Form (list template))] body branches))
(do meta_monad
@@ -6048,14 +6090,19 @@
(failure (..wrong_syntax_error (name_of ..^code)))))
(def: .public false
+ {#.doc "The boolean FALSE value."}
Bit
#0)
(def: .public true
+ {#.doc "The boolean TRUE value."}
Bit
#1)
(macro: .public (:let tokens)
+ {#.doc (example "Local bindings for types."
+ (:let [side (Either Int Frac)]
+ (List [side side])))}
(case tokens
(^ (list [_ (#Tuple bindings)] bodyT))
(if (multiple? 2 (list\size bindings))
@@ -6071,12 +6118,17 @@
(..failure (..wrong_syntax_error (name_of ..:let)))))
(macro: .public (try tokens)
- {#.doc (example (case (try (risky_computation input))
- (#.Right success)
- (do_something success)
-
- (#.Left error)
- (recover_from_failure error)))}
+ {#.doc (example (: Foo
+ (case (: (Either Text Bar)
+ (try (: Bar
+ (risky computation which may panic))))
+ (#.Right success)
+ (: Foo
+ (do something after success))
+
+ (#.Left error)
+ (: Foo
+ (recover from error)))))}
(case tokens
(^ (list expression))
(do meta_monad
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 622bb213b..2dbcfda97 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -113,8 +113,8 @@
(syntax: .public (||> [commands (<>.some <code>.any)])
{#.doc (example "A self-contained sequence of concatenative instructions."
- (is? value
- (||> (..push sample)))
+ (same? value
+ (||> (..push sample)))
(||> (push 123)
dup
@@ -286,11 +286,11 @@
(def: .public if
{#.doc (example "If expression."
- (is? "then"
- (||> (push true)
- (push "then")
- (push "else")
- if)))}
+ (same? "then"
+ (||> (push true)
+ (push "then")
+ (push "else")
+ if)))}
(All [___a ___z]
(=> {then (=> ___a ___z)
else (=> ___a ___z)}
diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux
index 0f42393ee..07e2640f8 100644
--- a/stdlib/source/library/lux/control/concurrency/atom.lux
+++ b/stdlib/source/library/lux/control/concurrency/atom.lux
@@ -76,7 +76,7 @@
(for {@.old <jvm>
@.jvm <jvm>}
(let [old (<read> 0 (:representation atom))]
- (if (is? old current)
+ (if (same? old current)
(exec (<write> 0 new (:representation atom))
true)
false))))))
diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux
index 97ed9bf6c..676aa0b8a 100644
--- a/stdlib/source/library/lux/control/concurrency/frp.lux
+++ b/stdlib/source/library/lux/control/concurrency/frp.lux
@@ -47,7 +47,7 @@
... Someone else interacted with the sink.
(do !
[latter (atom.read! sink)]
- (if (is? current latter)
+ (if (same? current latter)
... Someone else closed the sink.
(in (exception.except ..channel_is_already_closed []))
... Someone else fed the sink while I was closing it.
@@ -73,7 +73,7 @@
... Someone else interacted with the sink.
(do !
[latter (atom.read! sink)]
- (if (is? current latter)
+ (if (same? current latter)
... Someone else closed the sink while I was feeding it.
(in (exception.except ..channel_is_already_closed []))
... Someone else fed the sink.
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index 55d87e6cd..789c0a28f 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -85,7 +85,7 @@
(update@ #open_positions inc)
(update@ #waiting_list queue.pop))))
semaphore)]
- (if (is? pre post)
+ (if (same? pre post)
(in (exception.except ..semaphore_is_maxed_out [(get@ #max_positions pre)]))
(do !
[_ (case (queue.peek (get@ #waiting_list pre))
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux
index e76d80b6a..7e57abc62 100644
--- a/stdlib/source/library/lux/control/concurrency/stm.lux
+++ b/stdlib/source/library/lux/control/concurrency/stm.lux
@@ -41,7 +41,7 @@
(All [a] (-> (Sink a) (Var a) (IO Any)))
(do io.monad
[_ (atom.update! (function (_ [value observers])
- [value (list.only (|>> (is? sink) not) observers)])
+ [value (list.only (|>> (same? sink) not) observers)])
(:representation var))]
(in [])))
@@ -92,13 +92,12 @@
(def: (var_value var tx)
(All [a] (-> (Var a) Tx (Maybe a)))
(|> tx
- (list.find (function (_ [_var _original _current])
- (is? (:as (Var Any) var)
- (:as (Var Any) _var))))
+ (list.example (function (_ [_var _original _current])
+ (same? (:as (Var Any) var)
+ (:as (Var Any) _var))))
(\ maybe.monad map (function (_ [_var _original _current])
_current))
- (:assume)
- ))
+ :expected))
(def: .public (read var)
(All [a] (-> (Var a) (STM a)))
@@ -119,8 +118,8 @@
#.End
(#.Item [_var _original _current] tx')
- (if (is? (:as (Var Any) var)
- (:as (Var Any) _var))
+ (if (same? (:as (Var Any) var)
+ (:as (Var Any) _var))
(#.Item {#var (:as (Var Any) _var)
#original (:as Any _original)
#current (:as Any value)}
@@ -187,12 +186,12 @@
(def: (can_commit? tx)
(-> Tx Bit)
(list.every? (function (_ [_var _original _current])
- (is? _original (..read! _var)))
+ (same? _original (..read! _var)))
tx))
(def: (commit_var! [_var _original _current])
(-> (Ex [a] (Tx_Frame a)) (IO Any))
- (if (is? _original _current)
+ (if (same? _original _current)
(io [])
(..write! _current _var)))
diff --git a/stdlib/source/library/lux/control/function.lux b/stdlib/source/library/lux/control/function.lux
index 2f31e896a..d0bc286ae 100644
--- a/stdlib/source/library/lux/control/function.lux
+++ b/stdlib/source/library/lux/control/function.lux
@@ -7,8 +7,8 @@
(def: .public identity
{#.doc (example "Identity function."
"Does nothing to its argument and just returns it."
- (is? (identity value)
- value))}
+ (same? (identity value)
+ value))}
(All [a] (-> a a))
(|>>))
@@ -27,9 +27,9 @@
(All [o] (-> o (All [i] (-> i o))))
(function (_ _) value))
-(def: .public (flip f)
+(def: .public (flipped f)
{#.doc (example "Flips the order of the arguments of a function."
- (= ((flip f) "foo" "bar")
+ (= ((flipped f) "foo" "bar")
(f "bar" "foo")))}
(All [a b c]
(-> (-> a b c) (-> b a c)))
diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux
index ae8c4e9bf..ee20672b1 100644
--- a/stdlib/source/library/lux/control/function/memo.lux
+++ b/stdlib/source/library/lux/control/function/memo.lux
@@ -22,7 +22,7 @@
(function (_ input)
(do {! state.monad}
[memory state.get]
- (case (dictionary.get input memory)
+ (case (dictionary.value input memory)
(#.Some output)
(in output)
diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux
index 5358da9ca..e12febdf3 100644
--- a/stdlib/source/library/lux/control/parser/environment.lux
+++ b/stdlib/source/library/lux/control/parser/environment.lux
@@ -36,7 +36,7 @@
(def: .public (property name)
(-> Property (Parser Text))
(function (_ environment)
- (case (dictionary.get name environment)
+ (case (dictionary.value name environment)
(#.Some value)
(#try.Success [environment value])
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 964513f24..3dfea1a30 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -256,7 +256,7 @@
"Parses a type exactly."]
[sub check.subsumes?
"Parses a sub type."]
- [super (function.flip check.subsumes?)
+ [super (function.flipped check.subsumes?)
"Parses a super type."]
)
@@ -274,7 +274,7 @@
headT any]
(case headT
(#.Parameter idx)
- (case (dictionary.get (adjusted_idx env idx) env)
+ (case (dictionary.value (adjusted_idx env idx) env)
(#.Some [poly_type poly_code])
(in poly_code)
@@ -351,7 +351,7 @@
(case (type.anonymous headT)
(^multi (^ (#.Apply (|nothing|) (#.Parameter funcT_idx)))
(n.= 0 (adjusted_idx env funcT_idx))
- {(dictionary.get 0 env) (#.Some [self_type self_call])})
+ {(dictionary.value 0 env) (#.Some [self_type self_call])})
(in self_call)
_
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux
index 6e7dfe3e1..5785ecba8 100644
--- a/stdlib/source/library/lux/control/parser/xml.lux
+++ b/stdlib/source/library/lux/control/parser/xml.lux
@@ -91,7 +91,7 @@
{#.doc (example "Yields the value of an attribute in the current node.")}
(-> Attribute (Parser Text))
(function (_ [attrs documents])
- (case (dictionary.get name attrs)
+ (case (dictionary.value name attrs)
#.None
(exception.except ..unknown_attribute [name (dictionary.keys attrs)])
diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux
index 4d31c2035..66d3f2a06 100644
--- a/stdlib/source/library/lux/control/pipe.lux
+++ b/stdlib/source/library/lux/control/pipe.lux
@@ -74,13 +74,13 @@
else body^
prev <code>.any])
{#.doc (example "If-branching."
- (is? (if (n.even? sample)
- "even"
- "odd")
- (|> sample
- (if> [n.even?]
- [(new> "even" [])]
- [(new> "odd" [])]))))}
+ (same? (if (n.even? sample)
+ "even"
+ "odd")
+ (|> sample
+ (if> [n.even?]
+ [(new> "even" [])]
+ [(new> "odd" [])]))))}
(in (list (` (cond> [(~+ test)] [(~+ then)]
[(~+ else)]
(~ prev))))))
@@ -89,12 +89,12 @@
then body^
prev <code>.any])
{#.doc (example "Only execute the body when the test passes."
- (is? (if (n.even? sample)
- (n.* 2 sample)
- sample)
- (|> sample
- (when> [n.even?]
- [(n.* 2)]))))}
+ (same? (if (n.even? sample)
+ (n.* 2 sample)
+ sample)
+ (|> sample
+ (when> [n.even?]
+ [(n.* 2)]))))}
(in (list (` (cond> [(~+ test)] [(~+ then)]
[]
(~ prev))))))
diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux
index cebf0534e..3762c6e8f 100644
--- a/stdlib/source/library/lux/control/security/capability.lux
+++ b/stdlib/source/library/lux/control/security/capability.lux
@@ -59,7 +59,7 @@
(function (_ value)
[value value]))
[left right] (..use capability 123)]
- (is? left right)))}
+ (same? left right)))}
(do {! meta.monad}
[this_module meta.current_module_name
.let [[name vars] declaration]
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index af865d541..a141fad68 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- list)
+ [lux (#- list example)
["@" target]
[abstract
[monoid (#+ Monoid)]
@@ -37,17 +37,17 @@
(as_is))
(def: .public (empty size)
- {#.doc (example "An empty array of the specified size.")}
+ {#.doc (.example "An empty array of the specified size.")}
(All [a] (-> Nat (Array a)))
(for {@.old
- (:assume ("jvm anewarray" "(java.lang.Object )" size))
+ (:expected ("jvm anewarray" "(java.lang.Object )" size))
@.jvm
(|> size
!int
"jvm array new object"
(: <array_type>)
- :assume)
+ :expected)
@.js ("js array new" size)
@.python ("python array new" size)
@@ -99,7 +99,7 @@
("jvm array read object" (!int index)))]
(if ("jvm object null?" value)
#.None
- (#.Some (:assume value))))
+ (#.Some (:expected value))))
@.js (!read "js array read" "js object undefined?")
@.python (!read "python array read" "python object none?")
@@ -110,7 +110,7 @@
#.None))
(def: .public (write! index value array)
- {#.doc (example "Mutate the array by writing a value to the specified index.")}
+ {#.doc (.example "Mutate the array by writing a value to the specified index.")}
(All [a]
(-> Nat a (Array a) (Array a)))
(for {@.old
@@ -120,7 +120,7 @@
(|> array
(:as <array_type>)
("jvm array write object" (!int index) (:as <elem_type> value))
- :assume)
+ :expected)
@.js ("js array write" index value array)
@.python ("python array write" index value array)
@@ -130,15 +130,15 @@
@.scheme ("scheme array write" index value array)}))
(def: .public (delete! index array)
- {#.doc (example "Mutate the array by deleting the value at the specified index.")}
+ {#.doc (.example "Mutate the array by deleting the value at the specified index.")}
(All [a]
(-> Nat (Array a) (Array a)))
(if (n.< (size array) index)
(for {@.old
- (write! index (:assume ("jvm object null")) array)
+ (write! index (:expected ("jvm object null")) array)
@.jvm
- (write! index (:assume (: <elem_type> ("jvm object null"))) array)
+ (write! index (:expected (: <elem_type> ("jvm object null"))) array)
@.js ("js array delete" index array)
@.python ("python array delete" index array)
@@ -160,7 +160,7 @@
false))
(def: .public (update! index transform array)
- {#.doc (example "Mutate the array by updating the value at the specified index.")}
+ {#.doc (.example "Mutate the array by updating the value at the specified index.")}
(All [a]
(-> Nat (-> a a) (Array a) (Array a)))
(case (read index array)
@@ -171,8 +171,8 @@
(write! index (transform value) array)))
(def: .public (upsert! index default transform array)
- {#.doc (example "Mutate the array by updating the value at the specified index."
- "If there is no value, update and write the default value given.")}
+ {#.doc (.example "Mutate the array by updating the value at the specified index."
+ "If there is no value, update and write the default value given.")}
(All [a]
(-> Nat a (-> a a) (Array a) (Array a)))
(write! index
@@ -180,7 +180,7 @@
array))
(def: .public (copy! length src_start src_array dest_start dest_array)
- {#.doc (example "Writes the contents of one array into the other.")}
+ {#.doc (.example "Writes the contents of one array into the other.")}
(All [a]
(-> Nat Nat (Array a) Nat (Array a)
(Array a)))
@@ -215,7 +215,7 @@
(n.- (..occupancy array) (..size array)))
(def: .public (filter! p xs)
- {#.doc (example "Delete every item of the array that fails to satisfy the predicate.")}
+ {#.doc (.example "Delete every item of the array that fails to satisfy the predicate.")}
(All [a]
(-> (Predicate a) (Array a) (Array a)))
(list\fold (function (_ idx xs')
@@ -230,8 +230,8 @@
xs
(list.indices (size xs))))
-(def: .public (find p xs)
- {#.doc (example "Yields the first item in the array that satisfies the predicate.")}
+(def: .public (example p xs)
+ {#.doc (.example "Yields the first item in the array that satisfies the predicate.")}
(All [a]
(-> (Predicate a) (Array a) (Maybe a)))
(let [arr_size (size xs)]
@@ -247,8 +247,8 @@
(recur (inc idx))))
#.None))))
-(def: .public (find+ p xs)
- {#.doc "Just like 'find', but with access to the index of each value."}
+(def: .public (example+ p xs)
+ {#.doc "Just like 'example', but with access to the index of each value."}
(All [a]
(-> (-> Nat a Bit) (Array a) (Maybe [Nat a])))
(let [arr_size (size xs)]
@@ -265,7 +265,7 @@
#.None))))
(def: .public (clone xs)
- {#.doc (example "Yields a shallow clone of the array.")}
+ {#.doc (.example "Yields a shallow clone of the array.")}
(All [a] (-> (Array a) (Array a)))
(let [arr_size (size xs)]
(list\fold (function (_ idx ys)
@@ -290,7 +290,7 @@
(dec 0))
(def: .public (list array)
- {#.doc (example "Yields a list with every non-empty item in the array.")}
+ {#.doc (.example "Yields a list with every non-empty item in the array.")}
(All [a] (-> (Array a) (List a)))
(loop [idx (dec (size array))
output #.End]
@@ -308,7 +308,7 @@
output)))))
(def: .public (list' default array)
- {#.doc (example "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")}
+ {#.doc (.example "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")}
(All [a] (-> a (Array a) (List a)))
(loop [idx (dec (size array))
output #.End]
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index d7063ac08..ef10e0f6d 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -48,13 +48,13 @@
(-> Bits Bit)
(|>> ..size (n.= 0)))
-(def: .public (get index bits)
+(def: .public (bit index bits)
(-> Nat Bits Bit)
(let [[chunk_index bit_index] (n./% chunk_size index)]
(.and (n.< (array.size bits) chunk_index)
(|> (array.read chunk_index bits)
(maybe.else empty_chunk)
- (i64.set? bit_index)))))
+ (i64.one? bit_index)))))
(def: (chunk idx bits)
(-> Nat Bits Chunk)
@@ -84,16 +84,16 @@
no_op)
chunk
- (|> (if (is? ..empty output)
+ (|> (if (same? ..empty output)
(: Bits (array.empty size|output))
output)
(array.write! idx|output (.i64 chunk))
(recur (dec size|output))))
output)))))]
- [set i64.set]
- [clear i64.clear]
- [flip i64.flip]
+ [one i64.one]
+ [zero i64.zero]
+ [flipped i64.flipped]
)
(def: .public (intersects? reference sample)
@@ -125,7 +125,7 @@
chunk
(if (n.> 0 size|output)
- (|> (if (is? ..empty output)
+ (|> (if (same? ..empty output)
(: Bits (array.empty size|output))
output)
(array.write! idx (.i64 chunk))
@@ -152,7 +152,7 @@
(recur (dec size|output) output)
chunk
- (|> (if (is? ..empty output)
+ (|> (if (same? ..empty output)
(: Bits (array.empty size|output))
output)
(array.write! idx (.i64 chunk))
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index 3d0e729ce..642b19b57 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -226,9 +226,9 @@
(def: (collision_index key_hash key colls)
(All [k v] (-> (Hash k) k (Collisions k v) (Maybe Index)))
(\ maybe.monad map product.left
- (array.find+ (function (_ idx [key' val'])
- (\ key_hash = key key'))
- colls)))
+ (array.example+ (function (_ idx [key' val'])
+ (\ key_hash = key key'))
+ colls)))
... When #Hierarchy nodes grow too small, they're demoted to #Base
... nodes to save space.
@@ -405,7 +405,7 @@
(#.Some sub_node)
(let [sub_node' (lacks' (level_up level) hash key key_hash sub_node)]
... Then check if a removal was actually done.
- (if (is? sub_node sub_node')
+ (if (same? sub_node sub_node')
... If not, then there's nothing to change here either.
node
... But if the sub_removal yielded an empty sub_node...
@@ -431,7 +431,7 @@
(#.Some (#.Left sub_node))
(let [sub_node' (lacks' (level_up level) hash key key_hash sub_node)]
... Verify that it was removed.
- (if (is? sub_node sub_node')
+ (if (same? sub_node sub_node')
... If not, there's also nothing to change here.
node
... But if it came out empty...
@@ -481,14 +481,14 @@
(#Collisions _hash (lacks! idx _colls))))
))
-(def: (get' level hash key key_hash node)
+(def: (value' level hash key key_hash node)
(All [k v] (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v)))
(case node
... For #Hierarchy nodes, just look-up the key on its children.
(#Hierarchy _size hierarchy)
(case (array.read (level_index level hash) hierarchy)
#.None #.None
- (#.Some sub_node) (get' (level_up level) hash key key_hash sub_node))
+ (#.Some sub_node) (value' (level_up level) hash key key_hash sub_node))
... For #Base nodes, check the leaves, and recursively check the branches.
(#Base bitmap base)
@@ -496,7 +496,7 @@
(if (with_bit_position? bit bitmap)
(case (array.read (base_index bit bitmap) base)
(#.Some (#.Left sub_node))
- (get' (level_up level) hash key key_hash sub_node)
+ (value' (level_up level) hash key key_hash sub_node)
(#.Some (#.Right [key' val']))
(if (\ key_hash = key key')
@@ -510,8 +510,8 @@
... For #Collisions nodes, do a linear scan of all the known KV-pairs.
(#Collisions _hash _colls)
(\ maybe.monad map product.right
- (array.find (|>> product.left (\ key_hash = key))
- _colls))
+ (array.example (|>> product.left (\ key_hash = key))
+ _colls))
))
(def: (size' node)
@@ -580,14 +580,14 @@
(let [[key_hash node] dict]
[key_hash (lacks' root_level (\ key_hash hash key) key key_hash node)]))
-(def: .public (get key dict)
+(def: .public (value key dict)
(All [k v] (-> k (Dictionary k v) (Maybe v)))
(let [[key_hash node] dict]
- (get' root_level (\ key_hash hash key) key key_hash node)))
+ (value' root_level (\ key_hash hash key) key key_hash node)))
(def: .public (key? dict key)
(All [k v] (-> (Dictionary k v) k Bit))
- (case (get key dict)
+ (case (value key dict)
#.None #0
(#.Some _) #1))
@@ -596,14 +596,14 @@
(def: .public (try_put key val dict)
{#.doc "Only puts the KV-pair if the key is not already present."}
(All [k v] (-> k v (Dictionary k v) (Try (Dictionary k v))))
- (case (get key dict)
+ (case (value key dict)
#.None (#try.Success (has key val dict))
(#.Some _) (exception.except ..key_already_exists [])))
(def: .public (revised key f dict)
{#.doc "Transforms the value located at key (if available), using the given function."}
(All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v)))
- (case (get key dict)
+ (case (value key dict)
#.None
dict
@@ -616,7 +616,7 @@
(All [k v] (-> k v (-> v v) (Dictionary k v) (Dictionary k v)))
(..has key
(f (maybe.else default
- (..get key dict)))
+ (..value key dict)))
dict))
(def: .public size
@@ -663,7 +663,7 @@
"If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.")}
(All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v)))
(list\fold (function (_ [key val2] dict)
- (case (get key dict)
+ (case (value key dict)
#.None
(has key val2 dict)
@@ -675,7 +675,7 @@
(def: .public (re_bind from_key to_key dict)
{#.doc (example "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'.")}
(All [k v] (-> k k (Dictionary k v) (Dictionary k v)))
- (case (get from_key dict)
+ (case (value from_key dict)
#.None
dict
@@ -689,7 +689,7 @@
(All [k v] (-> (List k) (Dictionary k v) (Dictionary k v)))
(let [[key_hash _] dict]
(list\fold (function (_ key new_dict)
- (case (get key dict)
+ (case (value key dict)
#.None new_dict
(#.Some val) (has key val new_dict)))
(empty key_hash)
@@ -702,7 +702,7 @@
(and (n.= (..size reference)
(..size subject))
(list.every? (function (_ [k rv])
- (case (..get k subject)
+ (case (..value k subject)
(#.Some sv)
(,\= rv sv)
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index d4516f8d1..e6b05bf51 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -58,7 +58,7 @@
... TODO: Doing inneficient access of Order functions due to compiler bug.
... TODO: Must improve it as soon as bug is fixed.
-(def: .public (get key dict)
+(def: .public (value key dict)
(All [k v] (-> k (Dictionary k v) (Maybe v)))
(let [... (^open "_\.") (get@ #&order dict)
]
@@ -264,7 +264,7 @@
[(<comp> reference key)
(let [side_root (get@ <tag> root)
outcome (recur side_root)]
- (if (is? side_root outcome)
+ (if (same? side_root outcome)
?root
(#.Some (<add> (maybe.assume outcome)
root))))]
@@ -530,7 +530,7 @@
(def: .public (revised key transform dict)
(All [k v] (-> k (-> v v) (Dictionary k v) (Dictionary k v)))
- (case (..get key dict)
+ (case (..value key dict)
(#.Some old)
(..has key (transform old) dict)
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index 88ea21f79..c56994d6c 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -30,7 +30,7 @@
(All [a] (-> (PList a) Bit))
(|>> ..size (n.= 0)))
-(def: .public (get key properties)
+(def: .public (value key properties)
(All [a] (-> Text (PList a) (Maybe a)))
(case properties
#.End
@@ -39,7 +39,7 @@
(#.Item [k' v'] properties')
(if (text\= key k')
(#.Some v')
- (get key properties'))))
+ (value key properties'))))
(template [<name> <type> <access>]
[(def: .public <name>
@@ -52,7 +52,7 @@
(def: .public (contains? key properties)
(All [a] (-> Text (PList a) Bit))
- (case (..get key properties)
+ (case (..value key properties)
(#.Some _)
true
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index 6174f1ea6..ff5a1fe12 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux #*
+ [lux (#- example)
["@" target]
[abstract
[monoid (#+ Monoid)]
@@ -51,7 +51,7 @@
xs))
(def: .public (only keep? xs)
- {#.doc (example "A list with only values that satisfy the predicate.")}
+ {#.doc (.example "A list with only values that satisfy the predicate.")}
(All [a]
(-> (Predicate a) (List a) (List a)))
(case xs
@@ -77,8 +77,8 @@
[in (#.Item head out)]))))
(def: .public (pairs xs)
- {#.doc (example "Cut the list into pairs of 2."
- "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.")}
+ {#.doc (.example "Cut the list into pairs of 2."
+ "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.")}
(All [a] (-> (List a) (List [a a])))
(case xs
(^ (list& x1 x2 xs'))
@@ -117,8 +117,8 @@
<then>
<else>)))]
- [take_while (#.Item x (take_while predicate xs')) #.End]
- [drop_while (drop_while predicate xs') xs]
+ [while (#.Item x (while predicate xs')) #.End]
+ [until (until predicate xs') xs]
)
(def: .public (split n xs)
@@ -134,7 +134,7 @@
[(#.Item x tail) rest]))
[#.End xs]))
-(def: (split_with' predicate ys xs)
+(def: (split_when' predicate ys xs)
(All [a]
(-> (Predicate a) (List a) (List a) [(List a) (List a)]))
(case xs
@@ -143,14 +143,14 @@
(#.Item x xs')
(if (predicate x)
- (split_with' predicate (#.Item x ys) xs')
- [ys xs])))
+ [ys xs]
+ (split_when' predicate (#.Item x ys) xs'))))
-(def: .public (split_with predicate xs)
+(def: .public (split_when predicate xs)
{#.doc "Segment the list by using a predicate to tell when to cut."}
(All [a]
(-> (Predicate a) (List a) [(List a) (List a)]))
- (let [[ys' xs'] (split_with' predicate #.End xs)]
+ (let [[ys' xs'] (split_when' predicate #.End xs)]
[(reversed ys') xs']))
(def: .public (sub size list)
@@ -234,7 +234,7 @@
#.None
(all check xs')))))
-(def: .public (find predicate xs)
+(def: .public (example predicate xs)
{#.doc "Yields the first value in the list that satisfies the predicate."}
(All [a]
(-> (Predicate a) (List a) (Maybe a)))
@@ -376,7 +376,7 @@
(|>> reversed (fold compose identity))))
(def: .public (sorted < xs)
- {#.doc (example "A list ordered by a comparison function.")}
+ {#.doc (.example "A list ordered by a comparison function.")}
(All [a] (-> (-> a a Bit) (List a) (List a)))
(case xs
#.End
@@ -459,11 +459,11 @@
(recur input' output')))))
(macro: .public (zipped tokens state)
- {#.doc (example "Create list zippers with the specified number of input lists."
- (def: .public zipped/2 (zipped 2))
- (def: .public zipped/3 (zipped 3))
- (zipped/3 xs ys zs)
- ((zipped 3) xs ys zs))}
+ {#.doc (.example "Create list zippers with the specified number of input lists."
+ (def: .public zipped/2 (zipped 2))
+ (def: .public zipped/3 (zipped 3))
+ (zipped/3 xs ys zs)
+ ((zipped 3) xs ys zs))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
@@ -504,11 +504,11 @@
(def: .public zipped/3 (zipped 3))
(macro: .public (zipped_with tokens state)
- {#.doc (example "Create list zippers with the specified number of input lists."
- (def: .public zipped_with/2 (zipped_with 2))
- (def: .public zipped_with/3 (zipped_with 3))
- (zipped_with/2 + xs ys)
- ((zipped_with 2) + xs ys))}
+ {#.doc (.example "Create list zippers with the specified number of input lists."
+ (def: .public zipped_with/2 (zipped_with 2))
+ (def: .public zipped_with/3 (zipped_with 3))
+ (zipped_with/2 + xs ys)
+ ((zipped_with 2) + xs ys))}
(case tokens
(^ (list [_ (#.Nat num_lists)]))
(if (n.> 0 num_lists)
@@ -564,8 +564,8 @@
(last xs')))
(def: .public (inits xs)
- {#.doc (example "For a list of size N, yields the first N-1 elements."
- "Will yield a #.None for empty lists.")}
+ {#.doc (.example "For a list of size N, yields the first N-1 elements."
+ "Will yield a #.None for empty lists.")}
(All [a] (-> (List a) (Maybe (List a))))
(case xs
#.End
@@ -584,12 +584,12 @@
))
(def: .public joined
- {#.doc (example "The sequential combination of all the lists.")}
+ {#.doc (.example "The sequential combination of all the lists.")}
(All [a] (-> (List (List a)) (List a)))
(\ ..monad join))
(implementation: .public (with monad)
- {#.doc (example "Enhances a monad with List functionality.")}
+ {#.doc (.example "Enhances a monad with List functionality.")}
(All [M] (-> (Monad M) (Monad (All [a] (M (List a))))))
(def: &functor (functor.compose (get@ #monad.&functor monad) ..functor))
@@ -607,7 +607,7 @@
(in (..joined lla)))))
(def: .public (lift monad)
- {#.doc (example "Wraps a monadic value with List machinery.")}
+ {#.doc (.example "Wraps a monadic value with List machinery.")}
(All [M a] (-> (Monad M) (-> (M a) (M (List a)))))
(\ monad map (\ ..monad in)))
@@ -624,11 +624,11 @@
(#.Item [idx x] (recur (inc idx) xs')))))
(macro: .public (when tokens state)
- {#.doc (example "Can be used as a guard in (co)monadic be/do expressions."
- (do monad
- [value (do_something 1 2 3)
- ..when (passes_test? value)]
- (do_something_else 4 5 6)))}
+ {#.doc (.example "Can be used as a guard in (co)monadic be/do expressions."
+ (do monad
+ [value (do_something 1 2 3)
+ ..when (passes_test? value)]
+ (do_something_else 4 5 6)))}
(case tokens
(^ (.list test then))
(#.Right [state (.list (` (.if (~ test)
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index c8049c3b3..6264d6083 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -66,12 +66,12 @@
0 head
_ (item (dec idx) tail))))
-(template [<taker> <dropper> <splitter> <pred_type> <pred_test> <pred_step>]
+(template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>]
[(def: .public (<taker> pred xs)
(All [a]
(-> <pred_type> (Sequence a) (List a)))
(let [[x xs'] (//.result xs)]
- (if <pred_test>
+ (if (<post_test> <pred_test>)
(list& x (<taker> <pred_step> xs'))
(list))))
@@ -79,21 +79,26 @@
(All [a]
(-> <pred_type> (Sequence a) (Sequence a)))
(let [[x xs'] (//.result xs)]
- (if <pred_test>
+ (if (<post_test> <pred_test>)
(<dropper> <pred_step> xs')
- xs)))
+ xs)))]
+
+ [while until (-> a Bit) (pred x) pred |>]
+ [take drop Nat (n.= 0 pred) (dec pred) not]
+ )
- (def: .public (<splitter> pred xs)
+(template [<splitter> <pred_type> <pred_test> <pred_step>]
+ [(def: .public (<splitter> pred xs)
(All [a]
(-> <pred_type> (Sequence a) [(List a) (Sequence a)]))
(let [[x xs'] (//.result xs)]
(if <pred_test>
+ [(list) xs]
(let [[tail next] (<splitter> <pred_step> xs')]
- [(#.Item [x tail]) next])
- [(list) xs])))]
+ [(#.Item [x tail]) next]))))]
- [take_while drop_while split_while (-> a Bit) (pred x) pred]
- [take drop split Nat (n.> 0 pred) (dec pred)]
+ [split_when (-> a Bit) (pred x) pred]
+ [split Nat (n.= 0 pred) (dec pred)]
)
(def: .public (unfold step init)
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index 8211134e1..46f395b21 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -44,7 +44,7 @@
(All [a] (-> Nat a (Set a) (Set a)))
(case multiplicity
0 set
- _ (case (dictionary.get elem (:representation set))
+ _ (case (dictionary.value elem (:representation set))
(#.Some current)
(:abstraction
(if (n.> multiplicity current)
@@ -56,7 +56,7 @@
(def: .public (multiplicity set elem)
(All [a] (-> (Set a) a Nat))
- (|> set :representation (dictionary.get elem) (maybe.else 0)))
+ (|> set :representation (dictionary.value elem) (maybe.else 0)))
(def: .public list
(All [a] (-> (Set a) (List a)))
@@ -159,4 +159,4 @@
(def: .public super?
{#.doc (example "Is 'subject' a super-set of 'reference'?")}
(All [a] (-> (Set a) (Set a) Bit))
- (function.flip sub?))
+ (function.flipped sub?))
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index e9288ecff..d86deb7e5 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -113,7 +113,7 @@
(-> Combinator (Selector Any) (CSS Common) (CSS Common))
(|> css
:representation
- (text.split_all_with ..css_separator)
+ (text.all_split_by ..css_separator)
(list\map (|>> (format (/selector.selector (|> selector (combinator (/selector.tag "")))))))
(text.join_with ..css_separator)
:abstraction))
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index 50bbb160d..1bee5183d 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- or and for is? not)
+ [lux (#- or and for same? not)
[data
["." text
["%" format (#+ format)]]
@@ -95,7 +95,7 @@
(-> Attribute Text (Selector Can_Chain))
(:abstraction (format "[" attribute <check> value "]")))]
- ["=" is?]
+ ["=" same?]
["~=" has?]
["|=" has_start?]
["^=" starts?]
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 34ab99976..3c3566a56 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -300,7 +300,7 @@
(#.Item head tail)
(..tag "map" attributes
- (list\fold (function.flip ..and) head tail)))))
+ (list\fold (function.flipped ..and) head tail)))))
(template [<name> <tag> <type>]
[(def: .public <name>
@@ -465,7 +465,7 @@
(#.Item head tail)
(..tag "dl" attributes
- (list\fold (function.flip ..and) head tail))))
+ (list\fold (function.flipped ..and) head tail))))
(def: .public p ..paragraph)
@@ -524,7 +524,7 @@
(#.Item first rest)
(..and head
(..table_body
- (list\fold (function.flip ..and) first rest))))
+ (list\fold (function.flipped ..and) first rest))))
content (case footer
#.None
content
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 55b1cd6e0..45ac870c0 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -120,12 +120,12 @@
_
(#try.Failure ($_ text\compose "Cannot get the fields of a non-object."))))
-(def: .public (get key json)
+(def: .public (field key json)
{#.doc "A JSON object field getter."}
(-> String JSON (Try JSON))
(case json
(#Object obj)
- (case (dictionary.get key obj)
+ (case (dictionary.value key obj)
(#.Some value)
(#try.Success value)
@@ -135,7 +135,7 @@
_
(#try.Failure ($_ text\compose "Cannot get field '" key "' on a non-object."))))
-(def: .public (set key value json)
+(def: .public (has key value json)
{#.doc "A JSON object field setter."}
(-> String JSON JSON (Try JSON))
(case json
@@ -149,7 +149,7 @@
[(def: .public (<name> key json)
{#.doc (code.text ($_ text\compose "A JSON object field getter for " <desc> "."))}
(-> Text JSON (Try <type>))
- (case (get key json)
+ (case (field key json)
(#try.Success (<tag> value))
(#try.Success value)
@@ -159,11 +159,11 @@
(#try.Failure error)
(#try.Failure error)))]
- [get_boolean #Boolean Boolean "booleans"]
- [get_number #Number Number "numbers"]
- [get_string #String String "strings"]
- [get_array #Array Array "arrays"]
- [get_object #Object Object "objects"]
+ [boolean_field #Boolean Boolean "booleans"]
+ [number_field #Number Number "numbers"]
+ [string_field #String String "strings"]
+ [array_field #Array Array "arrays"]
+ [object_field #Object Object "objects"]
)
(implementation: .public equivalence
@@ -197,7 +197,7 @@
(and (n.= (dictionary.size xs) (dictionary.size ys))
(list\fold (function (_ [xk xv] prev)
(and prev
- (case (dictionary.get xk ys)
+ (case (dictionary.value xk ys)
#.None #0
(#.Some yv) (= xv yv))))
#1
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index fba6167b9..08b26a686 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -88,7 +88,7 @@
(def: (prefix with)
(-> Text (-> Text Text))
- (|>> (text.split_all_with text.new_line)
+ (|>> (text.all_split_by text.new_line)
(list\map (function (_ line)
(if (text.empty? line)
line
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 0278235b0..8dd91b2ee 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -813,7 +813,7 @@
(do <>.monad
[header ..header_parser
_ (<>.assertion (exception.error ..wrong_link_flag [expected (get@ #link_flag header)])
- (is? expected (get@ #link_flag header)))
+ (same? expected (get@ #link_flag header)))
.let [size (get@ #size header)
rounded_size (..rounded_content_size size)]
content (<binary>.segment (..from_big size))
diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux
index 531a343b7..8373951c4 100644
--- a/stdlib/source/library/lux/data/name.lux
+++ b/stdlib/source/library/lux/data/name.lux
@@ -53,7 +53,7 @@
_ ($_ text\compose module ..separator short)))
(def: (decode input)
- (case (text.split_all_with ..separator input)
+ (case (text.all_split_by ..separator input)
(^ (list short))
(#.Right ["" short])
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 1d3bd0a57..096a968ee 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -163,7 +163,7 @@
_
#.None))
-(def: .public (split_with token sample)
+(def: .public (split_by token sample)
(-> Text Text (Maybe [Text Text]))
(do maybe.monad
[index (index_of token sample)
@@ -171,11 +171,11 @@
[_ post] (split (size token) post')]
(in [pre post])))
-(def: .public (split_all_with token sample)
+(def: .public (all_split_by token sample)
(-> Text Text (List Text))
(loop [input sample
output (: (List Text) (list))]
- (case (..split_with token input)
+ (case (..split_by token input)
(#.Some [pre post])
(|> output
(#.Item pre)
@@ -190,7 +190,7 @@
(-> Text Text Text Text)
(<| (maybe.else template)
(do maybe.monad
- [[pre post] (..split_with pattern template)]
+ [[pre post] (..split_by pattern template)]
(in ($_ "lux text concat" pre replacement post)))))
(def: .public (replaced pattern replacement template)
@@ -220,7 +220,7 @@
("ruby object do" "gsub" template pattern replacement))
@.php
(:as Text
- ("php apply" (:assume ("php constant" "str_replace"))
+ ("php apply" (:expected ("php constant" "str_replace"))
pattern replacement template))
... TODO @.scheme
... TODO @.common_lisp
@@ -229,7 +229,7 @@
... Inefficient default
(loop [left ""
right template]
- (case (..split_with pattern right)
+ (case (..split_by pattern right)
(#.Some [pre post])
(recur ($_ "lux text concat" left pre replacement) post)
diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux
index 60955ba63..0adb95c82 100644
--- a/stdlib/source/library/lux/data/text/encoding/utf8.lux
+++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux
@@ -91,7 +91,7 @@
)
@.python
- (:as Binary ("python apply" (:assume ("python constant" "bytearray")) value "utf-8"))
+ (:as Binary ("python apply" (:expected ("python constant" "bytearray")) value "utf-8"))
@.lua
("lua utf8 encode" value)
@@ -134,7 +134,7 @@
#try.Success))
@.python
- (try (:as Text ("python object do" "decode" (:assume value) "utf-8")))
+ (try (:as Text ("python object do" "decode" (:expected value) "utf-8")))
@.lua
(#try.Success ("lua utf8 decode" value))
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 6039bbcd8..234333bd8 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -292,7 +292,7 @@
(Object::to_s []))]]
(let [value_class (class_of value)]
(`` (cond (~~ (template [<literal> <type> <format>]
- [(is? (class_of <literal>) value_class)
+ [(same? (class_of <literal>) value_class)
(|> value (:as <type>) <format>)]
[#0 Bit %.bit]
@@ -303,7 +303,7 @@
[("ruby object nil") Any (new> "nil" [])]
))
- (is? (class_of #.None) value_class)
+ (same? (class_of #.None) value_class)
(let [variant_tag ("ruby object get" "_lux_tag" value)
variant_flag ("ruby object get" "_lux_flag" value)
variant_value ("ruby object get" "_lux_value" value)]
@@ -315,7 +315,7 @@
" " (inspection variant_value))
(text.enclosed ["(" ")"]))))
- (is? (class_of [[] []]) value_class)
+ (same? (class_of [[] []]) value_class)
(tuple_inspection inspection value)
... else
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux
index 9913664af..65665bcd3 100644
--- a/stdlib/source/library/lux/ffi.js.lux
+++ b/stdlib/source/library/lux/ffi.js.lux
@@ -152,7 +152,7 @@
(def: .public (null _)
{#.doc (example "The null pointer.")}
(-> Any Nothing)
- (:assume ("js object null")))
+ (:expected ("js object null")))
(def: .public null?
(-> Any Bit)
@@ -225,7 +225,7 @@
(~ (|> (nullable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_null g!temp outputT)
@@ -271,7 +271,7 @@
(All [(~+ class_parameters)]
(-> [(~+ (list\map nullable_type inputsT))]
(~ declaration)))
- (:assume
+ (:expected
("js object new"
("js constant" (~ (code.text real_class)))
[(~+ (list\map (with_null g!temp) g!inputs))])))))
@@ -287,7 +287,7 @@
(All [(~+ class_parameters)]
(-> (~ declaration)
(~ (nullable_type fieldT))))
- (:assume
+ (:expected
(~ (without_null g!temp fieldT (` ("js object get" (~ (code.text field)) (~ g!object)))))))))
(#Method method)
@@ -312,7 +312,7 @@
(~ (|> (nullable_type outputT)
(try_type try?)
(io_type io?)))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_null g!temp outputT)
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index 4be059a82..1030a353a 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -1287,7 +1287,8 @@
(object [] [Runnable]
[]
(Runnable [] (run self) void
- (exec (do_something some_value)
+ (exec
+ (do_something some_value)
[])))
)}
(in (list (` ("jvm class anonymous"
@@ -1369,9 +1370,10 @@
body <code>.any])
{#.doc (example "Evaluates body, while holding a lock on a given object."
(synchronized object_to_be_locked
- (exec (do_something ___)
- (do_something_else ___)
- (finish_the_computation ___))))}
+ (exec
+ (do something)
+ (dosomething else)
+ (finish the computation))))}
(in (list (` ("jvm object synchronized" (~ lock) (~ body))))))
(syntax: .public (do_to [obj <code>.any
@@ -1505,7 +1507,7 @@
(` ("jvm object cast" (~ raw)))
raw)
(list)]))))
- unboxed/boxed (case (dictionary.get unboxed ..boxes)
+ unboxed/boxed (case (dictionary.value unboxed ..boxes)
(#.Some boxed)
(<unbox/box> unboxed boxed refined)
@@ -1895,7 +1897,7 @@
(text.starts_with? descriptor.array_prefix name)
(case params
#.End
- (let [[_ unprefixed] (maybe.assume (text.split_with descriptor.array_prefix name))]
+ (let [[_ unprefixed] (maybe.assume (text.split_by descriptor.array_prefix name))]
(\ meta.monad map type.array
(lux_type->jvm_type (#.Primitive unprefixed (list)))))
diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux
index d2a062257..ddfeede9d 100644
--- a/stdlib/source/library/lux/ffi.lua.lux
+++ b/stdlib/source/library/lux/ffi.lua.lux
@@ -206,7 +206,7 @@
(~ (|> (nilable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_nil g!temp outputT)
@@ -229,7 +229,7 @@
code.local_identifier)))
g!type (code.local_identifier class)
real_class (text.replaced "/" "." class)
- imported (case (text.split_all_with "/" class)
+ imported (case (text.all_split_by "/" class)
(#.Item head tail)
(list\fold (function (_ sub super)
(` ("lua object get" (~ (code.text sub))
@@ -254,7 +254,7 @@
(~ g!object))
(-> (~ g!type)
(~ (nilable_type fieldT)))
- (:assume
+ (:expected
(~ (without_nil g!temp fieldT (` ("lua object get" (~ (code.text field))
(:as (..Object .Any) (~ g!object))))))))))
@@ -280,7 +280,7 @@
(~ (|> (nilable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_nil g!temp outputT)
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index da538d4c7..0e041f5a1 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -291,10 +291,10 @@
(-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
(case class
(#GenericTypeVar name)
- (case (list.find (function (_ [pname pbounds])
- (and (text\= name pname)
- (not (list.empty? pbounds))))
- type_params)
+ (case (list.example (function (_ [pname pbounds])
+ (and (text\= name pname)
+ (not (list.empty? pbounds))))
+ type_params)
#.None
(code.identifier ["" name])
@@ -344,10 +344,10 @@
(-> (List Type_Parameter) GenericType Text)
(case class
(#GenericTypeVar name)
- (case (list.find (function (_ [pname pbounds])
- (and (text\= name pname)
- (not (list.empty? pbounds))))
- env)
+ (case (list.example (function (_ [pname pbounds])
+ (and (text\= name pname)
+ (not (list.empty? pbounds))))
+ env)
#.None
type_var_class
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index c29e16c9a..112c0c0be 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -224,7 +224,7 @@
(~ (|> (nullable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_null g!temp outputT)
@@ -259,7 +259,7 @@
(~ g!object))
(-> (~ g!type)
(~ (nullable_type fieldT)))
- (:assume
+ (:expected
(~ (without_null g!temp fieldT (` ("php object get" (~ (code.text field))
(:as (..Object .Any) (~ g!object))))))))))
@@ -286,7 +286,7 @@
(~ (|> (nullable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_null g!temp outputT)
diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux
index 70b9fe281..0bb32e7f8 100644
--- a/stdlib/source/library/lux/ffi.py.lux
+++ b/stdlib/source/library/lux/ffi.py.lux
@@ -206,7 +206,7 @@
(~ (|> (noneable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_none g!temp outputT)
@@ -249,7 +249,7 @@
code.local_identifier)))
g!type (code.local_identifier class)
real_class (text.replaced "/" "." class)
- imported (case (text.split_all_with "/" class)
+ imported (case (text.all_split_by "/" class)
(#.Item head tail)
(list\fold (function (_ sub super)
(` ("python object get" (~ (code.text sub))
@@ -269,7 +269,7 @@
[(~+ (list\map product.right g!inputs))])
(-> [(~+ (list\map noneable_type inputsT))]
(~ g!type))
- (:assume
+ (:expected
("python apply"
(:as ..Function (~ imported))
(~+ (list\map (with_none g!temp) g!inputs)))))))
@@ -285,7 +285,7 @@
(~ g!object))
(-> (~ g!type)
(~ (noneable_type fieldT)))
- (:assume
+ (:expected
(~ (without_none g!temp fieldT (` ("python object get" (~ (code.text field))
(:as (..Object .Any) (~ g!object))))))))))
@@ -311,7 +311,7 @@
(~ (|> (noneable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_none g!temp outputT)
diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux
index b0d3a5c9b..7175fe4c9 100644
--- a/stdlib/source/library/lux/ffi.rb.lux
+++ b/stdlib/source/library/lux/ffi.rb.lux
@@ -219,7 +219,7 @@
(~ (|> (nilable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_nil g!temp outputT)
@@ -282,7 +282,7 @@
(~ g!object))
(-> (~ g!type)
(~ (nilable_type fieldT)))
- (:assume
+ (:expected
(~ (without_nil g!temp fieldT (` ("ruby object get" (~ (code.text field))
(:as (..Object .Any) (~ g!object))))))))))
@@ -311,7 +311,7 @@
(~ (|> (nilable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_nil g!temp outputT)
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index fe845f74d..c3b77f830 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -191,7 +191,7 @@
(~ (|> (nilable_type outputT)
(try_type try?)
(io_type io?))))
- (:assume
+ (:expected
(~ (<| (with_io io?)
(with_try try?)
(without_nil g!temp outputT)
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index 4bff5041e..1a7b52201 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -561,7 +561,7 @@
(Equivalence Language)
(def: (= reference sample)
- (is? reference sample)))
+ (same? reference sample)))
(implementation: .public hash
(Hash Language)
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index 48526b897..e0f569100 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -300,7 +300,7 @@
(Equivalence Territory)
(def: (= reference sample)
- (is? reference sample)))
+ (same? reference sample)))
(implementation: .public hash
(Hash Territory)
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index b95b6983b..f6e2e1716 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -117,7 +117,7 @@
($_ text\compose "__gensym__" prefix)
[""] code.identifier))))
-(def: (get_local_identifier ast)
+(def: (local_identifier ast)
(-> Code (Meta Text))
(case ast
[_ (#.Identifier [_ name])]
@@ -147,7 +147,7 @@
(case tokens
(^ (list [_ (#.Tuple identifiers)] body))
(do {! //.monad}
- [identifier_names (monad.map ! ..get_local_identifier identifiers)
+ [identifier_names (monad.map ! ..local_identifier identifiers)
.let [identifier_defs (list\join (list\map (: (-> Text (List Code))
(function (_ name) (list (code.identifier ["" name]) (` (..identifier (~ (code.text name)))))))
identifier_names))]]
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index 03eab5adc..8a10f5f26 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -34,7 +34,7 @@
(def: (with_module name body)
(All [a] (-> Text (-> Module (Try [Module a])) (Meta a)))
(function (_ compiler)
- (case (|> compiler (get@ #.modules) (plist.get name))
+ (case (|> compiler (get@ #.modules) (plist.value name))
(#.Some module)
(case (body module)
(#try.Success [module' output])
@@ -56,7 +56,7 @@
(plist.has definition_name definition))]]
(..with_module module_name
(function (_ module)
- (case (|> module (get@ #.definitions) (plist.get definition_name))
+ (case (|> module (get@ #.definitions) (plist.value definition_name))
#.None
(#try.Success [(update@ #.definitions add_macro! module)
[]])
@@ -72,7 +72,7 @@
(plist.lacks definition_name))]]
(..with_module module_name
(function (_ module)
- (case (|> module (get@ #.definitions) (plist.get definition_name))
+ (case (|> module (get@ #.definitions) (plist.value definition_name))
(#.Some _)
(#try.Success [(update@ #.definitions lacks_macro! module)
[]])
@@ -87,7 +87,7 @@
(do {! meta.monad}
[_ (monad.map ! ..pop_one macros)
_ (..pop_one self)
- compiler meta.get_compiler]
+ compiler meta.compiler_state]
(in (case (get@ #.expected compiler)
(#.Some _)
(list (' []))
@@ -96,6 +96,10 @@
(list)))))))
(def: .public (push macros)
+ {#.doc (example "Installs macros in the compiler-state, with the given names."
+ "Yields code that can be placed either as expression or as directives."
+ "This code un-installs the macros."
+ "NOTE: Always use this code once to clean-up..")}
(-> (List [Name Macro]) (Meta Code))
(do meta.monad
[_ (monad.map meta.monad ..push_one macros)
diff --git a/stdlib/source/library/lux/macro/poly.lux b/stdlib/source/library/lux/macro/poly.lux
index a32a2e5d8..a4aa6ba23 100644
--- a/stdlib/source/library/lux/macro/poly.lux
+++ b/stdlib/source/library/lux/macro/poly.lux
@@ -85,13 +85,13 @@
(#.Parameter idx)
(let [idx (<type>.adjusted_idx env idx)]
(if (n.= 0 idx)
- (|> (dictionary.get idx env) maybe.assume product.left (code env))
+ (|> (dictionary.value idx env) maybe.assume product.left (code env))
(` (.$ (~ (code.nat (dec idx)))))))
(#.Apply (#.Named [(~~ (static .prelude_module)) "Nothing"] _) (#.Parameter idx))
(let [idx (<type>.adjusted_idx env idx)]
(if (n.= 0 idx)
- (|> (dictionary.get idx env) maybe.assume product.left (code env))
+ (|> (dictionary.value idx env) maybe.assume product.left (code env))
(undefined)))
(^template [<tag>]
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index 2f72ef96a..b5a364ffd 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -1,4 +1,5 @@
(.module:
+ {#.doc "Utilities commonly used while templating."}
[library
[lux (#- let local)
["." meta]
@@ -34,6 +35,12 @@
(syntax: .public (with_locals [locals (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
+ {#.doc (example "Creates names for local bindings aliased by the names you choose."
+ (with_locals [my_var]
+ (let [my_var 123]
+ (..text [my_var])))
+ "=>"
+ "__gensym__my_var506")}
(do {! meta.monad}
[g!locals (|> locals
(list\map //.identifier)
@@ -80,21 +87,38 @@
(<code>.tuple (<>.many (..snippet module_side?))))
(syntax: .public (text [simple (..part false)])
+ {#.doc (example "A text literal made by concatenating pieces of code."
+ (text [#0 123 +456 +789.0 "abc" .def ..ghi])
+ "=>"
+ "#0123+456+789.0abcdefghi")}
(in (list (|> simple (text.join_with "") code.text))))
-(template [<name> <simple> <complex>]
- [(syntax: .public (<name> [name (<>.or (<>.and (..part true) (..part false))
- (..part false))])
- (case name
- (#.Left [simple complex])
- (in (list (<complex> [(text.join_with "" simple)
- (text.join_with "" complex)])))
-
- (#.Right simple)
- (in (list (|> simple (text.join_with "") <simple>)))))]
-
- [identifier code.local_identifier code.identifier]
- [tag code.local_tag code.tag]
+(template [<a/an> <name> <simple> <complex> <short_example> <full_example>]
+ [(`` (syntax: .public (<name> [name (<>.or (<>.and (..part true) (..part false))
+ (..part false))])
+ {#.doc (example (~~ (..text [<a/an> " " <name> " made by concatenating pieces of code."]))
+ "The (optional) module part and the short part are specified independently."
+ (<name> ["abc" .def ..ghi])
+ "=>"
+ <short_example>
+ "--------------"
+ (<name> [.def] ["abc" .def ..ghi])
+ "=>"
+ <full_example>)}
+ (case name
+ (#.Left [simple complex])
+ (in (list (<complex> [(text.join_with "" simple)
+ (text.join_with "" complex)])))
+
+ (#.Right simple)
+ (in (list (|> simple (text.join_with "") <simple>))))))]
+
+ ["An" identifier code.local_identifier code.identifier
+ abcdefghi
+ .abcdefghi]
+ ["A" tag code.local_tag code.tag
+ #abcdefghi
+ #.abcdefghi]
)
(type: Environment
@@ -104,7 +128,7 @@
(-> Environment Code Code)
(case template
[_ (#.Identifier "" name)]
- (case (dictionary.get name env)
+ (case (dictionary.value name env)
(#.Some substitute)
substitute
@@ -162,6 +186,12 @@
(syntax: .public (let [locals (<code>.tuple (<>.some ..local))
body <code>.any])
+ {#.doc (example "Lexically-bound templates."
+ (let [(!square <root>)
+ [(nat.* <root> <root>)]]
+ (def: (square root)
+ (-> Nat Nat)
+ (!square root))))}
(do meta.monad
[here_name meta.current_module_name
expression? (: (Meta Bit)
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 9dce6d30b..981424626 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -296,7 +296,7 @@
($_ //i64.or
(//i64.left_shifted ..sign_offset sign_bit)
(//i64.left_shifted ..exponent_offset exponent_bits)
- (//i64.clear ..mantissa_size mantissa_bits)))
+ (//i64.zero ..mantissa_size mantissa_bits)))
)))
(template [<getter> <size> <offset>]
@@ -336,13 +336,13 @@
[mantissa power] (if (//nat.< ..mantissa_size E)
[(if (//nat.= 0 E)
M
- (//i64.set ..mantissa_size M))
+ (//i64.one ..mantissa_size M))
(|> E
(//nat.- ..double_bias)
.int
(//int.max ..min_exponent)
(//int.- (.int ..mantissa_size)))]
- [(//i64.set ..mantissa_size M)
+ [(//i64.one ..mantissa_size M)
(|> E (//nat.- ..double_bias) (//nat.- ..mantissa_size) .int)])
exponent (///.pow (//int.frac power) +2.0)]
(|> (//nat.frac mantissa)
@@ -419,7 +419,7 @@
($_ //i64.or
(//i64.left_shifted ..sign_offset (.i64 sign))
(//i64.left_shifted ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent)))
- (//i64.clear ..mantissa_size (.i64 mantissa))))))
+ (//i64.zero ..mantissa_size (.i64 mantissa))))))
(#try.Failure ("lux text concat" <error> representation))))))]
[binary //nat.binary //int.binary "Invalid binary syntax: "]
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index fd79d7bb3..df8d01dbe 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -89,7 +89,7 @@
(with_shift 32)
(..and 127))))
-(def: .public (clear index input)
+(def: .public (zero index input)
{#.doc "Clear bit at the given index."}
(All [s] (-> Nat (I64 s) (I64 s)))
(|> index ..bit ..not (..and input)))
@@ -100,17 +100,17 @@
(All [s] (-> Nat (I64 s) (I64 s)))
(|> index ..bit (<op> input)))]
- [set ..or "Set bit at given index."]
- [flip ..xor "Flip bit at given index."]
+ [one ..or "Set bit at given index."]
+ [flipped ..xor "Flip bit at given index."]
)
-(def: .public (set? index input)
+(def: .public (one? index input)
(-> Nat (I64 Any) Bit)
(|> input (:as I64) (..and (..bit index)) (n.= 0) .not))
-(def: .public (clear? index input)
+(def: .public (zero? index input)
(-> Nat (I64 Any) Bit)
- (.not (..set? index input)))
+ (.not (..one? index input)))
(template [<name> <forward> <backward>]
[(def: .public (<name> distance input)
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index f6307b4bf..cfb3eca00 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -140,7 +140,7 @@
($_ text\compose (n\encode numerator) ..separator (n\encode denominator)))
(def: (decode input)
- (case (text.split_with ..separator input)
+ (case (text.split_by ..separator input)
(#.Some [num denom])
(do try.monad
[numerator (n\decode num)
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index 20e1d6130..5c0ce4d8e 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -421,7 +421,7 @@
(loop [idx last_idx
digits (..digits [])]
(if (//int.>= +0 (.int idx))
- (if (//i64.set? idx input)
+ (if (//i64.one? idx input)
(let [digits' (digits\+! (power_digits (//nat.- idx last_idx))
digits)]
(recur (dec idx)
@@ -453,7 +453,7 @@
(recur digits (inc idx) output)
(recur (digits\-! power digits)
(inc idx)
- (//i64.set (//nat.- idx (dec //i64.width)) output))))
+ (//i64.one (//nat.- idx (dec //i64.width)) output))))
(#try.Success (.rev output))))
#.None
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 2b9465aca..8ed6e30f5 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -33,13 +33,13 @@
(Functor Meta)
(def: (map f fa)
- (function (_ compiler)
- (case (fa compiler)
+ (function (_ lux)
+ (case (fa lux)
(#try.Failure msg)
(#try.Failure msg)
- (#try.Success [compiler' a])
- (#try.Success [compiler' (f a)])))))
+ (#try.Success [lux' a])
+ (#try.Success [lux' (f a)])))))
(implementation: .public apply
(Apply Meta)
@@ -47,12 +47,12 @@
(def: &functor ..functor)
(def: (apply ff fa)
- (function (_ compiler)
- (case (ff compiler)
- (#try.Success [compiler' f])
- (case (fa compiler')
- (#try.Success [compiler'' a])
- (#try.Success [compiler'' (f a)])
+ (function (_ lux)
+ (case (ff lux)
+ (#try.Success [lux' f])
+ (case (fa lux')
+ (#try.Success [lux'' a])
+ (#try.Success [lux'' (f a)])
(#try.Failure msg)
(#try.Failure msg))
@@ -66,25 +66,28 @@
(def: &functor ..functor)
(def: (in x)
- (function (_ compiler)
- (#try.Success [compiler x])))
+ (function (_ lux)
+ (#try.Success [lux x])))
(def: (join mma)
- (function (_ compiler)
- (case (mma compiler)
+ (function (_ lux)
+ (case (mma lux)
(#try.Failure msg)
(#try.Failure msg)
- (#try.Success [compiler' ma])
- (ma compiler')))))
+ (#try.Success [lux' ma])
+ (ma lux')))))
-(def: .public (result' compiler action)
+(def: .public (result' lux action)
+ {#.doc (example "Evaluates a computation that depends on Lux's compiler state."
+ "Also returns a (potentially modified) compiler state.")}
(All [a] (-> Lux (Meta a) (Try [Lux a])))
- (action compiler))
+ (action lux))
-(def: .public (result compiler action)
+(def: .public (result lux action)
+ {#.doc (example "Evaluates a computation that depends on Lux's compiler state.")}
(All [a] (-> Lux (Meta a) (Try a)))
- (case (action compiler)
+ (case (action lux)
(#try.Failure error)
(#try.Failure error)
@@ -94,20 +97,20 @@
(def: .public (either left right)
{#.doc "Pick whichever computation succeeds."}
(All [a] (-> (Meta a) (Meta a) (Meta a)))
- (function (_ compiler)
- (case (left compiler)
+ (function (_ lux)
+ (case (left lux)
(#try.Failure error)
- (right compiler)
+ (right lux)
- (#try.Success [compiler' output])
- (#try.Success [compiler' output]))))
+ (#try.Success [lux' output])
+ (#try.Success [lux' output]))))
(def: .public (assertion message test)
{#.doc "Fails with the given message if the test is #0."}
(-> Text Bit (Meta Any))
- (function (_ compiler)
+ (function (_ lux)
(if test
- (#try.Success [compiler []])
+ (#try.Success [lux []])
(#try.Failure message))))
(def: .public (failure error)
@@ -118,26 +121,29 @@
(#try.Failure (location.with (get@ #.location state) error))))
(def: .public (module name)
+ {#.doc (example "Looks-up a module with the given name.")}
(-> Text (Meta Module))
- (function (_ compiler)
- (case (plist.get name (get@ #.modules compiler))
+ (function (_ lux)
+ (case (plist.value name (get@ #.modules lux))
(#.Some module)
- (#try.Success [compiler module])
+ (#try.Success [lux module])
_
(#try.Failure ($_ text\compose "Unknown module: " name)))))
(def: .public current_module_name
+ {#.doc (example "The name of the module currently being compiled, if any.")}
(Meta Text)
- (function (_ compiler)
- (case (get@ #.current_module compiler)
+ (function (_ lux)
+ (case (get@ #.current_module lux)
(#.Some current_module)
- (#try.Success [compiler current_module])
+ (#try.Success [lux current_module])
_
(#try.Failure "No current module."))))
(def: .public current_module
+ {#.doc (example "The module currently being compiled, if any.")}
(Meta Module)
(let [(^open "\.") ..monad]
(|> ..current_module_name
@@ -170,11 +176,11 @@
(-> (List [Text Module]) Text Text Text
(Maybe Macro))
(do maybe.monad
- [$module (plist.get module modules)
+ [$module (plist.value module modules)
definition (: (Maybe Global)
(|> (: Module $module)
(get@ #.definitions)
- (plist.get name)))]
+ (plist.value name)))]
(case definition
(#.Alias [r_module r_name])
(macro' modules this_module r_module r_name)
@@ -185,34 +191,38 @@
#.None))))
(def: .public (macro full_name)
+ {#.doc (example "Looks-up a macro known by the given name.")}
(-> Name (Meta (Maybe Macro)))
(do ..monad
[[module name] (..normal full_name)]
(: (Meta (Maybe Macro))
- (function (_ compiler)
- (let [macro (case (..current_module_name compiler)
+ (function (_ lux)
+ (let [macro (case (..current_module_name lux)
(#try.Failure error)
#.None
(#try.Success [_ this_module])
- (macro' (get@ #.modules compiler) this_module module name))]
- (#try.Success [compiler macro]))))))
+ (macro' (get@ #.modules lux) this_module module name))]
+ (#try.Success [lux macro]))))))
(def: .public seed
+ {#.doc (example "The current value of a number tracked by the compiler."
+ "Also increases the value, so it's different next time it is seen."
+ "This number can be used for generating data 'randomly' during compilation.")}
(Meta Nat)
- (function (_ compiler)
- (#try.Success [(update@ #.seed inc compiler)
- (get@ #.seed compiler)])))
+ (function (_ lux)
+ (#try.Success [(update@ #.seed inc lux)
+ (get@ #.seed lux)])))
(def: .public (module_exists? module)
(-> Text (Meta Bit))
- (function (_ compiler)
- (#try.Success [compiler (case (plist.get module (get@ #.modules compiler))
- (#.Some _)
- #1
-
- #.None
- #0)])))
+ (function (_ lux)
+ (#try.Success [lux (case (plist.value module (get@ #.modules lux))
+ (#.Some _)
+ #1
+
+ #.None
+ #0)])))
(def: (on_either f x1 x2)
(All [a b]
@@ -236,15 +246,15 @@
(-> Type (Meta Type))
(case type
(#.Var var)
- (function (_ compiler)
- (case (|> compiler
+ (function (_ lux)
+ (case (|> lux
(get@ [#.type_context #.var_bindings])
(type_variable var))
(^or #.None (#.Some (#.Var _)))
- (#try.Success [compiler type])
+ (#try.Success [lux type])
(#.Some type')
- (#try.Success [compiler type'])))
+ (#try.Success [lux type'])))
_
(\ ..monad in type)))
@@ -252,24 +262,24 @@
(def: .public (var_type name)
{#.doc "Looks-up the type of a local variable somewhere in the environment."}
(-> Text (Meta Type))
- (function (_ compiler)
+ (function (_ lux)
(let [test (: (-> [Text [Type Any]] Bit)
(|>> product.left (text\= name)))]
(case (do maybe.monad
- [scope (list.find (function (_ env)
- (or (list.any? test (: (List [Text [Type Any]])
- (get@ [#.locals #.mappings] env)))
- (list.any? test (: (List [Text [Type Any]])
- (get@ [#.captured #.mappings] env)))))
- (get@ #.scopes compiler))
- [_ [type _]] (on_either (list.find test)
+ [scope (list.example (function (_ env)
+ (or (list.any? test (: (List [Text [Type Any]])
+ (get@ [#.locals #.mappings] env)))
+ (list.any? test (: (List [Text [Type Any]])
+ (get@ [#.captured #.mappings] env)))))
+ (get@ #.scopes lux))
+ [_ [type _]] (on_either (list.example test)
(: (List [Text [Type Any]])
(get@ [#.locals #.mappings] scope))
(: (List [Text [Type Any]])
(get@ [#.captured #.mappings] scope)))]
(in type))
(#.Some var_type)
- ((clean_type var_type) compiler)
+ ((clean_type var_type) lux)
#.None
(#try.Failure ($_ text\compose "Unknown variable: " name))))))
@@ -280,20 +290,20 @@
(do ..monad
[name (..normal name)
.let [[normal_module normal_short] name]]
- (function (_ compiler)
+ (function (_ lux)
(case (: (Maybe Global)
(do maybe.monad
- [(^slots [#.definitions]) (|> compiler
+ [(^slots [#.definitions]) (|> lux
(get@ #.modules)
- (plist.get normal_module))]
- (plist.get normal_short definitions)))
+ (plist.value normal_module))]
+ (plist.value normal_short definitions)))
(#.Some definition)
- (#try.Success [compiler definition])
+ (#try.Success [lux definition])
_
- (let [current_module (|> compiler (get@ #.current_module) (maybe.else "???"))
+ (let [current_module (|> lux (get@ #.current_module) (maybe.else "???"))
separator ($_ text\compose text.new_line " ")
- all_known_modules (|> compiler
+ all_known_modules (|> lux
(get@ #.modules)
(list\map product.left)
(list.sorted text\<)
@@ -301,9 +311,9 @@
(#try.Failure ($_ text\compose
"Unknown definition: " (name\encode name) text.new_line
" Current module: " current_module text.new_line
- (case (plist.get current_module (get@ #.modules compiler))
+ (case (plist.value current_module (get@ #.modules lux))
(#.Some this_module)
- (let [candidates (|> compiler
+ (let [candidates (|> lux
(get@ #.modules)
(list\map (function (_ [module_name module])
(|> module
@@ -340,7 +350,8 @@
" All known modules: " all_known_modules text.new_line)))))))
(def: .public (export name)
- {#.doc "Looks-up a definition's type in the available modules (including the current one)."}
+ {#.doc (example "Looks-up a definition in the available modules (including the current one)."
+ "The look-up only succeeds if the definition has been exported.")}
(-> Name (Meta Definition))
(do ..monad
[definition (..definition name)]
@@ -371,15 +382,13 @@
(def: .public (type name)
{#.doc "Looks-up the type of either a local variable or a definition."}
(-> Name (Meta Type))
- (do ..monad
- [.let [[_ _name] name]]
- (case name
- ["" _name]
- (either (var_type _name)
- (definition_type name))
+ (case name
+ ["" _name]
+ (either (var_type _name)
+ (definition_type name))
- _
- (definition_type name))))
+ _
+ (definition_type name)))
(def: .public (type_definition name)
{#.doc "Finds the value of a type definition (such as Int, Any or Lux)."}
@@ -392,7 +401,7 @@
(#.Right [exported? def_type def_data def_value])
(let [type_code (`` ("lux in-module" (~~ (static .prelude_module)) .type_code))]
- (if (or (is? .Type def_type)
+ (if (or (same? .Type def_type)
(\ code.equivalence =
(type_code .Type)
(type_code def_type)))
@@ -402,13 +411,13 @@
(def: .public (globals module)
{#.doc "The entire list of globals in a module (including the non-exported/private ones)."}
(-> Text (Meta (List [Text Global])))
- (function (_ compiler)
- (case (plist.get module (get@ #.modules compiler))
+ (function (_ lux)
+ (case (plist.value module (get@ #.modules lux))
#.None
(#try.Failure ($_ text\compose "Unknown module: " module))
(#.Some module)
- (#try.Success [compiler (get@ #.definitions module)]))))
+ (#try.Success [lux (get@ #.definitions module)]))))
(def: .public (definitions module)
{#.doc "The entire list of definitions in a module (including the non-exported/private ones)."}
@@ -437,10 +446,10 @@
(def: .public modules
{#.doc "All the available modules (including the current one)."}
(Meta (List [Text Module]))
- (function (_ compiler)
- (|> compiler
+ (function (_ lux)
+ (|> lux
(get@ #.modules)
- [compiler]
+ [lux]
#try.Success)))
(def: .public (tags_of type_name)
@@ -449,7 +458,7 @@
(do ..monad
[.let [[module name] type_name]
module (..module module)]
- (case (plist.get name (get@ #.types module))
+ (case (plist.value name (get@ #.types module))
(#.Some [tags _])
(in (#.Some tags))
@@ -459,16 +468,16 @@
(def: .public location
{#.doc "The location of the current expression being analyzed."}
(Meta Location)
- (function (_ compiler)
- (#try.Success [compiler (get@ #.location compiler)])))
+ (function (_ lux)
+ (#try.Success [lux (get@ #.location lux)])))
(def: .public expected_type
{#.doc "The expected type of the current expression being analyzed."}
(Meta Type)
- (function (_ compiler)
- (case (get@ #.expected compiler)
+ (function (_ lux)
+ (case (get@ #.expected lux)
(#.Some type)
- (#try.Success [compiler type])
+ (#try.Success [lux type])
#.None
(#try.Failure "Not expecting any type."))))
@@ -487,6 +496,7 @@
(in (list.any? (text\= import) imports))))
(def: .public (imported? import)
+ {#.doc (example "Checks if the given module has been imported by the current module.")}
(-> Text (Meta Bit))
(\ ..functor map
(|>> (get@ #.imports) (list.any? (text\= import)))
@@ -500,7 +510,7 @@
=module (..module module)
this_module_name ..current_module_name
imported! (..imported? module)]
- (case (plist.get name (get@ #.tags =module))
+ (case (plist.value name (get@ #.tags =module))
(#.Some [idx tag_list exported? type])
(if (or (text\= this_module_name module)
(and imported! exported?))
@@ -532,13 +542,13 @@
(def: .public locals
{#.doc "All the local variables currently in scope, separated in different scopes."}
(Meta (List (List [Text Type])))
- (function (_ compiler)
- (case (list.inits (get@ #.scopes compiler))
+ (function (_ lux)
+ (case (list.inits (get@ #.scopes lux))
#.None
(#try.Failure "No local environment")
(#.Some scopes)
- (#try.Success [compiler
+ (#try.Success [lux
(list\map (|>> (get@ [#.locals #.mappings])
(list\map (function (_ [name [type _]])
[name type])))
@@ -556,16 +566,17 @@
(#.Right _)
def_name))))
-(def: .public get_compiler
+(def: .public compiler_state
{#.doc "Obtains the current state of the compiler."}
(Meta Lux)
- (function (_ compiler)
- (#try.Success [compiler compiler])))
+ (function (_ lux)
+ (#try.Success [lux lux])))
(def: .public type_context
+ {#.doc (example "The current type-checking context.")}
(Meta Type_Context)
- (function (_ compiler)
- (#try.Success [compiler (get@ #.type_context compiler)])))
+ (function (_ lux)
+ (#try.Success [lux (get@ #.type_context lux)])))
(def: .public (lift result)
(All [a] (-> (Try a) (Meta a)))
diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux
index e0a95d916..3bb42e75f 100644
--- a/stdlib/source/library/lux/program.lux
+++ b/stdlib/source/library/lux/program.lux
@@ -21,34 +21,27 @@
(type: Arguments
(#Raw Text)
- (#Parsed (List [Code Code])))
+ (#Parsed (List Code)))
(def: arguments^
(<code>.Parser Arguments)
(<>.or <code>.local_identifier
- (<code>.tuple (<>.some (<>.either (do <>.monad
- [name <code>.local_identifier]
- (in [(code.identifier ["" name]) (` (~! <cli>.any))]))
- (<code>.record (<>.and <code>.any <code>.any)))))))
+ (<code>.tuple (<>.some <code>.any))))
(syntax: .public (program: [args ..arguments^
body <code>.any])
{#.doc (example "Defines the entry-point to a program (similar to the 'main' function/method in other programming languages)."
"Can take a list of all the input parameters to the program."
- "Or, can destructure them using CLI-option combinators from the lux/control/parser/cli module."
- (program: all_args
+ "Or, can destructure them using CLI-option combinators from the library/lux/control/parser/cli module."
+ (program: all_arguments
(do io.monad
- [foo init_program
- bar (do_something all_args)]
- (in [])))
+ [foo (initialize program)]
+ (do_something_with all_arguments)))
- (program: [name]
- (io (log! (\ text.monoid compose "Hello, " name))))
-
- (program: [{config configuration_parser}]
+ (program: [config configuration_parser]
(do io.monad
- [data (init_program config)]
- (do_something data))))}
+ [data (initialize program with config)]
+ (do_something_with data))))}
(with_identifiers [g!program g!args g!_ g!output g!message]
(let [initialization+event_loop
(` ((~! do) (~! io.monad)
@@ -69,10 +62,7 @@
(` (.function ((~ g!program) (~ g!args))
(case ((~! <cli>.result) (: (~! (<cli>.Parser (io.IO .Any)))
((~! do) (~! <>.monad)
- [(~+ (|> args
- (list\map (function (_ [binding parser])
- (list binding parser)))
- list\join))
+ [(~+ args)
(~ g!_) (~! <cli>.end)]
((~' in) (~ initialization+event_loop))))
(~ g!args))
diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux
index a040fe442..0821593ea 100644
--- a/stdlib/source/library/lux/target.lux
+++ b/stdlib/source/library/lux/target.lux
@@ -1,8 +1,10 @@
(.module:
[library
- lux])
+ [lux #*]])
(type: .public Target
+ {#.doc (example "The name/ID of a platform targetted by a Lux compiler."
+ "This information can be used to generate code targetting specific platforms, and to make programs cross-platform.")}
Text)
(template [<name> <value>]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index 04524741f..b742f16cc 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -83,10 +83,10 @@
(def: identity ..relative_identity)
(def: (compose left right)
- (cond (is? ..relative_identity left)
+ (cond (same? ..relative_identity left)
right
- (is? ..relative_identity right)
+ (same? ..relative_identity right)
left
... else
@@ -136,7 +136,7 @@
(-> Label (Bytecode Any))
(function (_ [pool environment tracker])
(let [@here (get@ #program_counter tracker)]
- (case (dictionary.get label (get@ #known tracker))
+ (case (dictionary.value label (get@ #known tracker))
(#.Some [expected (#.Some address)])
(exception.except ..label_has_already_been_set [label])
@@ -709,7 +709,7 @@
(def: (resolve_label label resolver)
(-> Label Resolver (Try [Stack Address]))
- (case (dictionary.get label resolver)
+ (case (dictionary.value label resolver)
(#.Some [actual (#.Some address)])
(#try.Success [actual address])
@@ -721,7 +721,7 @@
(def: (acknowledge_label stack label tracker)
(-> Stack Label Tracker Tracker)
- (case (dictionary.get label (get@ #known tracker))
+ (case (dictionary.value label (get@ #known tracker))
(#.Some _)
tracker
@@ -796,7 +796,7 @@
(..acknowledge_label actual label)
(set@ #program_counter program_counter'))]
[(function (_ resolver)
- (case (dictionary.get label resolver)
+ (case (dictionary.value label resolver)
(#.Some [expected (#.Some @to)])
(do try.monad
[_ (exception.assertion ..mismatched_environments [(name_of <instruction>) label @here expected actual]
@@ -852,7 +852,7 @@
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
(function (_ label)
- (dictionary.get label resolver)))]
+ (dictionary.value label resolver)))]
(case (do {! maybe.monad}
[@default (|> default get (monad.bind ! product.right))
@at_minimum (|> at_minimum get (monad.bind ! product.right))
@@ -895,7 +895,7 @@
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
(function (_ label)
- (dictionary.get label resolver)))]
+ (dictionary.value label resolver)))]
(case (do {! maybe.monad}
[@default (|> default get (monad.bind ! product.right))
@cases (|> cases
@@ -954,11 +954,11 @@
(def: (type_size type)
(-> (Type Return) Nat)
- (cond (is? type.void type)
+ (cond (same? type.void type)
0
- (or (is? type.long type)
- (is? type.double type))
+ (or (same? type.long type)
+ (same? type.double type))
2
... else
@@ -998,15 +998,15 @@
(//constant/pool.field (..reflection class))
{#//constant/pool.name field
#//constant/pool.descriptor (type.descriptor type)})]
- (if (or (is? type.long type)
- (is? type.double type))
+ (if (or (same? type.long type)
+ (same? type.double type))
(..bytecode <consumption> $2 @_ <2> [index])
(..bytecode <consumption> $1 @_ <1> [index]))))]
[$0 getstatic _.getstatic/1 _.getstatic/2]
[$1 putstatic _.putstatic/1 _.putstatic/2]
- [$1 getfield _.getfield/1 _.getfield/2]
- [$2 putfield _.putfield/1 _.putfield/2]
+ [$1 getfield _.getfield/1 _.getfield/2]
+ [$2 putfield _.putfield/1 _.putfield/2]
)
(exception: .public (invalid_range_for_try {start Address} {end Address})
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
index 7db606a0b..ddc600162 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
@@ -41,8 +41,8 @@
(let [[type_variables inputs output exceptions] (/////type/parser.method type)]
(|> inputs
(list\map (function (_ input)
- (if (or (is? /////type.long input)
- (is? /////type.double input))
+ (if (or (same? /////type.long input)
+ (same? /////type.double input))
..wide
..normal)))
(list\fold n.+ 0))))
diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux
index 214f0b456..549fb8b01 100644
--- a/stdlib/source/library/lux/target/jvm/loader.lux
+++ b/stdlib/source/library/lux/target/jvm/loader.lux
@@ -114,11 +114,11 @@
#throws [java/lang/ClassNotFoundException]
(let [class_name (:as Text class_name)
classes (|> library atom.read! io.run!)]
- (case (dictionary.get class_name classes)
+ (case (dictionary.value class_name classes)
(#.Some bytecode)
(case (..define class_name bytecode (<| <cast> self))
(#try.Success class)
- (:assume class)
+ (:expected class)
(#try.Failure error)
(panic! (exception.error ..cannot_define [class_name error])))
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index e0c21a435..813395886 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -351,7 +351,7 @@
(case (java/lang/Class::getDeclaredField field target)
(#try.Success field)
(let [owner (java/lang/reflect/Field::getDeclaringClass field)]
- (if (is? owner target)
+ (if (same? owner target)
(#try.Success field)
(exception.except ..mistaken_field_owner [field owner target])))
diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux
index e6beb53d2..e87838ef1 100644
--- a/stdlib/source/library/lux/target/jvm/type.lux
+++ b/stdlib/source/library/lux/target/jvm/type.lux
@@ -146,7 +146,7 @@
(list\map ..signature exceptions)])
(/descriptor.method [(list\map ..descriptor inputs)
(..descriptor output)])
- (:assume ..void)]))
+ (:expected ..void)]))
(implementation: .public equivalence
(All [category] (Equivalence (Type category)))
diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux
index 9c01faea3..6b3a2ee45 100644
--- a/stdlib/source/library/lux/target/jvm/type/alias.lux
+++ b/stdlib/source/library/lux/target/jvm/type/alias.lux
@@ -36,7 +36,7 @@
(do <>.monad
[var //parser.var']
(in (|> aliasing
- (dictionary.get var)
+ (dictionary.value var)
(maybe.else var)
//.var))))
diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux
index c6721ab41..a9021109b 100644
--- a/stdlib/source/library/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/target/jvm/type/lux.lux
@@ -119,7 +119,7 @@
(-> Mapping (Parser (Check Type)))
(do <>.monad
[var //parser.var']
- (in (case (dictionary.get var mapping)
+ (in (case (dictionary.value var mapping)
#.None
(check.except ..unknown_var [var])
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index 9fae1bd7e..867304aa7 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -42,6 +42,7 @@
["." program]]]])
(type: .public Tally
+ {#.doc (example "A record of successes and failures while executing tests.")}
{#successes Nat
#failures Nat
#expected_coverage (Set Name)
@@ -73,16 +74,18 @@
)
(type: .public Assertion
+ {#.doc (example "An asynchronous operation that yields test results.")}
(Async [Tally Text]))
(type: .public Test
+ {#.doc (example "A test that relies on random data generation to thoroughly cover different scenarios.")}
(Random Assertion))
(def: separator
text.new_line)
(def: .public (and' left right)
- {#.doc "Sequencing combinator."}
+ {#.doc "Sequencing combinator (for assertions)."}
(-> Assertion Assertion Assertion)
(let [[read! write!] (: [(Async [Tally Text])
(async.Resolver [Tally Text])]
@@ -107,10 +110,11 @@
text.tab)
(def: .public (context description)
+ {#.doc (example "Adds a contextual description to a test's documentation.")}
(-> Text Test Test)
(random\map (async\map (function (_ [tally documentation])
[tally (|> documentation
- (text.split_all_with ..separator)
+ (text.all_split_by ..separator)
(list\map (|>> (format context_prefix)))
(text.join_with ..separator)
(format description ..separator))]))))
@@ -119,6 +123,7 @@
(def: success_prefix "[Success] ")
(def: .public failure
+ {#.doc (example "A failing test, with a given error message.")}
(-> Text Test)
(|>> (format ..failure_prefix)
[..failure_tally]
@@ -151,6 +156,8 @@
Nat)
(def: .public (seed value test)
+ {#.doc (example "Execute the given test with a specific seed value."
+ "This allows you to reproduce a failing test case as many times as you want while debugging.")}
(-> Seed Test Test)
(function (_ prng)
(let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc value])
@@ -169,6 +176,9 @@
(exception: .public must_try_test_at_least_once)
(def: .public (times amount test)
+ {#.doc (example "Allows executing a test several times."
+ "By doing this, it's possible to thoroughly test code with many different scenarios."
+ "This assumes that random data generation is being used in tests instead of fixed/constant inputs.")}
(-> Nat Test Test)
(case amount
0 (..failure (exception.error ..must_try_test_at_least_once []))
@@ -241,6 +251,8 @@
(def: success_exit_code +0)
(def: .public (run! test)
+ {#.doc (example "Executes a test, and exits the program with either a successful or a failing exit code."
+ "WARNING: This procedure is only meant to be used in (program: ...) forms.")}
(-> Test (Async Nothing))
(do async.monad
[pre (async.future instant.now)
@@ -310,7 +322,7 @@
(-> Text Text (Set Name))
(loop [remaining encoding
output (set.of_list name.hash (list))]
- (case (text.split_with ..coverage_separator remaining)
+ (case (text.split_by ..coverage_separator remaining)
(#.Some [head tail])
(recur tail (set.has [module head] output))
@@ -320,6 +332,11 @@
(template [<macro> <function>]
[(syntax: .public (<macro> [coverage (<code>.tuple (<>.many <code>.any))
condition <code>.any])
+ {#.doc (example "Specifies a test as covering one or more definitions."
+ "Adds to the test tally information to track which definitions have been tested."
+ (<macro> [definition/0 definition/1 ,,, definition/N]
+ (: Bit
+ (some "computation"))))}
(let [coverage (list\map (function (_ definition)
(` ((~! ..reference) (~ definition))))
coverage)]
@@ -334,6 +351,11 @@
(syntax: .public (for [coverage (<code>.tuple (<>.many <code>.any))
test <code>.any])
+ {#.doc (example "Specifies a context for tests as covering one or more definitions."
+ "Adds to the test tally information to track which definitions have been tested."
+ (for [definition/0 definition/1 ,,, definition/N]
+ (: Test
+ some_test)))}
(let [coverage (list\map (function (_ definition)
(` ((~! ..reference) (~ definition))))
coverage)]
@@ -352,6 +374,11 @@
(syntax: .public (covering [module <code>.identifier
test <code>.any])
+ {#.doc (example "Specifies the module being covered by a test."
+ "Adds tracking information to the tally to know which exported definitions in the module need to be covered."
+ (covering .._
+ (: Test
+ some_test)))}
(do meta.monad
[.let [module (name.module module)]
definitions (meta.definitions module)
@@ -372,6 +399,7 @@
["Error" (%.text error)]))
(def: .public (in_parallel tests)
+ {#.doc (example "Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores.")}
(-> (List Test) Test)
(case (list.size tests)
0
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index dbe7ff1fa..9429e7081 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -23,15 +23,20 @@
[/
["." duration (#+ Duration)]])
-(template [<name> <singular> <plural>]
+(template [<name> <singular> <plural> <doc>]
[(def: .public <name>
+ {#.doc (example <doc>)}
Nat
(.nat (duration.ticks <singular> <plural>)))]
- [milli_seconds duration.milli_second duration.second]
- [seconds duration.second duration.minute]
- [minutes duration.minute duration.hour]
- [hours duration.hour duration.day]
+ [milli_seconds duration.milli_second duration.second
+ "Number of milli-seconds in a second."]
+ [seconds duration.second duration.minute
+ "Number of seconds in a minute."]
+ [minutes duration.minute duration.hour
+ "Number of minutes in an hour."]
+ [hours duration.hour duration.day
+ "Number of hours in an day."]
)
(def: limit
@@ -169,6 +174,7 @@
($_ text\compose "." (n\encode millis))))
(type: .public Clock
+ {#.doc (example "A clock marking the specific hour, minute, second, and milli-second in a day.")}
{#hour Nat
#minute Nat
#second Nat
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index a2a455fa1..310be7a0e 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -178,7 +178,7 @@
_ (<text>.this ..separator)
utc_month ..month_parser
_ (<text>.this ..separator)
- .let [month (maybe.assume (dictionary.get utc_month ..month_by_number))]
+ .let [month (maybe.assume (dictionary.value utc_month ..month_by_number))]
utc_day ..section_parser]
(<>.lift (..date utc_year month utc_day))))
@@ -339,7 +339,7 @@
... Coercing, because the year is already in internal form.
(try.assumed
(..date (:as Year year)
- (maybe.assume (dictionary.get month ..month_by_number))
+ (maybe.assume (dictionary.value month ..month_by_number))
day))))
(implementation: .public enum
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 98d910b10..174058fab 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -189,8 +189,8 @@
_ (///directive.lift_synthesis
(extension.with extender synthesizers))
_ (///directive.lift_generation
- (extension.with extender (:assume generators)))
- _ (extension.with extender (:assume directives))]
+ (extension.with extender (:expected generators)))
+ _ (extension.with extender (:expected directives))]
(in [])))
(///phase.result' state)
(\ try.monad map product.left)))
@@ -254,7 +254,7 @@
[[state phase_wrapper] (..phase_wrapper archive platform state)]
(|> state
(initialize_state (extender phase_wrapper)
- (:assume (..complete_extensions host_directive_bundle phase_wrapper (:assume bundles)))
+ (:expected (..complete_extensions host_directive_bundle phase_wrapper (:expected bundles)))
analysis_state)
(try\map (//init.with_default_directives expander host_analysis program anchorT,expressionT,directiveT (extender phase_wrapper))))))))]]
(if (archive.archived? archive archive.runtime_module)
@@ -318,7 +318,7 @@
(function (_ lens module)
(|> dependence
lens
- (dictionary.get module)
+ (dictionary.value module)
(maybe.else ..empty))))
transitive_depends_on (transitive_dependency (get@ #depends_on) import)
transitive_depended_by (transitive_dependency (get@ #depended_by) module)
@@ -340,7 +340,7 @@
[module transitive_depends_on]
[import transitive_depended_by]))
(update@ #depended_by
- ((function.flip update_dependence)
+ ((function.flipped update_dependence)
[module transitive_depends_on]
[import transitive_depended_by])))))
@@ -350,7 +350,7 @@
(function (_ from relationship to)
(let [targets (|> dependence
relationship
- (dictionary.get from)
+ (dictionary.value from)
(maybe.else ..empty))]
(set.member? targets to))))]
(or (dependence? import (get@ #depends_on) module)
@@ -400,7 +400,7 @@
initial
(Var (Dictionary Module <Pending>))
- (:assume (stm.var (dictionary.empty text.hash))))
+ (:expected (stm.var (dictionary.empty text.hash))))
dependence (: (Var Dependence)
(stm.var ..independence))]
(function (_ compile)
@@ -413,7 +413,7 @@
(Async [<Return> (Maybe [<Context>
archive.ID
<Signal>])])
- (:assume
+ (:expected
(stm.commit
(do {! stm.monad}
[dependence (if (text\= archive.runtime_module importer)
@@ -434,7 +434,7 @@
#.None])
(do !
[@pending (stm.read pending)]
- (case (dictionary.get module @pending)
+ (case (dictionary.value module @pending)
(#.Some [return signal])
(in [return
#.None])
@@ -512,7 +512,7 @@
not)
current)
modules)))
- :assume))
+ :expected))
state))))
(def: (set_current_module module state)
@@ -532,7 +532,7 @@
context
(///.Compiler <State+> .Module Any)
- (:assume
+ (:expected
((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list))))
compiler (..parallel
context
@@ -557,7 +557,7 @@
(-> <Context> (///.Compilation <State+> .Module Any) (Set Module)
(Action [Archive <State+>]))
- (:assume recur))
+ (:expected recur))
... TODO: Come up with a less hacky way to prevent duplicate imports.
... This currently assumes that all imports will be specified once in a single .module: form.
... This might not be the case in the future.
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 d43a937b1..996272df7 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
@@ -245,7 +245,7 @@
(do {! try.monad}
[casesM (monad.fold !
(function (_ [tagA coverageA] casesSF')
- (case (dictionary.get tagA casesSF')
+ (case (dictionary.value tagA casesSF')
(#.Some coverageSF)
(do !
[coverageM (merged coverageA coverageSF)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
index c0249441c..db51c3d77 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
@@ -128,7 +128,7 @@
(function (_ state)
(|> state
(get@ #.modules)
- (plist.get module)
+ (plist.value module)
(case> (#.Some _) #1 #.None #0)
[state] #try.Success))))
@@ -139,7 +139,7 @@
[self_name meta.current_module_name
self meta.current_module]
(function (_ state)
- (case (plist.get name (get@ #.definitions self))
+ (case (plist.value name (get@ #.definitions self))
#.None
(#try.Success [(update@ #.modules
(plist.has self_name
@@ -176,7 +176,7 @@
(-> Text (Operation Any))
(///extension.lift
(function (_ state)
- (case (|> state (get@ #.modules) (plist.get module_name))
+ (case (|> state (get@ #.modules) (plist.value module_name))
(#.Some module)
(let [active? (case (get@ #.module_state module)
#.Active #1
@@ -196,7 +196,7 @@
(-> Text (Operation Bit))
(///extension.lift
(function (_ state)
- (case (|> state (get@ #.modules) (plist.get module_name))
+ (case (|> state (get@ #.modules) (plist.value module_name))
(#.Some module)
(#try.Success [state
(case (get@ #.module_state module)
@@ -216,7 +216,7 @@
(-> Text (Operation <type>))
(///extension.lift
(function (_ state)
- (case (|> state (get@ #.modules) (plist.get module_name))
+ (case (|> state (get@ #.modules) (plist.value module_name))
(#.Some module)
(#try.Success [state (get@ <tag> module)])
@@ -234,7 +234,7 @@
[bindings (..tags module_name)
_ (monad.map !
(function (_ tag)
- (case (plist.get tag bindings)
+ (case (plist.value tag bindings)
#.None
(in [])
@@ -258,7 +258,7 @@
(text\= self_name type_module))]
(///extension.lift
(function (_ state)
- (case (|> state (get@ #.modules) (plist.get self_name))
+ (case (|> state (get@ #.modules) (plist.value self_name))
(#.Some module)
(let [namespaced_tags (list\map (|>> [self_name]) tags)]
(#try.Success [(update@ #.modules
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
index f379a9692..ae6034b65 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
@@ -36,7 +36,7 @@
(-> Text Scope (Maybe [Type Variable]))
(|> scope
(get@ [#.locals #.mappings])
- (plist.get name)
+ (plist.value name)
(maybe\map (function (_ [type value])
[type (#variable.Local value)]))))
@@ -79,7 +79,7 @@
(function (_ state)
(let [[inner outer] (|> state
(get@ #.scopes)
- (list.split_with (|>> (reference? name) not)))]
+ (list.split_when (|>> (reference? name) not)))]
(case outer
#.End
(#.Right [state #.None])
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 e123fab83..8f254c5d6 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
@@ -320,7 +320,7 @@
(function (_ [key val] idx->val)
(do !
[key (///extension.lift (meta.normal key))]
- (case (dictionary.get key tag->idx)
+ (case (dictionary.value key tag->idx)
(#.Some idx)
(if (dictionary.key? idx->val idx)
(/.except ..cannot_repeat_tag [key record])
@@ -331,7 +331,7 @@
(: (Dictionary Nat Code)
(dictionary.empty n.hash))
record)
- .let [ordered_tuple (list\map (function (_ idx) (maybe.assume (dictionary.get idx idx->val)))
+ .let [ordered_tuple (list\map (function (_ idx) (maybe.assume (dictionary.value idx idx->val)))
tuple_range)]]
(in [ordered_tuple recordT]))
))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
index bfb776fcd..354f40fd2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
@@ -90,7 +90,7 @@
(All [s i o]
(-> (Extender s i o) Text (Handler s i o) (Operation s i o Any)))
(function (_ [bundle state])
- (case (dictionary.get name bundle)
+ (case (dictionary.value name bundle)
#.None
(#try.Success [[(dictionary.has name (extender handler) bundle) state]
[]])
@@ -112,7 +112,7 @@
(All [s i o]
(-> Archive (Phase s i o) (Extension i) (Operation s i o o)))
(function (_ (^@ stateE [bundle state]))
- (case (dictionary.get name bundle)
+ (case (dictionary.value name bundle)
(#.Some handler)
(((handler name phase) archive parameters)
stateE)
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 4ef27d1d8..4913607a6 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
@@ -363,7 +363,7 @@
(phase\map jvm.array (jvm_type elemT))
(#.Primitive class parametersT)
- (case (dictionary.get class ..boxes)
+ (case (dictionary.value class ..boxes)
(#.Some [_ primitive_type])
(case parametersT
#.End
@@ -556,7 +556,7 @@
[jvm.char]))
(text.starts_with? descriptor.array_prefix name)
- (let [[_ unprefixed] (maybe.assume (text.split_with descriptor.array_prefix name))]
+ (let [[_ unprefixed] (maybe.assume (text.split_by descriptor.array_prefix name))]
(\ phase.monad map jvm.array
(check_jvm (#.Primitive unprefixed (list)))))
@@ -604,7 +604,7 @@
(def: (check_return type)
(-> .Type (Operation (Type Return)))
- (if (is? .Any type)
+ (if (same? .Any type)
(phase\in jvm.void)
(check_jvm type)))
@@ -1116,7 +1116,7 @@
(case (jvm_parser.var? actualJC)
(#.Some name)
(|> aliasing
- (dictionary.get name)
+ (dictionary.value name)
(maybe.else name)
jvm.var)
@@ -1146,7 +1146,7 @@
(case (jvm_parser.var? actualJC)
(#.Some name)
(|> aliasing
- (dictionary.get name)
+ (dictionary.value name)
(maybe.else name)
jvm.var)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
index 1cba80e10..04df2b765 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
@@ -335,7 +335,7 @@
handler
<type>
- (:assume handlerV)))
+ (:expected handlerV)))
_ (/////directive.lift_generation
(/////generation.log! (format <description> " " (%.text (:as Text name)))))]
(in /////directive.no_requirements))
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 b3b4be343..a79807c28 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
@@ -84,7 +84,7 @@
(template [<conversion> <name>]
[(def: (<name> inputG)
(Unary (Bytecode Any))
- (if (is? _.nop <conversion>)
+ (if (same? _.nop <conversion>)
inputG
($_ _.compose
inputG
@@ -643,7 +643,7 @@
(function (_ extension_name generate archive [class field unboxed])
(do //////.monad
[.let [$class (type.class class (list))]]
- (case (dictionary.get unboxed ..primitives)
+ (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(in (_.getstatic $class field primitive))
@@ -660,7 +660,7 @@
(do //////.monad
[valueG (generate archive valueS)
.let [$class (type.class class (list))]]
- (case (dictionary.get unboxed ..primitives)
+ (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(in ($_ _.compose
valueG
@@ -682,7 +682,7 @@
(do //////.monad
[objectG (generate archive objectS)
.let [$class (type.class class (list))
- getG (case (dictionary.get unboxed ..primitives)
+ getG (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(_.getfield $class field primitive)
@@ -702,7 +702,7 @@
[valueG (generate archive valueS)
objectG (generate archive objectS)
.let [$class (type.class class (list))
- putG (case (dictionary.get unboxed ..primitives)
+ putG (case (dictionary.value unboxed ..primitives)
(#.Some primitive)
(_.putfield $class field primitive)
@@ -888,7 +888,7 @@
(^ (//////synthesis.variable var))
(|> mapping
- (dictionary.get var)
+ (dictionary.value var)
(maybe.else var)
//////synthesis.variable)
@@ -915,7 +915,7 @@
(case local
(^ (//////synthesis.variable local))
(|> mapping
- (dictionary.get local)
+ (dictionary.value local)
(maybe.else local)
//////synthesis.variable)
@@ -1039,7 +1039,7 @@
(list\map (function (_ [foreign_id capture])
[(#//////variable.Foreign foreign_id)
(|> global_mapping
- (dictionary.get capture)
+ (dictionary.value capture)
maybe.assume)]))
(dictionary.from_list //////variable.hash))]
[ownerT name
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
index db25d1d70..0e0c91e60 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
@@ -71,7 +71,7 @@
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
(list\fold (function (_ clause total)
- (if (is? _.nil total)
+ (if (same? _.nil total)
clause
(_.or clause total)))
_.nil))
@@ -123,7 +123,7 @@
(/.install "-" (binary (product.uncurried _.-)))
(/.install "*" (binary (product.uncurried _.*)))
(/.install "/" (binary (product.uncurried _./)))
- (/.install "%" (binary (product.uncurried (function.flip (_.apply/2 (_.var "math.fmod"))))))
+ (/.install "%" (binary (product.uncurried (function.flipped (_.apply/2 (_.var "math.fmod"))))))
(/.install "=" (binary (product.uncurried _.=)))
(/.install "<" (binary (product.uncurried _.<)))
(/.install "i64" (unary (!unary "math.floor")))
@@ -148,7 +148,7 @@
(|> /.empty
(/.install "=" (binary (product.uncurried _.=)))
(/.install "<" (binary (product.uncurried _.<)))
- (/.install "concat" (binary (product.uncurried (function.flip _.concat))))
+ (/.install "concat" (binary (product.uncurried (function.flipped _.concat))))
(/.install "index" (trinary ..text//index))
(/.install "size" (unary //runtime.text//size))
... TODO: Use version below once the Lua compiler becomes self-hosted.
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
index c4059fc35..45d6873da 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
@@ -75,7 +75,7 @@
(in [(|> chars
(list\map (|>> .int _.int (_.=== @input)))
(list\fold (function (_ clause total)
- (if (is? _.null total)
+ (if (same? _.null total)
clause
(_.or clause total)))
_.null))
@@ -167,7 +167,7 @@
(|> /.empty
(/.install "=" (binary (product.uncurried _.==)))
(/.install "<" (binary (product.uncurried _.<)))
- (/.install "concat" (binary (product.uncurried (function.flip _.concat))))
+ (/.install "concat" (binary (product.uncurried (function.flipped _.concat))))
(/.install "index" (trinary ..text//index))
(/.install "size" (unary //runtime.text//size))
(/.install "char" (binary (product.uncurried //runtime.text//char)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
index 5b9eba41e..f683c9b9a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
@@ -69,7 +69,7 @@
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
(list\fold (function (_ clause total)
- (if (is? _.none total)
+ (if (same? _.none total)
clause
(_.or clause total)))
_.none))
@@ -146,7 +146,7 @@
(|> /.empty
(/.install "=" (binary (product.uncurried _.=)))
(/.install "<" (binary (product.uncurried _.<)))
- (/.install "concat" (binary (product.uncurried (function.flip _.+))))
+ (/.install "concat" (binary (product.uncurried (function.flipped _.+))))
(/.install "index" (trinary ..text::index))
(/.install "size" (unary _.len/1))
(/.install "char" (binary (product.uncurried //runtime.text::char)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
index 651f7a62d..db479ccd3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
@@ -68,7 +68,7 @@
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
(list\fold (function (_ clause total)
- (if (is? _.nil total)
+ (if (same? _.nil total)
clause
(_.or clause total)))
_.nil))
@@ -151,7 +151,7 @@
(|> /.empty
(/.install "=" (binary (product.uncurried _.=)))
(/.install "<" (binary (product.uncurried _.<)))
- (/.install "concat" (binary (product.uncurried (function.flip _.+))))
+ (/.install "concat" (binary (product.uncurried (function.flipped _.+))))
(/.install "index" (trinary text//index))
(/.install "size" (unary (_.the "length")))
(/.install "char" (binary (product.uncurried //runtime.text//char)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
index 624915eed..7bc4f46df 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
@@ -37,11 +37,11 @@
(def: .public register
(-> Register Var/1)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register Var/1)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
index ce6b2bdc6..917ab8503 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
@@ -38,7 +38,7 @@
(def: capture
(-> Register Var/1)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: (with_closure inits function_definition)
(-> (List (Expression Any)) (Expression Any) (Operation (Expression Any)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
index 12bce545f..b89ca3c5a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
@@ -34,7 +34,7 @@
(def: .public register
(-> Register Var)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
index 75b54ebe7..cccb72dd5 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
@@ -36,7 +36,7 @@
(def: capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: (with_closure @self inits body!)
(-> Var (List Expression) Statement [Statement Expression])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
index 589d9191d..d21adc3ef 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
@@ -32,11 +32,11 @@
(def: .public register
(-> Register Var)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
index 83db2505d..65930fb75 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
@@ -38,7 +38,7 @@
(def: capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: (with_closure inits @self @args body!)
(-> (List Expression) Var (List Var) Statement [Statement Expression])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
index bfc75d6ca..04cce603a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
@@ -36,11 +36,11 @@
(def: .public register
(-> Register Var)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
index f8746bdf2..5cc25a622 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
@@ -38,7 +38,7 @@
(def: capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: input
(|>> inc //case.register))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
index b00d65682..df2a1a3fc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
@@ -41,11 +41,11 @@
(def: .public register
(-> Register SVar)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register SVar)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
index 0304e7a58..b1ce3f5c8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
@@ -40,7 +40,7 @@
(def: .public capture
(-> Register SVar)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: (with_closure function_id @function inits function_definition)
(-> artifact.ID SVar (List (Expression Any)) (Statement Any) (Operation (Expression Any)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
index 87cae6c43..cd41e5f3d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
@@ -38,11 +38,11 @@
(def: .public register
(-> Register SVar)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register SVar)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
index dbdb0b1d0..fa95d1ba3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
@@ -42,11 +42,11 @@
(def: .public register
(-> Register LVar)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register LVar)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
index dc39ac6f7..b64895b0e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
@@ -40,7 +40,7 @@
(def: .public capture
(-> Register LVar)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: (with_closure inits self function_definition)
(-> (List Expression) Text Expression [Statement Expression])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
index b09071726..70dfee409 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
@@ -38,11 +38,11 @@
(def: .public register
(-> Register Var)
- (|>> (///reference.local //reference.system) :assume))
+ (|>> (///reference.local //reference.system) :expected))
(def: .public capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: .public (let expression archive [valueS register bodyS])
(Generator [Synthesis Register Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
index d52f5d920..a36feb036 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
@@ -38,7 +38,7 @@
(def: capture
(-> Register Var)
- (|>> (///reference.foreign //reference.system) :assume))
+ (|>> (///reference.foreign //reference.system) :expected))
(def: (with_closure inits function_definition)
(-> (List Expression) Computation (Operation Computation))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index 29ee68fac..78dc5dce1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -219,7 +219,7 @@
(def: (declare register redundancy)
(-> Register Redundancy (Try Redundancy))
- (case (dictionary.get register redundancy)
+ (case (dictionary.value register redundancy)
#.None
(#try.Success (dictionary.has register ..redundant! redundancy))
@@ -228,7 +228,7 @@
(def: (observe register redundancy)
(-> Register Redundancy (Try Redundancy))
- (case (dictionary.get register redundancy)
+ (case (dictionary.value register redundancy)
#.None
(exception.except ..unknown_register [register])
@@ -368,7 +368,7 @@
redundancy (..declare register redundancy)
[redundancy output] (optimization' [redundancy output])
.let [redundant? (|> redundancy
- (dictionary.get register)
+ (dictionary.value register)
(maybe.else ..necessary!))]]
(in [(dictionary.lacks register redundancy)
(#/.Control (if redundant?
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
index 6db98721b..15539ae10 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -195,7 +195,7 @@
... (#.Left error)
<<otherwise>>
- (:assume <<otherwise>>))])
+ (:expected <<otherwise>>))])
(template: (!horizontal where offset source_code)
[[(update@ #.column inc where)
@@ -228,7 +228,7 @@
(recur source' (#.Item top stack))
(#.Left [source' error])
- (if (is? <close> error)
+ (if (same? <close> error)
(#.Right [source'
[where (<tag> (list.reversed stack))]])
(#.Left [source' error])))))]
@@ -251,7 +251,7 @@
(recur sourceFV (#.Item [field value] stack)))
(#.Left [source' error])
- (if (is? ..close_record error)
+ (if (same? ..close_record error)
(#.Right [source'
[where (#.Record (list.reversed stack))]])
(#.Left [source' error])))))
@@ -368,7 +368,7 @@
(recur (!inc end) exponent)
[["e" "E"]
- (if (is? (static ..no_exponent) exponent)
+ (if (same? (static ..no_exponent) exponent)
(<| (!with_char+ source_code//size source_code (!inc end) char/1 <failure>)
(`` ("lux syntax char case!" char/1
[[<signs>]
@@ -468,7 +468,7 @@
(let [[where offset source_code] source]
(!failure ..full_name_parser where offset source_code))
(#.Right [source'' [(|> aliases
- (dictionary.get simple)
+ (dictionary.value simple)
(maybe.else simple))
complex]])))
<simple>)))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index 1d605c120..06a2d5ca8 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -92,7 +92,7 @@
(def: .public (id module archive)
(-> Module Archive (Try ID))
(let [(^slots [#..resolver]) (:representation archive)]
- (case (dictionary.get module resolver)
+ (case (dictionary.value module resolver)
(#.Some [id _])
(#try.Success id)
@@ -103,7 +103,7 @@
(def: .public (reserve module archive)
(-> Module Archive (Try [ID Archive]))
(let [(^slots [#..next #..resolver]) (:representation archive)]
- (case (dictionary.get module resolver)
+ (case (dictionary.value module resolver)
(#.Some _)
(exception.except ..module_has_already_been_reserved [module])
@@ -118,7 +118,7 @@
(def: .public (has module [descriptor document output] archive)
(-> Module [Descriptor (Document Any) Output] Archive (Try Archive))
(let [(^slots [#..resolver]) (:representation archive)]
- (case (dictionary.get module resolver)
+ (case (dictionary.value module resolver)
(#.Some [id #.None])
(#try.Success (|> archive
:representation
@@ -126,7 +126,7 @@
:abstraction))
(#.Some [id (#.Some [existing_descriptor existing_document existing_output])])
- (if (is? document existing_document)
+ (if (same? document existing_document)
... TODO: Find out why this code allows for the same module to be added more than once. It looks fishy...
(#try.Success archive)
(exception.except ..cannot_replace_document [module existing_document document]))
@@ -137,7 +137,7 @@
(def: .public (find module archive)
(-> Module Archive (Try [Descriptor (Document Any) Output]))
(let [(^slots [#..resolver]) (:representation archive)]
- (case (dictionary.get module resolver)
+ (case (dictionary.value module resolver)
(#.Some [id (#.Some entry)])
(#try.Success entry)
@@ -170,7 +170,7 @@
(def: .public (reserved? archive module)
(-> Archive Module Bit)
(let [(^slots [#..resolver]) (:representation archive)]
- (case (dictionary.get module resolver)
+ (case (dictionary.value module resolver)
(#.Some [id _])
bit.yes
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 e4240e404..de1858b97 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
@@ -100,7 +100,7 @@
(-> Text Registry (Maybe ID))
(|> (:representation registry)
(get@ #resolver)
- (dictionary.get name)))
+ (dictionary.value name)))
(def: .public writer
(Writer Registry)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
index d9f12d482..30777c282 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
@@ -42,7 +42,7 @@
key
e
- (:assume document//content)))
+ (:expected document//content)))
(exception.except ..invalid_signature [(key.signature key)
document//signature]))))
@@ -55,7 +55,7 @@
(All [d] (-> (Key d) (Document Any) (Try (Document d))))
(do try.monad
[_ (..read key document)]
- (in (:assume document))))
+ (in (:expected document))))
(def: .public signature
(-> (Document Any) Signature)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
index fc6c26067..2df8c36ec 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
@@ -75,7 +75,7 @@
(def: (dependency? ancestry target source)
(-> Graph Module Module Bit)
(let [target_ancestry (|> ancestry
- (dictionary.get target)
+ (dictionary.value target)
(maybe.else ..fresh))]
(set.member? target_ancestry source)))
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 a1f263f05..c5483ac0c 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -225,7 +225,7 @@
(case input
(#.Item [[artifact_id artifact_category] input'])
(case (do !
- [data (try.of_maybe (dictionary.get (format (%.nat artifact_id) extension) actual))
+ [data (try.of_maybe (dictionary.value (format (%.nat artifact_id) extension) actual))
.let [context [module_id artifact_id]
directive (\ host ingest context data)]]
(case artifact_category
@@ -328,7 +328,7 @@
(#.Definition [exported? type annotations _])
(|> definitions
- (dictionary.get def_name)
+ (dictionary.value def_name)
try.of_maybe
(\ ! map (|>> [exported? type annotations]
#.Definition
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 e65ede1eb..3e797c325 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
@@ -93,13 +93,13 @@
(def: (find_library_source_file importer import partial_host_extension module)
(-> Module Import Extension Module (Try [file.Path Binary]))
(let [path (format module (..full_host_extension partial_host_extension))]
- (case (dictionary.get path import)
+ (case (dictionary.value path import)
(#.Some data)
(#try.Success [path data])
#.None
(let [path (format module ..lux_extension)]
- (case (dictionary.get path import)
+ (case (dictionary.value path import)
(#.Some data)
(#try.Success [path data])
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
index 42a1a378c..90d28197a 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
@@ -63,7 +63,7 @@
(|> content
(\ encoding.utf8 decode)
(\ try.monad map
- (|>> :assume
+ (|>> :expected
(:sharing [directive]
directive
so_far
@@ -106,7 +106,7 @@
(|> descriptor
(get@ #descriptor.references)
set.list
- (list.all (function (_ module) (dictionary.get module mapping)))
+ (list.all (function (_ module) (dictionary.value module mapping)))
(list\map (|>> ..module_file _.string _.load_relative/1))
(list\fold ..then bundle)
(: _.Expression)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
index 28f8a3f28..fd6437557 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
@@ -45,7 +45,7 @@
(|> content
(\ utf8.codec decode)
(\ try.monad map
- (|>> :assume
+ (|>> :expected
(:sharing [directive]
directive
so_far
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 521ec2e8a..97cdf5a3d 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -30,6 +30,7 @@
(template [<name> <tag>]
[(def: .public (<name> type)
+ {#.doc (example "The number of parameters, and the body, of a quantified type.")}
(-> Type [Nat Type])
(loop [num_args 0
type type]
@@ -45,6 +46,7 @@
)
(def: .public (flat_function type)
+ {#.doc (example "The input, and the output of a function type.")}
(-> Type [(List Type) Type])
(case type
(#.Function in out')
@@ -55,6 +57,7 @@
[(list) type]))
(def: .public (flat_application type)
+ {#.doc (example "The quantified type, and its parameters, for a type-application.")}
(-> Type [Type (List Type)])
(case type
(#.Apply arg func')
@@ -66,6 +69,7 @@
(template [<name> <tag>]
[(def: .public (<name> type)
+ {#.doc (example "The members of a composite type.")}
(-> Type (List Type))
(case type
(<tag> left right)
@@ -79,6 +83,7 @@
)
(def: .public (format type)
+ {#.doc (example "A (readable) textual representable of a type.")}
(-> Type Text)
(case type
(#.Primitive name params)
@@ -87,7 +92,7 @@
(text.enclosed' text.double_quote name)
(|> params
(list\map (|>> format (text\compose " ")))
- (list\fold (function.flip text\compose) ""))
+ (list\fold (function.flipped text\compose) ""))
")")
(^template [<tag> <open> <close> <flat>]
@@ -181,7 +186,7 @@
(def: (= x y)
(or (for {@.php false} ... TODO: Remove this once JPHP is gone.
- (is? x y))
+ (same? x y))
(case [x y]
[(#.Primitive xname xparams) (#.Primitive yname yparams)]
(and (text\= xname yname)
@@ -222,6 +227,7 @@
))))
(def: .public (applied params func)
+ {#.doc (example "To the extend possible, applies a quantified type to the given parameters.")}
(-> (List Type) Type (Maybe Type))
(case params
#.End
@@ -246,6 +252,8 @@
#.None)))
(def: .public (code type)
+ {#.doc (example "A representation of a type as code."
+ "The code is such that evaluating it would yield the type value.")}
(-> Type Code)
(case type
(#.Primitive name params)
@@ -274,6 +282,7 @@
))
(def: .public (de_aliased type)
+ {#.doc (example "A (potentially named) type that does not have its name shadowed by other names.")}
(-> Type Type)
(case type
(#.Named _ (#.Named name type'))
@@ -283,6 +292,7 @@
type))
(def: .public (anonymous type)
+ {#.doc (example "A type without any names covering it.")}
(-> Type Type)
(case type
(#.Named name type')
@@ -293,6 +303,7 @@
(template [<name> <base> <ctor>]
[(def: .public (<name> types)
+ {#.doc (example "A composite type, constituted by the given member types.")}
(-> (List Type) Type)
(case types
#.End
@@ -309,6 +320,7 @@
)
(def: .public (function inputs output)
+ {#.doc (example "A function type, with the given inputs and output.")}
(-> (List Type) Type Type)
(case inputs
#.End
@@ -318,6 +330,7 @@
(#.Function input (function inputs' output))))
(def: .public (application params quant)
+ {#.doc (example "An un-evaluated type application, with the given quantified type, and parameters.")}
(-> (List Type) Type Type)
(case params
#.End
@@ -328,6 +341,7 @@
(template [<name> <tag>]
[(def: .public (<name> size body)
+ {#.doc (example "A quantified type, with the given number of parameters, and body.")}
(-> Nat Type Type)
(case size
0 body
@@ -338,6 +352,7 @@
)
(def: .public (quantified? type)
+ {#.doc (example "Only yields #1 for universally or existentially quantified types.")}
(-> Type Bit)
(case type
(#.Named [module name] _type)
@@ -355,6 +370,7 @@
#0))
(def: .public (array depth element_type)
+ {#.doc (example "An array type, with the given level of nesting/depth, and the given element type.")}
(-> Nat Type Type)
(case depth
0 element_type
@@ -364,6 +380,7 @@
(#.Primitive array.type_name))))
(def: .public (flat_array type)
+ {#.doc (example "The level of nesting/depth and element type for an array type.")}
(-> Type [Nat Type])
(case type
(^multi (^ (#.Primitive name (list element_type)))
@@ -375,6 +392,7 @@
[0 type]))
(def: .public array?
+ {#.doc (example "Is a type an array type?")}
(-> Type Bit)
(|>> ..flat_array
product.left
@@ -390,6 +408,12 @@
(syntax: .public (:log! [input (<>.or (<>.and <code>.identifier
(<>.maybe (<>.after (<code>.identifier! ..secret_marker) <code>.any)))
<code>.any)])
+ {#.doc (example "Logs to the console/terminal the type of an expression."
+ (:log! (: Foo (foo expression)))
+ "=>"
+ "Expression: (foo expression)"
+ " Type: Foo"
+ (foo expression))}
(case input
(#.Left [valueN valueC])
(do meta.monad
@@ -421,9 +445,18 @@
input <code>.any
output <code>.any
value (<>.maybe <code>.any)])
+ {#.doc (example "Casts a value to a specific type."
+ "The specified type can depend on type variables of the original type of the value."
+ (: (Bar Bit Nat Text)
+ (:cast [a b c]
+ (Foo a [b c])
+ (Bar a b c)
+ (: (Foo Bit [Nat Text])
+ (foo expression))))
+ "NOTE: Careless use of type-casts is an easy way to introduce bugs. USE WITH CAUTION.")}
(let [casterC (` (: (All [(~+ (list\map code.local_identifier type_vars))]
(-> (~ input) (~ output)))
- (|>> :assume)))]
+ (|>> :expected)))]
(case value
#.None
(in (list casterC))
@@ -443,6 +476,15 @@
(syntax: .public (:sharing [type_vars ..type_parameters
exemplar ..typed
computation ..typed])
+ {#.doc (example "Allows specifing the type of an expression as sharing type-variables with the type of another expression."
+ (: (Bar Bit Nat Text)
+ (:cast [a b c]
+ (Foo a [b c])
+ (: (Foo Bit [Nat Text])
+ (foo expression))
+
+ (Bar a b c)
+ (bar expression))))}
(macro.with_identifiers [g!_]
(let [shareC (` (: (All [(~+ (list\map code.local_identifier type_vars))]
(-> (~ (get@ #type exemplar))
@@ -454,6 +496,16 @@
(syntax: .public (:by_example [type_vars ..type_parameters
exemplar ..typed
extraction <code>.any])
+ {#.doc (example "Constructs a type that shares type-variables with an expression of some other type."
+ (: Type
+ (:by_example [a b c]
+ (Foo a [b c])
+ (: (Foo Bit [Nat Text])
+ (foo expression))
+
+ (Bar a b c)))
+ "=>"
+ (.type (Bar Bit Nat Text)))}
(in (list (` (:of ((~! :sharing)
[(~+ (list\map code.local_identifier type_vars))]
@@ -461,4 +513,4 @@
(~ (get@ #expression exemplar))
(~ extraction)
- (:assume [])))))))
+ (:expected [])))))))
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux
index 90332bf08..362167393 100644
--- a/stdlib/source/library/lux/type/abstract.lux
+++ b/stdlib/source/library/lux/type/abstract.lux
@@ -80,9 +80,9 @@
current_frames (peek_frames reference definition_reference (get@ #.modules compiler))]
(case (case frame
(#.Some frame)
- (list.find (function (_ [actual _])
- (text\= frame actual))
- current_frames)
+ (list.example (function (_ [actual _])
+ (text\= frame actual))
+ current_frames)
#.None
(..peek current_frames))
@@ -277,12 +277,12 @@
(:abstraction Single [value value]))
(let [value 0123]
- (is? value
- (|> value
- single'
- (:representation Single)
- double
- :representation)))))
+ (same? value
+ (|> value
+ single'
+ (:representation Single)
+ double
+ :representation)))))
"Type-parameters do not necessarily have to be used in the representation type."
"If they are not used, they become phantom types and can be used to customize types without changing the representation."
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 2048e1159..0201a446a 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -384,15 +384,15 @@
[?bound (read id)]
(else (maybe.else (#.Var id) ?bound)))))
-... TODO: "link_2" can be optimized...
-(def: (link_2 left right)
+... TODO: "link/2" can be optimized...
+(def: (link/2 left right)
(-> Var Var (Check Any))
(do ..monad
[_ (..bind (#.Var right) left)]
(..bind (#.Var left) right)))
-... TODO: "link_3" can be optimized...
-(def: (link_3 interpose to from)
+... TODO: "link/3" can be optimized...
+(def: (link/3 interpose to from)
(-> Var Var Var (Check Any))
(do ..monad
[_ (update (#.Var interpose) from)]
@@ -410,7 +410,7 @@
... Link the 2 variables circularly
[#.None #.None]
(do !
- [_ (link_2 idE idA)]
+ [_ (link/2 idE idA)]
(in assumptions))
... Interpose new variable between 2 existing links
@@ -418,7 +418,7 @@
(case etype
(#.Var targetE)
(do !
- [_ (link_3 idA targetE idE)]
+ [_ (link/3 idA targetE idE)]
(in assumptions))
_
@@ -429,7 +429,7 @@
(case atype
(#.Var targetA)
(do !
- [_ (link_3 idE targetA idA)]
+ [_ (link/3 idE targetA idA)]
(in assumptions))
_
@@ -447,7 +447,7 @@
(do !
[_ (monad.fold ! (function (_ interpose to)
(do !
- [_ (link_3 interpose to idE)]
+ [_ (link/3 interpose to idE)]
(in interpose)))
targetE
(set.list ringA))]
@@ -565,7 +565,7 @@
{#.doc "Type-check to ensure that the 'expected' type subsumes the 'actual' type."}
(Checker Type)
(if (for {@.php false} ... TODO: Remove this once JPHP is gone.
- (is? expected actual))
+ (same? expected actual))
(check\in assumptions)
(with ..type_check_failed [expected actual]
(case [expected actual]
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index 957f7deb2..d8aeeebb1 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -29,8 +29,8 @@
(def: (type_var id env)
(-> Nat Type_Context (Meta Type))
- (case (list.find (|>> product.left (n.= id))
- (get@ #.var_bindings env))
+ (case (list.example (|>> product.left (n.= id))
+ (get@ #.var_bindings env))
(#.Some [_ (#.Some type)])
(case type
(#.Var id')
@@ -50,7 +50,7 @@
(-> Name (Meta Type))
(do meta.monad
[raw_type (meta.type var_name)
- compiler meta.get_compiler]
+ compiler meta.compiler_state]
(case raw_type
(#.Var id)
(type_var id (get@ #.type_context compiler))
@@ -209,7 +209,7 @@
Type_Context Type (List [Name Type])
(Meta (List Instance)))
(do meta.monad
- [compiler meta.get_compiler]
+ [compiler meta.compiler_state]
(case (|> alts
(list\map (function (_ [alt_name alt_type])
(case (check.result context
@@ -257,7 +257,7 @@
(def: (candidate_alternatives sig_type member_idx input_types output_type alts)
(-> Type Nat (List Type) Type (List [Name Type]) (Meta (List Instance)))
(do meta.monad
- [compiler meta.get_compiler
+ [compiler meta.compiler_state
context meta.type_context]
(case (|> alts
(list\map (function (_ [alt_name alt_type])
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index 1dea469da..8a815c47b 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -152,11 +152,11 @@
"This keys will be placed at the front of the keyring in the order they are specified."
"The specific keys must be specified based of their index into the current keyring."
(do (..monad !)
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.exchange [1 0]) !)
- left (/.read ! res|left)
- right (/.read ! res|right)]
+ [res|left (commutative ! pre)
+ res|right (commutative ! post)
+ _ ((exchange [1 0]) !)
+ left (read ! res|left)
+ right (read ! res|right)]
(in (format left right))))}
(macro.with_identifiers [g!_ g!context g!!]
(case swaps
@@ -199,12 +199,12 @@
[(syntax: .public (<name> [amount ..amount])
{#.doc (example "Group/un-group keys in the keyring into/out-of tuples."
(do (..monad !)
- [res|left (/.commutative ! pre)
- res|right (/.commutative ! post)
- _ ((/.group 2) !)
- _ ((/.un_group 2) !)
- right (/.read ! res|right)
- left (/.read ! res|left)]
+ [res|left (commutative ! pre)
+ res|right (commutative ! post)
+ _ ((group 2) !)
+ _ ((un_group 2) !)
+ right (read ! res|right)
+ left (read ! res|left)]
(in (format left right))))}
(macro.with_identifiers [g!_ g!context g!!]
(do {! meta.monad}
diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux
index eb368954b..ce9842b8d 100644
--- a/stdlib/source/library/lux/world/db/sql.lux
+++ b/stdlib/source/library/lux/world/db/sql.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Source Definition function and or not type is? int)
+ [lux (#- Source Definition function and or not type int)
[control
[monad (#+ do)]]
[data
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index b0ae0d400..293856d25 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -367,7 +367,7 @@
io.run!
write!
(if (ffi.null? error)
- (#try.Success (:assume datum))
+ (#try.Success (:expected datum))
(#try.Failure (Error::toString [] (:as Error error))))))
(ffi.import: JsPath
@@ -1014,10 +1014,10 @@
(def: (retrieve_mock_file! separator path mock)
(-> Text Path Mock (Try [Text Mock_File]))
(loop [directory mock
- trail (text.split_all_with separator path)]
+ trail (text.all_split_by separator path)]
(case trail
(#.Item head tail)
- (case (dictionary.get head directory)
+ (case (dictionary.value head directory)
#.None
(exception.except ..cannot_find_file [path])
@@ -1038,10 +1038,10 @@
(def: (update_mock_file! / path now content mock)
(-> Text Path Instant Binary Mock (Try Mock))
(loop [directory mock
- trail (text.split_all_with / path)]
+ trail (text.all_split_by / path)]
(case trail
(#.Item head tail)
- (case (dictionary.get head directory)
+ (case (dictionary.value head directory)
#.None
(case tail
#.End
@@ -1077,10 +1077,10 @@
(def: (delete_mock_node! / path mock)
(-> Text Path Mock (Try Mock))
(loop [directory mock
- trail (text.split_all_with / path)]
+ trail (text.all_split_by / path)]
(case trail
(#.Item head tail)
- (case (dictionary.get head directory)
+ (case (dictionary.value head directory)
#.None
(exception.except ..cannot_delete [path])
@@ -1125,10 +1125,10 @@
(def: (make_mock_directory! / path mock)
(-> Text Path Mock (Try Mock))
(loop [directory mock
- trail (text.split_all_with / path)]
+ trail (text.all_split_by / path)]
(case trail
(#.Item head tail)
- (case (dictionary.get head directory)
+ (case (dictionary.value head directory)
#.None
(case tail
#.End
@@ -1153,13 +1153,13 @@
(def: (retrieve_mock_directory! / path mock)
(-> Text Path Mock (Try Mock))
(loop [directory mock
- trail (text.split_all_with / path)]
+ trail (text.all_split_by / path)]
(case trail
#.End
(#try.Success directory)
(#.Item head tail)
- (case (dictionary.get head directory)
+ (case (dictionary.value head directory)
#.None
(exception.except ..cannot_find_directory [path])
@@ -1331,7 +1331,7 @@
"Also, creates every super-directory necessary to make the given path valid.")}
(All [!] (-> (Monad !) (System !) Path (! (Try Any))))
(let [rooted? (text.starts_with? (\ fs separator) path)
- segments (text.split_all_with (\ fs separator) path)]
+ segments (text.all_split_by (\ fs separator) path)]
(case (if rooted?
(list.drop 1 segments)
segments)
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index c7642f6b5..0bbc37e35 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -113,7 +113,7 @@
(-> Concern //.Path (Var Directory_Tracker) (STM Bit))
(do {! stm.monad}
[@tracker (stm.read tracker)]
- (case (dictionary.get path @tracker)
+ (case (dictionary.value path @tracker)
(#.Some [old_concern last_modified])
(do !
[_ (stm.update (dictionary.has path [new_concern last_modified]) tracker)]
@@ -167,7 +167,7 @@
(list))
modifications (list.all (function (_ [path current_modification])
(do maybe.monad
- [previous_modification (dictionary.get path file_tracker)]
+ [previous_modification (dictionary.value path file_tracker)]
(in [path previous_modification current_modification])))
current_files)]]
(in [[directory
@@ -211,7 +211,7 @@
(stm.commit
(do stm.monad
[@tracker (stm.read tracker)]
- (in (case (dictionary.get path @tracker)
+ (in (case (dictionary.value path @tracker)
(#.Some [concern file_tracker])
(#try.Success concern)
@@ -221,7 +221,7 @@
(stm.commit
(do {! stm.monad}
[@tracker (stm.read tracker)]
- (case (dictionary.get path @tracker)
+ (case (dictionary.value path @tracker)
(#.Some [concern file_tracker])
(do !
[_ (stm.update (dictionary.lacks path) tracker)]
@@ -312,16 +312,16 @@
(-> (java/nio/file/WatchEvent a) Concern))
(let [kind (:as (java/nio/file/WatchEvent$Kind java/nio/file/Path)
(java/nio/file/WatchEvent::kind event))]
- (cond (is? (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE)
- kind)
+ (cond (same? (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE)
+ kind)
..creation
- (is? (java/nio/file/StandardWatchEventKinds::ENTRY_MODIFY)
- kind)
+ (same? (java/nio/file/StandardWatchEventKinds::ENTRY_MODIFY)
+ kind)
..modification
- (is? (java/nio/file/StandardWatchEventKinds::ENTRY_DELETE)
- kind)
+ (same? (java/nio/file/StandardWatchEventKinds::ENTRY_DELETE)
+ kind)
..deletion
... else
@@ -426,7 +426,7 @@
(function (_ path)
(do {! async.monad}
[@tracker (stm.commit (stm.read tracker))]
- (case (dictionary.get path @tracker)
+ (case (dictionary.value path @tracker)
(#.Some [concern key])
(do !
[_ (async.future
@@ -452,7 +452,7 @@
(def: (concern path)
(do async.monad
[@tracker (stm.commit (stm.read tracker))]
- (case (dictionary.get path @tracker)
+ (case (dictionary.value path @tracker)
(#.Some [concern key])
(in (#try.Success concern))
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index 92b399f28..5c8d162c6 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -84,7 +84,7 @@
(function (_ [identification protocol resource message])
(let [full (get@ #//.uri resource)
[uri query] (|> full
- (text.split_with "?")
+ (text.split_by "?")
(maybe.else [full ""]))]
(case (do try.monad
[query (//query.parameters query)
@@ -117,7 +117,7 @@
(function (_ (^@ request [identification protocol resource message]))
(case (do try.monad
[cookies (|> (get@ #//.headers message)
- (dictionary.get "Cookie")
+ (dictionary.value "Cookie")
(maybe.else "")
//cookie.get)]
(context.result cookies property))
diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux
index 5c9735c51..488d0ba36 100644
--- a/stdlib/source/library/lux/world/program.lux
+++ b/stdlib/source/library/lux/world/program.lux
@@ -98,7 +98,7 @@
(def: available_variables
(function.constant (io.io (dictionary.keys environment))))
(def: (variable name)
- (io.io (case (dictionary.get name environment)
+ (io.io (case (dictionary.value name environment)
(#.Some value)
(#try.Success value)
@@ -419,7 +419,7 @@
@.lua (do io.monad
[.let [default <default>]
on_windows (..run_command default "cd")]
- (if (is? default on_windows)
+ (if (same? default on_windows)
(..run_command default "pwd")
(in on_windows)))
@.ruby (io.io (RubyFileUtils::pwd))
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index e6dae7bbc..05aee240b 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -124,7 +124,7 @@
(..fail! error))))
(\ io.monad in [])))
-(program: [{[profile operation] /cli.command}]
+(program: [[profile operation] /cli.command]
(do {! io.monad}
[?console console.default]
(case (try\map console.async ?console)
@@ -166,7 +166,7 @@
(#/cli.Deploy repository identity)
(..command
(case [(get@ #/.identity profile)
- (dictionary.get repository (get@ #/.deploy_repositories profile))]
+ (dictionary.value repository (get@ #/.deploy_repositories profile))]
[(#.Some artifact) (#.Some repository)]
(/command/deploy.do! console
(/repository.async (/repository/remote.repository http.default (#.Some identity) repository))
diff --git a/stdlib/source/program/aedifex/action.lux b/stdlib/source/program/aedifex/action.lux
index 55994c67b..41d168b97 100644
--- a/stdlib/source/program/aedifex/action.lux
+++ b/stdlib/source/program/aedifex/action.lux
@@ -13,4 +13,4 @@
(def: .public monad
(Monad Action)
- (:assume (try.with async.monad)))
+ (:expected (try.with async.monad)))
diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux
index a6980813e..e37894330 100644
--- a/stdlib/source/program/aedifex/artifact.lux
+++ b/stdlib/source/program/aedifex/artifact.lux
@@ -87,7 +87,7 @@
(def: .public (directory separator group)
(-> Text Group Text)
(|> group
- (text.split_all_with ..group_separator)
+ (text.all_split_by ..group_separator)
(text.join_with separator)))
(def: .public (uri version artifact)
@@ -103,6 +103,6 @@
(-> Artifact (List Text))
(list\compose (|> artifact
(get@ #group)
- (text.split_all_with ..group_separator))
+ (text.all_split_by ..group_separator))
(list (get@ #name artifact)
(get@ #version artifact))))
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index e14eee20f..41668665e 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -83,7 +83,7 @@
(def: (remove_dependency dependency)
(-> Dependency (-> Resolution Resolution))
(|>> dictionary.entries
- (list.only (|>> product.left (is? dependency) not))
+ (list.only (|>> product.left (same? dependency) not))
(dictionary.of_list ///dependency.hash)))
(def: (compiler resolution compiler_dependency)
@@ -135,8 +135,8 @@
text.equivalence)
(def: (< left right)
- (loop [left (text.split_all_with ..version_separator left)
- right (text.split_all_with ..version_separator right)]
+ (loop [left (text.all_split_by ..version_separator left)
+ right (text.all_split_by ..version_separator right)]
(case [left right]
[(#.Item leftH leftT) (#.Item rightH rightT)]
(if (text\= leftH rightH)
@@ -164,7 +164,7 @@
identity [(get@ #///artifact.group artifact)
(get@ #///artifact.name artifact)]
version (get@ #///artifact.version artifact)]
- (case (dictionary.get identity uniques)
+ (case (dictionary.value identity uniques)
(#.Some [current_version current_path])
(if (\ version_order < version current_version)
(dictionary.has identity [version dependency] uniques)
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index 05ae5c523..22778e25b 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -88,7 +88,7 @@
(:as Text))
(\ utf8.codec decode actual))
actual (|> output
- (text.split_all_with " ")
+ (text.all_split_by " ")
list.head
(maybe.else output)
(\ codec decode))
@@ -221,7 +221,7 @@
tail
resolution)
_ (do {! async.monad}
- [?package (case (dictionary.get head resolution)
+ [?package (case (dictionary.value head resolution)
(#.Some package)
(in (#try.Success package))
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index 37ce2c46b..6d4d05b92 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -39,12 +39,12 @@
(def: (singular input tag parser)
(All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser a)))
- (<code>.local (..as_input (dictionary.get tag input))
+ (<code>.local (..as_input (dictionary.value tag input))
parser))
(def: (plural input tag parser)
(All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser (List a))))
- (<code>.local (..as_input (dictionary.get tag input))
+ (<code>.local (..as_input (dictionary.value tag input))
(<code>.tuple (<>.some parser))))
(def: group
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux
index 146ef471b..f3a945d66 100644
--- a/stdlib/source/program/aedifex/pom.lux
+++ b/stdlib/source/program/aedifex/pom.lux
@@ -171,17 +171,17 @@
(<| <>.lift
try.of_maybe
(do maybe.monad
- [group (dictionary.get ["" ..group_tag] properties)
- artifact (dictionary.get ["" ..artifact_tag] properties)]
+ [group (dictionary.value ["" ..group_tag] properties)
+ artifact (dictionary.value ["" ..artifact_tag] properties)]
(in {#//dependency.artifact {#//artifact.group group
#//artifact.name artifact
#//artifact.version (|> properties
- (dictionary.get ["" ..version_tag])
+ (dictionary.value ["" ..version_tag])
(maybe.else "")
(text.replaced "${project.version}" own_version)
(text.replaced "${project.parent.version}" parent_version))}
#//dependency.type (|> properties
- (dictionary.get ["" "type"])
+ (dictionary.value ["" "type"])
(maybe.else //artifact/type.jvm_library))})))))
(def: (dependencies_parser own_version parent_version)
diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux
index fdaf77e6c..951e82d34 100644
--- a/stdlib/source/program/aedifex/project.lux
+++ b/stdlib/source/program/aedifex/project.lux
@@ -52,10 +52,10 @@
(def: (profile' lineage project name)
(-> (Set Name) Project Name (Try Profile))
- (case (dictionary.get name project)
+ (case (dictionary.value name project)
(#.Some profile)
- (case (list.find (set.member? lineage)
- (get@ #//.parents profile))
+ (case (list.example (set.member? lineage)
+ (get@ #//.parents profile))
(#.Some ouroboros)
(exception.except ..circular_dependency [ouroboros name])
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 849c5b89a..efe7a6b28 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -143,14 +143,14 @@
(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)))
+ (:expected (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
(Async (Try [Archive (directive.State+ <parameters>)]))
- (:assume (platform.compile import static expander platform compilation [archive state])))
+ (:expected (platform.compile import static expander platform compilation [archive state])))
_ (ioW.freeze (get@ #platform.&file_system platform) static archive)
program_context (async\in ($/program.context archive))
host_dependencies (..load_host_dependencies (get@ #platform.&file_system platform) compilation_host_dependencies)
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index 9128fdc60..ab4c2e787 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -93,7 +93,7 @@
(def: (prefix_lines prefix lines)
(-> Text Text Text)
(|> lines
- (text.split_all_with text.new_line)
+ (text.all_split_by text.new_line)
(list\map (|>> (format prefix)))
(text.join_with text.new_line)))
@@ -372,7 +372,7 @@
(unravel_type_func nesting)
(when> [(new> recursive_type? [])] [unrecurse_type])
(pprint_type_definition (dec nesting) [_name type_arguments] (maybe.else (list) tags) module interface? recursive_type?)
- (text.split_all_with text.new_line)
+ (text.all_split_by text.new_line)
(list\map (|>> (format " ")))
(text.join_with text.new_line))
")"))))
@@ -399,7 +399,7 @@
md.empty)
type_code)))))
types)]
- (in (list\fold (function.flip md.then)
+ (in (list\fold (function.flipped md.then)
(md.heading/2 "Types")
type_docs))))
@@ -415,7 +415,7 @@
(do maybe.monad
[documentation (annotation.documentation def_annotations)]
(in (md.code documentation))))))))
- (list\fold (function.flip md.then)
+ (list\fold (function.flipped md.then)
(md.heading/2 "Macros"))))
(template [<singular> <plural> <header>]
@@ -443,7 +443,7 @@
_
md.empty)
(<singular> module value_type)))))
- (list\fold (function.flip md.then)
+ (list\fold (function.flipped md.then)
(md.heading/2 <header>))))]
[document_implementation document_implementations "Implementations"]
@@ -453,7 +453,7 @@
(def: (enclose_lines pre+post block)
(-> [Text Text] Text Text)
(|> block
- (text.split_all_with text.new_line)
+ (text.all_split_by text.new_line)
(list\map (text.enclosed pre+post))
(text.join_with text.new_line)))
diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux
index ec00f935f..cd740649c 100644
--- a/stdlib/source/specification/compositor/generation/primitive.lux
+++ b/stdlib/source/specification/compositor/generation/primitive.lux
@@ -35,7 +35,7 @@
(_.test (%.name (name_of <synthesis>))
(|> (run <evaluation_name> (<synthesis> expected))
(case> (#try.Success actual)
- (<test> expected (:assume actual))
+ (<test> expected (:expected actual))
(#try.Failure _)
false))))]
diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux
index 212aa01dd..c67ade3ec 100644
--- a/stdlib/source/test/aedifex/artifact/time/date.lux
+++ b/stdlib/source/test/aedifex/artifact/time/date.lux
@@ -60,7 +60,7 @@
(_.cover [/.year_is_out_of_range]
(case (/.date candidate)
(#try.Success date)
- (is? candidate (/.value date))
+ (same? candidate (/.value date))
(#try.Failure error)
(exception.match? /.year_is_out_of_range error)))
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index 934810e0c..41d0f080f 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -111,7 +111,7 @@
(shell.async ($build.good_shell []))
resolution)
(\ ! map (|>> (case> (#try.Failure error)
- (is? end_signal error)
+ (same? end_signal error)
(#try.Success _)
false))))
diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux
index 0400cbc58..2bdf72078 100644
--- a/stdlib/source/test/aedifex/command/version.lux
+++ b/stdlib/source/test/aedifex/command/version.lux
@@ -45,7 +45,7 @@
(if open?
(try.of_maybe
(do maybe.monad
- [[output state] (text.split_with text.new_line state)]
+ [[output state] (text.split_by text.new_line state)]
(in [[open? state] output])))
(exception.except ..console_is_closed! [])))
(def: (on_write input [open? state])
diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux
index ccccc47cd..9ddabee88 100644
--- a/stdlib/source/test/aedifex/dependency/deployment.lux
+++ b/stdlib/source/test/aedifex/dependency/deployment.lux
@@ -105,7 +105,7 @@
correct_library_upload!
(and (|> cache
- (dictionary.get library_url)
+ (dictionary.value library_url)
(maybe\map (binary\= expected_library))
(maybe.else false))
(dictionary.key? cache (format library_url artifact/extension.sha-1))
@@ -113,7 +113,7 @@
correct_pom_upload!
(and (|> cache
- (dictionary.get pom_url)
+ (dictionary.value pom_url)
(maybe\map (binary\= expected_pom))
(maybe.else false))
(dictionary.key? cache (format pom_url artifact/extension.sha-1))
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index e05dc712f..e05c1d753 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -80,7 +80,7 @@
_ false)
(let [expected_sha1 (//hash.sha-1 expected_library)
expected_md5 (//hash.md5 expected_library)]
- (and (is? expected_library actual_library)
+ (and (same? expected_library actual_library)
(case library_status
(#//status.Verified actual_sha1 expected_md5)
(and (//hash\= expected_sha1 actual_sha1)
@@ -90,7 +90,7 @@
false)))
(let [expected_sha1 (//hash.sha-1 binary_pom)
expected_md5 (//hash.md5 binary_pom)]
- (and (is? expected_pom actual_pom)
+ (and (same? expected_pom actual_pom)
(|> (do try.monad
[xml_pom (\ utf8.codec decode binary_pom)
decoded_pom (\ xml.codec decode xml_pom)]
diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux
index 857aaf6e1..b1ec22e6c 100644
--- a/stdlib/source/test/aedifex/profile.lux
+++ b/stdlib/source/test/aedifex/profile.lux
@@ -155,9 +155,9 @@
(_.cover [/.default_compiler]
(|> (\ /.monoid identity)
(get@ #/.compiler)
- (is? /.default_compiler)))
+ (same? /.default_compiler)))
(_.cover [/.default_target]
(|> (\ /.monoid identity)
(get@ #/.target)
- (is? /.default_target)))
+ (same? /.default_target)))
)))))
diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux
index ce7647c9e..8e8b4c945 100644
--- a/stdlib/source/test/aedifex/repository.lux
+++ b/stdlib/source/test/aedifex/repository.lux
@@ -71,7 +71,7 @@
(def: the_description
"@")
(def: (on_download uri state)
- (case (dictionary.get uri state)
+ (case (dictionary.value uri state)
(#.Some content)
(case (binary.size content)
0 (exception.except ..not_found [uri])
diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux
index 8cca4aee8..44f913863 100644
--- a/stdlib/source/test/aedifex/repository/remote.lux
+++ b/stdlib/source/test/aedifex/repository/remote.lux
@@ -47,8 +47,8 @@
(<| io.io
#try.Success
(if (|> headers
- (dictionary.get "User-Agent")
- (maybe\map (is? /.user_agent))
+ (dictionary.value "User-Agent")
+ (maybe\map (same? /.user_agent))
(maybe.else false))
(case [method input]
[#@http.Get #.None]
@@ -58,7 +58,7 @@
[#@http.Put (#.Some input)]
(if (|> headers
- (dictionary.get "Authorization")
+ (dictionary.value "Authorization")
(maybe\map (text\= (//identity.basic_auth user password)))
(maybe.else false))
[http/status.created
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 34d3b4cc1..cf45f0ca5 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -12,18 +12,25 @@
[monad (#+ do)]]
[control
["." io]
+ ["." maybe ("#\." functor)]
[concurrency
- ["." atom (#+ Atom)]]]
+ ["." atom (#+ Atom)]]
+ [parser
+ ["<.>" code]]]
[data
+ ["." product]
["." bit ("#\." equivalence)]
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list]
- ["." set (#+ Set)]]]
+ ["." list ("#\." functor)]
+ ["." set (#+ Set) ("#\." equivalence)]
+ [dictionary
+ ["." plist]]]]
["." macro
[syntax (#+ syntax:)]
- ["." code ("#\." equivalence)]]
+ ["." code ("#\." equivalence)]
+ ["." template]]
["." math
["." random ("#\." functor)]
[number
@@ -440,15 +447,15 @@
(_.cover [/.Macro']
(|> macro
(: /.Macro')
- (is? macro)))
+ (same? macro)))
(_.cover [/.Macro]
(|> macro
"lux macro"
(: /.Macro)
(: Any)
- (is? (: Any macro))))
+ (same? (: Any macro))))
(_.cover [/.macro:]
- (is? expected (..identity_macro expected)))
+ (same? expected (..identity_macro expected)))
<found_crosshair?>
))))))
@@ -480,61 +487,61 @@
(_.cover [/.:]
(|> expected
(/.: Any)
- (is? (/.: Any expected))))
+ (same? (/.: Any expected))))
(_.cover [/.:as]
(|> expected
(/.: Any)
(/.:as /.Nat)
- (is? expected)))
- (_.cover [/.:assume]
+ (same? expected)))
+ (_.cover [/.:expected]
(|> expected
(/.: Any)
- /.:assume
+ /.:expected
(/.: /.Nat)
- (is? expected)))
+ (same? 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))))
+ (and (same? expected_left actual_left)
+ (same? expected_right actual_right))))
(_.cover [/.:of]
- (is? /.Nat (/.:of expected)))
+ (same? /.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))
+ (and (same? expected/0 actual/0)
+ (same? 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))
+ (and (same? expected/0 actual/0)
+ (same? expected/1 actual/1))
_
false)
(case (/.type (/.Or expected/0 expected/1))
(#.Sum actual/0 actual/1)
- (and (is? expected/0 actual/0)
- (is? expected/1 actual/1))
+ (and (same? expected/0 actual/0)
+ (same? 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))
+ (and (same? expected/0 actual/0)
+ (same? 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))
+ (and (same? expected/0 actual/0)
+ (same? expected/1 actual/1))
_
false)))
@@ -552,17 +559,17 @@
[expected random.i64]
($_ _.and
(_.cover [/.i64]
- (is? (: Any expected)
- (: Any (/.i64 expected))))
+ (same? (: Any expected)
+ (: Any (/.i64 expected))))
(_.cover [/.nat]
- (is? (: Any expected)
- (: Any (/.nat expected))))
+ (same? (: Any expected)
+ (: Any (/.nat expected))))
(_.cover [/.int]
- (is? (: Any expected)
- (: Any (/.int expected))))
+ (same? (: Any expected)
+ (: Any (/.int expected))))
(_.cover [/.rev]
- (is? (: Any expected)
- (: Any (/.rev expected))))
+ (same? (: Any expected)
+ (: Any (/.rev expected))))
(_.cover [/.inc]
(n.= 1 (n.- expected
(/.inc expected))))
@@ -667,41 +674,41 @@
(_.cover [/.get@]
(and (and (|> sample
(/.get@ #big_left)
- (is? start/b))
+ (same? start/b))
(|> sample
((/.get@ #big_left))
- (is? start/b)))
+ (same? start/b)))
(and (|> sample
(/.get@ [#big_right #small_left])
- (is? start/s))
+ (same? start/s))
(|> sample
((/.get@ [#big_right #small_left]))
- (is? start/s)))))
+ (same? start/s)))))
(_.cover [/.set@]
(and (and (|> sample
(/.set@ #big_left shift/b)
(/.get@ #big_left)
- (is? shift/b))
+ (same? shift/b))
(|> sample
((/.set@ #big_left shift/b))
(/.get@ #big_left)
- (is? shift/b))
+ (same? shift/b))
(|> sample
((/.set@ #big_left) shift/b)
(/.get@ #big_left)
- (is? shift/b)))
+ (same? shift/b)))
(and (|> sample
(/.set@ [#big_right #small_left] shift/s)
(/.get@ [#big_right #small_left])
- (is? shift/s))
+ (same? shift/s))
(|> sample
((/.set@ [#big_right #small_left] shift/s))
(/.get@ [#big_right #small_left])
- (is? shift/s))
+ (same? shift/s))
(|> sample
((/.set@ [#big_right #small_left]) shift/s)
(/.get@ [#big_right #small_left])
- (is? shift/s)))))
+ (same? shift/s)))))
(_.cover [/.update@]
(and (and (|> sample
(/.update@ #big_left (n.+ shift/b))
@@ -852,11 +859,11 @@
(: /.Any
(hide left))
true)))
- (_.cover [/.is?]
+ (_.cover [/.same?]
(let [not_left (|> left inc dec)]
- (and (/.is? left left)
+ (and (/.same? left left)
(and (n.= not_left left)
- (not (/.is? not_left left))))))
+ (not (/.same? not_left left))))))
(_.cover [/.Rec]
(let [list (: (/.Rec NList
(Maybe [Nat NList]))
@@ -866,9 +873,9 @@
#.None])])]))]
(case list
(#.Some [actual/0 (#.Some [actual/1 (#.Some [actual/2 #.None])])])
- (and (is? item/0 actual/0)
- (is? item/1 actual/1)
- (is? item/2 actual/2))
+ (and (same? item/0 actual/0)
+ (same? item/1 actual/1)
+ (same? item/2 actual/2))
_
false)))
@@ -939,8 +946,8 @@
(_.cover [/.^slots]
(/.case {#left expected_nat #right expected_int}
(/.^slots [#left #right])
- (and (/.is? expected_nat left)
- (/.is? expected_int right))))
+ (and (/.same? expected_nat left)
+ (/.same? expected_int right))))
(_.cover [/.^]
(/.case {#left expected_nat #right expected_int}
(/.^ (!pair 0 +0)) true
@@ -950,9 +957,9 @@
{#left expected_nat #right expected_int})]
(/.case expected_pair
(/.^@ actual_pair (/.^ (!pair actual_left actual_right)))
- (and (/.is? expected_pair actual_pair)
- (/.is? expected_nat actual_left)
- (/.is? expected_int actual_right)))))
+ (and (/.same? expected_pair actual_pair)
+ (/.same? expected_nat actual_left)
+ (/.same? expected_int actual_right)))))
(_.cover [/.^multi]
(let [expected_pair (: (Pair Nat Int)
{#left expected_nat #right expected_int})]
@@ -982,10 +989,10 @@
_ false))
(_.cover [/.let]
(and (/.let [actual_nat expected_nat]
- (/.is? expected_nat actual_nat))
+ (/.same? expected_nat actual_nat))
(/.let [[actual_left actual_right] {#left expected_nat #right expected_int}]
- (and (/.is? expected_nat actual_left)
- (/.is? expected_int actual_right)))))
+ (and (/.same? expected_nat actual_left)
+ (/.same? expected_int actual_right)))))
)))
(def: for_control_flow
@@ -1007,10 +1014,10 @@
post (random.only (|>> (n.= pre) not) random.nat)
.let [box (atom.atom pre)]]
(_.cover [/.exec]
- (and (is? pre (io.run! (atom.read! box)))
+ (and (same? pre (io.run! (atom.read! box)))
(/.exec
(io.run! (atom.write! post box))
- (is? post (io.run! (atom.read! box)))))))
+ (same? post (io.run! (atom.read! box)))))))
))
(def: identity/constant
@@ -1027,38 +1034,8 @@
(do random.monad
[expected random.nat]
(_.cover [/.def:]
- (and (is? expected (identity/constant expected))
- (is? expected (identity/function expected))))))
-
-(.refer "library/lux/target" #*)
-(.refer "library/lux/macro" #all)
-(.refer "library/lux/math/number/nat" #_)
-(.refer "library/lux/math/number/int" #nothing)
-(.refer "library/lux/math/number/rev" (#+ /4096))
-(.refer "library/lux/math/number/frac" (#only positive_infinity))
-(.refer "library/lux/math/number/i8" (#- equivalence width i8 i64))
-(.refer "library/lux/math/number/i16" (#exclude equivalence width i16 i64))
-
-(def: for_import
- Test
- (let [can_access? (: (All [a] (-> a a Bit))
- (function (_ global local)
- (is? global local)))]
- ($_ _.and
- (_.cover [/.refer]
- (and (can_access? library/lux/target.jvm
- jvm)
- (can_access? library/lux/macro.single_expansion
- single_expansion)
- (can_access? library/lux/math/number/rev./4096
- /4096)
- (can_access? library/lux/math/number/frac.positive_infinity
- positive_infinity)
- (can_access? library/lux/math/number/i8.I8
- I8)
- (can_access? library/lux/math/number/i16.I16
- I16)))
- )))
+ (and (same? expected (identity/constant expected))
+ (same? expected (identity/function expected))))))
(def: possible_targets
(Set @.Target)
@@ -1110,36 +1087,119 @@
(bit\= /.private /.local)))
))
+(for {@.old (as_is)}
+ (as_is (syntax: (for_bindings|test [fn/0 <code>.local_identifier
+ var/0 <code>.local_identifier
+ let/0 <code>.local_identifier
+
+ fn/1 <code>.local_identifier
+ var/1 <code>.local_identifier
+ let/1 <code>.local_identifier
+
+ fn/2 <code>.local_identifier
+ var/2 <code>.local_identifier
+ let/2 <code>.local_identifier
+
+ let/3 <code>.local_identifier])
+ (in (list (code.bit (case (get@ #.scopes *lux*)
+ (^ (list& scope/2 _))
+ (let [locals/2 (get@ #.locals scope/2)
+ expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2
+ let/3))
+ actual_locals/2 (|> locals/2
+ (get@ #.mappings)
+ (list\map product.left)
+ (set.of_list text.hash))
+
+ correct_locals!
+ (and (n.= 4 (get@ #.counter locals/2))
+ (set\= expected_locals/2
+ actual_locals/2))
+
+ captured/2 (get@ #.captured scope/2)
+
+ local? (: (-> Ref Bit)
+ (function (_ ref)
+ (case ref
+ (#.Local _) true
+ (#.Captured _) false)))
+ captured? (: (-> Ref Bit)
+ (|>> local? not))
+ binding? (: (-> (-> Ref Bit) Text Bit)
+ (function (_ is? name)
+ (|> captured/2
+ (get@ #.mappings)
+ (plist.value name)
+ (maybe\map (|>> product.right is?))
+ (maybe.else false))))
+
+ correct_closure!
+ (and (n.= 6 (get@ #.counter captured/2))
+ (binding? local? fn/1)
+ (binding? local? var/1)
+ (binding? local? let/1)
+ (binding? captured? fn/0)
+ (binding? captured? var/0)
+ (binding? captured? let/0))]
+ (and correct_locals!
+ correct_closure!))
+
+ _
+ false)))))
+
+ (def: for_bindings
+ Test
+ ((<| (template.with_locals [fn/0 var/0 let/0
+ fn/1 var/1 let/1
+ fn/2 var/2 let/2
+ let/3])
+ (function (fn/0 var/0)) (let [let/0 123])
+ (function (fn/1 var/1)) (let [let/1 456])
+ (function (fn/2 var/2)) (let [let/2 789])
+ (let [let/3 [fn/0 var/0 let/0
+ fn/1 var/1 let/1
+ fn/2 var/2 let/2]
+ verdict (for_bindings|test fn/0 var/0 let/0
+ fn/1 var/1 let/1
+ fn/2 var/2 let/2
+ let/3)]
+ (_.cover [/.Bindings /.Ref]
+ verdict)))
+ 0 1 2))))
+
(def: test
Test
(<| (_.covering /._)
- ($_ _.and
- ..for_bit
- ..for_try
- ..for_list
- ..for_interface
- ..for_module
- ..for_pipe
- ..for_code
- ..for_macro
- ..for_type
- ..for_i64
- ..for_function
- ..for_template
- ..for_static
- ..for_slot
- ..for_associative
- ..for_expansion
- ..for_value
- ..for_case
- ..for_control_flow
- ..for_def:
- ..for_import
- ..for_meta
- ..for_export
-
- ..sub_tests
- )))
+ (with_expansions
+ [<for_bindings> (for {@.old (~~ (as_is))}
+ (~~ (as_is ..for_bindings)))]
+ (`` ($_ _.and
+ ..for_bit
+ ..for_try
+ ..for_list
+ ..for_interface
+ ..for_module
+ ..for_pipe
+ ..for_code
+ ..for_macro
+ ..for_type
+ ..for_i64
+ ..for_function
+ ..for_template
+ ..for_static
+ ..for_slot
+ ..for_associative
+ ..for_expansion
+ ..for_value
+ ..for_case
+ ..for_control_flow
+ ..for_def:
+ ..for_meta
+ ..for_export
+ <for_bindings>
+
+ ..sub_tests
+ )))))
(program: args
(let [times (for {@.old 100
diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux
index debc5c17c..fe3a58e71 100644
--- a/stdlib/source/test/lux/abstract/codec.lux
+++ b/stdlib/source/test/lux/abstract/codec.lux
@@ -27,7 +27,7 @@
list
json.object))
(def: decode
- (json.get_boolean field)))))
+ (json.boolean_field field)))))
(def: codec
(Codec Text Bit)
diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux
index 2da826ebb..c6b381829 100644
--- a/stdlib/source/test/lux/control/concurrency/actor.lux
+++ b/stdlib/source/test/lux/control/concurrency/actor.lux
@@ -152,7 +152,7 @@
(not alive?)
(exception.match? ..got_wrecked error)
(n.= initial_state state)
- (is? die! single_pending_message))
+ (same? die! single_pending_message))
_
false)))))
diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux
index 939fe7d9f..1b0510c45 100644
--- a/stdlib/source/test/lux/control/concurrency/atom.lux
+++ b/stdlib/source/test/lux/control/concurrency/atom.lux
@@ -24,10 +24,10 @@
(io.run!
(do io.monad
[actual (/.read! box)]
- (in (is? expected actual))))))
+ (in (same? expected actual))))))
(do random.monad
[target random.nat
- unknown (random.only (|>> (is? target) not) random.nat)
+ unknown (random.only (|>> (same? target) not) random.nat)
expected random.nat
.let [box (/.atom target)]]
(_.cover [/.compare_and_swap!]
@@ -38,7 +38,7 @@
actual (/.read! box)]
(in (and (not swapped_unknown?)
swapped_target?
- (is? expected actual)))))))
+ (same? expected actual)))))))
(do random.monad
[init random.nat
shift random.nat
@@ -47,7 +47,7 @@
(io.run!
(do io.monad
[[pre post] (/.update! (n.+ shift) box)]
- (in (and (is? init pre)
+ (in (and (same? init pre)
(n.= (n.+ shift init)
post)))))))
(do random.monad
@@ -59,6 +59,6 @@
(do io.monad
[old (/.write! post box)
new (/.read! box)]
- (in (and (is? pre old)
- (is? post new)))))))
+ (in (and (same? pre old)
+ (same? post new)))))))
)))
diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux
index 357c87d61..03f3ae2c3 100644
--- a/stdlib/source/test/lux/control/continuation.lux
+++ b/stdlib/source/test/lux/control/continuation.lux
@@ -85,12 +85,12 @@
(list\= elems
(/.result (/.reset (visit elems))))))
(_.cover [/.continue]
- (/.continue (is? sample)
+ (/.continue (same? sample)
(: (/.Cont Nat Bit)
(function (_ next)
(next sample)))))
(_.cover [/.pending]
- (/.continue (is? sample)
+ (/.continue (same? sample)
(: (/.Cont Nat Bit)
(/.pending sample))))
)))
diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux
index b65995923..01da979e6 100644
--- a/stdlib/source/test/lux/control/function.lux
+++ b/stdlib/source/test/lux/control/function.lux
@@ -50,8 +50,8 @@
(_.cover [/.constant]
(n.= expected
((/.constant expected) dummy)))
- (_.cover [/.flip]
- (let [outcome ((/.flip n.-) expected extra)]
+ (_.cover [/.flipped]
+ (let [outcome ((/.flipped n.-) expected extra)]
(and (n.= (n.- extra expected)
outcome)
(not (n.= (n.- expected extra)
diff --git a/stdlib/source/test/lux/control/function/contract.lux b/stdlib/source/test/lux/control/function/contract.lux
index 436ba2282..48246a7c2 100644
--- a/stdlib/source/test/lux/control/function/contract.lux
+++ b/stdlib/source/test/lux/control/function/contract.lux
@@ -31,7 +31,7 @@
(case (try (/.post n.odd?
expected))
(#try.Success actual)
- (is? expected actual)
+ (same? expected actual)
(#try.Failure error)
(not (n.odd? expected))))
diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux
index c9de9cb25..ea1b1f787 100644
--- a/stdlib/source/test/lux/control/lazy.lux
+++ b/stdlib/source/test/lux/control/lazy.lux
@@ -60,8 +60,8 @@
(_.cover [/.value]
(let [lazy (/.lazy <eager>)]
- (and (not (is? expected
- (/.value lazy)))
- (is? (/.value lazy)
- (/.value lazy)))))
+ (and (not (same? expected
+ (/.value lazy)))
+ (same? (/.value lazy)
+ (/.value lazy)))))
))))))
diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux
index a2a85eae1..5d9a04a0b 100644
--- a/stdlib/source/test/lux/control/maybe.lux
+++ b/stdlib/source/test/lux/control/maybe.lux
@@ -64,15 +64,15 @@
[default random.nat
value random.nat]
(_.cover [/.else]
- (and (is? default (/.else default
- #.None))
+ (and (same? default (/.else default
+ #.None))
- (is? value (/.else default
- (#.Some value))))))
+ (same? value (/.else default
+ (#.Some value))))))
(do random.monad
[value random.nat]
(_.cover [/.assume]
- (is? value (/.assume (#.Some value)))))
+ (same? value (/.assume (#.Some value)))))
(do random.monad
[value random.nat]
(_.cover [/.list]
diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux
index 55398c22e..b348c1da2 100644
--- a/stdlib/source/test/lux/control/parser/type.lux
+++ b/stdlib/source/test/lux/control/parser/type.lux
@@ -140,7 +140,7 @@
/.any)
not_parameter)
(!expect (^multi (#try.Success [quantification\\binding argument\\binding actual])
- (is? not_parameter actual)))))
+ (same? not_parameter actual)))))
(_.cover [/.parameter]
(|> (/.result (<| (/.with_extension quantification)
(/.with_extension argument)
@@ -182,7 +182,7 @@
(type.univ_q expected_inputs not_polymorphic))
(!expect (^multi (#try.Success [g!poly actual_inputs bodyT])
(and (n.= expected_inputs (list.size actual_inputs))
- (is? not_polymorphic bodyT))))))
+ (same? not_polymorphic bodyT))))))
)))
(def: .public test
@@ -232,7 +232,7 @@
(in env))
expected)
(!expect (^multi (#try.Success environment)
- (is? /.fresh environment))))))
+ (same? /.fresh environment))))))
(do {! random.monad}
[expected ..primitive
dummy (random.only (|>> (type\= expected) not)
diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux
index 4fbb71916..ceda7b3a9 100644
--- a/stdlib/source/test/lux/control/region.lux
+++ b/stdlib/source/test/lux/control/region.lux
@@ -63,13 +63,13 @@
==
(Try a)
- (thread.result (:assume (/.run! thread.monad left))))
+ (thread.result (:expected (/.run! thread.monad left))))
(:sharing [a]
(Equivalence a)
==
(Try a)
- (thread.result (:assume (/.run! thread.monad right))))]
+ (thread.result (:expected (/.run! thread.monad right))))]
[(#try.Success left) (#try.Success right)]
(== left right)
diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux
index ea3750151..045e2d0df 100644
--- a/stdlib/source/test/lux/control/remember.lux
+++ b/stdlib/source/test/lux/control/remember.lux
@@ -99,7 +99,7 @@
false)
(case should_succeed1
(^ (#try.Success (list actual)))
- (is? expected actual)
+ (same? expected actual)
_
false)
diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux
index 8c0a42952..801dc3014 100644
--- a/stdlib/source/test/lux/control/security/capability.lux
+++ b/stdlib/source/test/lux/control/security/capability.lux
@@ -35,7 +35,7 @@
(let [capability (..can_shift (function (_ [no_op raw])
[no_op (n.+ shift raw)]))
[untouched actual] (/.use capability [pass_through base])]
- (and (is? pass_through untouched)
+ (and (same? pass_through untouched)
(n.= expected actual))))
(in (let [capability (..can_io (function (_ _) (io.io expected)))]
(do async.monad
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 3270e17a7..d45cc6554 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -147,7 +147,7 @@
(_.cover [/.copy]
(and (case (/.copy size 0 sample 0 (/.empty size))
(#try.Success output)
- (and (not (is? sample output))
+ (and (not (same? sample output))
(\ /.equivalence = sample output))
(#try.Failure _)
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index 64e0f4268..c7433632e 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -56,15 +56,15 @@
.let [expected (n.+ base shift)]
the_array (random.array size random.nat)]
($_ _.and
- (_.cover [/.find]
+ (_.cover [/.example]
(\ (maybe.equivalence n.equivalence) =
- (/.find n.even? the_array)
- (list.find n.even? (/.list the_array))))
- (_.cover [/.find+]
- (case [(/.find n.even? the_array)
- (/.find+ (function (_ idx member)
- (n.even? member))
- the_array)]
+ (/.example n.even? the_array)
+ (list.example n.even? (/.list the_array))))
+ (_.cover [/.example+]
+ (case [(/.example n.even? the_array)
+ (/.example+ (function (_ idx member)
+ (n.even? member))
+ the_array)]
[(#.Some expected) (#.Some [idx actual])]
(case (/.read idx the_array)
(#.Some again)
@@ -110,7 +110,7 @@
(_.cover [/.type_name]
(case /.Array
(^ (#.Named _ (#.UnivQ _ (#.Primitive nominal_type (list (#.Parameter 1))))))
- (is? /.type_name nominal_type)
+ (same? /.type_name nominal_type)
_
false))
@@ -199,7 +199,7 @@
(/.list copy))))))
(_.cover [/.clone]
(let [clone (/.clone the_array)]
- (and (not (is? the_array clone))
+ (and (not (same? the_array clone))
(\ (/.equivalence n.equivalence) = the_array clone))))
(let [the_array (/.clone the_array)
evens (|> the_array /.list (list.only n.even?))
@@ -220,6 +220,6 @@
(exec (/.filter! n.even? the_array)
(list.every? (function (_ value)
(or (n.even? value)
- (is? default value)))
+ (same? default value)))
(/.list' default the_array)))))
))))
diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux
index da4a759e5..6710ef7c6 100644
--- a/stdlib/source/test/lux/data/collection/bits.lux
+++ b/stdlib/source/test/lux/data/collection/bits.lux
@@ -27,7 +27,7 @@
0 (in /.empty)
_ (do {! random.monad}
[idx (|> random.nat (\ ! map (n.% size)))]
- (in (/.set idx /.empty))))))
+ (in (/.one idx /.empty))))))
(def: .public test
Test
@@ -51,38 +51,38 @@
idx (\ ! map (n.% size) random.nat)
sample ..random]
($_ _.and
- (_.cover [/.get /.set]
- (and (|> /.empty (/.get idx) not)
- (|> /.empty (/.set idx) (/.get idx))))
- (_.cover [/.clear]
- (|> /.empty (/.set idx) (/.clear idx) (/.get idx) not))
- (_.cover [/.flip]
- (and (|> /.empty (/.flip idx) (/.get idx))
- (|> /.empty (/.flip idx) (/.flip idx) (/.get idx) not)))
+ (_.cover [/.bit /.one]
+ (and (|> /.empty (/.bit idx) not)
+ (|> /.empty (/.one idx) (/.bit idx))))
+ (_.cover [/.zero]
+ (|> /.empty (/.one idx) (/.zero idx) (/.bit idx) not))
+ (_.cover [/.flipped]
+ (and (|> /.empty (/.flipped idx) (/.bit idx))
+ (|> /.empty (/.flipped idx) (/.flipped idx) (/.bit idx) not)))
(_.cover [/.Chunk /.capacity /.chunk_size]
(and (n.= 0 (/.capacity /.empty))
- (|> /.empty (/.set idx) /.capacity
+ (|> /.empty (/.one idx) /.capacity
(n.- idx)
(predicate.or (n.>= 0)
(n.< /.chunk_size)))
- (let [grown (/.flip idx /.empty)]
+ (let [grown (/.flipped idx /.empty)]
(and (n.> 0 (/.capacity grown))
- (is? /.empty (/.flip idx grown))))))
+ (same? /.empty (/.flipped idx grown))))))
(_.cover [/.intersects?]
(and (not (/.intersects? /.empty
/.empty))
- (/.intersects? (/.set idx /.empty)
- (/.set idx /.empty))
- (not (/.intersects? (/.set (inc idx) /.empty)
- (/.set idx /.empty)))
+ (/.intersects? (/.one idx /.empty)
+ (/.one idx /.empty))
+ (not (/.intersects? (/.one (inc idx) /.empty)
+ (/.one idx /.empty)))
(not (/.intersects? sample (/.not sample)))))
(_.cover [/.not]
- (and (is? /.empty (/.not /.empty))
- (or (is? /.empty sample)
+ (and (same? /.empty (/.not /.empty))
+ (or (same? /.empty sample)
(and (not (\ /.equivalence = sample (/.not sample)))
(\ /.equivalence = sample (/.not (/.not sample)))))))
(_.cover [/.xor]
- (and (is? /.empty (/.xor sample sample))
+ (and (same? /.empty (/.xor sample sample))
(n.= (/.size (/.xor sample (/.not sample)))
(/.capacity sample))))
(_.cover [/.or]
@@ -91,5 +91,5 @@
(/.capacity sample))))
(_.cover [/.and]
(and (\ /.equivalence = sample (/.and sample sample))
- (is? /.empty (/.and sample (/.not sample)))))
+ (same? /.empty (/.and sample (/.not sample)))))
)))))
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux
index 8667b7054..7114a2eed 100644
--- a/stdlib/source/test/lux/data/collection/dictionary.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary.lux
@@ -60,7 +60,7 @@
(def: (hash _)
constant)))]]
(_.cover [/.key_hash]
- (is? hash (/.key_hash (/.empty hash)))))
+ (same? hash (/.key_hash (/.empty hash)))))
(_.cover [/.entries]
(let [entries (/.entries dict)
@@ -79,7 +79,7 @@
correct_pairing!
(list.every? (function (_ [key value])
(|> dict
- (/.get key)
+ (/.value key)
(maybe\map (n.= value))
(maybe.else false)))
entries)]
@@ -145,19 +145,19 @@
(list.every? (/.key? dict)
(/.keys dict)))
- (_.cover [/.get]
- (and (list.every? (function (_ key) (case (/.get key dict)
+ (_.cover [/.value]
+ (and (list.every? (function (_ key) (case (/.value key dict)
(#.Some _) true
_ false))
(/.keys dict))
- (case (/.get non_key dict)
+ (case (/.value non_key dict)
(#.Some _) false
_ true)))
(_.cover [/.has]
(and (n.= (inc (/.size dict))
(/.size (/.has non_key test_val dict)))
- (case (/.get non_key (/.has non_key test_val dict))
+ (case (/.value non_key (/.has non_key test_val dict))
(#.Some v) (n.= test_val v)
_ true)))
@@ -165,7 +165,7 @@
(let [can_put_new_keys!
(case (/.try_put non_key test_val dict)
(#try.Success dict)
- (case (/.get non_key dict)
+ (case (/.value non_key dict)
(#.Some v) (n.= test_val v)
_ true)
@@ -199,7 +199,7 @@
(_.cover [/.revised]
(let [base (/.has non_key test_val dict)
updt (/.revised non_key inc base)]
- (case [(/.get non_key base) (/.get non_key updt)]
+ (case [(/.value non_key base) (/.value non_key updt)]
[(#.Some x) (#.Some y)]
(n.= (inc x) y)
@@ -208,7 +208,7 @@
(_.cover [/.upsert]
(let [can_upsert_new_key!
- (case (/.get non_key (/.upsert non_key test_val inc dict))
+ (case (/.value non_key (/.upsert non_key test_val inc dict))
(#.Some inserted)
(n.= (inc test_val) inserted)
@@ -221,7 +221,7 @@
true
(#.Some [known_key known_value])
- (case (/.get known_key (/.upsert known_key test_val inc dict))
+ (case (/.value known_key (/.upsert known_key test_val inc dict))
(#.Some updated)
(n.= (inc known_value) updated)
@@ -244,8 +244,8 @@
(and (n.= (/.size dict) (/.size rebound))
(/.key? rebound non_key)
(not (/.key? rebound first_key))
- (n.= (maybe.assume (/.get first_key dict))
- (maybe.assume (/.get non_key rebound)))))))
+ (n.= (maybe.assume (/.value first_key dict))
+ (maybe.assume (/.value non_key rebound)))))))
)))
(def: .public test
diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
index b2bed04f9..838d2cf5d 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux
@@ -113,10 +113,10 @@
(and (/.key? sample+ extra_key)
(n.= (inc (/.size sample))
(/.size sample+))))))
- (_.cover [/.get]
+ (_.cover [/.value]
(let [sample+ (/.has extra_key extra_value sample)]
- (case [(/.get extra_key sample)
- (/.get extra_key sample+)]
+ (case [(/.value extra_key sample)
+ (/.value extra_key sample+)]
[#.None (#.Some actual)]
(n.= extra_value actual)
@@ -131,7 +131,7 @@
(|> sample
(/.has extra_key extra_value)
(/.revised extra_key (n.+ shift))
- (/.get extra_key)
+ (/.value extra_key)
(maybe\map (n.= (n.+ shift extra_value)))
(maybe.else false)))
))))
diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
index b36d5d9d2..c76892185 100644
--- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux
@@ -71,17 +71,17 @@
(/.contains? extra_key sample+)
(n.= (inc (/.size sample))
(/.size sample+)))))
- (_.cover [/.get]
+ (_.cover [/.value]
(|> sample
(/.has extra_key extra_value)
- (/.get extra_key)
+ (/.value extra_key)
(maybe\map (n.= extra_value))
(maybe.else false)))
(_.cover [/.revised]
(|> sample
(/.has extra_key extra_value)
(/.revised extra_key (n.+ shift))
- (/.get extra_key)
+ (/.value extra_key)
(maybe\map (n.= (n.+ shift extra_value)))
(maybe.else false)))
(_.cover [/.lacks]
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index e9be412e2..7fb1e8704 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -122,7 +122,7 @@
symmetry!
(/\= (/.sorted <<< sample)
- (/.reversed (/.sorted (function.flip <<<) sample)))]
+ (/.reversed (/.sorted (function.flipped <<<) sample)))]
(and size_preservation!
symmetry!)))
)))
@@ -206,18 +206,18 @@
(let [[left right] (/.split idx sample)]
(/\= sample
(/\compose left right))))
- (_.cover [/.split_with]
- (let [[left right] (/.split_with n.even? sample)]
+ (_.cover [/.split_when]
+ (let [[left right] (/.split_when n.even? sample)]
(/\= sample
(/\compose left right))))
(_.cover [/.take /.drop]
(/\= sample
(/\compose (/.take idx sample)
(/.drop idx sample))))
- (_.cover [/.take_while /.drop_while]
+ (_.cover [/.while /.until]
(/\= sample
- (/\compose (/.take_while n.even? sample)
- (/.drop_while n.even? sample))))
+ (/\compose (/.while n.even? sample)
+ (/.until n.even? sample))))
(_.cover [/.sub]
(let [subs (/.sub sub_size sample)]
(and (/.every? (|>> /.size (n.<= sub_size)) subs)
@@ -380,8 +380,8 @@
(/.only n.even?)
(/\map (\ n.decimal encode)))
(/.all choose sample)))
- (_.cover [/.find]
- (case (/.find n.even? sample)
+ (_.cover [/.example]
+ (case (/.example n.even? sample)
(#.Some found)
(n.even? found)
diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux
index a6e4679fb..3ae89efba 100644
--- a/stdlib/source/test/lux/data/collection/row.lux
+++ b/stdlib/source/test/lux/data/collection/row.lux
@@ -103,7 +103,7 @@
(do try.monad
[sample (/.put good_index non_member sample)
actual (/.item good_index sample)]
- (in (is? non_member actual)))))
+ (in (same? non_member actual)))))
(_.cover [/.revised]
(<| (try.else false)
(do try.monad
diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux
index 61c301f94..9a2c78afb 100644
--- a/stdlib/source/test/lux/data/collection/sequence.lux
+++ b/stdlib/source/test/lux/data/collection/sequence.lux
@@ -65,19 +65,19 @@
drops)
(list\= (enum.range n.enum size (dec (n.* 2 size)))
(/.take size takes)))))
- (_.cover [/.take_while]
+ (_.cover [/.while]
(list\= (enum.range n.enum 0 (dec size))
- (/.take_while (n.< size) (/.iterations inc 0))))
- (_.cover [/.drop_while]
+ (/.while (n.< size) (/.iterations inc 0))))
+ (_.cover [/.until]
(list\= (enum.range n.enum offset (dec (n.+ size offset)))
- (/.take_while (n.< (n.+ size offset))
- (/.drop_while (n.< offset) (/.iterations inc 0)))))
- (_.cover [/.split_while]
- (let [[drops takes] (/.split_while (n.< size) (/.iterations inc 0))]
+ (/.while (n.< (n.+ size offset))
+ (/.until (n.< offset) (/.iterations inc 0)))))
+ (_.cover [/.split_when]
+ (let [[drops takes] (/.split_when (n.= size) (/.iterations inc 0))]
(and (list\= (enum.range n.enum 0 (dec size))
drops)
(list\= (enum.range n.enum size (dec (n.* 2 size)))
- (/.take_while (n.< (n.* 2 size)) takes)))))
+ (/.while (n.< (n.* 2 size)) takes)))))
(_.cover [/.head]
(n.= offset
(/.head (/.iterations inc offset))))
diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux
index bd76d5bf3..e6dbd5c3d 100644
--- a/stdlib/source/test/lux/data/collection/set.lux
+++ b/stdlib/source/test/lux/data/collection/set.lux
@@ -61,7 +61,7 @@
constant))))
random.nat)]
(_.cover [/.member_hash]
- (is? hash (/.member_hash (/.empty hash)))))
+ (same? hash (/.member_hash (/.empty hash)))))
(_.cover [/.size]
(n.= sizeL (/.size setL)))
(_.cover [/.empty?]
diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux
index 1cb75755f..591308f56 100644
--- a/stdlib/source/test/lux/data/collection/stack.lux
+++ b/stdlib/source/test/lux/data/collection/stack.lux
@@ -62,8 +62,8 @@
(_.cover [/.push]
(case (/.pop (/.push expected_top sample))
(#.Some [actual_top actual_sample])
- (and (is? expected_top actual_top)
- (is? sample actual_sample))
+ (and (same? expected_top actual_top)
+ (same? sample actual_sample))
#.None
false))
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index 51bc3ac0e..33b2622f4 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -103,9 +103,9 @@
(#try.Failure error)
false))
- (_.cover [/.get]
+ (_.cover [/.field]
(list.every? (function (_ [key expected])
- (|> (/.get key object)
+ (|> (/.field key object)
(try\map (\= expected))
(try.else false)))
expected))
@@ -115,18 +115,18 @@
unknown (random.only (|>> (\ text.equivalence = key) not)
(random.ascii/alpha 1))
expected random.safe_frac]
- (_.cover [/.set]
+ (_.cover [/.has]
(<| (try.else false)
(do try.monad
- [object (/.set key (#/.Number expected) (/.object (list)))
+ [object (/.has key (#/.Number expected) (/.object (list)))
.let [can_find_known_key!
(|> object
- (/.get key)
+ (/.field key)
(try\map (\= (#/.Number expected)))
(try.else false))
cannot_find_unknown_key!
- (case (/.get unknown object)
+ (case (/.field unknown object)
(#try.Success _)
false
@@ -134,21 +134,21 @@
true)]]
(in (and can_find_known_key!
cannot_find_unknown_key!))))))
- (~~ (template [<type> <get> <tag> <random> <equivalence>]
+ (~~ (template [<type> <field> <tag> <random> <equivalence>]
[(do random.monad
[key (random.ascii/alpha 1)
value <random>]
- (_.cover [<type> <get>]
+ (_.cover [<type> <field>]
(|> (/.object (list [key (<tag> value)]))
- (<get> key)
+ (<field> key)
(try\map (\ <equivalence> = value))
(try.else false))))]
- [/.Boolean /.get_boolean #/.Boolean random.bit bit.equivalence]
- [/.Number /.get_number #/.Number random.safe_frac frac.equivalence]
- [/.String /.get_string #/.String (random.ascii/alpha 1) text.equivalence]
- [/.Array /.get_array #/.Array (random.row 3 ..random) (row.equivalence /.equivalence)]
- [/.Object /.get_object #/.Object (random.dictionary text.hash 3 (random.ascii/alpha 1) ..random) (dictionary.equivalence /.equivalence)]
+ [/.Boolean /.boolean_field #/.Boolean random.bit bit.equivalence]
+ [/.Number /.number_field #/.Number random.safe_frac frac.equivalence]
+ [/.String /.string_field #/.String (random.ascii/alpha 1) text.equivalence]
+ [/.Array /.array_field #/.Array (random.row 3 ..random) (row.equivalence /.equivalence)]
+ [/.Object /.object_field #/.Object (random.dictionary text.hash 3 (random.ascii/alpha 1) ..random) (dictionary.equivalence /.equivalence)]
))
(with_expansions [<boolean> (boolean)
<number> (number)
@@ -182,13 +182,13 @@
<key5> {<key6> <number>}})]
(<| (try.else false)
(do try.monad
- [value0 (/.get <key0> object)
- value1 (/.get <key1> object)
- value2 (/.get <key2> object)
- value3 (/.get <key3> object)
- value4 (/.get <key4> object)
- value5 (/.get <key5> object)
- value6 (/.get <key6> value5)]
+ [value0 (/.field <key0> object)
+ value1 (/.field <key1> object)
+ value2 (/.field <key2> object)
+ value3 (/.field <key3> object)
+ value4 (/.field <key4> object)
+ value5 (/.field <key5> object)
+ value6 (/.field <key6> value5)]
(in (and (\= #/.Null value0)
(\= (#/.Boolean <boolean>) value1)
(\= (#/.Number <number>) value2)
diff --git a/stdlib/source/test/lux/data/name.lux b/stdlib/source/test/lux/data/name.lux
index 2cde215a0..2856d3476 100644
--- a/stdlib/source/test/lux/data/name.lux
+++ b/stdlib/source/test/lux/data/name.lux
@@ -56,8 +56,8 @@
#1)))))
(_.cover [/.module /.short]
- (and (is? module1 (/.module name1))
- (is? short1 (/.short name1))))
+ (and (same? module1 (/.module name1))
+ (same? short1 (/.short name1))))
(_.for [.name_of]
(let [(^open "/\.") /.equivalence]
($_ _.and
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index f2bcccfc6..f95757333 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -195,10 +195,10 @@
(_.cover [/.joined]
(n.= (set.size characters)
(/.size (/.joined (set.list characters)))))
- (_.cover [/.join_with /.split_all_with]
+ (_.cover [/.join_with /.all_split_by]
(and (|> (set.list characters)
(/.join_with separator)
- (/.split_all_with separator)
+ (/.all_split_by separator)
(set.of_list /.hash)
(\ set.equivalence = characters))
(\ /.equivalence =
@@ -208,8 +208,8 @@
(\ /.equivalence =
(\ /.monoid compose post static)
(/.replaced/1 pre post (\ /.monoid compose pre static))))
- (_.cover [/.split_with]
- (case (/.split_with static ($_ (\ /.monoid compose) pre static post))
+ (_.cover [/.split_by]
+ (case (/.split_by static ($_ (\ /.monoid compose) pre static post))
(#.Some [left right])
(and (\ /.equivalence = pre left)
(\ /.equivalence = post right))
diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux
index e612dc9b6..f2887f530 100644
--- a/stdlib/source/test/lux/data/text/format.lux
+++ b/stdlib/source/test/lux/data/text/format.lux
@@ -147,7 +147,7 @@
[/.text text.format (random.unicode 5)]
[/.code code.format $///code.random]
- [/.type type.format $///type.random]
+ [/.type type.format ($///type.random 0)]
[/.location location.format
($_ random.and
(random.unicode 5)
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index 4415a3798..2f94947a5 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -109,7 +109,7 @@
[sample_ratio $//ratio.random
sample_name ($//name.random 5 5)
sample_location $//location.random
- sample_type $//type.random
+ sample_type ($//type.random 0)
sample_code $//code.random
sample_xml $//xml.random
sample_json $//json.random]
diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux
index 994430c85..6e41aef82 100644
--- a/stdlib/source/test/lux/ffi.js.lux
+++ b/stdlib/source/test/lux/ffi.js.lux
@@ -73,7 +73,7 @@
(exec
(: (Ex [a] (/.Object a))
(: <type>
- (:assume [])))
+ (:expected [])))
true))]
[/.Function]
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 2a6e714af..24c4c6f11 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -203,7 +203,7 @@
(_.cover [/.:cast]
(|> string
(/.:cast java/lang/Object)
- (is? (:as java/lang/Object string))))
+ (same? (:as java/lang/Object string))))
(_.cover [/.type]
(and (and (type\= /.Boolean (/.type java/lang/Boolean))
(type\= /.Boolean (/.type boolean)))
@@ -272,8 +272,8 @@
(:as java/lang/Long
expected)))
example/0!
- (is? (: Any expected)
- (: Any (test/TestInterface0::actual0 object/0)))
+ (same? (: Any expected)
+ (: Any (test/TestInterface0::actual0 object/0)))
object/1 (/.object [] [test/TestInterface1]
[]
@@ -288,8 +288,8 @@
example/1!
(and (case (test/TestInterface1::actual1 false object/1)
(#try.Success actual)
- (is? (: Any expected)
- (: Any actual))
+ (same? (: Any expected)
+ (: Any actual))
(#try.Failure error)
false)
@@ -307,8 +307,8 @@
a
input))
example/2!
- (is? (: Any expected)
- (: Any (test/TestInterface2::actual2 (:as java/lang/Long expected) object/2)))
+ (same? (: Any expected)
+ (: Any (test/TestInterface2::actual2 (:as java/lang/Long expected) object/2)))
object/3 (/.object [] [(test/TestInterface3 java/lang/Long)]
[]
@@ -318,8 +318,8 @@
(:as java/lang/Long
expected)))
example/3!
- (is? (: Any expected)
- (: Any (test/TestInterface3::actual3 object/3)))
+ (same? (: Any expected)
+ (: Any (test/TestInterface3::actual3 object/3)))
example/4!
(let [expected (i.+ left right)
@@ -560,7 +560,7 @@
(|> object/9
test/TestClass9::get_actual9
(:as java/lang/Long)
- (is? dummy/2))]]
+ (same? dummy/2))]]
($_ _.and
(_.cover [/.class: /.import:]
(and example/0!
diff --git a/stdlib/source/test/lux/ffi.rb.lux b/stdlib/source/test/lux/ffi.rb.lux
index a6ba3d949..f39893779 100644
--- a/stdlib/source/test/lux/ffi.rb.lux
+++ b/stdlib/source/test/lux/ffi.rb.lux
@@ -47,6 +47,6 @@
[/.Function]
))))
(_.cover [/.import:]
- (is? (..File::SEPARATOR)
- (..File::SEPARATOR)))
+ (same? (..File::SEPARATOR)
+ (..File::SEPARATOR)))
)))))
diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux
index 5eedd7f9d..d8e47745b 100644
--- a/stdlib/source/test/lux/math/number/i64.lux
+++ b/stdlib/source/test/lux/math/number/i64.lux
@@ -24,21 +24,21 @@
[pattern random.nat
idx (\ ! map (n.% /.width) random.nat)]
($_ _.and
- (_.cover [/.set? /.set]
- (if (/.set? idx pattern)
- (\= pattern (/.set idx pattern))
- (not (\= pattern (/.set idx pattern)))))
- (_.cover [/.clear? /.clear]
- (if (/.clear? idx pattern)
- (\= pattern (/.clear idx pattern))
- (not (\= pattern (/.clear idx pattern)))))
- (_.cover [/.flip]
- (\= (/.flip idx pattern)
- (if (/.set? idx pattern)
- (/.clear idx pattern)
- (/.set idx pattern))))
+ (_.cover [/.one? /.one]
+ (if (/.one? idx pattern)
+ (\= pattern (/.one idx pattern))
+ (not (\= pattern (/.one idx pattern)))))
+ (_.cover [/.zero? /.zero]
+ (if (/.zero? idx pattern)
+ (\= pattern (/.zero idx pattern))
+ (not (\= pattern (/.zero idx pattern)))))
+ (_.cover [/.flipped]
+ (\= (/.flipped idx pattern)
+ (if (/.one? idx pattern)
+ (/.zero idx pattern)
+ (/.one idx pattern))))
(_.cover [/.bit]
- (bit\= (/.clear? idx pattern)
+ (bit\= (/.zero? idx pattern)
(\= /.false (/.and (/.bit idx) pattern))))
)))
@@ -197,16 +197,16 @@
(/.xor pattern
pattern))))
(_.cover [/.ones]
- (let [clear&set!
- (if (/.set? idx pattern)
- (n.= (dec (/.ones pattern)) (/.ones (/.clear idx pattern)))
- (n.= (inc (/.ones pattern)) (/.ones (/.set idx pattern))))
+ (let [zero&one!
+ (if (/.one? idx pattern)
+ (n.= (dec (/.ones pattern)) (/.ones (/.zero idx pattern)))
+ (n.= (inc (/.ones pattern)) (/.ones (/.one idx pattern))))
complementarity!
(n.= /.width
(n.+ (/.ones pattern)
(/.ones (/.not pattern))))]
- (and clear&set!
+ (and zero&one!
complementarity!)))
(_.cover [/.left_rotated /.right_rotated]
(let [false!
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 2d7198c46..b8e3e1c76 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -76,13 +76,13 @@
(|> (\ /.monad in expected)
(/.result' expected_lux)
(!expect (^multi (#try.Success [actual_lux actual])
- (and (is? expected_lux actual_lux)
+ (and (same? expected_lux actual_lux)
(n.= expected actual))))))
- (_.cover [/.get_compiler]
- (|> /.get_compiler
+ (_.cover [/.compiler_state]
+ (|> /.compiler_state
(/.result expected_lux)
(!expect (^multi (#try.Success actual_lux)
- (is? expected_lux actual_lux)))))
+ (same? expected_lux actual_lux)))))
)))
(def: error_handling
@@ -224,12 +224,12 @@
(|> /.current_module
(/.result expected_lux)
(!expect (^multi (#try.Success actual_module)
- (is? expected_module actual_module)))))
+ (same? expected_module actual_module)))))
(_.cover [/.module]
(|> (/.module expected_current_module)
(/.result expected_lux)
(!expect (^multi (#try.Success actual_module)
- (is? expected_module actual_module)))))
+ (same? expected_module actual_module)))))
(_.cover [/.module_exists?]
(and (|> (/.module_exists? expected_current_module)
(/.result expected_lux)
@@ -241,7 +241,7 @@
(|> /.modules
(/.result expected_lux)
(!expect (^multi (#try.Success actual_modules)
- (is? expected_modules actual_modules)))))
+ (same? expected_modules actual_modules)))))
(_.cover [/.imported_modules]
(and (|> (/.imported_modules expected_current_module)
(/.result expected_lux)
@@ -266,12 +266,12 @@
(/.result expected_lux)
(!expect (^multi (#try.Success [actual_module actual_short])
(and (text\= expected_current_module actual_module)
- (is? expected_short actual_short)))))
+ (same? expected_short actual_short)))))
(|> (/.normal [dummy_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success [actual_module actual_short])
(and (text\= dummy_module actual_module)
- (is? expected_short actual_short)))))))
+ (same? expected_short actual_short)))))))
))))
(def: random_location
@@ -325,16 +325,16 @@
(|> /.location
(/.result expected_lux)
(!expect (^multi (#try.Success actual_location)
- (is? expected_location actual_location)))))
+ (same? expected_location actual_location)))))
(_.cover [/.expected_type]
(|> /.expected_type
(/.result expected_lux)
(!expect (^multi (#try.Success actual_type)
- (is? expected_type actual_type)))))
+ (same? expected_type actual_type)))))
(_.cover [.Type_Context /.type_context]
(|> /.type_context
(/.result expected_lux)
- (try\map (is? type_context))
+ (try\map (same? type_context))
(try.else false)))
)))
@@ -411,13 +411,13 @@
(|> (/.globals expected_current_module)
(/.result expected_lux)
(!expect (^multi (#try.Success actual_globals)
- (is? current_globals actual_globals))))
+ (same? current_globals actual_globals))))
macro_globals!
(|> (/.globals expected_macro_module)
(/.result expected_lux)
(!expect (^multi (#try.Success actual_globals)
- (is? macro_globals actual_globals))))]
+ (same? macro_globals actual_globals))))]
(and current_globals!
macro_globals!)))
(_.cover [.Definition /.definitions]
@@ -542,7 +542,7 @@
(|> (/.macro [expected_macro_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success (#.Some actual_value))
- (is? expected_value actual_value)))))
+ (same? expected_value actual_value)))))
not_macro!
(let [[current_globals macro_globals expected_lux]
@@ -564,7 +564,7 @@
(|> (/.macro [expected_current_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success (#.Some actual_value))
- (is? expected_value actual_value)))))]
+ (same? expected_value actual_value)))))]
(and same_module!
not_macro!
not_found!
@@ -589,16 +589,16 @@
(/.result expected_lux)
(!expect (^multi (#try.Success (#.Definition [actual_exported? actual_type actual_annotations actual_value]))
(and (bit\= expected_exported? actual_exported?)
- (is? expected_type actual_type)
- (is? expected_annotations actual_annotations)
- (is? (:as Any expected_value) actual_value)))))
+ (same? expected_type actual_type)
+ (same? expected_annotations actual_annotations)
+ (same? (:as Any expected_value) actual_value)))))
alias!
(|> (/.definition [expected_current_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success (#.Alias [actual_module actual_short]))
- (and (is? expected_macro_module actual_module)
- (is? expected_short actual_short)))))]
+ (and (same? expected_macro_module actual_module)
+ (same? expected_short actual_short)))))]
(and definition!
alias!)))
(_.cover [/.definition_type]
@@ -609,13 +609,13 @@
(|> (/.definition_type [expected_macro_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success actual_type)
- (is? expected_type actual_type))))
+ (same? expected_type actual_type))))
alias!
(|> (/.definition_type [expected_current_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success actual_type)
- (is? expected_type actual_type))))]
+ (same? expected_type actual_type))))]
(and definition!
alias!)))
(_.cover [/.type_definition]
@@ -626,13 +626,13 @@
(|> (/.type_definition [expected_macro_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success actual_value)
- (is? (:as .Type expected_value) actual_value))))
+ (same? (:as .Type expected_value) actual_value))))
alias!
(|> (/.type_definition [expected_current_module expected_short])
(/.result expected_lux)
(!expect (^multi (#try.Success actual_value)
- (is? (:as .Type expected_value) actual_value))))]
+ (same? (:as .Type expected_value) actual_value))))]
(and definition!
alias!)))
)))
@@ -945,7 +945,7 @@
/.lift
(/.result expected_lux)
(!expect (^multi (#try.Success actual)
- (is? expected_value actual)))))))
+ (same? expected_value actual)))))))
..compiler_related
..error_handling
diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux
index c3df88e81..4062dd9b2 100644
--- a/stdlib/source/test/lux/program.lux
+++ b/stdlib/source/test/lux/program.lux
@@ -38,22 +38,30 @@
(let [outcome ((: (-> (List Text) (io.IO Any))
(..actual_program <program>))
inputs)]
- (is? (: Any inputs) (io.run! outcome))))
- (with_expansions [<program> (/.program: [arg/0 arg/1 arg/2 arg/3 arg/4]
+ (same? (: Any inputs)
+ (io.run! outcome))))
+ (with_expansions [<program> (/.program: [arg/0 <cli>.any
+ arg/1 <cli>.any
+ arg/2 <cli>.any
+ arg/3 <cli>.any
+ arg/4 <cli>.any]
(io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))]
(let [outcome ((: (-> (List Text) (io.IO Any))
(..actual_program <program>))
inputs)]
(list\= (list.reversed inputs)
(:as (List Text) (io.run! outcome)))))
- (with_expansions [<program> (/.program: [{all_arguments (<>.many <cli>.any)}]
+ (with_expansions [<program> (/.program: [all_arguments (<>.many <cli>.any)]
(io.io all_arguments))]
(let [outcome ((: (-> (List Text) (io.IO Any))
(..actual_program <program>))
inputs)]
(list\= inputs
(:as (List Text) (io.run! outcome)))))
- (with_expansions [<program> (/.program: [arg/0 arg/1 arg/2 arg/3]
+ (with_expansions [<program> (/.program: [arg/0 <cli>.any
+ arg/1 <cli>.any
+ arg/2 <cli>.any
+ arg/3 <cli>.any]
(io.io []))]
(case (try ((: (-> (List Text) (io.IO Any))
(..actual_program <program>))
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 738e080c4..3f975a006 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
@@ -155,7 +155,7 @@
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)
+ [outputT outputC] (r.only (|>> product.left (same? Any) not)
_primitive.primitive)
.let [analyse_pm (function (_ branches)
(|> (/.case _primitive.phase branches archive.empty inputC)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux
index 8df54a276..fcec6b95c 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux
@@ -76,7 +76,7 @@
//type.with_inference
(phase.result ..state)
(case> (#try.Success [inferred_type output])
- (if (is? expected_type inferred_type)
+ (if (same? expected_type inferred_type)
(#try.Success output)
(exception.except wrong_inference [expected_type inferred_type]))
@@ -89,7 +89,7 @@
(_.test (%.name (name_of #////analysis.Unit))
(|> (infer Any (..phase archive.empty (' [])))
(case> (^ (#try.Success (#////analysis.Primitive (#////analysis.Unit output))))
- (is? [] output)
+ (same? [] output)
_
false)))
@@ -99,7 +99,7 @@
(_.test (%.name (name_of <tag>))
(|> (infer <type> (..phase archive.empty (<constructor> sample)))
(case> (#try.Success (#////analysis.Primitive (<tag> output)))
- (is? sample output)
+ (same? sample output)
_
false))))]
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
index 30ad64e34..47abe0165 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -51,7 +51,7 @@
(def: primitive
(Random [Type Code])
- (r.only (|>> product.left (is? Any) not) _primitive.primitive))
+ (r.only (|>> product.left (same? Any) not) _primitive.primitive))
(def: lux
Test
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 529db21df..3a1101011 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
@@ -47,8 +47,8 @@
(~~ (template [<analysis> <post_analysis> <synthesis> <post_synthesis>]
[[(#////analysis.Primitive (<analysis> expected))
(#////synthesis.Primitive (<synthesis> actual))]
- (is? (|> expected <post_analysis>)
- (|> actual <post_synthesis>))]
+ (same? (|> expected <post_analysis>)
+ (|> actual <post_synthesis>))]
[#////analysis.Unit (:as Text) #////synthesis.Text (|>)]
[#////analysis.Bit (|>) #////synthesis.Bit (|>)]
@@ -82,7 +82,7 @@
(//.phase archive.empty)
(phase.result [///bundle.empty ////synthesis.init])
(case> (#try.Success (#////synthesis.Primitive (<synthesis> actual)))
- (is? expected actual)
+ (same? expected actual)
_
false))))]
diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux
index 46adc6884..078aef4e2 100644
--- a/stdlib/source/test/lux/type.lux
+++ b/stdlib/source/test/lux/type.lux
@@ -44,38 +44,39 @@
(Random Name)
(random.and ..short ..short))
-(def: .public random
- (Random Type)
+(def: .public (random parameters)
+ (-> Nat (Random Type))
(random.rec
(function (_ recur)
(let [pairG (random.and recur recur)
- idG random.nat
- quantifiedG (random.and (random\in (list)) recur)]
- ($_ random.or
- (random.and ..short (random\in (list)))
- pairG
- pairG
- pairG
- idG
- idG
- idG
- quantifiedG
- quantifiedG
- pairG
- (random.and ..name recur)
- )))))
+ quantifiedG (random.and (random\in (list)) recur)
+ un_parameterized (: (Random Type)
+ ($_ random.either
+ (random\map (|>> #.Primitive) (random.and ..short (random\in (list))))
+ (random\map (|>> #.Sum) pairG)
+ (random\map (|>> #.Product) pairG)
+ (random\map (|>> #.Function) pairG)
+ (random\map (|>> #.UnivQ) quantifiedG)
+ (random\map (|>> #.ExQ) quantifiedG)
+ (random\map (|>> #.Apply) pairG)
+ (random\map (|>> #.Named) (random.and ..name recur))
+ ))]
+ (case parameters
+ 0 un_parameterized
+ _ (random.either un_parameterized
+ (random\map (|>> (n.% parameters) #.Parameter) random.nat)))))))
(def: .public test
Test
(<| (_.covering /._)
($_ _.and
(_.for [/.equivalence]
- ($equivalence.spec /.equivalence ..random))
+ ($equivalence.spec /.equivalence (..random 0)))
(do {! random.monad}
[anonymousT (random.only (|>> (case> (#.Named _ _) false
_ true))
- ..random)
+ (..random 0))
name/0 ..name
name/1 ..name
.let [namedT (#.Named name/0 anonymousT)
@@ -87,7 +88,7 @@
(\ /.equivalence = anonymousT (/.anonymous aliasedT)))))
(do {! random.monad}
[size (|> random.nat (\ ! map (n.% 3)))
- members (|> ..random
+ members (|> (..random 0)
(random.only (function (_ type)
(case type
(^or (#.Sum _) (#.Product _))
@@ -121,8 +122,8 @@
(case> #.None #1 _ #0))))
(do {! random.monad}
[size (|> random.nat (\ ! map (n.% 3)))
- members (monad.seq ! (list.repeated size ..random))
- extra (|> ..random
+ members (monad.seq ! (list.repeated size (..random 0)))
+ extra (|> (..random 0)
(random.only (function (_ type)
(case type
(^or (#.Function _) (#.Apply _))
@@ -143,7 +144,7 @@
))
(do {! random.monad}
[size (|> random.nat (\ ! map (|>> (n.% 3) inc)))
- body_type (|> ..random
+ body_type (|> (..random 0)
(random.only (function (_ type)
(case type
(^or (#.UnivQ _) (#.ExQ _))
@@ -169,7 +170,7 @@
)))
(do {! random.monad}
[depth (|> random.nat (\ ! map (|>> (n.% 3) inc)))
- element_type (|> ..random
+ element_type (|> (..random 0)
(random.only (function (_ type)
(case type
(^ (#.Primitive name (list element_type)))
@@ -210,7 +211,7 @@
(|> left,right
(/.:cast [l r] (And l r) (Or l r))
(/.:cast [l r] (Or l r) (And l r))
- (is? left,right))))
+ (same? left,right))))
(do random.monad
[expected random.nat]
(_.cover [/.:sharing]
@@ -223,8 +224,8 @@
(.i64 expected)))))
(do random.monad
[.let [(^open "/\.") /.equivalence]
- left ..random
- right ..random]
+ left (..random 0)
+ right (..random 0)]
($_ _.and
(_.cover [/.code]
(bit\= (/\= left right)
diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux
index 39b336ba2..1875d4fc8 100644
--- a/stdlib/source/test/lux/type/check.lux
+++ b/stdlib/source/test/lux/type/check.lux
@@ -125,7 +125,7 @@
(: (/.Check Any)
(/.failure expected)))
(#try.Success _) false
- (#try.Failure actual) (is? expected actual))))
+ (#try.Failure actual) (same? expected actual))))
(do random.monad
[expected (random.ascii/upper 10)]
(_.cover [/.assertion]
@@ -136,7 +136,7 @@
(#try.Failure actual) false)
(case (/.result /.fresh_context (/.assertion expected false))
(#try.Success _) false
- (#try.Failure actual) (is? expected actual)))))
+ (#try.Failure actual) (same? expected actual)))))
(_.cover [/.except]
(case (/.result /.fresh_context
(: (/.Check Any)
@@ -241,7 +241,7 @@
(/.read var_id))
(/.result /.fresh_context)
(case> (#try.Success (#.Some actual))
- (is? expected actual)
+ (same? expected actual)
_
false)))))
@@ -255,7 +255,7 @@
_ (/.bind expected var_id)]
(/.read! var_id)))
(#try.Success actual)
- (is? expected actual)
+ (same? expected actual)
_
false)))
@@ -284,7 +284,7 @@
(_.cover [/.context]
(and (case (/.result /.fresh_context /.context)
(#try.Success actual)
- (is? /.fresh_context actual)
+ (same? /.fresh_context actual)
(#try.Failure error)
false)
@@ -850,7 +850,7 @@
(_.cover [/.result]
(case (/.result /.fresh_context
(\ /.monad in expected))
- (#try.Success actual) (is? expected actual)
+ (#try.Success actual) (same? expected actual)
(#try.Failure error) false)))
..error_handling
..var
diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux
index ae137a428..3233777c4 100644
--- a/stdlib/source/test/lux/type/quotient.lux
+++ b/stdlib/source/test/lux/type/quotient.lux
@@ -41,14 +41,14 @@
(_.for [/.Class]
(_.cover [/.class]
- (is? (: Any class)
- (: Any (/.class class)))))
+ (same? (: Any class)
+ (: Any (/.class class)))))
(_.for [/.Quotient]
($_ _.and
(_.cover [/.quotient /.value /.label]
(let [quotient (/.quotient (/.class class) value)]
- (and (is? value
- (/.value quotient))
+ (and (same? value
+ (/.value quotient))
(text\= (class value)
(/.label quotient)))))
(_.cover [/.type]
diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux
index 369a2de9a..64a0b60bd 100644
--- a/stdlib/source/test/lux/type/refinement.lux
+++ b/stdlib/source/test/lux/type/refinement.lux
@@ -46,7 +46,7 @@
(not (predicate raw))))
(_.cover [/.predicate]
(|> (/.refiner predicate modulus)
- (maybe\map (|>> /.predicate (is? predicate)))
+ (maybe\map (|>> /.predicate (same? predicate)))
(maybe.else false)))
))
(_.cover [/.value]
diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux
index 945dfc352..1198e56bb 100644
--- a/stdlib/source/test/lux/world/console.lux
+++ b/stdlib/source/test/lux/world/console.lux
@@ -33,7 +33,7 @@
(def: (on_read_line [dead? content])
(do try.monad
- [[line content] (try.of_maybe (text.split_with text.new_line content))]
+ [[line content] (try.of_maybe (text.split_by text.new_line content))]
(if dead?
(exception.except ..dead [])
(in [[dead? content] line]))))
diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux
index 98f589439..0bbff685f 100644
--- a/stdlib/source/test/lux/world/file/watch.lux
+++ b/stdlib/source/test/lux/world/file/watch.lux
@@ -51,7 +51,7 @@
(/.deletion? /.deletion)))
(do random.monad
[left ..concern
- right (random.only (|>> (is? left) not)
+ right (random.only (|>> (same? left) not)
..concern)
.let [[left left?] left
[right right?] right]]
diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux
index f2643a3b7..879d1f60f 100644
--- a/stdlib/source/test/lux/world/program.lux
+++ b/stdlib/source/test/lux/world/program.lux
@@ -62,7 +62,7 @@
dictionary.entries
(list.every? (function (_ [key value])
(|> environment
- (dictionary.get key)
+ (dictionary.value key)
(maybe\map (text\= value))
(maybe.else false)))))))))))
(_.cover [/.unknown_environment_variable]