effect 2.3.8 → 2.4.1

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 (279) hide show
  1. package/dist/cjs/BigInt.js +14 -1
  2. package/dist/cjs/BigInt.js.map +1 -1
  3. package/dist/cjs/Effect.js +48 -61
  4. package/dist/cjs/Effect.js.map +1 -1
  5. package/dist/cjs/Either.js +35 -6
  6. package/dist/cjs/Either.js.map +1 -1
  7. package/dist/cjs/Equal.js +1 -1
  8. package/dist/cjs/Equal.js.map +1 -1
  9. package/dist/cjs/Exit.js +1 -1
  10. package/dist/cjs/Number.js +25 -1
  11. package/dist/cjs/Number.js.map +1 -1
  12. package/dist/cjs/Predicate.js +40 -3
  13. package/dist/cjs/Predicate.js.map +1 -1
  14. package/dist/cjs/ReadonlyArray.js +2 -2
  15. package/dist/cjs/ReadonlyArray.js.map +1 -1
  16. package/dist/cjs/ReadonlyRecord.js +71 -76
  17. package/dist/cjs/ReadonlyRecord.js.map +1 -1
  18. package/dist/cjs/STM.js.map +1 -1
  19. package/dist/cjs/Schedule.js.map +1 -1
  20. package/dist/cjs/Sink.js.map +1 -1
  21. package/dist/cjs/Stream.js +3 -23
  22. package/dist/cjs/Stream.js.map +1 -1
  23. package/dist/cjs/Struct.js +3 -1
  24. package/dist/cjs/Struct.js.map +1 -1
  25. package/dist/cjs/TestAnnotation.js.map +1 -1
  26. package/dist/cjs/internal/channel/channelExecutor.js +5 -5
  27. package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
  28. package/dist/cjs/internal/channel/channelState.js +5 -5
  29. package/dist/cjs/internal/channel/channelState.js.map +1 -1
  30. package/dist/cjs/internal/channel.js.map +1 -1
  31. package/dist/cjs/internal/clock.js +3 -4
  32. package/dist/cjs/internal/clock.js.map +1 -1
  33. package/dist/cjs/internal/core-effect.js +6 -23
  34. package/dist/cjs/internal/core-effect.js.map +1 -1
  35. package/dist/cjs/internal/core.js +11 -27
  36. package/dist/cjs/internal/core.js.map +1 -1
  37. package/dist/cjs/internal/effect/circular.js +4 -5
  38. package/dist/cjs/internal/effect/circular.js.map +1 -1
  39. package/dist/cjs/internal/either.js +3 -3
  40. package/dist/cjs/internal/either.js.map +1 -1
  41. package/dist/cjs/internal/groupBy.js.map +1 -1
  42. package/dist/cjs/internal/layer.js +0 -2
  43. package/dist/cjs/internal/layer.js.map +1 -1
  44. package/dist/cjs/internal/runtime.js +12 -1
  45. package/dist/cjs/internal/runtime.js.map +1 -1
  46. package/dist/cjs/internal/schedule.js +4 -4
  47. package/dist/cjs/internal/schedule.js.map +1 -1
  48. package/dist/cjs/internal/sink.js +0 -2
  49. package/dist/cjs/internal/sink.js.map +1 -1
  50. package/dist/cjs/internal/stm/stm.js +1 -0
  51. package/dist/cjs/internal/stm/stm.js.map +1 -1
  52. package/dist/cjs/internal/stream.js +51 -64
  53. package/dist/cjs/internal/stream.js.map +1 -1
  54. package/dist/cjs/internal/version.js +1 -1
  55. package/dist/dts/BigInt.d.ts +7 -0
  56. package/dist/dts/BigInt.d.ts.map +1 -1
  57. package/dist/dts/Brand.d.ts +1 -1
  58. package/dist/dts/Brand.d.ts.map +1 -1
  59. package/dist/dts/Cause.d.ts +1 -1
  60. package/dist/dts/Cause.d.ts.map +1 -1
  61. package/dist/dts/Channel.d.ts +11 -11
  62. package/dist/dts/Channel.d.ts.map +1 -1
  63. package/dist/dts/Chunk.d.ts +3 -3
  64. package/dist/dts/Config.d.ts +4 -4
  65. package/dist/dts/Config.d.ts.map +1 -1
  66. package/dist/dts/Cron.d.ts +1 -1
  67. package/dist/dts/Cron.d.ts.map +1 -1
  68. package/dist/dts/Differ.d.ts +2 -2
  69. package/dist/dts/Differ.d.ts.map +1 -1
  70. package/dist/dts/Effect.d.ts +84 -108
  71. package/dist/dts/Effect.d.ts.map +1 -1
  72. package/dist/dts/Either.d.ts +126 -83
  73. package/dist/dts/Either.d.ts.map +1 -1
  74. package/dist/dts/Encoding.d.ts +6 -6
  75. package/dist/dts/Encoding.d.ts.map +1 -1
  76. package/dist/dts/Equal.d.ts.map +1 -1
  77. package/dist/dts/Exit.d.ts +2 -2
  78. package/dist/dts/Fiber.d.ts +2 -2
  79. package/dist/dts/Fiber.d.ts.map +1 -1
  80. package/dist/dts/GroupBy.d.ts +12 -12
  81. package/dist/dts/GroupBy.d.ts.map +1 -1
  82. package/dist/dts/Layer.d.ts +26 -26
  83. package/dist/dts/Layer.d.ts.map +1 -1
  84. package/dist/dts/List.d.ts +2 -2
  85. package/dist/dts/Logger.d.ts +4 -4
  86. package/dist/dts/Match.d.ts +2 -2
  87. package/dist/dts/Match.d.ts.map +1 -1
  88. package/dist/dts/MergeDecision.d.ts +1 -1
  89. package/dist/dts/MergeState.d.ts +5 -5
  90. package/dist/dts/MergeState.d.ts.map +1 -1
  91. package/dist/dts/Metric.d.ts +13 -13
  92. package/dist/dts/Metric.d.ts.map +1 -1
  93. package/dist/dts/MetricPolling.d.ts +4 -4
  94. package/dist/dts/MetricPolling.d.ts.map +1 -1
  95. package/dist/dts/Number.d.ts +8 -0
  96. package/dist/dts/Number.d.ts.map +1 -1
  97. package/dist/dts/Option.d.ts +11 -11
  98. package/dist/dts/Predicate.d.ts +37 -2
  99. package/dist/dts/Predicate.d.ts.map +1 -1
  100. package/dist/dts/ReadonlyArray.d.ts +9 -8
  101. package/dist/dts/ReadonlyArray.d.ts.map +1 -1
  102. package/dist/dts/ReadonlyRecord.d.ts +111 -94
  103. package/dist/dts/ReadonlyRecord.d.ts.map +1 -1
  104. package/dist/dts/Reloadable.d.ts +4 -4
  105. package/dist/dts/Reloadable.d.ts.map +1 -1
  106. package/dist/dts/RequestResolver.d.ts +13 -13
  107. package/dist/dts/RequestResolver.d.ts.map +1 -1
  108. package/dist/dts/Resource.d.ts +1 -1
  109. package/dist/dts/Resource.d.ts.map +1 -1
  110. package/dist/dts/STM.d.ts +144 -139
  111. package/dist/dts/STM.d.ts.map +1 -1
  112. package/dist/dts/Schedule.d.ts +171 -179
  113. package/dist/dts/Schedule.d.ts.map +1 -1
  114. package/dist/dts/SingleProducerAsyncInput.d.ts +1 -1
  115. package/dist/dts/SingleProducerAsyncInput.d.ts.map +1 -1
  116. package/dist/dts/Sink.d.ts +13 -13
  117. package/dist/dts/Sink.d.ts.map +1 -1
  118. package/dist/dts/Stream.d.ts +355 -366
  119. package/dist/dts/Stream.d.ts.map +1 -1
  120. package/dist/dts/Struct.d.ts +3 -3
  121. package/dist/dts/Struct.d.ts.map +1 -1
  122. package/dist/dts/SubscriptionRef.d.ts +2 -2
  123. package/dist/dts/TArray.d.ts +2 -2
  124. package/dist/dts/TDeferred.d.ts +3 -3
  125. package/dist/dts/TMap.d.ts +10 -10
  126. package/dist/dts/TSet.d.ts +4 -4
  127. package/dist/dts/Take.d.ts +2 -2
  128. package/dist/dts/TestAnnotation.d.ts +2 -2
  129. package/dist/dts/TestAnnotation.d.ts.map +1 -1
  130. package/dist/dts/Types.d.ts +7 -0
  131. package/dist/dts/Types.d.ts.map +1 -1
  132. package/dist/dts/internal/stm/stm.d.ts +2 -15
  133. package/dist/dts/internal/stm/stm.d.ts.map +1 -1
  134. package/dist/esm/BigInt.js +12 -0
  135. package/dist/esm/BigInt.js.map +1 -1
  136. package/dist/esm/Effect.js +45 -58
  137. package/dist/esm/Effect.js.map +1 -1
  138. package/dist/esm/Either.js +42 -5
  139. package/dist/esm/Either.js.map +1 -1
  140. package/dist/esm/Equal.js +1 -1
  141. package/dist/esm/Equal.js.map +1 -1
  142. package/dist/esm/Exit.js +1 -1
  143. package/dist/esm/Number.js +23 -0
  144. package/dist/esm/Number.js.map +1 -1
  145. package/dist/esm/Predicate.js +37 -2
  146. package/dist/esm/Predicate.js.map +1 -1
  147. package/dist/esm/ReadonlyArray.js +2 -2
  148. package/dist/esm/ReadonlyArray.js.map +1 -1
  149. package/dist/esm/ReadonlyRecord.js +70 -75
  150. package/dist/esm/ReadonlyRecord.js.map +1 -1
  151. package/dist/esm/STM.js.map +1 -1
  152. package/dist/esm/Schedule.js.map +1 -1
  153. package/dist/esm/Sink.js.map +1 -1
  154. package/dist/esm/Stream.js +5 -22
  155. package/dist/esm/Stream.js.map +1 -1
  156. package/dist/esm/Struct.js +3 -1
  157. package/dist/esm/Struct.js.map +1 -1
  158. package/dist/esm/TestAnnotation.js.map +1 -1
  159. package/dist/esm/internal/channel/channelExecutor.js +5 -5
  160. package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
  161. package/dist/esm/internal/channel/channelState.js +3 -3
  162. package/dist/esm/internal/channel/channelState.js.map +1 -1
  163. package/dist/esm/internal/channel.js.map +1 -1
  164. package/dist/esm/internal/clock.js +3 -4
  165. package/dist/esm/internal/clock.js.map +1 -1
  166. package/dist/esm/internal/core-effect.js +4 -20
  167. package/dist/esm/internal/core-effect.js.map +1 -1
  168. package/dist/esm/internal/core.js +8 -22
  169. package/dist/esm/internal/core.js.map +1 -1
  170. package/dist/esm/internal/effect/circular.js +4 -5
  171. package/dist/esm/internal/effect/circular.js.map +1 -1
  172. package/dist/esm/internal/either.js +3 -3
  173. package/dist/esm/internal/either.js.map +1 -1
  174. package/dist/esm/internal/groupBy.js.map +1 -1
  175. package/dist/esm/internal/layer.js +0 -2
  176. package/dist/esm/internal/layer.js.map +1 -1
  177. package/dist/esm/internal/runtime.js +12 -1
  178. package/dist/esm/internal/runtime.js.map +1 -1
  179. package/dist/esm/internal/schedule.js +4 -4
  180. package/dist/esm/internal/schedule.js.map +1 -1
  181. package/dist/esm/internal/sink.js +0 -2
  182. package/dist/esm/internal/sink.js.map +1 -1
  183. package/dist/esm/internal/stm/stm.js +1 -0
  184. package/dist/esm/internal/stm/stm.js.map +1 -1
  185. package/dist/esm/internal/stream.js +49 -59
  186. package/dist/esm/internal/stream.js.map +1 -1
  187. package/dist/esm/internal/version.js +1 -1
  188. package/package.json +1 -1
  189. package/src/BigInt.ts +13 -0
  190. package/src/Brand.ts +4 -4
  191. package/src/Cause.ts +1 -1
  192. package/src/Channel.ts +17 -17
  193. package/src/Chunk.ts +4 -4
  194. package/src/Config.ts +4 -4
  195. package/src/Cron.ts +2 -2
  196. package/src/Differ.ts +2 -2
  197. package/src/Effect.ts +100 -145
  198. package/src/Either.ts +215 -133
  199. package/src/Encoding.ts +3 -3
  200. package/src/Equal.ts +1 -1
  201. package/src/Exit.ts +2 -2
  202. package/src/Fiber.ts +2 -2
  203. package/src/GroupBy.ts +16 -16
  204. package/src/Layer.ts +32 -32
  205. package/src/List.ts +3 -3
  206. package/src/Logger.ts +4 -4
  207. package/src/Match.ts +3 -3
  208. package/src/MergeDecision.ts +1 -1
  209. package/src/MergeState.ts +8 -8
  210. package/src/Metric.ts +13 -13
  211. package/src/MetricPolling.ts +9 -9
  212. package/src/Number.ts +26 -0
  213. package/src/Option.ts +17 -17
  214. package/src/Predicate.ts +39 -2
  215. package/src/ReadonlyArray.ts +23 -15
  216. package/src/ReadonlyRecord.ts +421 -265
  217. package/src/Reloadable.ts +4 -4
  218. package/src/RequestResolver.ts +19 -19
  219. package/src/Resource.ts +3 -3
  220. package/src/STM.ts +166 -213
  221. package/src/Schedule.ts +331 -361
  222. package/src/SingleProducerAsyncInput.ts +1 -1
  223. package/src/Sink.ts +19 -19
  224. package/src/Stream.ts +449 -456
  225. package/src/Struct.ts +8 -5
  226. package/src/SubscriptionRef.ts +2 -2
  227. package/src/TArray.ts +2 -2
  228. package/src/TDeferred.ts +4 -4
  229. package/src/TMap.ts +10 -10
  230. package/src/TSet.ts +4 -4
  231. package/src/Take.ts +4 -4
  232. package/src/TestAnnotation.ts +5 -8
  233. package/src/Types.ts +11 -0
  234. package/src/internal/blockedRequests.ts +2 -2
  235. package/src/internal/cause.ts +2 -2
  236. package/src/internal/channel/channelExecutor.ts +26 -26
  237. package/src/internal/channel/channelState.ts +13 -13
  238. package/src/internal/channel/mergeDecision.ts +1 -1
  239. package/src/internal/channel/mergeState.ts +6 -6
  240. package/src/internal/channel/singleProducerAsyncInput.ts +5 -5
  241. package/src/internal/channel.ts +43 -43
  242. package/src/internal/clock.ts +3 -4
  243. package/src/internal/config.ts +7 -7
  244. package/src/internal/configError.ts +1 -1
  245. package/src/internal/configProvider/pathPatch.ts +2 -2
  246. package/src/internal/configProvider.ts +1 -1
  247. package/src/internal/core-effect.ts +28 -43
  248. package/src/internal/core.ts +15 -40
  249. package/src/internal/dataSource.ts +26 -26
  250. package/src/internal/differ/orPatch.ts +7 -7
  251. package/src/internal/differ.ts +2 -2
  252. package/src/internal/effect/circular.ts +9 -10
  253. package/src/internal/either.ts +25 -22
  254. package/src/internal/encoding/base64.ts +1 -1
  255. package/src/internal/encoding/base64Url.ts +1 -1
  256. package/src/internal/encoding/hex.ts +1 -1
  257. package/src/internal/fiber.ts +2 -2
  258. package/src/internal/fiberRuntime.ts +9 -9
  259. package/src/internal/groupBy.ts +40 -40
  260. package/src/internal/layer/circular.ts +4 -4
  261. package/src/internal/layer.ts +52 -54
  262. package/src/internal/matcher.ts +5 -5
  263. package/src/internal/metric/polling.ts +8 -8
  264. package/src/internal/metric.ts +6 -6
  265. package/src/internal/reloadable.ts +4 -4
  266. package/src/internal/resource.ts +2 -2
  267. package/src/internal/runtime.ts +32 -19
  268. package/src/internal/schedule.ts +430 -500
  269. package/src/internal/sink.ts +27 -29
  270. package/src/internal/stm/core.ts +23 -23
  271. package/src/internal/stm/stm.ts +158 -157
  272. package/src/internal/stm/tArray.ts +3 -3
  273. package/src/internal/stm/tDeferred.ts +5 -5
  274. package/src/internal/stm/tMap.ts +13 -13
  275. package/src/internal/stm/tSet.ts +4 -4
  276. package/src/internal/stream.ts +688 -723
  277. package/src/internal/subscriptionRef.ts +3 -3
  278. package/src/internal/take.ts +6 -6
  279. package/src/internal/version.ts +1 -1
