brass-runtime 1.13.4 → 1.13.6

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/dist/index.js CHANGED
@@ -1,92 +1,92 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
- var _chunk3IF374MGjs = require('./chunk-3IF374MG.js');
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
- var _chunkTGOMLZ65js = require('./chunk-TGOMLZ65.js');
1
+ import {
2
+ assertNever,
3
+ collectStream,
4
+ concatStream,
5
+ emitStream,
6
+ emptyStream,
7
+ flattenStream,
8
+ foreachStream,
9
+ fromArray,
10
+ fromPull,
11
+ managedStream,
12
+ mapStream,
13
+ merge,
14
+ mergeStream,
15
+ rangeStream,
16
+ streamFromReadableStream,
17
+ uncons,
18
+ unwrapScoped,
19
+ widenOpt,
20
+ zip
21
+ } from "./chunk-3IF374MG.js";
22
+ import {
23
+ Async,
24
+ Cause,
25
+ DefaultHostExecutor,
26
+ EngineFiberHandle,
27
+ Exit,
28
+ HostRegistry,
29
+ JsFiberEngine,
30
+ NoopHooks,
31
+ ProgramBuilder,
32
+ PushStatus,
33
+ ReferenceWasmBridge,
34
+ RingBuffer,
35
+ Runtime,
36
+ RuntimeFiber,
37
+ Scheduler,
38
+ Scope,
39
+ WasmFiberEngine,
40
+ WasmFiberRegistryBridge,
41
+ WasmPackFiberBridge,
42
+ acquireRelease,
43
+ async,
44
+ asyncCatchAll,
45
+ asyncFail,
46
+ asyncFlatMap,
47
+ asyncFold,
48
+ asyncInterruptible,
49
+ asyncMap,
50
+ asyncMapError,
51
+ asyncSucceed,
52
+ asyncSync,
53
+ asyncTotal,
54
+ catchAll,
55
+ collectAllPar,
56
+ end,
57
+ fail,
58
+ flatMap,
59
+ fork,
60
+ fromPromiseAbortable,
61
+ getBenchmarkBudget,
62
+ getCurrentFiber,
63
+ globalScheduler,
64
+ makeBoundedRingBuffer,
65
+ map,
66
+ mapAsync,
67
+ mapError,
68
+ mapTryAsync,
69
+ none,
70
+ orElseOptional,
71
+ race,
72
+ raceWith,
73
+ resolveWasmModule,
74
+ runtimeCapabilities,
75
+ setBenchmarkBudget,
76
+ some,
77
+ succeed,
78
+ sync,
79
+ toPromise,
80
+ unit,
81
+ unsafeGetCurrentRuntime,
82
+ unsafeRunAsync,
83
+ unsafeRunFoldWithEnv,
84
+ withAsyncPromise,
85
+ withCurrentFiber,
86
+ withScope,
87
+ withScopeAsync,
88
+ zipPar
89
+ } from "./chunk-TGOMLZ65.js";
90
90
 
91
91
  // src/core/types/cancel.ts
