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
@@ -8,11 +8,11 @@ import type * as FiberId from "../../FiberId.js"
8
8
  import type { LazyArg } from "../../Function.js"
9
9
  import { constFalse, constTrue, constVoid, dual, identity, pipe } from "../../Function.js"
10
10
  import * as Option from "../../Option.js"
11
- import * as predicate from "../../Predicate.js"
12
11
  import type { Predicate, Refinement } from "../../Predicate.js"
12
+ import * as predicate from "../../Predicate.js"
13
13
  import * as RA from "../../ReadonlyArray.js"
14
14
  import type * as STM from "../../STM.js"
15
- import type { NoInfer } from "../../Types.js"
15
+ import type { MergeRecord, NoInfer } from "../../Types.js"
16
16
  import * as effectCore from "../core.js"
17
17
  import * as SingleShotGen from "../singleShotGen.js"
18
18
  import * as core from "./core.js"
@@ -21,18 +21,18 @@ import * as STMState from "./stm/stmState.js"
21
21
 
22
22
  /** @internal */
23
23
  export const acquireUseRelease = dual<
24
- <A, R2, E2, A2, R3, E3, A3>(
24
+ <A, A2, E2, R2, A3, E3, R3>(
25
25
  use: (resource: A) => STM.STM<A2, E2, R2>,
26
26
  release: (resource: A) => STM.STM<A3, E3, R3>
27
- ) => <R, E>(
27
+ ) => <E, R>(
28
28
  acquire: STM.STM<A, E, R>
29
29
  ) => Effect.Effect<A2, E | E2 | E3, R | R2 | R3>,
30
- <R, E, A, R2, E2, A2, R3, E3, A3>(
30
+ <A, E, R, A2, E2, R2, A3, E3, R3>(
31
31
  acquire: STM.STM<A, E, R>,
32
32
  use: (resource: A) => STM.STM<A2, E2, R2>,
33
33
  release: (resource: A) => STM.STM<A3, E3, R3>
34
34
  ) => Effect.Effect<A2, E | E2 | E3, R | R2 | R3>
35
- >(3, <R, E, A, R2, E2, A2, R3, E3, A3>(
35
+ >(3, <A, E, R, A2, E2, R2, A3, E3, R3>(
36
36
  acquire: STM.STM<A, E, R>,
37
37
  use: (resource: A) => STM.STM<A2, E2, R2>,
38
38
  release: (resource: A) => STM.STM<A3, E3, R3>
@@ -86,7 +86,7 @@ export const acquireUseRelease = dual<
86
86
  /** @internal */
87
87
  export const as = dual<
88
88
  <A2>(value: A2) => <A, E, R>(self: STM.STM<A, E, R>) => STM.STM<A2, E, R>,
89
- <R, E, A, A2>(self: STM.STM<A, E, R>, value: A2) => STM.STM<A2, E, R>
89
+ <A, E, R, A2>(self: STM.STM<A, E, R>, value: A2) => STM.STM<A2, E, R>
90
90
  >(2, (self, value) => pipe(self, core.map(() => value)))
91
91
 
92
92
  /** @internal */
@@ -111,16 +111,16 @@ export const attempt = <A>(evaluate: LazyArg<A>): STM.STM<A, unknown> =>
111
111
  })
112
112
 
113
113
  export const bind = dual<
114
- <N extends string, K, R2, E2, A>(
114
+ <N extends string, K, A, E2, R2>(
115
115
  tag: Exclude<N, keyof K>,
116
116
  f: (_: K) => STM.STM<A, E2, R2>
117
- ) => <R, E>(self: STM.STM<K, E, R>) => STM.STM<Effect.MergeRecord<K, { [k in N]: A }>, E | E2, R | R2>,
118
- <R, E, N extends string, K, R2, E2, A>(
117
+ ) => <E, R>(self: STM.STM<K, E, R>) => STM.STM<MergeRecord<K, { [k in N]: A }>, E | E2, R | R2>,
118
+ <K, E, R, N extends string, A, E2, R2>(
119
119
  self: STM.STM<K, E, R>,
120
120
  tag: Exclude<N, keyof K>,
121
121
  f: (_: K) => STM.STM<A, E2, R2>
122
- ) => STM.STM<Effect.MergeRecord<K, { [k in N]: A }>, E | E2, R | R2>
123
- >(3, <R, E, N extends string, K, R2, E2, A>(
122
+ ) => STM.STM<MergeRecord<K, { [k in N]: A }>, E | E2, R | R2>
123
+ >(3, <K, E, R, N extends string, A, E2, R2>(
124
124
  self: STM.STM<K, E, R>,
125
125
  tag: Exclude<N, keyof K>,
126
126
  f: (_: K) => STM.STM<A, E2, R2>
@@ -128,7 +128,7 @@ export const bind = dual<
128
128
  core.flatMap(self, (k) =>
129
129
  core.map(
130
130
  f(k),
131
- (a): Effect.MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: a } as any)
131
+ (a): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: a } as any)
132
132
  )))
133
133
 
134
134
  /* @internal */
@@ -138,7 +138,7 @@ export const bindTo = dual<
138
138
  E,
139
139
  R
140
140
  >,
141
- <R, E, A, N extends string>(
141
+ <A, E, R, N extends string>(
142
142
  self: STM.STM<A, E, R>,
143
143
  tag: N
144
144
  ) => STM.STM<
@@ -148,7 +148,7 @@ export const bindTo = dual<
148
148
  >
149
149
  >(
150
150
  2,
151
- <R, E, A, N extends string>(self: STM.STM<A, E, R>, tag: N): STM.STM<Record<N, A>, E, R> =>
151
+ <A, E, R, N extends string>(self: STM.STM<A, E, R>, tag: N): STM.STM<Record<N, A>, E, R> =>
152
152
  core.map(self, (a) => ({ [tag]: a } as Record<N, A>))
153
153
  )
154
154
 
@@ -157,38 +157,38 @@ export const let_ = dual<
157
157
  <N extends string, K, A>(
158
158
  tag: Exclude<N, keyof K>,
159
159
  f: (_: K) => A
160
- ) => <R, E>(self: STM.STM<K, E, R>) => STM.STM<
161
- Effect.MergeRecord<K, { [k in N]: A }>,
160
+ ) => <E, R>(self: STM.STM<K, E, R>) => STM.STM<
161
+ MergeRecord<K, { [k in N]: A }>,
162
162
  E,
163
163
  R
164
164
  >,
165
- <R, E, K, N extends string, A>(
165
+ <K, E, R, N extends string, A>(
166
166
  self: STM.STM<K, E, R>,
167
167
  tag: Exclude<N, keyof K>,
168
168
  f: (_: K) => A
169
169
  ) => STM.STM<
170
- Effect.MergeRecord<K, { [k in N]: A }>,
170
+ MergeRecord<K, { [k in N]: A }>,
171
171
  E,
172
172
  R
173
173
  >
174
- >(3, <R, E, K, N extends string, A>(self: STM.STM<K, E, R>, tag: Exclude<N, keyof K>, f: (_: K) => A) =>
174
+ >(3, <K, E, R, N extends string, A>(self: STM.STM<K, E, R>, tag: Exclude<N, keyof K>, f: (_: K) => A) =>
175
175
  core.map(
176
176
  self,
177
- (k): Effect.MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: f(k) } as any)
177
+ (k): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: f(k) } as any)
178
178
  ))
179
179
 
180
180
  /** @internal */
181
181
  export const catchSome = dual<
182
- <E, R2, E2, A2>(
182
+ <E, A2, E2, R2>(
183
183
  pf: (error: E) => Option.Option<STM.STM<A2, E2, R2>>
184
- ) => <R, A>(
184
+ ) => <A, R>(
185
185
  self: STM.STM<A, E, R>
186
186
  ) => STM.STM<A2 | A, E | E2, R2 | R>,
187
- <R, A, E, R2, E2, A2>(
187
+ <A, E, R, A2, E2, R2>(
188
188
  self: STM.STM<A, E, R>,
189
189
  pf: (error: E) => Option.Option<STM.STM<A2, E2, R2>>
190
190
  ) => STM.STM<A2 | A, E | E2, R2 | R>
191
- >(2, <R, A, E, R2, E2, A2>(
191
+ >(2, <A, E, R, A2, E2, R2>(
192
192
  self: STM.STM<A, E, R>,
193
193
  pf: (error: E) => Option.Option<STM.STM<A2, E2, R2>>
194
194
  ): STM.STM<A2 | A, E | E2, R2 | R> =>
@@ -197,12 +197,13 @@ export const catchSome = dual<
197
197
  (e): STM.STM<A | A2, E | E2, R | R2> => Option.getOrElse(pf(e), () => core.fail(e))
198
198
  ))
199
199
 
200
+ /** @internal */
200
201
  export const catchTag = dual<
201
- <K extends E["_tag"] & string, E extends { _tag: string }, R1, E1, A1>(
202
+ <K extends E["_tag"] & string, E extends { _tag: string }, A1, E1, R1>(
202
203
  k: K,
203
204
  f: (e: Extract<E, { _tag: K }>) => STM.STM<A1, E1, R1>
204
- ) => <R, A>(self: STM.STM<A, E, R>) => STM.STM<A | A1, Exclude<E, { _tag: K }> | E1, R | R1>,
205
- <R, E extends { _tag: string }, A, K extends E["_tag"] & string, R1, E1, A1>(
205
+ ) => <A, R>(self: STM.STM<A, E, R>) => STM.STM<A | A1, Exclude<E, { _tag: K }> | E1, R | R1>,
206
+ <A, E extends { _tag: string }, R, K extends E["_tag"] & string, A1, E1, R1>(
206
207
  self: STM.STM<A, E, R>,
207
208
  k: K,
208
209
  f: (e: Extract<E, { _tag: K }>) => STM.STM<A1, E1, R1>
@@ -224,7 +225,7 @@ export const catchTags: {
224
225
  }
225
226
  >(
226
227
  cases: Cases
227
- ): <R, A>(self: STM.STM<A, E, R>) => STM.STM<
228
+ ): <A, R>(self: STM.STM<A, E, R>) => STM.STM<
228
229
  | A
229
230
  | {
230
231
  [K in keyof Cases]: Cases[K] extends ((...args: Array<any>) => STM.STM<infer A, any, any>) ? A : never
@@ -276,8 +277,8 @@ export const check = (predicate: LazyArg<boolean>): STM.STM<void> => suspend(()
276
277
 
277
278
  /** @internal */
278
279
  export const collect = dual<
279
- <A, A2>(pf: (a: A) => Option.Option<A2>) => <R, E>(self: STM.STM<A, E, R>) => STM.STM<A2, E, R>,
280
- <R, E, A, A2>(self: STM.STM<A, E, R>, pf: (a: A) => Option.Option<A2>) => STM.STM<A2, E, R>
280
+ <A, A2>(pf: (a: A) => Option.Option<A2>) => <E, R>(self: STM.STM<A, E, R>) => STM.STM<A2, E, R>,
281
+ <A, E, R, A2>(self: STM.STM<A, E, R>, pf: (a: A) => Option.Option<A2>) => STM.STM<A2, E, R>
281
282
  >(2, (self, pf) =>
282
283
  collectSTM(
283
284
  self,
@@ -286,12 +287,12 @@ export const collect = dual<
286
287
 
287
288
  /** @internal */
288
289
  export const collectSTM = dual<
289
- <A, R2, E2, A2>(
290
+ <A, A2, E2, R2>(
290
291
  pf: (a: A) => Option.Option<STM.STM<A2, E2, R2>>
291
- ) => <R, E>(
292
+ ) => <E, R>(
292
293
  self: STM.STM<A, E, R>
293
294
  ) => STM.STM<A2, E2 | E, R2 | R>,
294
- <R, E, A, R2, E2, A2>(
295
+ <A, E, R, A2, E2, R2>(
295
296
  self: STM.STM<A, E, R>,
296
297
  pf: (a: A) => Option.Option<STM.STM<A2, E2, R2>>
297
298
  ) => STM.STM<A2, E2 | E, R2 | R>
@@ -320,7 +321,7 @@ export const cond = <A, E>(
320
321
  }
321
322
 
322
323
  /** @internal */
323
- export const either = <A, E, R>(self: STM.STM<A, E, R>): STM.STM<Either.Either<E, A>, never, R> =>
324
+ export const either = <A, E, R>(self: STM.STM<A, E, R>): STM.STM<Either.Either<A, E>, never, R> =>
324
325
  match(self, { onFailure: Either.left, onSuccess: Either.right })
325
326
 
326
327
  /** @internal */
@@ -417,12 +418,12 @@ export const filterOrDie: {
417
418
  <A, B extends A>(
418
419
  refinement: Refinement<NoInfer<A>, B>,
419
420
  defect: LazyArg<unknown>
420
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<B, E, R>
421
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<B, E, R>
421
422
  <A>(
422
423
  predicate: Predicate<NoInfer<A>>,
423
424
  defect: LazyArg<unknown>
424
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>
425
- <R, E, A, B extends A>(
425
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>
426
+ <A, E, R, B extends A>(
426
427
  self: STM.STM<A, E, R>,
427
428
  refinement: Refinement<A, B>,
428
429
  defect: LazyArg<unknown>
@@ -439,9 +440,9 @@ export const filterOrDieMessage: {
439
440
  <A, B extends A>(
440
441
  refinement: Refinement<NoInfer<A>, B>,
441
442
  message: string
442
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<B, E, R>
443
- <A>(predicate: Predicate<NoInfer<A>>, message: string): <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>
444
- <R, E, A, B extends A>(self: STM.STM<A, E, R>, refinement: Refinement<A, B>, message: string): STM.STM<B, E, R>
443
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<B, E, R>
444
+ <A>(predicate: Predicate<NoInfer<A>>, message: string): <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>
445
+ <A, E, R, B extends A>(self: STM.STM<A, E, R>, refinement: Refinement<A, B>, message: string): STM.STM<B, E, R>
445
446
  <A, E, R>(self: STM.STM<A, E, R>, predicate: Predicate<A>, message: string): STM.STM<A, E, R>
446
447
  } = dual(
447
448
  3,
@@ -451,27 +452,27 @@ export const filterOrDieMessage: {
451
452
 
452
453
  /** @internal */
453
454
  export const filterOrElse: {
454
- <A, B extends A, R2, E2, C>(
455
+ <A, B extends A, C, E2, R2>(
455
456
  refinement: Refinement<NoInfer<A>, B>,
456
457
  orElse: (a: NoInfer<A>) => STM.STM<C, E2, R2>
457
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<B | C, E2 | E, R2 | R>
458
- <A, R2, E2, B>(
458
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<B | C, E2 | E, R2 | R>
459
+ <A, B, E2, R2>(
459
460
  predicate: Predicate<NoInfer<A>>,
460
461
  orElse: (a: NoInfer<A>) => STM.STM<B, E2, R2>
461
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<A | B, E2 | E, R2 | R>
462
- <R, E, A, B extends A, R2, E2, C>(
462
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<A | B, E2 | E, R2 | R>
463
+ <A, E, R, B extends A, C, E2, R2>(
463
464
  self: STM.STM<A, E, R>,
464
465
  refinement: Refinement<A, B>,
465
466
  orElse: (a: A) => STM.STM<C, E2, R2>
466
467
  ): STM.STM<B | C, E | E2, R | R2>
467
- <R, E, A, R2, E2, B>(
468
+ <A, E, R, B, E2, R2>(
468
469
  self: STM.STM<A, E, R>,
469
470
  predicate: Predicate<A>,
470
471
  orElse: (a: A) => STM.STM<B, E2, R2>
471
472
  ): STM.STM<A | B, E | E2, R | R2>
472
473
  } = dual(
473
474
  3,
474
- <R, E, A, R2, E2, B>(
475
+ <A, E, R, B, E2, R2>(
475
476
  self: STM.STM<A, E, R>,
476
477
  predicate: Predicate<A>,
477
478
  orElse: (a: A) => STM.STM<B, E2, R2>
@@ -484,20 +485,20 @@ export const filterOrFail: {
484
485
  <A, B extends A, E2>(
485
486
  refinement: Refinement<NoInfer<A>, B>,
486
487
  orFailWith: (a: NoInfer<A>) => E2
487
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<B, E2 | E, R>
488
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<B, E2 | E, R>
488
489
  <A, E2>(
489
490
  predicate: Predicate<NoInfer<A>>,
490
491
  orFailWith: (a: NoInfer<A>) => E2
491
- ): <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E2 | E, R>
492
- <R, E, A, B extends A, E2>(
492
+ ): <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E2 | E, R>
493
+ <A, E, R, B extends A, E2>(
493
494
  self: STM.STM<A, E, R>,
494
495
  refinement: Refinement<A, B>,
495
496
  orFailWith: (a: A) => E2
496
497
  ): STM.STM<B, E | E2, R>
497
- <R, E, A, E2>(self: STM.STM<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => E2): STM.STM<A, E | E2, R>
498
+ <A, E, R, E2>(self: STM.STM<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => E2): STM.STM<A, E | E2, R>
498
499
  } = dual(
499
500
  3,
500
- <R, E, A, E2>(self: STM.STM<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => E2): STM.STM<A, E | E2, R> =>
501
+ <A, E, R, E2>(self: STM.STM<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => E2): STM.STM<A, E | E2, R> =>
501
502
  filterOrElse(
502
503
  self,
503
504
  predicate,
@@ -506,7 +507,7 @@ export const filterOrFail: {
506
507
  )
507
508
 
508
509
  /** @internal */
509
- export const flatten = <R, E, R2, E2, A>(self: STM.STM<STM.STM<A, E2, R2>, E, R>): STM.STM<A, E | E2, R | R2> =>
510
+ export const flatten = <A, E2, R2, E, R>(self: STM.STM<STM.STM<A, E2, R2>, E, R>): STM.STM<A, E | E2, R | R2> =>
510
511
  core.flatMap(self, identity)
511
512
 
512
513
  /** @internal */
@@ -515,12 +516,12 @@ export const flip = <A, E, R>(self: STM.STM<A, E, R>): STM.STM<E, A, R> =>
515
516
 
516
517
  /** @internal */
517
518
  export const flipWith = dual<
518
- <R, A, E, R2, A2, E2>(
519
+ <E, A, R, E2, A2, R2>(
519
520
  f: (stm: STM.STM<E, A, R>) => STM.STM<E2, A2, R2>
520
521
  ) => (
521
522
  self: STM.STM<A, E, R>
522
523
  ) => STM.STM<A | A2, E | E2, R | R2>,
523
- <R, A, E, R2, A2, E2>(
524
+ <A, E, R, E2, A2, R2>(
524
525
  self: STM.STM<A, E, R>,
525
526
  f: (stm: STM.STM<E, A, R>) => STM.STM<E2, A2, R2>
526
527
  ) => STM.STM<A | A2, E | E2, R | R2>
@@ -532,7 +533,7 @@ export const match = dual<
532
533
  readonly onFailure: (error: E) => A2
533
534
  readonly onSuccess: (value: A) => A3
534
535
  }) => <R>(self: STM.STM<A, E, R>) => STM.STM<A2 | A3, never, R>,
535
- <R, E, A2, A, A3>(self: STM.STM<A, E, R>, options: {
536
+ <A, E, R, A2, A3>(self: STM.STM<A, E, R>, options: {
536
537
  readonly onFailure: (error: E) => A2
537
538
  readonly onSuccess: (value: A) => A3
538
539
  }) => STM.STM<A2 | A3, never, R>
@@ -545,24 +546,24 @@ export const match = dual<
545
546
  /** @internal */
546
547
  export const forEach = dual<
547
548
  {
548
- <A, R, E, A2>(f: (a: A) => STM.STM<A2, E, R>, options?: {
549
+ <A, A2, E, R>(f: (a: A) => STM.STM<A2, E, R>, options?: {
549
550
  readonly discard?: false | undefined
550
551
  }): (elements: Iterable<A>) => STM.STM<Array<A2>, E, R>
551
- <A, R, E, A2>(f: (a: A) => STM.STM<A2, E, R>, options: {
552
+ <A, A2, E, R>(f: (a: A) => STM.STM<A2, E, R>, options: {
552
553
  readonly discard: true
553
554
  }): (elements: Iterable<A>) => STM.STM<void, E, R>
554
555
  },
555
556
  {
556
- <A, R, E, A2>(elements: Iterable<A>, f: (a: A) => STM.STM<A2, E, R>, options?: {
557
+ <A, A2, E, R>(elements: Iterable<A>, f: (a: A) => STM.STM<A2, E, R>, options?: {
557
558
  readonly discard?: false | undefined
558
559
  }): STM.STM<Array<A2>, E, R>
559
- <A, R, E, A2>(elements: Iterable<A>, f: (a: A) => STM.STM<A2, E, R>, options: {
560
+ <A, A2, E, R>(elements: Iterable<A>, f: (a: A) => STM.STM<A2, E, R>, options: {
560
561
  readonly discard: true
561
562
  }): STM.STM<void, E, R>
562
563
  }
563
564
  >(
564
565
  (args) => predicate.isIterable(args[0]),
565
- <A, R, E, A2>(iterable: Iterable<A>, f: (a: A) => STM.STM<A2, E, R>, options?: {
566
+ <A, A2, E, R>(iterable: Iterable<A>, f: (a: A) => STM.STM<A2, E, R>, options?: {
566
567
  readonly discard?: boolean | undefined
567
568
  }): STM.STM<any, E, R> => {
568
569
  if (options?.discard) {
@@ -595,7 +596,7 @@ export const forEach = dual<
595
596
  )
596
597
 
597
598
  /** @internal */
598
- export const fromEither = <E, A>(either: Either.Either<E, A>): STM.STM<A, E> => {
599
+ export const fromEither = <A, E>(either: Either.Either<A, E>): STM.STM<A, E> => {
599
600
  switch (either._tag) {
600
601
  case "Left": {
601
602
  return core.fail(either.left)
@@ -669,44 +670,44 @@ export const head = <A, E, R>(self: STM.STM<Iterable<A>, E, R>): STM.STM<A, Opti
669
670
 
670
671
  /** @internal */
671
672
  export const if_ = dual<
672
- <R1, R2, E1, E2, A, A1>(
673
+ <A, E1, R1, A2, E2, R2>(
673
674
  options: {
674
675
  readonly onTrue: STM.STM<A, E1, R1>
675
- readonly onFalse: STM.STM<A1, E2, R2>
676
+ readonly onFalse: STM.STM<A2, E2, R2>
676
677
  }
677
- ) => <R = never, E = never>(
678
+ ) => <E = never, R = never>(
678
679
  self: STM.STM<boolean, E, R> | boolean
679
- ) => STM.STM<A | A1, E1 | E2 | E, R1 | R2 | R>,
680
+ ) => STM.STM<A | A2, E1 | E2 | E, R1 | R2 | R>,
680
681
  {
681
- <R, E, R1, R2, E1, E2, A, A1>(
682
+ <A, E1, R1, A2, E2, R2, E = never, R = never>(
682
683
  self: boolean,
683
684
  options: {
684
685
  readonly onTrue: STM.STM<A, E1, R1>
685
- readonly onFalse: STM.STM<A1, E2, R2>
686
+ readonly onFalse: STM.STM<A2, E2, R2>
686
687
  }
687
- ): STM.STM<A | A1, E1 | E2 | E, R1 | R2 | R>
688
- <R, E, R1, R2, E1, E2, A, A1>(
688
+ ): STM.STM<A | A2, E1 | E2 | E, R1 | R2 | R>
689
+ <E, R, A, E1, R1, A2, E2, R2>(
689
690
  self: STM.STM<boolean, E, R>,
690
691
  options: {
691
692
  readonly onTrue: STM.STM<A, E1, R1>
692
- readonly onFalse: STM.STM<A1, E2, R2>
693
+ readonly onFalse: STM.STM<A2, E2, R2>
693
694
  }
694
- ): STM.STM<A | A1, E1 | E2 | E, R1 | R2 | R>
695
+ ): STM.STM<A | A2, E1 | E2 | E, R1 | R2 | R>
695
696
  }
696
697
  >(
697
698
  (args) => typeof args[0] === "boolean" || core.isSTM(args[0]),
698
- <R, E, R1, R2, E1, E2, A, A1>(
699
+ <E, R, A, E1, R1, A2, E2, R2>(
699
700
  self: STM.STM<boolean, E, R> | boolean,
700
701
  { onFalse, onTrue }: {
701
702
  readonly onTrue: STM.STM<A, E1, R1>
702
- readonly onFalse: STM.STM<A1, E2, R2>
703
+ readonly onFalse: STM.STM<A2, E2, R2>
703
704
  }
704
705
  ) => {
705
706
  if (typeof self === "boolean") {
706
707
  return self ? onTrue : onFalse
707
708
  }
708
709
 
709
- return core.flatMap(self, (bool): STM.STM<A | A1, E1 | E2 | E, R1 | R2 | R> => bool ? onTrue : onFalse)
710
+ return core.flatMap(self, (bool): STM.STM<A | A2, E1 | E2 | E, R1 | R2 | R> => bool ? onTrue : onFalse)
710
711
  }
711
712
  )
712
713
 
@@ -723,7 +724,7 @@ export const isSuccess = <A, E, R>(self: STM.STM<A, E, R>): STM.STM<boolean, nev
723
724
  match(self, { onFailure: constFalse, onSuccess: constTrue })
724
725
 
725
726
  /** @internal */
726
- export const iterate = <R, E, Z>(
727
+ export const iterate = <Z, E, R>(
727
728
  initial: Z,
728
729
  options: {
729
730
  readonly while: (z: Z) => boolean
@@ -731,7 +732,7 @@ export const iterate = <R, E, Z>(
731
732
  }
732
733
  ): STM.STM<Z, E, R> => iterateLoop(initial, options.while, options.body)
733
734
 
734
- const iterateLoop = <R, E, Z>(
735
+ const iterateLoop = <Z, E, R>(
735
736
  initial: Z,
736
737
  cont: (z: Z) => boolean,
737
738
  body: (z: Z) => STM.STM<Z, E, R>
@@ -747,7 +748,7 @@ const iterateLoop = <R, E, Z>(
747
748
 
748
749
  /** @internal */
749
750
  export const loop: {
750
- <Z, R, E, A>(
751
+ <Z, A, E, R>(
751
752
  initial: Z,
752
753
  options: {
753
754
  readonly while: (z: Z) => boolean
@@ -756,7 +757,7 @@ export const loop: {
756
757
  readonly discard?: false | undefined
757
758
  }
758
759
  ): STM.STM<Array<A>, E, R>
759
- <Z, R, E, A>(
760
+ <Z, A, E, R>(
760
761
  initial: Z,
761
762
  options: {
762
763
  readonly while: (z: Z) => boolean
@@ -765,7 +766,7 @@ export const loop: {
765
766
  readonly discard: true
766
767
  }
767
768
  ): STM.STM<void, E, R>
768
- } = <Z, R, E, A>(
769
+ } = <Z, A, E, R>(
769
770
  initial: Z,
770
771
  options: {
771
772
  readonly while: (z: Z) => boolean
@@ -778,7 +779,7 @@ export const loop: {
778
779
  loopDiscardLoop(initial, options.while, options.step, options.body) :
779
780
  core.map(loopLoop(initial, options.while, options.step, options.body), (a) => Array.from(a))
780
781
 
781
- const loopLoop = <Z, R, E, A>(
782
+ const loopLoop = <Z, A, E, R>(
782
783
  initial: Z,
783
784
  cont: (z: Z) => boolean,
784
785
  inc: (z: Z) => Z,
@@ -810,9 +811,9 @@ const loopDiscardLoop = <Z, R, E, X>(
810
811
 
811
812
  /** @internal */
812
813
  export const mapAttempt = dual<
813
- <A, B>(f: (a: A) => B) => <R, E>(self: STM.STM<A, E, R>) => STM.STM<B, unknown, R>,
814
- <R, E, A, B>(self: STM.STM<A, E, R>, f: (a: A) => B) => STM.STM<B, unknown, R>
815
- >(2, <R, E, A, B>(self: STM.STM<A, E, R>, f: (a: A) => B): STM.STM<B, unknown, R> =>
814
+ <A, B>(f: (a: A) => B) => <E, R>(self: STM.STM<A, E, R>) => STM.STM<B, unknown, R>,
815
+ <A, E, R, B>(self: STM.STM<A, E, R>, f: (a: A) => B) => STM.STM<B, unknown, R>
816
+ >(2, <A, E, R, B>(self: STM.STM<A, E, R>, f: (a: A) => B): STM.STM<B, unknown, R> =>
816
817
  core.matchSTM(self, {
817
818
  onFailure: (e) => core.fail(e),
818
819
  onSuccess: (a) => attempt(() => f(a))
@@ -824,7 +825,7 @@ export const mapBoth = dual<
824
825
  readonly onFailure: (error: E) => E2
825
826
  readonly onSuccess: (value: A) => A2
826
827
  }) => <R>(self: STM.STM<A, E, R>) => STM.STM<A2, E2, R>,
827
- <R, E, E2, A, A2>(self: STM.STM<A, E, R>, options: {
828
+ <A, E, R, E2, A2>(self: STM.STM<A, E, R>, options: {
828
829
  readonly onFailure: (error: E) => E2
829
830
  readonly onSuccess: (value: A) => A2
830
831
  }) => STM.STM<A2, E2, R>
@@ -836,8 +837,8 @@ export const mapBoth = dual<
836
837
 
837
838
  /** @internal */
838
839
  export const mapError = dual<
839
- <E, E2>(f: (error: E) => E2) => <R, A>(self: STM.STM<A, E, R>) => STM.STM<A, E2, R>,
840
- <R, A, E, E2>(self: STM.STM<A, E, R>, f: (error: E) => E2) => STM.STM<A, E2, R>
840
+ <E, E2>(f: (error: E) => E2) => <A, R>(self: STM.STM<A, E, R>) => STM.STM<A, E2, R>,
841
+ <A, E, R, E2>(self: STM.STM<A, E, R>, f: (error: E) => E2) => STM.STM<A, E2, R>
841
842
  >(2, (self, f) =>
842
843
  core.matchSTM(self, {
843
844
  onFailure: (e) => core.fail(f(e)),
@@ -850,11 +851,11 @@ export const merge = <A, E, R>(self: STM.STM<A, E, R>): STM.STM<E | A, never, R>
850
851
 
851
852
  /** @internal */
852
853
  export const mergeAll = dual<
853
- <A2, A>(zero: A2, f: (a2: A2, a: A) => A2) => <R, E>(iterable: Iterable<STM.STM<A, E, R>>) => STM.STM<A2, E, R>,
854
- <R, E, A2, A>(iterable: Iterable<STM.STM<A, E, R>>, zero: A2, f: (a2: A2, a: A) => A2) => STM.STM<A2, E, R>
854
+ <A2, A>(zero: A2, f: (a2: A2, a: A) => A2) => <E, R>(iterable: Iterable<STM.STM<A, E, R>>) => STM.STM<A2, E, R>,
855
+ <A, E, R, A2>(iterable: Iterable<STM.STM<A, E, R>>, zero: A2, f: (a2: A2, a: A) => A2) => STM.STM<A2, E, R>
855
856
  >(
856
857
  3,
857
- <R, E, A2, A>(iterable: Iterable<STM.STM<A, E, R>>, zero: A2, f: (a2: A2, a: A) => A2): STM.STM<A2, E, R> =>
858
+ <A, E, R, A2>(iterable: Iterable<STM.STM<A, E, R>>, zero: A2, f: (a2: A2, a: A) => A2): STM.STM<A2, E, R> =>
858
859
  suspend(() =>
859
860
  Array.from(iterable).reduce(
860
861
  (acc, curr) => pipe(acc, core.zipWith(curr, f)),
@@ -864,7 +865,7 @@ export const mergeAll = dual<
864
865
  )
865
866
 
866
867
  /** @internal */
867
- export const negate = <R, E>(self: STM.STM<boolean, E, R>): STM.STM<boolean, E, R> => pipe(self, core.map((b) => !b))
868
+ export const negate = <E, R>(self: STM.STM<boolean, E, R>): STM.STM<boolean, E, R> => pipe(self, core.map((b) => !b))
868
869
 
869
870
  /** @internal */
870
871
  export const none = <A, E, R>(self: STM.STM<Option.Option<A>, E, R>): STM.STM<void, Option.Option<E>, R> =>
@@ -885,17 +886,17 @@ export const orDie = <A, E, R>(self: STM.STM<A, E, R>): STM.STM<A, never, R> =>
885
886
 
886
887
  /** @internal */
887
888
  export const orDieWith = dual<
888
- <E>(f: (error: E) => unknown) => <R, A>(self: STM.STM<A, E, R>) => STM.STM<A, never, R>,
889
- <R, A, E>(self: STM.STM<A, E, R>, f: (error: E) => unknown) => STM.STM<A, never, R>
889
+ <E>(f: (error: E) => unknown) => <A, R>(self: STM.STM<A, E, R>) => STM.STM<A, never, R>,
890
+ <A, E, R>(self: STM.STM<A, E, R>, f: (error: E) => unknown) => STM.STM<A, never, R>
890
891
  >(2, (self, f) => pipe(self, mapError(f), core.catchAll(core.die)))
891
892
 
892
893
  /** @internal */
893
894
  export const orElse = dual<
894
- <R2, E2, A2>(that: LazyArg<STM.STM<A2, E2, R2>>) => <A, E, R>(self: STM.STM<A, E, R>) => STM.STM<A2 | A, E2, R2 | R>,
895
- <R, E, A, R2, E2, A2>(self: STM.STM<A, E, R>, that: LazyArg<STM.STM<A2, E2, R2>>) => STM.STM<A2 | A, E2, R2 | R>
895
+ <A2, E2, R2>(that: LazyArg<STM.STM<A2, E2, R2>>) => <A, E, R>(self: STM.STM<A, E, R>) => STM.STM<A2 | A, E2, R2 | R>,
896
+ <A, E, R, A2, E2, R2>(self: STM.STM<A, E, R>, that: LazyArg<STM.STM<A2, E2, R2>>) => STM.STM<A2 | A, E2, R2 | R>
896
897
  >(
897
898
  2,
898
- <R, E, A, R2, E2, A2>(self: STM.STM<A, E, R>, that: LazyArg<STM.STM<A2, E2, R2>>): STM.STM<A2 | A, E2, R2 | R> =>
899
+ <A, E, R, A2, E2, R2>(self: STM.STM<A, E, R>, that: LazyArg<STM.STM<A2, E2, R2>>): STM.STM<A2 | A, E2, R2 | R> =>
899
900
  core.flatMap(core.effect<R, LazyArg<void>>((journal) => Journal.prepareResetJournal(journal)), (reset) =>
900
901
  pipe(
901
902
  core.orTry(self, () => core.flatMap(core.sync(reset), that)),
@@ -905,48 +906,48 @@ export const orElse = dual<
905
906
 
906
907
  /** @internal */
907
908
  export const orElseEither = dual<
908
- <R2, E2, A2>(
909
+ <A2, E2, R2>(
909
910
  that: LazyArg<STM.STM<A2, E2, R2>>
910
911
  ) => <A, E, R>(
911
912
  self: STM.STM<A, E, R>
912
- ) => STM.STM<Either.Either<A, A2>, E2, R2 | R>,
913
- <R, E, A, R2, E2, A2>(
913
+ ) => STM.STM<Either.Either<A2, A>, E2, R2 | R>,
914
+ <A, E, R, A2, E2, R2>(
914
915
  self: STM.STM<A, E, R>,
915
916
  that: LazyArg<STM.STM<A2, E2, R2>>
916
- ) => STM.STM<Either.Either<A, A2>, E2, R2 | R>
917
+ ) => STM.STM<Either.Either<A2, A>, E2, R2 | R>
917
918
  >(
918
919
  2,
919
- <R, E, A, R2, E2, A2>(
920
+ <A, E, R, A2, E2, R2>(
920
921
  self: STM.STM<A, E, R>,
921
922
  that: LazyArg<STM.STM<A2, E2, R2>>
922
- ): STM.STM<Either.Either<A, A2>, E2, R2 | R> =>
923
+ ): STM.STM<Either.Either<A2, A>, E2, R2 | R> =>
923
924
  orElse(core.map(self, Either.left), () => core.map(that(), Either.right))
924
925
  )
925
926
 
926
927
  /** @internal */
927
928
  export const orElseFail = dual<
928
929
  <E2>(error: LazyArg<E2>) => <A, E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E2, R>,
929
- <R, E, A, E2>(self: STM.STM<A, E, R>, error: LazyArg<E2>) => STM.STM<A, E2, R>
930
+ <A, E, R, E2>(self: STM.STM<A, E, R>, error: LazyArg<E2>) => STM.STM<A, E2, R>
930
931
  >(
931
932
  2,
932
- <R, E, A, E2>(self: STM.STM<A, E, R>, error: LazyArg<E2>): STM.STM<A, E2, R> =>
933
+ <A, E, R, E2>(self: STM.STM<A, E, R>, error: LazyArg<E2>): STM.STM<A, E2, R> =>
933
934
  orElse(self, () => core.failSync(error))
934
935
  )
935
936
 
936
937
  /** @internal */
937
938
  export const orElseOptional = dual<
938
- <R2, E2, A2>(
939
+ <A2, E2, R2>(
939
940
  that: LazyArg<STM.STM<A2, Option.Option<E2>, R2>>
940
941
  ) => <A, E, R>(
941
942
  self: STM.STM<A, Option.Option<E>, R>
942
943
  ) => STM.STM<A2 | A, Option.Option<E2 | E>, R2 | R>,
943
- <R, E, A, R2, E2, A2>(
944
+ <A, E, R, A2, E2, R2>(
944
945
  self: STM.STM<A, Option.Option<E>, R>,
945
946
  that: LazyArg<STM.STM<A2, Option.Option<E2>, R2>>
946
947
  ) => STM.STM<A2 | A, Option.Option<E2 | E>, R2 | R>
947
948
  >(
948
949
  2,
949
- <R, E, A, R2, E2, A2>(
950
+ <A, E, R, A2, E2, R2>(
950
951
  self: STM.STM<A, Option.Option<E>, R>,
951
952
  that: LazyArg<STM.STM<A2, Option.Option<E2>, R2>>
952
953
  ): STM.STM<A2 | A, Option.Option<E2 | E>, R2 | R> =>
@@ -962,10 +963,10 @@ export const orElseOptional = dual<
962
963
  /** @internal */
963
964
  export const orElseSucceed = dual<
964
965
  <A2>(value: LazyArg<A2>) => <A, E, R>(self: STM.STM<A, E, R>) => STM.STM<A2 | A, never, R>,
965
- <R, E, A, A2>(self: STM.STM<A, E, R>, value: LazyArg<A2>) => STM.STM<A2 | A, never, R>
966
+ <A, E, R, A2>(self: STM.STM<A, E, R>, value: LazyArg<A2>) => STM.STM<A2 | A, never, R>
966
967
  >(
967
968
  2,
968
- <R, E, A, A2>(self: STM.STM<A, E, R>, value: LazyArg<A2>): STM.STM<A2 | A, never, R> =>
969
+ <A, E, R, A2>(self: STM.STM<A, E, R>, value: LazyArg<A2>): STM.STM<A2 | A, never, R> =>
969
970
  orElse(self, () => core.sync(value))
970
971
  )
971
972
 
@@ -996,7 +997,7 @@ export const provideService = dual<
996
997
  ) => <A, E, R>(
997
998
  self: STM.STM<A, E, R>
998
999
  ) => STM.STM<A, E, Exclude<R, Context.Tag.Identifier<T>>>,
999
- <R, E, A, T extends Context.Tag<any, any>>(
1000
+ <A, E, R, T extends Context.Tag<any, any>>(
1000
1001
  self: STM.STM<A, E, R>,
1001
1002
  tag: T,
1002
1003
  resource: Context.Tag.Service<T>
@@ -1005,18 +1006,18 @@ export const provideService = dual<
1005
1006
 
1006
1007
  /** @internal */
1007
1008
  export const provideServiceSTM = dual<
1008
- <T extends Context.Tag<any, any>, R1, E1>(
1009
+ <T extends Context.Tag<any, any>, E1, R1>(
1009
1010
  tag: T,
1010
1011
  stm: STM.STM<Context.Tag.Service<T>, E1, R1>
1011
1012
  ) => <A, E, R>(
1012
1013
  self: STM.STM<A, E, R>
1013
1014
  ) => STM.STM<A, E1 | E, R1 | Exclude<R, Context.Tag.Identifier<T>>>,
1014
- <R, E, A, T extends Context.Tag<any, any>, R1, E1>(
1015
+ <A, E, R, T extends Context.Tag<any, any>, E1, R1>(
1015
1016
  self: STM.STM<A, E, R>,
1016
1017
  tag: T,
1017
1018
  stm: STM.STM<Context.Tag.Service<T>, E1, R1>
1018
1019
  ) => STM.STM<A, E1 | E, R1 | Exclude<R, Context.Tag.Identifier<T>>>
1019
- >(3, <R, E, A, T extends Context.Tag<any, any>, R1, E1>(
1020
+ >(3, <A, E, R, T extends Context.Tag<any, any>, E1, R1>(
1020
1021
  self: STM.STM<A, E, R>,
1021
1022
  tag: T,
1022
1023
  stm: STM.STM<Context.Tag.Service<T>, E1, R1>
@@ -1034,8 +1035,8 @@ export const provideServiceSTM = dual<
1034
1035
 
1035
1036
  /** @internal */
1036
1037
  export const reduce = dual<
1037
- <S, A, R, E>(zero: S, f: (s: S, a: A) => STM.STM<S, E, R>) => (iterable: Iterable<A>) => STM.STM<S, E, R>,
1038
- <S, A, R, E>(iterable: Iterable<A>, zero: S, f: (s: S, a: A) => STM.STM<S, E, R>) => STM.STM<S, E, R>
1038
+ <S, A, E, R>(zero: S, f: (s: S, a: A) => STM.STM<S, E, R>) => (iterable: Iterable<A>) => STM.STM<S, E, R>,
1039
+ <S, A, E, R>(iterable: Iterable<A>, zero: S, f: (s: S, a: A) => STM.STM<S, E, R>) => STM.STM<S, E, R>
1039
1040
  >(
1040
1041
  3,
1041
1042
  <S, A, R, E>(iterable: Iterable<A>, zero: S, f: (s: S, a: A) => STM.STM<S, E, R>): STM.STM<S, E, R> =>
@@ -1049,18 +1050,18 @@ export const reduce = dual<
1049
1050
 
1050
1051
  /** @internal */
1051
1052
  export const reduceAll = dual<
1052
- <R2, E2, A>(
1053
+ <A, E2, R2>(
1053
1054
  initial: STM.STM<A, E2, R2>,
1054
1055
  f: (x: A, y: A) => A
1055
- ) => <R, E>(
1056
+ ) => <E, R>(
1056
1057
  iterable: Iterable<STM.STM<A, E, R>>
1057
1058
  ) => STM.STM<A, E2 | E, R2 | R>,
1058
- <R, E, R2, E2, A>(
1059
+ <A, E, R, E2, R2>(
1059
1060
  iterable: Iterable<STM.STM<A, E, R>>,
1060
1061
  initial: STM.STM<A, E2, R2>,
1061
1062
  f: (x: A, y: A) => A
1062
1063
  ) => STM.STM<A, E2 | E, R2 | R>
1063
- >(3, <R, E, R2, E2, A>(
1064
+ >(3, <A, E, R, E2, R2>(
1064
1065
  iterable: Iterable<STM.STM<A, E, R>>,
1065
1066
  initial: STM.STM<A, E2, R2>,
1066
1067
  f: (x: A, y: A) => A
@@ -1089,8 +1090,8 @@ export const reduceRight = dual<
1089
1090
 
1090
1091
  /** @internal */
1091
1092
  export const refineOrDie = dual<
1092
- <E, E2>(pf: (error: E) => Option.Option<E2>) => <R, A>(self: STM.STM<A, E, R>) => STM.STM<A, E2, R>,
1093
- <R, A, E, E2>(self: STM.STM<A, E, R>, pf: (error: E) => Option.Option<E2>) => STM.STM<A, E2, R>
1093
+ <E, E2>(pf: (error: E) => Option.Option<E2>) => <A, R>(self: STM.STM<A, E, R>) => STM.STM<A, E2, R>,
1094
+ <A, E, R, E2>(self: STM.STM<A, E, R>, pf: (error: E) => Option.Option<E2>) => STM.STM<A, E2, R>
1094
1095
  >(2, (self, pf) => refineOrDieWith(self, pf, identity))
1095
1096
 
1096
1097
  /** @internal */
@@ -1098,10 +1099,10 @@ export const refineOrDieWith = dual<
1098
1099
  <E, E2>(
1099
1100
  pf: (error: E) => Option.Option<E2>,
1100
1101
  f: (error: E) => unknown
1101
- ) => <R, A>(
1102
+ ) => <A, R>(
1102
1103
  self: STM.STM<A, E, R>
1103
1104
  ) => STM.STM<A, E2, R>,
1104
- <R, A, E, E2>(
1105
+ <A, E, R, E2>(
1105
1106
  self: STM.STM<A, E, R>,
1106
1107
  pf: (error: E) => Option.Option<E2>,
1107
1108
  f: (error: E) => unknown
@@ -1118,8 +1119,8 @@ export const refineOrDieWith = dual<
1118
1119
 
1119
1120
  /** @internal */
1120
1121
  export const reject = dual<
1121
- <A, E2>(pf: (a: A) => Option.Option<E2>) => <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E2 | E, R>,
1122
- <R, E, A, E2>(self: STM.STM<A, E, R>, pf: (a: A) => Option.Option<E2>) => STM.STM<A, E2 | E, R>
1122
+ <A, E2>(pf: (a: A) => Option.Option<E2>) => <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E2 | E, R>,
1123
+ <A, E, R, E2>(self: STM.STM<A, E, R>, pf: (a: A) => Option.Option<E2>) => STM.STM<A, E2 | E, R>
1123
1124
  >(2, (self, pf) =>
1124
1125
  rejectSTM(
1125
1126
  self,
@@ -1128,12 +1129,12 @@ export const reject = dual<
1128
1129
 
1129
1130
  /** @internal */
1130
1131
  export const rejectSTM = dual<
1131
- <A, R2, E2>(
1132
+ <A, E2, R2>(
1132
1133
  pf: (a: A) => Option.Option<STM.STM<E2, E2, R2>>
1133
- ) => <R, E>(
1134
+ ) => <E, R>(
1134
1135
  self: STM.STM<A, E, R>
1135
1136
  ) => STM.STM<A, E2 | E, R2 | R>,
1136
- <R, E, A, R2, E2>(
1137
+ <A, E, R, E2, R2>(
1137
1138
  self: STM.STM<A, E, R>,
1138
1139
  pf: (a: A) => Option.Option<STM.STM<E2, E2, R2>>
1139
1140
  ) => STM.STM<A, E2 | E, R2 | R>
@@ -1146,7 +1147,7 @@ export const rejectSTM = dual<
1146
1147
 
1147
1148
  /** @internal */
1148
1149
  export const repeatUntil = dual<
1149
- <A>(predicate: Predicate<A>) => <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>,
1150
+ <A>(predicate: Predicate<A>) => <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>,
1150
1151
  <A, E, R>(self: STM.STM<A, E, R>, predicate: Predicate<A>) => STM.STM<A, E, R>
1151
1152
  >(2, (self, predicate) => repeatUntilLoop(self, predicate))
1152
1153
 
@@ -1158,7 +1159,7 @@ const repeatUntilLoop = <A, E, R>(self: STM.STM<A, E, R>, predicate: Predicate<A
1158
1159
 
1159
1160
  /** @internal */
1160
1161
  export const repeatWhile = dual<
1161
- <A>(predicate: Predicate<A>) => <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>,
1162
+ <A>(predicate: Predicate<A>) => <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>,
1162
1163
  <A, E, R>(self: STM.STM<A, E, R>, predicate: Predicate<A>) => STM.STM<A, E, R>
1163
1164
  >(2, (self, predicate) => repeatWhileLoop(self, predicate))
1164
1165
 
@@ -1191,11 +1192,11 @@ export const replicateSTMDiscard = dual<
1191
1192
  /** @internal */
1192
1193
  export const retryUntil = dual<
1193
1194
  {
1194
- <A, B extends A>(refinement: Refinement<NoInfer<A>, B>): <R, E>(self: STM.STM<A, E, R>) => STM.STM<B, E, R>
1195
- <A>(predicate: Predicate<A>): <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>
1195
+ <A, B extends A>(refinement: Refinement<NoInfer<A>, B>): <E, R>(self: STM.STM<A, E, R>) => STM.STM<B, E, R>
1196
+ <A>(predicate: Predicate<A>): <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>
1196
1197
  },
1197
1198
  {
1198
- <R, E, A, B extends A>(self: STM.STM<A, E, R>, refinement: Refinement<A, B>): STM.STM<B, E, R>
1199
+ <A, E, R, B extends A>(self: STM.STM<A, E, R>, refinement: Refinement<A, B>): STM.STM<B, E, R>
1199
1200
  <A, E, R>(self: STM.STM<A, E, R>, predicate: Predicate<A>): STM.STM<A, E, R>
1200
1201
  }
1201
1202
  >(
@@ -1206,7 +1207,7 @@ export const retryUntil = dual<
1206
1207
 
1207
1208
  /** @internal */
1208
1209
  export const retryWhile = dual<
1209
- <A>(predicate: Predicate<A>) => <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>,
1210
+ <A>(predicate: Predicate<A>) => <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E, R>,
1210
1211
  <A, E, R>(self: STM.STM<A, E, R>, predicate: Predicate<A>) => STM.STM<A, E, R>
1211
1212
  >(
1212
1213
  2,
@@ -1216,12 +1217,12 @@ export const retryWhile = dual<
1216
1217
 
1217
1218
  /** @internal */
1218
1219
  export const partition = dual<
1219
- <R, E, A, A2>(
1220
+ <A, A2, E, R>(
1220
1221
  f: (a: A) => STM.STM<A2, E, R>
1221
1222
  ) => (
1222
1223
  elements: Iterable<A>
1223
1224
  ) => STM.STM<[excluded: Array<E>, satisfying: Array<A2>], never, R>,
1224
- <R, E, A, A2>(
1225
+ <A, A2, E, R>(
1225
1226
  elements: Iterable<A>,
1226
1227
  f: (a: A) => STM.STM<A2, E, R>
1227
1228
  ) => STM.STM<[excluded: Array<E>, satisfying: Array<A2>], never, R>
@@ -1275,13 +1276,13 @@ export const succeedSome = <A>(value: A): STM.STM<Option.Option<A>> => core.succ
1275
1276
 
1276
1277
  /** @internal */
1277
1278
  export const summarized = dual<
1278
- <R2, E2, A2, A3>(
1279
+ <A2, E2, R2, A3>(
1279
1280
  summary: STM.STM<A2, E2, R2>,
1280
1281
  f: (before: A2, after: A2) => A3
1281
1282
  ) => <A, E, R>(
1282
1283
  self: STM.STM<A, E, R>
1283
1284
  ) => STM.STM<[A3, A], E2 | E, R2 | R>,
1284
- <R, E, A, R2, E2, A2, A3>(
1285
+ <A, E, R, A2, E2, R2, A3>(
1285
1286
  self: STM.STM<A, E, R>,
1286
1287
  summary: STM.STM<A2, E2, R2>,
1287
1288
  f: (before: A2, after: A2) => A3
@@ -1299,17 +1300,17 @@ export const suspend = <A, E, R>(evaluate: LazyArg<STM.STM<A, E, R>>): STM.STM<A
1299
1300
 
1300
1301
  /** @internal */
1301
1302
  export const tap: {
1302
- <A, R2, E2, _>(f: (a: A) => STM.STM<_, E2, R2>): <R, E>(self: STM.STM<A, E, R>) => STM.STM<A, E2 | E, R2 | R>
1303
- <R, E, A, R2, E2, _>(self: STM.STM<A, E, R>, f: (a: A) => STM.STM<_, E2, R2>): STM.STM<A, E | E2, R | R2>
1303
+ <A, X, E2, R2>(f: (a: A) => STM.STM<X, E2, R2>): <E, R>(self: STM.STM<A, E, R>) => STM.STM<A, E2 | E, R2 | R>
1304
+ <A, E, R, X, E2, R2>(self: STM.STM<A, E, R>, f: (a: A) => STM.STM<X, E2, R2>): STM.STM<A, E | E2, R | R2>
1304
1305
  } = dual(
1305
1306
  2,
1306
- <R, E, A, R2, E2, _>(self: STM.STM<A, E, R>, f: (a: A) => STM.STM<_, E2, R2>): STM.STM<A, E | E2, R | R2> =>
1307
+ <A, E, R, X, E2, R2>(self: STM.STM<A, E, R>, f: (a: A) => STM.STM<X, E2, R2>): STM.STM<A, E | E2, R | R2> =>
1307
1308
  core.flatMap(self, (a) => as(f(a), a))
1308
1309
  )
1309
1310
 
1310
1311
  /** @internal */
1311
1312
  export const tapBoth = dual<
1312
- <E, XE extends E, R2, E2, A2, A, XA extends A, R3, E3, A3>(
1313
+ <XE extends E, A2, E2, R2, XA extends A, A3, E3, R3, A, E>(
1313
1314
  options: {
1314
1315
  readonly onFailure: (error: XE) => STM.STM<A2, E2, R2>
1315
1316
  readonly onSuccess: (value: XA) => STM.STM<A3, E3, R3>
@@ -1317,7 +1318,7 @@ export const tapBoth = dual<
1317
1318
  ) => <R>(
1318
1319
  self: STM.STM<A, E, R>
1319
1320
  ) => STM.STM<A, E | E2 | E3, R2 | R3 | R>,
1320
- <R, E, XE extends E, R2, E2, A2, A, XA extends A, R3, E3, A3>(
1321
+ <A, E, R, XE extends E, A2, E2, R2, XA extends A, A3, E3, R3>(
1321
1322
  self: STM.STM<A, E, R>,
1322
1323
  options: {
1323
1324
  readonly onFailure: (error: XE) => STM.STM<A2, E2, R2>
@@ -1332,13 +1333,13 @@ export const tapBoth = dual<
1332
1333
 
1333
1334
  /** @internal */
1334
1335
  export const tapError: {
1335
- <E, R2, E2, _>(
1336
- f: (error: NoInfer<E>) => STM.STM<_, E2, R2>
1337
- ): <R, A>(self: STM.STM<A, E, R>) => STM.STM<A, E | E2, R2 | R>
1338
- <R, A, E, R2, E2, _>(self: STM.STM<A, E, R>, f: (error: E) => STM.STM<_, E2, R2>): STM.STM<A, E | E2, R | R2>
1336
+ <E, X, E2, R2>(
1337
+ f: (error: NoInfer<E>) => STM.STM<X, E2, R2>
1338
+ ): <A, R>(self: STM.STM<A, E, R>) => STM.STM<A, E | E2, R2 | R>
1339
+ <A, E, R, X, E2, R2>(self: STM.STM<A, E, R>, f: (error: E) => STM.STM<X, E2, R2>): STM.STM<A, E | E2, R | R2>
1339
1340
  } = dual(
1340
1341
  2,
1341
- <R, A, E, R2, E2, _>(self: STM.STM<A, E, R>, f: (error: E) => STM.STM<_, E2, R2>): STM.STM<A, E | E2, R | R2> =>
1342
+ <A, E, R, X, E2, R2>(self: STM.STM<A, E, R>, f: (error: E) => STM.STM<X, E2, R2>): STM.STM<A, E | E2, R | R2> =>
1342
1343
  core.matchSTM(self, {
1343
1344
  onFailure: (e) => core.zipRight(f(e), core.fail(e)),
1344
1345
  onSuccess: core.succeed
@@ -1382,12 +1383,12 @@ export const unless = dual<
1382
1383
 
1383
1384
  /** @internal */
1384
1385
  export const unlessSTM = dual<
1385
- <R2, E2>(
1386
+ <E2, R2>(
1386
1387
  predicate: STM.STM<boolean, E2, R2>
1387
1388
  ) => <A, E, R>(
1388
1389
  self: STM.STM<A, E, R>
1389
1390
  ) => STM.STM<Option.Option<A>, E2 | E, R2 | R>,
1390
- <R, E, A, R2, E2>(
1391
+ <A, E, R, E2, R2>(
1391
1392
  self: STM.STM<A, E, R>,
1392
1393
  predicate: STM.STM<boolean, E2, R2>
1393
1394
  ) => STM.STM<Option.Option<A>, E2 | E, R2 | R>
@@ -1409,12 +1410,12 @@ export const unsome = <A, E, R>(self: STM.STM<A, Option.Option<E>, R>): STM.STM<
1409
1410
 
1410
1411
  /** @internal */
1411
1412
  export const validateAll = dual<
1412
- <R, E, A, B>(
1413
+ <A, B, E, R>(
1413
1414
  f: (a: A) => STM.STM<B, E, R>
1414
1415
  ) => (
1415
1416
  elements: Iterable<A>
1416
1417
  ) => STM.STM<Array<B>, RA.NonEmptyArray<E>, R>,
1417
- <R, E, A, B>(
1418
+ <A, B, E, R>(
1418
1419
  elements: Iterable<A>,
1419
1420
  f: (a: A) => STM.STM<B, E, R>
1420
1421
  ) => STM.STM<Array<B>, RA.NonEmptyArray<E>, R>
@@ -1429,8 +1430,8 @@ export const validateAll = dual<
1429
1430
 
1430
1431
  /** @internal */
1431
1432
  export const validateFirst = dual<
1432
- <R, E, A, B>(f: (a: A) => STM.STM<B, E, R>) => (elements: Iterable<A>) => STM.STM<B, Array<E>, R>,
1433
- <R, E, A, B>(elements: Iterable<A>, f: (a: A) => STM.STM<B, E, R>) => STM.STM<B, Array<E>, R>
1433
+ <A, B, E, R>(f: (a: A) => STM.STM<B, E, R>) => (elements: Iterable<A>) => STM.STM<B, Array<E>, R>,
1434
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A) => STM.STM<B, E, R>) => STM.STM<B, Array<E>, R>
1434
1435
  >(2, (elements, f) => flip(forEach(elements, (a) => flip(f(a)))))
1435
1436
 
1436
1437
  /** @internal */
@@ -1444,12 +1445,12 @@ export const when = dual<
1444
1445
 
1445
1446
  /** @internal */
1446
1447
  export const whenSTM = dual<
1447
- <R2, E2>(
1448
+ <E2, R2>(
1448
1449
  predicate: STM.STM<boolean, E2, R2>
1449
1450
  ) => <A, E, R>(
1450
1451
  self: STM.STM<A, E, R>
1451
1452
  ) => STM.STM<Option.Option<A>, E2 | E, R2 | R>,
1452
- <R, E, A, R2, E2>(
1453
+ <A, E, R, E2, R2>(
1453
1454
  self: STM.STM<A, E, R>,
1454
1455
  predicate: STM.STM<boolean, E2, R2>
1455
1456
  ) => STM.STM<Option.Option<A>, E2 | E, R2 | R>