package/src/Effect.ts CHANGED
@@ -19,7 +19,7 @@ import type * as FiberRef from "./FiberRef.js"
19
19
  import type * as FiberRefs from "./FiberRefs.js"
20
20
  import type * as FiberRefsPatch from "./FiberRefsPatch.js"
21
21
  import type { LazyArg } from "./Function.js"
22
- import { dual, identity } from "./Function.js"
22
+ import { dual } from "./Function.js"
23
23
  import type * as HashMap from "./HashMap.js"
24
24
  import type * as HashSet from "./HashSet.js"
25
25
  import type { TypeLambda } from "./HKT.js"
@@ -53,23 +53,13 @@ import * as Scheduler from "./Scheduler.js"
53
53
  import type * as Scope from "./Scope.js"
54
54
  import type * as Supervisor from "./Supervisor.js"
55
55
  import type * as Tracer from "./Tracer.js"
56
- import type { Concurrency, Covariant, NoInfer } from "./Types.js"
56
+ import type { Concurrency, Covariant, MergeRecord, NoInfer } from "./Types.js"
57
57
  import type * as Unify from "./Unify.js"
58
58
 
59
59
  // -------------------------------------------------------------------------------------
60
60
  // models
61
61
  // -------------------------------------------------------------------------------------
62
62
 
