@fraczak/k 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/Examples/arithmetics.k +86 -63
- package/Value.mjs +8 -2
- package/backends/wasm/TECHNICAL-DEBT.md +11 -13
- package/backends/wasm/runtime.wat +375 -2
- package/backends/wasm/src/kvm2wasm.mjs +36 -0
- package/backends/wasm/src/wasm.mjs +48 -4
- package/backends/wasm/tests/test-wasm.mjs +8 -0
- package/browser/vfs-data.mjs +3 -3
- package/codecs/runtime/show-value.mjs +10 -1
- package/package.json +1 -1
|
@@ -50,7 +50,16 @@ function propertyListToFilter(propertyList, varPrefix = "X") {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function valueToK(v) {
|
|
53
|
-
if (isVariant(v))
|
|
53
|
+
if (isVariant(v)) {
|
|
54
|
+
const tags = [];
|
|
55
|
+
let curr = v;
|
|
56
|
+
while (isVariant(curr)) {
|
|
57
|
+
tags.push(pLabel(curr.tag).trimStart());
|
|
58
|
+
curr = curr.value;
|
|
59
|
+
}
|
|
60
|
+
const base = valueToK(curr);
|
|
61
|
+
return tags.length === 0 ? base : `${base}|${tags.reverse().join("|")}`;
|
|
62
|
+
}
|
|
54
63
|
if (isProduct(v)) {
|
|
55
64
|
const keys = Object.keys(v.product);
|
|
56
65
|
if (keys.length === 0) return "{}";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fraczak/k",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "k — a language for composing first-order partial functions over algebraic data types (products and tagged unions); includes runtime, type derivation, REPL, and codec toolchain",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"exports": {
|