effect 2.3.8 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) 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 +16 -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/ReadonlyArray.js +2 -2
  13. package/dist/cjs/ReadonlyArray.js.map +1 -1
  14. package/dist/cjs/ReadonlyRecord.js +71 -76
  15. package/dist/cjs/ReadonlyRecord.js.map +1 -1
  16. package/dist/cjs/STM.js.map +1 -1
  17. package/dist/cjs/Schedule.js.map +1 -1
  18. package/dist/cjs/Sink.js.map +1 -1
  19. package/dist/cjs/Stream.js +3 -23
  20. package/dist/cjs/Stream.js.map +1 -1
  21. package/dist/cjs/Struct.js +3 -1
  22. package/dist/cjs/Struct.js.map +1 -1
  23. package/dist/cjs/TestAnnotation.js.map +1 -1
  24. package/dist/cjs/internal/channel/channelExecutor.js +5 -5
  25. package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
  26. package/dist/cjs/internal/channel/channelState.js +5 -5
  27. package/dist/cjs/internal/channel/channelState.js.map +1 -1
  28. package/dist/cjs/internal/channel.js.map +1 -1
  29. package/dist/cjs/internal/clock.js +3 -4
  30. package/dist/cjs/internal/clock.js.map +1 -1
  31. package/dist/cjs/internal/core-effect.js +6 -23
  32. package/dist/cjs/internal/core-effect.js.map +1 -1
  33. package/dist/cjs/internal/core.js +11 -27
  34. package/dist/cjs/internal/core.js.map +1 -1
  35. package/dist/cjs/internal/effect/circular.js +4 -5
  36. package/dist/cjs/internal/effect/circular.js.map +1 -1
  37. package/dist/cjs/internal/either.js +3 -3
  38. package/dist/cjs/internal/either.js.map +1 -1
  39. package/dist/cjs/internal/groupBy.js.map +1 -1
  40. package/dist/cjs/internal/layer.js +0 -2
  41. package/dist/cjs/internal/layer.js.map +1 -1
  42. package/dist/cjs/internal/runtime.js +12 -1
  43. package/dist/cjs/internal/runtime.js.map +1 -1
  44. package/dist/cjs/internal/schedule.js +4 -4
  45. package/dist/cjs/internal/schedule.js.map +1 -1
  46. package/dist/cjs/internal/sink.js +0 -2
  47. package/dist/cjs/internal/sink.js.map +1 -1
  48. package/dist/cjs/internal/stm/stm.js +1 -0
  49. package/dist/cjs/internal/stm/stm.js.map +1 -1
  50. package/dist/cjs/internal/stream.js +51 -64
  51. package/dist/cjs/internal/stream.js.map +1 -1
  52. package/dist/cjs/internal/version.js +1 -1
  53. package/dist/dts/BigInt.d.ts +7 -0
  54. package/dist/dts/BigInt.d.ts.map +1 -1
  55. package/dist/dts/Brand.d.ts +1 -1
  56. package/dist/dts/Brand.d.ts.map +1 -1
  57. package/dist/dts/Cause.d.ts +1 -1
  58. package/dist/dts/Cause.d.ts.map +1 -1
  59. package/dist/dts/Channel.d.ts +11 -11
  60. package/dist/dts/Channel.d.ts.map +1 -1
  61. package/dist/dts/Chunk.d.ts +3 -3
  62. package/dist/dts/Config.d.ts +4 -4
  63. package/dist/dts/Config.d.ts.map +1 -1
  64. package/dist/dts/Cron.d.ts +1 -1
  65. package/dist/dts/Cron.d.ts.map +1 -1
  66. package/dist/dts/Differ.d.ts +2 -2
  67. package/dist/dts/Differ.d.ts.map +1 -1
  68. package/dist/dts/Effect.d.ts +52 -108
  69. package/dist/dts/Effect.d.ts.map +1 -1
  70. package/dist/dts/Either.d.ts +126 -83
  71. package/dist/dts/Either.d.ts.map +1 -1
  72. package/dist/dts/Encoding.d.ts +6 -6
  73. package/dist/dts/Encoding.d.ts.map +1 -1
  74. package/dist/dts/Equal.d.ts.map +1 -1
  75. package/dist/dts/Exit.d.ts +2 -2
  76. package/dist/dts/Fiber.d.ts +2 -2
  77. package/dist/dts/Fiber.d.ts.map +1 -1
  78. package/dist/dts/GroupBy.d.ts +12 -12
  79. package/dist/dts/GroupBy.d.ts.map +1 -1
  80. package/dist/dts/Layer.d.ts +26 -26
  81. package/dist/dts/Layer.d.ts.map +1 -1
  82. package/dist/dts/List.d.ts +2 -2
  83. package/dist/dts/Logger.d.ts +4 -4
  84. package/dist/dts/Match.d.ts +2 -2
  85. package/dist/dts/Match.d.ts.map +1 -1
  86. package/dist/dts/MergeDecision.d.ts +1 -1
  87. package/dist/dts/MergeState.d.ts +5 -5
  88. package/dist/dts/MergeState.d.ts.map +1 -1
  89. package/dist/dts/Metric.d.ts +13 -13
  90. package/dist/dts/Metric.d.ts.map +1 -1
  91. package/dist/dts/MetricPolling.d.ts +4 -4
  92. package/dist/dts/MetricPolling.d.ts.map +1 -1
  93. package/dist/dts/Number.d.ts +8 -0
  94. package/dist/dts/Number.d.ts.map +1 -1
  95. package/dist/dts/Option.d.ts +11 -11
  96. package/dist/dts/ReadonlyArray.d.ts +9 -8
  97. package/dist/dts/ReadonlyArray.d.ts.map +1 -1
  98. package/dist/dts/ReadonlyRecord.d.ts +111 -94
  99. package/dist/dts/ReadonlyRecord.d.ts.map +1 -1
  100. package/dist/dts/Reloadable.d.ts +4 -4
  101. package/dist/dts/Reloadable.d.ts.map +1 -1
  102. package/dist/dts/RequestResolver.d.ts +13 -13
  103. package/dist/dts/RequestResolver.d.ts.map +1 -1
  104. package/dist/dts/Resource.d.ts +1 -1
  105. package/dist/dts/Resource.d.ts.map +1 -1
  106. package/dist/dts/STM.d.ts +144 -139
  107. package/dist/dts/STM.d.ts.map +1 -1
  108. package/dist/dts/Schedule.d.ts +171 -179
  109. package/dist/dts/Schedule.d.ts.map +1 -1
  110. package/dist/dts/SingleProducerAsyncInput.d.ts +1 -1
  111. package/dist/dts/SingleProducerAsyncInput.d.ts.map +1 -1
  112. package/dist/dts/Sink.d.ts +13 -13
  113. package/dist/dts/Sink.d.ts.map +1 -1
  114. package/dist/dts/Stream.d.ts +355 -366
  115. package/dist/dts/Stream.d.ts.map +1 -1
  116. package/dist/dts/Struct.d.ts +3 -3
  117. package/dist/dts/Struct.d.ts.map +1 -1
  118. package/dist/dts/SubscriptionRef.d.ts +2 -2
  119. package/dist/dts/TArray.d.ts +2 -2
  120. package/dist/dts/TDeferred.d.ts +3 -3
  121. package/dist/dts/TMap.d.ts +10 -10
  122. package/dist/dts/TSet.d.ts +4 -4
  123. package/dist/dts/Take.d.ts +2 -2
  124. package/dist/dts/TestAnnotation.d.ts +2 -2
  125. package/dist/dts/TestAnnotation.d.ts.map +1 -1
  126. package/dist/dts/Types.d.ts +7 -0
  127. package/dist/dts/Types.d.ts.map +1 -1
  128. package/dist/dts/internal/stm/stm.d.ts +2 -15
  129. package/dist/dts/internal/stm/stm.d.ts.map +1 -1
  130. package/dist/esm/BigInt.js +12 -0
  131. package/dist/esm/BigInt.js.map +1 -1
  132. package/dist/esm/Effect.js +13 -58
  133. package/dist/esm/Effect.js.map +1 -1
  134. package/dist/esm/Either.js +42 -5
  135. package/dist/esm/Either.js.map +1 -1
  136. package/dist/esm/Equal.js +1 -1
  137. package/dist/esm/Equal.js.map +1 -1
  138. package/dist/esm/Exit.js +1 -1
  139. package/dist/esm/Number.js +23 -0
  140. package/dist/esm/Number.js.map +1 -1
  141. package/dist/esm/ReadonlyArray.js +2 -2
  142. package/dist/esm/ReadonlyArray.js.map +1 -1
  143. package/dist/esm/ReadonlyRecord.js +70 -75
  144. package/dist/esm/ReadonlyRecord.js.map +1 -1
  145. package/dist/esm/STM.js.map +1 -1
  146. package/dist/esm/Schedule.js.map +1 -1
  147. package/dist/esm/Sink.js.map +1 -1
  148. package/dist/esm/Stream.js +5 -22
  149. package/dist/esm/Stream.js.map +1 -1
  150. package/dist/esm/Struct.js +3 -1
  151. package/dist/esm/Struct.js.map +1 -1
  152. package/dist/esm/TestAnnotation.js.map +1 -1
  153. package/dist/esm/internal/channel/channelExecutor.js +5 -5
  154. package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
  155. package/dist/esm/internal/channel/channelState.js +3 -3
  156. package/dist/esm/internal/channel/channelState.js.map +1 -1
  157. package/dist/esm/internal/channel.js.map +1 -1
  158. package/dist/esm/internal/clock.js +3 -4
  159. package/dist/esm/internal/clock.js.map +1 -1
  160. package/dist/esm/internal/core-effect.js +4 -20
  161. package/dist/esm/internal/core-effect.js.map +1 -1
  162. package/dist/esm/internal/core.js +8 -22
  163. package/dist/esm/internal/core.js.map +1 -1
  164. package/dist/esm/internal/effect/circular.js +4 -5
  165. package/dist/esm/internal/effect/circular.js.map +1 -1
  166. package/dist/esm/internal/either.js +3 -3
  167. package/dist/esm/internal/either.js.map +1 -1
  168. package/dist/esm/internal/groupBy.js.map +1 -1
  169. package/dist/esm/internal/layer.js +0 -2
  170. package/dist/esm/internal/layer.js.map +1 -1
  171. package/dist/esm/internal/runtime.js +12 -1
  172. package/dist/esm/internal/runtime.js.map +1 -1
  173. package/dist/esm/internal/schedule.js +4 -4
  174. package/dist/esm/internal/schedule.js.map +1 -1
  175. package/dist/esm/internal/sink.js +0 -2
  176. package/dist/esm/internal/sink.js.map +1 -1
  177. package/dist/esm/internal/stm/stm.js +1 -0
  178. package/dist/esm/internal/stm/stm.js.map +1 -1
  179. package/dist/esm/internal/stream.js +49 -59
  180. package/dist/esm/internal/stream.js.map +1 -1
  181. package/dist/esm/internal/version.js +1 -1
  182. package/package.json +1 -1
  183. package/src/BigInt.ts +13 -0
  184. package/src/Brand.ts +4 -4
  185. package/src/Cause.ts +1 -1
  186. package/src/Channel.ts +17 -17
  187. package/src/Chunk.ts +4 -4
  188. package/src/Config.ts +4 -4
  189. package/src/Cron.ts +2 -2
  190. package/src/Differ.ts +2 -2
  191. package/src/Effect.ts +68 -145
  192. package/src/Either.ts +215 -133
  193. package/src/Encoding.ts +3 -3
  194. package/src/Equal.ts +1 -1
  195. package/src/Exit.ts +2 -2
  196. package/src/Fiber.ts +2 -2
  197. package/src/GroupBy.ts +16 -16
  198. package/src/Layer.ts +32 -32
  199. package/src/List.ts +3 -3
  200. package/src/Logger.ts +4 -4
  201. package/src/Match.ts +3 -3
  202. package/src/MergeDecision.ts +1 -1
  203. package/src/MergeState.ts +8 -8
  204. package/src/Metric.ts +13 -13
  205. package/src/MetricPolling.ts +9 -9
  206. package/src/Number.ts +26 -0
  207. package/src/Option.ts +17 -17
  208. package/src/ReadonlyArray.ts +23 -15
  209. package/src/ReadonlyRecord.ts +421 -265
  210. package/src/Reloadable.ts +4 -4
  211. package/src/RequestResolver.ts +19 -19
  212. package/src/Resource.ts +3 -3
  213. package/src/STM.ts +166 -213
  214. package/src/Schedule.ts +331 -361
  215. package/src/SingleProducerAsyncInput.ts +1 -1
  216. package/src/Sink.ts +19 -19
  217. package/src/Stream.ts +449 -456
  218. package/src/Struct.ts +8 -5
  219. package/src/SubscriptionRef.ts +2 -2
  220. package/src/TArray.ts +2 -2
  221. package/src/TDeferred.ts +4 -4
  222. package/src/TMap.ts +10 -10
  223. package/src/TSet.ts +4 -4
  224. package/src/Take.ts +4 -4
  225. package/src/TestAnnotation.ts +5 -8
  226. package/src/Types.ts +11 -0
  227. package/src/internal/blockedRequests.ts +2 -2
  228. package/src/internal/cause.ts +2 -2
  229. package/src/internal/channel/channelExecutor.ts +26 -26
  230. package/src/internal/channel/channelState.ts +13 -13
  231. package/src/internal/channel/mergeDecision.ts +1 -1
  232. package/src/internal/channel/mergeState.ts +6 -6
  233. package/src/internal/channel/singleProducerAsyncInput.ts +5 -5
  234. package/src/internal/channel.ts +43 -43
  235. package/src/internal/clock.ts +3 -4
  236. package/src/internal/config.ts +7 -7
  237. package/src/internal/configError.ts +1 -1
  238. package/src/internal/configProvider/pathPatch.ts +2 -2
  239. package/src/internal/configProvider.ts +1 -1
  240. package/src/internal/core-effect.ts +28 -43
  241. package/src/internal/core.ts +15 -40
  242. package/src/internal/dataSource.ts +26 -26
  243. package/src/internal/differ/orPatch.ts +7 -7
  244. package/src/internal/differ.ts +2 -2
  245. package/src/internal/effect/circular.ts +9 -10
  246. package/src/internal/either.ts +25 -22
  247. package/src/internal/encoding/base64.ts +1 -1
  248. package/src/internal/encoding/base64Url.ts +1 -1
  249. package/src/internal/encoding/hex.ts +1 -1
  250. package/src/internal/fiber.ts +2 -2
  251. package/src/internal/fiberRuntime.ts +9 -9
  252. package/src/internal/groupBy.ts +40 -40
  253. package/src/internal/layer/circular.ts +4 -4
  254. package/src/internal/layer.ts +52 -54
  255. package/src/internal/matcher.ts +5 -5
  256. package/src/internal/metric/polling.ts +8 -8
  257. package/src/internal/metric.ts +6 -6
  258. package/src/internal/reloadable.ts +4 -4
  259. package/src/internal/resource.ts +2 -2
  260. package/src/internal/runtime.ts +32 -19
  261. package/src/internal/schedule.ts +430 -500
  262. package/src/internal/sink.ts +27 -29
  263. package/src/internal/stm/core.ts +23 -23
  264. package/src/internal/stm/stm.ts +158 -157
  265. package/src/internal/stm/tArray.ts +3 -3
  266. package/src/internal/stm/tDeferred.ts +5 -5
  267. package/src/internal/stm/tMap.ts +13 -13
  268. package/src/internal/stm/tSet.ts +4 -4
  269. package/src/internal/stream.ts +688 -723
  270. package/src/internal/subscriptionRef.ts +3 -3
  271. package/src/internal/take.ts +6 -6
  272. package/src/internal/version.ts +1 -1