63
- /**
64
- * @since 2.0.0
65
- */
66
- export type MergeRecord<K, H> = {
67
- [k in keyof K | keyof H]: k extends keyof K ? K[k]
68
- : k extends keyof H ? H[k]
69
- : never
70
- } extends infer X ? X
71
- : never
72
-
73
63
  /**
74
64
  * @since 2.0.0
75
65
  * @category symbols
@@ -160,10 +150,10 @@ declare module "./Context.js" {
160
150
  * @category models
161
151
  */
162
152
  declare module "./Either.js" {
163
- interface Left<E, A> extends Effect<A, E> {
153
+ interface Left<L, R> extends Effect<R, L> {
164
154
  readonly _tag: "Left"
165
155
  }
166
- interface Right<E, A> extends Effect<A, E> {
156
+ interface Right<L, R> extends Effect<R, L> {
167
157
  readonly _tag: "Right"
168
158
  }
169
159
  interface EitherUnifyIgnore {
@@ -212,15 +202,6 @@ export declare namespace Effect {
212
202
  readonly _E: Covariant<E>
213
203
  readonly _R: Covariant<R>
214
204
  }
215
- /**
216
- * @since 2.0.0
217
- * @category models
218
- */
219
- export type Unify<Ret extends Effect<any, any, any>> = Effect<
220
- Success<Ret>,
221
- Error<Ret>,
222
- Context<Ret>
223
- >
224
205
  /**
225
206
  * @since 2.0.0
226
207
  * @category type-level
@@ -400,11 +381,11 @@ export declare namespace All {
400
381
  * @since 2.0.0
401
382
  */
402
383
  export type ReturnIterable<T extends Iterable<EffectAny>, Discard extends boolean, Mode> = [T] extends
403
- [Iterable<Effect.Variance<infer A, infer E, infer R>>] ? Effect<
404
- Discard extends true ? void : Mode extends "either" ? Array<Either.Either<E, A>> : Array<A>,
384
+ [Iterable<Effect.Variance<infer R0, infer L0, infer R>>] ? Effect<
385
+ Discard extends true ? void : Mode extends "either" ? Array<Either.Either<R0, L0>> : Array<R0>,
405
386
  Mode extends "either" ? never
406
- : Mode extends "validate" ? Array<Option.Option<E>>
407
- : E,
387
+ : Mode extends "validate" ? Array<Option.Option<L0>>
388
+ : L0,
408
389
  R
409
390
  >
410
391
  : never
@@ -417,7 +398,7 @@ export declare namespace All {
417
398
  : T[number] extends never ? []
418
399
  : Mode extends "either" ? {
419
400
  -readonly [K in keyof T]: [T[K]] extends [Effect.Variance<infer _A, infer _E, infer _R>] ?
420
- Either.Either<_E, _A>
401
+ Either.Either<_A, _E>
421
402
  : never
422
403
  }
423
404
  : { -readonly [K in keyof T]: [T[K]] extends [Effect.Variance<infer _A, infer _E, infer _R>] ? _A : never },
@@ -441,7 +422,7 @@ export declare namespace All {
441
422
  Discard extends true ? void
442
423
  : Mode extends "either" ? {
443
424
  -readonly [K in keyof T]: [T[K]] extends [Effect.Variance<infer _A, infer _E, infer _R>] ?
444
- Either.Either<_E, _A>
425
+ Either.Either<_A, _E>
445
426
  : never
446
427
  }
447
428
  : { -readonly [K in keyof T]: [T[K]] extends [Effect.Variance<infer _A, infer _E, infer _R>] ? _A : never },
@@ -789,11 +770,11 @@ export const reduceRight: {
789
770
  * @category collecting & elements
790
771
  */
791
772
  export const reduceWhile: {
792
- <A, R, E, Z>(
773
+ <Z, A, E, R>(
793
774
  zero: Z,
794
775
  options: { readonly while: Predicate<Z>; readonly body: (s: Z, a: A, i: number) => Effect<Z, E, R> }
795
776
  ): (elements: Iterable<A>) => Effect<Z, E, R>
796
- <A, R, E, Z>(
777
+ <A, Z, E, R>(
797
778
  elements: Iterable<A>,
798
779
  zero: Z,
799
780
  options: { readonly while: Predicate<Z>; readonly body: (s: Z, a: A, i: number) => Effect<Z, E, R> }
@@ -976,17 +957,20 @@ export const validateFirst: {
976
957
  // -------------------------------------------------------------------------------------
977
958
 
978
959
  /**
979
- * Imports an asynchronous side-effect into a pure `Effect` value.
980
- * The callback function `Effect<A, E, R> => void` must be called at most once.
960
+ * Imports an asynchronous side-effect into a pure `Effect` value. The callback
961
+ * function `Effect<A, E, R> => void` **MUST** be called at most once.
981
962
  *
982
- * If an Effect is returned by the registration function, it will be executed
983
- * if the fiber executing the effect is interrupted.
963
+ * The registration function can optionally return an Effect, which will be
964
+ * executed if the `Fiber` executing this Effect is interrupted.
984
965
  *
985
966
  * The registration function can also receive an `AbortSignal` if required for
986
967
  * interruption.
987
968
  *
988
- * The `FiberId` of the fiber that may complete the async callback may be
989
- * provided to allow for better diagnostics.
969
+ * The `FiberId` of the fiber that may complete the async callback may also be
970
+ * specified. This is called the "blocking fiber" because it suspends the fiber
971
+ * executing the `async` Effect (i.e. semantically blocks the fiber from making
972
+ * progress). Specifying this fiber id in cases where it is known will improve
973
+ * diagnostics, but not affect the behavior of the returned effect.
990
974
  *
991
975
  * @since 2.0.0
992
976
  * @category constructors
@@ -1005,51 +989,9 @@ export const async: <A, E = never, R = never>(
1005
989
  * @since 2.0.0
1006
990
  * @category constructors
1007
991
  */
1008
- export const asyncEffect: <A, E, R, X, E2, R2>(
1009
- register: (callback: (_: Effect<A, E, R>) => void) => Effect<X, E2, R2>
1010
- ) => Effect<A, E | E2, R | R2> = _runtime.asyncEffect
1011
-
1012
- /**
1013
- * Imports an asynchronous effect into a pure `Effect` value, possibly returning
1014
- * the value synchronously.
1015
- *
1016
- * If the register function returns a value synchronously, then the callback
1017
- * function `Effect<A, E, R> => void` must not be called. Otherwise the callback
1018
- * function must be called at most once.
1019
- *
1020
- * The `FiberId` of the fiber that may complete the async callback may be
1021
- * provided to allow for better diagnostics.
1022
- *
1023
- * @since 2.0.0
1024
- * @category constructors
1025
- */
1026
- export const asyncOption: <A, E = never, R = never>(
1027
- register: (callback: (_: Effect<A, E, R>) => void) => Option.Option<Effect<A, E, R>>,
1028
- blockingOn?: FiberId.FiberId
1029
- ) => Effect<A, E, R> = effect.asyncOption
1030
-
1031
- /**
1032
- * Imports an asynchronous side-effect into an effect. It has the option of
1033
- * returning the value synchronously, which is useful in cases where it cannot
1034
- * be determined if the effect is synchronous or asynchronous until the register
1035
- * is actually executed. It also has the option of returning a canceler,
1036
- * which will be used by the runtime to cancel the asynchronous effect if the fiber
1037
- * executing the effect is interrupted.
1038
- *
1039
- * If the register function returns a value synchronously, then the callback
1040
- * function `Effect<A, E, R> => void` must not be called. Otherwise the callback
1041
- * function must be called at most once.
1042
- *
1043
- * The `FiberId` of the fiber that may complete the async callback may be
1044
- * provided to allow for better diagnostics.
1045
- *
1046
- * @since 2.0.0
1047
- * @category constructors
1048
- */
1049
- export const asyncEither: <A, E = never, R = never>(
1050
- register: (callback: (effect: Effect<A, E, R>) => void) => Either.Either<Effect<void, never, R>, Effect<A, E, R>>,
1051
- blockingOn?: FiberId.FiberId
1052
- ) => Effect<A, E, R> = core.asyncEither
992
+ export const asyncEffect: <A, E, R, R3, E2, R2>(
993
+ register: (callback: (_: Effect<A, E, R>) => void) => Effect<Effect<void, never, R3> | void, E2, R2>
994
+ ) => Effect<A, E | E2, R | R2 | R3> = _runtime.asyncEffect
1053
995
 
1054
996
  /**
1055
997
  * @since 2.0.0
@@ -1776,13 +1718,13 @@ export declare namespace Retry {
1776
1718
  */
1777
1719
  export type Return<R, E, A, O extends Options<E>> = Effect<
1778
1720
  A,
1779
- | (O extends { schedule: Schedule.Schedule<infer _R, infer _I, infer _O> } ? E
1721
+ | (O extends { schedule: Schedule.Schedule<infer _O, infer _I, infer _R> } ? E
1780
1722
  : O extends { until: Refinement<E, infer E2> } ? E2
1781
1723
  : E)
1782
1724
  | (O extends { while: (...args: Array<any>) => Effect<infer _A, infer E, infer _R> } ? E : never)
1783
1725
  | (O extends { until: (...args: Array<any>) => Effect<infer _A, infer E, infer _R> } ? E : never),
1784
1726
  | R
1785
- | (O extends { schedule: Schedule.Schedule<infer R, infer _I, infer _O> } ? R : never)
1727
+ | (O extends { schedule: Schedule.Schedule<infer _O, infer _I, infer R> } ? R : never)
1786
1728
  | (O extends { while: (...args: Array<any>) => Effect<infer _A, infer _E, infer R> } ? R : never)
1787
1729
  | (O extends { until: (...args: Array<any>) => Effect<infer _A, infer _E, infer R> } ? R : never)
1788
1730
  > extends infer Z ? Z : never
@@ -1811,16 +1753,16 @@ export const retry: {
1811
1753
  ): <A, R>(
1812
1754
  self: Effect<A, E, R>
1813
1755
  ) => Retry.Return<R, E, A, O>
1814
- <R1, E, B>(
1815
- policy: Schedule.Schedule<R1, NoInfer<E>, B>
1756
+ <B, E, R1>(
1757
+ policy: Schedule.Schedule<B, NoInfer<E>, R1>
1816
1758
  ): <A, R>(self: Effect<A, E, R>) => Effect<A, E, R1 | R>
1817
1759
  <A, E, R, O extends Retry.Options<E>>(
1818
1760
  self: Effect<A, E, R>,
1819
1761
  options: O
1820
1762
  ): Retry.Return<R, E, A, O>
1821
- <R, E, A, R1, B>(
1763
+ <A, E, R, B, R1>(
1822
1764
  self: Effect<A, E, R>,
1823
- policy: Schedule.Schedule<R1, E, B>
1765
+ policy: Schedule.Schedule<B, E, R1>
1824
1766
  ): Effect<A, E, R1 | R>
1825
1767
  } = _schedule.retry_combined
1826
1768
 
@@ -1833,13 +1775,13 @@ export const retry: {
1833
1775
  * @category error handling
1834
1776
  */
1835
1777
  export const retryOrElse: {
1836
- <R1, E, A1, A2, E2, R2>(
1837
- policy: Schedule.Schedule<R1, NoInfer<E>, A1>,
1778
+ <A1, E, R1, A2, E2, R2>(
1779
+ policy: Schedule.Schedule<A1, NoInfer<E>, R1>,
1838
1780
  orElse: (e: NoInfer<E>, out: A1) => Effect<A2, E2, R2>
1839
1781
  ): <A, R>(self: Effect<A, E, R>) => Effect<A2 | A, E | E2, R1 | R2 | R>
1840
1782
  <A, E, R, A1, R1, A2, E2, R2>(
1841
1783
  self: Effect<A, E, R>,
1842
- policy: Schedule.Schedule<R1, NoInfer<E>, A1>,
1784
+ policy: Schedule.Schedule<A1, NoInfer<E>, R1>,
1843
1785
  orElse: (e: NoInfer<E>, out: A1) => Effect<A2, E2, R2>
1844
1786
  ): Effect<A | A2, E | E2, R | R1 | R2>
1845
1787
  } = _schedule.retryOrElse_Effect
@@ -2216,7 +2158,7 @@ export const merge: <A, E, R>(self: Effect<A, E, R>) => Effect<E | A, never, R>
2216
2158
  * @since 2.0.0
2217
2159
  * @category mapping
2218
2160
  */
2219
- export const negate: <R, E>(self: Effect<boolean, E, R>) => Effect<boolean, E, R> = effect.negate
2161
+ export const negate: <E, R>(self: Effect<boolean, E, R>) => Effect<boolean, E, R> = effect.negate
2220
2162
 
2221
2163
  // -------------------------------------------------------------------------------------
2222
2164
  // scoping, resources & finalization
@@ -2679,8 +2621,8 @@ export const forkScoped: <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber.Runtim
2679
2621
  export const forkWithErrorHandler: {
2680
2622
  <E, X>(
2681
2623
  handler: (e: E) => Effect<X>
2682
- ): <R, A>(self: Effect<A, E, R>) => Effect<Fiber.RuntimeFiber<A, E>, never, R>
2683
- <R, E, A, X>(
2624
+ ): <A, R>(self: Effect<A, E, R>) => Effect<Fiber.RuntimeFiber<A, E>, never, R>
2625
+ <A, E, R, X>(
2684
2626
  self: Effect<A, E, R>,
2685
2627
  handler: (e: E) => Effect<X>
2686
2628
  ): Effect<Fiber.RuntimeFiber<A, E>, never, R>
@@ -2714,7 +2656,7 @@ export const fromFiberEffect: <A, E, R>(fiber: Effect<Fiber.Fiber<A, E>, E, R>)
2714
2656
  */
2715
2657
  export const supervised: {
2716
2658
  <X>(supervisor: Supervisor.Supervisor<X>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>
2717
- <R, E, A, X>(self: Effect<A, E, R>, supervisor: Supervisor.Supervisor<X>): Effect<A, E, R>
2659
+ <A, E, R, X>(self: Effect<A, E, R>, supervisor: Supervisor.Supervisor<X>): Effect<A, E, R>
2718
2660
  } = circular.supervised
2719
2661
 
2720
2662
  /**
@@ -3085,14 +3027,17 @@ export const mapInputContext: {
3085
3027
  * @category context
3086
3028
  */
3087
3029
  export const provide: {
3088
- <R2, E2, R3>(
3089
- layer: Layer.Layer<R3, E2, R2>
3090
- ): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E2 | E, R2 | Exclude<R, R3>>
3030
+ <ROut, E2, RIn>(
3031
+ layer: Layer.Layer<ROut, E2, RIn>
3032
+ ): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E2 | E, RIn | Exclude<R, ROut>>
3091
3033
  <R2>(context: Context.Context<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>
3092
3034
  <R2>(runtime: Runtime.Runtime<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>
3093
- <A, E, R, R2, E2, R3>(self: Effect<A, E, R>, layer: Layer.Layer<R3, E2, R2>): Effect<A, E | E2, R2 | Exclude<R, R3>>
3094
- <R, E, A, R2>(self: Effect<A, E, R>, context: Context.Context<R2>): Effect<A, E, Exclude<R, R2>>
3095
- <R, E, A, R2>(self: Effect<A, E, R>, runtime: Runtime.Runtime<R2>): Effect<A, E, Exclude<R, R2>>
3035
+ <A, E, R, ROut, E2, RIn>(
3036
+ self: Effect<A, E, R>,
3037
+ layer: Layer.Layer<ROut, E2, RIn>
3038
+ ): Effect<A, E | E2, RIn | Exclude<R, ROut>>
3039
+ <A, E, R, R2>(self: Effect<A, E, R>, context: Context.Context<R2>): Effect<A, E, Exclude<R, R2>>
3040
+ <A, E, R, R2>(self: Effect<A, E, R>, runtime: Runtime.Runtime<R2>): Effect<A, E, Exclude<R, R2>>
3096
3041
  } = layer.effect_provide
3097
3042
 
3098
3043
  /**
@@ -3146,7 +3091,7 @@ export const serviceFunction: <T extends Effect<any, any, any>, Args extends Arr
3146
3091
  * @since 2.0.0
3147
3092
  * @category context
3148
3093
  */
3149
- export const serviceFunctionEffect: <T extends Effect<any, any, any>, Args extends Array<any>, R, E, A>(
3094
+ export const serviceFunctionEffect: <T extends Effect<any, any, any>, Args extends Array<any>, A, E, R>(
3150
3095
  getService: T,
3151
3096
  f: (_: Effect.Success<T>) => (...args: Args) => Effect<A, E, R>
3152
3097
  ) => (...args: Args) => Effect<A, E | Effect.Error<T>, R | Effect.Context<T>> = effect.serviceFunctionEffect
@@ -3301,7 +3246,7 @@ export {
3301
3246
  * @since 2.0.0
3302
3247
  * @category conversions
3303
3248
  */
3304
- export const either: <A, E, R>(self: Effect<A, E, R>) => Effect<Either.Either<E, A>, never, R> = core.either
3249
+ export const either: <A, E, R>(self: Effect<A, E, R>) => Effect<Either.Either<A, E>, never, R> = core.either
3305
3250
 
3306
3251
  /**
3307
3252
  * @since 2.0.0
@@ -3619,13 +3564,13 @@ export const andThen: {
3619
3564
  ) => [X] extends [Effect<infer A1, infer E1, infer R1>] ? Effect<A1, E | E1, R | R1>
3620
3565
  : [X] extends [Promise<infer A1>] ? Effect<A1, E | Cause.UnknownException, R>
3621
3566
  : Effect<X, E, R>
3622
- <A, R, E, X>(
3567
+ <A, E, R, X>(
3623
3568
  self: Effect<A, E, R>,
3624
3569
  f: (a: NoInfer<A>) => X
3625
3570
  ): [X] extends [Effect<infer A1, infer E1, infer R1>] ? Effect<A1, E | E1, R | R1>
3626
3571
  : [X] extends [Promise<infer A1>] ? Effect<A1, E | Cause.UnknownException, R>
3627
3572
  : Effect<X, E, R>
3628
- <A, R, E, X>(
3573
+ <A, E, R, X>(
3629
3574
  self: Effect<A, E, R>,
3630
3575
  f: X
3631
3576
  ): [X] extends [Effect<infer A1, infer E1, infer R1>] ? Effect<A1, E | E1, R | R1>
@@ -3975,14 +3920,14 @@ export declare namespace Repeat {
3975
3920
  * @category repetition / recursion
3976
3921
  */
3977
3922
  export type Return<R, E, A, O extends Options<A>> = Effect<
3978
- (O extends { schedule: Schedule.Schedule<infer _R, infer _I, infer Out> } ? Out
3923
+ (O extends { schedule: Schedule.Schedule<infer Out, infer _I, infer _R> } ? Out
3979
3924
  : O extends { until: Refinement<A, infer B> } ? B
3980
3925
  : A),
3981
3926
  | E
3982
3927
  | (O extends { while: (...args: Array<any>) => Effect<infer _A, infer E, infer _R> } ? E : never)
3983
3928
  | (O extends { until: (...args: Array<any>) => Effect<infer _A, infer E, infer _R> } ? E : never),
3984
3929
  | R
3985
- | (O extends { schedule: Schedule.Schedule<infer R, infer _I, infer _O> } ? R : never)
3930
+ | (O extends { schedule: Schedule.Schedule<infer _O, infer _I, infer R> } ? R : never)
3986
3931
  | (O extends { while: (...args: Array<any>) => Effect<infer _A, infer _E, infer R> } ? R : never)
3987
3932
  | (O extends { until: (...args: Array<any>) => Effect<infer _A, infer _E, infer R> } ? R : never)
3988
3933
  > extends infer Z ? Z : never
@@ -4010,19 +3955,19 @@ export declare namespace Repeat {
4010
3955
  * @category repetition / recursion
4011
3956
  */
4012
3957
  export const repeat: {
4013
- <A, O extends Repeat.Options<A>>(
3958
+ <O extends Repeat.Options<A>, A>(
4014
3959
  options: O
4015
3960
  ): <E, R>(
4016
3961
  self: Effect<A, E, R>
4017
3962
  ) => Repeat.Return<R, E, A, O>
4018
- <R1, A, B>(
4019
- schedule: Schedule.Schedule<R1, A, B>
3963
+ <B, A, R1>(
3964
+ schedule: Schedule.Schedule<B, A, R1>
4020
3965
  ): <E, R>(self: Effect<A, E, R>) => Effect<B, E, R1 | R>
4021
3966
  <A, E, R, O extends Repeat.Options<A>>(
4022
3967
  self: Effect<A, E, R>,
4023
3968
  options: O
4024
3969
  ): Repeat.Return<R, E, A, O>
4025
- <A, E, R, R1, B>(self: Effect<A, E, R>, schedule: Schedule.Schedule<R1, A, B>): Effect<B, E, R | R1>
3970
+ <A, E, R, B, R1>(self: Effect<A, E, R>, schedule: Schedule.Schedule<B, A, R1>): Effect<B, E, R | R1>
4026
3971
  } = _schedule.repeat_combined
4027
3972
 
4028
3973
  /**
@@ -4053,12 +3998,12 @@ export const repeatN: {
4053
3998
  */
4054
3999
  export const repeatOrElse: {
4055
4000
  <R2, A, B, E, E2, R3>(
4056
- schedule: Schedule.Schedule<R2, A, B>,
4001
+ schedule: Schedule.Schedule<B, A, R2>,
4057
4002
  orElse: (error: E, option: Option.Option<B>) => Effect<B, E2, R3>
4058
4003
  ): <R>(self: Effect<A, E, R>) => Effect<B, E2, R2 | R3 | R>
4059
4004
  <A, E, R, R2, B, E2, R3>(
4060
4005
  self: Effect<A, E, R>,
4061
- schedule: Schedule.Schedule<R2, A, B>,
4006
+ schedule: Schedule.Schedule<B, A, R2>,
4062
4007
  orElse: (error: E, option: Option.Option<B>) => Effect<B, E2, R3>
4063
4008
  ): Effect<B, E2, R | R2 | R3>
4064
4009
  } = _schedule.repeatOrElse_Effect
@@ -4073,8 +4018,8 @@ export const repeatOrElse: {
4073
4018
  * @category repetition / recursion
4074
4019
  */
4075
4020
  export const schedule: {
4076
- <R2, Out>(schedule: Schedule.Schedule<R2, unknown, Out>): <A, E, R>(self: Effect<A, E, R>) => Effect<Out, E, R2 | R>
4077
- <A, E, R, R2, Out>(self: Effect<A, E, R>, schedule: Schedule.Schedule<R2, unknown, Out>): Effect<Out, E, R | R2>
4021
+ <R2, Out>(schedule: Schedule.Schedule<Out, unknown, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<Out, E, R2 | R>
4022
+ <A, E, R, R2, Out>(self: Effect<A, E, R>, schedule: Schedule.Schedule<Out, unknown, R2>): Effect<Out, E, R | R2>
4078
4023
  } = _schedule.schedule_Effect
4079
4024
 
4080
4025
  /**
@@ -4085,12 +4030,12 @@ export const schedule: {
4085
4030
  * @category repetition / recursion
4086
4031
  */
4087
4032
  export const scheduleForked: {
4088
- <R2, Out>(
4089
- schedule: Schedule.Schedule<R2, unknown, Out>
4033
+ <Out, R2>(
4034
+ schedule: Schedule.Schedule<Out, unknown, R2>
4090
4035
  ): <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber.RuntimeFiber<Out, E>, never, Scope.Scope | R2 | R>
4091
- <R, E, A, R2, Out>(
4036
+ <A, E, R, Out, R2>(
4092
4037
  self: Effect<A, E, R>,
4093
- schedule: Schedule.Schedule<R2, unknown, Out>
4038
+ schedule: Schedule.Schedule<Out, unknown, R2>
4094
4039
  ): Effect<Fiber.RuntimeFiber<Out, E>, never, Scope.Scope | R | R2>
4095
4040
  } = circular.scheduleForked
4096
4041
 
@@ -4104,12 +4049,12 @@ export const scheduleForked: {
4104
4049
  export const scheduleFrom: {
4105
4050
  <R2, In, Out>(
4106
4051
  initial: In,
4107
- schedule: Schedule.Schedule<R2, In, Out>
4052
+ schedule: Schedule.Schedule<Out, In, R2>
4108
4053
  ): <E, R>(self: Effect<In, E, R>) => Effect<Out, E, R2 | R>
4109
4054
  <In, E, R, R2, Out>(
4110
4055
  self: Effect<In, E, R>,
4111
4056
  initial: In,
4112
- schedule: Schedule.Schedule<R2, In, Out>
4057
+ schedule: Schedule.Schedule<Out, In, R2>
4113
4058
  ): Effect<Out, E, R | R2>
4114
4059
  } = _schedule.scheduleFrom_Effect
4115
4060
 
@@ -4652,32 +4597,10 @@ export const metricLabels: Effect<ReadonlyArray<MetricLabel.MetricLabel>> = core
4652
4597
  * @category metrics
4653
4598
  */
4654
4599
  export const withMetric: {
4655
- <Type, In, Out>(metric: Metric.Metric<Type, In, Out>): <R, E, A extends In>(self: Effect<A, E, R>) => Effect<A, E, R>
4656
- <R, E, A extends In, Type, In, Out>(self: Effect<A, E, R>, metric: Metric.Metric<Type, In, Out>): Effect<A, E, R>
4600
+ <Type, In, Out>(metric: Metric.Metric<Type, In, Out>): <A extends In, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>
4601
+ <A extends In, E, R, Type, In, Out>(self: Effect<A, E, R>, metric: Metric.Metric<Type, In, Out>): Effect<A, E, R>
4657
4602
  } = effect.withMetric
4658
4603
 
4659
- // -------------------------------------------------------------------------------------
4660
- // unify
4661
- // -------------------------------------------------------------------------------------
4662
-
4663
- /**
4664
- * Used to unify functions that would otherwise return `Effect<A, B, C> | Effect<D, E, F>`
4665
- *
4666
- * @category unify
4667
- * @since 2.0.0
4668
- */
4669
- export const unifiedFn: <Args extends ReadonlyArray<any>, Ret extends Effect<any, any, any>>(
4670
- f: (...args: Args) => Ret
4671
- ) => (...args: Args) => Effect.Unify<Ret> = core.unified
4672
-
4673
- /**
4674
- * Used to unify effects that would otherwise be `Effect<A, B, C> | Effect<D, E, F>`
4675
- *
4676
- * @category unify
4677
- * @since 2.0.0
4678
- */
4679
- export const unified: <Ret extends Effect<any, any, any>>(f: Ret) => Effect.Unify<Ret> = identity
4680
-
4681
4604
  // -------------------------------------------------------------------------------------
4682
4605
  // semaphore
4683
4606
  // -------------------------------------------------------------------------------------
@@ -4852,6 +4775,22 @@ export const zip: {
4852
4775
  } = fiberRuntime.zipOptions
4853
4776
 
4854
4777
  /**
4778
+ * Sequentially run this effect with the specified effect, _discarding_ the result
4779
+ * of the second effect (`that`) in the chain.
4780
+ *
4781
+ * `{ concurrent: true }` can be passed to the options to make it a concurrent execution
4782
+ * of both effects instead of sequential.
4783
+ *
4784
+ * @example
4785
+ *
4786
+ * import { Effect } from 'effect';
4787
+ *
4788
+ * const effect = Effect.succeed("a message").pipe(
4789
+ * Effect.zipLeft(Effect.succeed(42)),
4790
+ * )
4791
+ *
4792
+ * assert.deepStrictEqual(Effect.runSync(effect), "a message");
4793
+ *
4855
4794
  * @since 2.0.0
4856
4795
  * @category zipping
4857
4796
  */
@@ -4872,6 +4811,22 @@ export const zipLeft: {
4872
4811
  } = fiberRuntime.zipLeftOptions
4873
4812
 
4874
4813
  /**
4814
+ * Sequentially run this effect with the specified effect, _returning_ the result
4815
+ * of the second effect (`that`) in the chain.
4816
+ *
4817
+ * `{ concurrent: true }` can be passed to the options to make it a concurrent execution
4818
+ * of both effects instead of sequential.
4819
+ *
4820
+ * @example
4821
+ *
4822
+ * import { Effect } from 'effect';
4823
+ *
4824
+ * const effect = Effect.succeed("a message").pipe(
4825
+ * Effect.zipRight(Effect.succeed(42)),
4826
+ * )
4827
+ *
4828
+ * assert.deepStrictEqual(Effect.runSync(effect), 42);
4829
+ *
4875
4830
  * @since 2.0.0
4876
4831
  * @category zipping
4877
4832
  */