@typed/fx 1.22.2 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Form.js.map +1 -1
- package/dist/cjs/Fx.js.map +1 -1
- package/dist/cjs/Idle.js.map +1 -1
- package/dist/cjs/Match.js.map +1 -1
- package/dist/cjs/Pull.js.map +1 -1
- package/dist/cjs/Subject.js.map +1 -1
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/helpers.js.map +1 -1
- package/dist/cjs/internal/keyed.js +1 -1
- package/dist/cjs/internal/keyed.js.map +1 -1
- package/dist/cjs/internal/share.js.map +1 -1
- package/dist/cjs/internal/sync-producer.js.map +1 -1
- package/dist/dts/AsyncData.d.ts +33 -33
- package/dist/dts/AsyncData.d.ts.map +1 -1
- package/dist/dts/Emitter.d.ts +6 -6
- package/dist/dts/Emitter.d.ts.map +1 -1
- package/dist/dts/Form.d.ts +12 -12
- package/dist/dts/Form.d.ts.map +1 -1
- package/dist/dts/FormEntry.d.ts +9 -9
- package/dist/dts/FormEntry.d.ts.map +1 -1
- package/dist/dts/Fx.d.ts +113 -113
- package/dist/dts/Fx.d.ts.map +1 -1
- package/dist/dts/Guard.d.ts +5 -5
- package/dist/dts/Guard.d.ts.map +1 -1
- package/dist/dts/Idle.d.ts +12 -12
- package/dist/dts/Idle.d.ts.map +1 -1
- package/dist/dts/Pull.d.ts +5 -5
- package/dist/dts/Pull.d.ts.map +1 -1
- package/dist/dts/Push.d.ts +20 -20
- package/dist/dts/Push.d.ts.map +1 -1
- package/dist/dts/RefArray.d.ts +33 -33
- package/dist/dts/RefArray.d.ts.map +1 -1
- package/dist/dts/RefChunk.d.ts +27 -27
- package/dist/dts/RefChunk.d.ts.map +1 -1
- package/dist/dts/RefHashMap.d.ts +17 -17
- package/dist/dts/RefHashMap.d.ts.map +1 -1
- package/dist/dts/RefHashSet.d.ts +5 -5
- package/dist/dts/RefHashSet.d.ts.map +1 -1
- package/dist/dts/RefSubject.d.ts +53 -53
- package/dist/dts/RefSubject.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +31 -31
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +11 -11
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Subject.d.ts +5 -5
- package/dist/dts/Subject.d.ts.map +1 -1
- package/dist/dts/Versioned.d.ts +11 -11
- package/dist/dts/Versioned.d.ts.map +1 -1
- package/dist/dts/internal/DeferredRef.d.ts +7 -7
- package/dist/dts/internal/core.d.ts +51 -51
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/effect-loop-operator.d.ts +4 -4
- package/dist/dts/internal/effect-loop-operator.d.ts.map +1 -1
- package/dist/dts/internal/effect-operator.d.ts +11 -11
- package/dist/dts/internal/effect-operator.d.ts.map +1 -1
- package/dist/dts/internal/effect-producer.d.ts +9 -9
- package/dist/dts/internal/effect-producer.d.ts.map +1 -1
- package/dist/dts/internal/helpers.d.ts +25 -25
- package/dist/dts/internal/helpers.d.ts.map +1 -1
- package/dist/dts/internal/protos.d.ts +9 -9
- package/dist/dts/internal/protos.d.ts.map +1 -1
- package/dist/dts/internal/provide.d.ts +10 -10
- package/dist/dts/internal/provide.d.ts.map +1 -1
- package/dist/dts/internal/share.d.ts +2 -2
- package/dist/dts/internal/share.d.ts.map +1 -1
- package/dist/dts/internal/sync-producer.d.ts +6 -6
- package/dist/dts/internal/sync-producer.d.ts.map +1 -1
- package/dist/esm/Form.js.map +1 -1
- package/dist/esm/FormEntry.js.map +1 -1
- package/dist/esm/Fx.js.map +1 -1
- package/dist/esm/Idle.js.map +1 -1
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Pull.js.map +1 -1
- package/dist/esm/RefSubject.js.map +1 -1
- package/dist/esm/Subject.js.map +1 -1
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/helpers.js.map +1 -1
- package/dist/esm/internal/keyed.js +1 -1
- package/dist/esm/internal/keyed.js.map +1 -1
- package/dist/esm/internal/share.js.map +1 -1
- package/dist/esm/internal/sync-producer.js.map +1 -1
- package/package.json +6 -6
- package/src/AsyncData.ts +86 -86
- package/src/Emitter.ts +9 -9
- package/src/Form.ts +39 -39
- package/src/FormEntry.ts +25 -25
- package/src/Fx.ts +122 -124
- package/src/Guard.ts +7 -7
- package/src/Idle.ts +23 -23
- package/src/Match.ts +3 -3
- package/src/Pull.ts +10 -10
- package/src/Push.ts +33 -33
- package/src/RefArray.ts +36 -36
- package/src/RefChunk.ts +30 -30
- package/src/RefHashMap.ts +24 -24
- package/src/RefHashSet.ts +6 -6
- package/src/RefSubject.ts +184 -184
- package/src/Sink.ts +91 -91
- package/src/Stream.ts +19 -19
- package/src/Subject.ts +21 -21
- package/src/Versioned.ts +23 -23
- package/src/internal/DeferredRef.ts +6 -6
- package/src/internal/core.ts +132 -132
- package/src/internal/effect-loop-operator.ts +4 -4
- package/src/internal/effect-operator.ts +13 -13
- package/src/internal/effect-producer.ts +14 -14
- package/src/internal/helpers.ts +36 -36
- package/src/internal/keyed.ts +3 -3
- package/src/internal/protos.ts +12 -12
- package/src/internal/provide.ts +10 -10
- package/src/internal/share.ts +4 -4
- package/src/internal/sync-producer.ts +12 -12
|
@@ -12,12 +12,12 @@ export type EffectLoopOperator<B = any, A = any, R = any, E = any, C = any> =
|
|
|
12
12
|
export interface LoopEffectOperator<B, A, R, E, C> {
|
|
13
13
|
readonly _tag: "LoopEffect"
|
|
14
14
|
readonly seed: B
|
|
15
|
-
readonly f: (acc: B, a: A) => Effect.Effect<
|
|
15
|
+
readonly f: (acc: B, a: A) => Effect.Effect<readonly [C, B], E, R>
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function LoopEffectOperator<const B, A, R, E, C>(
|
|
19
19
|
seed: B,
|
|
20
|
-
f: (acc: B, a: A) => Effect.Effect<
|
|
20
|
+
f: (acc: B, a: A) => Effect.Effect<readonly [C, B], E, R>
|
|
21
21
|
): LoopEffectOperator<B, A, R, E, C> {
|
|
22
22
|
return { _tag: "LoopEffect", seed, f }
|
|
23
23
|
}
|
|
@@ -25,12 +25,12 @@ export function LoopEffectOperator<const B, A, R, E, C>(
|
|
|
25
25
|
export interface FilterMapLoopEffectOperator<B, A, R, E, C> {
|
|
26
26
|
readonly _tag: "FilterMapLoopEffect"
|
|
27
27
|
readonly seed: B
|
|
28
|
-
readonly f: (acc: B, a: A) => Effect.Effect<
|
|
28
|
+
readonly f: (acc: B, a: A) => Effect.Effect<readonly [Option.Option<C>, B], E, R>
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function FilterMapLoopEffectOperator<const B, A, R, E, C>(
|
|
32
32
|
seed: B,
|
|
33
|
-
f: (acc: B, a: A) => Effect.Effect<
|
|
33
|
+
f: (acc: B, a: A) => Effect.Effect<readonly [Option.Option<C>, B], E, R>
|
|
34
34
|
): FilterMapLoopEffectOperator<B, A, R, E, C> {
|
|
35
35
|
return { _tag: "FilterMapLoopEffect", seed, f }
|
|
36
36
|
}
|
|
@@ -15,41 +15,41 @@ export type EffectOperator =
|
|
|
15
15
|
|
|
16
16
|
export interface MapEffect<A, R2, E2, B> {
|
|
17
17
|
readonly _tag: "MapEffect"
|
|
18
|
-
readonly f: (a: A) => Effect.Effect<
|
|
18
|
+
readonly f: (a: A) => Effect.Effect<B, E2, R2>
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const MapEffect = <A, R2, E2, B>(f: (a: A) => Effect.Effect<
|
|
21
|
+
export const MapEffect = <A, R2, E2, B>(f: (a: A) => Effect.Effect<B, E2, R2>): MapEffect<A, R2, E2, B> => ({
|
|
22
22
|
_tag: "MapEffect",
|
|
23
23
|
f
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
export interface TapEffect<A, R2, E2, B> {
|
|
27
27
|
readonly _tag: "TapEffect"
|
|
28
|
-
readonly f: (a: A) => Effect.Effect<
|
|
28
|
+
readonly f: (a: A) => Effect.Effect<B, E2, R2>
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export const TapEffect = <A, R2, E2, B>(f: (a: A) => Effect.Effect<
|
|
31
|
+
export const TapEffect = <A, R2, E2, B>(f: (a: A) => Effect.Effect<B, E2, R2>): TapEffect<A, R2, E2, B> => ({
|
|
32
32
|
_tag: "TapEffect",
|
|
33
33
|
f
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
export interface FilterEffect<A, R2, E2> {
|
|
37
37
|
readonly _tag: "FilterEffect"
|
|
38
|
-
readonly f: (a: A) => Effect.Effect<
|
|
38
|
+
readonly f: (a: A) => Effect.Effect<boolean, E2, R2>
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export const FilterEffect = <A, R2, E2>(f: (a: A) => Effect.Effect<
|
|
41
|
+
export const FilterEffect = <A, R2, E2>(f: (a: A) => Effect.Effect<boolean, E2, R2>): FilterEffect<A, R2, E2> => ({
|
|
42
42
|
_tag: "FilterEffect",
|
|
43
43
|
f
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
export interface FilterMapEffect<A, R2, E2, B> {
|
|
47
47
|
readonly _tag: "FilterMapEffect"
|
|
48
|
-
readonly f: (a: A) => Effect.Effect<
|
|
48
|
+
readonly f: (a: A) => Effect.Effect<Option.Option<B>, E2, R2>
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export const FilterMapEffect = <A, R2, E2, B>(
|
|
52
|
-
f: (a: A) => Effect.Effect<
|
|
52
|
+
f: (a: A) => Effect.Effect<Option.Option<B>, E2, R2>
|
|
53
53
|
): FilterMapEffect<A, R2, E2, B> => ({ _tag: "FilterMapEffect", f })
|
|
54
54
|
|
|
55
55
|
type EffectOperatorFusionMap = {
|
|
@@ -255,8 +255,8 @@ export function compileCauseEffectOperatorSink<R>(
|
|
|
255
255
|
|
|
256
256
|
export function compileEffectLoop<B, A, R2, E2, C>(
|
|
257
257
|
operator: EffectOperator,
|
|
258
|
-
loop: (b: B, a: A) => Effect.Effect<
|
|
259
|
-
): (b: B, i: any) => Effect.Effect<
|
|
258
|
+
loop: (b: B, a: A) => Effect.Effect<readonly [C, B], E2, R2>
|
|
259
|
+
): (b: B, i: any) => Effect.Effect<Option.Option<readonly [C, B]>, E2, R2> {
|
|
260
260
|
return matchEffectOperator(operator, {
|
|
261
261
|
MapEffect: (op) => (b, i) => Effect.map(Effect.flatMap(op.f(i), (a) => loop(b, a)), Option.some),
|
|
262
262
|
TapEffect: (op) => (b, i) => Effect.map(Effect.flatMap(op.f(i), () => loop(b, i)), Option.some),
|
|
@@ -275,8 +275,8 @@ export function compileEffectLoop<B, A, R2, E2, C>(
|
|
|
275
275
|
|
|
276
276
|
export function compileEffectReducer<B, A, R2, E2>(
|
|
277
277
|
operator: EffectOperator,
|
|
278
|
-
loop: (b: B, a: A) => Effect.Effect<
|
|
279
|
-
): (b: B, i: any) => Effect.Effect<
|
|
278
|
+
loop: (b: B, a: A) => Effect.Effect<B, E2, R2>
|
|
279
|
+
): (b: B, i: any) => Effect.Effect<Option.Option<B>, E2, R2> {
|
|
280
280
|
return matchEffectOperator(operator, {
|
|
281
281
|
MapEffect: (op) => (b, i) => Effect.map(Effect.flatMap(op.f(i), (a) => loop(b, a)), Option.some),
|
|
282
282
|
TapEffect: (op) => (b, i) => Effect.map(Effect.flatMap(op.f(i), () => loop(b, i)), Option.some),
|
|
@@ -298,7 +298,7 @@ export function runSyncReduce<A, B, R2, E2>(
|
|
|
298
298
|
op: EffectOperator,
|
|
299
299
|
seed: B,
|
|
300
300
|
f: (acc: B, a: any) => B
|
|
301
|
-
): Effect.Effect<
|
|
301
|
+
): Effect.Effect<B, E2, R2> {
|
|
302
302
|
return matchEffectOperator(op, {
|
|
303
303
|
MapEffect: (op) => SyncProducer.runReduceEffect(producer, seed, (acc, a) => Effect.map(op.f(a), (b) => f(acc, b))),
|
|
304
304
|
TapEffect: (op) => SyncProducer.runReduceEffect(producer, seed, (acc, a) => Effect.map(op.f(a), () => f(acc, a))),
|
|
@@ -10,21 +10,21 @@ export type EffectProducer<R = any, E = any, A = any> =
|
|
|
10
10
|
|
|
11
11
|
export interface FromEffect<R, E, A> {
|
|
12
12
|
readonly _tag: "FromEffect"
|
|
13
|
-
readonly source: Effect.Effect<
|
|
13
|
+
readonly source: Effect.Effect<A, E, R>
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function FromEffect<R, E, A>(source: Effect.Effect<
|
|
16
|
+
export function FromEffect<R, E, A>(source: Effect.Effect<A, E, R>): FromEffect<R, E, A> {
|
|
17
17
|
return { _tag: "FromEffect", source }
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface FromScheduled<R, E, I, O> {
|
|
21
21
|
readonly _tag: "FromScheduled"
|
|
22
|
-
readonly input: Effect.Effect<
|
|
22
|
+
readonly input: Effect.Effect<I, E, R>
|
|
23
23
|
readonly schedule: Schedule.Schedule<R, I, O>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function FromScheduled<R, E, R2, I, O>(
|
|
27
|
-
input: Effect.Effect<
|
|
27
|
+
input: Effect.Effect<I, E, R>,
|
|
28
28
|
schedule: Schedule.Schedule<R2, I, O>
|
|
29
29
|
): FromScheduled<R | R2, E, I, O> {
|
|
30
30
|
return { _tag: "FromScheduled", schedule, input }
|
|
@@ -32,12 +32,12 @@ export function FromScheduled<R, E, R2, I, O>(
|
|
|
32
32
|
|
|
33
33
|
export interface Scheduled<R, E, A, O> {
|
|
34
34
|
readonly _tag: "Scheduled"
|
|
35
|
-
readonly input: Effect.Effect<
|
|
35
|
+
readonly input: Effect.Effect<A, E, R>
|
|
36
36
|
readonly schedule: Schedule.Schedule<R, unknown, O>
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export function Scheduled<R, E, A, R2, O>(
|
|
40
|
-
input: Effect.Effect<
|
|
40
|
+
input: Effect.Effect<A, E, R>,
|
|
41
41
|
schedule: Schedule.Schedule<R2, unknown, O>
|
|
42
42
|
): Scheduled<R | R2, E, A, O> {
|
|
43
43
|
return { _tag: "Scheduled", schedule, input }
|
|
@@ -46,7 +46,7 @@ export function Scheduled<R, E, A, R2, O>(
|
|
|
46
46
|
export function runSink<R, E, A, R2>(
|
|
47
47
|
producer: EffectProducer<R, E, A>,
|
|
48
48
|
sink: Sink.Sink<R2, E, A>
|
|
49
|
-
): Effect.Effect<R | R2
|
|
49
|
+
): Effect.Effect<unknown, never, R | R2> {
|
|
50
50
|
switch (producer._tag) {
|
|
51
51
|
case "FromEffect":
|
|
52
52
|
return Effect.matchCauseEffect(producer.source, sink)
|
|
@@ -60,7 +60,7 @@ export function runSink<R, E, A, R2>(
|
|
|
60
60
|
function runFromScheduled<R, E, I, O, R2>(
|
|
61
61
|
scheduled: FromScheduled<R, E, I, O>,
|
|
62
62
|
sink: Sink.Sink<R2, E, O>
|
|
63
|
-
): Effect.Effect<R | R2
|
|
63
|
+
): Effect.Effect<unknown, never, R | R2> {
|
|
64
64
|
return Effect.catchAllCause(
|
|
65
65
|
Effect.flatMap(
|
|
66
66
|
scheduled.input,
|
|
@@ -73,7 +73,7 @@ function runFromScheduled<R, E, I, O, R2>(
|
|
|
73
73
|
function runSchedule<R, E, A, O, R2>(
|
|
74
74
|
scheduled: Scheduled<R, E, A, O>,
|
|
75
75
|
sink: Sink.Sink<R2, E, A>
|
|
76
|
-
): Effect.Effect<R | R2
|
|
76
|
+
): Effect.Effect<unknown, never, R | R2> {
|
|
77
77
|
return Effect.catchAllCause(
|
|
78
78
|
Effect.schedule(Effect.matchCauseEffect(scheduled.input, sink), scheduled.schedule),
|
|
79
79
|
sink.onFailure
|
|
@@ -82,8 +82,8 @@ function runSchedule<R, E, A, O, R2>(
|
|
|
82
82
|
|
|
83
83
|
export function runEffect<R, E, A, R2, E2, B>(
|
|
84
84
|
producer: EffectProducer<R, E, A>,
|
|
85
|
-
f: (a: A) => Effect.Effect<
|
|
86
|
-
): Effect.Effect<
|
|
85
|
+
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
86
|
+
): Effect.Effect<unknown, E | E2, R | R2> {
|
|
87
87
|
switch (producer._tag) {
|
|
88
88
|
case "FromEffect":
|
|
89
89
|
return Effect.flatMap(producer.source, f)
|
|
@@ -91,7 +91,7 @@ export function runEffect<R, E, A, R2, E2, B>(
|
|
|
91
91
|
return Effect.flatMap(
|
|
92
92
|
producer.input,
|
|
93
93
|
(i) =>
|
|
94
|
-
Effect.asyncEffect<
|
|
94
|
+
Effect.asyncEffect<unknown, E | E2, never, unknown, never, R | R2>((resume) => {
|
|
95
95
|
const onFailure = (cause: Cause.Cause<E | E2>) => Effect.succeed(resume(Effect.failCause(cause)))
|
|
96
96
|
|
|
97
97
|
return Effect.matchCauseEffect(
|
|
@@ -115,8 +115,8 @@ export function runEffect<R, E, A, R2, E2, B>(
|
|
|
115
115
|
export function runReduceEffect<R, E, A, R2, E2, B>(
|
|
116
116
|
producer: EffectProducer<R, E, A>,
|
|
117
117
|
initial: B,
|
|
118
|
-
f: (b: B, a: A) => Effect.Effect<
|
|
119
|
-
): Effect.Effect<
|
|
118
|
+
f: (b: B, a: A) => Effect.Effect<B, E2, R2>
|
|
119
|
+
): Effect.Effect<B, E | E2, R | R2> {
|
|
120
120
|
return Effect.suspend(() => {
|
|
121
121
|
let acc = initial
|
|
122
122
|
|
package/src/internal/helpers.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function withBuffers<R, E, A>(size: number, sink: Sink.Sink<R, E, A>) {
|
|
|
21
21
|
const finished = new Set<number>()
|
|
22
22
|
let currentIndex = 0
|
|
23
23
|
|
|
24
|
-
const drainBuffer = (index: number): Effect.Effect<
|
|
24
|
+
const drainBuffer = (index: number): Effect.Effect<void, never, R> => {
|
|
25
25
|
const effect = Effect.forEach(buffers[index], sink.onSuccess)
|
|
26
26
|
buffers[index] = []
|
|
27
27
|
|
|
@@ -63,13 +63,13 @@ export function withBuffers<R, E, A>(size: number, sink: Sink.Sink<R, E, A>) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export const withScope = <R, E, A>(
|
|
66
|
-
f: (scope: Scope.CloseableScope) => Effect.Effect<
|
|
66
|
+
f: (scope: Scope.CloseableScope) => Effect.Effect<A, E, R>,
|
|
67
67
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
68
|
-
): Effect.Effect<R | Scope.Scope
|
|
68
|
+
): Effect.Effect<A, E, R | Scope.Scope> =>
|
|
69
69
|
Effect.acquireUseRelease(Effect.scopeWith((scope) => Scope.fork(scope, executionStrategy)), f, Scope.close)
|
|
70
70
|
|
|
71
71
|
export const getExitEquivalence = <E, A>(A: Equivalence.Equivalence<A>) =>
|
|
72
|
-
Equivalence.make<Exit.Exit<
|
|
72
|
+
Equivalence.make<Exit.Exit<A, E>>((a, b) => {
|
|
73
73
|
if (a._tag === "Failure") {
|
|
74
74
|
return b._tag === "Failure" && Equal.equals(a.cause, b.cause)
|
|
75
75
|
} else {
|
|
@@ -78,15 +78,15 @@ export const getExitEquivalence = <E, A>(A: Equivalence.Equivalence<A>) =>
|
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
export function withScopedFork<R, E, A>(
|
|
81
|
-
f: (fork: ScopedFork, scope: Scope.CloseableScope) => Effect.Effect<
|
|
81
|
+
f: (fork: ScopedFork, scope: Scope.CloseableScope) => Effect.Effect<A, E, R>,
|
|
82
82
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
83
|
-
): Effect.Effect<R | Scope.Scope
|
|
83
|
+
): Effect.Effect<A, E, R | Scope.Scope> {
|
|
84
84
|
return withScope((scope) => f(makeForkInScope(scope), scope), executionStrategy)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export function makeForkInScope(scope: Scope.Scope) {
|
|
88
|
-
return <R, E, A>(effect: Effect.Effect<
|
|
89
|
-
matchEffectPrimitive<R, E, A, Effect.Effect<
|
|
88
|
+
return <R, E, A>(effect: Effect.Effect<A, E, R>) =>
|
|
89
|
+
matchEffectPrimitive<R, E, A, Effect.Effect<Fiber.Fiber<A, E>, never, R>>(effect, {
|
|
90
90
|
Success: (a) => Effect.succeed(Fiber.succeed(a)),
|
|
91
91
|
Failure: (cause) => Effect.succeed(Fiber.failCause(cause)),
|
|
92
92
|
Sync: (f) =>
|
|
@@ -106,13 +106,13 @@ export function makeForkInScope(scope: Scope.Scope) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export function withSwitchFork<R, E, A>(
|
|
109
|
-
f: (fork: FxFork, scope: Scope.CloseableScope) => Effect.Effect<
|
|
109
|
+
f: (fork: FxFork, scope: Scope.CloseableScope) => Effect.Effect<A, E, R>,
|
|
110
110
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
111
111
|
) {
|
|
112
112
|
return withScopedFork(
|
|
113
113
|
(fork, scope) =>
|
|
114
114
|
Effect.flatMap(
|
|
115
|
-
SynchronizedRef.make<Fiber.Fiber<
|
|
115
|
+
SynchronizedRef.make<Fiber.Fiber<unknown>>(Fiber.unit),
|
|
116
116
|
(ref) => runSwitchFork(ref, fork, scope, f)
|
|
117
117
|
),
|
|
118
118
|
executionStrategy
|
|
@@ -120,10 +120,10 @@ export function withSwitchFork<R, E, A>(
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export function runSwitchFork<R, E, A>(
|
|
123
|
-
ref: SynchronizedRef.SynchronizedRef<Fiber.Fiber<
|
|
123
|
+
ref: SynchronizedRef.SynchronizedRef<Fiber.Fiber<unknown>>,
|
|
124
124
|
fork: ScopedFork,
|
|
125
125
|
scope: Scope.CloseableScope,
|
|
126
|
-
f: (fork: FxFork, scope: Scope.CloseableScope) => Effect.Effect<
|
|
126
|
+
f: (fork: FxFork, scope: Scope.CloseableScope) => Effect.Effect<A, E, R>
|
|
127
127
|
) {
|
|
128
128
|
return Effect.zipRight(
|
|
129
129
|
f(
|
|
@@ -143,12 +143,12 @@ export function runSwitchFork<R, E, A>(
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export function withExhaustFork<R, E, A>(
|
|
146
|
-
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<
|
|
146
|
+
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<A, E, R>,
|
|
147
147
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
148
148
|
) {
|
|
149
149
|
return withScopedFork((fork, scope) => {
|
|
150
150
|
return Effect.flatMap(
|
|
151
|
-
SynchronizedRef.make<Fiber.Fiber<
|
|
151
|
+
SynchronizedRef.make<Fiber.Fiber<void> | null>(null),
|
|
152
152
|
(ref) =>
|
|
153
153
|
Effect.flatMap(
|
|
154
154
|
f((effect) =>
|
|
@@ -171,14 +171,14 @@ export function withExhaustFork<R, E, A>(
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
export function withExhaustLatestFork<R, E, A>(
|
|
174
|
-
f: (exhaustLatestFork: FxFork, scope: Scope.Scope) => Effect.Effect<
|
|
174
|
+
f: (exhaustLatestFork: FxFork, scope: Scope.Scope) => Effect.Effect<A, E, R>,
|
|
175
175
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
176
176
|
) {
|
|
177
177
|
return withScopedFork((fork, scope) =>
|
|
178
178
|
Effect.flatMap(
|
|
179
179
|
Effect.zip(
|
|
180
|
-
Ref.make<Fiber.Fiber<
|
|
181
|
-
Ref.make<Option.Option<Effect.Effect<
|
|
180
|
+
Ref.make<Fiber.Fiber<void> | void>(undefined),
|
|
181
|
+
Ref.make<Option.Option<Effect.Effect<void, never, any>>>(Option.none())
|
|
182
182
|
),
|
|
183
183
|
([ref, nextEffect]) => {
|
|
184
184
|
const reset = Ref.set(ref, undefined)
|
|
@@ -188,7 +188,7 @@ export function withExhaustLatestFork<R, E, A>(
|
|
|
188
188
|
|
|
189
189
|
// Run the next value that's be saved for replay if it exists
|
|
190
190
|
|
|
191
|
-
const runNext: Effect.Effect<
|
|
191
|
+
const runNext: Effect.Effect<void, never, any> = Effect.flatMap(
|
|
192
192
|
Ref.get(nextEffect),
|
|
193
193
|
(next) => {
|
|
194
194
|
if (Option.isNone(next)) {
|
|
@@ -206,7 +206,7 @@ export function withExhaustLatestFork<R, E, A>(
|
|
|
206
206
|
}
|
|
207
207
|
)
|
|
208
208
|
|
|
209
|
-
const exhaustLatestFork = <R2>(eff: Effect.Effect<
|
|
209
|
+
const exhaustLatestFork = <R2>(eff: Effect.Effect<void, never, R2>) =>
|
|
210
210
|
Effect.flatMap(Ref.get(ref), (currentFiber) =>
|
|
211
211
|
currentFiber
|
|
212
212
|
? Ref.set(nextEffect, Option.some(eff))
|
|
@@ -226,11 +226,11 @@ export function withExhaustLatestFork<R, E, A>(
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
export function withUnboundedFork<R, E, A>(
|
|
229
|
-
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<
|
|
229
|
+
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<A, E, R>
|
|
230
230
|
) {
|
|
231
231
|
return Effect.scopeWith((scope) =>
|
|
232
232
|
Effect.flatMap(
|
|
233
|
-
FiberSet.make<
|
|
233
|
+
FiberSet.make<void, never>(),
|
|
234
234
|
(set) =>
|
|
235
235
|
Effect.flatMap(
|
|
236
236
|
f((effect) => FiberSet.run(set, effect), scope),
|
|
@@ -242,12 +242,12 @@ export function withUnboundedFork<R, E, A>(
|
|
|
242
242
|
|
|
243
243
|
export function withBoundedFork(capacity: number) {
|
|
244
244
|
return <R, E, A>(
|
|
245
|
-
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<
|
|
245
|
+
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<A, E, R>,
|
|
246
246
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
247
247
|
) => {
|
|
248
248
|
return withScopedFork((fork, scope) =>
|
|
249
249
|
Effect.flatMap(
|
|
250
|
-
Ref.make<Set<Fiber.Fiber<
|
|
250
|
+
Ref.make<Set<Fiber.Fiber<void>>>(new Set()).pipe(Effect.zip(Effect.makeSemaphore(capacity))),
|
|
251
251
|
([ref, semaphore]) =>
|
|
252
252
|
Effect.flatMap(
|
|
253
253
|
f((effect) =>
|
|
@@ -272,9 +272,9 @@ export function withBoundedFork(capacity: number) {
|
|
|
272
272
|
export function withFlattenStrategy(
|
|
273
273
|
strategy: FlattenStrategy
|
|
274
274
|
): <R, E, A>(
|
|
275
|
-
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<
|
|
275
|
+
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<A, E, R>,
|
|
276
276
|
executionStrategy: ExecutionStrategy.ExecutionStrategy
|
|
277
|
-
) => Effect.Effect<R | Scope.Scope
|
|
277
|
+
) => Effect.Effect<void, E, R | Scope.Scope> {
|
|
278
278
|
switch (strategy._tag) {
|
|
279
279
|
case "Bounded":
|
|
280
280
|
return withBoundedFork(strategy.capacity)
|
|
@@ -290,7 +290,7 @@ export function withFlattenStrategy(
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
export function matchEffectPrimitive<R, E, A, Z>(
|
|
293
|
-
effect: Effect.Effect<
|
|
293
|
+
effect: Effect.Effect<A, E, R>,
|
|
294
294
|
matchers: {
|
|
295
295
|
Success: (a: A) => Z
|
|
296
296
|
Failure: (e: Cause.Cause<E>) => Z
|
|
@@ -299,7 +299,7 @@ export function matchEffectPrimitive<R, E, A, Z>(
|
|
|
299
299
|
Right: (a: A) => Z
|
|
300
300
|
Some: (a: A) => Z
|
|
301
301
|
None: (e: E) => Z
|
|
302
|
-
Otherwise: (effect: Effect.Effect<
|
|
302
|
+
Otherwise: (effect: Effect.Effect<A, E, R>) => Z
|
|
303
303
|
}
|
|
304
304
|
): Z {
|
|
305
305
|
const eff = effect as any
|
|
@@ -341,7 +341,7 @@ export function adjustTime(input: Duration.DurationInput = 1) {
|
|
|
341
341
|
|
|
342
342
|
export function tupleSink<R, E, A extends ReadonlyArray<any>, R2, E2, B>(
|
|
343
343
|
sink: Sink.Sink<R, E, A>,
|
|
344
|
-
f: (sink: (index: number, value: A[number]) => Effect.Effect<
|
|
344
|
+
f: (sink: (index: number, value: A[number]) => Effect.Effect<unknown, never, R>) => Effect.Effect<B, E2, R2>,
|
|
345
345
|
expected: number
|
|
346
346
|
) {
|
|
347
347
|
return Effect.suspend(() => {
|
|
@@ -362,13 +362,13 @@ export function tupleSink<R, E, A extends ReadonlyArray<any>, R2, E2, B>(
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
export function withDebounceFork<R, E, A>(
|
|
365
|
-
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<
|
|
365
|
+
f: (fork: FxFork, scope: Scope.Scope) => Effect.Effect<A, E, R>,
|
|
366
366
|
duration: Duration.DurationInput
|
|
367
|
-
): Effect.Effect<R | Scope.Scope
|
|
367
|
+
): Effect.Effect<unknown, E, R | Scope.Scope> {
|
|
368
368
|
return withScopedFork(
|
|
369
369
|
(fork, scope) =>
|
|
370
370
|
Effect.flatMap(
|
|
371
|
-
SynchronizedRef.make(Option.none<Fiber.Fiber<
|
|
371
|
+
SynchronizedRef.make(Option.none<Fiber.Fiber<void>>()),
|
|
372
372
|
(ref) =>
|
|
373
373
|
Effect.flatMap(
|
|
374
374
|
f(
|
|
@@ -418,7 +418,7 @@ export class RingBuffer<A> {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
forEach<R2, E2, B>(
|
|
421
|
-
f: (a: A, i: number) => Effect.Effect<
|
|
421
|
+
f: (a: A, i: number) => Effect.Effect<B, E2, R2>
|
|
422
422
|
) {
|
|
423
423
|
switch (this._size) {
|
|
424
424
|
case 0:
|
|
@@ -450,16 +450,16 @@ export class RingBuffer<A> {
|
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
export function awaitScopeClose(scope: Scope.Scope) {
|
|
453
|
-
return Effect.asyncEffect<never, never,
|
|
453
|
+
return Effect.asyncEffect<unknown, never, never, void, never, never>((cb) =>
|
|
454
454
|
Scope.addFinalizerExit(scope, () => Effect.sync(() => cb(Effect.unit)))
|
|
455
455
|
)
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
export class MulticastEffect<R, E, A> extends Effectable.Class<
|
|
459
|
-
private _fiber: Fiber.Fiber<
|
|
458
|
+
export class MulticastEffect<R, E, A> extends Effectable.Class<A, E, R> {
|
|
459
|
+
private _fiber: Fiber.Fiber<A, E> | null = null
|
|
460
460
|
|
|
461
461
|
constructor(
|
|
462
|
-
readonly effect: Effect.Effect<
|
|
462
|
+
readonly effect: Effect.Effect<A, E, R>
|
|
463
463
|
) {
|
|
464
464
|
super()
|
|
465
465
|
}
|
package/src/internal/keyed.ts
CHANGED
|
@@ -20,7 +20,7 @@ type StateContext<A, C> = {
|
|
|
20
20
|
output: C
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const StateContext = Context.
|
|
23
|
+
const StateContext = Context.GenericTag<StateContext<any, any>>("@services/StateContext")
|
|
24
24
|
|
|
25
25
|
class Keyed<R, E, A, B extends PropertyKey, R2, E2, C> extends FxBase<R | R2 | Scope.Scope, E | E2, ReadonlyArray<C>>
|
|
26
26
|
implements Fx<R | R2 | Scope.Scope, E | E2, ReadonlyArray<C>>
|
|
@@ -127,7 +127,7 @@ class KeyedEntry<A, C> {
|
|
|
127
127
|
public index: number,
|
|
128
128
|
public output: Option.Option<C>,
|
|
129
129
|
public readonly ref: RefSubject.RefSubject<never, never, A>,
|
|
130
|
-
public readonly interrupt: Effect.Effect<
|
|
130
|
+
public readonly interrupt: Effect.Effect<void>
|
|
131
131
|
) {}
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -160,7 +160,7 @@ function addValue<A, B extends PropertyKey, C, R2, E2, E, R3, D>(
|
|
|
160
160
|
parentScope: Scope.Scope,
|
|
161
161
|
options: KeyedOptions<A, B, R2, E2, C>,
|
|
162
162
|
sink: Sink.Sink<R2 | R3, E | E2, ReadonlyArray<C>>,
|
|
163
|
-
scheduleNextEmit: Effect.Effect<
|
|
163
|
+
scheduleNextEmit: Effect.Effect<D, never, R3>
|
|
164
164
|
) {
|
|
165
165
|
return Effect.gen(function*(_) {
|
|
166
166
|
const value = values[patch.index]
|
package/src/internal/protos.ts
CHANGED
|
@@ -15,24 +15,24 @@ const Variance: Fx.Variance<never, never, never> = {
|
|
|
15
15
|
export abstract class FxBase<R, E, A> implements Fx<R, E, A> {
|
|
16
16
|
readonly [TypeId]: Fx.Variance<R, E, A> = Variance
|
|
17
17
|
|
|
18
|
-
abstract run<R2>(sink: Sink<R2, E, A>): Effect.Effect<R | R2
|
|
18
|
+
abstract run<R2>(sink: Sink<R2, E, A>): Effect.Effect<unknown, never, R | R2>
|
|
19
19
|
|
|
20
20
|
pipe() {
|
|
21
21
|
return pipeArguments(this, arguments)
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export abstract class FxEffectBase<R, E, A, R2, E2, B> extends Effectable.StructuralClass<
|
|
26
|
-
implements Fx<R, E, A>, Effect.Effect<
|
|
25
|
+
export abstract class FxEffectBase<R, E, A, R2, E2, B> extends Effectable.StructuralClass<B, E2, R2>
|
|
26
|
+
implements Fx<R, E, A>, Effect.Effect<B, E2, R2>
|
|
27
27
|
{
|
|
28
28
|
readonly [TypeId]: Fx.Variance<R, E, A> = Variance
|
|
29
29
|
|
|
30
|
-
abstract run<R3>(sink: Sink<R3, E, A>): Effect.Effect<R | R3
|
|
30
|
+
abstract run<R3>(sink: Sink<R3, E, A>): Effect.Effect<unknown, never, R | R3>
|
|
31
31
|
|
|
32
|
-
abstract toEffect(): Effect.Effect<
|
|
32
|
+
abstract toEffect(): Effect.Effect<B, E2, R2>
|
|
33
33
|
|
|
34
|
-
protected _effect: Effect.Effect<
|
|
35
|
-
commit(): Effect.Effect<
|
|
34
|
+
protected _effect: Effect.Effect<B, E2, R2> | undefined
|
|
35
|
+
commit(): Effect.Effect<B, E2, R2> {
|
|
36
36
|
if (this._effect === undefined) {
|
|
37
37
|
return (this._effect = this.toEffect())
|
|
38
38
|
} else {
|
|
@@ -41,13 +41,13 @@ export abstract class FxEffectBase<R, E, A, R2, E2, B> extends Effectable.Struct
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export abstract class EffectBase<R, E, A> extends Effectable.StructuralClass<
|
|
45
|
-
implements Effect.Effect<
|
|
44
|
+
export abstract class EffectBase<R, E, A> extends Effectable.StructuralClass<A, E, R>
|
|
45
|
+
implements Effect.Effect<A, E, R>
|
|
46
46
|
{
|
|
47
|
-
abstract toEffect(): Effect.Effect<
|
|
47
|
+
abstract toEffect(): Effect.Effect<A, E, R>
|
|
48
48
|
|
|
49
|
-
private _effect: Effect.Effect<
|
|
50
|
-
commit(): Effect.Effect<
|
|
49
|
+
private _effect: Effect.Effect<A, E, R> | undefined
|
|
50
|
+
commit(): Effect.Effect<A, E, R> {
|
|
51
51
|
if (this._effect === undefined) {
|
|
52
52
|
return (this._effect = this.toEffect())
|
|
53
53
|
} else {
|
package/src/internal/provide.ts
CHANGED
|
@@ -25,10 +25,10 @@ export const ProvideContext = <A>(i0: Context.Context<A>): ProvideContext<A> =>
|
|
|
25
25
|
|
|
26
26
|
export interface ProvideLayer<R, E, A> {
|
|
27
27
|
readonly _tag: "ProvideLayer"
|
|
28
|
-
readonly i0: Layer.Layer<
|
|
28
|
+
readonly i0: Layer.Layer<A, E, R>
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export const ProvideLayer = <R, E, A>(i0: Layer.Layer<
|
|
31
|
+
export const ProvideLayer = <R, E, A>(i0: Layer.Layer<A, E, R>): ProvideLayer<R, E, A> => ({
|
|
32
32
|
_tag: "ProvideLayer",
|
|
33
33
|
i0
|
|
34
34
|
})
|
|
@@ -48,12 +48,12 @@ export const ProvideService = <I, S>(i0: Context.Tag<I, S>, i1: S): ProvideServi
|
|
|
48
48
|
export interface ProvideServiceEffect<R, E, I, S> {
|
|
49
49
|
readonly _tag: "ProvideServiceEffect"
|
|
50
50
|
readonly i0: Context.Tag<I, S>
|
|
51
|
-
readonly i1: Effect.Effect<
|
|
51
|
+
readonly i1: Effect.Effect<S, E, R>
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export const ProvideServiceEffect = <R, E, I, S>(
|
|
55
55
|
i0: Context.Tag<I, S>,
|
|
56
|
-
i1: Effect.Effect<
|
|
56
|
+
i1: Effect.Effect<S, E, R>
|
|
57
57
|
): ProvideServiceEffect<R, E, I, S> => ({
|
|
58
58
|
_tag: "ProvideServiceEffect",
|
|
59
59
|
i0,
|
|
@@ -75,9 +75,9 @@ export function matchProvide<R = never, E = never, A = never, B = never>(
|
|
|
75
75
|
matchers: {
|
|
76
76
|
readonly ProvideContext: (i0: Context.Context<A>) => B
|
|
77
77
|
readonly ProvideRuntime: (i0: Runtime.Runtime<A>) => B
|
|
78
|
-
readonly ProvideLayer: (i0: Layer.Layer<
|
|
78
|
+
readonly ProvideLayer: (i0: Layer.Layer<A, E, R>) => B
|
|
79
79
|
readonly ProvideService: (tag: Context.Tag<A, any>, service: any) => B
|
|
80
|
-
readonly ProvideServiceEffect: (tag: Context.Tag<A, any>, service: Effect.Effect<
|
|
80
|
+
readonly ProvideServiceEffect: (tag: Context.Tag<A, any>, service: Effect.Effect<any, E, R>) => B
|
|
81
81
|
}
|
|
82
82
|
): B {
|
|
83
83
|
return matchers[self._tag](self.i0 as any, (self as any).i1)
|
|
@@ -97,7 +97,7 @@ export function buildWithScope<R, E, A>(
|
|
|
97
97
|
return Layer.buildWithScope(toLayer(provide), scope)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
export function toLayer<R, E, A>(provide: Provide<R, E, A>): Layer.Layer<
|
|
100
|
+
export function toLayer<R, E, A>(provide: Provide<R, E, A>): Layer.Layer<A, E, R> {
|
|
101
101
|
switch (provide._tag) {
|
|
102
102
|
case "ProvideContext":
|
|
103
103
|
return Layer.succeedContext(provide.i0)
|
|
@@ -113,13 +113,13 @@ export function toLayer<R, E, A>(provide: Provide<R, E, A>): Layer.Layer<R, E, A
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export function provideToEffect<R, E, A, R2 = never, E2 = never, S = never>(
|
|
116
|
-
effect: Effect.Effect<
|
|
116
|
+
effect: Effect.Effect<A, E, R>,
|
|
117
117
|
provide: Provide<R2, E2, S>
|
|
118
|
-
): Effect.Effect<Exclude<R, S> | R2
|
|
118
|
+
): Effect.Effect<A, E | E2, Exclude<R, S> | R2> {
|
|
119
119
|
return Effect.provide(effect, toLayer(provide))
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export function runtimeToLayer<R>(runtime: Runtime.Runtime<R>): Layer.Layer<
|
|
122
|
+
export function runtimeToLayer<R>(runtime: Runtime.Runtime<R>): Layer.Layer<R> {
|
|
123
123
|
// Calculate patch
|
|
124
124
|
const patchRefs = FiberRefsPatch.diff(Runtime.defaultRuntime.fiberRefs, runtime.fiberRefs)
|
|
125
125
|
const patchFlags = RuntimeFlags.diff(Runtime.defaultRuntime.runtimeFlags, runtime.runtimeFlags)
|
package/src/internal/share.ts
CHANGED
|
@@ -30,7 +30,7 @@ class RefCounter {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export class Share<R, E, A, R2> extends FxBase<R | R2 | Scope.Scope, E, A> {
|
|
33
|
-
_FxFiber: MutableRef.MutableRef<Option.Option<Fiber.Fiber<
|
|
33
|
+
_FxFiber: MutableRef.MutableRef<Option.Option<Fiber.Fiber<unknown>>> = MutableRef.make(Option.none())
|
|
34
34
|
_RefCount = new RefCounter()
|
|
35
35
|
|
|
36
36
|
constructor(
|
|
@@ -40,7 +40,7 @@ export class Share<R, E, A, R2> extends FxBase<R | R2 | Scope.Scope, E, A> {
|
|
|
40
40
|
super()
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
run<R3>(sink: Sink<R3, E, A>): Effect.Effect<R | R2 | R3 | Scope.Scope
|
|
43
|
+
run<R3>(sink: Sink<R3, E, A>): Effect.Effect<unknown, never, R | R2 | R3 | Scope.Scope> {
|
|
44
44
|
return withScopedFork(
|
|
45
45
|
(fork) =>
|
|
46
46
|
Effect.flatMap(
|
|
@@ -53,7 +53,7 @@ export class Share<R, E, A, R2> extends FxBase<R | R2 | Scope.Scope, E, A> {
|
|
|
53
53
|
)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
private initialize(): Effect.Effect<R | R2
|
|
56
|
+
private initialize(): Effect.Effect<unknown, never, R | R2> {
|
|
57
57
|
return Effect.suspend(() => {
|
|
58
58
|
if (this._RefCount.increment() === 1) {
|
|
59
59
|
return this.i0.run(this.i1).pipe(
|
|
@@ -80,7 +80,7 @@ export class Share<R, E, A, R2> extends FxBase<R | R2 | Scope.Scope, E, A> {
|
|
|
80
80
|
})
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
private interrupt(): Effect.Effect<R | R2
|
|
83
|
+
private interrupt(): Effect.Effect<void, never, R | R2> {
|
|
84
84
|
return Effect.suspend(() => {
|
|
85
85
|
const fiber = Option.getOrNull(MutableRef.getAndSet(this._FxFiber, Option.none()))
|
|
86
86
|
|