aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/test.yml21
-rw-r--r--documentation/bookmark/business/compensation.md5
-rw-r--r--documentation/bookmark/business/sales/referral.md5
-rw-r--r--documentation/bookmark/compilation/target/c++.md1
-rw-r--r--documentation/bookmark/compilation/target/js__javascript.md1
-rw-r--r--documentation/bookmark/css.md2
-rw-r--r--documentation/bookmark/food.md1
-rw-r--r--documentation/bookmark/game/design.md5
-rw-r--r--documentation/bookmark/game/replayability.md5
-rw-r--r--documentation/bookmark/operating_system.md35
-rw-r--r--documentation/bookmark/security/verification/formal.md2
-rw-r--r--lux-bootstrapper/project.clj2
-rw-r--r--lux-bootstrapper/src/lux/base.clj2
-rw-r--r--lux-js/commands.md4
-rw-r--r--lux-js/project.lux8
-rw-r--r--lux-jvm/commands.md4
-rw-r--r--lux-jvm/project.clj2
-rw-r--r--lux-lein/project.clj2
-rw-r--r--lux-lua/commands.md4
-rw-r--r--lux-lua/project.lux6
-rw-r--r--lux-python/commands.md4
-rw-r--r--lux-python/project.lux6
-rw-r--r--lux-ruby/commands.md4
-rw-r--r--lux-ruby/project.lux6
-rw-r--r--stdlib/project.lux14
-rw-r--r--stdlib/source/library/lux/abstract/monad/indexed.lux20
-rw-r--r--stdlib/source/library/lux/ffi.lux369
-rw-r--r--stdlib/source/library/lux/ffi/export.js.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux17
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta.lux2
-rw-r--r--stdlib/source/library/lux/meta/target/js.lux4
-rw-r--r--stdlib/source/library/lux/meta/type/resource.lux20
-rw-r--r--stdlib/source/library/lux/meta/version.lux2
-rw-r--r--stdlib/source/library/lux/world/console.lux4
-rw-r--r--stdlib/source/library/lux/world/file.lux11
-rw-r--r--stdlib/source/test/lux/abstract.lux12
-rw-r--r--stdlib/source/test/lux/abstract/monad.lux8
-rw-r--r--stdlib/source/test/lux/abstract/monad/indexed.lux47
-rw-r--r--stdlib/source/test/lux/debug.lux75
-rw-r--r--stdlib/source/test/lux/ffi.py.lux8
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux2
-rw-r--r--stdlib/source/test/lux/meta/target/js.lux58
42 files changed, 524 insertions, 288 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5fed0d9ac..1da96d567 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -13,17 +13,16 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/workflows/setup_aedifex
- run: cd ./stdlib/ && ../lux.sh with aedifex test
- # Temporarily disabled because of strange "replaceAll" issue on CI.
-# test_stdlib_on_node_js:
-# runs-on: ubuntu-latest
-# steps:
-# - uses: actions/checkout@v2
-# - uses: ./.github/workflows/setup_aedifex
-# # https://github.com/actions/setup-node
-# - uses: actions/setup-node@v3
-# with:
-# node-version: '14'
-# - run: cd ./stdlib/ && ../lux.sh with js with bibliotheca test
+ test_stdlib_on_node_js:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ./.github/workflows/setup_aedifex
+ # https://github.com/actions/setup-node
+ - uses: actions/setup-node@v3
+ with:
+ node-version: '14'
+ - run: cd ./stdlib/ && ../lux.sh with js with bibliotheca test
test_stdlib_on_python_3:
runs-on: ubuntu-latest
steps:
diff --git a/documentation/bookmark/business/compensation.md b/documentation/bookmark/business/compensation.md
new file mode 100644
index 000000000..8b6d02af4
--- /dev/null
+++ b/documentation/bookmark/business/compensation.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Compensation as a Reflection of Values](https://oxide.computer/blog/compensation-as-a-reflection-of-values)
+
diff --git a/documentation/bookmark/business/sales/referral.md b/documentation/bookmark/business/sales/referral.md
new file mode 100644
index 000000000..ea2edf7c4
--- /dev/null
+++ b/documentation/bookmark/business/sales/referral.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [How to design a referral program](https://andrewchen.com/how-to-design-a-referral-program/)
+
diff --git a/documentation/bookmark/compilation/target/c++.md b/documentation/bookmark/compilation/target/c++.md
index 2e1c893ef..1a82f8212 100644
--- a/documentation/bookmark/compilation/target/c++.md
+++ b/documentation/bookmark/compilation/target/c++.md
@@ -23,6 +23,7 @@
# Reference
0. []()
+0. [The jank programming language](https://jank-lang.org/)
0. [Conan, the C/C++ Package Manager](https://conan.io/)
0. [C++ keywords: noexcept (since C++11)](https://en.cppreference.com/w/cpp/keyword/noexcept)
0. [alignas specifier (since C++11)](https://en.cppreference.com/w/cpp/language/alignas)
diff --git a/documentation/bookmark/compilation/target/js__javascript.md b/documentation/bookmark/compilation/target/js__javascript.md
index 6655cfa61..ea50f7f79 100644
--- a/documentation/bookmark/compilation/target/js__javascript.md
+++ b/documentation/bookmark/compilation/target/js__javascript.md
@@ -1,6 +1,7 @@
# Reference
0. []()
+0. [Optimizing for JavaScript is hard](https://jfmengels.net/optimizing-javascript-is-hard/)
0. [Roll your own JavaScript runtime](https://deno.com/blog/roll-your-own-javascript-runtime)
0. [How JavaScript Array Works Internally?](https://blog.gauravthakur.in/how-javascript-array-works-internally)
0. [Maybe you don't need Rust and WASM to speed up your JS ](https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html)
diff --git a/documentation/bookmark/css.md b/documentation/bookmark/css.md
index 50af40496..c1231143a 100644
--- a/documentation/bookmark/css.md
+++ b/documentation/bookmark/css.md
@@ -1,10 +1,12 @@
# Methodology
+0. []()
0. [CUBE CSS](https://cube.fyi/)
# Reference
0. []()
+0. [Not All Zeros are Equal: And every ‘best practice’ comes with caveats](https://www.oddbird.net/2022/08/04/zero-units/)
0. [Style scoping versus shadow DOM: which is fastest?](https://nolanlawson.com/2022/06/22/style-scoping-versus-shadow-dom-which-is-fastest/)
0. [Got Spaghetti Stylesheets? 4 Techniques for Managing CSS Complexity](https://blog.shimin.io/4-techniques-for-managing-css-complexity/)
0. [Why is :hover:after valid but not :after:hover? CSS Pseudo-Class and Pseudo-Element Selectors](https://blog.shimin.io/pseudo-class-and-pseudo-element-selectors/)
diff --git a/documentation/bookmark/food.md b/documentation/bookmark/food.md
index e46dbe88d..cbd63febe 100644
--- a/documentation/bookmark/food.md
+++ b/documentation/bookmark/food.md
@@ -1,6 +1,7 @@
# Reference
0. []()
+0. [Ikejime](https://en.wikipedia.org/wiki/Ikejime)
0. [Redefine Meat](https://www.redefinemeat.com/)
0. [Solar Foods](https://solarfoods.com/)
0. [Remilk](https://www.remilk.com/)
diff --git a/documentation/bookmark/game/design.md b/documentation/bookmark/game/design.md
new file mode 100644
index 000000000..05d3d9abb
--- /dev/null
+++ b/documentation/bookmark/game/design.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [How to design an Abstract Strategy Board Game *Top 10 Mechanisms*](https://www.youtube.com/watch?v=fBWDfXE9xsU)
+
diff --git a/documentation/bookmark/game/replayability.md b/documentation/bookmark/game/replayability.md
new file mode 100644
index 000000000..ac9eefaed
--- /dev/null
+++ b/documentation/bookmark/game/replayability.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Replayability in Game Design](https://medium.com/super-jump/replayability-in-game-design-798fbb91a726)
+
diff --git a/documentation/bookmark/operating_system.md b/documentation/bookmark/operating_system.md
index 4b1b90904..9942aa1d2 100644
--- a/documentation/bookmark/operating_system.md
+++ b/documentation/bookmark/operating_system.md
@@ -1,17 +1,21 @@
# Code-generation
+0. []()
0. [It’s Time for a Modern Synthesis Kernel](https://blog.regehr.org/archives/1676)
# Intepreter
+0. []()
0. [Jitk: A Trustworthy In-Kernel Interpreter Infrastructure](https://css.csail.mit.edu/jitk/)
# Architecture
+0. []()
0. [TabulaROSA: Tabular Operating System Architecture for Massively Parallel Heterogeneous Compute Engines](https://arxiv.org/abs/1807.05308)
# Graphics | Rendering
+0. []()
0. [Text Rendering Hates You](https://gankra.github.io/blah/text-hates-you/)
0. https://fuchsia.googlesource.com/garnet/+/master/docs/ui/scenic.md
@@ -19,6 +23,7 @@
## Operating system
+0. []()
0. [Phantom - forward-thinking concept of OS that's not Linux derived](http://phantomos.org/)
0. [CLOSOS: Specication of a Lisp operating system.](http://metamodular.com/lispos.pdf)
0. [CLOSOS: Specication of a Lisp operating system.](http://metamodular.com/closos.pdf)
@@ -78,6 +83,7 @@
## Unikernel
+0. []()
0. [State of the art for Unikernels](https://github.com/seeker89/unikernels)
0. https://hermitcore.org/2018/06/06/A-Rust-based-Unikernel/
0. http://unikernel.org/
@@ -96,14 +102,18 @@
## Microkernel
+0. []()
0. [Snap: a Microkernel Approach to Host Networking](https://storage.googleapis.com/pub-tools-public-publication-data/pdf/36f0f9b41e969a00d75da7693571e988996c9f4c.pdf)
## Real-time
+0. []()
0. https://en.wikipedia.org/wiki/VxWorks
# Reference
+0. []()
+0. [Purely Functional Operating Systems](https://eighty-twenty.org/2022/06/23/henderson-functional-operating-systems-1982)
0. [The little book about OS development](http://littleosbook.github.io/)
0. [Rethinking files](https://www.devever.net/~hl/objectworld)
0. [Writing an OS in Rust (Second Edition)](https://os.phil-opp.com/)
@@ -148,25 +158,30 @@
# Higher-Order
+0. []()
0. https://www.yoctoproject.org/
# Formats
+0. []()
0. http://iokit.racing/machotricks.pdf
# Error-handling
+0. []()
0. http://joeduffyblog.com/2016/02/07/the-error-model/
0. https://code.fb.com/production-engineering/open-sourcing-oomd-a-new-approach-to-handling-ooms/
0. https://os.phil-opp.com/double-fault-exceptions/
# Tools
+0. []()
0. https://osquery.io/
0. https://github.com/facebook/osquery
# Shell
+0. []()
0. [Magritte: A Language for Pipe-Based Programming](http://files.jneen.net/academic/thesis.pdf)
0. https://latacora.singles/2018/06/21/loud-subshells.html
0. https://github.com/ipetkov/conch-runtime
@@ -174,6 +189,7 @@
# File-system
+0. []()
0. https://medium.com/@siddontang/use-fuse-to-inject-failure-to-i-o-deb5f2e7800a
0. [Spiffy: Enabling File-System Aware Storage Applications](https://www.usenix.org/conference/fast18/presentation/sun)
0. https://github.com/bindh3x/libnicko
@@ -188,6 +204,7 @@
# Shared libraries | Dynamic Loading
+0. []()
0. https://amir.rachum.com/blog/2016/09/17/shared-libraries/
0. https://www.kix.in/2008/06/19/an-alternative-to-shared-libraries/
0. https://www.akkadia.org/drepper/no_static_linking.html
@@ -195,18 +212,21 @@
# Packages
+0. []()
0. [Piotr Gaczkowski - Nix -- the functional package manager - Lambda Days 2020](https://www.youtube.com/watch?v=6AvwC25fd_U)
0. https://snapcraft.io/
0. https://code.fb.com/data-infrastructure/xars-a-more-efficient-open-source-system-for-self-contained-executables/
# System Calls
+0. []()
0. [1001 Ways of Implementing a System Call](https://x86.lol/generic/2019/07/04/kernel-entry.html)
0. https://eli.thegreenplace.net/2018/basics-of-futexes/
0. [FlexSC: Flexible System Call Scheduling with Exception-Less System Calls](https://www.usenix.org/legacy/event/osdi10/tech/full_papers/Soares.pdf)
# Security
+0. []()
0. https://en.wikipedia.org/wiki/Reference_monitor
0. [FINE-CFI: Fine-grained Control-Flow Integrity for Operating System Kernels](http://www.cs.wayne.edu/fengwei/paper/fine-cfi-tifs18.pdf)
0. https://unsat.cs.washington.edu/projects/hyperkernel/
@@ -218,67 +238,82 @@
# Driver
+0. []()
0. https://blogs.windows.com/buildingapps/2018/08/15/introducing-driver-module-framework/#J6CWEbpcH0OwgWbP.97
0. [Toward Compositional Verification of Interruptible OS Kernels and Device Drivers](http://flint.cs.yale.edu/flint/publications/device-journal.pdf)
0. [Writing Network Drivers in Haskell](https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2019-ixy-haskell.pdf)
# Networking
+0. []()
0. [Computer Networks: A Systems Approach](https://github.com/SystemsApproach/book)
# Kernel
+0. []()
0. [A new kernel polling interface](https://lwn.net/Articles/743714/)
0. [Composing Abstractions using the null-Kernel](https://people.mpi-sws.org/~dg/papers/hotosxvii.pdf)
# I/O
+0. []()
0. [The block I/O latency controller](https://lwn.net/Articles/758963/)
0. [I/O Is Faster Than the CPU – Let’s Partition Resources and Eliminate (Most) OS Abstractions](https://penberg.org/parakernel-hotos19.pdf)
# Init System
+0. []()
0. https://davmac.wordpress.com/2018/10/26/on-the-vagaries-of-init-systems/
# Homogeneous Operating Systems
+0. []()
0. https://ecc-comp.blogspot.com/2014/12/homogeneous-operating-systems-are-better.html
# Update System
+0. []()
0. https://theupdateframework.github.io/overview.html
# Signal
+0. []()
0. http://delyan.me/code-review-signals/
# Daemon
+0. []()
0. https://chaoticlab.io/c/c++/unix/2018/10/01/daemonize.html
# Memory
+0. []()
0. [Memory Systems and Memory-Centric Computing Systems](http://people.inf.ethz.ch/omutlu/acaces2018.html)
0. https://en.wikipedia.org/wiki/Page_replacement_algorithm
0. [Compress Objects, Not Cache Lines:An Object-Based Compressed Memory Hierarchy](https://people.csail.mit.edu/poantsai/papers/2019.zippads.asplos.pdf)
# Hardware
+0. []()
0. [There's No Such Thing as a General-purpose Processor](https://queue.acm.org/detail.cfm?id=2687011)
# Reliability
+0. []()
0. [CuriOS: Improving Reliability through Operating System Structure](http://people.cs.ksu.edu/~danielwang/Investigation/System_Security/curios.pdf)
# Booting | Bootstrapping
+0. []()
0. https://puri.sm/posts/pureboot-the-high-security-boot-process/
# Virtualization
+0. []()
0. [virtio: Towards a De-Facto Standard For Virtual I/O Devices](https://www.ozlabs.org/~rusty/virtio-spec/virtio-paper.pdf)
# Separation kernel
+0. []()
0. [High-Assurance Separation Kernels: A Survey on Formal Methods](https://arxiv.org/abs/1701.01535)
diff --git a/documentation/bookmark/security/verification/formal.md b/documentation/bookmark/security/verification/formal.md
index ed59c673a..c2e450d7e 100644
--- a/documentation/bookmark/security/verification/formal.md
+++ b/documentation/bookmark/security/verification/formal.md
@@ -1,4 +1,6 @@
# Reference
+0. []()
+0. [Certifying Interpreters in Racket](https://kmicinski.com/certifying-interpreters)
0. [Verifying Dynamic Trait Objects in Rust](https://www.cs.cornell.edu/~avh/dyn-trait-icse-seip-2022-preprint.pdf)
diff --git a/lux-bootstrapper/project.clj b/lux-bootstrapper/project.clj
index c97ecece2..dc6b6404d 100644
--- a/lux-bootstrapper/project.clj
+++ b/lux-bootstrapper/project.clj
@@ -1,4 +1,4 @@
-(def version "0.7.0")
+(def version "0.8.0-SNAPSHOT")
(defproject com.github.luxlang/lux-bootstrapper #=(identity version)
:min-lein-version "2.1.0" ;; 2.1.0 introduced jar classifiers
diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj
index d0c457680..39806f73f 100644
--- a/lux-bootstrapper/src/lux/base.clj
+++ b/lux-bootstrapper/src/lux/base.clj
@@ -230,7 +230,7 @@
(def ^:const module-class-name "_")
(def ^:const +name-separator+ ".")
-(def ^:const ^String version "00.07.00")
+(def ^:const ^String version "00.08.00")
;; Constructors
(def empty-location (T ["" -1 -1]))
diff --git a/lux-js/commands.md b/lux-js/commands.md
index 4b27b62df..6730dad02 100644
--- a/lux-js/commands.md
+++ b/lux-js/commands.md
@@ -44,14 +44,14 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-js/ \
-&& mvn install:install-file -Dfile=target/program.js -DgroupId=com.github.luxlang -DartifactId=lux-js -Dversion=0.7.0 -Dpackaging=js
+&& mvn install:install-file -Dfile=target/program.js -DgroupId=com.github.luxlang -DartifactId=lux-js -Dversion=0.8.0-SNAPSHOT -Dpackaging=js
cd ~/lux/lux-js/ && mvn deploy:deploy-file \
-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
-Dfile=target/program.js \
-DgroupId=com.github.luxlang \
-DartifactId=lux-js \
--Dversion=0.7.0-SNAPSHOT \
+-Dversion=0.8.0-SNAPSHOT \
-Dpackaging=js
```
diff --git a/lux-js/project.lux b/lux-js/project.lux
index 24b4504ce..a3db2e680 100644
--- a/lux-js/project.lux
+++ b/lux-js/project.lux
@@ -1,5 +1,5 @@
[""
- ["identity" ["com.github.luxlang" "lux-js" "0.7.0"]
+ ["identity" ["com.github.luxlang" "lux-js" "0.8.0-SNAPSHOT"]
"info" ["description" "A JavaScript compiler for Lux."
"url" "https://github.com/LuxLang/lux"
"scm" "https://github.com/LuxLang/lux.git"
@@ -15,15 +15,15 @@
"repositories" ["https://oss.sonatype.org/content/repositories/snapshots/"
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"]
- "dependencies" [... ["com.github.luxlang" "stdlib" "0.7.0" "tar"]
+ "dependencies" [... ["com.github.luxlang" "stdlib" "0.8.0-SNAPSHOT" "tar"]
]
"program" program._]
"js"
- ["lux" ["com.github.luxlang" "lux-js" "0.7.0" "js"]]
+ ["lux" ["com.github.luxlang" "lux-js" "0.8.0-SNAPSHOT" "js"]]
"jvm"
- ["lux" ["com.github.luxlang" "lux-jvm" "0.7.0" "jar"]
+ ["lux" ["com.github.luxlang" "lux-jvm" "0.8.0-SNAPSHOT" "jar"]
"dependencies" [["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]
["org.openjdk.nashorn" "nashorn-core" "15.1" "jar"]]]]
diff --git a/lux-jvm/commands.md b/lux-jvm/commands.md
index 071b66f88..83ef82582 100644
--- a/lux-jvm/commands.md
+++ b/lux-jvm/commands.md
@@ -40,14 +40,14 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-jvm/ \
-&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm -Dversion=0.7.0 -Dpackaging=jar
+&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm -Dversion=0.8.0-SNAPSHOT -Dpackaging=jar
cd ~/lux/lux-jvm/ && mvn deploy:deploy-file \
-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
-Dfile=target/program.jar \
-DgroupId=com.github.luxlang \
-DartifactId=lux-jvm \
--Dversion=0.7.0-SNAPSHOT \
+-Dversion=0.8.0-SNAPSHOT \
-Dpackaging=jar
```
diff --git a/lux-jvm/project.clj b/lux-jvm/project.clj
index a77d134ac..b07c38035 100644
--- a/lux-jvm/project.clj
+++ b/lux-jvm/project.clj
@@ -1,4 +1,4 @@
-(def version "0.7.0")
+(def version "0.8.0-SNAPSHOT")
(def repo "https://github.com/LuxLang/lux")
(def sonatype "https://oss.sonatype.org")
(def sonatype-releases (str sonatype "/service/local/staging/deploy/maven2/"))
diff --git a/lux-lein/project.clj b/lux-lein/project.clj
index e5688c155..a3ffe8469 100644
--- a/lux-lein/project.clj
+++ b/lux-lein/project.clj
@@ -1,4 +1,4 @@
-(def version "0.7.0")
+(def version "0.8.0-SNAPSHOT")
(defproject com.github.luxlang/lein-luxc #=(identity version)
:description "The Leiningen plugin for the Lux programming language."
diff --git a/lux-lua/commands.md b/lux-lua/commands.md
index 3e7d49980..a914da39b 100644
--- a/lux-lua/commands.md
+++ b/lux-lua/commands.md
@@ -28,14 +28,14 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-lua/ \
-&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-lua -Dversion=0.7.0 -Dpackaging=jar
+&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-lua -Dversion=0.8.0-SNAPSHOT -Dpackaging=jar
cd ~/lux/lux-lua/ && mvn deploy:deploy-file \
-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
-Dfile=target/program.jar \
-DgroupId=com.github.luxlang \
-DartifactId=lux-lua \
--Dversion=0.7.0-SNAPSHOT \
+-Dversion=0.8.0-SNAPSHOT \
-Dpackaging=jar
```
diff --git a/lux-lua/project.lux b/lux-lua/project.lux
index a8c249184..3c751b467 100644
--- a/lux-lua/project.lux
+++ b/lux-lua/project.lux
@@ -1,5 +1,5 @@
[""
- ["identity" ["com.github.luxlang" "lux-lua" "0.7.0"]
+ ["identity" ["com.github.luxlang" "lux-lua" "0.8.0-SNAPSHOT"]
"info" ["description" "A Lua compiler for Lux."
"url" "https://github.com/LuxLang/lux"
"scm" "https://github.com/LuxLang/lux.git"
@@ -15,8 +15,8 @@
"repositories" ["https://oss.sonatype.org/content/repositories/snapshots/"
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"]
- "lux" ["com.github.luxlang" "lux-jvm" "0.7.0" "jar"]
- "dependencies" [... ["com.github.luxlang" "stdlib" "0.7.0" "tar"]
+ "lux" ["com.github.luxlang" "lux-jvm" "0.8.0-SNAPSHOT" "jar"]
+ "dependencies" [... ["com.github.luxlang" "stdlib" "0.8.0-SNAPSHOT" "tar"]
["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]
["org.ow2.asm" "asm" "5.0.4" "jar"]
diff --git a/lux-python/commands.md b/lux-python/commands.md
index e26a6840c..025ea8782 100644
--- a/lux-python/commands.md
+++ b/lux-python/commands.md
@@ -28,14 +28,14 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-python/ \
-&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-python -Dversion=0.7.0 -Dpackaging=jar
+&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-python -Dversion=0.8.0-SNAPSHOT -Dpackaging=jar
cd ~/lux/lux-python/ && mvn deploy:deploy-file \
-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
-Dfile=target/program.jar \
-DgroupId=com.github.luxlang \
-DartifactId=lux-python \
--Dversion=0.7.0-SNAPSHOT \
+-Dversion=0.8.0-SNAPSHOT \
-Dpackaging=jar
```
diff --git a/lux-python/project.lux b/lux-python/project.lux
index 1375d5a05..3a08e7ace 100644
--- a/lux-python/project.lux
+++ b/lux-python/project.lux
@@ -1,5 +1,5 @@
[""
- ["identity" ["com.github.luxlang" "lux-python" "0.7.0"]
+ ["identity" ["com.github.luxlang" "lux-python" "0.8.0-SNAPSHOT"]
"info" ["description" "A Python compiler for Lux."
"url" "https://github.com/LuxLang/lux"
"scm" "https://github.com/LuxLang/lux.git"
@@ -15,8 +15,8 @@
"repositories" ["https://oss.sonatype.org/content/repositories/snapshots/"
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"]
- "lux" ["com.github.luxlang" "lux-jvm" "0.7.0" "jar"]
- "dependencies" [... ["com.github.luxlang" "stdlib" "0.7.0" "tar"]
+ "lux" ["com.github.luxlang" "lux-jvm" "0.8.0-SNAPSHOT" "jar"]
+ "dependencies" [... ["com.github.luxlang" "stdlib" "0.8.0-SNAPSHOT" "tar"]
["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]
["org.python" "jython-standalone" "2.7.2" "jar"]]
diff --git a/lux-ruby/commands.md b/lux-ruby/commands.md
index 4c966898d..fe30d22a0 100644
--- a/lux-ruby/commands.md
+++ b/lux-ruby/commands.md
@@ -28,14 +28,14 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-ruby/ \
-&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-ruby -Dversion=0.7.0 -Dpackaging=jar
+&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-ruby -Dversion=0.8.0-SNAPSHOT -Dpackaging=jar
cd ~/lux/lux-ruby/ && mvn deploy:deploy-file \
-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
-Dfile=target/program.jar \
-DgroupId=com.github.luxlang \
-DartifactId=lux-ruby \
--Dversion=0.7.0-SNAPSHOT \
+-Dversion=0.8.0-SNAPSHOT \
-Dpackaging=jar
```
diff --git a/lux-ruby/project.lux b/lux-ruby/project.lux
index 5608d9920..2bb6ee5f6 100644
--- a/lux-ruby/project.lux
+++ b/lux-ruby/project.lux
@@ -1,5 +1,5 @@
[""
- ["identity" ["com.github.luxlang" "lux-ruby" "0.7.0"]
+ ["identity" ["com.github.luxlang" "lux-ruby" "0.8.0-SNAPSHOT"]
"info" ["description" "A Ruby compiler for Lux."
"url" "https://github.com/LuxLang/lux"
"scm" "https://github.com/LuxLang/lux.git"
@@ -15,8 +15,8 @@
"repositories" ["https://oss.sonatype.org/content/repositories/snapshots/"
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"]
- "lux" ["com.github.luxlang" "lux-jvm" "0.7.0" "jar"]
- "dependencies" [... ["com.github.luxlang" "stdlib" "0.7.0" "tar"]
+ "lux" ["com.github.luxlang" "lux-jvm" "0.8.0-SNAPSHOT" "jar"]
+ "dependencies" [... ["com.github.luxlang" "stdlib" "0.8.0-SNAPSHOT" "tar"]
["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]
["org.jruby" "jruby-complete" "9.2.15.0" "jar"]]
diff --git a/stdlib/project.lux b/stdlib/project.lux
index ff120c7cf..c2611040d 100644
--- a/stdlib/project.lux
+++ b/stdlib/project.lux
@@ -2,7 +2,7 @@
[... An optional identity for the project.
... It can also be specified or overriden in a non-default profile.
... This will be the name given to the project when installed/deployed as a dependency.
- "identity" ["com.github.luxlang" "stdlib" "0.7.0"]
+ "identity" ["com.github.luxlang" "stdlib" "0.8.0-SNAPSHOT"]
... Every piece of information, and the whole "info" bundle, are optional.
"info" ["name" "stdlib"
@@ -46,37 +46,37 @@
... The following are alternative profiles to use in various situations.
"jvm"
[... "lux" specifies the dependency to fetch and use as the compiler.
- "lux" ["com.github.luxlang" "lux-jvm" "0.7.0" "jar"]
+ "lux" ["com.github.luxlang" "lux-jvm" "0.8.0-SNAPSHOT" "jar"]
"dependencies" [["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]]
... "dependencies" is an optional list of dependencies to fetch.
... The dependencies have the same shape as when specifying the compiler.
... When omitting the packaging format of the dependency, "tar" will be assumed.
... "dependencies" [["org.ow2.asm" "asm-all" "5.0.3" "jar"]
- ... ["com.github.luxlang" "stdlib" "0.6.4"]]
+ ... ["com.github.luxlang" "stdlib" "0.8.0-SNAPSHOT"]]
... The OS command to use when running JVM tests. The default is described below.
... "java" ["java" "-jar"]
]
"js"
- ["lux" ["com.github.luxlang" "lux-js" "0.7.0" "js"]
+ ["lux" ["com.github.luxlang" "lux-js" "0.8.0-SNAPSHOT" "js"]
... The OS command to use when running JS tests. The default is described below.
... "js" ["node" "--stack_size=8192"]
]
"lua"
- ["lux" ["com.github.luxlang" "lux-lua" "0.7.0" "jar"]
+ ["lux" ["com.github.luxlang" "lux-lua" "0.8.0-SNAPSHOT" "jar"]
... The OS command to use when running Lua tests. The default is described below.
... "lua" ["lua"]
]
"python"
- ["lux" ["com.github.luxlang" "lux-python" "0.7.0" "jar"]
+ ["lux" ["com.github.luxlang" "lux-python" "0.8.0-SNAPSHOT" "jar"]
... The OS command to use when running Python tests. The default is described below.
... "python" ["python3"]
]
"ruby"
- ["lux" ["com.github.luxlang" "lux-ruby" "0.7.0" "jar"]
+ ["lux" ["com.github.luxlang" "lux-ruby" "0.8.0-SNAPSHOT" "jar"]
... The OS command to use when running Ruby tests. The default is described below.
... "ruby" ["ruby"]
]
diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux
index 602d65137..c752236c6 100644
--- a/stdlib/source/library/lux/abstract/monad/indexed.lux
+++ b/stdlib/source/library/lux/abstract/monad/indexed.lux
@@ -13,16 +13,16 @@
[syntax (.only syntax)]]]]]
["[0]" //])
-(type .public (IxMonad m)
+(type .public (Monad !)
(Interface
- (is (All (_ p a)
- (-> a (m p p a)))
+ (is (All (_ condition value)
+ (-> value (! condition condition value)))
in)
- (is (All (_ ii it io vi vo)
- (-> (-> vi (m it io vo))
- (m ii it vi)
- (m ii io vo)))
+ (is (All (_ pre interim post input output)
+ (-> (-> input (! interim post output))
+ (-> (! pre interim input)
+ (! pre post output))))
then)))
(type Binding
@@ -85,11 +85,9 @@
{.#Some name}
(let [name (code.local name)]
(` (let [(, name) (, monad)
- [..in (,' in)
- ..then (, g!then)] (, name)]
+ [..in (,' in) ..then (, g!then)] (, name)]
(, body))))
{.#None}
- (` (let [[..in (,' in)
- ..then (, g!then)] (, monad)]
+ (` (let [[..in (,' in) ..then (, g!then)] (, monad)]
(, body))))))))))
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 850ac3b83..bac9d29bd 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -13,7 +13,7 @@
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format]]
[collection
- ["[0]" list (.use "[1]#[0]" monad mix)]]]
+ ["[0]" list (.use "[1]#[0]" monoid monad mix)]]]
["[0]" meta (.only)
["[0]" code (.only)
["<[1]>" \\parser (.only Parser)]]
@@ -25,6 +25,165 @@
["@" target (.only)
["[0]" js]]]]])
+... These extensions must be defined this way because importing any of the modules
+... normally used when writing extensions would introduce a circular dependency
+... because the Archive type depends on Binary, and that module depends on this ffi module.
+(def extension_name
+ (syntax (_ [])
+ (do meta.monad
+ [module meta.current_module_name
+ unique_id meta.seed]
+ (in (list (code.text (%.format module " " (%.nat unique_id))))))))
+
+(def extension_analysis
+ (template (_ <name> <parameter>)
+ [{5 #1 [<name> <parameter>]}]))
+
+(def text_analysis
+ (template (_ <it>)
+ [{0 #0 {5 #1 <it>}}]))
+
+(def analysis
+ (template (_ <name> <bindings> <parser> <inputs> <body>)
+ [("lux def analysis" <name>
+ (.function (_ name phase archive inputs)
+ (.function (_ state)
+ (let [<bindings> [name phase archive state]]
+ (when (<code>.result <parser> inputs)
+ {try.#Failure error}
+ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
+ text.\n error)}
+
+ {try.#Success <inputs>}
+ <body>)))))]))
+
+(def generation
+ (template (_ <name> <bindings> <inputs> <body>)
+ [("lux def generation" <name>
+ (.function (_ name phase archive inputs)
+ (.function (_ state)
+ (let [<bindings> [name phase archive state]]
+ (when inputs
+ <inputs>
+ <body>
+
+ _
+ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))]))
+
+(for @.js (with_expansions [<undefined> (..extension_name)
+ <undefined?> (..extension_name)
+ <object> (..extension_name)
+ <set> (..extension_name)]
+ (these (analysis <undefined>
+ [name phase archive state]
+ <code>.end
+ _
+ {try.#Success [state (extension_analysis name (list))]})
+
+ (generation <undefined>
+ [name phase archive state]
+ (list)
+ {try.#Success [state js.undefined]})
+
+ (def .public undefined
+ (template (undefined)
+ [(.is ..Undefined (<undefined>))]))
+
+ (analysis <undefined?>
+ [name phase archive state]
+ <code>.any
+ it
+ (do try.monad
+ [[state it] (phase archive (` (.is .Any (, it))) state)]
+ (in [state (extension_analysis name (list it))])))
+
+ (generation <undefined?>
+ [name phase archive state]
+ (list it)
+ (do try.monad
+ [[state it] (phase archive it state)]
+ (in [state (js.= js.undefined it)])))
+
+ (def .public undefined?
+ (template (undefined? <it>)
+ [(.as .Bit (.is .Any (<undefined?> <it>)))]))
+
+ (analysis <object>
+ [name phase archive state]
+ (<>.some (<>.and <code>.text <code>.any))
+ it
+ (do [! try.monad]
+ [[state output] (monad.mix ! (.function (_ [key value] [state output])
+ (do !
+ [[state value] (phase archive (` (.is .Any (, value))) state)]
+ (in [state (list.partial value (text_analysis key) output)])))
+ [state (list)]
+ it)]
+ (in [state (extension_analysis name (list.reversed output))])))
+
+ (def text_synthesis
+ (template (_ <it>)
+ [{0 #0 {2 #1 <it>}}]))
+
+ (def (pairs it)
+ (All (_ a) (-> (List a) (List [a a])))
+ (when it
+ (list.partial left right tail)
+ (list.partial [left right] (pairs tail))
+
+ (list)
+ (list)
+
+ _
+ (.undefined)))
+
+ (generation <object>
+ [name phase archive state]
+ (list.partial head_key head_value tail)
+ (do [! try.monad]
+ [[state output] (monad.mix !
+ (.function (_ [key value] [state output])
+ (when key
+ (text_synthesis key)
+ (do try.monad
+ [[state value] (phase archive value state)]
+ (in [state (list.partial [key value] output)]))
+
+ _
+ (.undefined)))
+ [state (list)]
+ (pairs (list.partial head_key head_value tail)))]
+ (in [state (js.object (list.reversed output))])))
+
+ (def .public object
+ (syntax (_ [it (<>.some <code>.any)])
+ (in (list (` (.as (..Object .Any)
+ (<object> (,* it))))))))
+
+ (analysis <set>
+ [name phase archive state]
+ (all <>.and <code>.text <code>.any <code>.any)
+ [field value object]
+ (do try.monad
+ [[state value] (phase archive (` (.is .Any (, value))) state)
+ [state object] (phase archive (` (.is (..Object .Any) (, object))) state)]
+ (in [state (extension_analysis name (list (text_analysis field) value object))])))
+
+ (generation <set>
+ [name phase archive state]
+ (list (text_synthesis field) value object)
+ (do try.monad
+ [[state value] (phase archive value state)
+ [state object] (phase archive object state)]
+ (in [state (js.set (js.the field object) value)])))
+
+ (def .public set
+ (syntax (_ [field <code>.any
+ value <code>.any
+ object <code>.any])
+ (in (list (` (.as .Any (<set> (, field) (, value) (, object))))))))
+ )))
+
(with_expansions [<constant> (for @.js "js constant"
@.python "python constant"
@.lua "lua constant"
@@ -45,6 +204,9 @@
@.lua "lua object get"
@.ruby "ruby object get"
(these))
+ <set> (for @.lua "lua object set"
+ @.ruby "ruby object set"
+ (these))
<import> (for @.python "python import"
@.lua "lua import"
@.ruby "ruby import"
@@ -448,15 +610,27 @@
g!parameters (..parameters :parameters:)
g!class_variables (list#each code.local class_parameters)
g!class (` ((, (code.local (maybe.else class_name alias))) (,* g!class_variables)))
- :output: [#optional? false #mandatory g!class]]
+ :output: [#optional? false #mandatory g!class]
+ unquantified_type (` (.-> (,* (when :parameters:
+ (list)
+ (list (` .Any))
+
+ _
+ (list#each ..output_type :parameters:)))
+ (, (|> :output:
+ ..output_type
+ (..input_type input)))))
+ quantified_type (when (list#composite g!class_variables g!input_variables)
+ (list)
+ unquantified_type
+
+ _
+ (` (.All ((, g!it) (,* g!class_variables) (,* g!input_variables))
+ (, unquantified_type))))]
(` (.def ((, g!it) (,* (when g!parameters
{.#End} (list g!it)
_ (list#each (the #mandatory) g!parameters))))
- (.All ((, g!it) (,* g!class_variables) (,* g!input_variables))
- (.-> (,* (list#each ..output_type :parameters:))
- (, (|> :output:
- ..output_type
- (..input_type input)))))
+ (, quantified_type)
(.as_expected
(, (<| (..input_term input)
(..lux_optional :output:)
@@ -465,6 +639,11 @@
(, (..imported class_name))))))
[(,* (list#each ..host_optional g!parameters))]))))))))))
+ (def (optional_value type value)
+ (-> Optional Code Optional)
+ [#optional? (the #optional? type)
+ #mandatory value])
+
(def (static_field_definition import! [class_name class_parameters] alias namespace it)
(-> (List Code) Declaration Alias Namespace (Named Output) Code)
(let [field (the #name it)
@@ -472,18 +651,41 @@
(maybe.else field)
(..namespaced namespace class_name alias)
code.local)
- :field: (the #anonymous it)]
+ :field: (the #anonymous it)
+ get (` (.as (io.IO (, (..output_type :field:)))
+ (io.io (, (<| (lux_optional :field:)
+ (for @.js (` (<constant> (, (code.text (%.format (..host_path class_name) "." field)))))
+ @.ruby (` (<constant> (, (code.text (%.format (..host_path class_name) "::" field)))))
+ ... else
+ (` (<get> (, (code.text field))
+ (, (..imported class_name))))))))))
+ set (` (.as (io.IO .Any)
+ (io.io (, (for @.js (` (..set (, (code.text field))
+ (, (host_optional (optional_value :field: (` ((,' ,) (, g!it))))))
+ (.as (..Object .Any)
+ (<constant> (, (code.text (..host_path class_name)))))))
+ @.ruby (` (<set> (, (code.text field))
+ (, (host_optional (optional_value :field: (` ((,' ,) (, g!it))))))
+ (<constant> (, (code.text (..host_path class_name))))))
+ @.python (` (<apply> (<constant> "setattr")
+ [(, (..imported class_name))
+ (, (code.text field))
+ (, (host_optional (optional_value :field: (` ((,' ,) (, g!it))))))]))
+ ... else
+ (` (<set> (, (code.text field))
+ (, (host_optional (optional_value :field: (` ((,' ,) (, g!it))))))
+ (, (..imported class_name)))))))))]
(` (def (, g!it)
- (syntax ((, g!it) [])
+ (syntax ((, g!it) [(, g!it) (<>.maybe <code>.any)])
(.at meta.monad (,' in)
(.list (`' (.exec
(,* import!)
- (.as (, (..output_type :field:))
- (, (<| (lux_optional :field:)
- (for @.js (` (<constant> (, (code.text (%.format (..host_path class_name) "." field)))))
- @.ruby (` (<constant> (, (code.text (%.format (..host_path class_name) "::" field)))))
- (` (<get> (, (code.text field))
- (, (..imported class_name)))))))))))))))))
+ ((,' ,) (when (, g!it)
+ {.#None}
+ (`' (, get))
+
+ {.#Some (, g!it)}
+ (`' (, set)))))))))))))
(def (virtual_field_definition [class_name class_parameters] alias namespace it)
(-> Declaration Alias Namespace (Named Output) Code)
@@ -677,141 +879,6 @@
("js apply" ("js constant" "Object.prototype.toString.call"))
(as Text)
(text#= "[object process]")))
- (maybe.else false)))
-
- ... These extensions must be defined this way because importing any of the modules
- ... normally used when writing extensions would introduce a circular dependency
- ... because the Archive type depends on Binary, and that module depends on this ffi module.
- (def extension_name
- (syntax (_ [])
- (do meta.monad
- [module meta.current_module_name
- unique_id meta.seed]
- (in (list (code.text (%.format module " " (%.nat unique_id))))))))
-
- (with_expansions [<undefined> (..extension_name)
- <undefined?> (..extension_name)
- <object> (..extension_name)]
- (these (def extension_analysis
- (template (_ <name> <parameter>)
- [{5 #1 [<name> <parameter>]}]))
-
- (def text_analysis
- (template (_ <it>)
- [{0 #0 {5 #1 <it>}}]))
-
- (def analysis
- (template (_ <name> <bindings> <parser> <inputs> <body>)
- [("lux def analysis" <name>
- (.function (_ name phase archive inputs)
- (.function (_ state)
- (let [<bindings> [name phase archive state]]
- (when (<code>.result <parser> inputs)
- {try.#Failure error}
- {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
- text.\n error)}
-
- {try.#Success <inputs>}
- <body>)))))]))
-
- (def generation
- (template (_ <name> <bindings> <inputs> <body>)
- [("lux def generation" <name>
- (.function (_ name phase archive inputs)
- (.function (_ state)
- (let [<bindings> [name phase archive state]]
- (when inputs
- <inputs>
- <body>
-
- _
- {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))]))
-
- (analysis <undefined>
- [name phase archive state]
- <code>.end
- _
- {try.#Success [state (extension_analysis name (list))]})
-
- (generation <undefined>
- [name phase archive state]
- (list)
- {try.#Success [state js.undefined]})
-
- (def .public undefined
- (template (undefined)
- [(.is ..Undefined (<undefined>))]))
-
- (analysis <undefined?>
- [name phase archive state]
- <code>.any
- it
- (do try.monad
- [[state it] (phase archive (` (.is .Any (, it))) state)]
- (in [state (extension_analysis name (list it))])))
-
- (generation <undefined?>
- [name phase archive state]
- (list it)
- (do try.monad
- [[state it] (phase archive it state)]
- (in [state (js.= js.undefined it)])))
-
- (def .public undefined?
- (template (undefined? <it>)
- [(.as .Bit (.is .Any (<undefined?> <it>)))]))
-
- (analysis <object>
- [name phase archive state]
- (<>.some (<>.and <code>.text <code>.any))
- it
- (do [! try.monad]
- [[state output] (monad.mix ! (.function (_ [key value] [state output])
- (do !
- [[state value] (phase archive (` (.is .Any (, value))) state)]
- (in [state (list.partial value (text_analysis key) output)])))
- [state (list)]
- it)]
- (in [state (extension_analysis name (list.reversed output))])))
-
- (def text_synthesis
- (template (_ <it>)
- [{0 #0 {2 #1 <it>}}]))
-
- (def (pairs it)
- (All (_ a) (-> (List a) (List [a a])))
- (when it
- (list.partial left right tail)
- (list.partial [left right] (pairs tail))
-
- (list)
- (list)
-
- _
- (.undefined)))
-
- (generation <object>
- [name phase archive state]
- (list.partial head_key head_value tail)
- (do [! try.monad]
- [[state output] (monad.mix !
- (.function (_ [key value] [state output])
- (when key
- (text_synthesis key)
- (do try.monad
- [[state value] (phase archive value state)]
- (in [state (list.partial [key value] output)]))
-
- _
- (.undefined)))
- [state (list)]
- (pairs (list.partial head_key head_value tail)))]
- (in [state (js.object (list.reversed output))])))
-
- (def .public object
- (syntax (_ [it (<>.some <code>.any)])
- (in (list (` (.as (..Object .Any)
- (<object> (,* it))))))))
- )))
+ (maybe.else false))))
(these))
)
diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux
index 3f8561b78..2f9e4e99d 100644
--- a/stdlib/source/library/lux/ffi/export.js.lux
+++ b/stdlib/source/library/lux/ffi/export.js.lux
@@ -76,7 +76,7 @@
$exports (/.the "exports" $module)
definition (/.define (/.var name) term)
export (/.when (/.not (/.= (/.string "undefined") (/.type_of $module)))
- (/.set (/.the name $exports) (/.var name)))
+ (/.statement (/.set (/.the name $exports) (/.var name))))
code (all /.then
definition
export)]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux
index 73a240682..8848c781d 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/generation/js/runtime.lux
@@ -722,18 +722,19 @@
(io//log message)
(let [console (_.var "console")
print (_.var "print")
- end! (_.return ..unit)]
- (<| (_.if (|> console _.type_of (_.= (_.string "undefined")) _.not
- (_.and (_.the "log" console)))
+ end! (_.return ..unit)
+
+ has_console? (|> console _.type_of (_.= (_.string "undefined")) _.not)
+ node_or_browser? (|> has_console?
+ (_.and (_.the "log" console)))
+ nashorn? (|> print _.type_of (_.= (_.string "undefined")) _.not)]
+ (<| (_.if node_or_browser?
(all _.then
(_.statement (|> console (_.do "log" (list message))))
end!))
- (_.if (|> print _.type_of (_.= (_.string "undefined")) _.not)
+ (_.if nashorn?
(all _.then
- (_.statement (_.apply_1 print (_.? (_.= (_.string "string")
- (_.type_of message))
- message
- (_.apply_1 (_.var "JSON.stringify") message))))
+ (_.statement (_.apply_1 print message))
end!))
end!)))
diff --git a/stdlib/source/library/lux/meta/compiler/meta.lux b/stdlib/source/library/lux/meta/compiler/meta.lux
index 00e782b29..259d09b6e 100644
--- a/stdlib/source/library/lux/meta/compiler/meta.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta.lux
@@ -6,4 +6,4 @@
(def .public version
Version
- 00,02,00)
+ 00,03,00)
diff --git a/stdlib/source/library/lux/meta/target/js.lux b/stdlib/source/library/lux/meta/target/js.lux
index 37792d6bc..0a56ad62a 100644
--- a/stdlib/source/library/lux/meta/target/js.lux
+++ b/stdlib/source/library/lux/meta/target/js.lux
@@ -312,8 +312,8 @@
(abstraction (format "var " (representation name) " = " (representation value) ..statement_suffix)))
(def .public (set name value)
- (-> Location Expression Statement)
- (abstraction (format (representation name) " = " (representation value) ..statement_suffix)))
+ (-> Location Expression Expression)
+ (abstraction (format (representation name) " = " (representation value))))
(def .public (throw message)
(-> Expression Statement)
diff --git a/stdlib/source/library/lux/meta/type/resource.lux b/stdlib/source/library/lux/meta/type/resource.lux
index 904ee3129..acf620981 100644
--- a/stdlib/source/library/lux/meta/type/resource.lux
+++ b/stdlib/source/library/lux/meta/type/resource.lux
@@ -3,7 +3,7 @@
[lux (.except)
[abstract
["[0]" monad (.only Monad do)
- [indexed (.only IxMonad)]]]
+ ["[0]" indexed]]]
[control
["<>" parser]
["[0]" maybe]
@@ -26,23 +26,23 @@
[//
[primitive (.except)]])
-(type .public (Procedure monad input output value)
- (-> input (monad [output value])))
+(type .public (Procedure ! input output value)
+ (-> input (! [output value])))
-(type .public (Linear monad value)
+(type .public (Linear ! value)
(All (_ keys)
- (Procedure monad keys keys value)))
+ (Procedure ! keys keys value)))
-(type .public (Affine monad permissions value)
+(type .public (Affine ! permissions value)
(All (_ keys)
- (Procedure monad keys [permissions keys] value)))
+ (Procedure ! keys [permissions keys] value)))
-(type .public (Relevant monad permissions value)
+(type .public (Relevant ! permissions value)
(All (_ keys)
- (Procedure monad [permissions keys] keys value)))
+ (Procedure ! [permissions keys] keys value)))
(def .public (monad monad)
- (All (_ !) (-> (Monad !) (IxMonad (Procedure !))))
+ (All (_ !) (-> (Monad !) (indexed.Monad (Procedure !))))
(implementation
(def (in value)
(function (_ keys)
diff --git a/stdlib/source/library/lux/meta/version.lux b/stdlib/source/library/lux/meta/version.lux
index b25439e57..e9b83c9bd 100644
--- a/stdlib/source/library/lux/meta/version.lux
+++ b/stdlib/source/library/lux/meta/version.lux
@@ -20,7 +20,7 @@
(def .public latest
Version
- 00,07,00)
+ 00,08,00)
(def .public current
(syntax (_ [])
diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux
index 440063bca..ac83dcc9f 100644
--- a/stdlib/source/library/lux/world/console.lux
+++ b/stdlib/source/library/lux/world/console.lux
@@ -121,7 +121,7 @@
(def !read
(template (_ <type> <query>)
- [(let [it (process::stdin)]
+ [(let [it (io.run! (process::stdin))]
(when (Readable_Stream::read it)
{.#Some buffer}
(let [input (Buffer::toString buffer)]
@@ -158,7 +158,7 @@
(async.async []))]
(exec
(Writable_Stream::write it (ffi.function (_ []) Any (io.run! (write! {try.#Success []})))
- (process::stdout))
+ (io.run! (process::stdout)))
read!)))
(def close
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index 11adc36a7..16e205fe7 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -323,8 +323,6 @@
(ffi.import FsConstants
"[1]::[0]"
(F_OK ffi.Number)
- (R_OK ffi.Number)
- (W_OK ffi.Number)
(X_OK ffi.Number))
(ffi.import Error
@@ -527,9 +525,6 @@
(ffi.import os
"[1]::[0]"
- ("static" F_OK ffi.Integer)
- ("static" R_OK ffi.Integer)
- ("static" W_OK ffi.Integer)
("static" X_OK ffi.Integer)
("static" mkdir [ffi.String] "io" "try" "?" Any)
@@ -549,7 +544,7 @@
("static" getmtime [ffi.String] "io" "try" ffi.Float))
(def python_separator
- (os/path::sep))
+ (io.run! (os/path::sep)))
(`` (def .public default
(System IO)
@@ -598,7 +593,9 @@
instant.absolute))))
(def (can_execute? path)
- (os::access path (os::X_OK)))
+ (do io.monad
+ [permission (os::X_OK)]
+ (os::access path permission)))
(def (read path)
(do (try.with io.monad)
diff --git a/stdlib/source/test/lux/abstract.lux b/stdlib/source/test/lux/abstract.lux
index 5a3d4363a..e05272386 100644
--- a/stdlib/source/test/lux/abstract.lux
+++ b/stdlib/source/test/lux/abstract.lux
@@ -15,8 +15,7 @@
["[1][0]" functor (.only)
["[1]/[0]" contravariant]]
["[1][0]" interval]
- ["[1][0]" monad (.only)
- ["[1]/[0]" free]]
+ ["[1][0]" monad]
["[1][0]" monoid]
["[1][0]" order]])
@@ -27,13 +26,6 @@
/functor/contravariant.test
))
-(def monad
- Test
- (all _.and
- /monad.test
- /monad/free.test
- ))
-
(def comonad
Test
(all _.and
@@ -54,6 +46,6 @@
/monoid.test
/order.test
..functor
- ..monad
+ /monad.test
..comonad
))
diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux
index 67f039fd6..f0ff7096c 100644
--- a/stdlib/source/test/lux/abstract/monad.lux
+++ b/stdlib/source/test/lux/abstract/monad.lux
@@ -12,7 +12,10 @@
[test
["_" property (.only Test)]]]]
[\\library
- ["[0]" / (.only Monad do)]])
+ ["[0]" / (.only Monad do)]]
+ ["[0]" /
+ ["[1][0]" free]
+ ["[1][0]" indexed]])
(def .public test
Test
@@ -62,4 +65,7 @@
(n.+ part whole)))
0)
(is (Identity Nat)))))
+
+ /free.test
+ /indexed.test
))))
diff --git a/stdlib/source/test/lux/abstract/monad/indexed.lux b/stdlib/source/test/lux/abstract/monad/indexed.lux
new file mode 100644
index 000000000..62b09daa4
--- /dev/null
+++ b/stdlib/source/test/lux/abstract/monad/indexed.lux
@@ -0,0 +1,47 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ ["[0]" monad (.only do)]]
+ [math
+ ["[0]" random]
+ [number
+ ["n" nat]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(type (Effect input output value)
+ (-> input [output value]))
+
+(def monad
+ (/.Monad Effect)
+ (implementation
+ (def (in it)
+ (function (_ input)
+ [input it]))
+
+ (def (then $ @)
+ (function (_ pre)
+ (let [[interim input] (@ pre)]
+ (($ input) interim))))))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Monad])
+ (do random.monad
+ [left random.nat
+ right random.nat
+ .let [expected (n.+ left right)]])
+ (all _.and
+ (_.coverage [/.do]
+ (let [it (is (Effect [] [] Nat)
+ (/.do ..monad
+ [left' (in left)
+ right' (in right)]
+ (in (n.+ left right))))
+ [_ actual] (it [])]
+ (n.= expected actual)))
+ )))
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index 1612f17b4..a41f52a8d 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -1,11 +1,15 @@
(.require
[library
[lux (.except)
+ ["[0]" ffi]
[abstract
[monad (.only do)]]
[control
["[0]" try (.use "[1]#[0]" functor)]
- ["[0]" exception]]
+ ["[0]" exception]
+ ["[0]" io]
+ [concurrency
+ ["[0]" atom]]]
[data
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format (.only format)]]
@@ -231,11 +235,71 @@
(type My_Text
Text)
+(for @.jvm (these (ffi.import java/lang/String
+ "[1]::[0]")
+
+ (ffi.import java/io/ByteArrayOutputStream
+ "[1]::[0]"
+ (new [])
+ (toString [] java/lang/String))
+
+ (ffi.import java/io/OutputStream
+ "[1]::[0]")
+
+ (ffi.import java/io/PrintStream
+ "[1]::[0]"
+ (new [java/io/OutputStream]))
+
+ (ffi.import java/lang/System
+ "[1]::[0]"
+ ("static" out java/io/PrintStream)
+ ("static" setOut [java/io/PrintStream] void))
+
+ (def system_output
+ java/io/PrintStream
+ (io.run! (java/lang/System::out))))
+ @.js (these (ffi.import console
+ "[1]::[0]"
+ ("static" log (-> Text Any))))
+ @.python (these (ffi.import io/StringIO
+ "[1]::[0]"
+ (new [])
+ (getvalue [] Text))
+
+ (ffi.import sys
+ "[1]::[0]"
+ ("static" stdout io/StringIO))))
+
+(def with_out
+ (template (_ <body>)
+ [(for @.jvm (ffi.synchronized ..system_output
+ (let [buffer (java/io/ByteArrayOutputStream::new)
+ _ (java/lang/System::setOut (java/io/PrintStream::new buffer))
+ output <body>
+ _ (java/lang/System::setOut ..system_output)]
+ [(ffi.of_string (java/io/ByteArrayOutputStream::toString buffer))
+ output]))
+ @.js (let [old (io.run! (console::log))
+ buffer (atom.atom "")
+ _ (io.run! (console::log (function (_ it)
+ (io.run! (atom.write! (format it text.\n) buffer)))))
+ output <body>
+ _ (io.run! (console::log old))]
+ [(io.run! (atom.read! buffer))
+ output])
+ @.python (let [old (io.run! (sys::stdout))
+ buffer (io/StringIO::new [])
+ _ (io.run! (sys::stdout buffer))
+ output <body>
+ _ (io.run! (sys::stdout old))]
+ [(io/StringIO::getvalue buffer)
+ output]))]))
+
(def .public test
Test
(<| (_.covering /._)
(do random.monad
- [message (random.lower_case 5)]
+ [expected_message (random.lower_case 5)]
(all _.and
..inspection
..representation
@@ -264,8 +328,7 @@
/.inspection)
true))
(_.coverage [/.log!]
- (exec
- (/.log! (format (%.symbol (symbol /.log!))
- " works: " (%.text message)))
- true))
+ (let [[actual_message _] (with_out (/.log! expected_message))]
+ (text#= (format expected_message text.\n)
+ actual_message)))
))))
diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux
index a61678e06..5e005f9ff 100644
--- a/stdlib/source/test/lux/ffi.py.lux
+++ b/stdlib/source/test/lux/ffi.py.lux
@@ -3,6 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]]
+ [control
+ ["[0]" io]]
[math
["[0]" random]
[number
@@ -61,8 +63,10 @@
(is (Ex (_ a) (/.Object a))))
true))
(_.coverage [/.import]
- (and (i.= (os::R_OK) (os::R_OK))
- (not (i.= (os::W_OK) (os::R_OK)))))
+ (and (i.= (io.run! (os::R_OK))
+ (io.run! (os::R_OK)))
+ (not (i.= (io.run! (os::W_OK))
+ (io.run! (os::R_OK))))))
$/export.test
)))))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux
index 9aa2277d3..1a04f77e1 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/coverage.lux
@@ -105,7 +105,7 @@
right? random.bit
.let [lefts (//complex.lefts right? tag)]
[sub_coverage sub_pattern] again]
- (in [{/.#Variant (if right? {.#Some tag} {.#None})
+ (in [{/.#Variant (if right? {.#Some (++ tag)} {.#None})
(dictionary.of_list n.hash (list [tag sub_coverage]))}
{//pattern.#Complex
{//complex.#Variant
diff --git a/stdlib/source/test/lux/meta/target/js.lux b/stdlib/source/test/lux/meta/target/js.lux
index 9867d5085..eda7a2f72 100644
--- a/stdlib/source/test/lux/meta/target/js.lux
+++ b/stdlib/source/test/lux/meta/target/js.lux
@@ -348,7 +348,7 @@
(/.apply (/.closure (list $foreign)
(all /.then
(/.declare $local)
- (/.set $local (/.number number/1))
+ (/.statement (/.set $local (/.number number/1)))
(/.return $local)))
(list (/.number number/0)))))
)))
@@ -365,30 +365,30 @@
(and (expression (|>> (as Frac) (f.= (f.+ number/0 number/0)))
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.+ $foreign $foreign))
+ (/.statement (/.set $foreign (/.+ $foreign $foreign)))
(/.return $foreign)))
(list (/.number number/0))))
(expression (|>> (as Frac) (f.= (f.+ number/0 number/0)))
(let [@ (/.at (/.int +0) $foreign)]
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.array (list $foreign)))
- (/.set @ (/.+ @ @))
+ (/.statement (/.set $foreign (/.array (list $foreign))))
+ (/.statement (/.set @ (/.+ @ @)))
(/.return @)))
(list (/.number number/0)))))
(expression (|>> (as Frac) (f.= (f.+ number/0 number/0)))
(let [@ (/.the field $foreign)]
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.object (list [field $foreign])))
- (/.set @ (/.+ @ @))
+ (/.statement (/.set $foreign (/.object (list [field $foreign]))))
+ (/.statement (/.set @ (/.+ @ @)))
(/.return @)))
(list (/.number number/0)))))))
(_.coverage [/.delete]
(and (and (expression (|>> (as Bit))
(/.apply (/.closure (list)
(all /.then
- (/.set $foreign (/.number number/0))
+ (/.statement (/.set $foreign (/.number number/0)))
(/.return (/.delete $foreign))))
(list)))
(expression (|>> (as Bit) not)
@@ -399,7 +399,7 @@
(let [@ (/.at (/.int +0) $foreign)]
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.array (list $foreign)))
+ (/.statement (/.set $foreign (/.array (list $foreign))))
(/.return (|> (/.= (/.boolean true) (/.delete @))
(/.and (/.= /.undefined @))))))
(list (/.number number/0)))))
@@ -407,7 +407,7 @@
(let [@ (/.the field $foreign)]
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.object (list [field $foreign])))
+ (/.statement (/.set $foreign (/.object (list [field $foreign]))))
(/.return (|> (/.= (/.boolean true) (/.delete @))
(/.and (/.= /.undefined @))))))
(list (/.number number/0)))))
@@ -424,7 +424,7 @@
(let [@ (/.at (/.int +0) $foreign)]
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.array (list $foreign)))
+ (/.statement (/.set $foreign (/.array (list $foreign))))
(/.statement (<js> @))
(/.return @)))
(list (/.int int/0)))))
@@ -432,7 +432,7 @@
(let [@ (/.the field $foreign)]
(/.apply (/.closure (list $foreign)
(all /.then
- (/.set $foreign (/.object (list [field $foreign])))
+ (/.statement (/.set $foreign (/.object (list [field $foreign]))))
(/.statement (<js> @))
(/.return @)))
(list (/.int int/0)))))]
@@ -472,8 +472,8 @@
(all /.then
(/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index)
/.break)
- (/.set $output (/.+ $input $output))
- (/.set $inner_index (/.+ (/.int +1) $inner_index))
+ (/.statement (/.set $output (/.+ $input $output)))
+ (/.statement (/.set $inner_index (/.+ (/.int +1) $inner_index)))
))
(/.return $output)))
(list (/.int input))))))
@@ -486,10 +486,10 @@
(/.define $output (/.int +0))
(/.while (/.< (/.int (.int full_inner_iterations)) $inner_index)
(all /.then
- (/.set $inner_index (/.+ (/.int +1) $inner_index))
+ (/.statement (/.set $inner_index (/.+ (/.int +1) $inner_index)))
(/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index)
/.continue)
- (/.set $output (/.+ $input $output))
+ (/.statement (/.set $output (/.+ $input $output)))
))
(/.return $output)))
(list (/.int input))))))
@@ -514,10 +514,10 @@
(/.break_at @outer))
(/.when (/.= (/.int (.int expected_inner_iterations)) $inner_index)
/.break)
- (/.set $output (/.+ $input $output))
- (/.set $inner_index (/.+ (/.int +1) $inner_index))
+ (/.statement (/.set $output (/.+ $input $output)))
+ (/.statement (/.set $inner_index (/.+ (/.int +1) $inner_index)))
))
- (/.set $outer_index (/.+ (/.int +1) $outer_index))
+ (/.statement (/.set $outer_index (/.+ (/.int +1) $outer_index)))
)))
(/.return $output)))
(list (/.int input))))))
@@ -533,16 +533,16 @@
(/.with_label @outer
(/.while (/.< (/.int (.int full_outer_iterations)) $outer_index)
(all /.then
- (/.set $outer_index (/.+ (/.int +1) $outer_index))
+ (/.statement (/.set $outer_index (/.+ (/.int +1) $outer_index)))
(/.define $inner_index (/.int +0))
(/.while (/.< (/.int (.int full_inner_iterations)) $inner_index)
(all /.then
- (/.set $inner_index (/.+ (/.int +1) $inner_index))
+ (/.statement (/.set $inner_index (/.+ (/.int +1) $inner_index)))
(/.when (/.<= (/.int (.int expected_outer_iterations)) $outer_index)
(/.continue_at @outer))
(/.when (/.<= (/.int (.int expected_inner_iterations)) $inner_index)
/.continue)
- (/.set $output (/.+ $input $output))
+ (/.statement (/.set $output (/.+ $input $output)))
))
)
))
@@ -570,8 +570,8 @@
(/.define $output (/.int +0))
(/.while (/.< (/.int (.int iterations)) $index)
(all /.then
- (/.set $output (/.+ $input $output))
- (/.set $index (/.+ (/.int +1) $index))
+ (/.statement (/.set $output (/.+ $input $output)))
+ (/.statement (/.set $index (/.+ (/.int +1) $index)))
))
(/.return $output)))
(list (/.int input)))))
@@ -583,8 +583,8 @@
(/.define $output (/.int +0))
(/.do_while (/.< (/.int (.int iterations)) $index)
(all /.then
- (/.set $output (/.+ $input $output))
- (/.set $index (/.+ (/.int +1) $index))
+ (/.statement (/.set $output (/.+ $input $output)))
+ (/.statement (/.set $index (/.+ (/.int +1) $index)))
))
(/.return $output)))
(list (/.int input)))))
@@ -596,7 +596,7 @@
(/.for $index (/.int +0)
(/.< (/.int (.int iterations)) $index)
(/.++ $index)
- (/.set $output (/.+ $input $output)))
+ (/.statement (/.set $output (/.+ $input $output))))
(/.return $output)))
(list (/.int input)))))
(_.for [/.Label]
@@ -697,7 +697,7 @@
(/.apply_1 (/.closure (list $arg/0)
(all /.then
(/.function_definition $class (list)
- (/.set (/.the field $this) $arg/0))
+ (/.statement (/.set (/.the field $this) $arg/0)))
(/.return (/.the field (/.new $class (list))))))
(/.number number/0)))))
..test|apply
@@ -808,14 +808,14 @@
(all /.then
/.use_strict
(/.declare $arg/0)
- (/.set $arg/0 (/.number number/0))
+ (/.statement (/.set $arg/0 (/.number number/0)))
(/.return $arg/0)))
(list)))
(|> (/.apply (/.closure (list)
(all /.then
/.use_strict
... (/.declare $arg/0)
- (/.set $arg/0 (/.number number/0))
+ (/.statement (/.set $arg/0 (/.number number/0)))
(/.return $arg/0)))
(list))
..eval