functionalscript 0.35.2 → 0.37.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/fs/asn.1/module.f.js +1 -1
- package/fs/asserts/proof.f.js +1 -1
- package/fs/base_n/module.f.js +3 -3
- package/fs/base_n/proof.f.js +3 -3
- package/fs/{base128 → basen/base128}/module.f.d.ts +1 -1
- package/fs/{base128 → basen/base128}/module.f.js +1 -1
- package/fs/{base128 → basen/base128}/proof.f.js +3 -3
- package/fs/{base64 → basen/base64}/module.f.d.ts +2 -2
- package/fs/basen/base64/module.f.js +71 -0
- package/fs/{base64 → basen/base64}/proof.f.d.ts +2 -0
- package/fs/{base64 → basen/base64}/proof.f.js +17 -2
- package/fs/{cbase32 → basen/cbase32}/module.f.d.ts +2 -2
- package/fs/{cbase32 → basen/cbase32}/module.f.js +2 -2
- package/fs/{cbase32 → basen/cbase32}/proof.f.js +1 -1
- package/fs/bnf/data/module.f.js +4 -4
- package/fs/bnf/data/proof.f.js +6 -6
- package/fs/bnf/descent/module.f.js +6 -6
- package/fs/bnf/descent/proof.f.js +6 -6
- package/fs/bnf/ll1/module.f.js +9 -9
- package/fs/bnf/ll1/proof.f.js +6 -6
- package/fs/bnf/module.f.js +4 -4
- package/fs/bnf/proof.f.js +2 -2
- package/fs/bnf/testlib.f.js +1 -1
- package/fs/cas/cli/module.f.js +7 -7
- package/fs/cas/cli/proof.f.js +8 -8
- package/fs/cas/mcp/module.f.d.ts +8 -4
- package/fs/cas/mcp/module.f.js +124 -72
- package/fs/cas/mcp/proof.f.d.ts +3 -8
- package/fs/cas/mcp/proof.f.js +122 -186
- package/fs/cas/module.f.js +12 -19
- package/fs/cas/proof.f.d.ts +4 -2
- package/fs/cas/proof.f.js +10 -10
- package/fs/ci/bun/module.f.js +2 -2
- package/fs/ci/common/module.f.d.ts +2 -2
- package/fs/ci/common/module.f.js +4 -4
- package/fs/ci/config/module.f.d.ts +20 -21
- package/fs/ci/config/module.f.js +8 -10
- package/fs/ci/deno/module.f.js +8 -4
- package/fs/ci/module.f.js +9 -9
- package/fs/ci/node/module.f.d.ts +1 -1
- package/fs/ci/node/module.f.js +3 -5
- package/fs/ci/playwright/module.f.js +3 -3
- package/fs/ci/proof.f.js +14 -14
- package/fs/ci/rust/module.f.js +2 -2
- package/fs/cli/module.f.js +3 -3
- package/fs/cli/proof.f.js +3 -3
- package/fs/{types → common}/monoid/module.f.d.ts +1 -1
- package/fs/crypto/hmac/module.f.js +2 -2
- package/fs/crypto/hmac/proof.f.js +5 -5
- package/fs/crypto/pow/module.f.js +3 -3
- package/fs/crypto/pow/proof.f.js +4 -4
- package/fs/crypto/secp/module.f.js +2 -2
- package/fs/crypto/secp/proof.f.js +3 -3
- package/fs/crypto/sha2/module.f.js +2 -2
- package/fs/crypto/sha2/proof.f.js +6 -6
- package/fs/crypto/sign/module.f.js +4 -4
- package/fs/crypto/vdf/module.f.js +1 -1
- package/fs/crypto/vdf/proof.f.js +1 -1
- package/fs/dev/module.f.js +6 -6
- package/fs/dev/package_json/module.f.js +6 -6
- package/fs/dev/package_json/proof.f.js +3 -3
- package/fs/dev/proof.f.js +2 -2
- package/fs/djs/ast/module.f.js +2 -2
- package/fs/djs/ast/proof.f.js +4 -4
- package/fs/djs/examples/m.f.d.ts +1 -1
- package/fs/djs/module.f.d.ts +1 -1
- package/fs/djs/module.f.js +5 -5
- package/fs/djs/parser/module.f.js +4 -4
- package/fs/djs/parser/proof.f.js +19 -7
- package/fs/djs/proof.f.js +3 -3
- package/fs/djs/serializer/module.f.js +6 -6
- package/fs/djs/serializer/proof.f.js +4 -4
- package/fs/djs/tokenizer/module.f.js +3 -3
- package/fs/djs/tokenizer/proof.f.js +5 -5
- package/fs/djs/tokenizer-new/proof.f.js +6 -6
- package/fs/djs/transpiler/module.f.d.ts +5 -0
- package/fs/djs/transpiler/module.f.js +21 -11
- package/fs/djs/transpiler/proof.f.js +5 -5
- package/fs/effects/memory/module.f.js +4 -4
- package/fs/effects/memory/proof.f.js +3 -3
- package/fs/effects/module.f.d.ts +15 -0
- package/fs/effects/module.f.js +15 -1
- package/fs/effects/node/memory/module.js +2 -2
- package/fs/effects/node/memory/proof.js +3 -3
- package/fs/effects/node/module.f.js +10 -20
- package/fs/effects/node/module.js +13 -11
- package/fs/effects/node/proof.f.d.ts +3 -0
- package/fs/effects/node/proof.f.js +19 -1
- package/fs/effects/node/virtual/module.f.js +7 -8
- package/fs/effects/node/virtual/proof.f.d.ts +1 -0
- package/fs/effects/node/virtual/proof.f.js +11 -4
- package/fs/effects/proof.f.d.ts +5 -0
- package/fs/effects/proof.f.js +22 -1
- package/fs/emergent_testing/all.test.js +2 -2
- package/fs/emergent_testing/example.f.d.ts +1 -1
- package/fs/emergent_testing/module.f.js +6 -6
- package/fs/emergent_testing/proof.f.d.ts +19 -17
- package/fs/emergent_testing/proof.f.js +7 -7
- package/fs/emergent_testing/scenarios/all.js +1 -1
- package/fs/fsc/bnf.f.js +2 -2
- package/fs/fsc/json.f.js +1 -1
- package/fs/fsc/module.f.d.ts +1 -0
- package/fs/fsc/module.f.js +11 -7
- package/fs/fsc/proof.f.js +4 -4
- package/fs/fsm/module.f.js +9 -9
- package/fs/fsm/proof.f.js +7 -7
- package/fs/js/tokenizer/module.f.d.ts +1 -1
- package/fs/js/tokenizer/module.f.js +14 -8
- package/fs/js/tokenizer/proof.f.js +64 -5
- package/fs/mcp/module.f.d.ts +13 -13
- package/fs/mcp/module.f.js +8 -8
- package/fs/mcp/proof.f.js +5 -5
- package/fs/mcp/stdio/module.f.d.ts +2 -2
- package/fs/mcp/stdio/module.f.js +10 -10
- package/fs/mcp/stdio/proof.f.js +10 -10
- package/fs/{html → media/html}/module.f.d.ts +3 -3
- package/fs/{html → media/html}/module.f.js +9 -9
- package/fs/media/json/module.f.d.ts +50 -0
- package/fs/{json → media/json}/module.f.js +7 -7
- package/fs/{json → media/json}/parser/module.f.d.ts +2 -2
- package/fs/{json → media/json}/parser/module.f.js +7 -7
- package/fs/{json → media/json}/parser/proof.f.js +24 -6
- package/fs/{json → media/json}/proof.f.js +4 -4
- package/fs/media/json/rpc/module.f.d.ts +114 -0
- package/fs/{json → media/json}/rpc/module.f.js +3 -3
- package/fs/{json → media/json}/rpc/proof.f.js +4 -4
- package/fs/media/json/schema/module.f.d.ts +78 -0
- package/fs/{json → media/json}/schema/module.f.js +2 -2
- package/fs/{json → media/json}/schema/proof.f.js +3 -3
- package/fs/{json → media/json}/serializer/module.f.d.ts +1 -1
- package/fs/{json → media/json}/serializer/module.f.js +2 -2
- package/fs/{json → media/json}/serializer/proof.f.js +2 -2
- package/fs/{json → media/json}/tokenizer/module.f.d.ts +2 -2
- package/fs/{json → media/json}/tokenizer/module.f.js +4 -4
- package/fs/{json → media/json}/tokenizer/proof.f.js +5 -5
- package/fs/media/module.f.d.ts +37 -0
- package/fs/media/module.f.js +24 -0
- package/fs/media/proof.f.d.ts +9 -0
- package/fs/media/proof.f.js +57 -0
- package/fs/media/revision/module.f.d.ts +51 -0
- package/fs/media/revision/module.f.js +110 -0
- package/fs/media/revision/proof.f.d.ts +29 -0
- package/fs/media/revision/proof.f.js +119 -0
- package/fs/{mime → media/type}/module.f.d.ts +6 -6
- package/fs/{mime → media/type}/module.f.js +6 -6
- package/fs/{mime → media/type}/proof.f.js +6 -6
- package/fs/module.f.d.ts +2 -0
- package/fs/{fjs/module.f.js → module.f.js} +8 -8
- package/fs/module.js +4 -0
- package/fs/path/module.f.d.ts +6 -0
- package/fs/path/module.f.js +8 -2
- package/fs/path/proof.f.d.ts +1 -0
- package/fs/path/proof.f.js +40 -2
- package/fs/{fjs/proof.f.d.ts → proof.f.d.ts} +1 -0
- package/fs/{fjs/proof.f.js → proof.f.js} +10 -4
- package/fs/sul/id/module.f.js +9 -9
- package/fs/sul/id/proof.f.js +5 -5
- package/fs/sul/level/hash/module.f.js +3 -3
- package/fs/sul/level/hash/proof.f.js +3 -3
- package/fs/sul/level/literal/module.f.js +5 -5
- package/fs/sul/level/literal/proof.f.js +3 -3
- package/fs/sul/module.f.js +3 -3
- package/fs/sul/proof.f.js +3 -3
- package/fs/text/ascii/proof.f.js +3 -3
- package/fs/text/code_point/module.f.js +2 -2
- package/fs/text/code_point/proof.f.js +1 -1
- package/fs/text/module.f.js +5 -5
- package/fs/text/proof.f.js +4 -4
- package/fs/text/sgr/module.f.js +2 -2
- package/fs/text/sgr/proof.f.js +2 -2
- package/fs/text/utf16/module.f.js +5 -5
- package/fs/text/utf16/proof.f.js +4 -4
- package/fs/text/utf8/module.f.d.ts +6 -0
- package/fs/text/utf8/module.f.js +37 -19
- package/fs/text/utf8/proof.f.js +58 -5
- package/fs/types/array/module.f.js +1 -1
- package/fs/types/array/proof.f.js +3 -3
- package/fs/types/bigfloat/module.f.js +1 -1
- package/fs/types/bigfloat/proof.f.js +1 -1
- package/fs/types/bigint/module.f.js +2 -2
- package/fs/types/bigint/proof.f.js +3 -3
- package/fs/types/bit_vec/module.f.js +8 -8
- package/fs/types/bit_vec/proof.f.js +5 -5
- package/fs/types/btree/find/module.f.js +1 -1
- package/fs/types/btree/find/proof.f.d.ts +3 -1
- package/fs/types/btree/find/proof.f.js +7 -7
- package/fs/types/btree/module.f.js +2 -2
- package/fs/types/btree/proof.f.d.ts +11 -5
- package/fs/types/btree/proof.f.js +7 -7
- package/fs/types/btree/remove/module.f.js +4 -4
- package/fs/types/btree/remove/proof.f.d.ts +5 -2
- package/fs/types/btree/remove/proof.f.js +5 -5
- package/fs/types/btree/set/module.f.js +3 -3
- package/fs/types/btree/set/proof.f.js +4 -4
- package/fs/types/byte_set/module.f.js +2 -2
- package/fs/types/byte_set/proof.f.js +4 -4
- package/fs/types/function/compare/proof.f.js +1 -1
- package/fs/types/function/operator/proof.f.d.ts +21 -10
- package/fs/types/function/operator/proof.f.js +1 -1
- package/fs/types/function/proof.f.js +1 -1
- package/fs/types/list/module.f.js +2 -2
- package/fs/types/list/proof.f.d.ts +15 -7
- package/fs/types/list/proof.f.js +4 -4
- package/fs/types/map/proof.f.js +2 -2
- package/fs/types/nibble_set/proof.f.js +2 -2
- package/fs/types/nullable/module.f.js +2 -2
- package/fs/types/nullable/proof.f.js +1 -1
- package/fs/types/number/module.f.js +5 -5
- package/fs/types/number/proof.f.js +1 -1
- package/fs/types/object/module.f.js +4 -4
- package/fs/types/object/proof.f.js +1 -1
- package/fs/types/ordered_map/module.f.js +6 -6
- package/fs/types/ordered_map/proof.f.js +3 -3
- package/fs/types/patricia_trie/proof.f.d.ts +11 -5
- package/fs/types/patricia_trie/proof.f.js +2 -2
- package/fs/types/prime_field/module.f.js +2 -2
- package/fs/types/prime_field/proof.f.js +2 -2
- package/fs/types/range/proof.f.js +1 -1
- package/fs/types/range_map/module.f.js +4 -4
- package/fs/types/range_map/proof.f.js +7 -7
- package/fs/types/result/module.f.d.ts +4 -0
- package/fs/types/result/module.f.js +4 -0
- package/fs/types/result/module.js +1 -1
- package/fs/types/result/proof.f.d.ts +9 -3
- package/fs/types/result/proof.f.js +12 -2
- package/fs/types/rtti/common/module.f.js +4 -4
- package/fs/types/rtti/module.f.d.ts +2 -2
- package/fs/types/rtti/module.f.js +1 -1
- package/fs/types/rtti/parse/module.f.js +5 -5
- package/fs/types/rtti/parse/proof.f.js +2 -2
- package/fs/types/rtti/ts/module.f.js +1 -1
- package/fs/types/rtti/ts/proof.f.js +2 -2
- package/fs/types/rtti/validate/module.f.js +4 -4
- package/fs/types/rtti/validate/proof.f.js +2 -2
- package/fs/types/sorted_list/module.f.js +3 -3
- package/fs/types/sorted_list/proof.f.js +6 -6
- package/fs/types/sorted_set/module.f.js +1 -1
- package/fs/types/sorted_set/proof.f.js +6 -6
- package/fs/types/string/module.f.js +4 -4
- package/fs/types/string/proof.f.js +2 -2
- package/fs/types/string_set/module.f.js +6 -6
- package/fs/types/string_set/proof.f.js +1 -1
- package/fs/types/ts/proof.f.d.ts +18 -18
- package/fs/types/ts/proof.f.js +1 -1
- package/fs/types/uint8array/module.f.js +4 -4
- package/fs/types/uint8array/proof.f.js +4 -4
- package/fs/website/module.f.js +3 -3
- package/fs/website/proof.f.js +3 -3
- package/package.json +8 -8
- package/fs/base64/module.f.js +0 -60
- package/fs/fjs/module.f.d.ts +0 -2
- package/fs/fjs/module.js +0 -4
- package/fs/json/module.f.d.ts +0 -50
- package/fs/json/rpc/module.f.d.ts +0 -114
- package/fs/json/schema/module.f.d.ts +0 -77
- /package/fs/{base128 → basen/base128}/proof.f.d.ts +0 -0
- /package/fs/{cbase32 → basen/cbase32}/proof.f.d.ts +0 -0
- /package/fs/{types → common}/monoid/module.f.js +0 -0
- /package/fs/{types → common}/monoid/proof.f.d.ts +0 -0
- /package/fs/{types → common}/monoid/proof.f.js +0 -0
- /package/fs/{html → media/html}/proof.f.d.ts +0 -0
- /package/fs/{html → media/html}/proof.f.js +0 -0
- /package/fs/{json → media/json}/parser/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/rpc/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/schema/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/serializer/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/tokenizer/proof.f.d.ts +0 -0
- /package/fs/{mime → media/type}/proof.f.d.ts +0 -0
- /package/fs/{fjs/module.d.ts → module.d.ts} +0 -0
package/fs/djs/parser/proof.f.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { parseFromTokens } from
|
|
2
|
-
import { tokenize } from
|
|
3
|
-
import { toArray } from
|
|
4
|
-
import { sort } from
|
|
5
|
-
import { stringToList } from
|
|
6
|
-
import { stringifyAsTree } from
|
|
7
|
-
import { stringify } from
|
|
1
|
+
import { parseFromTokens } from './module.f.js';
|
|
2
|
+
import { tokenize } from '../tokenizer/module.f.js';
|
|
3
|
+
import { toArray } from '../../types/list/module.f.js';
|
|
4
|
+
import { sort } from '../../types/object/module.f.js';
|
|
5
|
+
import { stringToList } from '../../text/utf16/module.f.js';
|
|
6
|
+
import { stringifyAsTree } from '../serializer/module.f.js';
|
|
7
|
+
import { stringify } from '../../media/json/module.f.js';
|
|
8
8
|
const tokenizeString = s => toArray(tokenize(stringToList(s))(''));
|
|
9
9
|
const stringifyDjsModule = stringifyAsTree(sort);
|
|
10
10
|
export const proof = {
|
|
@@ -251,6 +251,18 @@ export const proof = {
|
|
|
251
251
|
throw obj[1].message;
|
|
252
252
|
}
|
|
253
253
|
},
|
|
254
|
+
// A literal control character inside a string is not valid JSON
|
|
255
|
+
// syntax (RFC 8259 §7), and DJS string literals are JSON strings.
|
|
256
|
+
() => {
|
|
257
|
+
const tokenList = tokenizeString('export default "\t"');
|
|
258
|
+
const obj = parseFromTokens(tokenList);
|
|
259
|
+
if (obj[0] !== 'error') {
|
|
260
|
+
throw obj;
|
|
261
|
+
}
|
|
262
|
+
if (obj[1].message !== 'unexpected token') {
|
|
263
|
+
throw obj[1].message;
|
|
264
|
+
}
|
|
265
|
+
},
|
|
254
266
|
() => {
|
|
255
267
|
const tokenList = tokenizeString('export default [,]');
|
|
256
268
|
const obj = parseFromTokens(tokenList);
|
package/fs/djs/proof.f.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { compile } from
|
|
2
|
-
import { virtual, emptyState } from
|
|
3
|
-
import { utf8, utf8ToString } from
|
|
1
|
+
import { compile } from './module.f.js';
|
|
2
|
+
import { virtual, emptyState } from '../effects/node/virtual/module.f.js';
|
|
3
|
+
import { utf8, utf8ToString } from '../text/module.f.js';
|
|
4
4
|
const readOutput = (root, path) => {
|
|
5
5
|
const file = root[path];
|
|
6
6
|
if (!Array.isArray(file) || file.length === 0) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { fold } from
|
|
2
|
-
import { concat } from
|
|
3
|
-
import { flat, flatMap, map, concat as listConcat } from
|
|
1
|
+
import { fold } from '../../types/list/module.f.js';
|
|
2
|
+
import { concat } from '../../types/string/module.f.js';
|
|
3
|
+
import { flat, flatMap, map, concat as listConcat } from '../../types/list/module.f.js';
|
|
4
4
|
const { entries } = Object;
|
|
5
|
-
import { compose, fn } from
|
|
6
|
-
import { serialize as bigintSerialize } from
|
|
7
|
-
import { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } from
|
|
5
|
+
import { compose, fn } from '../../types/function/module.f.js';
|
|
6
|
+
import { serialize as bigintSerialize } from '../../types/bigint/module.f.js';
|
|
7
|
+
import { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } from '../../media/json/serializer/module.f.js';
|
|
8
8
|
const colon = [':'];
|
|
9
9
|
export const undefinedSerialize = ['undefined'];
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { countRefs, stringify, stringifyAsTree } from
|
|
2
|
-
import { sort } from
|
|
3
|
-
import { identity } from
|
|
4
|
-
import { setProperty } from
|
|
1
|
+
import { countRefs, stringify, stringifyAsTree } from './module.f.js';
|
|
2
|
+
import { sort } from '../../types/object/module.f.js';
|
|
3
|
+
import { identity } from '../../types/function/module.f.js';
|
|
4
|
+
import { setProperty } from '../../media/json/module.f.js';
|
|
5
5
|
export const proof = {
|
|
6
6
|
stringify: [
|
|
7
7
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { empty, flat, map, stateScan } from
|
|
2
|
-
import { multiply } from
|
|
3
|
-
import * as jsTokenizer from
|
|
1
|
+
import { empty, flat, map, stateScan } from '../../types/list/module.f.js';
|
|
2
|
+
import { multiply } from '../../types/bigfloat/module.f.js';
|
|
3
|
+
import * as jsTokenizer from '../../js/tokenizer/module.f.js';
|
|
4
4
|
const mapToken = input => {
|
|
5
5
|
switch (input.kind) {
|
|
6
6
|
case 'id':
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { tokenize } from
|
|
2
|
-
import { map, toArray } from
|
|
3
|
-
import { stringifyAsTree } from
|
|
4
|
-
import { sort } from
|
|
5
|
-
import { stringToList } from
|
|
1
|
+
import { tokenize } from './module.f.js';
|
|
2
|
+
import { map, toArray } from '../../types/list/module.f.js';
|
|
3
|
+
import { stringifyAsTree } from '../serializer/module.f.js';
|
|
4
|
+
import { sort } from '../../types/object/module.f.js';
|
|
5
|
+
import { stringToList } from '../../text/utf16/module.f.js';
|
|
6
6
|
const tokenizeString = s => toArray(map(withoutMetada)(tokenize(stringToList(s))('')));
|
|
7
7
|
const tokenizeStringWithMetadata = s => toArray(tokenize(stringToList(s))(''));
|
|
8
8
|
const stringify = stringifyAsTree(sort);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { descentParser } from
|
|
2
|
-
import { backspace, ht, lf, ff, cr, quotationMark, solidus, reverseSolidus, digitRange, digit0, latinCapitalLetterA, latinSmallLetterA, latinSmallLetterB, latinSmallLetterF, latinSmallLetterN, latinSmallLetterR, latinSmallLetterT, latinSmallLetterU, range, } from
|
|
3
|
-
import { stringToCodePointList } from
|
|
4
|
-
import { contains } from
|
|
5
|
-
import { concat, filter, flat, flatMap, map, stateScan, toArray } from
|
|
6
|
-
import { jsGrammar, parse } from
|
|
1
|
+
import { descentParser } from '../../bnf/descent/module.f.js';
|
|
2
|
+
import { backspace, ht, lf, ff, cr, quotationMark, solidus, reverseSolidus, digitRange, digit0, latinCapitalLetterA, latinSmallLetterA, latinSmallLetterB, latinSmallLetterF, latinSmallLetterN, latinSmallLetterR, latinSmallLetterT, latinSmallLetterU, range, } from '../../text/ascii/module.f.js';
|
|
3
|
+
import { stringToCodePointList } from '../../text/utf16/module.f.js';
|
|
4
|
+
import { contains } from '../../types/range/module.f.js';
|
|
5
|
+
import { concat, filter, flat, flatMap, map, stateScan, toArray } from '../../types/list/module.f.js';
|
|
6
|
+
import { jsGrammar, parse } from './module.f.js';
|
|
7
7
|
const mapCodePoint = (cp) => [cp, undefined];
|
|
8
8
|
const descentParserCpOnly = (m, name, cp) => {
|
|
9
9
|
const cpm = toArray(map(mapCodePoint)(cp));
|
|
@@ -34,3 +34,8 @@ export type djsResult = {
|
|
|
34
34
|
* on a parse failure or circular dependency.
|
|
35
35
|
*/
|
|
36
36
|
export declare const transpile: (path: string) => Effect<ReadFile, Result<Unknown, ParseError>>;
|
|
37
|
+
export declare const proof: {
|
|
38
|
+
throw: {
|
|
39
|
+
mapDjsUnresolvedImport: () => Unknown;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import {} from
|
|
7
|
-
import { error, ok } from
|
|
8
|
-
import { drop, map as listMap, toArray, includes } from
|
|
9
|
-
import { tokenize } from
|
|
10
|
-
import { setReplace, at } from
|
|
11
|
-
import { stringToList } from
|
|
12
|
-
import { concat as pathConcat } from
|
|
13
|
-
import { parseFromTokens } from
|
|
14
|
-
import { run } from
|
|
15
|
-
import { foldStep, pure } from
|
|
16
|
-
import { readUtf8File } from
|
|
6
|
+
import {} from '../module.f.js';
|
|
7
|
+
import { error, ok } from '../../types/result/module.f.js';
|
|
8
|
+
import { drop, map as listMap, toArray, includes } from '../../types/list/module.f.js';
|
|
9
|
+
import { tokenize } from '../tokenizer/module.f.js';
|
|
10
|
+
import { setReplace, at } from '../../types/ordered_map/module.f.js';
|
|
11
|
+
import { stringToList } from '../../text/utf16/module.f.js';
|
|
12
|
+
import { concat as pathConcat } from '../../path/module.f.js';
|
|
13
|
+
import { parseFromTokens } from '../parser/module.f.js';
|
|
14
|
+
import { run } from '../ast/module.f.js';
|
|
15
|
+
import { foldStep, pure } from '../../effects/module.f.js';
|
|
16
|
+
import { readUtf8File } from '../../effects/node/module.f.js';
|
|
17
17
|
const mapDjs = context => path => {
|
|
18
18
|
const res = at(path)(context.complete);
|
|
19
19
|
if (res === null) {
|
|
@@ -76,3 +76,13 @@ export const transpile = path => foldNextModuleOp(path)({ stack: null, complete:
|
|
|
76
76
|
const result = at(path)(context.complete)?.djs;
|
|
77
77
|
return pure(ok(result));
|
|
78
78
|
});
|
|
79
|
+
// ── Tests ────────────────────────────────────────────────────────────────────
|
|
80
|
+
export const proof = {
|
|
81
|
+
throw: {
|
|
82
|
+
// `mapDjs` is only ever called with an import path that `foldNextModuleOp`
|
|
83
|
+
// has already resolved into `context.complete`, so the `res === null`
|
|
84
|
+
// guard is an internal-invariant check unreachable through `transpile`'s
|
|
85
|
+
// public API. Call it directly with an empty `complete` map to cover it.
|
|
86
|
+
mapDjsUnresolvedImport: () => mapDjs({ complete: null, stack: null, error: null })('missing.djs'),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { sort } from
|
|
2
|
-
import { transpile } from
|
|
3
|
-
import { stringifyAsTree } from
|
|
4
|
-
import { virtual, emptyState } from
|
|
5
|
-
import { utf8 } from
|
|
1
|
+
import { sort } from '../../types/object/module.f.js';
|
|
2
|
+
import { transpile } from './module.f.js';
|
|
3
|
+
import { stringifyAsTree } from '../serializer/module.f.js';
|
|
4
|
+
import { virtual, emptyState } from '../../effects/node/virtual/module.f.js';
|
|
5
|
+
import { utf8 } from '../../text/module.f.js';
|
|
6
6
|
const run = (root) => (path) => {
|
|
7
7
|
const [_, result] = virtual({ ...emptyState, root })(transpile(path));
|
|
8
8
|
return result;
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
|
-
import { asBase as nominalAsBase, asNominal as nominalAsNominal } from
|
|
16
|
-
import { do_ } from
|
|
17
|
-
export const asBase =
|
|
18
|
-
export const asNominal =
|
|
15
|
+
import { asBase as nominalAsBase, asNominal as nominalAsNominal } from '../../types/nominal/module.f.js';
|
|
16
|
+
import { do_ } from '../module.f.js';
|
|
17
|
+
export const asBase = nominalAsBase;
|
|
18
|
+
export const asNominal = nominalAsNominal;
|
|
19
19
|
/** Creates a new typed memory slot with `value` as its initial contents. */
|
|
20
20
|
export const create = do_('memCreate');
|
|
21
21
|
/** Reads the current contents of a typed memory slot. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { run } from
|
|
2
|
-
import { pure } from
|
|
3
|
-
import { asBase, asNominal, create, read, write, } from
|
|
1
|
+
import { run } from '../mock/module.f.js';
|
|
2
|
+
import { pure } from '../module.f.js';
|
|
3
|
+
import { asBase, asNominal, create, read, write, } from './module.f.js';
|
|
4
4
|
const initial = { next: 0, values: {} };
|
|
5
5
|
const mock = {
|
|
6
6
|
memCreate: value => state => {
|
package/fs/effects/module.f.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core effect type constructors and combinators.
|
|
3
3
|
*
|
|
4
|
+
* Effect helpers are **step adapters**: functions that return a continuation
|
|
5
|
+
* `(t: T) => Effect<Q, R>` meant to be passed into `.step`, never wrappers
|
|
6
|
+
* that take the effect itself as an argument. `Effect` has no pipeline
|
|
7
|
+
* operator to lean on and must not be extended with new methods, so
|
|
8
|
+
* `.step(adapterA).step(adapterB)` is how helpers compose — flat,
|
|
9
|
+
* left-to-right, in evaluation order. See {@link okStep} for an example.
|
|
10
|
+
*
|
|
4
11
|
* @module
|
|
5
12
|
*/
|
|
6
13
|
import { type List } from '../types/list/module.f.ts';
|
|
14
|
+
import type { Result } from '../types/result/module.f.ts';
|
|
7
15
|
export type Operation = readonly [string, (..._: readonly never[]) => unknown];
|
|
8
16
|
export type Effect<O extends Operation, T> = {
|
|
9
17
|
value: Value<O, T>;
|
|
@@ -43,6 +51,13 @@ export declare const foldStep: <O extends Operation, T, S>(f: (item: T) => (stat
|
|
|
43
51
|
* results. The `void` accumulator sibling of `foldStep`.
|
|
44
52
|
*/
|
|
45
53
|
export declare const forEachStep: <O extends Operation, T>(f: (item: T) => Effect<O, void>) => (items: List<T>) => Effect<O, void>;
|
|
54
|
+
/**
|
|
55
|
+
* A step adapter for the `error` short-circuit: `error` → pass it through
|
|
56
|
+
* unchanged as `pure`, `ok` → continue with `f`. Collapses the hand-written
|
|
57
|
+
* `r[0] === 'error' ? pure(r) : f(r[1])` check that recurs at every site
|
|
58
|
+
* chaining `Effect<O, Result<T, E>>` steps.
|
|
59
|
+
*/
|
|
60
|
+
export declare const okStep: <T, E, O extends Operation, R>(f: (value: T) => Effect<O, Result<R, E>>) => (r: Result<T, E>) => Effect<O, Result<R, E>>;
|
|
46
61
|
/**
|
|
47
62
|
* The decoded form of an effect's next step: either a final `result`, or a
|
|
48
63
|
* `command` to perform with its `payload` and the `continuation` to resume
|
package/fs/effects/module.f.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core effect type constructors and combinators.
|
|
3
3
|
*
|
|
4
|
+
* Effect helpers are **step adapters**: functions that return a continuation
|
|
5
|
+
* `(t: T) => Effect<Q, R>` meant to be passed into `.step`, never wrappers
|
|
6
|
+
* that take the effect itself as an argument. `Effect` has no pipeline
|
|
7
|
+
* operator to lean on and must not be extended with new methods, so
|
|
8
|
+
* `.step(adapterA).step(adapterB)` is how helpers compose — flat,
|
|
9
|
+
* left-to-right, in evaluation order. See {@link okStep} for an example.
|
|
10
|
+
*
|
|
4
11
|
* @module
|
|
5
12
|
*/
|
|
6
|
-
import { fold } from
|
|
13
|
+
import { fold } from '../types/list/module.f.js';
|
|
7
14
|
export const pure = (v) => ({
|
|
8
15
|
value: () => v,
|
|
9
16
|
step: f => f(v)
|
|
@@ -39,6 +46,13 @@ export const foldStep = (f) => (init) => (items) => fold(item => acc => acc.step
|
|
|
39
46
|
* results. The `void` accumulator sibling of `foldStep`.
|
|
40
47
|
*/
|
|
41
48
|
export const forEachStep = (f) => (items) => foldStep((item) => () => f(item))(undefined)(items);
|
|
49
|
+
/**
|
|
50
|
+
* A step adapter for the `error` short-circuit: `error` → pass it through
|
|
51
|
+
* unchanged as `pure`, `ok` → continue with `f`. Collapses the hand-written
|
|
52
|
+
* `r[0] === 'error' ? pure(r) : f(r[1])` check that recurs at every site
|
|
53
|
+
* chaining `Effect<O, Result<T, E>>` steps.
|
|
54
|
+
*/
|
|
55
|
+
export const okStep = (f) => (r) => r[0] === 'error' ? pure(r) : f(r[1]);
|
|
42
56
|
/**
|
|
43
57
|
* Decodes an effect's next step: a pure result, or a command to perform.
|
|
44
58
|
*
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
|
-
import { asyncRun } from
|
|
8
|
-
import { asBase, asNominal } from
|
|
7
|
+
import { asyncRun } from '../../module.js';
|
|
8
|
+
import { asBase, asNominal } from '../../memory/module.f.js';
|
|
9
9
|
const missingKey = (id) => new Error(`memory key not found: ${id}`);
|
|
10
10
|
/**
|
|
11
11
|
* Creates a stateful operation map backed by an immutable `Map` snapshot.
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { asyncRun } from
|
|
7
|
-
import { asNominal, create, read, write, } from
|
|
8
|
-
import { memoryOperationMap, run } from
|
|
6
|
+
import { asyncRun } from '../../module.js';
|
|
7
|
+
import { asNominal, create, read, write, } from '../../memory/module.f.js';
|
|
8
|
+
import { memoryOperationMap, run } from './module.js';
|
|
9
9
|
export const proof = {
|
|
10
10
|
nodeInterpreter: async () => {
|
|
11
11
|
const result = await run(create(1).step(key => write(key, 2).step(() => read(key))));
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
import { utf8, utf8ToString } from
|
|
12
|
-
import { toCodePointList } from
|
|
13
|
-
import { codePointListToString } from
|
|
14
|
-
import { reverse } from
|
|
15
|
-
import { length } from
|
|
16
|
-
import { ok, error as resultError } from
|
|
17
|
-
import { do_, pure } from
|
|
11
|
+
import { utf8, utf8ToString } from '../../text/module.f.js';
|
|
12
|
+
import { toCodePointList } from '../../text/utf8/module.f.js';
|
|
13
|
+
import { codePointListToString } from '../../text/utf16/module.f.js';
|
|
14
|
+
import { reverse } from '../../types/list/module.f.js';
|
|
15
|
+
import { length } from '../../types/bit_vec/module.f.js';
|
|
16
|
+
import { ok, error as resultError, mapOk } from '../../types/result/module.f.js';
|
|
17
|
+
import { do_, okStep, pure } from '../module.f.js';
|
|
18
18
|
/**
|
|
19
19
|
* True if `e` is a "file or directory does not exist" (`ENOENT`) error.
|
|
20
20
|
*
|
|
@@ -43,7 +43,7 @@ export const readFile = do_('readFile');
|
|
|
43
43
|
* on errors (e.g. convert them into domain-specific errors) or `unwrap` at the
|
|
44
44
|
* call site.
|
|
45
45
|
*/
|
|
46
|
-
export const readUtf8File = (path) => readFile(path).step(r => pure(
|
|
46
|
+
export const readUtf8File = (path) => readFile(path).step(r => pure(mapOk(utf8ToString)(r)));
|
|
47
47
|
export const readdir = do_('readdir');
|
|
48
48
|
export const writeFile = do_('writeFile');
|
|
49
49
|
/** Writes a string to `path` as UTF-8 bytes. */
|
|
@@ -70,22 +70,12 @@ const writeLoop = (path) => {
|
|
|
70
70
|
return pure(resultError('invalid buffer size'));
|
|
71
71
|
}
|
|
72
72
|
return writeBytes(path, offset, v)
|
|
73
|
-
.step((
|
|
74
|
-
if (r[0] === 'error') {
|
|
75
|
-
return pure(r);
|
|
76
|
-
}
|
|
77
|
-
return f(offset + Number(lenV >> 3n), tail);
|
|
78
|
-
});
|
|
73
|
+
.step(okStep(() => f(offset + Number(lenV >> 3n), tail)));
|
|
79
74
|
});
|
|
80
75
|
return f;
|
|
81
76
|
};
|
|
82
77
|
export const writeFromStream = (path, e) => createExclusive(path)
|
|
83
|
-
.step((
|
|
84
|
-
if (r === 'error') {
|
|
85
|
-
return pure(resultError(v));
|
|
86
|
-
}
|
|
87
|
-
return writeLoop(path)(0, e);
|
|
88
|
-
});
|
|
78
|
+
.step(okStep(() => writeLoop(path)(0, e)));
|
|
89
79
|
export const stat = do_('stat');
|
|
90
80
|
export const createServer = do_('createServer');
|
|
91
81
|
export const listen = do_('listen');
|
|
@@ -28,16 +28,16 @@ import os from 'node:os';
|
|
|
28
28
|
import process from 'node:process';
|
|
29
29
|
import { once } from 'node:events';
|
|
30
30
|
import * as testContext from 'node:test';
|
|
31
|
-
import { concat, normalize, toPosix } from
|
|
32
|
-
import {} from
|
|
33
|
-
import { asyncRun } from
|
|
34
|
-
import { memoryOperationMap } from
|
|
35
|
-
import {} from
|
|
36
|
-
import { asBase, asNominal } from
|
|
37
|
-
import { error, ok } from
|
|
38
|
-
import { asyncTryCatch } from
|
|
39
|
-
import { fromVec, listToVec, toVec } from
|
|
40
|
-
import { maxLengthBytes } from
|
|
31
|
+
import { concat, normalize, toPosix } from '../../path/module.f.js';
|
|
32
|
+
import {} from '../module.f.js';
|
|
33
|
+
import { asyncRun } from '../module.js';
|
|
34
|
+
import { memoryOperationMap } from './memory/module.js';
|
|
35
|
+
import {} from './module.f.js';
|
|
36
|
+
import { asBase, asNominal } from '../../types/nominal/module.f.js';
|
|
37
|
+
import { error, ok } from '../../types/result/module.f.js';
|
|
38
|
+
import { asyncTryCatch } from '../../types/result/module.js';
|
|
39
|
+
import { fromVec, listToVec, toVec } from '../../types/uint8array/module.f.js';
|
|
40
|
+
import { maxLengthBytes } from '../../types/bit_vec/module.f.js';
|
|
41
41
|
/**
|
|
42
42
|
* Narrowed structural view of `node:http`'s `createServer`. The official types
|
|
43
43
|
* declare `method`/`url` optional and header values as
|
|
@@ -146,6 +146,8 @@ const readStdinByte = async () => {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
+
const randomMax = Number(1n << 32n);
|
|
150
|
+
const { randomInt } = crypto;
|
|
149
151
|
const runNodeEffect = asyncRun({
|
|
150
152
|
...memoryOperationMap(),
|
|
151
153
|
all: async (...effects) => await Promise.all(effects.map(runNodeEffect)),
|
|
@@ -191,7 +193,7 @@ const runNodeEffect = asyncRun({
|
|
|
191
193
|
await fh.close();
|
|
192
194
|
}
|
|
193
195
|
}),
|
|
194
|
-
randomInt: async () =>
|
|
196
|
+
randomInt: async () => randomInt(randomMax),
|
|
195
197
|
access: path => asyncTryCatch(() => access(path)),
|
|
196
198
|
createExclusive: path => asyncTryCatch(async () => {
|
|
197
199
|
const fh = await open(path, 'wx');
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { empty, isVec, uint, vec8 } from "../../types/bit_vec/module.f.js";
|
|
2
2
|
import { utf8, utf8ToString } from "../../text/module.f.js";
|
|
3
3
|
import { decode, pure } from "../module.f.js";
|
|
4
|
-
import { both, fetch, mkdir, now, readdir, readFile, readUtf8File, rm, sandbox, writeFile, writeUtf8File, rename, readBytes, randomInt } from "./module.f.js";
|
|
4
|
+
import { both, fetch, mkdir, now, readdir, readFile, readUtf8File, rm, sandbox, writeFile, writeUtf8File, rename, readBytes, randomInt, writeFromStream } from "./module.f.js";
|
|
5
5
|
import { create as memCreate, read as memRead, write as memWrite } from "../memory/module.f.js";
|
|
6
|
+
import { empty as listEmpty } from "../list/module.f.js";
|
|
6
7
|
import { emptyState, virtual } from "./virtual/module.f.js";
|
|
7
8
|
export const proof = {
|
|
8
9
|
map: () => {
|
|
@@ -553,4 +554,21 @@ export const proof = {
|
|
|
553
554
|
}
|
|
554
555
|
},
|
|
555
556
|
},
|
|
557
|
+
writeFromStream: {
|
|
558
|
+
createExclusiveFails: () => {
|
|
559
|
+
// The destination already exists, so `createExclusive` fails (EEXIST) and
|
|
560
|
+
// the error propagates without ever touching `writeBytes`.
|
|
561
|
+
const [state, [t, result]] = virtual({
|
|
562
|
+
...emptyState,
|
|
563
|
+
root: { hello: [vec8(0x2an)] },
|
|
564
|
+
})(writeFromStream('hello', listEmpty()));
|
|
565
|
+
if (t !== 'error') {
|
|
566
|
+
throw result;
|
|
567
|
+
}
|
|
568
|
+
const file = state.root.hello;
|
|
569
|
+
if (!Array.isArray(file) || uint(file[0]) !== 0x2an) {
|
|
570
|
+
throw file;
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
},
|
|
556
574
|
};
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { todo } from
|
|
7
|
-
import { join, parse } from
|
|
8
|
-
import { utf8ToString } from
|
|
9
|
-
import { empty, length, maxLengthBytes, msb, vec } from
|
|
10
|
-
import { error, ok } from
|
|
11
|
-
import { run } from
|
|
12
|
-
import { asBase, asNominal } from
|
|
6
|
+
import { todo } from '../../../asserts/module.f.js';
|
|
7
|
+
import { isProperPrefix, join, parse } from '../../../path/module.f.js';
|
|
8
|
+
import { utf8ToString } from '../../../text/module.f.js';
|
|
9
|
+
import { empty, length, maxLengthBytes, msb, vec } from '../../../types/bit_vec/module.f.js';
|
|
10
|
+
import { error, ok } from '../../../types/result/module.f.js';
|
|
11
|
+
import { run } from '../../mock/module.f.js';
|
|
12
|
+
import { asBase, asNominal } from '../../memory/module.f.js';
|
|
13
13
|
export const emptyState = {
|
|
14
14
|
stdout: '',
|
|
15
15
|
stderr: '',
|
|
@@ -218,7 +218,6 @@ const insertEntityAt = (dir, path, entity) => {
|
|
|
218
218
|
}
|
|
219
219
|
return [{ ...dir, [first]: newSub }, result];
|
|
220
220
|
};
|
|
221
|
-
const isProperPrefix = (prefix, path) => prefix.length < path.length && prefix.every((seg, i) => seg === path[i]);
|
|
222
221
|
const rename = (src, dst) => (state) => {
|
|
223
222
|
const srcParsed = parse(src);
|
|
224
223
|
const dstParsed = parse(dst);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { assertEq } from
|
|
2
|
-
import { awaitIfPromise, fetch, rm, writeFile, readFile, readdir, import_, rename, readBytes } from
|
|
3
|
-
import { maxLengthBytes, vec, vec8 } from
|
|
4
|
-
import { emptyState, virtual } from
|
|
1
|
+
import { assertEq } from '../../../asserts/module.f.js';
|
|
2
|
+
import { awaitIfPromise, fetch, rm, writeFile, readFile, readdir, import_, rename, readBytes, writeBytes } from '../module.f.js';
|
|
3
|
+
import { maxLengthBytes, vec, vec8 } from '../../../types/bit_vec/module.f.js';
|
|
4
|
+
import { emptyState, virtual } from './module.f.js';
|
|
5
5
|
export const proof = {
|
|
6
6
|
rm: {
|
|
7
7
|
success: () => {
|
|
@@ -159,6 +159,13 @@ export const proof = {
|
|
|
159
159
|
const [, result] = virtual({ ...emptyState, root })(readBytes('big', chunkSize - 1, 2));
|
|
160
160
|
assertEq(result[0], 'ok');
|
|
161
161
|
},
|
|
162
|
+
writeBytesWrongOffset: () => {
|
|
163
|
+
// writeBytes is append-only; an offset that doesn't match the current
|
|
164
|
+
// file size must fail rather than silently create a hole.
|
|
165
|
+
const root = { 'file': [vec8(0x42n)] };
|
|
166
|
+
const [, result] = virtual({ ...emptyState, root })(writeBytes('file', 5, vec8(0x43n)));
|
|
167
|
+
assertEq(result[0], 'error');
|
|
168
|
+
},
|
|
162
169
|
largeFileReadBytes: () => {
|
|
163
170
|
// A file stored as two 128 KiB chunks is larger than maxLengthBytes.
|
|
164
171
|
// readBytes within the second chunk (offset = 128 KiB, size = 1) should succeed.
|
package/fs/effects/proof.f.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const proof: {
|
|
|
2
2
|
lazy: {
|
|
3
3
|
value: () => void;
|
|
4
4
|
deferred: () => void;
|
|
5
|
+
step: () => void;
|
|
5
6
|
};
|
|
6
7
|
foldStep: {
|
|
7
8
|
empty: () => void;
|
|
@@ -12,6 +13,10 @@ export declare const proof: {
|
|
|
12
13
|
empty: () => void;
|
|
13
14
|
runs: () => void;
|
|
14
15
|
};
|
|
16
|
+
okStep: {
|
|
17
|
+
ok: () => void;
|
|
18
|
+
error: () => void;
|
|
19
|
+
};
|
|
15
20
|
decode: () => void;
|
|
16
21
|
match: {
|
|
17
22
|
done: () => void;
|
package/fs/effects/proof.f.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { decode, do_, foldStep, forEachStep, lazy, match, pure } from
|
|
1
|
+
import { decode, do_, foldStep, forEachStep, lazy, match, okStep, pure } from './module.f.js';
|
|
2
|
+
import { error, ok } from '../types/result/module.f.js';
|
|
2
3
|
const assertPure = (e, expected) => {
|
|
3
4
|
const d = decode(e);
|
|
4
5
|
if (!d.done) {
|
|
@@ -26,6 +27,10 @@ export const proof = {
|
|
|
26
27
|
throw 'decode must force the thunk';
|
|
27
28
|
}
|
|
28
29
|
},
|
|
30
|
+
step: () => {
|
|
31
|
+
const e = lazy(() => 5).step(v => pure(v * 2));
|
|
32
|
+
assertPure(e, 10);
|
|
33
|
+
},
|
|
29
34
|
},
|
|
30
35
|
foldStep: {
|
|
31
36
|
empty: () => {
|
|
@@ -51,6 +56,22 @@ export const proof = {
|
|
|
51
56
|
assertPure(e, undefined);
|
|
52
57
|
},
|
|
53
58
|
},
|
|
59
|
+
okStep: {
|
|
60
|
+
ok: () => {
|
|
61
|
+
const e = pure(ok(5)).step(okStep((v) => pure(ok(v * 2))));
|
|
62
|
+
const d = decode(e);
|
|
63
|
+
if (!d.done || d.result[0] !== 'ok' || d.result[1] !== 10) {
|
|
64
|
+
throw e.value;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
error: () => {
|
|
68
|
+
const e = pure(error('oops')).step(okStep(v => pure(ok(v * 2))));
|
|
69
|
+
const d = decode(e);
|
|
70
|
+
if (!d.done || d.result[0] !== 'error' || d.result[1] !== 'oops') {
|
|
71
|
+
throw e.value;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
54
75
|
decode: () => {
|
|
55
76
|
const d = decode(do_('add')(2, 3));
|
|
56
77
|
if (d.done) {
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module
|
|
12
12
|
*/
|
|
13
|
-
import { reset, fgGreen, fgRed, bold, csiWrite } from
|
|
14
|
-
import { all, awaitIfPromise, sandbox, test } from
|
|
15
|
-
import { pure } from
|
|
16
|
-
import { loadModuleMap, shouldLoad } from
|
|
17
|
-
import { invert } from
|
|
18
|
-
import { definedEntries } from
|
|
13
|
+
import { reset, fgGreen, fgRed, bold, csiWrite } from '../text/sgr/module.f.js';
|
|
14
|
+
import { all, awaitIfPromise, sandbox, test } from '../effects/node/module.f.js';
|
|
15
|
+
import { pure } from '../effects/module.f.js';
|
|
16
|
+
import { loadModuleMap, shouldLoad } from '../dev/module.f.js';
|
|
17
|
+
import { invert } from '../types/result/module.f.js';
|
|
18
|
+
import { definedEntries } from '../types/object/module.f.js';
|
|
19
19
|
const addPass = (delta) => (ts) => ({ ...ts, time: ts.time + delta, pass: ts.pass + 1 });
|
|
20
20
|
const addFail = (delta) => (ts) => ({ ...ts, time: ts.time + delta, fail: ts.fail + 1 });
|
|
21
21
|
const timeFormat = (a) => {
|