package/src/Equal.ts CHANGED
@@ -62,4 +62,4 @@ export const isEqual = (u: unknown): u is Equal => hasProperty(u, symbol)
62
62
  * @since 2.0.0
63
63
  * @category instances
64
64
  */
65
- export const equivalence: <A>() => Equivalence<A> = () => (self, that) => equals(self, that)
65
+ export const equivalence: <A>() => Equivalence<A> = () => equals
package/src/Exit.ts CHANGED
@@ -226,12 +226,12 @@ export const forEachEffect: {
226
226
  } = core.exitForEachEffect
227
227
 
228
228
  /**
229
- * Converts an `Either<E, A>` into an `Exit<A, E>`.
229
+ * Converts an `Either<R, L>` into an `Exit<R, L>`.
230
230
  *
231
231
  * @since 2.0.0
232
232
  * @category conversions
233
233
  */
234
- export const fromEither: <E, A>(either: Either.Either<E, A>) => Exit<A, E> = core.exitFromEither
234
+ export const fromEither: <R, L>(either: Either.Either<R, L>) => Exit<R, L> = core.exitFromEither
235
235
 
236
236
  /**
237
237
  * Converts an `Option<A>` into an `Exit<void, A>`.
package/src/Fiber.ts CHANGED
@@ -539,8 +539,8 @@ export const orElse: {
539
539
  * @category alternatives
540
540
  */
