@typed/fx 2.0.0-beta.5 → 2.0.0-beta.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/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 +2 -1
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param predicate - The predicate function.
|
|
23
23
|
* @returns An `Fx` that emits once the predicate first fails.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Selecting values
|
|
26
26
|
*/
|
|
27
27
|
export declare const skipWhile: {
|
|
28
28
|
<A>(predicate: (a: A) => boolean): <E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -61,7 +61,7 @@ export declare const skipWhile: {
|
|
|
61
61
|
* @param predicate - Effectful predicate function.
|
|
62
62
|
* @returns An `Fx` that emits once the predicate first fails.
|
|
63
63
|
* @since 1.0.0
|
|
64
|
-
* @category
|
|
64
|
+
* @category Selecting values
|
|
65
65
|
*/
|
|
66
66
|
export declare const skipWhileEffect: {
|
|
67
67
|
<A, E2, R2>(predicate: (a: A) => Effect.Effect<boolean, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -84,7 +84,7 @@ export declare const skipWhileEffect: {
|
|
|
84
84
|
* ```
|
|
85
85
|
*
|
|
86
86
|
* @since 1.0.0
|
|
87
|
-
* @category
|
|
87
|
+
* @category Selecting values
|
|
88
88
|
*/
|
|
89
89
|
export declare const dropWhile: {
|
|
90
90
|
<A>(predicate: (a: A) => boolean): <E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -108,7 +108,7 @@ export declare const dropWhile: {
|
|
|
108
108
|
* ```
|
|
109
109
|
*
|
|
110
110
|
* @since 1.0.0
|
|
111
|
-
* @category
|
|
111
|
+
* @category Selecting values
|
|
112
112
|
*/
|
|
113
113
|
export declare const dropWhileEffect: {
|
|
114
114
|
<A, E2, R2>(predicate: (a: A) => Effect.Effect<boolean, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -25,7 +25,7 @@ import { make as makeSink } from "../../Sink/Sink.js";
|
|
|
25
25
|
* @param predicate - The predicate function.
|
|
26
26
|
* @returns An `Fx` that emits once the predicate first fails.
|
|
27
27
|
* @since 1.0.0
|
|
28
|
-
* @category
|
|
28
|
+
* @category Selecting values
|
|
29
29
|
*/
|
|
30
30
|
export const skipWhile = dual(2, (fx, predicate) => makeFx((sink) => Effect.gen(function* () {
|
|
31
31
|
const skippingRef = yield* Ref.make(true);
|
|
@@ -73,7 +73,7 @@ export const skipWhile = dual(2, (fx, predicate) => makeFx((sink) => Effect.gen(
|
|
|
73
73
|
* @param predicate - Effectful predicate function.
|
|
74
74
|
* @returns An `Fx` that emits once the predicate first fails.
|
|
75
75
|
* @since 1.0.0
|
|
76
|
-
* @category
|
|
76
|
+
* @category Selecting values
|
|
77
77
|
*/
|
|
78
78
|
export const skipWhileEffect = dual(2, (fx, predicate) => makeFx((sink) => Effect.gen(function* () {
|
|
79
79
|
const skippingRef = yield* Ref.make(true);
|
|
@@ -108,7 +108,7 @@ export const skipWhileEffect = dual(2, (fx, predicate) => makeFx((sink) => Effec
|
|
|
108
108
|
* ```
|
|
109
109
|
*
|
|
110
110
|
* @since 1.0.0
|
|
111
|
-
* @category
|
|
111
|
+
* @category Selecting values
|
|
112
112
|
*/
|
|
113
113
|
export const dropWhile = skipWhile;
|
|
114
114
|
/**
|
|
@@ -129,6 +129,6 @@ export const dropWhile = skipWhile;
|
|
|
129
129
|
* ```
|
|
130
130
|
*
|
|
131
131
|
* @since 1.0.0
|
|
132
|
-
* @category
|
|
132
|
+
* @category Selecting values
|
|
133
133
|
*/
|
|
134
134
|
export const dropWhileEffect = skipWhileEffect;
|
|
@@ -19,7 +19,7 @@ import type { Fx } from "../Fx.js";
|
|
|
19
19
|
* const page: Fx.Bounds = { skip: 20, take: 10 }
|
|
20
20
|
* ```
|
|
21
21
|
* @since 1.0.0
|
|
22
|
-
* @category
|
|
22
|
+
* @category Operator options
|
|
23
23
|
*/
|
|
24
24
|
export interface Bounds {
|
|
25
25
|
/**
|
|
@@ -80,7 +80,7 @@ export interface Bounds {
|
|
|
80
80
|
* @param bounds - The `Bounds` specifying how many elements to skip and take.
|
|
81
81
|
* @returns An `Fx` representing the slice.
|
|
82
82
|
* @since 1.0.0
|
|
83
|
-
* @category
|
|
83
|
+
* @category Selecting values
|
|
84
84
|
*/
|
|
85
85
|
export declare const slice: {
|
|
86
86
|
(bounds: Bounds): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -109,7 +109,7 @@ export declare const slice: {
|
|
|
109
109
|
* @param bounds - Effect that produces slice bounds.
|
|
110
110
|
* @returns An `Fx` representing the slice.
|
|
111
111
|
* @since 1.0.0
|
|
112
|
-
* @category
|
|
112
|
+
* @category Selecting values
|
|
113
113
|
*/
|
|
114
114
|
export declare const sliceEffect: {
|
|
115
115
|
<E2, R2>(bounds: Effect.Effect<Bounds, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -25,7 +25,7 @@ import { unwrap } from "./unwrap.js";
|
|
|
25
25
|
* @param bounds - The `Bounds` specifying how many elements to skip and take.
|
|
26
26
|
* @returns An `Fx` representing the slice.
|
|
27
27
|
* @since 1.0.0
|
|
28
|
-
* @category
|
|
28
|
+
* @category Selecting values
|
|
29
29
|
*/
|
|
30
30
|
export const slice = dual(2, (fx, bounds) => make((sink) => sinkCore.slice(sink, bounds, (sink) => fx.run(sink))));
|
|
31
31
|
/**
|
|
@@ -51,6 +51,6 @@ export const slice = dual(2, (fx, bounds) => make((sink) => sinkCore.slice(sink,
|
|
|
51
51
|
* @param bounds - Effect that produces slice bounds.
|
|
52
52
|
* @returns An `Fx` representing the slice.
|
|
53
53
|
* @since 1.0.0
|
|
54
|
-
* @category
|
|
54
|
+
* @category Selecting values
|
|
55
55
|
*/
|
|
56
56
|
export const sliceEffect = dual(2, (fx, bounds) => unwrap(Effect.map(bounds, (b) => slice(fx, b))));
|
|
@@ -45,7 +45,7 @@ import type { FlatMapLike } from "./flatMap.js";
|
|
|
45
45
|
* @param f - A function that maps an element `A` to a new `Fx<B>`.
|
|
46
46
|
* @returns An `Fx` that emits values from the latest inner stream.
|
|
47
47
|
* @since 1.0.0
|
|
48
|
-
* @category
|
|
48
|
+
* @category Concurrent work
|
|
49
49
|
*/
|
|
50
50
|
export declare const switchMap: FlatMapLike;
|
|
51
51
|
//# sourceMappingURL=switchMap.d.ts.map
|
|
@@ -53,7 +53,7 @@ import { extendScope } from "../internal/scope.js";
|
|
|
53
53
|
* @param f - A function that maps an element `A` to a new `Fx<B>`.
|
|
54
54
|
* @returns An `Fx` that emits values from the latest inner stream.
|
|
55
55
|
* @since 1.0.0
|
|
56
|
-
* @category
|
|
56
|
+
* @category Concurrent work
|
|
57
57
|
*/
|
|
58
58
|
export const switchMap = dual(2, (self, f) => make(Effect.fn(function* (sink) {
|
|
59
59
|
const ctx = yield* Effect.context();
|
|
@@ -44,7 +44,7 @@ import type { FlatMapEffectLike } from "./flatMapEffect.js";
|
|
|
44
44
|
* @param f - A function that maps an element `A` to an `Effect<B>`.
|
|
45
45
|
* @returns An `Fx` that emits the results of the latest effect.
|
|
46
46
|
* @since 1.0.0
|
|
47
|
-
* @category
|
|
47
|
+
* @category Concurrent work
|
|
48
48
|
*/
|
|
49
49
|
export declare const switchMapEffect: FlatMapEffectLike;
|
|
50
50
|
//# sourceMappingURL=switchMapEffect.d.ts.map
|
|
@@ -46,6 +46,6 @@ import { switchMap } from "./switchMap.js";
|
|
|
46
46
|
* @param f - A function that maps an element `A` to an `Effect<B>`.
|
|
47
47
|
* @returns An `Fx` that emits the results of the latest effect.
|
|
48
48
|
* @since 1.0.0
|
|
49
|
-
* @category
|
|
49
|
+
* @category Concurrent work
|
|
50
50
|
*/
|
|
51
51
|
export const switchMapEffect = dual(2, (self, f) => switchMap(self, flow(f, fromEffect)));
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param n - The number of elements to take.
|
|
23
23
|
* @returns An `Fx` that emits at most `n` elements.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Selecting values
|
|
26
26
|
*/
|
|
27
27
|
export declare const take: {
|
|
28
28
|
(n: number): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -50,7 +50,7 @@ export declare const take: {
|
|
|
50
50
|
* @param count - Effect that produces the number of elements to take.
|
|
51
51
|
* @returns An `Fx` that emits at most `n` elements.
|
|
52
52
|
* @since 1.0.0
|
|
53
|
-
* @category
|
|
53
|
+
* @category Selecting values
|
|
54
54
|
*/
|
|
55
55
|
export declare const takeEffect: {
|
|
56
56
|
<E2, R2>(count: Effect.Effect<number, E2, R2>): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -24,7 +24,7 @@ import { unwrap } from "./unwrap.js";
|
|
|
24
24
|
* @param n - The number of elements to take.
|
|
25
25
|
* @returns An `Fx` that emits at most `n` elements.
|
|
26
26
|
* @since 1.0.0
|
|
27
|
-
* @category
|
|
27
|
+
* @category Selecting values
|
|
28
28
|
*/
|
|
29
29
|
export const take = dual(2, (fx, n) => slice(fx, { skip: 0, take: n }));
|
|
30
30
|
/**
|
|
@@ -49,6 +49,6 @@ export const take = dual(2, (fx, n) => slice(fx, { skip: 0, take: n }));
|
|
|
49
49
|
* @param count - Effect that produces the number of elements to take.
|
|
50
50
|
* @returns An `Fx` that emits at most `n` elements.
|
|
51
51
|
* @since 1.0.0
|
|
52
|
-
* @category
|
|
52
|
+
* @category Selecting values
|
|
53
53
|
*/
|
|
54
54
|
export const takeEffect = dual(2, (fx, count) => unwrap(Effect.map(count, (n) => take(fx, n))));
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param predicate - The predicate function.
|
|
23
23
|
* @returns An `Fx` that completes when the predicate matches.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Selecting values
|
|
26
26
|
*/
|
|
27
27
|
export declare const takeUntil: {
|
|
28
28
|
<A>(predicate: (a: A) => boolean): <E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -51,7 +51,7 @@ export declare const takeUntil: {
|
|
|
51
51
|
* @param predicate - Effectful predicate function.
|
|
52
52
|
* @returns An `Fx` that completes when the predicate matches.
|
|
53
53
|
* @since 1.0.0
|
|
54
|
-
* @category
|
|
54
|
+
* @category Selecting values
|
|
55
55
|
*/
|
|
56
56
|
export declare const takeUntilEffect: {
|
|
57
57
|
<A, E2, R2>(predicate: (a: A) => Effect.Effect<boolean, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -79,7 +79,7 @@ export declare const takeUntilEffect: {
|
|
|
79
79
|
* @param predicate - The predicate function.
|
|
80
80
|
* @returns An `Fx` that stops emitting when the predicate matches.
|
|
81
81
|
* @since 1.0.0
|
|
82
|
-
* @category
|
|
82
|
+
* @category Selecting values
|
|
83
83
|
*/
|
|
84
84
|
export declare const dropAfter: {
|
|
85
85
|
<A>(predicate: (a: A) => boolean): <E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -25,7 +25,7 @@ import { make as makeFx } from "../constructors/make.js";
|
|
|
25
25
|
* @param predicate - The predicate function.
|
|
26
26
|
* @returns An `Fx` that completes when the predicate matches.
|
|
27
27
|
* @since 1.0.0
|
|
28
|
-
* @category
|
|
28
|
+
* @category Selecting values
|
|
29
29
|
*/
|
|
30
30
|
export const takeUntil = dual(2, (fx, predicate) => {
|
|
31
31
|
return makeFx((sink) => combinators.withEarlyExit(sink, (sink) => fx.run(makeSink(sink.onFailure, (a) => {
|
|
@@ -58,7 +58,7 @@ export const takeUntil = dual(2, (fx, predicate) => {
|
|
|
58
58
|
* @param predicate - Effectful predicate function.
|
|
59
59
|
* @returns An `Fx` that completes when the predicate matches.
|
|
60
60
|
* @since 1.0.0
|
|
61
|
-
* @category
|
|
61
|
+
* @category Selecting values
|
|
62
62
|
*/
|
|
63
63
|
export const takeUntilEffect = dual(2, (fx, predicate) => makeFx((sink) => combinators.withEarlyExit(sink, (sink) => fx.run(makeSink(sink.onFailure, (a) => Effect.matchCauseEffect(predicate(a), {
|
|
64
64
|
onFailure: sink.onFailure,
|
|
@@ -86,6 +86,6 @@ export const takeUntilEffect = dual(2, (fx, predicate) => makeFx((sink) => combi
|
|
|
86
86
|
* @param predicate - The predicate function.
|
|
87
87
|
* @returns An `Fx` that stops emitting when the predicate matches.
|
|
88
88
|
* @since 1.0.0
|
|
89
|
-
* @category
|
|
89
|
+
* @category Selecting values
|
|
90
90
|
*/
|
|
91
91
|
export const dropAfter = dual(2, (fx, predicate) => makeFx((sink) => combinators.dropAfter(sink, predicate, (sink) => fx.run(sink))));
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param predicate - The predicate function.
|
|
23
23
|
* @returns An `Fx` that emits while the predicate holds.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Selecting values
|
|
26
26
|
*/
|
|
27
27
|
export declare const takeWhile: {
|
|
28
28
|
<A>(predicate: (a: A) => boolean): <E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -51,7 +51,7 @@ export declare const takeWhile: {
|
|
|
51
51
|
* @param predicate - Effectful predicate function.
|
|
52
52
|
* @returns An `Fx` that emits while the predicate holds.
|
|
53
53
|
* @since 1.0.0
|
|
54
|
-
* @category
|
|
54
|
+
* @category Selecting values
|
|
55
55
|
*/
|
|
56
56
|
export declare const takeWhileEffect: {
|
|
57
57
|
<A, E2, R2>(predicate: (a: A) => Effect.Effect<boolean, E2, R2>): <E, R>(fx: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -23,7 +23,7 @@ import { takeUntil, takeUntilEffect } from "./takeUntil.js";
|
|
|
23
23
|
* @param predicate - The predicate function.
|
|
24
24
|
* @returns An `Fx` that emits while the predicate holds.
|
|
25
25
|
* @since 1.0.0
|
|
26
|
-
* @category
|
|
26
|
+
* @category Selecting values
|
|
27
27
|
*/
|
|
28
28
|
export const takeWhile = dual(2, (fx, predicate) => takeUntil(fx, (a) => !predicate(a)));
|
|
29
29
|
/**
|
|
@@ -49,6 +49,6 @@ export const takeWhile = dual(2, (fx, predicate) => takeUntil(fx, (a) => !predic
|
|
|
49
49
|
* @param predicate - Effectful predicate function.
|
|
50
50
|
* @returns An `Fx` that emits while the predicate holds.
|
|
51
51
|
* @since 1.0.0
|
|
52
|
-
* @category
|
|
52
|
+
* @category Selecting values
|
|
53
53
|
*/
|
|
54
54
|
export const takeWhileEffect = dual(2, (fx, predicate) => takeUntilEffect(fx, (a) => Effect.map(predicate(a), (b) => !b)));
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param f - An effectful function to apply to each element.
|
|
23
23
|
* @returns An `Fx` that emits the original elements.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Transforming values
|
|
26
26
|
*/
|
|
27
27
|
export declare const tap: {
|
|
28
28
|
<A, E2 = never, R2 = never>(f: (a: A) => void | Effect.Effect<unknown, E2, R2>): <E, R>(self: Fx<A, E | E2, R>) => Fx<A, E | E2, R | R2>;
|
|
@@ -24,7 +24,7 @@ import { make } from "../constructors/make.js";
|
|
|
24
24
|
* @param f - An effectful function to apply to each element.
|
|
25
25
|
* @returns An `Fx` that emits the original elements.
|
|
26
26
|
* @since 1.0.0
|
|
27
|
-
* @category
|
|
27
|
+
* @category Transforming values
|
|
28
28
|
*/
|
|
29
29
|
export const tap = dual(2, (self, f) => make((sink) => self.run(sinkCore.tapEffect(sink, (a) => {
|
|
30
30
|
const x = f(a);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Duration, Scope } from "effect";
|
|
2
|
-
import { Fx } from "../Fx.js";
|
|
2
|
+
import type { Fx } from "../Fx.js";
|
|
3
3
|
/**
|
|
4
4
|
* Options for {@link throttle}. A duration-only call is leading-edge
|
|
5
5
|
* (`{ leading: true, trailing: false }`).
|
|
@@ -27,7 +27,7 @@ import { Fx } from "../Fx.js";
|
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
29
|
* @since 1.0.0
|
|
30
|
-
* @category
|
|
30
|
+
* @category Operator options
|
|
31
31
|
*/
|
|
32
32
|
export type ThrottleOptions = {
|
|
33
33
|
readonly duration: Duration.Input;
|
|
@@ -68,7 +68,7 @@ export type ThrottleOptions = {
|
|
|
68
68
|
* ```
|
|
69
69
|
*
|
|
70
70
|
* @since 1.0.0
|
|
71
|
-
* @category
|
|
71
|
+
* @category Time and rate
|
|
72
72
|
*/
|
|
73
73
|
export declare const throttle: {
|
|
74
74
|
(duration: Duration.Input): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, R | Scope.Scope>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAOjD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAOjD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAKnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC,CAAC;AAsEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,QAAQ,EAAE;IACrB,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACpF,CAAC,OAAO,EAAE,eAAe,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACpF,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;CAoBjF,CAAC"}
|
|
@@ -85,7 +85,7 @@ const throttleWindow = (fx, duration, leading, trailing) => make(Effect.fn(funct
|
|
|
85
85
|
* ```
|
|
86
86
|
*
|
|
87
87
|
* @since 1.0.0
|
|
88
|
-
* @category
|
|
88
|
+
* @category Time and rate
|
|
89
89
|
*/
|
|
90
90
|
export const throttle = dual((args) => isFx(args[0]), (fx, durationOrOptions) => {
|
|
91
91
|
const { duration, leading, trailing } = resolve(durationOrOptions);
|
|
@@ -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 timeout: {
|
|
38
38
|
(duration: Duration.Input): <A, E, R>(self: Fx<A, E, R>) => Fx<A, E, R | Scope.Scope>;
|
|
@@ -67,7 +67,7 @@ export declare const timeout: {
|
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
69
|
* @since 1.0.0
|
|
70
|
-
* @category
|
|
70
|
+
* @category Time and rate
|
|
71
71
|
*/
|
|
72
72
|
export declare const timeoutTo: {
|
|
73
73
|
<B, E2, R2>(duration: Duration.Input, fallback: Fx<B, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A | B, E | E2, R | R2 | Scope.Scope>;
|
|
@@ -59,7 +59,7 @@ const runTimed = (self, duration, fallback) => make(Effect.fn(function* (sink) {
|
|
|
59
59
|
* ```
|
|
60
60
|
*
|
|
61
61
|
* @since 1.0.0
|
|
62
|
-
* @category
|
|
62
|
+
* @category Time and rate
|
|
63
63
|
*/
|
|
64
64
|
export const timeout = dual(2, (self, duration) => {
|
|
65
65
|
const d = Duration.fromInputUnsafe(duration);
|
|
@@ -98,7 +98,7 @@ export const timeout = dual(2, (self, duration) => {
|
|
|
98
98
|
* ```
|
|
99
99
|
*
|
|
100
100
|
* @since 1.0.0
|
|
101
|
-
* @category
|
|
101
|
+
* @category Time and rate
|
|
102
102
|
*/
|
|
103
103
|
export const timeoutTo = dual(3, (self, duration, fallback) => {
|
|
104
104
|
const d = Duration.fromInputUnsafe(duration);
|
|
@@ -22,7 +22,7 @@ import type { Fx } from "../Fx.js";
|
|
|
22
22
|
* @param fxs - The Fx streams to combine.
|
|
23
23
|
* @returns An `Fx` emitting tuples of values.
|
|
24
24
|
* @since 1.0.0
|
|
25
|
-
* @category
|
|
25
|
+
* @category Combining sources
|
|
26
26
|
*/
|
|
27
27
|
export declare function tuple<FX extends ReadonlyArray<Fx<any, any, any>>>(...fxs: FX): Fx<{
|
|
28
28
|
readonly [K in keyof FX]: Fx.Success<FX[K]>;
|
|
@@ -49,7 +49,7 @@ export declare function tuple<FX extends ReadonlyArray<Fx<any, any, any>>>(...fx
|
|
|
49
49
|
* @param fxs - A record of Fx streams.
|
|
50
50
|
* @returns An `Fx` emitting records of values.
|
|
51
51
|
* @since 1.0.0
|
|
52
|
-
* @category
|
|
52
|
+
* @category Combining sources
|
|
53
53
|
*/
|
|
54
54
|
export declare function struct<FXS extends Readonly<Record<string, Fx<any, any, any>>>>(fxs: FXS): Fx<{
|
|
55
55
|
readonly [K in keyof FXS]: Fx.Success<FXS[K]>;
|
|
@@ -26,7 +26,7 @@ import { map } from "./map.js";
|
|
|
26
26
|
* @param fxs - The Fx streams to combine.
|
|
27
27
|
* @returns An `Fx` emitting tuples of values.
|
|
28
28
|
* @since 1.0.0
|
|
29
|
-
* @category
|
|
29
|
+
* @category Combining sources
|
|
30
30
|
*/
|
|
31
31
|
export function tuple(...fxs) {
|
|
32
32
|
if (fxs.length === 0)
|
|
@@ -70,7 +70,7 @@ export function tuple(...fxs) {
|
|
|
70
70
|
* @param fxs - A record of Fx streams.
|
|
71
71
|
* @returns An `Fx` emitting records of values.
|
|
72
72
|
* @since 1.0.0
|
|
73
|
-
* @category
|
|
73
|
+
* @category Combining sources
|
|
74
74
|
*/
|
|
75
75
|
export function struct(fxs) {
|
|
76
76
|
return map(tuple(...Object.entries(fxs).map(([key, fx]) => map(fx, (value) => [key, value]))), Object.fromEntries);
|
|
@@ -35,7 +35,7 @@ import type { Fx } from "../Fx.js";
|
|
|
35
35
|
* @param effect - An `Effect` that produces an `Fx`.
|
|
36
36
|
* @returns An `Fx` that runs the effect and then the produced Fx.
|
|
37
37
|
* @since 1.0.0
|
|
38
|
-
* @category
|
|
38
|
+
* @category Generator composition
|
|
39
39
|
*/
|
|
40
40
|
export declare const unwrap: <A = never, E = never, R = never, E2 = never, R2 = never>(effect: Effect.Effect<Fx<A, E, R>, E2, R2>) => Fx<A, E | E2, R | R2>;
|
|
41
41
|
//# sourceMappingURL=unwrap.d.ts.map
|
|
@@ -35,7 +35,7 @@ import { make } from "../constructors/make.js";
|
|
|
35
35
|
* @param effect - An `Effect` that produces an `Fx`.
|
|
36
36
|
* @returns An `Fx` that runs the effect and then the produced Fx.
|
|
37
37
|
* @since 1.0.0
|
|
38
|
-
* @category
|
|
38
|
+
* @category Generator composition
|
|
39
39
|
*/
|
|
40
40
|
export const unwrap = (effect) => make((sink) => Effect.matchCauseEffect(effect, {
|
|
41
41
|
onFailure: (cause) => sink.onFailure(cause),
|
|
@@ -42,7 +42,7 @@ import type { Fx } from "../Fx.js";
|
|
|
42
42
|
* @param effect - An `Effect` that produces an `Fx`.
|
|
43
43
|
* @returns An `Fx` that runs the effect and then the produced Fx.
|
|
44
44
|
* @since 1.0.0
|
|
45
|
-
* @category
|
|
45
|
+
* @category Generator composition
|
|
46
46
|
*/
|
|
47
47
|
export declare const unwrapScoped: <A, E, R, E2, R2>(effect: Effect.Effect<Fx<A, E, R>, E2, R2 | Scope.Scope>) => Fx<A, E | E2, Exclude<R | R2, Scope.Scope>>;
|
|
48
48
|
//# sourceMappingURL=unwrapScoped.d.ts.map
|
|
@@ -41,7 +41,7 @@ import { make } from "../constructors/make.js";
|
|
|
41
41
|
* @param effect - An `Effect` that produces an `Fx`.
|
|
42
42
|
* @returns An `Fx` that runs the effect and then the produced Fx.
|
|
43
43
|
* @since 1.0.0
|
|
44
|
-
* @category
|
|
44
|
+
* @category Generator composition
|
|
45
45
|
*/
|
|
46
46
|
export const unwrapScoped = (effect) => make((sink) => Effect.scoped(Effect.matchCauseEffect(effect, {
|
|
47
47
|
onFailure: (cause) => sink.onFailure(cause),
|
|
@@ -23,7 +23,7 @@ import type { Fx } from "../Fx.js";
|
|
|
23
23
|
* @param matchers - An object containing `onTrue` and `onFalse` Fx streams.
|
|
24
24
|
* @returns An `Fx` that switches between `onTrue` and `onFalse` based on the condition.
|
|
25
25
|
* @since 1.0.0
|
|
26
|
-
* @category
|
|
26
|
+
* @category Conditional sources
|
|
27
27
|
*/
|
|
28
28
|
declare const if_: {
|
|
29
29
|
<B, E2, R2, C, E3, R3>(matchers: {
|
|
@@ -62,7 +62,7 @@ export { if_ as if };
|
|
|
62
62
|
* @param matchers - An object containing `onTrue` and `onFalse` values.
|
|
63
63
|
* @returns An `Fx` that emits the matched value.
|
|
64
64
|
* @since 1.0.0
|
|
65
|
-
* @category
|
|
65
|
+
* @category Conditional sources
|
|
66
66
|
*/
|
|
67
67
|
export declare const when: <E, R, B, C>(condition: Fx<boolean, E, R>, matchers: {
|
|
68
68
|
onTrue: B;
|
|
@@ -24,7 +24,7 @@ import { switchMap } from "./switchMap.js";
|
|
|
24
24
|
* @param matchers - An object containing `onTrue` and `onFalse` Fx streams.
|
|
25
25
|
* @returns An `Fx` that switches between `onTrue` and `onFalse` based on the condition.
|
|
26
26
|
* @since 1.0.0
|
|
27
|
-
* @category
|
|
27
|
+
* @category Conditional sources
|
|
28
28
|
*/
|
|
29
29
|
const if_ = dual(2, (condition, matchers) => {
|
|
30
30
|
return switchMap(condition, (pass) => pass ? matchers.onTrue : matchers.onFalse);
|
|
@@ -56,7 +56,7 @@ export { if_ as if };
|
|
|
56
56
|
* @param matchers - An object containing `onTrue` and `onFalse` values.
|
|
57
57
|
* @returns An `Fx` that emits the matched value.
|
|
58
58
|
* @since 1.0.0
|
|
59
|
-
* @category
|
|
59
|
+
* @category Conditional sources
|
|
60
60
|
*/
|
|
61
61
|
export const when = (condition, matchers) => {
|
|
62
62
|
return if_(condition, { onTrue: succeed(matchers.onTrue), onFalse: succeed(matchers.onFalse) });
|
|
@@ -24,7 +24,7 @@ import type { Fx } from "../Fx.js";
|
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
26
|
* @since 1.0.0
|
|
27
|
-
* @category
|
|
27
|
+
* @category Combining sources
|
|
28
28
|
*/
|
|
29
29
|
export declare const withLatestFrom: {
|
|
30
30
|
<B, E2, R2>(that: Fx<B, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<readonly [A, B], E | E2, R | R2>;
|
|
@@ -49,7 +49,7 @@ export declare const withLatestFrom: {
|
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
51
|
* @since 1.0.0
|
|
52
|
-
* @category
|
|
52
|
+
* @category Combining sources
|
|
53
53
|
*/
|
|
54
54
|
export declare const withLatestFromWith: {
|
|
55
55
|
<A, B, E2, R2, C>(that: Fx<B, E2, R2>, f: (a: A, b: B) => C): <E, R>(self: Fx<A, E, R>) => Fx<C, E | E2, R | R2>;
|
|
@@ -31,7 +31,7 @@ import { map } from "./map.js";
|
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
33
|
* @since 1.0.0
|
|
34
|
-
* @category
|
|
34
|
+
* @category Combining sources
|
|
35
35
|
*/
|
|
36
36
|
export const withLatestFrom = dual(2, (self, that) => make((sink) => Effect.gen(function* () {
|
|
37
37
|
const latest = yield* Ref.make(Option.none());
|
|
@@ -63,6 +63,6 @@ export const withLatestFrom = dual(2, (self, that) => make((sink) => Effect.gen(
|
|
|
63
63
|
* ```
|
|
64
64
|
*
|
|
65
65
|
* @since 1.0.0
|
|
66
|
-
* @category
|
|
66
|
+
* @category Combining sources
|
|
67
67
|
*/
|
|
68
68
|
export const withLatestFromWith = dual(3, (self, that, f) => map(withLatestFrom(self, that), (pair) => f(pair[0], pair[1])));
|
|
@@ -29,7 +29,7 @@ import type { Fx } from "../Fx.js";
|
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
31
31
|
* @since 1.0.0
|
|
32
|
-
* @category
|
|
32
|
+
* @category Observing failures
|
|
33
33
|
*/
|
|
34
34
|
export declare const withSpan: {
|
|
35
35
|
(name: string, options?: SpanOptionsNoTrace): <A, E, R>(fx: Fx<A, E, R>) => Fx<A, E, R>;
|
|
@@ -32,6 +32,6 @@ import { isFx } from "../TypeId.js";
|
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
34
|
* @since 1.0.0
|
|
35
|
-
* @category
|
|
35
|
+
* @category Observing failures
|
|
36
36
|
*/
|
|
37
37
|
export const withSpan = dual((args) => isFx(args[0]), (fx, name, options) => make((sink) => Effect.withSpan(fx.run(makeSink((cause) => Effect.withSpan(sink.onFailure(cause), `onFailure(${name})`, options), (value) => Effect.withSpan(sink.onSuccess(value), `onSuccess(${name})`, options))), `Fx(${name})`, options)));
|
|
@@ -28,7 +28,7 @@ import type { Fx } from "../Fx.js";
|
|
|
28
28
|
* @param that - The second Fx stream.
|
|
29
29
|
* @returns An Fx that emits pairs `[A, B]`.
|
|
30
30
|
* @since 1.0.0
|
|
31
|
-
* @category
|
|
31
|
+
* @category Combining sources
|
|
32
32
|
*/
|
|
33
33
|
export declare const zip: {
|
|
34
34
|
<A2, E2, R2>(that: Fx<A2, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<readonly [A, A2], E | E2, R | R2>;
|
|
@@ -60,7 +60,7 @@ export declare const zip: {
|
|
|
60
60
|
* @param f - Function to combine the pair `(a, b)` into a single value.
|
|
61
61
|
* @returns An Fx that emits combined values.
|
|
62
62
|
* @since 1.0.0
|
|
63
|
-
* @category
|
|
63
|
+
* @category Combining sources
|
|
64
64
|
*/
|
|
65
65
|
export declare const zipWith: {
|
|
66
66
|
<A, A2, E2, R2, B>(that: Fx<A2, E2, R2>, f: (a: A, b: A2) => B): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2, R | R2>;
|
|
@@ -93,7 +93,7 @@ export declare const zipWith: {
|
|
|
93
93
|
* @param that - The second Fx stream.
|
|
94
94
|
* @returns An Fx that emits `[AL, AR]` on every update from either stream.
|
|
95
95
|
* @since 1.0.0
|
|
96
|
-
* @category
|
|
96
|
+
* @category Combining sources
|
|
97
97
|
*/
|
|
98
98
|
export declare const zipLatest: {
|
|
99
99
|
<AR, ER, RR>(that: Fx<AR, ER, RR>): <AL, EL, RL>(self: Fx<AL, EL, RL>) => Fx<readonly [AL, AR], EL | ER, RL | RR>;
|
|
@@ -126,7 +126,7 @@ export declare const zipLatest: {
|
|
|
126
126
|
* @param f - Function to combine the latest `(left, right)` into a single value.
|
|
127
127
|
* @returns An Fx that emits combined values.
|
|
128
128
|
* @since 1.0.0
|
|
129
|
-
* @category
|
|
129
|
+
* @category Combining sources
|
|
130
130
|
*/
|
|
131
131
|
export declare const zipLatestWith: {
|
|
132
132
|
<AL, AR, ER, RR, B>(that: Fx<AR, ER, RR>, f: (left: AL, right: AR) => B): <EL, RL>(self: Fx<AL, EL, RL>) => Fx<B, EL | ER, RL | RR>;
|
|
@@ -37,7 +37,7 @@ import { tuple } from "./tuple.js";
|
|
|
37
37
|
* @param that - The second Fx stream.
|
|
38
38
|
* @returns An Fx that emits pairs `[A, B]`.
|
|
39
39
|
* @since 1.0.0
|
|
40
|
-
* @category
|
|
40
|
+
* @category Combining sources
|
|
41
41
|
*/
|
|
42
42
|
export const zip = dual(2, (self, that) => make((sink) => Effect.gen(function* () {
|
|
43
43
|
const leftQueue = yield* Queue.unbounded();
|
|
@@ -95,7 +95,7 @@ export const zip = dual(2, (self, that) => make((sink) => Effect.gen(function* (
|
|
|
95
95
|
* @param f - Function to combine the pair `(a, b)` into a single value.
|
|
96
96
|
* @returns An Fx that emits combined values.
|
|
97
97
|
* @since 1.0.0
|
|
98
|
-
* @category
|
|
98
|
+
* @category Combining sources
|
|
99
99
|
*/
|
|
100
100
|
export const zipWith = dual(3, (self, that, f) => map(zip(self, that), (pair) => f(pair[0], pair[1])));
|
|
101
101
|
/**
|
|
@@ -125,7 +125,7 @@ export const zipWith = dual(3, (self, that, f) => map(zip(self, that), (pair) =>
|
|
|
125
125
|
* @param that - The second Fx stream.
|
|
126
126
|
* @returns An Fx that emits `[AL, AR]` on every update from either stream.
|
|
127
127
|
* @since 1.0.0
|
|
128
|
-
* @category
|
|
128
|
+
* @category Combining sources
|
|
129
129
|
*/
|
|
130
130
|
export const zipLatest = dual(2, (self, that) => tuple(self, that));
|
|
131
131
|
/**
|
|
@@ -155,6 +155,6 @@ export const zipLatest = dual(2, (self, that) => tuple(self, that));
|
|
|
155
155
|
* @param f - Function to combine the latest `(left, right)` into a single value.
|
|
156
156
|
* @returns An Fx that emits combined values.
|
|
157
157
|
* @since 1.0.0
|
|
158
|
-
* @category
|
|
158
|
+
* @category Combining sources
|
|
159
159
|
*/
|
|
160
160
|
export const zipLatestWith = dual(3, (self, that, f) => map(zipLatest(self, that), (pair) => f(pair[0], pair[1])));
|