92
92
  function makeCancelToken() {
@@ -104,7 +104,7 @@ function makeCancelToken() {
104
104
  if (cancelled) {
105
105
  try {
106
106
  f();
107
- } catch (e2) {
107
+ } catch {
108
108
  }
109
109
  return () => {
110
110
  };
@@ -122,10 +122,10 @@ function linkAbortController(token, ac) {
122
122
  }
123
123
 
124
124
  // src/core/runtime/linkedQueue.ts
125
- var LinkedQueue = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }
126
- __init() {this.head = null}
127
- __init2() {this.tail = null}
128
- __init3() {this.len = 0}
125
+ var LinkedQueue = class {
126
+ head = null;
127
+ tail = null;
128
+ len = 0;
129
129
  get length() {
130
130
  return this.len;
131
131
  }
@@ -161,14 +161,14 @@ var LinkedQueue = (_class = class {constructor() { _class.prototype.__init.call(
161
161
  node.prev = null;
162
162
  this.len--;
163
163
  }
164
- }, _class);
164
+ };
165
165
 
166
166
  // src/core/stream/queue.ts
167
167
  function bounded(capacity, strategy = "backpressure", options = {}) {
168
- return _chunkTGOMLZ65js.asyncSync.call(void 0, () => makeQueue(capacity, strategy, options));
168
+ return asyncSync(() => makeQueue(capacity, strategy, options));
169
169
  }
170
170
  function makeQueue(capacity, strategy, options) {
171
- const items = _chunkTGOMLZ65js.makeBoundedRingBuffer.call(void 0, capacity, capacity, options);
171
+ const items = makeBoundedRingBuffer(capacity, capacity, options);
172
172
  let closed = false;
173
173
  const QueueClosedErr = { _tag: "QueueClosed" };
174
174
  const offerWaiters = new LinkedQueue();
@@ -189,7 +189,7 @@ function makeQueue(capacity, strategy, options) {
189
189
  return {
190
190
  size: () => items.length,
191
191
  shutdown,
192
- offer: (a) => _chunkTGOMLZ65js.async.call(void 0, (_env, cb) => {
192
+ offer: (a) => async((_env, cb) => {
193
193
  if (closed) {
194
194
  cb({ _tag: "Success", value: false });
195
195
  return;
@@ -224,7 +224,7 @@ function makeQueue(capacity, strategy, options) {
224
224
  };
225
225
  return canceler;
226
226
  }),
227
- take: () => _chunkTGOMLZ65js.async.call(void 0, (_env, cb) => {
227
+ take: () => async((_env, cb) => {
228
228
  if (items.length > 0) {
229
229
  const a = items.shift();
230
230
  cb({ _tag: "Success", value: a });
@@ -261,34 +261,34 @@ function buffer(stream, capacity, strategy = "backpressure") {
261
261
  let q = null;
262
262
  let producer = null;
263
263
  let upstream = stream;
264
- const onUpstreamFailure = (opt) => _chunkTGOMLZ65js.asyncSucceed.call(void 0,
264
+ const onUpstreamFailure = (opt) => asyncSucceed(
265
265
  opt._tag === "None" ? SIGNAL_END : { _tag: "Fail", error: opt.value }
266
266
  );
267
- const onUpstreamSuccess = ([a, tail]) => _chunkTGOMLZ65js.asyncSync.call(void 0, () => {
267
+ const onUpstreamSuccess = ([a, tail]) => asyncSync(() => {
268
268
  upstream = tail;
269
269
  return { _tag: "Elem", value: a };
270
270
  });
271
- const nextSignal = () => _chunkTGOMLZ65js.asyncFold.call(void 0,
272
- _chunk3IF374MGjs.uncons.call(void 0, upstream),
271
+ const nextSignal = () => asyncFold(
272
+ uncons(upstream),
273
273
  onUpstreamFailure,
274
274
  onUpstreamSuccess
275
275
  );
276
- const start = (env) => _chunkTGOMLZ65js.asyncFlatMap.call(void 0, bounded(capacity, strategy), (_q) => {
276
+ const start = (env) => asyncFlatMap(bounded(capacity, strategy), (_q) => {
277
277
  q = _q;
278
278
  let lastSig;
279
279
  const afterOffer = () => {
280
280
  if (lastSig._tag !== "Elem") {
281
- return _chunkTGOMLZ65js.asyncSucceed.call(void 0, void 0);
281
+ return asyncSucceed(void 0);
282
282
  }
283
283
  return loop();
284
284
  };
285
285
  const onSignal = (sig) => {
286
286
  lastSig = sig;
287
- return _chunkTGOMLZ65js.asyncFlatMap.call(void 0, q.offer(sig), afterOffer);
287
+ return asyncFlatMap(q.offer(sig), afterOffer);
288
288
  };
289
- const loop = () => _chunkTGOMLZ65js.asyncFlatMap.call(void 0, nextSignal(), onSignal);
290
- producer = _chunkTGOMLZ65js.fork.call(void 0, loop(), env);
291
- return _chunkTGOMLZ65js.asyncSucceed.call(void 0, void 0);
289
+ const loop = () => asyncFlatMap(nextSignal(), onSignal);
290
+ producer = fork(loop(), env);
291
+ return asyncSucceed(void 0);
292
292
  });
293
293
  const pullDown = {
294
294
  _tag: "Async",
@@ -296,7 +296,7 @@ function buffer(stream, capacity, strategy = "backpressure") {
296
296
  const go = () => {
297
297
  if (!started) {
298
298
  started = true;
299
- _chunkTGOMLZ65js.unsafeGetCurrentRuntime.call(void 0, ).fork(start(env)).join(() => {
299
+ unsafeGetCurrentRuntime().fork(start(env)).join(() => {
300
300
  pullFromQueue(env, cb);
301
301
  });
302
302
  return;
@@ -308,25 +308,25 @@ function buffer(stream, capacity, strategy = "backpressure") {
308
308
  };
309
309
  function pullFromQueue(env, cb) {
310
310
  const takeEff = q.take();
311
- _chunkTGOMLZ65js.unsafeGetCurrentRuntime.call(void 0, ).fork(takeEff).join((ex) => {
311
+ unsafeGetCurrentRuntime().fork(takeEff).join((ex) => {
312
312
  if (ex._tag !== "Success") return;
313
313
  const sig = ex.value;
314
314
  switch (sig._tag) {
315
315
  case "Elem":
316
- cb({ _tag: "Success", value: [sig.value, _chunk3IF374MGjs.fromPull.call(void 0, pullDown)] });
316
+ cb({ _tag: "Success", value: [sig.value, fromPull(pullDown)] });
317
317
  return;
318
318
  case "End":
319
- _optionalChain([producer, 'optionalAccess', _ => _.interrupt, 'optionalCall', _2 => _2()]);
320
- cb({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkTGOMLZ65js.none } });
319
+ producer?.interrupt?.();
320
+ cb({ _tag: "Failure", cause: { _tag: "Fail", error: none } });
321
321
  return;
322
322
  case "Fail":
323
- _optionalChain([producer, 'optionalAccess', _3 => _3.interrupt, 'optionalCall', _4 => _4()]);
324
- cb({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkTGOMLZ65js.some.call(void 0, sig.error) } });
323
+ producer?.interrupt?.();
324
+ cb({ _tag: "Failure", cause: { _tag: "Fail", error: some(sig.error) } });
325
325
  return;
326
326
  }
327
327
  });
328
328
  }
329
- return _chunk3IF374MGjs.fromPull.call(void 0, pullDown);
329
+ return fromPull(pullDown);
330
330
  }
331
331
 
332
332
  // src/core/stream/hub.ts
@@ -335,45 +335,45 @@ function makeHub(capacity, strategy = "BackPressure") {
335
335
  const queues = /* @__PURE__ */ new Set();
336
336
  let closed = false;
337
337
  const publish = (a) => {
338
- if (closed) return _chunkTGOMLZ65js.asyncSucceed.call(void 0, false);
338
+ if (closed) return asyncSucceed(false);
339
339
  const size = queues.size;
340
- if (size === 0) return _chunkTGOMLZ65js.asyncSucceed.call(void 0, true);
340
+ if (size === 0) return asyncSucceed(true);
341
341
  if (size === 1) {
342
342
  const q = queues.values().next().value;
343
343
  return q.offer(a);
344
344
  }
345
- let eff = _chunkTGOMLZ65js.asyncSucceed.call(void 0, true);
345
+ let eff = asyncSucceed(true);
346
346
  for (const q of queues) {
347
- eff = _chunkTGOMLZ65js.asyncFlatMap.call(void 0,
347
+ eff = asyncFlatMap(
348
348
  eff,
349
- (okSoFar) => _chunkTGOMLZ65js.asyncFlatMap.call(void 0, q.offer(a), (ok) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, okSoFar && ok))
349
+ (okSoFar) => asyncFlatMap(q.offer(a), (ok) => asyncSucceed(okSoFar && ok))
350
350
  );
351
351
  }
352
352
  return eff;
353
353
  };
354
354
  const publishAll = (as) => {
355
- let eff = _chunkTGOMLZ65js.asyncSucceed.call(void 0, true);
355
+ let eff = asyncSucceed(true);
356
356
  const it = as[Symbol.iterator]();
357
357
  while (true) {
358
358
  const n = it.next();
359
359
  if (n.done) break;
360
360
  const a = n.value;
361
- eff = _chunkTGOMLZ65js.asyncFlatMap.call(void 0,
361
+ eff = asyncFlatMap(
362
362
  eff,
363
- (okSoFar) => _chunkTGOMLZ65js.asyncFlatMap.call(void 0, publish(a), (ok) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, okSoFar && ok))
363
+ (okSoFar) => asyncFlatMap(publish(a), (ok) => asyncSucceed(okSoFar && ok))
364
364
  );
365
365
  }
366
366
  return eff;
367
367
  };
368
368
  const subscribe = () => {
369
369
  if (closed) {
370
- return _chunkTGOMLZ65js.asyncTotal.call(void 0, () => {
370
+ return asyncTotal(() => {
371
371
  throw { _tag: "HubClosed" };
372
372
  });
373
373
  }
374
- return _chunkTGOMLZ65js.asyncFlatMap.call(void 0,
374
+ return asyncFlatMap(
375
375
  bounded(capacity, toQueueStrategy(strategy)),
376
- (q) => _chunkTGOMLZ65js.asyncSync.call(void 0, () => {
376
+ (q) => asyncSync(() => {
377
377
  queues.add(q);
378
378
  return {
379
379
  ...q,
@@ -386,7 +386,7 @@ function makeHub(capacity, strategy = "BackPressure") {
386
386
  })
387
387
  );
388
388
  };
389
- const shutdown = () => _chunkTGOMLZ65js.asyncSync.call(void 0, () => {
389
+ const shutdown = () => asyncSync(() => {
390
390
  if (closed) return;
391
391
  closed = true;
392
392
  for (const q of queues) q.shutdown();
@@ -401,23 +401,23 @@ function makeHub(capacity, strategy = "BackPressure") {
401
401
  }
402
402
  var broadcast = makeHub;
403
403
  function broadcastToHub(stream, hub) {
404
- return _chunk3IF374MGjs.foreachStream.call(void 0,
404
+ return foreachStream(
405
405
  stream,
406
- (a) => _chunkTGOMLZ65js.asyncFlatMap.call(void 0, hub.publish(a), () => _chunkTGOMLZ65js.asyncSucceed.call(void 0, void 0))
406
+ (a) => asyncFlatMap(hub.publish(a), () => asyncSucceed(void 0))
407
407
  );
408
408
  }
409
409
  function fromHub(hub) {
410
- return _chunk3IF374MGjs.managedStream.call(void 0,
411
- _chunkTGOMLZ65js.asyncFlatMap.call(void 0, hub.subscribe(), (sub) => {
412
- const loop = _chunk3IF374MGjs.fromPull.call(void 0,
413
- _chunkTGOMLZ65js.asyncFlatMap.call(void 0,
414
- _chunkTGOMLZ65js.asyncMapError.call(void 0, sub.take(), (_queueClosed) => _chunkTGOMLZ65js.none),
415
- (a) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, [a, loop])
410
+ return managedStream(
411
+ asyncFlatMap(hub.subscribe(), (sub) => {
412
+ const loop = fromPull(
413
+ asyncFlatMap(
414
+ asyncMapError(sub.take(), (_queueClosed) => none),
415
+ (a) => asyncSucceed([a, loop])
416
416
  )
417
417
  );
418
- return _chunkTGOMLZ65js.asyncSucceed.call(void 0, {
418
+ return asyncSucceed({
419
419
  stream: loop,
420
- release: (_exit) => _chunkTGOMLZ65js.asyncSync.call(void 0, () => sub.unsubscribe())
420
+ release: (_exit) => asyncSync(() => sub.unsubscribe())
421
421
  });
422
422
  })
423
423
  );
@@ -427,22 +427,22 @@ function fromHub(hub) {
427
427
  var cachedWasmChunkCtor;
428
428
  function resolveWasmChunkBuffer() {
429
429
  if (cachedWasmChunkCtor !== void 0) return cachedWasmChunkCtor;
430
- const mod = _chunkTGOMLZ65js.resolveWasmModule.call(void 0, );
431
- cachedWasmChunkCtor = _nullishCoalesce(_optionalChain([mod, 'optionalAccess', _5 => _5.BrassWasmChunkBuffer]), () => ( null));
430
+ const mod = resolveWasmModule();
431
+ cachedWasmChunkCtor = mod?.BrassWasmChunkBuffer ?? null;
432
432
  return cachedWasmChunkCtor;
433
433
  }
434
- var JsChunker = (_class2 = class {
435
- constructor(maxChunkSize, fallbackUsed = false) {;_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);
434
+ var JsChunker = class {
435
+ constructor(maxChunkSize, fallbackUsed = false) {
436
436
  this.maxChunkSize = maxChunkSize;
437
437
  this.fallbackUsed = fallbackUsed;
438
438
  }
439
-
440
-
441
- __init4() {this.engine = "js"}
442
- __init5() {this.values = []}
443
- __init6() {this.emittedChunks = 0}
444
- __init7() {this.emittedItems = 0}
445
- __init8() {this.flushes = 0}
439
+ maxChunkSize;
440
+ fallbackUsed;
441
+ engine = "js";
442
+ values = [];
443
+ emittedChunks = 0;
444
+ emittedItems = 0;
445
+ flushes = 0;
446
446
  get length() {
447
447
  return this.values.length;
448
448
  }
@@ -483,12 +483,12 @@ var JsChunker = (_class2 = class {
483
483
  }
484
484
  };
485
485
  }
486
- }, _class2);
487
- var WasmChunker = (_class3 = class {
488
- __init9() {this.engine = "wasm"}
489
- __init10() {this.fallbackUsed = false}
490
-
491
- constructor(maxChunkSize) {;_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);
486
+ };
487
+ var WasmChunker = class {
488
+ engine = "wasm";
489
+ fallbackUsed = false;
490
+ inner;
491
+ constructor(maxChunkSize) {
492
492
  const Ctor = resolveWasmChunkBuffer();
493
493
  if (!Ctor) {
494
494
  throw new Error("brass-runtime wasm chunk buffer is not available. Run npm run build:wasm first.");
@@ -519,29 +519,29 @@ var WasmChunker = (_class3 = class {
519
519
  stats() {
520
520
  return { engine: "wasm", fallbackUsed: false, data: JSON.parse(this.inner.stats_json()) };
521
521
  }
522
- }, _class3);
522
+ };
523
523
  function makeStreamChunker(chunkSize, options = {}) {
524
524
  const size = Math.max(1, chunkSize | 0);
525
- const engine = _nullishCoalesce(options.engine, () => ( "auto"));
525
+ const engine = options.engine ?? "auto";
526
526
  if (engine === "js") return new JsChunker(size, false);
527
527
  if (engine === "wasm") return new WasmChunker(size);
528
528
  return resolveWasmChunkBuffer() ? new WasmChunker(size) : new JsChunker(size, true);
529
529
  }
530
530
  function chunks(input, chunkSize, options = {}) {
531
531
  const size = Math.max(1, chunkSize | 0);
532
- const loop = (cur) => _chunk3IF374MGjs.fromPull.call(void 0, fillChunk(cur, makeStreamChunker(size, options)));
533
- const fillChunk = (cur, chunker) => _chunkTGOMLZ65js.asyncFold.call(void 0,
534
- _chunk3IF374MGjs.uncons.call(void 0, cur),
532
+ const loop = (cur) => fromPull(fillChunk(cur, makeStreamChunker(size, options)));
533
+ const fillChunk = (cur, chunker) => asyncFold(
534
+ uncons(cur),
535
535
  (opt) => {
536
536
  if (opt._tag === "None" && !chunker.isEmpty()) {
537
- return _chunkTGOMLZ65js.asyncSucceed.call(void 0, [chunker.takeChunk(), _chunk3IF374MGjs.fromPull.call(void 0, _chunkTGOMLZ65js.asyncFail.call(void 0, _chunkTGOMLZ65js.none))]);
537
+ return asyncSucceed([chunker.takeChunk(), fromPull(asyncFail(none))]);
538
538
  }
539
- return _chunkTGOMLZ65js.asyncFail.call(void 0, opt);
539
+ return asyncFail(opt);
540
540
  },
541
541
  ([a, tail]) => {
542
542
  chunker.push(a);
543
543
  if (chunker.isFull()) {
544
- return _chunkTGOMLZ65js.asyncSucceed.call(void 0, [chunker.takeChunk(), loop(tail)]);
544
+ return asyncSucceed([chunker.takeChunk(), loop(tail)]);
545
545
  }
546
546
  return fillChunk(tail, chunker);
547
547
  }
@@ -552,15 +552,15 @@ function mapChunks(input, chunkSize, f, options = {}) {
552
552
  const pullOne = (pending, rest) => {
553
553
  if (pending.length > 0) {
554
554
  const [head, ...tail] = pending;
555
- return _chunk3IF374MGjs.fromPull.call(void 0, _chunkTGOMLZ65js.asyncSucceed.call(void 0, [head, pullOne(tail, rest)]));
555
+ return fromPull(asyncSucceed([head, pullOne(tail, rest)]));
556
556
  }
557
- return _chunk3IF374MGjs.fromPull.call(void 0,
558
- _chunkTGOMLZ65js.asyncFold.call(void 0,
559
- _chunk3IF374MGjs.uncons.call(void 0, rest),
560
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
557
+ return fromPull(
558
+ asyncFold(
559
+ uncons(rest),
560
+ (opt) => asyncFail(opt),
561
561
  ([chunk, tail]) => {
562
562
  const mapped = f(chunk);
563
- return _chunk3IF374MGjs.uncons.call(void 0, pullOne(mapped, tail));
563
+ return uncons(pullOne(mapped, tail));
564
564
  }
565
565
  )
566
566
  );
@@ -573,16 +573,16 @@ function mapChunksEffect(chunkSize, f, options = {}) {
573
573
  const pullOne = (pending, rest) => {
574
574
  if (pending.length > 0) {
575
575
  const [head, ...tail] = pending;
576
- return _chunk3IF374MGjs.fromPull.call(void 0, _chunkTGOMLZ65js.asyncSucceed.call(void 0, [head, pullOne(tail, rest)]));
576
+ return fromPull(asyncSucceed([head, pullOne(tail, rest)]));
577
577
  }
578
- return _chunk3IF374MGjs.fromPull.call(void 0,
579
- _chunkTGOMLZ65js.asyncFold.call(void 0,
580
- _chunkTGOMLZ65js.asyncMapError.call(void 0, _chunk3IF374MGjs.uncons.call(void 0, rest), (opt) => _chunk3IF374MGjs.widenOpt.call(void 0, opt)),
581
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
582
- ([chunk, tail]) => _chunkTGOMLZ65js.asyncFold.call(void 0,
583
- _chunkTGOMLZ65js.asyncMapError.call(void 0, f(chunk), (e) => ({ _tag: "Some", value: e })),
584
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
585
- (mapped) => _chunk3IF374MGjs.uncons.call(void 0, pullOne(mapped, tail))
578
+ return fromPull(
579
+ asyncFold(
580
+ asyncMapError(uncons(rest), (opt) => widenOpt(opt)),
581
+ (opt) => asyncFail(opt),
582
+ ([chunk, tail]) => asyncFold(
583
+ asyncMapError(f(chunk), (e) => ({ _tag: "Some", value: e })),
584
+ (opt) => asyncFail(opt),
585
+ (mapped) => uncons(pullOne(mapped, tail))
586
586
  )
587
587
  )
588
588
  );
@@ -606,35 +606,35 @@ function identity() {
606
606
  }
607
607
  function mapP(f) {
608
608
  return ((input) => {
609
- const onError = (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt);
610
- const onSuccess = ([a, tail]) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, [f(a), loop(tail)]);
611
- const loop = (cur) => _chunk3IF374MGjs.fromPull.call(void 0,
612
- _chunkTGOMLZ65js.asyncFold.call(void 0, _chunk3IF374MGjs.uncons.call(void 0, cur), onError, onSuccess)
609
+ const onError = (opt) => asyncFail(opt);
610
+ const onSuccess = ([a, tail]) => asyncSucceed([f(a), loop(tail)]);
611
+ const loop = (cur) => fromPull(
612
+ asyncFold(uncons(cur), onError, onSuccess)
613
613
  );
614
614
  return loop(input);
615
615
  });
616
616
  }
617
617
  function filterP(pred) {
618
618
  return ((input) => {
619
- const onError = (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt);
620
- const onSuccess = ([a, tail]) => pred(a) ? _chunkTGOMLZ65js.asyncSucceed.call(void 0, [a, loop(tail)]) : next(tail);
621
- const next = (cur) => _chunkTGOMLZ65js.asyncFold.call(void 0, _chunk3IF374MGjs.uncons.call(void 0, cur), onError, onSuccess);
622
- const loop = (cur) => _chunk3IF374MGjs.fromPull.call(void 0, next(cur));
619
+ const onError = (opt) => asyncFail(opt);
620
+ const onSuccess = ([a, tail]) => pred(a) ? asyncSucceed([a, loop(tail)]) : next(tail);
621
+ const next = (cur) => asyncFold(uncons(cur), onError, onSuccess);
622
+ const loop = (cur) => fromPull(next(cur));
623
623
  return loop(input);
624
624
  });
625
625
  }
626
626
  function filterMapP(f) {
627
627
  return ((input) => {
628
- const onError = (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt);
629
- const next = (cur) => _chunkTGOMLZ65js.asyncFold.call(void 0,
630
- _chunk3IF374MGjs.uncons.call(void 0, cur),
628
+ const onError = (opt) => asyncFail(opt);
629
+ const next = (cur) => asyncFold(
630
+ uncons(cur),
631
631
  onError,
632
632
  ([a, tail]) => {
633
633
  const ob = f(a);
634
- return ob._tag === "Some" ? _chunkTGOMLZ65js.asyncSucceed.call(void 0, [ob.value, loop(tail)]) : next(tail);
634
+ return ob._tag === "Some" ? asyncSucceed([ob.value, loop(tail)]) : next(tail);
635
635
  }
636
636
  );
637
- const loop = (cur) => _chunk3IF374MGjs.fromPull.call(void 0, next(cur));
637
+ const loop = (cur) => fromPull(next(cur));
638
638
  return loop(input);
639
639
  });
640
640
  }
@@ -642,12 +642,12 @@ function takeP(n) {
642
642
  const m = Math.max(0, n | 0);
643
643
  return ((input) => {
644
644
  const loop = (cur, remaining) => {
645
- if (remaining <= 0) return _chunk3IF374MGjs.emptyStream.call(void 0, );
646
- return _chunk3IF374MGjs.fromPull.call(void 0,
647
- _chunkTGOMLZ65js.asyncFold.call(void 0,
648
- _chunk3IF374MGjs.uncons.call(void 0, cur),
649
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
650
- ([a, tail]) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, [a, loop(tail, remaining - 1)])
645
+ if (remaining <= 0) return emptyStream();
646
+ return fromPull(
647
+ asyncFold(
648
+ uncons(cur),
649
+ (opt) => asyncFail(opt),
650
+ ([a, tail]) => asyncSucceed([a, loop(tail, remaining - 1)])
651
651
  )
652
652
  );
653
653
  };
@@ -659,11 +659,11 @@ function dropP(n) {
659
659
  return ((input) => {
660
660
  const skip = (cur, remaining) => {
661
661
  if (remaining <= 0) return cur;
662
- return _chunk3IF374MGjs.fromPull.call(void 0,
663
- _chunkTGOMLZ65js.asyncFold.call(void 0,
664
- _chunk3IF374MGjs.uncons.call(void 0, cur),
665
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
666
- ([_a, tail]) => _chunk3IF374MGjs.uncons.call(void 0, skip(tail, remaining - 1))
662
+ return fromPull(
663
+ asyncFold(
664
+ uncons(cur),
665
+ (opt) => asyncFail(opt),
666
+ ([_a, tail]) => uncons(skip(tail, remaining - 1))
667
667
  )
668
668
  );
669
669
  };
@@ -672,19 +672,19 @@ function dropP(n) {
672
672
  }
673
673
  function mapEffectP(f) {
674
674
  return ((input) => {
675
- const raiseToOpt = (fa) => _chunkTGOMLZ65js.asyncMapError.call(void 0, fa, (e) => _chunkTGOMLZ65js.some.call(void 0, e));
676
- const loop = (cur) => _chunk3IF374MGjs.fromPull.call(void 0,
677
- _chunkTGOMLZ65js.asyncFold.call(void 0,
678
- _chunkTGOMLZ65js.asyncMapError.call(void 0,
679
- _chunk3IF374MGjs.uncons.call(void 0, cur),
680
- (opt) => _chunk3IF374MGjs.widenOpt.call(void 0, opt)
675
+ const raiseToOpt = (fa) => asyncMapError(fa, (e) => some(e));
676
+ const loop = (cur) => fromPull(
677
+ asyncFold(
678
+ asyncMapError(
679
+ uncons(cur),
680
+ (opt) => widenOpt(opt)
681
681
  ),
682
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
683
- ([a, tail]) => _chunkTGOMLZ65js.asyncFold.call(void 0,
682
+ (opt) => asyncFail(opt),
683
+ ([a, tail]) => asyncFold(
684
684
  raiseToOpt(f(a)),
685
685
  // Async<Rp, ...>
686
- (opt2) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt2),
687
- (b) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, [b, loop(tail)])
686
+ (opt2) => asyncFail(opt2),
687
+ (b) => asyncSucceed([b, loop(tail)])
688
688
  )
689
689
  )
690
690
  );
@@ -692,7 +692,7 @@ function mapEffectP(f) {
692
692
  });
693
693
  }
694
694
  function tapEffectP(f) {
695
- return mapEffectP((a) => _chunkTGOMLZ65js.asyncFlatMap.call(void 0, f(a), () => _chunkTGOMLZ65js.asyncSucceed.call(void 0, a)));
695
+ return mapEffectP((a) => asyncFlatMap(f(a), () => asyncSucceed(a)));
696
696
  }
697
697
  function chunksP(chunkSize, options = {}) {
698
698
  return ((input) => chunks(input, chunkSize, options));
@@ -707,23 +707,23 @@ function groupedP(n) {
707
707
  const size = Math.max(1, n | 0);
708
708
  return ((input) => {
709
709
  const gather = (cur, remaining, acc) => {
710
- if (remaining <= 0) return _chunkTGOMLZ65js.asyncSucceed.call(void 0, { chunk: acc, rest: cur });
711
- return _chunkTGOMLZ65js.asyncFold.call(void 0,
712
- _chunk3IF374MGjs.uncons.call(void 0, cur),
710
+ if (remaining <= 0) return asyncSucceed({ chunk: acc, rest: cur });
711
+ return asyncFold(
712
+ uncons(cur),
713
713
  (opt) => {
714
- if (opt._tag === "None") return _chunkTGOMLZ65js.asyncSucceed.call(void 0, { chunk: acc, rest: _chunk3IF374MGjs.emptyStream.call(void 0, ) });
715
- return _chunkTGOMLZ65js.asyncFail.call(void 0, opt);
714
+ if (opt._tag === "None") return asyncSucceed({ chunk: acc, rest: emptyStream() });
715
+ return asyncFail(opt);
716
716
  },
717
717
  ([a, tail]) => gather(tail, remaining - 1, [...acc, a])
718
718
  );
719
719
  };
720
- const loop = (cur) => _chunk3IF374MGjs.fromPull.call(void 0,
721
- _chunkTGOMLZ65js.asyncFold.call(void 0,
722
- _chunk3IF374MGjs.uncons.call(void 0, cur),
723
- (opt) => _chunkTGOMLZ65js.asyncFail.call(void 0, opt),
724
- ([a, tail]) => _chunkTGOMLZ65js.asyncFlatMap.call(void 0,
720
+ const loop = (cur) => fromPull(
721
+ asyncFold(
722
+ uncons(cur),
723
+ (opt) => asyncFail(opt),
724
+ ([a, tail]) => asyncFlatMap(
725
725
  gather(tail, size - 1, [a]),
726
- ({ chunk, rest }) => _chunkTGOMLZ65js.asyncSucceed.call(void 0, [chunk, loop(rest)])
726
+ ({ chunk, rest }) => asyncSucceed([chunk, loop(rest)])
727
727
  )
728
728
  )
729
729
  );
@@ -738,118 +738,118 @@ function engineStats(engine, data, fallbackUsed = false) {
738
738
  function selectedEngineStats(requested, engine, data) {
739
739
  return { requested, engine, data, fallbackUsed: requested === "auto" && engine !== "wasm" };
740
740
  }
741
-
742
-
743
-
744
-
745
-
746
-
747
-
748
-
749
-
750
-
751
-
752
-
753
-
754
-
755
-
756
-
757
-
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
-
775
-
776
-
777
-
778
-
779
-
780
-
781
-
782
-
783
-
784
-
785
-
786
-
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
-
800
-
801
-
802
-
803
-
804
-
805
-
806
-
807
-
808
-
809
-
810
-
811
-
812
-
813
-
814
-
815
-
816
-
817
-
818
-
819
-
820
-
821
-
822
-
823
-
824
-
825
-
826
-
827
-
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
-
845
-
846
-
847
-
848
-
849
-
850
-
851
-
852
-
853
-
854
-
855
- exports.Async = _chunkTGOMLZ65js.Async; exports.Cause = _chunkTGOMLZ65js.Cause; exports.DefaultHostExecutor = _chunkTGOMLZ65js.DefaultHostExecutor; exports.EngineFiberHandle = _chunkTGOMLZ65js.EngineFiberHandle; exports.Exit = _chunkTGOMLZ65js.Exit; exports.HostRegistry = _chunkTGOMLZ65js.HostRegistry; exports.JsFiberEngine = _chunkTGOMLZ65js.JsFiberEngine; exports.NoopHooks = _chunkTGOMLZ65js.NoopHooks; exports.ProgramBuilder = _chunkTGOMLZ65js.ProgramBuilder; exports.PushStatus = _chunkTGOMLZ65js.PushStatus; exports.ReferenceWasmBridge = _chunkTGOMLZ65js.ReferenceWasmBridge; exports.RingBuffer = _chunkTGOMLZ65js.RingBuffer; exports.Runtime = _chunkTGOMLZ65js.Runtime; exports.RuntimeFiber = _chunkTGOMLZ65js.RuntimeFiber; exports.Scheduler = _chunkTGOMLZ65js.Scheduler; exports.Scope = _chunkTGOMLZ65js.Scope; exports.WasmFiberEngine = _chunkTGOMLZ65js.WasmFiberEngine; exports.WasmFiberRegistryBridge = _chunkTGOMLZ65js.WasmFiberRegistryBridge; exports.WasmPackFiberBridge = _chunkTGOMLZ65js.WasmPackFiberBridge; exports.acquireRelease = _chunkTGOMLZ65js.acquireRelease; exports.andThen = andThen; exports.assertNever = _chunk3IF374MGjs.assertNever; exports.async = _chunkTGOMLZ65js.async; exports.asyncCatchAll = _chunkTGOMLZ65js.asyncCatchAll; exports.asyncFail = _chunkTGOMLZ65js.asyncFail; exports.asyncFlatMap = _chunkTGOMLZ65js.asyncFlatMap; exports.asyncFold = _chunkTGOMLZ65js.asyncFold; exports.asyncInterruptible = _chunkTGOMLZ65js.asyncInterruptible; exports.asyncMap = _chunkTGOMLZ65js.asyncMap; exports.asyncMapError = _chunkTGOMLZ65js.asyncMapError; exports.asyncSucceed = _chunkTGOMLZ65js.asyncSucceed; exports.asyncSync = _chunkTGOMLZ65js.asyncSync; exports.asyncTotal = _chunkTGOMLZ65js.asyncTotal; exports.bounded = bounded; exports.broadcast = broadcast; exports.broadcastToHub = broadcastToHub; exports.buffer = buffer; exports.bufferP = bufferP; exports.catchAll = _chunkTGOMLZ65js.catchAll; exports.chunks = chunks; exports.chunksP = chunksP; exports.collectAllPar = _chunkTGOMLZ65js.collectAllPar; exports.collectStream = _chunk3IF374MGjs.collectStream; exports.compose = compose; exports.concatStream = _chunk3IF374MGjs.concatStream; exports.dropP = dropP; exports.emitStream = _chunk3IF374MGjs.emitStream; exports.emptyStream = _chunk3IF374MGjs.emptyStream; exports.end = _chunkTGOMLZ65js.end; exports.engineStats = engineStats; exports.fail = _chunkTGOMLZ65js.fail; exports.filterMapP = filterMapP; exports.filterP = filterP; exports.flatMap = _chunkTGOMLZ65js.flatMap; exports.flattenStream = _chunk3IF374MGjs.flattenStream; exports.foreachStream = _chunk3IF374MGjs.foreachStream; exports.fork = _chunkTGOMLZ65js.fork; exports.fromArray = _chunk3IF374MGjs.fromArray; exports.fromHub = fromHub; exports.fromPromiseAbortable = _chunkTGOMLZ65js.fromPromiseAbortable; exports.fromPull = _chunk3IF374MGjs.fromPull; exports.getBenchmarkBudget = _chunkTGOMLZ65js.getBenchmarkBudget; exports.getCurrentFiber = _chunkTGOMLZ65js.getCurrentFiber; exports.globalScheduler = _chunkTGOMLZ65js.globalScheduler; exports.groupedP = groupedP; exports.identity = identity; exports.linkAbortController = linkAbortController; exports.makeBoundedRingBuffer = _chunkTGOMLZ65js.makeBoundedRingBuffer; exports.makeCancelToken = makeCancelToken; exports.makeHub = makeHub; exports.makeStreamChunker = makeStreamChunker; exports.managedStream = _chunk3IF374MGjs.managedStream; exports.map = _chunkTGOMLZ65js.map; exports.mapAsync = _chunkTGOMLZ65js.mapAsync; exports.mapChunks = mapChunks; exports.mapChunksEffect = mapChunksEffect; exports.mapChunksEffectP = mapChunksEffectP; exports.mapEffectP = mapEffectP; exports.mapError = _chunkTGOMLZ65js.mapError; exports.mapP = mapP; exports.mapStream = _chunk3IF374MGjs.mapStream; exports.mapTryAsync = _chunkTGOMLZ65js.mapTryAsync; exports.merge = _chunk3IF374MGjs.merge; exports.mergeStream = _chunk3IF374MGjs.mergeStream; exports.none = _chunkTGOMLZ65js.none; exports.orElseOptional = _chunkTGOMLZ65js.orElseOptional; exports.race = _chunkTGOMLZ65js.race; exports.raceWith = _chunkTGOMLZ65js.raceWith; exports.rangeStream = _chunk3IF374MGjs.rangeStream; exports.runtimeCapabilities = _chunkTGOMLZ65js.runtimeCapabilities; exports.selectedEngineStats = selectedEngineStats; exports.setBenchmarkBudget = _chunkTGOMLZ65js.setBenchmarkBudget; exports.some = _chunkTGOMLZ65js.some; exports.streamFromReadableStream = _chunk3IF374MGjs.streamFromReadableStream; exports.succeed = _chunkTGOMLZ65js.succeed; exports.sync = _chunkTGOMLZ65js.sync; exports.takeP = takeP; exports.tapEffectP = tapEffectP; exports.toPromise = _chunkTGOMLZ65js.toPromise; exports.uncons = _chunk3IF374MGjs.uncons; exports.unit = _chunkTGOMLZ65js.unit; exports.unsafeGetCurrentRuntime = _chunkTGOMLZ65js.unsafeGetCurrentRuntime; exports.unsafeRunAsync = _chunkTGOMLZ65js.unsafeRunAsync; exports.unsafeRunFoldWithEnv = _chunkTGOMLZ65js.unsafeRunFoldWithEnv; exports.unwrapScoped = _chunk3IF374MGjs.unwrapScoped; exports.via = via; exports.widenOpt = _chunk3IF374MGjs.widenOpt; exports.withAsyncPromise = _chunkTGOMLZ65js.withAsyncPromise; exports.withCurrentFiber = _chunkTGOMLZ65js.withCurrentFiber; exports.withScope = _chunkTGOMLZ65js.withScope; exports.withScopeAsync = _chunkTGOMLZ65js.withScopeAsync; exports.zip = _chunk3IF374MGjs.zip; exports.zipPar = _chunkTGOMLZ65js.zipPar;
741
+ export {
742
+ Async,
743
+ Cause,
744
+ DefaultHostExecutor,
745
+ EngineFiberHandle,
746
+ Exit,
747
+ HostRegistry,
748
+ JsFiberEngine,
749
+ NoopHooks,
750
+ ProgramBuilder,
751
+ PushStatus,
752
+ ReferenceWasmBridge,
753
+ RingBuffer,
754
+ Runtime,
755
+ RuntimeFiber,
756
+ Scheduler,
757
+ Scope,
758
+ WasmFiberEngine,
759
+ WasmFiberRegistryBridge,
760
+ WasmPackFiberBridge,
761
+ acquireRelease,
762
+ andThen,
763
+ assertNever,
764
+ async,
765
+ asyncCatchAll,
766
+ asyncFail,
767
+ asyncFlatMap,
768
+ asyncFold,
769
+ asyncInterruptible,
770
+ asyncMap,
771
+ asyncMapError,
772
+ asyncSucceed,
773
+ asyncSync,
774
+ asyncTotal,
775
+ bounded,
776
+ broadcast,
777
+ broadcastToHub,
778
+ buffer,
779
+ bufferP,
780
+ catchAll,
781
+ chunks,
782
+ chunksP,
783
+ collectAllPar,
784
+ collectStream,
785
+ compose,
786
+ concatStream,
787
+ dropP,
788
+ emitStream,
789
+ emptyStream,
790
+ end,
791
+ engineStats,
792
+ fail,
793
+ filterMapP,
794
+ filterP,
795
+ flatMap,
796
+ flattenStream,
797
+ foreachStream,
798
+ fork,
799
+ fromArray,
800
+ fromHub,
801
+ fromPromiseAbortable,
802
+ fromPull,
803
+ getBenchmarkBudget,
804
+ getCurrentFiber,
805
+ globalScheduler,
806
+ groupedP,
807
+ identity,
808
+ linkAbortController,
809
+ makeBoundedRingBuffer,
810
+ makeCancelToken,
811
+ makeHub,
812
+ makeStreamChunker,
813
+ managedStream,
814
+ map,
815
+ mapAsync,
816
+ mapChunks,
817
+ mapChunksEffect,
818
+ mapChunksEffectP,
819
+ mapEffectP,
820
+ mapError,
821
+ mapP,
822
+ mapStream,
823
+ mapTryAsync,
824
+ merge,
825
+ mergeStream,
826
+ none,
827
+ orElseOptional,
828
+ race,
829
+ raceWith,
830
+ rangeStream,
831
+ runtimeCapabilities,
832
+ selectedEngineStats,
833
+ setBenchmarkBudget,
834
+ some,
835
+ streamFromReadableStream,
836
+ succeed,
837
+ sync,
838
+ takeP,
839
+ tapEffectP,
840
+ toPromise,
841
+ uncons,
842
+ unit,
843
+ unsafeGetCurrentRuntime,
844
+ unsafeRunAsync,
845
+ unsafeRunFoldWithEnv,
846
+ unwrapScoped,
847
+ via,
848
+ widenOpt,
849
+ withAsyncPromise,
850
+ withCurrentFiber,
851
+ withScope,
852
+ withScopeAsync,
853
+ zip,
854
+ zipPar
855
+ };