541
541
  export const orElseEither: {
542
- <A2, E2>(that: Fiber<A2, E2>): <A, E>(self: Fiber<A, E>) => Fiber<Either.Either<A, A2>, E2 | E>
543
- <A, E, A2, E2>(self: Fiber<A, E>, that: Fiber<A2, E2>): Fiber<Either.Either<A, A2>, E | E2>
542
+ <A2, E2>(that: Fiber<A2, E2>): <A, E>(self: Fiber<A, E>) => Fiber<Either.Either<A2, A>, E2 | E>
543
+ <A, E, A2, E2>(self: Fiber<A, E>, that: Fiber<A2, E2>): Fiber<Either.Either<A2, A>, E | E2>
544
544
  } = internal.orElseEither
545
545
 
546
546
  /**
package/src/GroupBy.ts CHANGED
@@ -29,7 +29,7 @@ export type GroupByTypeId = typeof GroupByTypeId
29
29
  * @since 2.0.0
30
30
  * @category models
31
31
  */
32
- export interface GroupBy<out R, out E, out K, out V> extends GroupBy.Variance<R, E, K, V>, Pipeable {
32
+ export interface GroupBy<out K, out V, out E = never, out R = never> extends GroupBy.Variance<K, V, E, R>, Pipeable {
33
33
  readonly grouped: Stream.Stream<readonly [K, Queue.Dequeue<Take.Take<V, E>>], E, R>
34
34
  }
35
35
 
@@ -41,12 +41,12 @@ export declare namespace GroupBy {
41
41
  * @since 2.0.0
42
42
  * @category models
43
43
  */
44
- export interface Variance<out R, out E, out K, out V> {
44
+ export interface Variance<out K, out V, out E, out R> {
45
45
  readonly [GroupByTypeId]: {
46
- readonly _R: Covariant<R>
47
- readonly _E: Covariant<E>
48
46
  readonly _K: Covariant<K>
49
47
  readonly _V: Covariant<V>
48
+ readonly _E: Covariant<E>
49
+ readonly _R: Covariant<R>
50
50
  }
51
51
  }
52
52
  }
@@ -59,13 +59,13 @@ export declare namespace GroupBy {
59
59
  * @category destructors
60
60
  */
61
61
  export const evaluate: {
62
- <K, E, V, R2, E2, A>(
63
- f: (key: K, stream: Stream.Stream<V, E>) => Stream.Stream<A, E2, R2>,
62
+ <K, V, E, A, E2, R2>(
63
+ f: (key: K, stream: Stream.Stream<V, E, never>) => Stream.Stream<A, E2, R2>,
64
64
  options?: { readonly bufferSize?: number | undefined } | undefined
65
- ): <R>(self: GroupBy<R, E, K, V>) => Stream.Stream<A, E | E2, R2 | R>
66
- <R, K, E, V, R2, E2, A>(
67
- self: GroupBy<R, E, K, V>,
68
- f: (key: K, stream: Stream.Stream<V, E>) => Stream.Stream<A, E2, R2>,
65
+ ): <R>(self: GroupBy<K, V, E, R>) => Stream.Stream<A, E | E2, R2 | R>
66
+ <K, V, E, R, A, E2, R2>(
67
+ self: GroupBy<K, V, E, R>,
68
+ f: (key: K, stream: Stream.Stream<V, E, never>) => Stream.Stream<A, E2, R2>,
69
69
  options?: { readonly bufferSize?: number | undefined } | undefined
70
70
  ): Stream.Stream<A, E | E2, R | R2>
71
71
  } = internal.evaluate
@@ -77,8 +77,8 @@ export const evaluate: {
77
77
  * @category utils
78
78
  */
79
79
  export const filter: {
80
- <K>(predicate: Predicate<NoInfer<K>>): <R, E, V>(self: GroupBy<R, E, K, V>) => GroupBy<R, E, K, V>
81
- <R, E, V, K>(self: GroupBy<R, E, K, V>, predicate: Predicate<K>): GroupBy<R, E, K, V>
80
+ <K>(predicate: Predicate<NoInfer<K>>): <V, E, R>(self: GroupBy<K, V, E, R>) => GroupBy<K, V, E, R>
81
+ <K, V, E, R>(self: GroupBy<K, V, E, R>, predicate: Predicate<K>): GroupBy<K, V, E, R>
82
82
  } = internal.filter
83
83
 
84
84
  /**
@@ -88,8 +88,8 @@ export const filter: {
88
88
  * @category utils
89
89
  */
90
90
  export const first: {
91
- (n: number): <R, E, K, V>(self: GroupBy<R, E, K, V>) => GroupBy<R, E, K, V>
92
- <R, E, K, V>(self: GroupBy<R, E, K, V>, n: number): GroupBy<R, E, K, V>
91
+ (n: number): <K, V, E, R>(self: GroupBy<K, V, E, R>) => GroupBy<K, V, E, R>
92
+ <K, V, E, R>(self: GroupBy<K, V, E, R>, n: number): GroupBy<K, V, E, R>
93
93
  } = internal.first
94
94
 
95
95
  /**
@@ -98,6 +98,6 @@ export const first: {
98
98
  * @since 2.0.0
99
99
  * @category constructors
100
100
  */
101
- export const make: <R, E, K, V>(
101
+ export const make: <K, V, E, R>(
102
102
  grouped: Stream.Stream<readonly [K, Queue.Dequeue<Take.Take<V, E>>], E, R>
103
- ) => GroupBy<R, E, K, V> = internal.make
103
+ ) => GroupBy<K, V, E, R> = internal.make
package/src/Layer.ts CHANGED
@@ -252,7 +252,7 @@ export const effect: {
252
252
  * @since 2.0.0
253
253
  * @category constructors
254
254
  */
255
- export const effectDiscard: <_, E, R>(effect: Effect.Effect<_, E, R>) => Layer<never, E, R> = internal.fromEffectDiscard
255
+ export const effectDiscard: <X, E, R>(effect: Effect.Effect<X, E, R>) => Layer<never, E, R> = internal.fromEffectDiscard
256
256
 
257
257
  /**
258
258
  * Constructs a layer from the specified effect, which must return one or more
@@ -323,10 +323,10 @@ export const failCauseSync: <E>(evaluate: LazyArg<Cause.Cause<E>>) => Layer<unkn
323
323
  * @category sequencing
324
324
  */
325
325
  export const flatMap: {
326
- <A, R2, E2, A2>(
326
+ <A, A2, E2, R2>(
327
327
  f: (context: Context.Context<A>) => Layer<A2, E2, R2>
328
- ): <R, E>(self: Layer<A, E, R>) => Layer<A2, E2 | E, R2 | R>
329
- <R, E, A, R2, E2, A2>(
328
+ ): <E, R>(self: Layer<A, E, R>) => Layer<A2, E2 | E, R2 | R>
329
+ <A, E, R, A2, E2, R2>(
330
330
  self: Layer<A, E, R>,
331
331
  f: (context: Context.Context<A>) => Layer<A2, E2, R2>
332
332
  ): Layer<A2, E | E2, R | R2>
@@ -339,8 +339,8 @@ export const flatMap: {
339
339
  * @category sequencing
340
340
  */
341
341
  export const flatten: {
342
- <R2, E2, A, I>(tag: Context.Tag<I, Layer<A, E2, R2>>): <R, E>(self: Layer<I, E, R>) => Layer<A, E2 | E, R2 | R>
343
- <R, E, A, R2, E2, I>(self: Layer<I, E, R>, tag: Context.Tag<I, Layer<A, E2, R2>>): Layer<A, E | E2, R | R2>
342
+ <I, A, E2, R2>(tag: Context.Tag<I, Layer<A, E2, R2>>): <E, R>(self: Layer<I, E, R>) => Layer<A, E2 | E, R2 | R>
343
+ <I, E, R, A, E2, R2>(self: Layer<I, E, R>, tag: Context.Tag<I, Layer<A, E2, R2>>): Layer<A, E | E2, R | R2>
344
344
  } = internal.flatten
345
345
 
346
346
  /**
@@ -383,8 +383,8 @@ export const launch: <RIn, E, ROut>(self: Layer<ROut, E, RIn>) => Effect.Effect<
383
383
  * @category mapping
384
384
  */
385
385
  export const map: {
386
- <A, B>(f: (context: Context.Context<A>) => Context.Context<B>): <R, E>(self: Layer<A, E, R>) => Layer<B, E, R>
387
- <R, E, A, B>(self: Layer<A, E, R>, f: (context: Context.Context<A>) => Context.Context<B>): Layer<B, E, R>
386
+ <A, B>(f: (context: Context.Context<A>) => Context.Context<B>): <E, R>(self: Layer<A, E, R>) => Layer<B, E, R>
387
+ <A, E, R, B>(self: Layer<A, E, R>, f: (context: Context.Context<A>) => Context.Context<B>): Layer<B, E, R>
388
388
  } = internal.map
389
389
 
390
390
  /**
@@ -394,8 +394,8 @@ export const map: {
394
394
  * @category mapping
395
395
  */
396
396
  export const mapError: {
397
- <E, E2>(f: (error: E) => E2): <R, A>(self: Layer<A, E, R>) => Layer<A, E2, R>
398
- <R, E, A, E2>(self: Layer<A, E, R>, f: (error: E) => E2): Layer<A, E2, R>
397
+ <E, E2>(f: (error: E) => E2): <A, R>(self: Layer<A, E, R>) => Layer<A, E2, R>
398
+ <A, E, R, E2>(self: Layer<A, E, R>, f: (error: E) => E2): Layer<A, E2, R>
399
399
  } = internal.mapError
400
400
 
401
401
  /**
@@ -407,13 +407,13 @@ export const mapError: {
407
407
  * @category folding
408
408
  */
409
409
  export const match: {
410
- <E, R2, E2, A2, A, R3, E3, A3>(
410
+ <E, A2, E2, R2, A, A3, E3, R3>(
411
411
  options: {
412
412
  readonly onFailure: (error: E) => Layer<A2, E2, R2>
413
413
  readonly onSuccess: (context: Context.Context<A>) => Layer<A3, E3, R3>
414
414
  }
415
415
  ): <R>(self: Layer<A, E, R>) => Layer<A2 & A3, E2 | E3, R2 | R3 | R>
416
- <R, E, A, R2, E2, A2, R3, E3, A3>(
416
+ <A, E, R, A2, E2, R2, A3, E3, R3>(
417
417
  self: Layer<A, E, R>,
418
418
  options: {
419
419
  readonly onFailure: (error: E) => Layer<A2, E2, R2>
@@ -431,13 +431,13 @@ export const match: {
431
431
  * @category folding
432
432
  */
433
433
  export const matchCause: {
434
- <E, A, R2, E2, A2, R3, E3, A3>(
434
+ <E, A2, E2, R2, A, A3, E3, R3>(
435
435
  options: {
436
436
  readonly onFailure: (cause: Cause.Cause<E>) => Layer<A2, E2, R2>
437
437
  readonly onSuccess: (context: Context.Context<A>) => Layer<A3, E3, R3>
438
438
  }
439
439
  ): <R>(self: Layer<A, E, R>) => Layer<A2 & A3, E2 | E3, R2 | R3 | R>
440
- <R, E, A, R2, E2, A2, R3, E3, A3>(
440
+ <A, E, R, A2, E2, R2, A3, E3, R3>(
441
441
  self: Layer<A, E, R>,
442
442
  options: {
443
443
  readonly onFailure: (cause: Cause.Cause<E>) => Layer<A2, E2, R2>
@@ -504,8 +504,8 @@ export const orDie: <A, E, R>(self: Layer<A, E, R>) => Layer<A, never, R> = inte
504
504
  * @category error handling
505
505
  */
506
506
  export const orElse: {
507
- <R2, E2, A2>(that: LazyArg<Layer<A2, E2, R2>>): <A, E, R>(self: Layer<A, E, R>) => Layer<A & A2, E2 | E, R2 | R>
508
- <R, E, A, R2, E2, A2>(self: Layer<A, E, R>, that: LazyArg<Layer<A2, E2, R2>>): Layer<A & A2, E | E2, R | R2>
507
+ <A2, E2, R2>(that: LazyArg<Layer<A2, E2, R2>>): <A, E, R>(self: Layer<A, E, R>) => Layer<A & A2, E2 | E, R2 | R>
508
+ <A, E, R, A2, E2, R2>(self: Layer<A, E, R>, that: LazyArg<Layer<A2, E2, R2>>): Layer<A & A2, E | E2, R | R2>
509
509
  } = internal.orElse
510
510
 
511
511
  /**
@@ -561,7 +561,7 @@ export const locally: {
561
561
  ref: FiberRef<X>,
562
562
  value: X
563
563
  ): <A, E, R>(self: Layer<A, E, R>) => Layer<A, E, R>
564
- <R, E, A, X>(
564
+ <A, E, R, X>(
565
565
  self: Layer<A, E, R>,
566
566
  ref: FiberRef<X>,
567
567
  value: X
@@ -574,7 +574,7 @@ export const locally: {
574
574
  */
575
575
  export const locallyWith: {
576
576
  <X>(ref: FiberRef<X>, value: (_: X) => X): <A, E, R>(self: Layer<A, E, R>) => Layer<A, E, R>
577
- <R, E, A, X>(self: Layer<A, E, R>, ref: FiberRef<X>, value: (_: X) => X): Layer<A, E, R>
577
+ <A, E, R, X>(self: Layer<A, E, R>, ref: FiberRef<X>, value: (_: X) => X): Layer<A, E, R>
578
578
  } = internal.fiberRefLocallyWith
579
579
 
580
580
  /**
@@ -597,12 +597,12 @@ export const fiberRefLocallyScopedWith: <A>(self: FiberRef<A>, value: (_: A) =>
597
597
  * @category retrying
598
598
  */
599
599
  export const retry: {
600
- <RIn2, E, X>(
601
- schedule: Schedule.Schedule<RIn2, E, X>
602
- ): <RIn, ROut>(self: Layer<ROut, E, RIn>) => Layer<ROut, E, RIn2 | RIn>
603
- <RIn, E, ROut, RIn2, X>(
600
+ <X, E, RIn2>(
601
+ schedule: Schedule.Schedule<X, E, RIn2>
602
+ ): <ROut, RIn>(self: Layer<ROut, E, RIn>) => Layer<ROut, E, RIn2 | RIn>
603
+ <ROut, E, RIn, X, RIn2>(
604
604
  self: Layer<ROut, E, RIn>,
605
- schedule: Schedule.Schedule<RIn2, E, X>
605
+ schedule: Schedule.Schedule<X, E, RIn2>
606
606
  ): Layer<ROut, E, RIn | RIn2>
607
607
  } = internal.retry
608
608
 
@@ -626,10 +626,10 @@ export const scope: Layer<Scope.CloseableScope> = internal.scope
626
626
  export const scoped: {
627
627
  <T extends Context.Tag<any, any>>(
628
628
  tag: T
629
- ): <R, E>(
629
+ ): <E, R>(
630
630
  effect: Effect.Effect<Context.Tag.Service<T>, E, R>
631
631
  ) => Layer<Context.Tag.Identifier<T>, E, Exclude<R, Scope.Scope>>
632
- <T extends Context.Tag<any, any>, R, E>(
632
+ <T extends Context.Tag<any, any>, E, R>(
633
633
  tag: T,
634
634
  effect: Effect.Effect<Context.Tag.Service<T>, E, R>
635
635
  ): Layer<Context.Tag.Identifier<T>, E, Exclude<R, Scope.Scope>>
@@ -641,7 +641,7 @@ export const scoped: {
641
641
  * @since 2.0.0
642
642
  * @category constructors
643
643
  */
644
- export const scopedDiscard: <_, E, R>(effect: Effect.Effect<_, E, R>) => Layer<never, E, Exclude<R, Scope.Scope>> =
644
+ export const scopedDiscard: <X, E, R>(effect: Effect.Effect<X, E, R>) => Layer<never, E, Exclude<R, Scope.Scope>> =
645
645
  internal.scopedDiscard
646
646
 
647
647
  /**
@@ -828,11 +828,11 @@ export const provideMerge: {
828
828
  * @category zipping
829
829
  */
830
830
  export const zipWith: {
831
- <R2, E2, B, A, C>(
831
+ <B, E2, R2, A, C>(
832
832
  that: Layer<B, E2, R2>,
833
833
  f: (a: Context.Context<A>, b: Context.Context<B>) => Context.Context<C>
834
- ): <R, E>(self: Layer<A, E, R>) => Layer<C, E2 | E, R2 | R>
835
- <R, E, R2, E2, B, A, C>(
834
+ ): <E, R>(self: Layer<A, E, R>) => Layer<C, E2 | E, R2 | R>
835
+ <A, E, R, B, E2, R2, C>(
836
836
  self: Layer<A, E, R>,
837
837
  that: Layer<B, E2, R2>,
838
838
  f: (a: Context.Context<A>, b: Context.Context<B>) => Context.Context<C>
@@ -843,14 +843,14 @@ export const zipWith: {
843
843
  * @since 2.0.0
844
844
  * @category utils
845
845
  */
846
- export const unwrapEffect: <R, E, R1, E1, A>(self: Effect.Effect<Layer<A, E1, R1>, E, R>) => Layer<A, E | E1, R | R1> =
846
+ export const unwrapEffect: <A, E1, R1, E, R>(self: Effect.Effect<Layer<A, E1, R1>, E, R>) => Layer<A, E | E1, R | R1> =
847
847
  internal.unwrapEffect
848
848
 
849
849
  /**
850
850
  * @since 2.0.0
851
851
  * @category utils
852
852
  */
853
- export const unwrapScoped: <R, E, R1, E1, A>(
853
+ export const unwrapScoped: <A, E1, R1, E, R>(
854
854
  self: Effect.Effect<Layer<A, E1, R1>, E, R>
855
855
  ) => Layer<A, E | E1, R1 | Exclude<R, Scope.Scope>> = internal.unwrapScoped
856
856
 
@@ -914,7 +914,7 @@ export const setRequestCache: {
914
914
  (
915
915
  cache: Request.Cache
916
916
  ): Layer<never>
917
- } = (<R, E>(cache: Request.Cache | Effect.Effect<Request.Cache, E, R>) =>
917
+ } = (<E, R>(cache: Request.Cache | Effect.Effect<Request.Cache, E, R>) =>
918
918
  scopedDiscard(
919
919
  core.isEffect(cache) ?
920
920
  core.flatMap(cache, (x) => fiberRuntime.fiberRefLocallyScoped(query.currentCache as any, x)) :
package/src/List.ts CHANGED
@@ -799,9 +799,9 @@ export const partition: {
799
799
  * @category combinators
800
800
  */
801
801
  export const partitionMap: {
802
- <A, B, C>(f: (a: A) => Either.Either<B, C>): (self: List<A>) => [left: List<B>, right: List<C>]
803
- <A, B, C>(self: List<A>, f: (a: A) => Either.Either<B, C>): [left: List<B>, right: List<C>]
804
- } = dual(2, <A, B, C>(self: List<A>, f: (a: A) => Either.Either<B, C>): [left: List<B>, right: List<C>] => {
802
+ <A, B, C>(f: (a: A) => Either.Either<C, B>): (self: List<A>) => [left: List<B>, right: List<C>]
803
+ <A, B, C>(self: List<A>, f: (a: A) => Either.Either<C, B>): [left: List<B>, right: List<C>]
804
+ } = dual(2, <A, B, C>(self: List<A>, f: (a: A) => Either.Either<C, B>): [left: List<B>, right: List<C>] => {
805
805
  const left: Array<B> = []
806
806
  const right: Array<C> = []
807
807
  for (const a of self) {
package/src/Logger.ts CHANGED
@@ -186,8 +186,8 @@ export const replace: {
186
186
  * @category context
187
187
  */
188
188
  export const replaceEffect: {
189
- <R, E, B>(that: Effect<Logger<unknown, B>, E, R>): <A>(self: Logger<unknown, A>) => Layer.Layer<never, E, R>
190
- <A, R, E, B>(self: Logger<unknown, A>, that: Effect<Logger<unknown, B>, E, R>): Layer.Layer<never, E, R>
189
+ <B, E, R>(that: Effect<Logger<unknown, B>, E, R>): <A>(self: Logger<unknown, A>) => Layer.Layer<never, E, R>
190
+ <A, B, E, R>(self: Logger<unknown, A>, that: Effect<Logger<unknown, B>, E, R>): Layer.Layer<never, E, R>
191
191
  } = circular.replaceLoggerEffect
192
192
 
193
193
  /**
@@ -195,10 +195,10 @@ export const replaceEffect: {
195
195
  * @category context
196
196
  */
197
197
  export const replaceScoped: {
198
- <R, E, B>(
198
+ <B, E, R>(
199
199
  that: Effect<Logger<unknown, B>, E, R>
200
200
  ): <A>(self: Logger<unknown, A>) => Layer.Layer<never, E, Exclude<R, Scope>>
201
- <A, R, E, B>(
201
+ <A, B, E, R>(
202
202
  self: Logger<unknown, A>,
203
203
  that: Effect<Logger<unknown, B>, E, R>
204
204
  ): Layer.Layer<never, E, Exclude<R, Scope>>
package/src/Match.ts CHANGED
@@ -57,7 +57,7 @@ export interface ValueMatcher<in Input, Filters, out Remaining, out Result, Prov
57
57
  readonly _result: Covariant<Result>
58
58
  }
59
59
  readonly provided: Provided
60
- readonly value: Either.Either<Remaining, Provided>
60
+ readonly value: Either.Either<Provided, Remaining>
61
61
  add<I, R, RA, A, Pr>(_case: Case): ValueMatcher<I, R, RA, A, Pr>
62
62
  }
63
63
 
@@ -526,8 +526,8 @@ export const orElseAbsurd: <I, R, RA, A, Pr>(
526
526
  */
527
527
  export const either: <I, F, R, A, Pr>(
528
528
  self: Matcher<I, F, R, A, Pr>
529
- ) => [Pr] extends [never] ? (input: I) => Either.Either<R, Unify<A>>
530
- : Either.Either<R, Unify<A>> = internal.either
529
+ ) => [Pr] extends [never] ? (input: I) => Either.Either<Unify<A>, R>
530
+ : Either.Either<Unify<A>, R> = internal.either
531
531
 
532
532
  /**
533
533
  * @category conversions
@@ -61,7 +61,7 @@ export const Await: <R, E0, Z0, E, Z>(
61
61
  * @since 2.0.0
62
62
  * @category constructors
63
63
  */
64
- export const AwaitConst: <R, E, Z>(effect: Effect.Effect<Z, E, R>) => MergeDecision<R, unknown, unknown, E, Z> =
64
+ export const AwaitConst: <Z, E, R>(effect: Effect.Effect<Z, E, R>) => MergeDecision<R, unknown, unknown, E, Z> =
65
65
  internal.AwaitConst
66
66
 
67
67
  /**
package/src/MergeState.ts CHANGED
@@ -49,8 +49,8 @@ export interface BothRunning<_Env, out Err, out Err1, _Err2, out Elem, out Done,
49
49
  extends MergeState.Proto
50
50
  {
51
51
  readonly _tag: "BothRunning"
52
- readonly left: Fiber.Fiber<Either.Either<Done, Elem>, Err>
53
- readonly right: Fiber.Fiber<Either.Either<Done1, Elem>, Err1>
52
+ readonly left: Fiber.Fiber<Either.Either<Elem, Done>, Err>
53
+ readonly right: Fiber.Fiber<Either.Either<Elem, Done1>, Err1>
54
54
  }
55
55
 
56
56
  /**
@@ -80,8 +80,8 @@ export interface RightDone<out Env, in Err, _Err1, out Err2, _Elem, in Done, _Do
80
80
  * @category constructors
81
81
  */
82
82
  export const BothRunning: <Env, Err, Err1, Err2, Elem, Done, Done1, Done2>(
83
- left: Fiber.Fiber<Either.Either<Done, Elem>, Err>,
84
- right: Fiber.Fiber<Either.Either<Done1, Elem>, Err1>
83
+ left: Fiber.Fiber<Either.Either<Elem, Done>, Err>,
84
+ right: Fiber.Fiber<Either.Either<Elem, Done1>, Err1>
85
85
  ) => MergeState<Env, Err, Err1, Err2, Elem, Done, Done1, Done2> = internal.BothRunning
86
86
 
87
87
  /**
@@ -151,8 +151,8 @@ export const match: {
151
151
  <Env, Err, Err1, Err2, Elem, Done, Done1, Done2, Z>(
152
152
  options: {
153
153
  readonly onBothRunning: (
154
- left: Fiber.Fiber<Either.Either<Done, Elem>, Err>,
155
- right: Fiber.Fiber<Either.Either<Done1, Elem>, Err1>
154
+ left: Fiber.Fiber<Either.Either<Elem, Done>, Err>,
155
+ right: Fiber.Fiber<Either.Either<Elem, Done1>, Err1>
156
156
  ) => Z
157
157
  readonly onLeftDone: (f: (exit: Exit.Exit<Done1, Err1>) => Effect.Effect<Done2, Err2, Env>) => Z
158
158
  readonly onRightDone: (f: (exit: Exit.Exit<Done, Err>) => Effect.Effect<Done2, Err2, Env>) => Z
@@ -162,8 +162,8 @@ export const match: {
162
162
  self: MergeState<Env, Err, Err1, Err2, Elem, Done, Done1, Done2>,
163
163
  options: {
164
164
  readonly onBothRunning: (
165
- left: Fiber.Fiber<Either.Either<Done, Elem>, Err>,
166
- right: Fiber.Fiber<Either.Either<Done1, Elem>, Err1>
165
+ left: Fiber.Fiber<Either.Either<Elem, Done>, Err>,
166
+ right: Fiber.Fiber<Either.Either<Elem, Done1>, Err1>
167
167
  ) => Z
168
168
  readonly onLeftDone: (f: (exit: Exit.Exit<Done1, Err1>) => Effect.Effect<Done2, Err2, Env>) => Z
169
169
  readonly onRightDone: (f: (exit: Exit.Exit<Done, Err>) => Effect.Effect<Done2, Err2, Env>) => Z
package/src/Metric.ts CHANGED
@@ -57,7 +57,7 @@ export interface Metric<in out Type, in In, out Out> extends Metric.Variance<Typ
57
57
  unsafeUpdate(input: In, extraTags: ReadonlyArray<MetricLabel.MetricLabel>): void
58
58
  unsafeValue(extraTags: ReadonlyArray<MetricLabel.MetricLabel>): Out
59
59
  register(): this
60
- <R, E, A extends In>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>
60
+ <A extends In, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>
61
61
  }
62
62
 
63
63
  /**
@@ -528,7 +528,7 @@ export const trackAll: {
528
528
  */
529
529
  export const trackDefect: {
530
530
  <Type, Out>(metric: Metric<Type, unknown, Out>): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
531
- <R, E, A, Type, Out>(self: Effect.Effect<A, E, R>, metric: Metric<Type, unknown, Out>): Effect.Effect<A, E, R>
531
+ <A, E, R, Type, Out>(self: Effect.Effect<A, E, R>, metric: Metric<Type, unknown, Out>): Effect.Effect<A, E, R>
532
532
  } = internal.trackDefect
533
533
 
534
534
  /**
@@ -544,7 +544,7 @@ export const trackDefectWith: {
544
544
  metric: Metric<Type, In, Out>,
545
545
  f: (defect: unknown) => In
546
546
  ): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
547
- <R, E, A, Type, In, Out>(
547
+ <A, E, R, Type, In, Out>(
548
548
  self: Effect.Effect<A, E, R>,
549
549
  metric: Metric<Type, In, Out>,
550
550
  f: (defect: unknown) => In
@@ -563,7 +563,7 @@ export const trackDuration: {
563
563
  <Type, Out>(
564
564
  metric: Metric<Type, Duration.Duration, Out>
565
565
  ): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
566
- <R, E, A, Type, Out>(
566
+ <A, E, R, Type, Out>(
567
567
  self: Effect.Effect<A, E, R>,
568
568
  metric: Metric<Type, Duration.Duration, Out>
569
569
  ): Effect.Effect<A, E, R>
@@ -582,7 +582,7 @@ export const trackDurationWith: {
582
582
  metric: Metric<Type, In, Out>,
583
583
  f: (duration: Duration.Duration) => In
584
584
  ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
585
- <R, E, A, Type, In, Out>(
585
+ <A, E, R, Type, In, Out>(
586
586
  self: Effect.Effect<A, E, R>,
587
587
  metric: Metric<Type, In, Out>,
588
588
  f: (duration: Duration.Duration) => In
@@ -599,8 +599,8 @@ export const trackDurationWith: {
599
599
  export const trackError: {
600
600
  <Type, In, Out>(
601
601
  metric: Metric<Type, In, Out>
602
- ): <R, E extends In, A>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
603
- <R, E extends In, A, Type, In, Out>(
602
+ ): <A, E extends In, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
603
+ <A, E extends In, R, Type, In, Out>(
604
604
  self: Effect.Effect<A, E, R>,
605
605
  metric: Metric<Type, In, Out>
606
606
  ): Effect.Effect<A, E, R>
@@ -618,8 +618,8 @@ export const trackErrorWith: {
618
618
  <Type, In, Out, In2>(
619
619
  metric: Metric<Type, In, Out>,
620
620
  f: (error: In2) => In
621
- ): <R, E extends In2, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
622
- <R, E extends In2, A, Type, In, Out, In2>(
621
+ ): <A, E extends In2, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
622
+ <A, E extends In2, R, Type, In, Out, In2>(
623
623
  self: Effect.Effect<A, E, R>,
624
624
  metric: Metric<Type, In, Out>,
625
625
  f: (error: In2) => In
@@ -636,8 +636,8 @@ export const trackErrorWith: {
636
636
  export const trackSuccess: {
637
637
  <Type, In, Out>(
638
638
  metric: Metric<Type, In, Out>
639
- ): <R, E, A extends In>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
640
- <R, E, A extends In, Type, In, Out>(
639
+ ): <A extends In, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
640
+ <A extends In, E, R, Type, In, Out>(
641
641
  self: Effect.Effect<A, E, R>,
642
642
  metric: Metric<Type, In, Out>
643
643
  ): Effect.Effect<A, E, R>
@@ -655,8 +655,8 @@ export const trackSuccessWith: {
655
655
  <Type, In, Out, In2>(
656
656
  metric: Metric<Type, In, Out>,
657
657
  f: (value: In2) => In
658
- ): <R, E, A extends In2>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
659
- <R, E, A extends In2, Type, In, Out, In2>(
658
+ ): <A extends In2, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
659
+ <A extends In2, E, R, Type, In, Out, In2>(
660
660
  self: Effect.Effect<A, E, R>,
661
661
  metric: Metric<Type, In, Out>,
662
662
  f: (value: In2) => In
@@ -70,14 +70,14 @@ export const collectAll: <R, E, Out>(
70
70
  * @category utils
71
71
  */
72
72
  export const launch: {
73
- <R2, A2>(
74
- schedule: Schedule.Schedule<R2, unknown, A2>
73
+ <A2, R2>(
74
+ schedule: Schedule.Schedule<A2, unknown, R2>
75
75
  ): <Type, In, R, E, Out>(
76
76
  self: MetricPolling<Type, In, R, E, Out>
77
- ) => Effect.Effect<Fiber.Fiber<A2, E>, never, Scope.Scope | R2 | R>
78
- <Type, In, R, E, Out, R2, A2>(
77
+ ) => Effect.Effect<Fiber.Fiber<A2, E>, never, R2 | R | Scope.Scope>
78
+ <Type, In, R, E, Out, A2, R2>(
79
79
  self: MetricPolling<Type, In, R, E, Out>,
80
- schedule: Schedule.Schedule<R2, unknown, A2>
80
+ schedule: Schedule.Schedule<A2, unknown, R2>
81
81
  ): Effect.Effect<Fiber.Fiber<A2, E>, never, Scope.Scope | R | R2>
82
82
  } = internal.launch
83
83
 
@@ -108,12 +108,12 @@ export const pollAndUpdate: <Type, In, R, E, Out>(
108
108
  * @category constructors
109
109
  */
110
110
  export const retry: {
111
- <R2, E, _>(
112
- policy: Schedule.Schedule<R2, E, _>
111
+ <X, E, R2>(
112
+ policy: Schedule.Schedule<X, E, R2>
113
113
  ): <Type, In, R, Out>(self: MetricPolling<Type, In, R, E, Out>) => MetricPolling<Type, In, R2 | R, E, Out>
114
- <Type, In, R, Out, R2, E, _>(
114
+ <Type, In, R, E, Out, X, R2>(
115
115
  self: MetricPolling<Type, In, R, E, Out>,
116
- policy: Schedule.Schedule<R2, E, _>
116
+ policy: Schedule.Schedule<X, E, R2>
117
117
  ): MetricPolling<Type, In, R | R2, E, Out>
118
118
  } = internal.retry
119
119
 
package/src/Number.ts CHANGED
@@ -467,3 +467,29 @@ export const nextPow2 = (n: number): number => {
467
467
  const nextPow = Math.ceil(Math.log(n) / Math.log(2))
468
468
  return Math.max(Math.pow(2, nextPow), 2)
469
469
  }
470
+
471
+ /**
472
+ * Tries to parse a `number` from a `string` using the `Number()` function.
473
+ * The following special string values are supported: "NaN", "Infinity", "-Infinity".
474
+ *
475
+ * @category constructors
476
+ * @since 2.0.0
477
+ */
478
+ export const parse = (s: string): Option<number> => {
479
+ if (s === "NaN") {
480
+ return option.some(NaN)
481
+ }
482
+ if (s === "Infinity") {
483
+ return option.some(Infinity)
484
+ }
485
+ if (s === "-Infinity") {
486
+ return option.some(-Infinity)
487
+ }
488
+ if (s.trim() === "") {
489
+ return option.none
490
+ }
491
+ const n = Number(s)
492
+ return Number.isNaN(n)
493
+ ? option.none
494
+ : option.some(n)
495
+ }