effect 3.6.5 → 3.6.7
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/cjs/Stream.js +10 -10
- package/dist/cjs/internal/configProvider.js +1 -1
- package/dist/cjs/internal/configProvider.js.map +1 -1
- package/dist/cjs/internal/core.js +1 -14
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/stream.js +10 -10
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Stream.d.ts +28 -28
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/esm/Stream.js +10 -10
- package/dist/esm/internal/configProvider.js +1 -1
- package/dist/esm/internal/configProvider.js.map +1 -1
- package/dist/esm/internal/core.js +1 -13
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/stream.js +10 -10
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Stream.ts +49 -49
- package/src/internal/configProvider.ts +1 -1
- package/src/internal/core.ts +2 -17
- package/src/internal/fiberRuntime.ts +2 -2
- package/src/internal/stream.ts +134 -134
- package/src/internal/version.ts +1 -1
|
@@ -461,13 +461,13 @@ export const concat = /*#__PURE__*/dual(2, (self, that) => new StreamImpl(pipe(t
|
|
|
461
461
|
/** @internal */
|
|
462
462
|
export const concatAll = streams => suspend(() => pipe(streams, Chunk.reduce(empty, (x, y) => concat(y)(x))));
|
|
463
463
|
/** @internal */
|
|
464
|
-
export const cross = /*#__PURE__*/dual(2, (
|
|
464
|
+
export const cross = /*#__PURE__*/dual(2, (left, right) => pipe(left, crossWith(right, (a, a2) => [a, a2])));
|
|
465
465
|
/** @internal */
|
|
466
|
-
export const crossLeft = /*#__PURE__*/dual(2, (
|
|
466
|
+
export const crossLeft = /*#__PURE__*/dual(2, (left, right) => pipe(left, crossWith(right, (a, _) => a)));
|
|
467
467
|
/** @internal */
|
|
468
|
-
export const crossRight = /*#__PURE__*/dual(2, (
|
|
468
|
+
export const crossRight = /*#__PURE__*/dual(2, (left, right) => flatMap(left, () => right));
|
|
469
469
|
/** @internal */
|
|
470
|
-
export const crossWith = /*#__PURE__*/dual(3, (
|
|
470
|
+
export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => pipe(left, flatMap(a => pipe(right, map(b => f(a, b))))));
|
|
471
471
|
/** @internal */
|
|
472
472
|
export const debounce = /*#__PURE__*/dual(2, (self, duration) => pipe(singleProducerAsyncInput.make(), Effect.flatMap(input => Effect.transplant(grafter => pipe(Handoff.make(), Effect.map(handoff => {
|
|
473
473
|
const enqueue = last => pipe(Clock.sleep(duration), Effect.as(last), Effect.fork, grafter, Effect.map(fiber => consumer(DebounceState.previous(fiber))));
|
|
@@ -2533,7 +2533,7 @@ export const zipAllWith = /*#__PURE__*/dual(2, (self, options) => {
|
|
|
2533
2533
|
return combineChunks(self, options.other, ZipAllState.PullBoth, pull);
|
|
2534
2534
|
});
|
|
2535
2535
|
/** @internal */
|
|
2536
|
-
export const zipLatest = /*#__PURE__*/dual(2, (
|
|
2536
|
+
export const zipLatest = /*#__PURE__*/dual(2, (left, right) => pipe(left, zipLatestWith(right, (a, a2) => [a, a2])));
|
|
2537
2537
|
export const zipLatestAll = (...streams) => {
|
|
2538
2538
|
if (streams.length === 0) {
|
|
2539
2539
|
return empty;
|
|
@@ -2544,9 +2544,9 @@ export const zipLatestAll = (...streams) => {
|
|
|
2544
2544
|
return zipLatestWith(head, zipLatestAll(...tail), (first, second) => [first, ...second]);
|
|
2545
2545
|
};
|
|
2546
2546
|
/** @internal */
|
|
2547
|
-
export const zipLatestWith = /*#__PURE__*/dual(3, (
|
|
2547
|
+
export const zipLatestWith = /*#__PURE__*/dual(3, (left, right, f) => {
|
|
2548
2548
|
const pullNonEmpty = pull => pipe(pull, Effect.flatMap(chunk => Chunk.isEmpty(chunk) ? pullNonEmpty(pull) : Effect.succeed(chunk)));
|
|
2549
|
-
return pipe(toPull(
|
|
2549
|
+
return pipe(toPull(left), Effect.map(pullNonEmpty), Effect.zip(pipe(toPull(right), Effect.map(pullNonEmpty))), Effect.flatMap(([left, right]) => pipe(fromEffectOption(Effect.raceWith(left, right, {
|
|
2550
2550
|
onSelfDone: (leftDone, rightFiber) => pipe(Effect.suspend(() => leftDone), Effect.zipWith(Fiber.join(rightFiber), (l, r) => [l, r, true])),
|
|
2551
2551
|
onOtherDone: (rightDone, leftFiber) => pipe(Effect.suspend(() => rightDone), Effect.zipWith(Fiber.join(leftFiber), (l, r) => [r, l, false]))
|
|
2552
2552
|
})), flatMap(([l, r, leftFirst]) => pipe(fromEffect(Ref.make([Chunk.unsafeLast(l), Chunk.unsafeLast(r)])), flatMap(latest => pipe(fromChunk(leftFirst ? pipe(r, Chunk.map(a2 => f(Chunk.unsafeLast(l), a2))) : pipe(l, Chunk.map(a => f(a, Chunk.unsafeLast(r))))), concat(pipe(repeatEffectOption(left), mergeEither(repeatEffectOption(right)), mapEffectSequential(Either.match({
|
|
@@ -2555,21 +2555,21 @@ export const zipLatestWith = /*#__PURE__*/dual(3, (self, that, f) => {
|
|
|
2555
2555
|
})), flatMap(fromChunk))))))), toPull)), fromPull);
|
|
2556
2556
|
});
|
|
2557
2557
|
/** @internal */
|
|
2558
|
-
export const zipLeft = /*#__PURE__*/dual(2, (
|
|
2558
|
+
export const zipLeft = /*#__PURE__*/dual(2, (left, right) => pipe(left, zipWithChunks(right, (left, right) => {
|
|
2559
2559
|
if (left.length > right.length) {
|
|
2560
2560
|
return [pipe(left, Chunk.take(right.length)), Either.left(pipe(left, Chunk.take(right.length)))];
|
|
2561
2561
|
}
|
|
2562
2562
|
return [left, Either.right(pipe(right, Chunk.drop(left.length)))];
|
|
2563
2563
|
})));
|
|
2564
2564
|
/** @internal */
|
|
2565
|
-
export const zipRight = /*#__PURE__*/dual(2, (
|
|
2565
|
+
export const zipRight = /*#__PURE__*/dual(2, (left, right) => pipe(left, zipWithChunks(right, (left, right) => {
|
|
2566
2566
|
if (left.length > right.length) {
|
|
2567
2567
|
return [right, Either.left(pipe(left, Chunk.take(right.length)))];
|
|
2568
2568
|
}
|
|
2569
2569
|
return [pipe(right, Chunk.take(left.length)), Either.right(pipe(right, Chunk.drop(left.length)))];
|
|
2570
2570
|
})));
|
|
2571
2571
|
/** @internal */
|
|
2572
|
-
export const zipWith = /*#__PURE__*/dual(3, (
|
|
2572
|
+
export const zipWith = /*#__PURE__*/dual(3, (left, right, f) => pipe(left, zipWithChunks(right, (leftChunk, rightChunk) => zipChunks(leftChunk, rightChunk, f))));
|
|
2573
2573
|
/** @internal */
|
|
2574
2574
|
export const zipWithChunks = /*#__PURE__*/dual(3, (self, that, f) => {
|
|
2575
2575
|
const pull = (state, pullLeft, pullRight) => {
|