@typed/fx 2.0.0-beta.6 → 2.0.0-beta.8
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/Fx/Fx.d.ts +9 -9
- package/dist/Fx/Fx.js +1 -1
- package/dist/Fx/TypeId.d.ts +3 -3
- package/dist/Fx/TypeId.js +2 -2
- package/dist/Fx/combinators/additive.d.ts +6 -6
- package/dist/Fx/combinators/additive.js +6 -6
- package/dist/Fx/combinators/catch.d.ts +7 -7
- package/dist/Fx/combinators/catch.js +7 -7
- package/dist/Fx/combinators/causes.d.ts +1 -1
- package/dist/Fx/combinators/causes.js +1 -1
- package/dist/Fx/combinators/changesWithEffect.d.ts +1 -1
- package/dist/Fx/combinators/changesWithEffect.js +1 -1
- package/dist/Fx/combinators/compact.d.ts +1 -1
- package/dist/Fx/combinators/compact.js +1 -1
- package/dist/Fx/combinators/concatMap.d.ts +2 -2
- package/dist/Fx/combinators/concatMap.js +2 -2
- package/dist/Fx/combinators/continueWith.d.ts +4 -4
- package/dist/Fx/combinators/continueWith.js +4 -4
- package/dist/Fx/combinators/debounce.d.ts +2 -2
- package/dist/Fx/combinators/debounce.d.ts.map +1 -1
- package/dist/Fx/combinators/debounce.js +1 -1
- package/dist/Fx/combinators/delay.d.ts +9 -7
- package/dist/Fx/combinators/delay.d.ts.map +1 -1
- package/dist/Fx/combinators/delay.js +8 -6
- package/dist/Fx/combinators/dropUntil.d.ts +2 -2
- package/dist/Fx/combinators/dropUntil.js +2 -2
- package/dist/Fx/combinators/during.d.ts +1 -1
- package/dist/Fx/combinators/during.js +1 -1
- package/dist/Fx/combinators/ensuring.d.ts +1 -1
- package/dist/Fx/combinators/ensuring.js +1 -1
- package/dist/Fx/combinators/exhaustLatestMap.d.ts +1 -1
- package/dist/Fx/combinators/exhaustLatestMap.js +1 -1
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +1 -1
- package/dist/Fx/combinators/exhaustLatestMapEffect.js +1 -1
- package/dist/Fx/combinators/exhaustMap.d.ts +1 -1
- package/dist/Fx/combinators/exhaustMap.js +1 -1
- package/dist/Fx/combinators/exhaustMapEffect.d.ts +1 -1
- package/dist/Fx/combinators/exhaustMapEffect.js +1 -1
- package/dist/Fx/combinators/exit.d.ts +1 -1
- package/dist/Fx/combinators/exit.js +1 -1
- package/dist/Fx/combinators/filter.d.ts +1 -1
- package/dist/Fx/combinators/filter.js +1 -1
- package/dist/Fx/combinators/filterEffect.d.ts +1 -1
- package/dist/Fx/combinators/filterEffect.js +1 -1
- package/dist/Fx/combinators/filterMap.d.ts +1 -1
- package/dist/Fx/combinators/filterMap.js +1 -1
- package/dist/Fx/combinators/filterMapEffect.d.ts +1 -1
- package/dist/Fx/combinators/filterMapEffect.js +1 -1
- package/dist/Fx/combinators/filterMapLoop.d.ts +1 -1
- package/dist/Fx/combinators/filterMapLoop.js +1 -1
- package/dist/Fx/combinators/filterMapLoopCause.d.ts +1 -1
- package/dist/Fx/combinators/filterMapLoopCause.js +1 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +1 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.js +1 -1
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts +1 -1
- package/dist/Fx/combinators/filterMapLoopEffect.js +1 -1
- package/dist/Fx/combinators/flatMap.d.ts +2 -2
- package/dist/Fx/combinators/flatMap.js +1 -1
- package/dist/Fx/combinators/flatMapConcurrently.d.ts +1 -1
- package/dist/Fx/combinators/flatMapConcurrently.js +1 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +1 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +1 -1
- package/dist/Fx/combinators/flatMapEffect.d.ts +2 -2
- package/dist/Fx/combinators/flatMapEffect.js +1 -1
- package/dist/Fx/combinators/flip.d.ts +1 -1
- package/dist/Fx/combinators/flip.js +1 -1
- package/dist/Fx/combinators/gen.d.ts +1 -1
- package/dist/Fx/combinators/gen.js +1 -1
- package/dist/Fx/combinators/genScoped.d.ts +1 -1
- package/dist/Fx/combinators/genScoped.js +1 -1
- package/dist/Fx/combinators/grouped.d.ts +2 -2
- package/dist/Fx/combinators/grouped.js +2 -2
- package/dist/Fx/combinators/keyed.d.ts +2 -2
- package/dist/Fx/combinators/keyed.js +1 -1
- package/dist/Fx/combinators/loop.d.ts +1 -1
- package/dist/Fx/combinators/loop.js +1 -1
- package/dist/Fx/combinators/loopCause.d.ts +1 -1
- package/dist/Fx/combinators/loopCause.js +1 -1
- package/dist/Fx/combinators/loopCauseEffect.d.ts +1 -1
- package/dist/Fx/combinators/loopCauseEffect.js +1 -1
- package/dist/Fx/combinators/loopEffect.d.ts +1 -1
- package/dist/Fx/combinators/loopEffect.js +1 -1
- package/dist/Fx/combinators/map.d.ts +2 -2
- package/dist/Fx/combinators/map.js +2 -2
- package/dist/Fx/combinators/mapBoth.d.ts +1 -1
- package/dist/Fx/combinators/mapBoth.js +1 -1
- package/dist/Fx/combinators/mapEffect.d.ts +1 -1
- package/dist/Fx/combinators/mapEffect.js +1 -1
- package/dist/Fx/combinators/mapError.d.ts +1 -1
- package/dist/Fx/combinators/mapError.js +1 -1
- package/dist/Fx/combinators/mergeAll.d.ts +1 -1
- package/dist/Fx/combinators/mergeAll.js +1 -1
- package/dist/Fx/combinators/mergeOrdered.d.ts +1 -1
- package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeOrdered.js +33 -11
- package/dist/Fx/combinators/onError.d.ts +1 -1
- package/dist/Fx/combinators/onError.js +1 -1
- package/dist/Fx/combinators/onExit.d.ts +1 -1
- package/dist/Fx/combinators/onExit.js +1 -1
- package/dist/Fx/combinators/onInterrupt.d.ts +1 -1
- package/dist/Fx/combinators/onInterrupt.js +1 -1
- package/dist/Fx/combinators/pairwise.d.ts +1 -1
- package/dist/Fx/combinators/pairwise.js +1 -1
- package/dist/Fx/combinators/provide.d.ts +4 -4
- package/dist/Fx/combinators/provide.js +4 -4
- package/dist/Fx/combinators/race.d.ts +2 -2
- package/dist/Fx/combinators/race.js +2 -2
- package/dist/Fx/combinators/repeat.d.ts +1 -1
- package/dist/Fx/combinators/repeat.js +1 -1
- package/dist/Fx/combinators/result.d.ts +1 -1
- package/dist/Fx/combinators/result.js +1 -1
- package/dist/Fx/combinators/retry.d.ts +1 -1
- package/dist/Fx/combinators/retry.js +1 -1
- package/dist/Fx/combinators/sample.d.ts +1 -1
- package/dist/Fx/combinators/sample.js +1 -1
- package/dist/Fx/combinators/scan.d.ts +2 -2
- package/dist/Fx/combinators/scan.js +2 -2
- package/dist/Fx/combinators/since.d.ts +1 -1
- package/dist/Fx/combinators/since.js +1 -1
- package/dist/Fx/combinators/skip.d.ts +2 -2
- package/dist/Fx/combinators/skip.js +2 -2
- package/dist/Fx/combinators/skipRepeats.d.ts +1 -1
- package/dist/Fx/combinators/skipRepeats.js +1 -1
- package/dist/Fx/combinators/skipRepeatsWith.d.ts +1 -1
- package/dist/Fx/combinators/skipRepeatsWith.js +1 -1
- package/dist/Fx/combinators/skipWhile.d.ts +4 -4
- package/dist/Fx/combinators/skipWhile.js +4 -4
- package/dist/Fx/combinators/slice.d.ts +3 -3
- package/dist/Fx/combinators/slice.js +2 -2
- package/dist/Fx/combinators/switchMap.d.ts +1 -1
- package/dist/Fx/combinators/switchMap.js +1 -1
- package/dist/Fx/combinators/switchMapEffect.d.ts +1 -1
- package/dist/Fx/combinators/switchMapEffect.js +1 -1
- package/dist/Fx/combinators/take.d.ts +2 -2
- package/dist/Fx/combinators/take.js +2 -2
- package/dist/Fx/combinators/takeUntil.d.ts +3 -3
- package/dist/Fx/combinators/takeUntil.js +3 -3
- package/dist/Fx/combinators/takeWhile.d.ts +2 -2
- package/dist/Fx/combinators/takeWhile.js +2 -2
- package/dist/Fx/combinators/tapEffect.d.ts +1 -1
- package/dist/Fx/combinators/tapEffect.js +1 -1
- package/dist/Fx/combinators/throttle.d.ts +3 -3
- package/dist/Fx/combinators/throttle.d.ts.map +1 -1
- package/dist/Fx/combinators/throttle.js +1 -1
- package/dist/Fx/combinators/timeout.d.ts +2 -2
- package/dist/Fx/combinators/timeout.js +2 -2
- package/dist/Fx/combinators/tuple.d.ts +2 -2
- package/dist/Fx/combinators/tuple.js +2 -2
- package/dist/Fx/combinators/until.d.ts +1 -1
- package/dist/Fx/combinators/until.js +1 -1
- package/dist/Fx/combinators/unwrap.d.ts +1 -1
- package/dist/Fx/combinators/unwrap.js +1 -1
- package/dist/Fx/combinators/unwrapScoped.d.ts +1 -1
- package/dist/Fx/combinators/unwrapScoped.js +1 -1
- package/dist/Fx/combinators/when.d.ts +2 -2
- package/dist/Fx/combinators/when.js +2 -2
- package/dist/Fx/combinators/withLatestFrom.d.ts +2 -2
- package/dist/Fx/combinators/withLatestFrom.js +2 -2
- package/dist/Fx/combinators/withSpan.d.ts +1 -1
- package/dist/Fx/combinators/withSpan.js +1 -1
- package/dist/Fx/combinators/zip.d.ts +4 -4
- package/dist/Fx/combinators/zip.js +4 -4
- package/dist/Fx/constructors/at.d.ts +1 -1
- package/dist/Fx/constructors/at.js +1 -1
- package/dist/Fx/constructors/die.d.ts +1 -1
- package/dist/Fx/constructors/die.js +1 -1
- package/dist/Fx/constructors/empty.d.ts +1 -1
- package/dist/Fx/constructors/empty.js +1 -1
- package/dist/Fx/constructors/fail.d.ts +1 -1
- package/dist/Fx/constructors/fail.js +1 -1
- package/dist/Fx/constructors/failCause.d.ts +1 -1
- package/dist/Fx/constructors/failCause.js +1 -1
- package/dist/Fx/constructors/fn.d.ts +4 -4
- package/dist/Fx/constructors/fn.js +1 -1
- package/dist/Fx/constructors/fromEffect.d.ts +2 -2
- package/dist/Fx/constructors/fromEffect.js +2 -2
- package/dist/Fx/constructors/fromFailures.d.ts +1 -1
- package/dist/Fx/constructors/fromFailures.js +1 -1
- package/dist/Fx/constructors/fromIterable.d.ts +1 -1
- package/dist/Fx/constructors/fromIterable.js +1 -1
- package/dist/Fx/constructors/fromSchedule.d.ts +6 -4
- package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -1
- package/dist/Fx/constructors/fromSchedule.js +6 -4
- package/dist/Fx/constructors/interrupt.d.ts +1 -1
- package/dist/Fx/constructors/interrupt.js +1 -1
- package/dist/Fx/constructors/make.d.ts +9 -7
- package/dist/Fx/constructors/make.d.ts.map +1 -1
- package/dist/Fx/constructors/make.js +8 -6
- package/dist/Fx/constructors/periodic.d.ts +1 -1
- package/dist/Fx/constructors/periodic.js +1 -1
- package/dist/Fx/constructors/succeed.d.ts +4 -4
- package/dist/Fx/constructors/succeed.js +4 -4
- package/dist/Fx/constructors/suspend.d.ts +1 -1
- package/dist/Fx/constructors/suspend.js +1 -1
- package/dist/Fx/constructors/sync.d.ts +1 -1
- package/dist/Fx/constructors/sync.js +1 -1
- package/dist/Fx/run/collect.d.ts +4 -4
- package/dist/Fx/run/collect.js +4 -4
- package/dist/Fx/run/first.d.ts +1 -1
- package/dist/Fx/run/first.js +1 -1
- package/dist/Fx/run/fork.d.ts +2 -2
- package/dist/Fx/run/fork.js +2 -2
- package/dist/Fx/run/observe.d.ts +7 -5
- package/dist/Fx/run/observe.d.ts.map +1 -1
- package/dist/Fx/run/observe.js +30 -15
- package/dist/Fx/run/runPromise.d.ts +2 -2
- package/dist/Fx/run/runPromise.js +2 -2
- package/dist/Fx/stream.d.ts +4 -4
- package/dist/Fx/stream.js +2 -2
- package/dist/Push/Push.d.ts +30 -30
- package/dist/Push/Push.js +26 -26
- package/dist/RefSubject/Hydration.d.ts +24 -24
- package/dist/RefSubject/Hydration.js +5 -5
- package/dist/RefSubject/RefArray.d.ts +31 -31
- package/dist/RefSubject/RefArray.js +30 -30
- package/dist/RefSubject/RefBigDecimal.d.ts +20 -20
- package/dist/RefSubject/RefBigDecimal.js +19 -19
- package/dist/RefSubject/RefBigInt.d.ts +15 -15
- package/dist/RefSubject/RefBigInt.js +14 -14
- package/dist/RefSubject/RefBoolean.d.ts +15 -15
- package/dist/RefSubject/RefBoolean.js +14 -14
- package/dist/RefSubject/RefCause.d.ts +11 -11
- package/dist/RefSubject/RefCause.js +10 -10
- package/dist/RefSubject/RefChunk.d.ts +37 -37
- package/dist/RefSubject/RefChunk.js +36 -36
- package/dist/RefSubject/RefDateTime.d.ts +11 -11
- package/dist/RefSubject/RefDateTime.js +10 -10
- package/dist/RefSubject/RefDuration.d.ts +14 -14
- package/dist/RefSubject/RefDuration.js +13 -13
- package/dist/RefSubject/RefGraph.d.ts +29 -29
- package/dist/RefSubject/RefGraph.js +28 -28
- package/dist/RefSubject/RefHashMap.d.ts +27 -27
- package/dist/RefSubject/RefHashMap.js +26 -26
- package/dist/RefSubject/RefHashRing.d.ts +13 -13
- package/dist/RefSubject/RefHashRing.js +12 -12
- package/dist/RefSubject/RefHashSet.d.ts +21 -21
- package/dist/RefSubject/RefHashSet.js +20 -20
- package/dist/RefSubject/RefIterable.d.ts +30 -30
- package/dist/RefSubject/RefIterable.js +29 -29
- package/dist/RefSubject/RefOption.d.ts +13 -13
- package/dist/RefSubject/RefOption.js +12 -12
- package/dist/RefSubject/RefRecord.d.ts +31 -31
- package/dist/RefSubject/RefRecord.js +30 -30
- package/dist/RefSubject/RefResult.d.ts +12 -12
- package/dist/RefSubject/RefResult.js +11 -11
- package/dist/RefSubject/RefString.d.ts +17 -17
- package/dist/RefSubject/RefString.js +16 -16
- package/dist/RefSubject/RefStruct.d.ts +13 -13
- package/dist/RefSubject/RefStruct.js +12 -12
- package/dist/RefSubject/RefSubject.d.ts +93 -94
- package/dist/RefSubject/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject/RefSubject.js +132 -77
- package/dist/RefSubject/RefTrie.d.ts +26 -26
- package/dist/RefSubject/RefTrie.js +25 -25
- package/dist/RefSubject/RefTuple.d.ts +11 -11
- package/dist/RefSubject/RefTuple.js +9 -9
- package/dist/Sink/Sink.d.ts +21 -19
- package/dist/Sink/Sink.d.ts.map +1 -1
- package/dist/Sink/Sink.js +5 -4
- package/dist/Sink/combinators.d.ts +33 -33
- package/dist/Sink/combinators.js +32 -32
- package/dist/Subject/Subject.d.ts +14 -13
- package/dist/Subject/Subject.d.ts.map +1 -1
- package/dist/Subject/Subject.js +11 -10
- package/dist/Versioned/Versioned.d.ts +31 -28
- package/dist/Versioned/Versioned.d.ts.map +1 -1
- package/dist/Versioned/Versioned.js +45 -37
- package/package.json +5 -4
|
@@ -25,6 +25,6 @@ import { make } from "../constructors/make.js";
|
|
|
25
25
|
* @param f - The loop function for causes.
|
|
26
26
|
* @returns An `Fx` with transformed errors.
|
|
27
27
|
* @since 1.0.0
|
|
28
|
-
* @category
|
|
28
|
+
* @category Stateful transforms
|
|
29
29
|
*/
|
|
30
30
|
export const loopCause = dual(3, (self, seed, f) => make((sink) => self.run(sinkCore.loopCause(sink, seed, f))));
|
|
@@ -26,7 +26,7 @@ import type { Fx } from "../Fx.js";
|
|
|
26
26
|
* @param f - The effectful loop function for causes.
|
|
27
27
|
* @returns An `Fx` with transformed errors.
|
|
28
28
|
* @since 1.0.0
|
|
29
|
-
* @category
|
|
29
|
+
* @category Stateful transforms
|
|
30
30
|
*/
|
|
31
31
|
export declare const loopCauseEffect: {
|
|
32
32
|
<B, A, E, R2, C>(seed: B, f: (acc: B, a: Cause.Cause<A>) => Effect.Effect<readonly [Cause.Cause<C>, B], R2>): <R>(self: Fx<A, E, R>) => Fx<A, C | E, R | R2>;
|
|
@@ -26,6 +26,6 @@ import { make } from "../constructors/make.js";
|
|
|
26
26
|
* @param f - The effectful loop function for causes.
|
|
27
27
|
* @returns An `Fx` with transformed errors.
|
|
28
28
|
* @since 1.0.0
|
|
29
|
-
* @category
|
|
29
|
+
* @category Stateful transforms
|
|
30
30
|
*/
|
|
31
31
|
export const loopCauseEffect = dual(3, (self, seed, f) => make((sink) => self.run(sinkCore.loopCauseEffect(sink, seed, f))));
|
|
@@ -30,7 +30,7 @@ import type { Fx } from "../Fx.js";
|
|
|
30
30
|
* @param f - The effectful loop function.
|
|
31
31
|
* @returns An `Fx` emitting the transformed values.
|
|
32
32
|
* @since 1.0.0
|
|
33
|
-
* @category
|
|
33
|
+
* @category Stateful transforms
|
|
34
34
|
*/
|
|
35
35
|
export declare const loopEffect: {
|
|
36
36
|
<B, A, E2, R2, C>(seed: B, f: (acc: B, a: A) => Effect.Effect<readonly [C, B], E2, R2>): <E, R>(self: Fx<A, E | E2, R>) => Fx<C, E | E2, R | R2>;
|
|
@@ -31,6 +31,6 @@ import { make } from "../constructors/make.js";
|
|
|
31
31
|
* @param f - The effectful loop function.
|
|
32
32
|
* @returns An `Fx` emitting the transformed values.
|
|
33
33
|
* @since 1.0.0
|
|
34
|
-
* @category
|
|
34
|
+
* @category Stateful transforms
|
|
35
35
|
*/
|
|
36
36
|
export const loopEffect = dual(3, (self, seed, f) => make((sink) => self.run(sinkCore.loopEffect(seed, f)(sink))));
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param f - A function that transforms values of type `A` to `B`.
|
|
23
23
|
* @returns An `Fx` that emits values of type `B`.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Transforming values
|
|
26
26
|
*/
|
|
27
27
|
export declare const map: {
|
|
28
28
|
<A, B>(f: (a: A) => B): <E, R>(self: Fx<A, E, R>) => Fx<B, E, R>;
|
|
@@ -50,7 +50,7 @@ export declare const map: {
|
|
|
50
50
|
* @param b - The value to emit instead.
|
|
51
51
|
* @returns An Fx that emits `b` for every element.
|
|
52
52
|
* @since 1.0.0
|
|
53
|
-
* @category
|
|
53
|
+
* @category Transforming values
|
|
54
54
|
*/
|
|
55
55
|
export declare const as: {
|
|
56
56
|
<B>(b: B): <A, E, R>(self: Fx<A, E, R>) => Fx<B, E, R>;
|
|
@@ -24,7 +24,7 @@ import { make } from "../constructors/make.js";
|
|
|
24
24
|
* @param f - A function that transforms values of type `A` to `B`.
|
|
25
25
|
* @returns An `Fx` that emits values of type `B`.
|
|
26
26
|
* @since 1.0.0
|
|
27
|
-
* @category
|
|
27
|
+
* @category Transforming values
|
|
28
28
|
*/
|
|
29
29
|
export const map = dual(2, (self, f) => make((sink) => self.run(sinkCore.map(sink, f))));
|
|
30
30
|
/**
|
|
@@ -49,6 +49,6 @@ export const map = dual(2, (self, f) => make((sink) => self.run(sinkCore.map(sin
|
|
|
49
49
|
* @param b - The value to emit instead.
|
|
50
50
|
* @returns An Fx that emits `b` for every element.
|
|
51
51
|
* @since 1.0.0
|
|
52
|
-
* @category
|
|
52
|
+
* @category Transforming values
|
|
53
53
|
*/
|
|
54
54
|
export const as = dual(2, (self, b) => map(self, () => b));
|
|
@@ -28,6 +28,6 @@ import { make } from "../constructors/make.js";
|
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
30
|
* @since 1.0.0
|
|
31
|
-
* @category
|
|
31
|
+
* @category Errors and recovery
|
|
32
32
|
*/
|
|
33
33
|
export const mapBoth = dual(2, (self, options) => make((sink) => self.run(makeSink((cause) => sink.onFailure(Cause.map(cause, options.onFailure)), (a) => sink.onSuccess(options.onSuccess(a))))));
|
|
@@ -30,7 +30,7 @@ import type { Fx } from "../Fx.js";
|
|
|
30
30
|
* @param f - A function that transforms values of type `A` to an Effect of `B`.
|
|
31
31
|
* @returns An `Fx` that emits values of type `B`.
|
|
32
32
|
* @since 1.0.0
|
|
33
|
-
* @category
|
|
33
|
+
* @category Transforming values
|
|
34
34
|
*/
|
|
35
35
|
export declare const mapEffect: {
|
|
36
36
|
<A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>): <E, R>(fx: Fx<A, E | E2, R>) => Fx<B, E | E2, R | R2>;
|
|
@@ -31,6 +31,6 @@ import { make } from "../constructors/make.js";
|
|
|
31
31
|
* @param f - A function that transforms values of type `A` to an Effect of `B`.
|
|
32
32
|
* @returns An `Fx` that emits values of type `B`.
|
|
33
33
|
* @since 1.0.0
|
|
34
|
-
* @category
|
|
34
|
+
* @category Transforming values
|
|
35
35
|
*/
|
|
36
36
|
export const mapEffect = dual(2, (self, f) => make((sink) => self.run(sinkCore.mapEffect(sink, f))));
|
|
@@ -27,6 +27,6 @@ import { make } from "../constructors/make.js";
|
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
29
|
* @since 1.0.0
|
|
30
|
-
* @category
|
|
30
|
+
* @category Errors and recovery
|
|
31
31
|
*/
|
|
32
32
|
export const mapError = dual(2, (self, f) => make((sink) => self.run(makeSink((cause) => sink.onFailure(Cause.map(cause, f)), sink.onSuccess))));
|
|
@@ -39,7 +39,7 @@ import type { Fx } from "../Fx.js";
|
|
|
39
39
|
* @param fx - The Fx streams to merge.
|
|
40
40
|
* @returns An `Fx` that emits values from all input streams.
|
|
41
41
|
* @since 1.0.0
|
|
42
|
-
* @category
|
|
42
|
+
* @category Combining sources
|
|
43
43
|
*/
|
|
44
44
|
export declare const mergeAll: <FX extends ReadonlyArray<Fx<any, any, any>>>(...fx: FX) => Fx<Fx.Success<FX[number]>, Fx.Error<FX[number]>, Fx.Services<FX[number]>>;
|
|
45
45
|
//# sourceMappingURL=mergeAll.d.ts.map
|
|
@@ -41,7 +41,7 @@ import { make } from "../constructors/make.js";
|
|
|
41
41
|
* @param fx - The Fx streams to merge.
|
|
42
42
|
* @returns An `Fx` that emits values from all input streams.
|
|
43
43
|
* @since 1.0.0
|
|
44
|
-
* @category
|
|
44
|
+
* @category Combining sources
|
|
45
45
|
*/
|
|
46
46
|
export const mergeAll = (...fx) => make((sink) => Effect.forEach(fx, (fx) => fx.run(skipInterrupt(sink)), {
|
|
47
47
|
concurrency: fx.length,
|
|
@@ -40,7 +40,7 @@ import type { Fx } from "../Fx.js";
|
|
|
40
40
|
* @param fx - The Fx streams to merge.
|
|
41
41
|
* @returns An `Fx` that emits values in order.
|
|
42
42
|
* @since 1.0.0
|
|
43
|
-
* @category
|
|
43
|
+
* @category Combining sources
|
|
44
44
|
*/
|
|
45
45
|
export declare function mergeOrdered<FX extends ReadonlyArray<Fx<any, any, any>>>(...fx: FX): Fx<Fx.Success<FX[number]>, Fx.Error<FX[number]>, Fx.Services<FX[number]>>;
|
|
46
46
|
//# sourceMappingURL=mergeOrdered.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeOrdered.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/mergeOrdered.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeOrdered.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/mergeOrdered.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EACtE,GAAG,EAAE,EAAE,EAAE,GACR,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAoB3E"}
|
|
@@ -2,6 +2,7 @@ import * as Cause from "effect/Cause";
|
|
|
2
2
|
import * as Deferred from "effect/Deferred";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Exit from "effect/Exit";
|
|
5
|
+
import * as Fiber from "effect/Fiber";
|
|
5
6
|
import * as Sink from "../../Sink/Sink.js";
|
|
6
7
|
import { make } from "../constructors/make.js";
|
|
7
8
|
/**
|
|
@@ -45,25 +46,31 @@ import { make } from "../constructors/make.js";
|
|
|
45
46
|
* @param fx - The Fx streams to merge.
|
|
46
47
|
* @returns An `Fx` that emits values in order.
|
|
47
48
|
* @since 1.0.0
|
|
48
|
-
* @category
|
|
49
|
+
* @category Combining sources
|
|
49
50
|
*/
|
|
50
51
|
export function mergeOrdered(...fx) {
|
|
51
52
|
return make(Effect.fn(function* (sink) {
|
|
52
|
-
const { makeSink, onEnd } = withBuffers(fx.length, sink);
|
|
53
|
-
|
|
53
|
+
const { makeSink, onEnd, discard } = withBuffers(fx.length, sink);
|
|
54
|
+
const run = Effect.forEach(fx, (fx, i) => Effect.onExit(fx.run(makeSink(i)), () => onEnd(i)), {
|
|
54
55
|
concurrency: "unbounded",
|
|
55
56
|
discard: true,
|
|
56
57
|
});
|
|
58
|
+
yield* Effect.acquireUseRelease(run.pipe(Effect.forkChild({ startImmediately: true })), Fiber.join, (fiber) => discard.pipe(Effect.andThen(Fiber.interrupt(fiber))));
|
|
57
59
|
}));
|
|
58
60
|
}
|
|
59
61
|
function withBuffers(size, sink) {
|
|
60
62
|
const buffers = indexedBuffers(size, sink);
|
|
61
63
|
const onSuccess = (index, value) => buffers.get(index).onSuccess(value);
|
|
62
64
|
const onEnd = (index) => buffers.get(index).onEnd;
|
|
65
|
+
const discard = Effect.sync(() => {
|
|
66
|
+
for (const buffer of buffers.values())
|
|
67
|
+
buffer.discard();
|
|
68
|
+
});
|
|
63
69
|
const makeSink = (index) => Sink.make((cause) => (Cause.hasInterruptsOnly(cause) ? onEnd(index) : sink.onFailure(cause)), (value) => onSuccess(index, value));
|
|
64
70
|
return {
|
|
65
71
|
onSuccess,
|
|
66
72
|
onEnd,
|
|
73
|
+
discard,
|
|
67
74
|
makeSink,
|
|
68
75
|
};
|
|
69
76
|
}
|
|
@@ -92,12 +99,16 @@ function indexedBuffers(size, sink) {
|
|
|
92
99
|
}
|
|
93
100
|
function IndexedBuffer(state, sink, onDone) {
|
|
94
101
|
let buffer = [];
|
|
102
|
+
let active = true;
|
|
103
|
+
const forward = (value) => Effect.suspend(() => (active ? sink.onSuccess(value) : Effect.void));
|
|
95
104
|
const onSuccess = (value) => {
|
|
105
|
+
if (!active)
|
|
106
|
+
return Effect.void;
|
|
96
107
|
if (state.ready) {
|
|
97
108
|
if (buffer.length === 0)
|
|
98
|
-
return
|
|
109
|
+
return forward(value);
|
|
99
110
|
buffer.push(value);
|
|
100
|
-
const effect = Effect.forEach(buffer,
|
|
111
|
+
const effect = Effect.forEach(buffer, forward);
|
|
101
112
|
buffer = [];
|
|
102
113
|
return effect;
|
|
103
114
|
}
|
|
@@ -106,16 +117,27 @@ function IndexedBuffer(state, sink, onDone) {
|
|
|
106
117
|
return Effect.void;
|
|
107
118
|
}
|
|
108
119
|
};
|
|
109
|
-
const onEnd = Effect.
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
const onEnd = Effect.suspend(() => {
|
|
121
|
+
if (!active)
|
|
122
|
+
return Effect.void;
|
|
123
|
+
return Effect.flatMap(Deferred.await(state.deferred), () => {
|
|
124
|
+
if (!active)
|
|
125
|
+
return Effect.void;
|
|
126
|
+
if (buffer.length === 0)
|
|
127
|
+
return onDone;
|
|
128
|
+
const effect = Effect.forEach(buffer, forward);
|
|
129
|
+
buffer = [];
|
|
130
|
+
return Effect.ensuring(effect, onDone);
|
|
131
|
+
});
|
|
115
132
|
});
|
|
116
133
|
return {
|
|
117
134
|
state,
|
|
118
135
|
onSuccess,
|
|
119
136
|
onEnd,
|
|
137
|
+
discard: () => {
|
|
138
|
+
active = false;
|
|
139
|
+
buffer = [];
|
|
140
|
+
Deferred.doneUnsafe(state.deferred, Exit.void);
|
|
141
|
+
},
|
|
120
142
|
};
|
|
121
143
|
}
|
|
@@ -38,7 +38,7 @@ import type { Fx } from "../Fx.js";
|
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
40
|
* @since 1.0.0
|
|
41
|
-
* @category
|
|
41
|
+
* @category Observing failures
|
|
42
42
|
*/
|
|
43
43
|
export declare const onError: {
|
|
44
44
|
<E, X, R2>(cleanup: (cause: Cause.Cause<E>) => Effect.Effect<X, never, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E, R | R2>;
|
|
@@ -39,6 +39,6 @@ import { make } from "../constructors/make.js";
|
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
41
41
|
* @since 1.0.0
|
|
42
|
-
* @category
|
|
42
|
+
* @category Observing failures
|
|
43
43
|
*/
|
|
44
44
|
export const onError = dual(2, (self, cleanup) => make((sink) => self.run(makeSink((cause) => Effect.flatMap(sink.onFailure(cause), () => Effect.ignore(cleanup(cause))), sink.onSuccess))));
|
|
@@ -33,7 +33,7 @@ import type { Fx } from "../Fx.js";
|
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
35
|
* @since 1.0.0
|
|
36
|
-
* @category
|
|
36
|
+
* @category Resource lifetime
|
|
37
37
|
*/
|
|
38
38
|
export declare const onExit: {
|
|
39
39
|
<A, E, XE = never, XR = never>(f: (exit: Exit.Exit<void, E>) => void | Effect.Effect<void, XE, XR>): <R>(self: Fx<A, E, R>) => Fx<A, E | XE, R | XR>;
|
|
@@ -41,7 +41,7 @@ const toFinalizer = (f) => (exit) => {
|
|
|
41
41
|
* ```
|
|
42
42
|
*
|
|
43
43
|
* @since 1.0.0
|
|
44
|
-
* @category
|
|
44
|
+
* @category Resource lifetime
|
|
45
45
|
*/
|
|
46
46
|
export const onExit = dual(2, (self, f) => make(Effect.fnUntraced(function* (sink) {
|
|
47
47
|
const finalizer = toFinalizer(f);
|
|
@@ -52,7 +52,7 @@ import type { Fx } from "../Fx.js";
|
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
54
|
* @since 1.0.0
|
|
55
|
-
* @category
|
|
55
|
+
* @category Resource lifetime
|
|
56
56
|
*/
|
|
57
57
|
export declare const onInterrupt: {
|
|
58
58
|
<XE, XR>(finalizer: Effect.Effect<void, XE, XR> | ((interruptors: ReadonlySet<number>) => Effect.Effect<void, XE, XR>)): <A, E, R>(self: Fx<A, E, R>) => Fx<A, E | XE, R | XR>;
|
|
@@ -58,7 +58,7 @@ const toFinalizer = (f) => (interruptors) => typeof f === "function" ? f(interru
|
|
|
58
58
|
* ```
|
|
59
59
|
*
|
|
60
60
|
* @since 1.0.0
|
|
61
|
-
* @category
|
|
61
|
+
* @category Resource lifetime
|
|
62
62
|
*/
|
|
63
63
|
export const onInterrupt = dual(2, (self, finalizer_) => make(Effect.fnUntraced(function* (sink) {
|
|
64
64
|
const finalizer = toFinalizer(finalizer_);
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Stateful transforms
|
|
26
26
|
*/
|
|
27
27
|
export declare const pairwise: <A, E = never, R = never>(self: Fx<A, E, R>) => Fx<readonly [A, A], E, R>;
|
|
28
28
|
//# sourceMappingURL=pairwise.d.ts.map
|
|
@@ -23,7 +23,7 @@ import { filterMapLoop } from "./filterMapLoop.js";
|
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
25
|
* @since 1.0.0
|
|
26
|
-
* @category
|
|
26
|
+
* @category Stateful transforms
|
|
27
27
|
*/
|
|
28
28
|
export const pairwise = (self) => filterMapLoop(self, Option.none(), (prev, a) => Option.match(prev, {
|
|
29
29
|
onNone: () => [Option.none(), Option.some(a)],
|
|
@@ -35,7 +35,7 @@ import type { Fx } from "../Fx.js";
|
|
|
35
35
|
* @param layer - The Layer to provide.
|
|
36
36
|
* @returns An `Fx` with the required context provided.
|
|
37
37
|
* @since 1.0.0
|
|
38
|
-
* @category
|
|
38
|
+
* @category Providing services
|
|
39
39
|
*/
|
|
40
40
|
export declare const provide: {
|
|
41
41
|
<R2, E2 = never, R3 = never>(layer: Layer.Layer<R2, E2, R3>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, R2> | R3>;
|
|
@@ -70,7 +70,7 @@ export declare const provide: {
|
|
|
70
70
|
* ```
|
|
71
71
|
*
|
|
72
72
|
* @since 1.0.0
|
|
73
|
-
* @category
|
|
73
|
+
* @category Providing services
|
|
74
74
|
*/
|
|
75
75
|
export declare const provideContext: {
|
|
76
76
|
<R2>(services: Context.Context<R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, Exclude<R, R2>>;
|
|
@@ -110,7 +110,7 @@ export declare const provideContext: {
|
|
|
110
110
|
* @param service - The service implementation.
|
|
111
111
|
* @returns An `Fx` with the required service provided.
|
|
112
112
|
* @since 1.0.0
|
|
113
|
-
* @category
|
|
113
|
+
* @category Providing services
|
|
114
114
|
*/
|
|
115
115
|
export declare const provideService: {
|
|
116
116
|
<Id, S>(tag: Context.Service<Id, S>, service: S): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, Exclude<R, Id>>;
|
|
@@ -168,7 +168,7 @@ export declare const provideService: {
|
|
|
168
168
|
* @param serviceEffect - Effect that produces the service (may have its own requirements).
|
|
169
169
|
* @returns An `Fx` with the required service provided.
|
|
170
170
|
* @since 1.0.0
|
|
171
|
-
* @category
|
|
171
|
+
* @category Providing services
|
|
172
172
|
*/
|
|
173
173
|
export declare const provideServiceEffect: {
|
|
174
174
|
<Id, S, E2, R2>(tag: Context.Service<Id, S>, serviceEffect: Effect.Effect<S, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, Exclude<R, Id> | R2>;
|
|
@@ -38,7 +38,7 @@ import { make } from "../constructors/make.js";
|
|
|
38
38
|
* @param layer - The Layer to provide.
|
|
39
39
|
* @returns An `Fx` with the required context provided.
|
|
40
40
|
* @since 1.0.0
|
|
41
|
-
* @category
|
|
41
|
+
* @category Providing services
|
|
42
42
|
*/
|
|
43
43
|
export const provide = dual(2, (fx, layer) => make(Effect.fnUntraced(function* (sink) {
|
|
44
44
|
const scope = yield* Scope.make();
|
|
@@ -78,7 +78,7 @@ export const provide = dual(2, (fx, layer) => make(Effect.fnUntraced(function* (
|
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
80
|
* @since 1.0.0
|
|
81
|
-
* @category
|
|
81
|
+
* @category Providing services
|
|
82
82
|
*/
|
|
83
83
|
export const provideContext = dual(2, (fx, services) => provide(fx, Layer.succeedContext(services)));
|
|
84
84
|
/**
|
|
@@ -115,7 +115,7 @@ export const provideContext = dual(2, (fx, services) => provide(fx, Layer.succee
|
|
|
115
115
|
* @param service - The service implementation.
|
|
116
116
|
* @returns An `Fx` with the required service provided.
|
|
117
117
|
* @since 1.0.0
|
|
118
|
-
* @category
|
|
118
|
+
* @category Providing services
|
|
119
119
|
*/
|
|
120
120
|
export const provideService = dual(3, (fx, tag, service) => provideContext(fx, Context.make(tag, service)));
|
|
121
121
|
/**
|
|
@@ -170,6 +170,6 @@ export const provideService = dual(3, (fx, tag, service) => provideContext(fx, C
|
|
|
170
170
|
* @param serviceEffect - Effect that produces the service (may have its own requirements).
|
|
171
171
|
* @returns An `Fx` with the required service provided.
|
|
172
172
|
* @since 1.0.0
|
|
173
|
-
* @category
|
|
173
|
+
* @category Providing services
|
|
174
174
|
*/
|
|
175
175
|
export const provideServiceEffect = dual(3, (fx, tag, serviceEffect) => provide(fx, Layer.effect(tag, serviceEffect)));
|
|
@@ -43,7 +43,7 @@ import type { Fx } from "../Fx.js";
|
|
|
43
43
|
* ```
|
|
44
44
|
*
|
|
45
45
|
* @since 1.0.0
|
|
46
|
-
* @category
|
|
46
|
+
* @category Concurrent work
|
|
47
47
|
*/
|
|
48
48
|
export declare const race: {
|
|
49
49
|
<AR, ER, RR>(that: Fx<AR, ER, RR>): <AL, EL, RL>(self: Fx<AL, EL, RL>) => Fx<AL | AR, EL | ER, RL | RR>;
|
|
@@ -86,7 +86,7 @@ export declare const race: {
|
|
|
86
86
|
* ```
|
|
87
87
|
*
|
|
88
88
|
* @since 1.0.0
|
|
89
|
-
* @category
|
|
89
|
+
* @category Concurrent work
|
|
90
90
|
*/
|
|
91
91
|
export declare const raceAll: <FX extends ReadonlyArray<Fx<any, any, any>>>(...fxs: FX) => Fx<Fx.Success<FX[number]>, Fx.Error<FX[number]>, Fx.Services<FX[number]>>;
|
|
92
92
|
//# sourceMappingURL=race.d.ts.map
|
|
@@ -51,7 +51,7 @@ import { make } from "../constructors/make.js";
|
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
53
|
* @since 1.0.0
|
|
54
|
-
* @category
|
|
54
|
+
* @category Concurrent work
|
|
55
55
|
*/
|
|
56
56
|
export const race = dual(2, (self, that) => raceAll(self, that));
|
|
57
57
|
/**
|
|
@@ -91,7 +91,7 @@ export const race = dual(2, (self, that) => raceAll(self, that));
|
|
|
91
91
|
* ```
|
|
92
92
|
*
|
|
93
93
|
* @since 1.0.0
|
|
94
|
-
* @category
|
|
94
|
+
* @category Concurrent work
|
|
95
95
|
*/
|
|
96
96
|
export const raceAll = (...fxs) => {
|
|
97
97
|
if (fxs.length === 0) {
|
|
@@ -32,7 +32,7 @@ import type { Fx } from "../Fx.js";
|
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
34
|
* @since 1.0.0
|
|
35
|
-
* @category
|
|
35
|
+
* @category Time and rate
|
|
36
36
|
*/
|
|
37
37
|
export declare const repeat: {
|
|
38
38
|
<X, E2, R2>(schedule: Schedule.Schedule<X, void, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -37,7 +37,7 @@ import { make } from "../constructors/make.js";
|
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
39
|
* @since 1.0.0
|
|
40
|
-
* @category
|
|
40
|
+
* @category Time and rate
|
|
41
41
|
*/
|
|
42
42
|
export const repeat = dual(2, (self, schedule) => make((sink) => Effect.gen(function* () {
|
|
43
43
|
const step = yield* Schedule.toStepWithSleep(schedule);
|
|
@@ -39,7 +39,7 @@ import type { Fx } from "../Fx.js";
|
|
|
39
39
|
* @param fx - The `Fx` stream.
|
|
40
40
|
* @returns An `Fx` emitting `Result<A, Cause<E>>`.
|
|
41
41
|
* @since 1.0.0
|
|
42
|
-
* @category
|
|
42
|
+
* @category Errors and recovery
|
|
43
43
|
*/
|
|
44
44
|
export declare const result: <A, E, R>(fx: Fx<A, E, R>) => Fx<Result.Result<A, Cause.Cause<E>>, never, R>;
|
|
45
45
|
//# sourceMappingURL=result.d.ts.map
|
|
@@ -38,7 +38,7 @@ import { make } from "../constructors/make.js";
|
|
|
38
38
|
* @param fx - The `Fx` stream.
|
|
39
39
|
* @returns An `Fx` emitting `Result<A, Cause<E>>`.
|
|
40
40
|
* @since 1.0.0
|
|
41
|
-
* @category
|
|
41
|
+
* @category Errors and recovery
|
|
42
42
|
*/
|
|
43
43
|
export const result = (fx) => make((sink) => fx.run({
|
|
44
44
|
onSuccess: (value) => sink.onSuccess(Result.succeed(value)),
|
|
@@ -44,7 +44,7 @@ import type { Fx } from "../Fx.js";
|
|
|
44
44
|
* ```
|
|
45
45
|
*
|
|
46
46
|
* @since 1.0.0
|
|
47
|
-
* @category
|
|
47
|
+
* @category Errors and recovery
|
|
48
48
|
*/
|
|
49
49
|
export declare const retry: {
|
|
50
50
|
<E, X, E2, R2>(schedule: Schedule.Schedule<X, E, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -51,7 +51,7 @@ import { make } from "../constructors/make.js";
|
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
53
|
* @since 1.0.0
|
|
54
|
-
* @category
|
|
54
|
+
* @category Errors and recovery
|
|
55
55
|
*/
|
|
56
56
|
export const retry = dual(2, (self, schedule) => make((sink) => Effect.gen(function* () {
|
|
57
57
|
const stepRef = yield* Ref.make(yield* Schedule.toStepWithSleep(schedule));
|
|
@@ -28,7 +28,7 @@ import { make } from "../constructors/make.js";
|
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
30
|
* @since 1.0.0
|
|
31
|
-
* @category
|
|
31
|
+
* @category Time and rate
|
|
32
32
|
*/
|
|
33
33
|
export const sample = dual(2, (self, sampler) => make(Effect.fn(function* (sink) {
|
|
34
34
|
const latest = yield* Ref.make(Option.none());
|
|
@@ -26,7 +26,7 @@ import type { Fx } from "../Fx.js";
|
|
|
26
26
|
* @param f - Reducer `(state, value) => nextState`.
|
|
27
27
|
* @returns An `Fx` that emits the accumulated state at each step.
|
|
28
28
|
* @since 1.0.0
|
|
29
|
-
* @category
|
|
29
|
+
* @category Stateful transforms
|
|
30
30
|
*/
|
|
31
31
|
export declare const scan: {
|
|
32
32
|
<S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(fx: Fx<A, E, R>) => Fx<S, E, R>;
|
|
@@ -63,7 +63,7 @@ export declare const scan: {
|
|
|
63
63
|
* @param f - Effectful reducer `(state, value) => Effect<nextState>`.
|
|
64
64
|
* @returns An `Fx` that emits the accumulated state at each step.
|
|
65
65
|
* @since 1.0.0
|
|
66
|
-
* @category
|
|
66
|
+
* @category Stateful transforms
|
|
67
67
|
*/
|
|
68
68
|
export declare const scanEffect: {
|
|
69
69
|
<S, A, E2, R2>(initial: S, f: (s: S, a: A) => Effect.Effect<S, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Fx<S, E | E2, R | R2>;
|
|
@@ -28,7 +28,7 @@ import { make } from "../constructors/make.js";
|
|
|
28
28
|
* @param f - Reducer `(state, value) => nextState`.
|
|
29
29
|
* @returns An `Fx` that emits the accumulated state at each step.
|
|
30
30
|
* @since 1.0.0
|
|
31
|
-
* @category
|
|
31
|
+
* @category Stateful transforms
|
|
32
32
|
*/
|
|
33
33
|
export const scan = dual(3, (fx, initial, f) => make((sink) => Effect.gen(function* () {
|
|
34
34
|
yield* sink.onSuccess(initial);
|
|
@@ -68,7 +68,7 @@ export const scan = dual(3, (fx, initial, f) => make((sink) => Effect.gen(functi
|
|
|
68
68
|
* @param f - Effectful reducer `(state, value) => Effect<nextState>`.
|
|
69
69
|
* @returns An `Fx` that emits the accumulated state at each step.
|
|
70
70
|
* @since 1.0.0
|
|
71
|
-
* @category
|
|
71
|
+
* @category Stateful transforms
|
|
72
72
|
*/
|
|
73
73
|
export const scanEffect = dual(3, (fx, initial, f) => make((sink) => Effect.gen(function* () {
|
|
74
74
|
const services = yield* Effect.context();
|
|
@@ -21,7 +21,7 @@ import type { Fx } from "../Fx.js";
|
|
|
21
21
|
* @param n - The number of elements to skip.
|
|
22
22
|
* @returns An `Fx` that emits values after the first `n` elements.
|
|
23
23
|
* @since 1.0.0
|
|
24
|
-
* @category
|
|
24
|
+
* @category Selecting values
|
|
25
25
|
*/
|
|
26
26
|
export declare const skip: {
|
|
27
27
|
(n: number): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -49,7 +49,7 @@ export declare const skip: {
|
|
|
49
49
|
* @param count - Effect that produces the number of elements to skip.
|
|
50
50
|
* @returns An `Fx` that emits values after the first `n` elements.
|
|
51
51
|
* @since 1.0.0
|
|
52
|
-
* @category
|
|
52
|
+
* @category Selecting values
|
|
53
53
|
*/
|
|
54
54
|
export declare const skipEffect: {
|
|
55
55
|
<E2, R2>(count: Effect.Effect<number, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -23,7 +23,7 @@ import { unwrap } from "./unwrap.js";
|
|
|
23
23
|
* @param n - The number of elements to skip.
|
|
24
24
|
* @returns An `Fx` that emits values after the first `n` elements.
|
|
25
25
|
* @since 1.0.0
|
|
26
|
-
* @category
|
|
26
|
+
* @category Selecting values
|
|
27
27
|
*/
|
|
28
28
|
export const skip = dual(2, (fx, n) => slice(fx, { skip: n, take: Infinity }));
|
|
29
29
|
/**
|
|
@@ -48,6 +48,6 @@ export const skip = dual(2, (fx, n) => slice(fx, { skip: n, take: Infinity }));
|
|
|
48
48
|
* @param count - Effect that produces the number of elements to skip.
|
|
49
49
|
* @returns An `Fx` that emits values after the first `n` elements.
|
|
50
50
|
* @since 1.0.0
|
|
51
|
-
* @category
|
|
51
|
+
* @category Selecting values
|
|
52
52
|
*/
|
|
53
53
|
export const skipEffect = dual(2, (fx, count) => unwrap(Effect.map(count, (n) => skip(fx, n))));
|