effect 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +14 -2
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Exit.js.map +1 -1
- package/dist/cjs/HashMap.js.map +1 -1
- package/dist/cjs/HashSet.js.map +1 -1
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/Option.js +13 -1
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Readable.js.map +1 -1
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/RequestResolver.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Subscribable.js.map +1 -1
- package/dist/cjs/Utils.js +42 -2
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/cause.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +4 -1
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/core.js +4 -3
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/dataSource.js +2 -2
- package/dist/cjs/internal/dataSource.js.map +1 -1
- package/dist/cjs/internal/effectable.js +2 -2
- package/dist/cjs/internal/effectable.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +13 -3
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/hashMap.js.map +1 -1
- package/dist/cjs/internal/hashSet.js.map +1 -1
- package/dist/cjs/internal/schedule.js.map +1 -1
- package/dist/cjs/internal/stm/core.js +2 -1
- package/dist/cjs/internal/stm/core.js.map +1 -1
- package/dist/cjs/internal/stm/stm.js +2 -1
- package/dist/cjs/internal/stm/stm.js.map +1 -1
- package/dist/cjs/internal/trie.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Array.d.ts +1 -0
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +2 -2
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +1 -1
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +9 -8
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +2 -2
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Exit.d.ts +1 -0
- package/dist/dts/Exit.d.ts.map +1 -1
- package/dist/dts/GroupBy.d.ts +1 -1
- package/dist/dts/GroupBy.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +1 -0
- package/dist/dts/HashMap.d.ts.map +1 -1
- package/dist/dts/HashSet.d.ts +1 -0
- package/dist/dts/HashSet.d.ts.map +1 -1
- package/dist/dts/Iterable.d.ts +1 -0
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/List.d.ts +1 -0
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/Logger.d.ts +2 -2
- package/dist/dts/Logger.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +2 -2
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Readable.d.ts +1 -0
- package/dist/dts/Readable.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +1 -0
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +5 -4
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +5 -4
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/SortedSet.d.ts +1 -1
- package/dist/dts/SortedSet.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +1 -1
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Subscribable.d.ts +1 -0
- package/dist/dts/Subscribable.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +1 -1
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +7 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +49 -25
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/hashMap.d.ts.map +1 -1
- package/dist/dts/internal/stm/stm.d.ts.map +1 -1
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +14 -2
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Exit.js.map +1 -1
- package/dist/esm/HashMap.js.map +1 -1
- package/dist/esm/HashSet.js.map +1 -1
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/Option.js +14 -2
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Readable.js.map +1 -1
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/RequestResolver.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Subscribable.js.map +1 -1
- package/dist/esm/Utils.js +39 -2
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/cause.js.map +1 -1
- package/dist/esm/internal/core-effect.js +4 -1
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/core.js +4 -3
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/dataSource.js +2 -2
- package/dist/esm/internal/dataSource.js.map +1 -1
- package/dist/esm/internal/effectable.js +2 -2
- package/dist/esm/internal/effectable.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +13 -3
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/hashMap.js.map +1 -1
- package/dist/esm/internal/hashSet.js.map +1 -1
- package/dist/esm/internal/schedule.js.map +1 -1
- package/dist/esm/internal/stm/core.js +2 -1
- package/dist/esm/internal/stm/core.js.map +1 -1
- package/dist/esm/internal/stm/stm.js +2 -1
- package/dist/esm/internal/stm/stm.js.map +1 -1
- package/dist/esm/internal/trie.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Array.ts +1 -0
- package/src/Cause.ts +2 -2
- package/src/Chunk.ts +1 -1
- package/src/Effect.ts +9 -8
- package/src/Either.ts +16 -4
- package/src/Exit.ts +1 -0
- package/src/GroupBy.ts +1 -1
- package/src/HashMap.ts +1 -0
- package/src/HashSet.ts +1 -0
- package/src/Iterable.ts +1 -0
- package/src/List.ts +1 -0
- package/src/Logger.ts +2 -2
- package/src/Option.ts +16 -4
- package/src/Readable.ts +1 -0
- package/src/Record.ts +1 -0
- package/src/RequestResolver.ts +7 -6
- package/src/STM.ts +5 -4
- package/src/SortedSet.ts +1 -1
- package/src/Stream.ts +1 -1
- package/src/Subscribable.ts +1 -0
- package/src/Trie.ts +1 -1
- package/src/Types.ts +8 -0
- package/src/Utils.ts +74 -27
- package/src/internal/cause.ts +1 -0
- package/src/internal/core-effect.ts +7 -4
- package/src/internal/core.ts +5 -4
- package/src/internal/dataSource.ts +9 -8
- package/src/internal/effectable.ts +2 -2
- package/src/internal/fiberRuntime.ts +21 -4
- package/src/internal/groupBy.ts +1 -1
- package/src/internal/hashMap.ts +1 -0
- package/src/internal/hashSet.ts +1 -0
- package/src/internal/schedule.ts +6 -5
- package/src/internal/stm/core.ts +2 -1
- package/src/internal/stm/stm.ts +3 -2
- package/src/internal/stream.ts +1 -1
- package/src/internal/trie.ts +1 -0
- package/src/internal/version.ts +1 -1
package/src/STM.ts
CHANGED
|
@@ -14,8 +14,9 @@ import * as stm from "./internal/stm/stm.js"
|
|
|
14
14
|
import type * as Option from "./Option.js"
|
|
15
15
|
import type { Pipeable } from "./Pipeable.js"
|
|
16
16
|
import type { Predicate, Refinement } from "./Predicate.js"
|
|
17
|
-
import type { Covariant, MergeRecord } from "./Types.js"
|
|
17
|
+
import type { Covariant, MergeRecord, NoInfer } from "./Types.js"
|
|
18
18
|
import type * as Unify from "./Unify.js"
|
|
19
|
+
import type { YieldWrap } from "./Utils.js"
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @since 2.0.0
|
|
@@ -1064,12 +1065,12 @@ export interface Adapter {
|
|
|
1064
1065
|
* @since 2.0.0
|
|
1065
1066
|
* @category constructors
|
|
1066
1067
|
*/
|
|
1067
|
-
export const gen: <Eff extends STM<any, any, any
|
|
1068
|
+
export const gen: <Eff extends YieldWrap<STM<any, any, any>>, AEff>(
|
|
1068
1069
|
f: (resume: Adapter) => Generator<Eff, AEff, never>
|
|
1069
1070
|
) => STM<
|
|
1070
1071
|
AEff,
|
|
1071
|
-
[Eff] extends [never] ? never : [Eff] extends [STM<infer _A, infer E, infer _R
|
|
1072
|
-
[Eff] extends [never] ? never : [Eff] extends [STM<infer _A, infer _E, infer R
|
|
1072
|
+
[Eff] extends [never] ? never : [Eff] extends [YieldWrap<STM<infer _A, infer E, infer _R>>] ? E : never,
|
|
1073
|
+
[Eff] extends [never] ? never : [Eff] extends [YieldWrap<STM<infer _A, infer _E, infer R>>] ? R : never
|
|
1073
1074
|
> = stm.gen
|
|
1074
1075
|
|
|
1075
1076
|
/**
|
package/src/SortedSet.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { pipeArguments } from "./Pipeable.js"
|
|
|
14
14
|
import type { Predicate } from "./Predicate.js"
|
|
15
15
|
import { hasProperty } from "./Predicate.js"
|
|
16
16
|
import * as RBT from "./RedBlackTree.js"
|
|
17
|
-
import type { Invariant } from "./Types.js"
|
|
17
|
+
import type { Invariant, NoInfer } from "./Types.js"
|
|
18
18
|
|
|
19
19
|
const TypeId: unique symbol = Symbol.for("effect/SortedSet")
|
|
20
20
|
|
package/src/Stream.ts
CHANGED
|
@@ -29,7 +29,7 @@ import type * as Emit from "./StreamEmit.js"
|
|
|
29
29
|
import type * as HaltStrategy from "./StreamHaltStrategy.js"
|
|
30
30
|
import type * as Take from "./Take.js"
|
|
31
31
|
import type * as Tracer from "./Tracer.js"
|
|
32
|
-
import type { Covariant, MergeRecord } from "./Types.js"
|
|
32
|
+
import type { Covariant, MergeRecord, NoInfer } from "./Types.js"
|
|
33
33
|
import type * as Unify from "./Unify.js"
|
|
34
34
|
|
|
35
35
|
/**
|
package/src/Subscribable.ts
CHANGED
package/src/Trie.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type { Inspectable } from "./Inspectable.js"
|
|
|
20
20
|
import * as TR from "./internal/trie.js"
|
|
21
21
|
import type { Option } from "./Option.js"
|
|
22
22
|
import type { Pipeable } from "./Pipeable.js"
|
|
23
|
-
import type { Covariant } from "./Types.js"
|
|
23
|
+
import type { Covariant, NoInfer } from "./Types.js"
|
|
24
24
|
|
|
25
25
|
const TypeId: unique symbol = TR.TrieTypeId as TypeId
|
|
26
26
|
|
package/src/Types.ts
CHANGED
|
@@ -170,6 +170,14 @@ export type Mutable<T> = {
|
|
|
170
170
|
-readonly [P in keyof T]: T[P]
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Avoid inference on a specific parameter
|
|
175
|
+
*
|
|
176
|
+
* @since 2.0.0
|
|
177
|
+
* @category models
|
|
178
|
+
*/
|
|
179
|
+
export type NoInfer<A> = [A][A extends any ? 0 : never]
|
|
180
|
+
|
|
173
181
|
/**
|
|
174
182
|
* Invariant helper.
|
|
175
183
|
*
|
package/src/Utils.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { identity } from "./Function.js"
|
|
5
5
|
import type { Kind, TypeLambda } from "./HKT.js"
|
|
6
|
-
import {
|
|
6
|
+
import { getBugErrorMessage } from "./internal/errors.js"
|
|
7
|
+
import { isNullable, isObject } from "./Predicate.js"
|
|
7
8
|
import type * as Types from "./Types.js"
|
|
8
9
|
|
|
9
10
|
/*
|
|
@@ -41,6 +42,12 @@ export interface GenKind<F extends TypeLambda, R, O, E, A> extends Variance<F, R
|
|
|
41
42
|
[Symbol.iterator](): Generator<GenKind<F, R, O, E, A>, A>
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @category predicates
|
|
47
|
+
* @since 3.0.6
|
|
48
|
+
*/
|
|
49
|
+
export const isGenKind = (u: unknown): u is GenKind<any, any, any, any, any> => isObject(u) && GenKindTypeId in u
|
|
50
|
+
|
|
44
51
|
/**
|
|
45
52
|
* @category constructors
|
|
46
53
|
* @since 2.0.0
|
|
@@ -173,13 +180,19 @@ export interface Variance<in out F extends TypeLambda, in R, out O, out E> {
|
|
|
173
180
|
* @since 2.0.0
|
|
174
181
|
*/
|
|
175
182
|
export interface Gen<F extends TypeLambda, Z> {
|
|
176
|
-
<K extends Variance<F, any, any, any> | Kind<F, any, any, any, any
|
|
183
|
+
<K extends Variance<F, any, any, any> | YieldWrap<Kind<F, any, any, any, any>>, A>(
|
|
177
184
|
body: (resume: Z) => Generator<K, A, never>
|
|
178
185
|
): Kind<
|
|
179
186
|
F,
|
|
180
|
-
[K] extends [Variance<F, infer R, any, any>] ? R
|
|
181
|
-
|
|
182
|
-
|
|
187
|
+
[K] extends [Variance<F, infer R, any, any>] ? R
|
|
188
|
+
: [K] extends [YieldWrap<Kind<F, infer R, any, any, any>>] ? R
|
|
189
|
+
: never,
|
|
190
|
+
[K] extends [Variance<F, any, infer O, any>] ? O
|
|
191
|
+
: [K] extends [YieldWrap<Kind<F, any, infer O, any, any>>] ? O
|
|
192
|
+
: never,
|
|
193
|
+
[K] extends [Variance<F, any, any, infer E>] ? E
|
|
194
|
+
: [K] extends [YieldWrap<Kind<F, any, any, infer E, any>>] ? E
|
|
195
|
+
: never,
|
|
183
196
|
A
|
|
184
197
|
>
|
|
185
198
|
}
|
|
@@ -191,22 +204,22 @@ export interface Gen<F extends TypeLambda, Z> {
|
|
|
191
204
|
export interface Adapter<Z extends TypeLambda> {
|
|
192
205
|
<_R, _O, _E, _A>(
|
|
193
206
|
self: Kind<Z, _R, _O, _E, _A>
|
|
194
|
-
):
|
|
195
|
-
<A, _R, _O, _E, _A>(a: A, ab: (a: A) => Kind<Z, _R, _O, _E, _A>):
|
|
196
|
-
<A, B, _R, _O, _E, _A>(a: A, ab: (a: A) => B, bc: (b: B) => Kind<Z, _R, _O, _E, _A>):
|
|
207
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
208
|
+
<A, _R, _O, _E, _A>(a: A, ab: (a: A) => Kind<Z, _R, _O, _E, _A>): GenKind<Z, _R, _O, _E, _A>
|
|
209
|
+
<A, B, _R, _O, _E, _A>(a: A, ab: (a: A) => B, bc: (b: B) => Kind<Z, _R, _O, _E, _A>): GenKind<Z, _R, _O, _E, _A>
|
|
197
210
|
<A, B, C, _R, _O, _E, _A>(
|
|
198
211
|
a: A,
|
|
199
212
|
ab: (a: A) => B,
|
|
200
213
|
bc: (b: B) => C,
|
|
201
214
|
cd: (c: C) => Kind<Z, _R, _O, _E, _A>
|
|
202
|
-
):
|
|
215
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
203
216
|
<A, B, C, D, _R, _O, _E, _A>(
|
|
204
217
|
a: A,
|
|
205
218
|
ab: (a: A) => B,
|
|
206
219
|
bc: (b: B) => C,
|
|
207
220
|
cd: (c: C) => D,
|
|
208
221
|
de: (d: D) => Kind<Z, _R, _O, _E, _A>
|
|
209
|
-
):
|
|
222
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
210
223
|
<A, B, C, D, E, _R, _O, _E, _A>(
|
|
211
224
|
a: A,
|
|
212
225
|
ab: (a: A) => B,
|
|
@@ -214,7 +227,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
214
227
|
cd: (c: C) => D,
|
|
215
228
|
de: (d: D) => E,
|
|
216
229
|
ef: (e: E) => Kind<Z, _R, _O, _E, _A>
|
|
217
|
-
):
|
|
230
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
218
231
|
<A, B, C, D, E, F, _R, _O, _E, _A>(
|
|
219
232
|
a: A,
|
|
220
233
|
ab: (a: A) => B,
|
|
@@ -223,7 +236,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
223
236
|
de: (d: D) => E,
|
|
224
237
|
ef: (e: E) => F,
|
|
225
238
|
fg: (f: F) => Kind<Z, _R, _O, _E, _A>
|
|
226
|
-
):
|
|
239
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
227
240
|
<A, B, C, D, E, F, G, _R, _O, _E, _A>(
|
|
228
241
|
a: A,
|
|
229
242
|
ab: (a: A) => B,
|
|
@@ -233,7 +246,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
233
246
|
ef: (e: E) => F,
|
|
234
247
|
fg: (f: F) => G,
|
|
235
248
|
gh: (g: F) => Kind<Z, _R, _O, _E, _A>
|
|
236
|
-
):
|
|
249
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
237
250
|
<A, B, C, D, E, F, G, H, _R, _O, _E, _A>(
|
|
238
251
|
a: A,
|
|
239
252
|
ab: (a: A) => B,
|
|
@@ -244,7 +257,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
244
257
|
fg: (f: F) => G,
|
|
245
258
|
gh: (g: G) => H,
|
|
246
259
|
hi: (g: H) => Kind<Z, _R, _O, _E, _A>
|
|
247
|
-
):
|
|
260
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
248
261
|
<A, B, C, D, E, F, G, H, I, _R, _O, _E, _A>(
|
|
249
262
|
a: A,
|
|
250
263
|
ab: (a: A) => B,
|
|
@@ -256,7 +269,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
256
269
|
gh: (g: G) => H,
|
|
257
270
|
hi: (h: H) => I,
|
|
258
271
|
ij: (i: I) => Kind<Z, _R, _O, _E, _A>
|
|
259
|
-
):
|
|
272
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
260
273
|
<A, B, C, D, E, F, G, H, I, J, _R, _O, _E, _A>(
|
|
261
274
|
a: A,
|
|
262
275
|
ab: (a: A) => B,
|
|
@@ -269,7 +282,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
269
282
|
hi: (h: H) => I,
|
|
270
283
|
ij: (i: I) => J,
|
|
271
284
|
jk: (j: J) => Kind<Z, _R, _O, _E, _A>
|
|
272
|
-
):
|
|
285
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
273
286
|
<A, B, C, D, E, F, G, H, I, J, K, _R, _O, _E, _A>(
|
|
274
287
|
a: A,
|
|
275
288
|
ab: (a: A) => B,
|
|
@@ -283,7 +296,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
283
296
|
ij: (i: I) => J,
|
|
284
297
|
jk: (j: J) => K,
|
|
285
298
|
kl: (k: K) => Kind<Z, _R, _O, _E, _A>
|
|
286
|
-
):
|
|
299
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
287
300
|
<A, B, C, D, E, F, G, H, I, J, K, L, _R, _O, _E, _A>(
|
|
288
301
|
a: A,
|
|
289
302
|
ab: (a: A) => B,
|
|
@@ -298,7 +311,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
298
311
|
jk: (j: J) => K,
|
|
299
312
|
kl: (k: K) => L,
|
|
300
313
|
lm: (l: L) => Kind<Z, _R, _O, _E, _A>
|
|
301
|
-
):
|
|
314
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
302
315
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, _R, _O, _E, _A>(
|
|
303
316
|
a: A,
|
|
304
317
|
ab: (a: A) => B,
|
|
@@ -314,7 +327,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
314
327
|
kl: (k: K) => L,
|
|
315
328
|
lm: (l: L) => M,
|
|
316
329
|
mn: (m: M) => Kind<Z, _R, _O, _E, _A>
|
|
317
|
-
):
|
|
330
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
318
331
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, _R, _O, _E, _A>(
|
|
319
332
|
a: A,
|
|
320
333
|
ab: (a: A) => B,
|
|
@@ -331,7 +344,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
331
344
|
lm: (l: L) => M,
|
|
332
345
|
mn: (m: M) => N,
|
|
333
346
|
no: (n: N) => Kind<Z, _R, _O, _E, _A>
|
|
334
|
-
):
|
|
347
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
335
348
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, _R, _O, _E, _A>(
|
|
336
349
|
a: A,
|
|
337
350
|
ab: (a: A) => B,
|
|
@@ -349,7 +362,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
349
362
|
mn: (m: M) => N,
|
|
350
363
|
no: (n: N) => O,
|
|
351
364
|
op: (o: O) => Kind<Z, _R, _O, _E, _A>
|
|
352
|
-
):
|
|
365
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
353
366
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, _R, _O, _E, _A>(
|
|
354
367
|
a: A,
|
|
355
368
|
ab: (a: A) => B,
|
|
@@ -368,7 +381,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
368
381
|
no: (n: N) => O,
|
|
369
382
|
op: (o: O) => P,
|
|
370
383
|
pq: (p: P) => Kind<Z, _R, _O, _E, _A>
|
|
371
|
-
):
|
|
384
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
372
385
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, _R, _O, _E, _A>(
|
|
373
386
|
a: A,
|
|
374
387
|
ab: (a: A) => B,
|
|
@@ -388,7 +401,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
388
401
|
op: (o: O) => P,
|
|
389
402
|
pq: (p: P) => Q,
|
|
390
403
|
qr: (q: Q) => Kind<Z, _R, _O, _E, _A>
|
|
391
|
-
):
|
|
404
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
392
405
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, _R, _O, _E, _A>(
|
|
393
406
|
a: A,
|
|
394
407
|
ab: (a: A) => B,
|
|
@@ -409,7 +422,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
409
422
|
pq: (p: P) => Q,
|
|
410
423
|
qr: (q: Q) => R,
|
|
411
424
|
rs: (r: R) => Kind<Z, _R, _O, _E, _A>
|
|
412
|
-
):
|
|
425
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
413
426
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, _R, _O, _E, _A>(
|
|
414
427
|
a: A,
|
|
415
428
|
ab: (a: A) => B,
|
|
@@ -431,7 +444,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
431
444
|
qr: (q: Q) => R,
|
|
432
445
|
rs: (r: R) => S,
|
|
433
446
|
st: (s: S) => Kind<Z, _R, _O, _E, _A>
|
|
434
|
-
):
|
|
447
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
435
448
|
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, _R, _O, _E, _A>(
|
|
436
449
|
a: A,
|
|
437
450
|
ab: (a: A) => B,
|
|
@@ -454,7 +467,7 @@ export interface Adapter<Z extends TypeLambda> {
|
|
|
454
467
|
rs: (r: R) => S,
|
|
455
468
|
st: (s: S) => T,
|
|
456
469
|
tu: (s: T) => Kind<Z, _R, _O, _E, _A>
|
|
457
|
-
):
|
|
470
|
+
): GenKind<Z, _R, _O, _E, _A>
|
|
458
471
|
}
|
|
459
472
|
|
|
460
473
|
/**
|
|
@@ -466,7 +479,7 @@ export const adapter: <F extends TypeLambda>() => Adapter<F> = () => (function()
|
|
|
466
479
|
for (let i = 1; i < arguments.length; i++) {
|
|
467
480
|
x = arguments[i](x)
|
|
468
481
|
}
|
|
469
|
-
return x
|
|
482
|
+
return new GenKindImpl(x) as any
|
|
470
483
|
})
|
|
471
484
|
|
|
472
485
|
const defaultIncHi = 0x14057b7e
|
|
@@ -699,3 +712,37 @@ function add64(
|
|
|
699
712
|
out[0] = hi
|
|
700
713
|
out[1] = lo
|
|
701
714
|
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* @since 3.0.6
|
|
718
|
+
*/
|
|
719
|
+
export const YieldWrapTypeId = Symbol.for("effect/Utils/YieldWrap")
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* @since 3.0.6
|
|
723
|
+
*/
|
|
724
|
+
export class YieldWrap<T> {
|
|
725
|
+
/**
|
|
726
|
+
* @since 3.0.6
|
|
727
|
+
*/
|
|
728
|
+
readonly #value: T
|
|
729
|
+
constructor(value: T) {
|
|
730
|
+
this.#value = value
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* @since 3.0.6
|
|
734
|
+
*/
|
|
735
|
+
[YieldWrapTypeId](): T {
|
|
736
|
+
return this.#value
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* @since 3.0.6
|
|
742
|
+
*/
|
|
743
|
+
export function yieldWrapGet<T>(self: YieldWrap<T>): T {
|
|
744
|
+
if (typeof self === "object" && self !== null && YieldWrapTypeId in self) {
|
|
745
|
+
return self[YieldWrapTypeId]()
|
|
746
|
+
}
|
|
747
|
+
throw new Error(getBugErrorMessage("yieldWrapGet"))
|
|
748
|
+
}
|
package/src/internal/cause.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { pipeArguments } from "../Pipeable.js"
|
|
|
13
13
|
import { hasProperty, isFunction } from "../Predicate.js"
|
|
14
14
|
import type { Predicate, Refinement } from "../Predicate.js"
|
|
15
15
|
import type { AnySpan, Span } from "../Tracer.js"
|
|
16
|
+
import type { NoInfer } from "../Types.js"
|
|
16
17
|
import { getBugErrorMessage } from "./errors.js"
|
|
17
18
|
import * as OpCodes from "./opCodes/cause.js"
|
|
18
19
|
|
|
@@ -25,7 +25,8 @@ import type * as Random from "../Random.js"
|
|
|
25
25
|
import * as Ref from "../Ref.js"
|
|
26
26
|
import type * as runtimeFlagsPatch from "../RuntimeFlagsPatch.js"
|
|
27
27
|
import * as Tracer from "../Tracer.js"
|
|
28
|
-
import type { MergeRecord } from "../Types.js"
|
|
28
|
+
import type { MergeRecord, NoInfer } from "../Types.js"
|
|
29
|
+
import { yieldWrapGet } from "../Utils.js"
|
|
29
30
|
import * as internalCause from "./cause.js"
|
|
30
31
|
import { clockTag } from "./clock.js"
|
|
31
32
|
import * as core from "./core.js"
|
|
@@ -788,9 +789,11 @@ export const gen: typeof Effect.gen = function() {
|
|
|
788
789
|
const state = iterator.next()
|
|
789
790
|
const run = (
|
|
790
791
|
state: IteratorYieldResult<any> | IteratorReturnResult<any>
|
|
791
|
-
): Effect.Effect<any, any, any> =>
|
|
792
|
-
|
|
793
|
-
|
|
792
|
+
): Effect.Effect<any, any, any> => {
|
|
793
|
+
return (state.done
|
|
794
|
+
? core.succeed(state.value)
|
|
795
|
+
: core.flatMap(yieldWrapGet(state.value) as any, (val: any) => run(iterator.next(val))))
|
|
796
|
+
}
|
|
794
797
|
return run(state)
|
|
795
798
|
})
|
|
796
799
|
}
|
package/src/internal/core.ts
CHANGED
|
@@ -35,7 +35,8 @@ import type * as RuntimeFlags from "../RuntimeFlags.js"
|
|
|
35
35
|
import * as RuntimeFlagsPatch from "../RuntimeFlagsPatch.js"
|
|
36
36
|
import type * as Scope from "../Scope.js"
|
|
37
37
|
import type * as Tracer from "../Tracer.js"
|
|
38
|
-
import type { NotFunction } from "../Types.js"
|
|
38
|
+
import type { NoInfer, NotFunction } from "../Types.js"
|
|
39
|
+
import { YieldWrap } from "../Utils.js"
|
|
39
40
|
import * as _blockedRequests from "./blockedRequests.js"
|
|
40
41
|
import * as internalCause from "./cause.js"
|
|
41
42
|
import * as deferred from "./deferred.js"
|
|
@@ -180,7 +181,7 @@ class EffectPrimitive {
|
|
|
180
181
|
return this.toJSON()
|
|
181
182
|
}
|
|
182
183
|
[Symbol.iterator]() {
|
|
183
|
-
return new SingleShotGen(this)
|
|
184
|
+
return new SingleShotGen(new YieldWrap(this))
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
|
|
@@ -221,7 +222,7 @@ class EffectPrimitiveFailure {
|
|
|
221
222
|
return this.toJSON()
|
|
222
223
|
}
|
|
223
224
|
[Symbol.iterator]() {
|
|
224
|
-
return new SingleShotGen(this)
|
|
225
|
+
return new SingleShotGen(new YieldWrap(this))
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
|
|
@@ -262,7 +263,7 @@ class EffectPrimitiveSuccess {
|
|
|
262
263
|
return this.toJSON()
|
|
263
264
|
}
|
|
264
265
|
[Symbol.iterator]() {
|
|
265
|
-
return new SingleShotGen(this)
|
|
266
|
+
return new SingleShotGen(new YieldWrap(this))
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
|
|
@@ -7,6 +7,7 @@ import type * as Either from "../Either.js"
|
|
|
7
7
|
import { dual, pipe } from "../Function.js"
|
|
8
8
|
import type * as Request from "../Request.js"
|
|
9
9
|
import type * as RequestResolver from "../RequestResolver.js"
|
|
10
|
+
import type { NoInfer } from "../Types.js"
|
|
10
11
|
import * as core from "./core.js"
|
|
11
12
|
import { invokeWithInterrupt, zipWithOptions } from "./fiberRuntime.js"
|
|
12
13
|
import { complete } from "./request.js"
|
|
@@ -24,21 +25,21 @@ export const makeWithEntry = <A, R>(
|
|
|
24
25
|
|
|
25
26
|
/** @internal */
|
|
26
27
|
export const makeBatched = <A extends Request.Request<any, any>, R>(
|
|
27
|
-
run: (requests:
|
|
28
|
+
run: (requests: RA.NonEmptyArray<A>) => Effect.Effect<void, never, R>
|
|
28
29
|
): RequestResolver.RequestResolver<A, R> =>
|
|
29
30
|
new core.RequestResolverImpl<A, R>(
|
|
30
31
|
(requests) => {
|
|
31
32
|
if (requests.length > 1) {
|
|
32
33
|
return core.forEachSequentialDiscard(requests, (block) => {
|
|
33
34
|
const filtered = block.filter((_) => !_.state.completed).map((_) => _.request)
|
|
34
|
-
if (filtered
|
|
35
|
+
if (!RA.isNonEmptyArray(filtered)) {
|
|
35
36
|
return core.void
|
|
36
37
|
}
|
|
37
38
|
return invokeWithInterrupt(run(filtered), block)
|
|
38
39
|
})
|
|
39
40
|
} else if (requests.length === 1) {
|
|
40
41
|
const filtered = requests[0].filter((_) => !_.state.completed).map((_) => _.request)
|
|
41
|
-
if (filtered
|
|
42
|
+
if (!RA.isNonEmptyArray(filtered)) {
|
|
42
43
|
return core.void
|
|
43
44
|
}
|
|
44
45
|
return run(filtered)
|
|
@@ -210,7 +211,7 @@ export const eitherWith = dual<
|
|
|
210
211
|
export const fromFunction = <A extends Request.Request<any>>(
|
|
211
212
|
f: (request: A) => Request.Request.Success<A>
|
|
212
213
|
): RequestResolver.RequestResolver<A> =>
|
|
213
|
-
makeBatched((requests:
|
|
214
|
+
makeBatched((requests: RA.NonEmptyArray<A>) =>
|
|
214
215
|
core.forEachSequentialDiscard(
|
|
215
216
|
requests,
|
|
216
217
|
(request) => complete(request, core.exitSucceed(f(request)) as any)
|
|
@@ -219,9 +220,9 @@ export const fromFunction = <A extends Request.Request<any>>(
|
|
|
219
220
|
|
|
220
221
|
/** @internal */
|
|
221
222
|
export const fromFunctionBatched = <A extends Request.Request<any>>(
|
|
222
|
-
f: (chunk:
|
|
223
|
+
f: (chunk: RA.NonEmptyArray<A>) => Iterable<Request.Request.Success<A>>
|
|
223
224
|
): RequestResolver.RequestResolver<A> =>
|
|
224
|
-
makeBatched((as:
|
|
225
|
+
makeBatched((as: RA.NonEmptyArray<A>) =>
|
|
225
226
|
Effect.forEach(
|
|
226
227
|
f(as),
|
|
227
228
|
(res, i) => complete(as[i], core.exitSucceed(res) as any),
|
|
@@ -233,7 +234,7 @@ export const fromFunctionBatched = <A extends Request.Request<any>>(
|
|
|
233
234
|
export const fromEffect = <R, A extends Request.Request<any, any>>(
|
|
234
235
|
f: (a: A) => Effect.Effect<Request.Request.Success<A>, Request.Request.Error<A>, R>
|
|
235
236
|
): RequestResolver.RequestResolver<A, R> =>
|
|
236
|
-
makeBatched((requests:
|
|
237
|
+
makeBatched((requests: RA.NonEmptyArray<A>) =>
|
|
237
238
|
Effect.forEach(
|
|
238
239
|
requests,
|
|
239
240
|
(a) => Effect.flatMap(Effect.exit(f(a)), (e) => complete(a, e as any)),
|
|
@@ -261,7 +262,7 @@ export const fromEffectTagged = <
|
|
|
261
262
|
A,
|
|
262
263
|
ReturnType<Fns[keyof Fns]> extends Effect.Effect<infer _A, infer _E, infer R> ? R : never
|
|
263
264
|
> =>
|
|
264
|
-
makeBatched<A, any>((requests:
|
|
265
|
+
makeBatched<A, any>((requests: RA.NonEmptyArray<A>) => {
|
|
265
266
|
const grouped: Record<string, Array<A>> = {}
|
|
266
267
|
const tags: Array<A["_tag"]> = []
|
|
267
268
|
for (let i = 0, len = requests.length; i < len; i++) {
|
|
@@ -6,8 +6,8 @@ import * as Hash from "../Hash.js"
|
|
|
6
6
|
import { pipeArguments } from "../Pipeable.js"
|
|
7
7
|
import type * as Sink from "../Sink.js"
|
|
8
8
|
import type * as Stream from "../Stream.js"
|
|
9
|
+
import { SingleShotGen, YieldWrap } from "../Utils.js"
|
|
9
10
|
import * as OpCodes from "./opCodes/effect.js"
|
|
10
|
-
import * as SingleShotGen from "./singleShotGen.js"
|
|
11
11
|
import * as version from "./version.js"
|
|
12
12
|
|
|
13
13
|
/** @internal */
|
|
@@ -77,7 +77,7 @@ export const EffectPrototype: Effect.Effect<never> & Equal.Equal = {
|
|
|
77
77
|
return Hash.cached(this, Hash.random(this))
|
|
78
78
|
},
|
|
79
79
|
[Symbol.iterator]() {
|
|
80
|
-
return new SingleShotGen
|
|
80
|
+
return new SingleShotGen(new YieldWrap(this)) as any
|
|
81
81
|
},
|
|
82
82
|
pipe() {
|
|
83
83
|
return pipeArguments(this, arguments)
|
|
@@ -41,7 +41,7 @@ import { currentScheduler, type Scheduler } from "../Scheduler.js"
|
|
|
41
41
|
import type * as Scope from "../Scope.js"
|
|
42
42
|
import type * as Supervisor from "../Supervisor.js"
|
|
43
43
|
import type * as Tracer from "../Tracer.js"
|
|
44
|
-
import type { Concurrency } from "../Types.js"
|
|
44
|
+
import type { Concurrency, NoInfer } from "../Types.js"
|
|
45
45
|
import * as _RequestBlock from "./blockedRequests.js"
|
|
46
46
|
import * as internalCause from "./cause.js"
|
|
47
47
|
import * as clock from "./clock.js"
|
|
@@ -3518,9 +3518,26 @@ export const invokeWithInterrupt: <A, E, R>(
|
|
|
3518
3518
|
const counts = entries.map((_) => _.listeners.count)
|
|
3519
3519
|
const checkDone = () => {
|
|
3520
3520
|
if (counts.every((count) => count === 0)) {
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3521
|
+
if (
|
|
3522
|
+
entries.every((_) => {
|
|
3523
|
+
if (_.result.state.current._tag === "Pending") {
|
|
3524
|
+
return true
|
|
3525
|
+
} else if (
|
|
3526
|
+
_.result.state.current._tag === "Done" &&
|
|
3527
|
+
core.exitIsExit(_.result.state.current.effect) &&
|
|
3528
|
+
_.result.state.current.effect._tag === "Failure" &&
|
|
3529
|
+
internalCause.isInterrupted(_.result.state.current.effect.cause)
|
|
3530
|
+
) {
|
|
3531
|
+
return true
|
|
3532
|
+
} else {
|
|
3533
|
+
return false
|
|
3534
|
+
}
|
|
3535
|
+
})
|
|
3536
|
+
) {
|
|
3537
|
+
cleanup.forEach((f) => f())
|
|
3538
|
+
onInterrupt?.()
|
|
3539
|
+
cb(core.interruptFiber(processing))
|
|
3540
|
+
}
|
|
3524
3541
|
}
|
|
3525
3542
|
}
|
|
3526
3543
|
processing.addObserver((exit) => {
|
package/src/internal/groupBy.ts
CHANGED
|
@@ -13,7 +13,7 @@ import * as Queue from "../Queue.js"
|
|
|
13
13
|
import * as Ref from "../Ref.js"
|
|
14
14
|
import type * as Stream from "../Stream.js"
|
|
15
15
|
import type * as Take from "../Take.js"
|
|
16
|
-
import type { MergeRecord } from "../Types.js"
|
|
16
|
+
import type { MergeRecord, NoInfer } from "../Types.js"
|
|
17
17
|
import * as channel from "./channel.js"
|
|
18
18
|
import * as channelExecutor from "./channel/channelExecutor.js"
|
|
19
19
|
import * as core from "./core-stream.js"
|
package/src/internal/hashMap.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { format, NodeInspectSymbol, toJSON } from "../Inspectable.js"
|
|
|
7
7
|
import * as Option from "../Option.js"
|
|
8
8
|
import { pipeArguments } from "../Pipeable.js"
|
|
9
9
|
import { hasProperty } from "../Predicate.js"
|
|
10
|
+
import type { NoInfer } from "../Types.js"
|
|
10
11
|
import { fromBitmap, hashFragment, toBitmap } from "./hashMap/bitwise.js"
|
|
11
12
|
import { SIZE } from "./hashMap/config.js"
|
|
12
13
|
import * as Node from "./hashMap/node.js"
|
package/src/internal/hashSet.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { format, NodeInspectSymbol, toJSON } from "../Inspectable.js"
|
|
|
7
7
|
import { pipeArguments } from "../Pipeable.js"
|
|
8
8
|
import type { Predicate, Refinement } from "../Predicate.js"
|
|
9
9
|
import { hasProperty } from "../Predicate.js"
|
|
10
|
+
import type { NoInfer } from "../Types.js"
|
|
10
11
|
import * as HM from "./hashMap.js"
|
|
11
12
|
|
|
12
13
|
const HashSetSymbolKey = "effect/HashSet"
|
package/src/internal/schedule.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type * as Schedule from "../Schedule.js"
|
|
|
18
18
|
import * as ScheduleDecision from "../ScheduleDecision.js"
|
|
19
19
|
import * as Interval from "../ScheduleInterval.js"
|
|
20
20
|
import * as Intervals from "../ScheduleIntervals.js"
|
|
21
|
+
import type * as Types from "../Types.js"
|
|
21
22
|
import * as internalCause from "./cause.js"
|
|
22
23
|
import * as effect from "./core-effect.js"
|
|
23
24
|
import * as core from "./core.js"
|
|
@@ -1902,7 +1903,7 @@ export const retry_combined: {
|
|
|
1902
1903
|
self: Effect.Effect<A, E, R>
|
|
1903
1904
|
) => Effect.Retry.Return<R, E, A, O>
|
|
1904
1905
|
<B, E, R1>(
|
|
1905
|
-
policy: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
1906
|
+
policy: Schedule.Schedule<B, Types.NoInfer<E>, R1>
|
|
1906
1907
|
): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R1 | R>
|
|
1907
1908
|
<A, E, R, O extends Effect.Retry.Options<E>>(
|
|
1908
1909
|
self: Effect.Effect<A, E, R>,
|
|
@@ -1948,13 +1949,13 @@ export const retry_combined: {
|
|
|
1948
1949
|
/** @internal */
|
|
1949
1950
|
export const retryOrElse_Effect = dual<
|
|
1950
1951
|
<A1, E, R1, A2, E2, R2>(
|
|
1951
|
-
policy: Schedule.Schedule<A1, NoInfer<E>, R1>,
|
|
1952
|
-
orElse: (e: NoInfer<E>, out: A1) => Effect.Effect<A2, E2, R2>
|
|
1952
|
+
policy: Schedule.Schedule<A1, Types.NoInfer<E>, R1>,
|
|
1953
|
+
orElse: (e: Types.NoInfer<E>, out: A1) => Effect.Effect<A2, E2, R2>
|
|
1953
1954
|
) => <A, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, E2, R | R1 | R2>,
|
|
1954
1955
|
<A, E, R, A1, R1, A2, E2, R2>(
|
|
1955
1956
|
self: Effect.Effect<A, E, R>,
|
|
1956
|
-
policy: Schedule.Schedule<A1, NoInfer<E>, R1>,
|
|
1957
|
-
orElse: (e: NoInfer<E>, out: A1) => Effect.Effect<A2, E2, R2>
|
|
1957
|
+
policy: Schedule.Schedule<A1, Types.NoInfer<E>, R1>,
|
|
1958
|
+
orElse: (e: Types.NoInfer<E>, out: A1) => Effect.Effect<A2, E2, R2>
|
|
1958
1959
|
) => Effect.Effect<A | A2, E2, R | R1 | R2>
|
|
1959
1960
|
>(3, (self, policy, orElse) =>
|
|
1960
1961
|
core.flatMap(
|
package/src/internal/stm/core.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { hasProperty } from "../../Predicate.js"
|
|
|
15
15
|
import type * as Scheduler from "../../Scheduler.js"
|
|
16
16
|
import type * as STM from "../../STM.js"
|
|
17
17
|
import { StreamTypeId } from "../../Stream.js"
|
|
18
|
+
import { YieldWrap } from "../../Utils.js"
|
|
18
19
|
import { ChannelTypeId } from "../core-stream.js"
|
|
19
20
|
import { withFiberRuntime } from "../core.js"
|
|
20
21
|
import { effectVariance } from "../effectable.js"
|
|
@@ -172,7 +173,7 @@ class STMPrimitive implements STM.STM<any, any, any> {
|
|
|
172
173
|
return Hash.cached(this, Hash.random(this))
|
|
173
174
|
}
|
|
174
175
|
[Symbol.iterator]() {
|
|
175
|
-
return new SingleShotGen(this) as any
|
|
176
|
+
return new SingleShotGen(new YieldWrap(this)) as any
|
|
176
177
|
}
|
|
177
178
|
commit(this: STM.STM<any, any, any>): Effect.Effect<any, any, any> {
|
|
178
179
|
return unsafeAtomically(this, constVoid, constVoid)
|
package/src/internal/stm/stm.ts
CHANGED
|
@@ -12,7 +12,8 @@ import * as Option from "../../Option.js"
|
|
|
12
12
|
import type { Predicate, Refinement } from "../../Predicate.js"
|
|
13
13
|
import * as predicate from "../../Predicate.js"
|
|
14
14
|
import type * as STM from "../../STM.js"
|
|
15
|
-
import type { MergeRecord } from "../../Types.js"
|
|
15
|
+
import type { MergeRecord, NoInfer } from "../../Types.js"
|
|
16
|
+
import { yieldWrapGet } from "../../Utils.js"
|
|
16
17
|
import * as effectCore from "../core.js"
|
|
17
18
|
import * as core from "./core.js"
|
|
18
19
|
import * as Journal from "./stm/journal.js"
|
|
@@ -626,7 +627,7 @@ export const gen: typeof STM.gen = (f) =>
|
|
|
626
627
|
): STM.STM<any, any, any> =>
|
|
627
628
|
state.done ?
|
|
628
629
|
core.succeed(state.value) :
|
|
629
|
-
core.flatMap(state.value, (val: any) => run(iterator.next(val as never)))
|
|
630
|
+
core.flatMap(yieldWrapGet(state.value) as any, (val: any) => run(iterator.next(val as never)))
|
|
630
631
|
return run(state)
|
|
631
632
|
})
|
|
632
633
|
|
package/src/internal/stream.ts
CHANGED
|
@@ -31,7 +31,7 @@ import * as HaltStrategy from "../StreamHaltStrategy.js"
|
|
|
31
31
|
import type * as Take from "../Take.js"
|
|
32
32
|
import type * as Tracer from "../Tracer.js"
|
|
33
33
|
import * as Tuple from "../Tuple.js"
|
|
34
|
-
import type { MergeRecord } from "../Types.js"
|
|
34
|
+
import type { MergeRecord, NoInfer } from "../Types.js"
|
|
35
35
|
import * as channel from "./channel.js"
|
|
36
36
|
import * as channelExecutor from "./channel/channelExecutor.js"
|
|
37
37
|
import * as MergeStrategy from "./channel/mergeStrategy.js"
|