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.
Files changed (164) hide show
  1. package/dist/cjs/Array.js.map +1 -1
  2. package/dist/cjs/Effect.js.map +1 -1
  3. package/dist/cjs/Either.js +14 -2
  4. package/dist/cjs/Either.js.map +1 -1
  5. package/dist/cjs/Exit.js.map +1 -1
  6. package/dist/cjs/HashMap.js.map +1 -1
  7. package/dist/cjs/HashSet.js.map +1 -1
  8. package/dist/cjs/Iterable.js.map +1 -1
  9. package/dist/cjs/List.js.map +1 -1
  10. package/dist/cjs/Option.js +13 -1
  11. package/dist/cjs/Option.js.map +1 -1
  12. package/dist/cjs/Readable.js.map +1 -1
  13. package/dist/cjs/Record.js.map +1 -1
  14. package/dist/cjs/RequestResolver.js.map +1 -1
  15. package/dist/cjs/STM.js.map +1 -1
  16. package/dist/cjs/Subscribable.js.map +1 -1
  17. package/dist/cjs/Utils.js +42 -2
  18. package/dist/cjs/Utils.js.map +1 -1
  19. package/dist/cjs/internal/cause.js.map +1 -1
  20. package/dist/cjs/internal/core-effect.js +4 -1
  21. package/dist/cjs/internal/core-effect.js.map +1 -1
  22. package/dist/cjs/internal/core.js +4 -3
  23. package/dist/cjs/internal/core.js.map +1 -1
  24. package/dist/cjs/internal/dataSource.js +2 -2
  25. package/dist/cjs/internal/dataSource.js.map +1 -1
  26. package/dist/cjs/internal/effectable.js +2 -2
  27. package/dist/cjs/internal/effectable.js.map +1 -1
  28. package/dist/cjs/internal/fiberRuntime.js +13 -3
  29. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  30. package/dist/cjs/internal/hashMap.js.map +1 -1
  31. package/dist/cjs/internal/hashSet.js.map +1 -1
  32. package/dist/cjs/internal/schedule.js.map +1 -1
  33. package/dist/cjs/internal/stm/core.js +2 -1
  34. package/dist/cjs/internal/stm/core.js.map +1 -1
  35. package/dist/cjs/internal/stm/stm.js +2 -1
  36. package/dist/cjs/internal/stm/stm.js.map +1 -1
  37. package/dist/cjs/internal/trie.js.map +1 -1
  38. package/dist/cjs/internal/version.js +1 -1
  39. package/dist/dts/Array.d.ts +1 -0
  40. package/dist/dts/Array.d.ts.map +1 -1
  41. package/dist/dts/Cause.d.ts +2 -2
  42. package/dist/dts/Cause.d.ts.map +1 -1
  43. package/dist/dts/Chunk.d.ts +1 -1
  44. package/dist/dts/Chunk.d.ts.map +1 -1
  45. package/dist/dts/Effect.d.ts +9 -8
  46. package/dist/dts/Effect.d.ts.map +1 -1
  47. package/dist/dts/Either.d.ts +2 -2
  48. package/dist/dts/Either.d.ts.map +1 -1
  49. package/dist/dts/Exit.d.ts +1 -0
  50. package/dist/dts/Exit.d.ts.map +1 -1
  51. package/dist/dts/GroupBy.d.ts +1 -1
  52. package/dist/dts/GroupBy.d.ts.map +1 -1
  53. package/dist/dts/HashMap.d.ts +1 -0
  54. package/dist/dts/HashMap.d.ts.map +1 -1
  55. package/dist/dts/HashSet.d.ts +1 -0
  56. package/dist/dts/HashSet.d.ts.map +1 -1
  57. package/dist/dts/Iterable.d.ts +1 -0
  58. package/dist/dts/Iterable.d.ts.map +1 -1
  59. package/dist/dts/List.d.ts +1 -0
  60. package/dist/dts/List.d.ts.map +1 -1
  61. package/dist/dts/Logger.d.ts +2 -2
  62. package/dist/dts/Logger.d.ts.map +1 -1
  63. package/dist/dts/Option.d.ts +2 -2
  64. package/dist/dts/Option.d.ts.map +1 -1
  65. package/dist/dts/Readable.d.ts +1 -0
  66. package/dist/dts/Readable.d.ts.map +1 -1
  67. package/dist/dts/Record.d.ts +1 -0
  68. package/dist/dts/Record.d.ts.map +1 -1
  69. package/dist/dts/RequestResolver.d.ts +5 -4
  70. package/dist/dts/RequestResolver.d.ts.map +1 -1
  71. package/dist/dts/STM.d.ts +5 -4
  72. package/dist/dts/STM.d.ts.map +1 -1
  73. package/dist/dts/SortedSet.d.ts +1 -1
  74. package/dist/dts/SortedSet.d.ts.map +1 -1
  75. package/dist/dts/Stream.d.ts +1 -1
  76. package/dist/dts/Stream.d.ts.map +1 -1
  77. package/dist/dts/Subscribable.d.ts +1 -0
  78. package/dist/dts/Subscribable.d.ts.map +1 -1
  79. package/dist/dts/Trie.d.ts +1 -1
  80. package/dist/dts/Trie.d.ts.map +1 -1
  81. package/dist/dts/Types.d.ts +7 -0
  82. package/dist/dts/Types.d.ts.map +1 -1
  83. package/dist/dts/Utils.d.ts +49 -25
  84. package/dist/dts/Utils.d.ts.map +1 -1
  85. package/dist/dts/internal/core.d.ts.map +1 -1
  86. package/dist/dts/internal/hashMap.d.ts.map +1 -1
  87. package/dist/dts/internal/stm/stm.d.ts.map +1 -1
  88. package/dist/esm/Array.js.map +1 -1
  89. package/dist/esm/Effect.js.map +1 -1
  90. package/dist/esm/Either.js +14 -2
  91. package/dist/esm/Either.js.map +1 -1
  92. package/dist/esm/Exit.js.map +1 -1
  93. package/dist/esm/HashMap.js.map +1 -1
  94. package/dist/esm/HashSet.js.map +1 -1
  95. package/dist/esm/Iterable.js.map +1 -1
  96. package/dist/esm/List.js.map +1 -1
  97. package/dist/esm/Option.js +14 -2
  98. package/dist/esm/Option.js.map +1 -1
  99. package/dist/esm/Readable.js.map +1 -1
  100. package/dist/esm/Record.js.map +1 -1
  101. package/dist/esm/RequestResolver.js.map +1 -1
  102. package/dist/esm/STM.js.map +1 -1
  103. package/dist/esm/Subscribable.js.map +1 -1
  104. package/dist/esm/Utils.js +39 -2
  105. package/dist/esm/Utils.js.map +1 -1
  106. package/dist/esm/internal/cause.js.map +1 -1
  107. package/dist/esm/internal/core-effect.js +4 -1
  108. package/dist/esm/internal/core-effect.js.map +1 -1
  109. package/dist/esm/internal/core.js +4 -3
  110. package/dist/esm/internal/core.js.map +1 -1
  111. package/dist/esm/internal/dataSource.js +2 -2
  112. package/dist/esm/internal/dataSource.js.map +1 -1
  113. package/dist/esm/internal/effectable.js +2 -2
  114. package/dist/esm/internal/effectable.js.map +1 -1
  115. package/dist/esm/internal/fiberRuntime.js +13 -3
  116. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  117. package/dist/esm/internal/hashMap.js.map +1 -1
  118. package/dist/esm/internal/hashSet.js.map +1 -1
  119. package/dist/esm/internal/schedule.js.map +1 -1
  120. package/dist/esm/internal/stm/core.js +2 -1
  121. package/dist/esm/internal/stm/core.js.map +1 -1
  122. package/dist/esm/internal/stm/stm.js +2 -1
  123. package/dist/esm/internal/stm/stm.js.map +1 -1
  124. package/dist/esm/internal/trie.js.map +1 -1
  125. package/dist/esm/internal/version.js +1 -1
  126. package/package.json +1 -1
  127. package/src/Array.ts +1 -0
  128. package/src/Cause.ts +2 -2
  129. package/src/Chunk.ts +1 -1
  130. package/src/Effect.ts +9 -8
  131. package/src/Either.ts +16 -4
  132. package/src/Exit.ts +1 -0
  133. package/src/GroupBy.ts +1 -1
  134. package/src/HashMap.ts +1 -0
  135. package/src/HashSet.ts +1 -0
  136. package/src/Iterable.ts +1 -0
  137. package/src/List.ts +1 -0
  138. package/src/Logger.ts +2 -2
  139. package/src/Option.ts +16 -4
  140. package/src/Readable.ts +1 -0
  141. package/src/Record.ts +1 -0
  142. package/src/RequestResolver.ts +7 -6
  143. package/src/STM.ts +5 -4
  144. package/src/SortedSet.ts +1 -1
  145. package/src/Stream.ts +1 -1
  146. package/src/Subscribable.ts +1 -0
  147. package/src/Trie.ts +1 -1
  148. package/src/Types.ts +8 -0
  149. package/src/Utils.ts +74 -27
  150. package/src/internal/cause.ts +1 -0
  151. package/src/internal/core-effect.ts +7 -4
  152. package/src/internal/core.ts +5 -4
  153. package/src/internal/dataSource.ts +9 -8
  154. package/src/internal/effectable.ts +2 -2
  155. package/src/internal/fiberRuntime.ts +21 -4
  156. package/src/internal/groupBy.ts +1 -1
  157. package/src/internal/hashMap.ts +1 -0
  158. package/src/internal/hashSet.ts +1 -0
  159. package/src/internal/schedule.ts +6 -5
  160. package/src/internal/stm/core.ts +2 -1
  161. package/src/internal/stm/stm.ts +3 -2
  162. package/src/internal/stream.ts +1 -1
  163. package/src/internal/trie.ts +1 -0
  164. 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>, AEff>(
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>] ? E : never,
1072
- [Eff] extends [never] ? never : [Eff] extends [STM<infer _A, infer _E, infer R>] ? R : never
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
  /**
@@ -7,6 +7,7 @@ import { pipeArguments } from "./Pipeable.js"
7
7
  import { hasProperty } from "./Predicate.js"
8
8
  import * as Readable from "./Readable.js"
9
9
  import * as Stream from "./Stream.js"
10
+ import type { NoInfer } from "./Types.js"
10
11
 
11
12
  /**
12
13
  * @since 2.0.0
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 { isNullable } from "./Predicate.js"
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>, A>(
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 : [K] extends [Kind<F, infer R, any, any, any>] ? R : never,
181
- [K] extends [Variance<F, any, infer O, any>] ? O : [K] extends [Kind<F, any, infer O, any, any>] ? O : never,
182
- [K] extends [Variance<F, any, any, infer E>] ? E : [K] extends [Kind<F, any, any, infer E, any>] ? E : never,
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
- ): Kind<Z, _R, _O, _E, _A>
195
- <A, _R, _O, _E, _A>(a: A, ab: (a: A) => Kind<Z, _R, _O, _E, _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>): 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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
- ): Kind<Z, _R, _O, _E, _A>
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
+ }
@@ -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> => (state.done
792
- ? core.succeed(state.value)
793
- : core.flatMap(state.value, (val: any) => run(iterator.next(val))))
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
  }
@@ -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: Array<A>) => Effect.Effect<void, never, R>
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.length === 0) {
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.length === 0) {
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: Array<A>) =>
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: Array<A>) => Iterable<Request.Request.Success<A>>
223
+ f: (chunk: RA.NonEmptyArray<A>) => Iterable<Request.Request.Success<A>>
223
224
  ): RequestResolver.RequestResolver<A> =>
224
- makeBatched((as: Array<A>) =>
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: Array<A>) =>
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: Array<A>) => {
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.SingleShotGen(this) as any
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
- cleanup.forEach((f) => f())
3522
- onInterrupt?.()
3523
- cb(core.interruptFiber(processing))
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) => {
@@ -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"
@@ -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"
@@ -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"
@@ -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(
@@ -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)
@@ -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
 
@@ -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"