effect 2.0.0-next.44 → 2.0.0-next.46

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 (779) hide show
  1. package/Bigint/dist/effect-Bigint.cjs.dev.js +125 -1
  2. package/Bigint/dist/effect-Bigint.cjs.mjs +6 -1
  3. package/Bigint/dist/effect-Bigint.cjs.prod.js +125 -1
  4. package/Bigint/dist/effect-Bigint.esm.js +111 -2
  5. package/Boolean/dist/effect-Boolean.cjs.dev.js +1 -1
  6. package/Boolean/dist/effect-Boolean.cjs.prod.js +1 -1
  7. package/Boolean/dist/effect-Boolean.esm.js +1 -1
  8. package/Brand/dist/effect-Brand.cjs.dev.js +3 -3
  9. package/Brand/dist/effect-Brand.cjs.prod.js +3 -3
  10. package/Cache/dist/effect-Cache.cjs.dev.js +32 -32
  11. package/Cache/dist/effect-Cache.cjs.prod.js +32 -32
  12. package/Cause/dist/effect-Cause.cjs.dev.js +17 -17
  13. package/Cause/dist/effect-Cause.cjs.mjs +1 -1
  14. package/Cause/dist/effect-Cause.cjs.prod.js +17 -17
  15. package/Cause/dist/effect-Cause.esm.js +4 -4
  16. package/Channel/dist/effect-Channel.cjs.dev.js +50 -50
  17. package/Channel/dist/effect-Channel.cjs.mjs +3 -3
  18. package/Channel/dist/effect-Channel.cjs.prod.js +50 -50
  19. package/Channel/dist/effect-Channel.esm.js +8 -8
  20. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.dev.js +36 -36
  21. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.prod.js +36 -36
  22. package/Chunk/dist/effect-Chunk.cjs.dev.js +3 -3
  23. package/Chunk/dist/effect-Chunk.cjs.prod.js +3 -3
  24. package/Clock/dist/effect-Clock.cjs.dev.js +16 -16
  25. package/Clock/dist/effect-Clock.cjs.prod.js +16 -16
  26. package/Config/dist/effect-Config.cjs.dev.js +11 -11
  27. package/Config/dist/effect-Config.cjs.prod.js +11 -11
  28. package/ConfigError/dist/effect-ConfigError.cjs.dev.js +4 -4
  29. package/ConfigError/dist/effect-ConfigError.cjs.prod.js +4 -4
  30. package/ConfigProvider/dist/effect-ConfigProvider.cjs.dev.js +17 -17
  31. package/ConfigProvider/dist/effect-ConfigProvider.cjs.prod.js +17 -17
  32. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.dev.js +5 -5
  33. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.prod.js +5 -5
  34. package/ConfigSecret/dist/effect-ConfigSecret.cjs.dev.js +4 -4
  35. package/ConfigSecret/dist/effect-ConfigSecret.cjs.prod.js +4 -4
  36. package/Console/dist/effect-Console.cjs.dev.js +35 -35
  37. package/Console/dist/effect-Console.cjs.prod.js +35 -35
  38. package/Context/dist/effect-Context.cjs.dev.js +3 -8
  39. package/Context/dist/effect-Context.cjs.prod.js +3 -8
  40. package/Data/dist/effect-Data.cjs.dev.js +141 -54
  41. package/Data/dist/effect-Data.cjs.mjs +2 -0
  42. package/Data/dist/effect-Data.cjs.prod.js +141 -54
  43. package/Data/dist/effect-Data.esm.js +51 -3
  44. package/DefaultServices/dist/effect-DefaultServices.cjs.dev.js +16 -16
  45. package/DefaultServices/dist/effect-DefaultServices.cjs.prod.js +16 -16
  46. package/Deferred/dist/effect-Deferred.cjs.dev.js +8 -8
  47. package/Deferred/dist/effect-Deferred.cjs.prod.js +8 -8
  48. package/Differ/dist/effect-Differ.cjs.dev.js +11 -11
  49. package/Differ/dist/effect-Differ.cjs.prod.js +11 -11
  50. package/Duration/dist/effect-Duration.cjs.dev.js +3 -3
  51. package/Duration/dist/effect-Duration.cjs.prod.js +3 -3
  52. package/Effect/dist/effect-Effect.cjs.dev.js +44 -44
  53. package/Effect/dist/effect-Effect.cjs.prod.js +44 -44
  54. package/Effectable/dist/effect-Effectable.cjs.dev.js +24 -14
  55. package/Effectable/dist/effect-Effectable.cjs.mjs +5 -4
  56. package/Effectable/dist/effect-Effectable.cjs.prod.js +24 -14
  57. package/Effectable/dist/effect-Effectable.esm.js +15 -5
  58. package/Either/dist/effect-Either.cjs.dev.js +3 -3
  59. package/Either/dist/effect-Either.cjs.prod.js +3 -3
  60. package/Encoding/dist/effect-Encoding.cjs.dev.js +3 -3
  61. package/Encoding/dist/effect-Encoding.cjs.prod.js +3 -3
  62. package/ExecutionStrategy/dist/effect-ExecutionStrategy.cjs.dev.js +2 -2
  63. package/ExecutionStrategy/dist/effect-ExecutionStrategy.cjs.prod.js +2 -2
  64. package/Exit/dist/effect-Exit.cjs.dev.js +8 -8
  65. package/Exit/dist/effect-Exit.cjs.prod.js +8 -8
  66. package/Fiber/dist/effect-Fiber.cjs.dev.js +29 -29
  67. package/Fiber/dist/effect-Fiber.cjs.prod.js +29 -29
  68. package/FiberId/dist/effect-FiberId.cjs.dev.js +5 -5
  69. package/FiberId/dist/effect-FiberId.cjs.prod.js +5 -5
  70. package/FiberRef/dist/effect-FiberRef.cjs.dev.js +29 -29
  71. package/FiberRef/dist/effect-FiberRef.cjs.prod.js +29 -29
  72. package/FiberRefs/dist/effect-FiberRefs.cjs.dev.js +9 -9
  73. package/FiberRefs/dist/effect-FiberRefs.cjs.prod.js +9 -9
  74. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.dev.js +10 -10
  75. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.prod.js +10 -10
  76. package/GroupBy/dist/effect-GroupBy.cjs.dev.js +42 -42
  77. package/GroupBy/dist/effect-GroupBy.cjs.prod.js +42 -42
  78. package/HashMap/dist/effect-HashMap.cjs.dev.js +20 -20
  79. package/HashMap/dist/effect-HashMap.cjs.prod.js +20 -20
  80. package/HashSet/dist/effect-HashSet.cjs.dev.js +20 -20
  81. package/HashSet/dist/effect-HashSet.cjs.prod.js +20 -20
  82. package/KeyedPool/dist/effect-KeyedPool.cjs.dev.js +33 -33
  83. package/KeyedPool/dist/effect-KeyedPool.cjs.prod.js +33 -33
  84. package/Layer/dist/effect-Layer.cjs.dev.js +32 -32
  85. package/Layer/dist/effect-Layer.cjs.prod.js +32 -32
  86. package/List/dist/effect-List.cjs.dev.js +3 -3
  87. package/List/dist/effect-List.cjs.prod.js +3 -3
  88. package/LogLevel/dist/effect-LogLevel.cjs.dev.js +8 -8
  89. package/LogLevel/dist/effect-LogLevel.cjs.prod.js +8 -8
  90. package/Logger/dist/effect-Logger.cjs.dev.js +33 -33
  91. package/Logger/dist/effect-Logger.cjs.prod.js +33 -33
  92. package/Metric/dist/effect-Metric.cjs.dev.js +27 -27
  93. package/Metric/dist/effect-Metric.cjs.prod.js +27 -27
  94. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.dev.js +4 -4
  95. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.prod.js +4 -4
  96. package/MetricHook/dist/effect-MetricHook.cjs.dev.js +6 -6
  97. package/MetricHook/dist/effect-MetricHook.cjs.prod.js +6 -6
  98. package/MetricKey/dist/effect-MetricKey.cjs.dev.js +6 -6
  99. package/MetricKey/dist/effect-MetricKey.cjs.prod.js +6 -6
  100. package/MetricKeyType/dist/effect-MetricKeyType.cjs.dev.js +4 -4
  101. package/MetricKeyType/dist/effect-MetricKeyType.cjs.prod.js +4 -4
  102. package/MetricPolling/dist/effect-MetricPolling.cjs.dev.js +30 -30
  103. package/MetricPolling/dist/effect-MetricPolling.cjs.prod.js +30 -30
  104. package/MetricRegistry/dist/effect-MetricRegistry.cjs.dev.js +8 -8
  105. package/MetricRegistry/dist/effect-MetricRegistry.cjs.prod.js +8 -8
  106. package/MetricState/dist/effect-MetricState.cjs.dev.js +1 -1
  107. package/MetricState/dist/effect-MetricState.cjs.prod.js +1 -1
  108. package/MutableHashMap/dist/effect-MutableHashMap.cjs.dev.js +4 -4
  109. package/MutableHashMap/dist/effect-MutableHashMap.cjs.prod.js +4 -4
  110. package/MutableHashSet/dist/effect-MutableHashSet.cjs.dev.js +4 -4
  111. package/MutableHashSet/dist/effect-MutableHashSet.cjs.prod.js +4 -4
  112. package/MutableQueue/dist/effect-MutableQueue.cjs.dev.js +3 -3
  113. package/MutableQueue/dist/effect-MutableQueue.cjs.prod.js +3 -3
  114. package/Number/dist/effect-Number.cjs.dev.js +1 -1
  115. package/Number/dist/effect-Number.cjs.prod.js +1 -1
  116. package/Number/dist/effect-Number.esm.js +1 -1
  117. package/Option/dist/effect-Option.cjs.dev.js +9 -9
  118. package/Option/dist/effect-Option.cjs.prod.js +9 -9
  119. package/Pool/dist/effect-Pool.cjs.dev.js +31 -31
  120. package/Pool/dist/effect-Pool.cjs.prod.js +31 -31
  121. package/PubSub/dist/effect-PubSub.cjs.d.mts +2 -0
  122. package/PubSub/dist/effect-PubSub.cjs.d.mts.map +1 -0
  123. package/PubSub/dist/effect-PubSub.cjs.d.ts +2 -0
  124. package/PubSub/dist/effect-PubSub.cjs.d.ts.map +1 -0
  125. package/{Hub/dist/effect-Hub.cjs.dev.js → PubSub/dist/effect-PubSub.cjs.dev.js} +163 -163
  126. package/PubSub/dist/effect-PubSub.cjs.js +7 -0
  127. package/{Hub/dist/effect-Hub.cjs.mjs → PubSub/dist/effect-PubSub.cjs.mjs} +1 -1
  128. package/{Hub/dist/effect-Hub.cjs.prod.js → PubSub/dist/effect-PubSub.cjs.prod.js} +163 -163
  129. package/{Hub/dist/effect-Hub.esm.js → PubSub/dist/effect-PubSub.esm.js} +15 -15
  130. package/PubSub/package.json +4 -0
  131. package/Queue/dist/effect-Queue.cjs.dev.js +28 -28
  132. package/Queue/dist/effect-Queue.cjs.prod.js +28 -28
  133. package/README.md +5 -5
  134. package/Random/dist/effect-Random.cjs.dev.js +16 -16
  135. package/Random/dist/effect-Random.cjs.prod.js +16 -16
  136. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.dev.js +3 -3
  137. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.prod.js +3 -3
  138. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.dev.js +3 -3
  139. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.prod.js +3 -3
  140. package/RedBlackTree/dist/effect-RedBlackTree.cjs.dev.js +4 -4
  141. package/RedBlackTree/dist/effect-RedBlackTree.cjs.prod.js +4 -4
  142. package/Ref/dist/effect-Ref.cjs.dev.js +9 -9
  143. package/Ref/dist/effect-Ref.cjs.prod.js +9 -9
  144. package/Reloadable/dist/effect-Reloadable.cjs.dev.js +44 -44
  145. package/Reloadable/dist/effect-Reloadable.cjs.prod.js +44 -44
  146. package/Request/dist/effect-Request.cjs.dev.js +29 -29
  147. package/Request/dist/effect-Request.cjs.prod.js +29 -29
  148. package/RequestBlock/dist/effect-RequestBlock.cjs.dev.js +36 -36
  149. package/RequestBlock/dist/effect-RequestBlock.cjs.prod.js +36 -36
  150. package/RequestResolver/dist/effect-RequestResolver.cjs.dev.js +38 -38
  151. package/RequestResolver/dist/effect-RequestResolver.cjs.prod.js +38 -38
  152. package/Resource/dist/effect-Resource.cjs.dev.js +34 -34
  153. package/Resource/dist/effect-Resource.cjs.prod.js +34 -34
  154. package/Runtime/dist/effect-Runtime.cjs.dev.js +34 -34
  155. package/Runtime/dist/effect-Runtime.cjs.prod.js +34 -34
  156. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.dev.js +33 -33
  157. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.prod.js +33 -33
  158. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.dev.js +6 -6
  159. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.prod.js +6 -6
  160. package/STM/dist/effect-STM.cjs.dev.js +48 -48
  161. package/STM/dist/effect-STM.cjs.prod.js +48 -48
  162. package/Schedule/dist/effect-Schedule.cjs.dev.js +19 -19
  163. package/Schedule/dist/effect-Schedule.cjs.prod.js +19 -19
  164. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.dev.js +3 -3
  165. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.prod.js +3 -3
  166. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.dev.js +3 -3
  167. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.prod.js +3 -3
  168. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.dev.js +3 -3
  169. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.prod.js +3 -3
  170. package/Scheduler/dist/effect-Scheduler.cjs.dev.js +8 -8
  171. package/Scheduler/dist/effect-Scheduler.cjs.prod.js +8 -8
  172. package/Scope/dist/effect-Scope.cjs.dev.js +27 -27
  173. package/Scope/dist/effect-Scope.cjs.prod.js +27 -27
  174. package/ScopedCache/dist/effect-ScopedCache.cjs.dev.js +78 -61
  175. package/ScopedCache/dist/effect-ScopedCache.cjs.prod.js +78 -61
  176. package/ScopedRef/dist/effect-ScopedRef.cjs.dev.js +34 -34
  177. package/ScopedRef/dist/effect-ScopedRef.cjs.prod.js +34 -34
  178. package/Sink/dist/effect-Sink.cjs.dev.js +43 -43
  179. package/Sink/dist/effect-Sink.cjs.mjs +1 -1
  180. package/Sink/dist/effect-Sink.cjs.prod.js +43 -43
  181. package/Sink/dist/effect-Sink.esm.js +5 -5
  182. package/SortedMap/dist/effect-SortedMap.cjs.dev.js +3 -3
  183. package/SortedMap/dist/effect-SortedMap.cjs.prod.js +3 -3
  184. package/SortedSet/dist/effect-SortedSet.cjs.dev.js +3 -3
  185. package/SortedSet/dist/effect-SortedSet.cjs.prod.js +3 -3
  186. package/Stream/dist/effect-Stream.cjs.dev.js +60 -60
  187. package/Stream/dist/effect-Stream.cjs.mjs +5 -5
  188. package/Stream/dist/effect-Stream.cjs.prod.js +60 -60
  189. package/Stream/dist/effect-Stream.esm.js +15 -15
  190. package/Streamable/dist/effect-Streamable.cjs.d.mts +2 -0
  191. package/Streamable/dist/effect-Streamable.cjs.d.mts.map +1 -0
  192. package/Streamable/dist/effect-Streamable.cjs.d.ts +2 -0
  193. package/Streamable/dist/effect-Streamable.cjs.d.ts.map +1 -0
  194. package/Streamable/dist/effect-Streamable.cjs.dev.js +152 -0
  195. package/Streamable/dist/effect-Streamable.cjs.js +7 -0
  196. package/Streamable/dist/effect-Streamable.cjs.mjs +3 -0
  197. package/Streamable/dist/effect-Streamable.cjs.prod.js +152 -0
  198. package/Streamable/dist/effect-Streamable.esm.js +42 -0
  199. package/Streamable/package.json +4 -0
  200. package/String/dist/effect-String.cjs.dev.js +4 -4
  201. package/String/dist/effect-String.cjs.prod.js +4 -4
  202. package/String/dist/effect-String.esm.js +1 -1
  203. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.dev.js +48 -48
  204. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.prod.js +48 -48
  205. package/Supervisor/dist/effect-Supervisor.cjs.dev.js +34 -34
  206. package/Supervisor/dist/effect-Supervisor.cjs.prod.js +34 -34
  207. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.dev.js +30 -30
  208. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.prod.js +30 -30
  209. package/TArray/dist/effect-TArray.cjs.dev.js +46 -46
  210. package/TArray/dist/effect-TArray.cjs.prod.js +46 -46
  211. package/TDeferred/dist/effect-TDeferred.cjs.dev.js +45 -45
  212. package/TDeferred/dist/effect-TDeferred.cjs.prod.js +45 -45
  213. package/TMap/dist/effect-TMap.cjs.dev.js +47 -47
  214. package/TMap/dist/effect-TMap.cjs.prod.js +47 -47
  215. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.dev.js +44 -44
  216. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.prod.js +44 -44
  217. package/TPubSub/dist/effect-TPubSub.cjs.d.mts +2 -0
  218. package/TPubSub/dist/effect-TPubSub.cjs.d.mts.map +1 -0
  219. package/TPubSub/dist/effect-TPubSub.cjs.d.ts +2 -0
  220. package/TPubSub/dist/effect-TPubSub.cjs.d.ts.map +1 -0
  221. package/{THub/dist/effect-THub.cjs.dev.js → TPubSub/dist/effect-TPubSub.cjs.dev.js} +101 -101
  222. package/TPubSub/dist/effect-TPubSub.cjs.js +7 -0
  223. package/{THub/dist/effect-THub.cjs.mjs → TPubSub/dist/effect-TPubSub.cjs.mjs} +2 -2
  224. package/{THub/dist/effect-THub.cjs.prod.js → TPubSub/dist/effect-TPubSub.cjs.prod.js} +101 -101
  225. package/TPubSub/dist/effect-TPubSub.esm.js +157 -0
  226. package/TPubSub/package.json +4 -0
  227. package/TQueue/dist/effect-TQueue.cjs.dev.js +46 -46
  228. package/TQueue/dist/effect-TQueue.cjs.prod.js +46 -46
  229. package/TRandom/dist/effect-TRandom.cjs.dev.js +50 -50
  230. package/TRandom/dist/effect-TRandom.cjs.prod.js +50 -50
  231. package/TReentrantLock/dist/effect-TReentrantLock.cjs.dev.js +46 -46
  232. package/TReentrantLock/dist/effect-TReentrantLock.cjs.prod.js +46 -46
  233. package/TRef/dist/effect-TRef.cjs.dev.js +44 -44
  234. package/TRef/dist/effect-TRef.cjs.prod.js +44 -44
  235. package/TSemaphore/dist/effect-TSemaphore.cjs.dev.js +45 -45
  236. package/TSemaphore/dist/effect-TSemaphore.cjs.prod.js +45 -45
  237. package/TSet/dist/effect-TSet.cjs.dev.js +47 -47
  238. package/TSet/dist/effect-TSet.cjs.prod.js +47 -47
  239. package/Take/dist/effect-Take.cjs.dev.js +36 -36
  240. package/Take/dist/effect-Take.cjs.prod.js +36 -36
  241. package/TestAnnotation/dist/effect-TestAnnotation.cjs.dev.js +8 -8
  242. package/TestAnnotation/dist/effect-TestAnnotation.cjs.prod.js +8 -8
  243. package/TestAnnotations/dist/effect-TestAnnotations.cjs.dev.js +25 -25
  244. package/TestAnnotations/dist/effect-TestAnnotations.cjs.prod.js +25 -25
  245. package/TestClock/dist/effect-TestClock.cjs.dev.js +46 -46
  246. package/TestClock/dist/effect-TestClock.cjs.prod.js +46 -46
  247. package/TestConfig/dist/effect-TestConfig.cjs.dev.js +3 -8
  248. package/TestConfig/dist/effect-TestConfig.cjs.prod.js +3 -8
  249. package/TestContext/dist/effect-TestContext.cjs.dev.js +37 -37
  250. package/TestContext/dist/effect-TestContext.cjs.prod.js +37 -37
  251. package/TestLive/dist/effect-TestLive.cjs.dev.js +17 -17
  252. package/TestLive/dist/effect-TestLive.cjs.prod.js +17 -17
  253. package/TestServices/dist/effect-TestServices.cjs.dev.js +42 -42
  254. package/TestServices/dist/effect-TestServices.cjs.prod.js +42 -42
  255. package/TestSized/dist/effect-TestSized.cjs.dev.js +11 -11
  256. package/TestSized/dist/effect-TestSized.cjs.prod.js +11 -11
  257. package/Tracer/dist/effect-Tracer.cjs.dev.js +16 -16
  258. package/Tracer/dist/effect-Tracer.cjs.prod.js +16 -16
  259. package/dist/{Context-01a123ac.cjs.prod.js → Context-9fe5eb16.cjs.prod.js} +5 -5
  260. package/dist/{Context-593661f6.cjs.dev.js → Context-da73ddfa.cjs.dev.js} +5 -5
  261. package/dist/{Effectable-2f022879.cjs.dev.js → Effectable-7314aed8.cjs.dev.js} +63 -10
  262. package/dist/{Effectable-cd8f3a96.cjs.prod.js → Effectable-c4c14a2b.cjs.prod.js} +63 -10
  263. package/dist/{Either-7a881c7a.cjs.prod.js → Either-d43f082c.cjs.prod.js} +6 -79
  264. package/dist/{Either-12bbe00c.cjs.dev.js → Either-fa0ef1d9.cjs.dev.js} +6 -79
  265. package/dist/{ExecutionStrategy-14d3053a.cjs.prod.js → ExecutionStrategy-4808fe5d.cjs.prod.js} +2 -2
  266. package/dist/{ExecutionStrategy-70f1a920.cjs.dev.js → ExecutionStrategy-7d9d457b.cjs.dev.js} +2 -2
  267. package/dist/{HashSet-0b4ff1e4.cjs.dev.js → HashSet-5963ad6b.cjs.dev.js} +32 -32
  268. package/dist/{HashSet-6257b66d.cjs.prod.js → HashSet-ac02a3e1.cjs.prod.js} +32 -32
  269. package/dist/Option-463b42e6.cjs.dev.js +81 -0
  270. package/dist/Option-935e5d7c.cjs.prod.js +81 -0
  271. package/dist/{Ref-a3a4e50d.cjs.prod.js → Ref-4014b526.cjs.prod.js} +1 -1
  272. package/dist/{Ref-74b592a4.cjs.dev.js → Ref-acdee7ef.cjs.dev.js} +1 -1
  273. package/dist/{cache-75fbef45.cjs.prod.js → cache-5c7d77e4.cjs.prod.js} +17 -17
  274. package/dist/{cache-e1ea3923.cjs.dev.js → cache-7eed9d33.cjs.dev.js} +17 -17
  275. package/dist/{circular-6f16b226.cjs.prod.js → circular-1f481ffb.cjs.prod.js} +33 -33
  276. package/dist/{circular-f406f9a4.cjs.prod.js → circular-9e10a5a7.cjs.prod.js} +6 -6
  277. package/dist/{circular-58ff5e9c.cjs.dev.js → circular-c2dbce1a.cjs.dev.js} +33 -33
  278. package/dist/{circular-30564534.cjs.dev.js → circular-c8b65bdb.cjs.dev.js} +6 -6
  279. package/dist/{config-80900693.cjs.dev.js → config-3b7935a3.cjs.dev.js} +3 -3
  280. package/dist/{config-d0ddc159.cjs.prod.js → config-5ba54da1.cjs.prod.js} +3 -3
  281. package/dist/{configProvider-93617d6d.cjs.prod.js → configProvider-b6b20998.cjs.prod.js} +29 -29
  282. package/dist/{configProvider-ce43fdbf.cjs.dev.js → configProvider-f34a82f1.cjs.dev.js} +29 -29
  283. package/dist/{core-0b0539de.cjs.prod.js → core-07202cc0.cjs.prod.js} +711 -726
  284. package/dist/{core-60ca562a.cjs.prod.js → core-7411d1e1.cjs.prod.js} +3 -3
  285. package/dist/{core-b4d7b4f5.cjs.dev.js → core-b7401357.cjs.dev.js} +711 -726
  286. package/dist/{core-13f8a866.cjs.dev.js → core-c5747f88.cjs.dev.js} +3 -3
  287. package/dist/{core-effect-892f3686.cjs.dev.js → core-effect-1c564d42.cjs.dev.js} +77 -75
  288. package/dist/{core-effect-c65770cd.cjs.prod.js → core-effect-9201ea63.cjs.prod.js} +77 -75
  289. package/dist/{dataSource-3ba9e4d3.cjs.dev.js → dataSource-b5eda714.cjs.dev.js} +2 -2
  290. package/dist/{dataSource-7df3a5f6.cjs.prod.js → dataSource-b83bc277.cjs.prod.js} +2 -2
  291. package/dist/declarations/src/Bigint.d.ts +92 -1
  292. package/dist/declarations/src/Bigint.d.ts.map +1 -1
  293. package/dist/declarations/src/Boolean.d.ts +1 -1
  294. package/dist/declarations/src/Cause.d.ts +6 -6
  295. package/dist/declarations/src/Cause.d.ts.map +1 -1
  296. package/dist/declarations/src/Channel.d.ts +7 -7
  297. package/dist/declarations/src/Channel.d.ts.map +1 -1
  298. package/dist/declarations/src/Data.d.ts +30 -0
  299. package/dist/declarations/src/Data.d.ts.map +1 -1
  300. package/dist/declarations/src/Effect.d.ts +4 -2
  301. package/dist/declarations/src/Effect.d.ts.map +1 -1
  302. package/dist/declarations/src/Effectable.d.ts +14 -4
  303. package/dist/declarations/src/Effectable.d.ts.map +1 -1
  304. package/dist/declarations/src/Metric.d.ts +31 -7
  305. package/dist/declarations/src/Metric.d.ts.map +1 -1
  306. package/dist/declarations/src/MetricHook.d.ts +7 -4
  307. package/dist/declarations/src/MetricHook.d.ts.map +1 -1
  308. package/dist/declarations/src/MetricKey.d.ts +24 -4
  309. package/dist/declarations/src/MetricKey.d.ts.map +1 -1
  310. package/dist/declarations/src/MetricKeyType.d.ts +9 -6
  311. package/dist/declarations/src/MetricKeyType.d.ts.map +1 -1
  312. package/dist/declarations/src/MetricRegistry.d.ts +2 -2
  313. package/dist/declarations/src/MetricRegistry.d.ts.map +1 -1
  314. package/dist/declarations/src/MetricState.d.ts +15 -9
  315. package/dist/declarations/src/MetricState.d.ts.map +1 -1
  316. package/dist/declarations/src/Number.d.ts +1 -1
  317. package/dist/declarations/src/{Hub.d.ts → PubSub.d.ts} +38 -38
  318. package/dist/declarations/src/PubSub.d.ts.map +1 -0
  319. package/dist/declarations/src/Sink.d.ts +4 -4
  320. package/dist/declarations/src/Sink.d.ts.map +1 -1
  321. package/dist/declarations/src/Stream.d.ts +24 -24
  322. package/dist/declarations/src/Stream.d.ts.map +1 -1
  323. package/dist/declarations/src/Streamable.d.ts +27 -0
  324. package/dist/declarations/src/Streamable.d.ts.map +1 -0
  325. package/dist/declarations/src/String.d.ts +1 -1
  326. package/dist/declarations/src/SubscriptionRef.d.ts.map +1 -1
  327. package/dist/declarations/src/TPubSub.d.ts +146 -0
  328. package/dist/declarations/src/TPubSub.d.ts.map +1 -0
  329. package/dist/declarations/src/index.d.ts +15 -15
  330. package/dist/declarations/src/index.d.ts.map +1 -1
  331. package/dist/{defaultServices-5530ff0e.cjs.dev.js → defaultServices-755d5b46.cjs.dev.js} +6 -6
  332. package/dist/{defaultServices-086b8ac9.cjs.prod.js → defaultServices-9d7ce86f.cjs.prod.js} +6 -6
  333. package/dist/effect.cjs.dev.js +9 -9
  334. package/dist/effect.cjs.mjs +3 -3
  335. package/dist/effect.cjs.prod.js +9 -9
  336. package/dist/effect.esm.js +6 -6
  337. package/dist/{fiber-1bfb4c1d.cjs.dev.js → fiber-5156eff2.cjs.dev.js} +12 -12
  338. package/dist/{fiber-2eb0a4c1.cjs.prod.js → fiber-9519d109.cjs.prod.js} +12 -12
  339. package/dist/{fiberRefs-be6b6a70.cjs.prod.js → fiberRefs-558c17e6.cjs.prod.js} +1 -1
  340. package/dist/{fiberRefs-be4fae6a.cjs.dev.js → fiberRefs-98b71233.cjs.dev.js} +1 -1
  341. package/dist/{fiberRuntime-2d31e120.cjs.prod.js → fiberRuntime-31ae011f.cjs.prod.js} +99 -100
  342. package/dist/{fiberRuntime-c7280769.cjs.dev.js → fiberRuntime-d3872282.cjs.dev.js} +99 -100
  343. package/dist/{groupBy-0702739b.cjs.prod.js → groupBy-724f64ef.cjs.prod.js} +4 -4
  344. package/dist/{groupBy-7f852bf3.cjs.dev.js → groupBy-862cc2da.cjs.dev.js} +4 -4
  345. package/dist/{hook-e72b20fd.cjs.dev.js → hook-8cefc909.cjs.dev.js} +8 -4
  346. package/dist/{hook-470b717e.cjs.prod.js → hook-98ce30e4.cjs.prod.js} +8 -4
  347. package/dist/{key-f0a1408a.cjs.dev.js → key-198b6670.cjs.dev.js} +3 -3
  348. package/dist/{key-378a6a2c.cjs.prod.js → key-eb8a12b2.cjs.prod.js} +3 -3
  349. package/dist/{keyType-cf67c69c.cjs.prod.js → keyType-0c5e6178.cjs.prod.js} +9 -2
  350. package/dist/{keyType-55f27f07.cjs.dev.js → keyType-7c164b82.cjs.dev.js} +9 -2
  351. package/dist/{layer-b42e8022.cjs.dev.js → layer-29574350.cjs.dev.js} +33 -33
  352. package/dist/{layer-d103b49b.cjs.prod.js → layer-51ff4846.cjs.prod.js} +33 -33
  353. package/dist/{patch-a1b2802f.cjs.dev.js → patch-0220a642.cjs.dev.js} +1 -1
  354. package/dist/{patch-c4d6c61e.cjs.prod.js → patch-7c559bb2.cjs.prod.js} +1 -1
  355. package/dist/{pathPatch-15c8d723.cjs.prod.js → pathPatch-b56a4da2.cjs.prod.js} +1 -1
  356. package/dist/{pathPatch-d9d41297.cjs.dev.js → pathPatch-fab016f1.cjs.dev.js} +1 -1
  357. package/dist/{pool-ef44ba82.cjs.dev.js → pool-3211287f.cjs.dev.js} +31 -31
  358. package/dist/{pool-e414eb88.cjs.prod.js → pool-f77d7705.cjs.prod.js} +31 -31
  359. package/dist/{query-1d0157db.cjs.prod.js → query-a52b25f0.cjs.prod.js} +11 -11
  360. package/dist/{query-54337864.cjs.dev.js → query-c36decd5.cjs.dev.js} +11 -11
  361. package/dist/{queue-27ac9d98.cjs.prod.js → queue-315ea45d.cjs.prod.js} +22 -22
  362. package/dist/{queue-533d70d4.cjs.dev.js → queue-7a223c44.cjs.dev.js} +22 -22
  363. package/dist/{registry-1099de3f.cjs.dev.js → registry-62ff192e.cjs.dev.js} +4 -4
  364. package/dist/{registry-013ecdde.cjs.prod.js → registry-d5258dff.cjs.prod.js} +4 -4
  365. package/dist/{runtime-ea174155.cjs.prod.js → runtime-005f8a9b.cjs.prod.js} +7 -7
  366. package/dist/{runtime-afad6a9b.cjs.dev.js → runtime-57c8ddf8.cjs.dev.js} +7 -7
  367. package/dist/{schedule-1d92198c.cjs.prod.js → schedule-8cdf6bf1.cjs.prod.js} +40 -40
  368. package/dist/{schedule-e0f55cab.cjs.dev.js → schedule-e7a9f93f.cjs.dev.js} +40 -40
  369. package/dist/scopedRef-789d7fef.cjs.prod.js +55 -0
  370. package/dist/scopedRef-eb19c7a6.cjs.dev.js +55 -0
  371. package/dist/{singleProducerAsyncInput-4105a342.cjs.dev.js → singleProducerAsyncInput-9ff8389b.cjs.dev.js} +1 -1
  372. package/dist/{singleProducerAsyncInput-21463e16.cjs.prod.js → singleProducerAsyncInput-f9b258b1.cjs.prod.js} +1 -1
  373. package/dist/{sink-9129504b.cjs.prod.js → sink-572d8981.cjs.prod.js} +17 -17
  374. package/dist/{sink-ee393b63.cjs.dev.js → sink-8d3427e7.cjs.dev.js} +17 -17
  375. package/dist/{state-dd1bd066.cjs.prod.js → state-0bdf02b7.cjs.prod.js} +2 -6
  376. package/dist/{state-8fbec044.cjs.dev.js → state-931050c4.cjs.dev.js} +2 -6
  377. package/dist/{stm-537da66b.cjs.dev.js → stm-8aca0022.cjs.dev.js} +3 -3
  378. package/dist/{stm-5043c3cb.cjs.prod.js → stm-f250b596.cjs.prod.js} +3 -3
  379. package/dist/{stream-c7eda5bc.cjs.dev.js → stream-34d80d2c.cjs.dev.js} +31 -28
  380. package/dist/{stream-13637643.cjs.prod.js → stream-ea4f4d44.cjs.prod.js} +31 -28
  381. package/dist/{synchronizedRef-37e32854.cjs.dev.js → synchronizedRef-a12fd967.cjs.dev.js} +6 -6
  382. package/dist/{synchronizedRef-b4cde4de.cjs.prod.js → synchronizedRef-ed8aa6ac.cjs.prod.js} +6 -6
  383. package/dist/{tArray-df1bae1c.cjs.dev.js → tArray-17f078f2.cjs.dev.js} +3 -3
  384. package/dist/{tArray-d5476a2d.cjs.prod.js → tArray-d184e22f.cjs.prod.js} +3 -3
  385. package/dist/{tMap-a3e14c05.cjs.dev.js → tMap-1a5aa78b.cjs.dev.js} +4 -4
  386. package/dist/{tMap-20ef43ea.cjs.prod.js → tMap-e219f30e.cjs.prod.js} +4 -4
  387. package/dist/{tQueue-bd3cf539.cjs.dev.js → tQueue-0a4fc773.cjs.dev.js} +3 -3
  388. package/dist/{tQueue-c02c22bd.cjs.prod.js → tQueue-47129ad0.cjs.prod.js} +3 -3
  389. package/dist/{tRef-49e44dde.cjs.prod.js → tRef-ab4c5713.cjs.prod.js} +1 -1
  390. package/dist/{tRef-75dd04b3.cjs.dev.js → tRef-b860ef05.cjs.dev.js} +1 -1
  391. package/internal/Context.esm.js +4 -4
  392. package/internal/Data.esm.js +4 -1
  393. package/internal/Differ/ChunkPatch.esm.js +1 -1
  394. package/internal/Differ/ContextPatch.esm.js +1 -1
  395. package/internal/Differ/HashMapPatch.esm.js +1 -1
  396. package/internal/Differ/HashSetPatch.esm.js +1 -1
  397. package/internal/Differ/OrPatch.esm.js +1 -1
  398. package/internal/Effectable.esm.js +9 -9
  399. package/internal/Either.esm.js +3 -3
  400. package/internal/Option.esm.js +3 -3
  401. package/internal/cache.esm.js +1 -1
  402. package/internal/cause.esm.js +6 -21
  403. package/internal/channel.esm.js +5 -5
  404. package/internal/core-effect.esm.js +6 -4
  405. package/internal/fiberRuntime.esm.js +3 -3
  406. package/internal/layer.esm.js +1 -1
  407. package/internal/metric/hook.esm.js +7 -3
  408. package/internal/metric/key.esm.js +2 -2
  409. package/internal/metric/keyType.esm.js +9 -2
  410. package/internal/metric/registry.esm.js +2 -2
  411. package/internal/metric/state.esm.js +2 -6
  412. package/internal/metric.esm.js +3 -3
  413. package/internal/{hub.esm.js → pubsub.esm.js} +108 -108
  414. package/internal/request.esm.js +1 -1
  415. package/internal/sink.esm.js +8 -8
  416. package/internal/stm/{tHub.esm.js → tPubSub.esm.js} +30 -30
  417. package/internal/stream.esm.js +23 -20
  418. package/internal/subscriptionRef.esm.js +8 -8
  419. package/package.json +66 -211
  420. package/src/.index.ts +30 -0
  421. package/src/Bigint.ts +497 -0
  422. package/src/Boolean.ts +261 -0
  423. package/src/Brand.ts +336 -0
  424. package/src/Cache.ts +250 -0
  425. package/src/Cause.ts +813 -0
  426. package/src/Channel.ts +2244 -0
  427. package/src/ChannelChildExecutorDecision.ts +138 -0
  428. package/src/ChannelMergeDecision.ts +94 -0
  429. package/src/ChannelMergeState.ts +166 -0
  430. package/src/ChannelMergeStrategy.ts +107 -0
  431. package/src/ChannelSingleProducerAsyncInput.ts +68 -0
  432. package/src/ChannelUpstreamPullRequest.ts +110 -0
  433. package/src/ChannelUpstreamPullStrategy.ts +120 -0
  434. package/src/Chunk.ts +1314 -0
  435. package/src/Clock.ts +111 -0
  436. package/src/Config.ts +447 -0
  437. package/src/ConfigError.ts +267 -0
  438. package/src/ConfigProvider.ts +296 -0
  439. package/src/ConfigProviderPathPatch.ts +100 -0
  440. package/src/ConfigSecret.ts +76 -0
  441. package/src/Console.ts +222 -0
  442. package/src/Context.ts +365 -0
  443. package/src/Data.ts +367 -0
  444. package/src/DefaultServices.ts +34 -0
  445. package/src/Deferred.ts +283 -0
  446. package/src/Differ.ts +406 -0
  447. package/src/Duration.ts +558 -0
  448. package/src/Effect.ts +5177 -0
  449. package/src/Effectable.ts +107 -0
  450. package/src/Either.ts +593 -0
  451. package/src/Encoding.ts +130 -0
  452. package/src/Equal.ts +64 -0
  453. package/src/Equivalence.ts +235 -0
  454. package/src/ExecutionStrategy.ts +111 -0
  455. package/src/Exit.ts +464 -0
  456. package/src/Fiber.ts +650 -0
  457. package/src/FiberId.ts +187 -0
  458. package/src/FiberRef.ts +399 -0
  459. package/src/FiberRefs.ts +160 -0
  460. package/src/FiberRefsPatch.ts +105 -0
  461. package/src/FiberStatus.ts +108 -0
  462. package/src/Function.ts +834 -0
  463. package/src/GlobalValue.ts +20 -0
  464. package/src/GroupBy.ts +102 -0
  465. package/src/HKT.ts +44 -0
  466. package/src/Hash.ts +162 -0
  467. package/src/HashMap.ts +373 -0
  468. package/src/HashSet.ts +300 -0
  469. package/src/Inspectable.ts +45 -0
  470. package/src/KeyedPool.ts +160 -0
  471. package/src/Layer.ts +866 -0
  472. package/src/List.ts +942 -0
  473. package/src/LogLevel.ts +266 -0
  474. package/src/LogSpan.ts +25 -0
  475. package/src/Logger.ts +321 -0
  476. package/src/Metric.ts +657 -0
  477. package/src/MetricBoundaries.ts +70 -0
  478. package/src/MetricHook.ts +139 -0
  479. package/src/MetricKey.ts +227 -0
  480. package/src/MetricKeyType.ts +257 -0
  481. package/src/MetricLabel.ts +47 -0
  482. package/src/MetricPair.ts +70 -0
  483. package/src/MetricPolling.ts +136 -0
  484. package/src/MetricRegistry.ts +47 -0
  485. package/src/MetricState.ts +256 -0
  486. package/src/MutableHashMap.ts +187 -0
  487. package/src/MutableHashSet.ts +118 -0
  488. package/src/MutableList.ts +289 -0
  489. package/src/MutableQueue.ts +227 -0
  490. package/src/MutableRef.ts +204 -0
  491. package/src/NonEmptyIterable.ts +30 -0
  492. package/src/Number.ts +406 -0
  493. package/src/Option.ts +1307 -0
  494. package/src/Order.ts +328 -0
  495. package/src/Ordering.ts +112 -0
  496. package/src/Pipeable.ts +318 -0
  497. package/src/Pool.ts +148 -0
  498. package/src/Predicate.ts +704 -0
  499. package/src/PubSub.ts +175 -0
  500. package/src/Queue.ts +575 -0
  501. package/src/Random.ts +115 -0
  502. package/src/ReadonlyArray.ts +2017 -0
  503. package/src/ReadonlyRecord.ts +641 -0
  504. package/src/RedBlackTree.ts +415 -0
  505. package/src/Ref.ts +159 -0
  506. package/src/Reloadable.ts +136 -0
  507. package/src/Request.ts +285 -0
  508. package/src/RequestBlock.ts +157 -0
  509. package/src/RequestResolver.ts +305 -0
  510. package/src/Resource.ts +97 -0
  511. package/src/Runtime.ts +216 -0
  512. package/src/RuntimeFlags.ts +336 -0
  513. package/src/RuntimeFlagsPatch.ts +183 -0
  514. package/src/STM.ts +2076 -0
  515. package/src/Schedule.ts +1396 -0
  516. package/src/ScheduleDecision.ts +62 -0
  517. package/src/ScheduleInterval.ts +151 -0
  518. package/src/ScheduleIntervals.ts +122 -0
  519. package/src/Scheduler.ts +359 -0
  520. package/src/Scope.ts +171 -0
  521. package/src/ScopedCache.ts +148 -0
  522. package/src/ScopedRef.ts +95 -0
  523. package/src/Sink.ts +1431 -0
  524. package/src/SortedMap.ts +229 -0
  525. package/src/SortedSet.ts +385 -0
  526. package/src/Stream.ts +4540 -0
  527. package/src/StreamEmit.ts +83 -0
  528. package/src/StreamHaltStrategy.ts +111 -0
  529. package/src/Streamable.ts +42 -0
  530. package/src/String.ts +682 -0
  531. package/src/Struct.ts +151 -0
  532. package/src/SubscriptionRef.ts +273 -0
  533. package/src/Supervisor.ts +239 -0
  534. package/src/Symbol.ts +28 -0
  535. package/src/SynchronizedRef.ts +249 -0
  536. package/src/TArray.ts +494 -0
  537. package/src/TDeferred.ts +99 -0
  538. package/src/TMap.ts +510 -0
  539. package/src/TPriorityQueue.ts +223 -0
  540. package/src/TPubSub.ts +187 -0
  541. package/src/TQueue.ts +431 -0
  542. package/src/TRandom.ts +129 -0
  543. package/src/TReentrantLock.ts +224 -0
  544. package/src/TRef.ts +176 -0
  545. package/src/TSemaphore.ts +129 -0
  546. package/src/TSet.ts +349 -0
  547. package/src/Take.ts +257 -0
  548. package/src/TestAnnotation.ts +166 -0
  549. package/src/TestAnnotationMap.ts +124 -0
  550. package/src/TestAnnotations.ts +113 -0
  551. package/src/TestClock.ts +552 -0
  552. package/src/TestConfig.ts +49 -0
  553. package/src/TestContext.ts +35 -0
  554. package/src/TestLive.ts +55 -0
  555. package/src/TestServices.ts +392 -0
  556. package/src/TestSized.ts +55 -0
  557. package/src/Tracer.ts +119 -0
  558. package/src/Tuple.ts +204 -0
  559. package/src/Types.ts +123 -0
  560. package/src/Unify.ts +118 -0
  561. package/src/Utils.ts +699 -0
  562. package/src/index.ts +840 -0
  563. package/src/internal/Common.ts +56 -0
  564. package/src/internal/Context.ts +252 -0
  565. package/src/internal/Data.ts +55 -0
  566. package/src/internal/Differ/ChunkPatch.ts +209 -0
  567. package/src/internal/Differ/ContextPatch.ts +229 -0
  568. package/src/internal/Differ/HashMapPatch.ts +217 -0
  569. package/src/internal/Differ/HashSetPatch.ts +174 -0
  570. package/src/internal/Differ/OrPatch.ts +296 -0
  571. package/src/internal/Differ.ts +184 -0
  572. package/src/internal/Effectable.ts +92 -0
  573. package/src/internal/Either.ts +107 -0
  574. package/src/internal/Encoding/Base64.ts +282 -0
  575. package/src/internal/Encoding/Base64Url.ts +28 -0
  576. package/src/internal/Encoding/Common.ts +24 -0
  577. package/src/internal/Encoding/Hex.ts +315 -0
  578. package/src/internal/HashMap/array.ts +49 -0
  579. package/src/internal/HashMap/bitwise.ts +32 -0
  580. package/src/internal/HashMap/config.ts +14 -0
  581. package/src/internal/HashMap/keySet.ts +8 -0
  582. package/src/internal/HashMap/node.ts +390 -0
  583. package/src/internal/HashMap.ts +533 -0
  584. package/src/internal/HashSet.ts +319 -0
  585. package/src/internal/Iterable.ts +54 -0
  586. package/src/internal/Option.ts +79 -0
  587. package/src/internal/ReadonlyArray.ts +8 -0
  588. package/src/internal/RedBlackTree/iterator.ts +207 -0
  589. package/src/internal/RedBlackTree/node.ts +48 -0
  590. package/src/internal/RedBlackTree.ts +1195 -0
  591. package/src/internal/Stack.ts +4 -0
  592. package/src/internal/blockedRequests.ts +512 -0
  593. package/src/internal/cache.ts +714 -0
  594. package/src/internal/cause.ts +1205 -0
  595. package/src/internal/channel/channelExecutor.ts +1193 -0
  596. package/src/internal/channel/channelState.ts +132 -0
  597. package/src/internal/channel/childExecutorDecision.ts +95 -0
  598. package/src/internal/channel/continuation.ts +171 -0
  599. package/src/internal/channel/mergeDecision.ts +115 -0
  600. package/src/internal/channel/mergeState.ts +120 -0
  601. package/src/internal/channel/mergeStrategy.ts +72 -0
  602. package/src/internal/channel/singleProducerAsyncInput.ts +261 -0
  603. package/src/internal/channel/subexecutor.ts +229 -0
  604. package/src/internal/channel/upstreamPullRequest.ts +83 -0
  605. package/src/internal/channel/upstreamPullStrategy.ts +86 -0
  606. package/src/internal/channel.ts +2516 -0
  607. package/src/internal/clock.ts +97 -0
  608. package/src/internal/completedRequestMap.ts +9 -0
  609. package/src/internal/concurrency.ts +83 -0
  610. package/src/internal/config.ts +598 -0
  611. package/src/internal/configError.ts +291 -0
  612. package/src/internal/configProvider/pathPatch.ts +97 -0
  613. package/src/internal/configProvider.ts +692 -0
  614. package/src/internal/configSecret.ts +71 -0
  615. package/src/internal/console.ts +136 -0
  616. package/src/internal/core-effect.ts +2146 -0
  617. package/src/internal/core-stream.ts +999 -0
  618. package/src/internal/core.ts +2765 -0
  619. package/src/internal/dataSource.ts +258 -0
  620. package/src/internal/defaultServices/console.ts +97 -0
  621. package/src/internal/defaultServices.ts +140 -0
  622. package/src/internal/deferred.ts +44 -0
  623. package/src/internal/effect/circular.ts +664 -0
  624. package/src/internal/executionStrategy.ts +72 -0
  625. package/src/internal/fiber.ts +350 -0
  626. package/src/internal/fiberId.ts +270 -0
  627. package/src/internal/fiberMessage.ts +85 -0
  628. package/src/internal/fiberRefs/patch.ts +144 -0
  629. package/src/internal/fiberRefs.ts +239 -0
  630. package/src/internal/fiberRuntime.ts +3477 -0
  631. package/src/internal/fiberScope.ts +72 -0
  632. package/src/internal/fiberStatus.ts +118 -0
  633. package/src/internal/groupBy.ts +516 -0
  634. package/src/internal/keyedPool.ts +240 -0
  635. package/src/internal/layer/circular.ts +203 -0
  636. package/src/internal/layer.ts +1230 -0
  637. package/src/internal/logSpan.ts +15 -0
  638. package/src/internal/logger-circular.ts +24 -0
  639. package/src/internal/logger.ts +307 -0
  640. package/src/internal/metric/boundaries.ts +72 -0
  641. package/src/internal/metric/hook.ts +459 -0
  642. package/src/internal/metric/key.ts +173 -0
  643. package/src/internal/metric/keyType.ts +263 -0
  644. package/src/internal/metric/label.ts +44 -0
  645. package/src/internal/metric/pair.ts +48 -0
  646. package/src/internal/metric/polling.ts +143 -0
  647. package/src/internal/metric/registry.ts +188 -0
  648. package/src/internal/metric/state.ts +286 -0
  649. package/src/internal/metric.ts +522 -0
  650. package/src/internal/opCodes/cause.ts +35 -0
  651. package/src/internal/opCodes/channel.ts +83 -0
  652. package/src/internal/opCodes/channelChildExecutorDecision.ts +17 -0
  653. package/src/internal/opCodes/channelMergeDecision.ts +11 -0
  654. package/src/internal/opCodes/channelMergeState.ts +17 -0
  655. package/src/internal/opCodes/channelMergeStrategy.ts +11 -0
  656. package/src/internal/opCodes/channelState.ts +23 -0
  657. package/src/internal/opCodes/channelUpstreamPullRequest.ts +11 -0
  658. package/src/internal/opCodes/channelUpstreamPullStrategy.ts +11 -0
  659. package/src/internal/opCodes/config.ts +65 -0
  660. package/src/internal/opCodes/configError.ts +35 -0
  661. package/src/internal/opCodes/continuation.ts +11 -0
  662. package/src/internal/opCodes/deferred.ts +11 -0
  663. package/src/internal/opCodes/effect.ts +83 -0
  664. package/src/internal/opCodes/layer.ts +53 -0
  665. package/src/internal/opCodes/streamHaltStrategy.ts +23 -0
  666. package/src/internal/pool.ts +499 -0
  667. package/src/internal/pubsub.ts +1557 -0
  668. package/src/internal/query.ts +199 -0
  669. package/src/internal/queue.ts +729 -0
  670. package/src/internal/random.ts +88 -0
  671. package/src/internal/ref.ts +164 -0
  672. package/src/internal/reloadable.ts +164 -0
  673. package/src/internal/request.ts +137 -0
  674. package/src/internal/resource.ts +64 -0
  675. package/src/internal/ringBuffer.ts +68 -0
  676. package/src/internal/runtime.ts +348 -0
  677. package/src/internal/runtimeFlags.ts +176 -0
  678. package/src/internal/runtimeFlagsPatch.ts +103 -0
  679. package/src/internal/schedule/decision.ts +47 -0
  680. package/src/internal/schedule/interval.ts +101 -0
  681. package/src/internal/schedule/intervals.ts +179 -0
  682. package/src/internal/schedule.ts +2096 -0
  683. package/src/internal/scopedCache.ts +634 -0
  684. package/src/internal/scopedRef.ts +133 -0
  685. package/src/internal/singleShotGen.ts +35 -0
  686. package/src/internal/sink.ts +2118 -0
  687. package/src/internal/stm/core.ts +804 -0
  688. package/src/internal/stm/opCodes/stm.ts +71 -0
  689. package/src/internal/stm/opCodes/stmState.ts +17 -0
  690. package/src/internal/stm/opCodes/strategy.ts +17 -0
  691. package/src/internal/stm/opCodes/tExit.ts +29 -0
  692. package/src/internal/stm/opCodes/tryCommit.ts +11 -0
  693. package/src/internal/stm/stm/entry.ts +59 -0
  694. package/src/internal/stm/stm/journal.ts +123 -0
  695. package/src/internal/stm/stm/opCodes/stm.ts +71 -0
  696. package/src/internal/stm/stm/opCodes/stmState.ts +17 -0
  697. package/src/internal/stm/stm/opCodes/strategy.ts +17 -0
  698. package/src/internal/stm/stm/opCodes/tExit.ts +29 -0
  699. package/src/internal/stm/stm/opCodes/tryCommit.ts +11 -0
  700. package/src/internal/stm/stm/stmState.ts +130 -0
  701. package/src/internal/stm/stm/tExit.ts +180 -0
  702. package/src/internal/stm/stm/tryCommit.ts +34 -0
  703. package/src/internal/stm/stm/txnId.ts +14 -0
  704. package/src/internal/stm/stm/versioned.ts +4 -0
  705. package/src/internal/stm/stm.ts +1491 -0
  706. package/src/internal/stm/tArray.ts +550 -0
  707. package/src/internal/stm/tDeferred.ts +79 -0
  708. package/src/internal/stm/tMap.ts +824 -0
  709. package/src/internal/stm/tPriorityQueue.ts +259 -0
  710. package/src/internal/stm/tPubSub.ts +542 -0
  711. package/src/internal/stm/tQueue.ts +400 -0
  712. package/src/internal/stm/tRandom.ts +140 -0
  713. package/src/internal/stm/tReentrantLock.ts +352 -0
  714. package/src/internal/stm/tRef.ts +190 -0
  715. package/src/internal/stm/tSemaphore.ts +113 -0
  716. package/src/internal/stm/tSet.ts +237 -0
  717. package/src/internal/stream/debounceState.ts +57 -0
  718. package/src/internal/stream/emit.ts +46 -0
  719. package/src/internal/stream/haltStrategy.ts +85 -0
  720. package/src/internal/stream/handoff.ts +185 -0
  721. package/src/internal/stream/handoffSignal.ts +59 -0
  722. package/src/internal/stream/pull.ts +35 -0
  723. package/src/internal/stream/sinkEndReason.ts +30 -0
  724. package/src/internal/stream/zipAllState.ts +88 -0
  725. package/src/internal/stream/zipChunksState.ts +56 -0
  726. package/src/internal/stream.ts +8089 -0
  727. package/src/internal/string-utils.ts +107 -0
  728. package/src/internal/subscriptionRef.ts +133 -0
  729. package/src/internal/supervisor/patch.ts +190 -0
  730. package/src/internal/supervisor.ts +301 -0
  731. package/src/internal/synchronizedRef.ts +115 -0
  732. package/src/internal/take.ts +198 -0
  733. package/src/internal/testing/sleep.ts +27 -0
  734. package/src/internal/testing/suspendedWarningData.ts +85 -0
  735. package/src/internal/testing/warningData.ts +94 -0
  736. package/src/internal/timeout.ts +23 -0
  737. package/src/internal/tracer.ts +74 -0
  738. package/Error/dist/effect-Error.cjs.d.mts +0 -2
  739. package/Error/dist/effect-Error.cjs.d.mts.map +0 -1
  740. package/Error/dist/effect-Error.cjs.d.ts +0 -2
  741. package/Error/dist/effect-Error.cjs.d.ts.map +0 -1
  742. package/Error/dist/effect-Error.cjs.dev.js +0 -140
  743. package/Error/dist/effect-Error.cjs.js +0 -7
  744. package/Error/dist/effect-Error.cjs.mjs +0 -4
  745. package/Error/dist/effect-Error.cjs.prod.js +0 -140
  746. package/Error/dist/effect-Error.esm.js +0 -47
  747. package/Error/package.json +0 -4
  748. package/Hub/dist/effect-Hub.cjs.d.mts +0 -2
  749. package/Hub/dist/effect-Hub.cjs.d.mts.map +0 -1
  750. package/Hub/dist/effect-Hub.cjs.d.ts +0 -2
  751. package/Hub/dist/effect-Hub.cjs.d.ts.map +0 -1
  752. package/Hub/dist/effect-Hub.cjs.js +0 -7
  753. package/Hub/package.json +0 -4
  754. package/THub/dist/effect-THub.cjs.d.mts +0 -2
  755. package/THub/dist/effect-THub.cjs.d.mts.map +0 -1
  756. package/THub/dist/effect-THub.cjs.d.ts +0 -2
  757. package/THub/dist/effect-THub.cjs.d.ts.map +0 -1
  758. package/THub/dist/effect-THub.cjs.js +0 -7
  759. package/THub/dist/effect-THub.esm.js +0 -157
  760. package/THub/package.json +0 -4
  761. package/dist/declarations/src/Error.d.ts +0 -37
  762. package/dist/declarations/src/Error.d.ts.map +0 -1
  763. package/dist/declarations/src/Hub.d.ts.map +0 -1
  764. package/dist/declarations/src/THub.d.ts +0 -146
  765. package/dist/declarations/src/THub.d.ts.map +0 -1
  766. package/dist/scopedRef-1c2c9acf.cjs.prod.js +0 -55
  767. package/dist/scopedRef-ab4c58b0.cjs.dev.js +0 -55
  768. /package/dist/{FiberId-e594f6e8.cjs.prod.js → FiberId-1d7ac632.cjs.prod.js} +0 -0
  769. /package/dist/{FiberId-557db880.cjs.dev.js → FiberId-d88ddce6.cjs.dev.js} +0 -0
  770. /package/dist/{RuntimeFlagsPatch-ea268c50.cjs.dev.js → RuntimeFlagsPatch-69102b03.cjs.dev.js} +0 -0
  771. /package/dist/{RuntimeFlagsPatch-e2769b87.cjs.prod.js → RuntimeFlagsPatch-866fa259.cjs.prod.js} +0 -0
  772. /package/dist/{boundaries-20cfad9d.cjs.prod.js → boundaries-9af538e3.cjs.prod.js} +0 -0
  773. /package/dist/{boundaries-3810d885.cjs.dev.js → boundaries-f212e414.cjs.dev.js} +0 -0
  774. /package/dist/{configError-33e55472.cjs.prod.js → configError-b43723af.cjs.prod.js} +0 -0
  775. /package/dist/{configError-240e9b61.cjs.dev.js → configError-d5efe9c0.cjs.dev.js} +0 -0
  776. /package/dist/{configSecret-e34c1b14.cjs.dev.js → configSecret-3e8ae336.cjs.dev.js} +0 -0
  777. /package/dist/{configSecret-d1caca55.cjs.prod.js → configSecret-e2faa181.cjs.prod.js} +0 -0
  778. /package/dist/{take-2af6e92a.cjs.prod.js → take-85daaf79.cjs.prod.js} +0 -0
  779. /package/dist/{take-df9480a8.cjs.dev.js → take-f9ef9e2e.cjs.dev.js} +0 -0
package/src/STM.ts ADDED
@@ -0,0 +1,2076 @@
1
+ /**
2
+ * @since 2.0.0
3
+ */
4
+ import * as Cause from "./Cause"
5
+ import * as Chunk from "./Chunk"
6
+ import type * as Context from "./Context"
7
+ import type * as Effect from "./Effect"
8
+ import type * as Either from "./Either"
9
+ import type * as FiberId from "./FiberId"
10
+ import type { LazyArg } from "./Function"
11
+ import type { TypeLambda } from "./HKT"
12
+ import * as core from "./internal/stm/core"
13
+ import * as stm from "./internal/stm/stm"
14
+ import type * as Option from "./Option"
15
+ import type { Pipeable } from "./Pipeable"
16
+ import type { Predicate, Refinement } from "./Predicate"
17
+ import type * as Unify from "./Unify"
18
+
19
+ /**
20
+ * @since 2.0.0
21
+ * @category symbols
22
+ */
23
+ export const STMTypeId: unique symbol = core.STMTypeId
24
+
25
+ /**
26
+ * @since 2.0.0
27
+ * @category symbols
28
+ */
29
+ export type STMTypeId = typeof STMTypeId
30
+
31
+ /**
32
+ * `STM<R, E, A>` represents an effect that can be performed transactionally,
33
+ * resulting in a failure `E` or a value `A` that may require an environment
34
+ * `R` to execute.
35
+ *
36
+ * Software Transactional Memory is a technique which allows composition of
37
+ * arbitrary atomic operations. It is the software analog of transactions in
38
+ * database systems.
39
+ *
40
+ * The API is lifted directly from the Haskell package Control.Concurrent.STM
41
+ * although the implementation does not resemble the Haskell one at all.
42
+ *
43
+ * See http://hackage.haskell.org/package/stm-2.5.0.0/docs/Control-Concurrent-STM.html
44
+ *
45
+ * STM in Haskell was introduced in:
46
+ *
47
+ * Composable memory transactions, by Tim Harris, Simon Marlow, Simon Peyton
48
+ * Jones, and Maurice Herlihy, in ACM Conference on Principles and Practice of
49
+ * Parallel Programming 2005.
50
+ *
51
+ * See https://www.microsoft.com/en-us/research/publication/composable-memory-transactions/
52
+ *
53
+ * See also:
54
+ * Lock Free Data Structures using STMs in Haskell, by Anthony Discolo, Tim
55
+ * Harris, Simon Marlow, Simon Peyton Jones, Satnam Singh) FLOPS 2006: Eighth
56
+ * International Symposium on Functional and Logic Programming, Fuji Susono,
57
+ * JAPAN, April 2006
58
+ *
59
+ * https://www.microsoft.com/en-us/research/publication/lock-free-data-structures-using-stms-in-haskell/
60
+ *
61
+ * The implemtation is based on the ZIO STM module, while JS environments have
62
+ * no race conditions from multiple threads STM provides greater benefits for
63
+ * synchronization of Fibers and transactional data-types can be quite useful.
64
+ *
65
+ * @since 2.0.0
66
+ * @category models
67
+ */
68
+ export interface STM<R, E, A> extends Effect.Effect<R, E, A>, STM.Variance<R, E, A>, Pipeable {
69
+ [Unify.typeSymbol]?: unknown
70
+ [Unify.unifySymbol]?: STMUnify<this>
71
+ [Unify.blacklistSymbol]?: STMUnifyBlacklist
72
+ }
73
+
74
+ /**
75
+ * @since 2.0.0
76
+ * @category models
77
+ */
78
+ export interface STMUnify<A extends { [Unify.typeSymbol]?: any }> extends Effect.EffectUnify<A> {
79
+ STM?: () => A[Unify.typeSymbol] extends STM<infer R0, infer E0, infer A0> | infer _ ? STM<R0, E0, A0> : never
80
+ }
81
+
82
+ /**
83
+ * @category models
84
+ * @since 2.0.0
85
+ */
86
+ export interface STMUnifyBlacklist extends Effect.EffectUnifyBlacklist {
87
+ Effect?: true
88
+ }
89
+
90
+ /**
91
+ * @category type lambdas
92
+ * @since 2.0.0
93
+ */
94
+ export interface STMTypeLambda extends TypeLambda {
95
+ readonly type: STM<this["Out2"], this["Out1"], this["Target"]>
96
+ }
97
+
98
+ /**
99
+ * @since 2.0.0
100
+ * @category models
101
+ */
102
+ declare module "./Context" {
103
+ interface Tag<Identifier, Service> extends STM<Identifier, never, Service> {}
104
+ }
105
+
106
+ /**
107
+ * @since 2.0.0
108
+ * @category models
109
+ */
110
+ declare module "./Either" {
111
+ interface Left<E, A> extends STM<never, E, A> {
112
+ readonly _tag: "Left"
113
+ }
114
+ interface Right<E, A> extends STM<never, E, A> {
115
+ readonly _tag: "Right"
116
+ }
117
+ }
118
+
119
+ /**
120
+ * @since 2.0.0
121
+ * @category models
122
+ */
123
+ declare module "./Option" {
124
+ interface None<A> extends STM<never, Cause.NoSuchElementException, A> {
125
+ readonly _tag: "None"
126
+ }
127
+ interface Some<A> extends STM<never, Cause.NoSuchElementException, A> {
128
+ readonly _tag: "Some"
129
+ }
130
+ }
131
+
132
+ /**
133
+ * @since 2.0.0
134
+ */
135
+ export declare namespace STM {
136
+ /**
137
+ * @since 2.0.0
138
+ * @category models
139
+ */
140
+ export interface Variance<R, E, A> {
141
+ readonly [STMTypeId]: {
142
+ readonly _R: (_: never) => R
143
+ readonly _E: (_: never) => E
144
+ readonly _A: (_: never) => A
145
+ }
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @category models
151
+ * @since 2.0.0
152
+ */
153
+ export interface STMGen<R, E, A> {
154
+ readonly _R: () => R
155
+ readonly _E: () => E
156
+ readonly _A: () => A
157
+ readonly value: STM<R, E, A>
158
+ [Symbol.iterator](): Generator<STMGen<R, E, A>, A>
159
+ }
160
+
161
+ /**
162
+ * Returns `true` if the provided value is an `STM`, `false` otherwise.
163
+ *
164
+ * @since 2.0.0
165
+ * @category refinements
166
+ */
167
+ export const isSTM: (u: unknown) => u is STM<unknown, unknown, unknown> = core.isSTM
168
+
169
+ /**
170
+ * Treats the specified `acquire` transaction as the acquisition of a
171
+ * resource. The `acquire` transaction will be executed interruptibly. If it
172
+ * is a success and is committed the specified `release` workflow will be
173
+ * executed uninterruptibly as soon as the `use` workflow completes execution.
174
+ *
175
+ * @since 2.0.0
176
+ * @category constructors
177
+ */
178
+ export const acquireUseRelease: {
179
+ <A, R2, E2, A2, R3, E3, A3>(
180
+ use: (resource: A) => STM<R2, E2, A2>,
181
+ release: (resource: A) => STM<R3, E3, A3>
182
+ ): <R, E>(
183
+ acquire: STM<R, E, A>
184
+ ) => Effect.Effect<R2 | R3 | R, E2 | E3 | E, A2>
185
+ <R, E, A, R2, E2, A2, R3, E3, A3>(
186
+ acquire: STM<R, E, A>,
187
+ use: (resource: A) => STM<R2, E2, A2>,
188
+ release: (resource: A) => STM<R3, E3, A3>
189
+ ): Effect.Effect<R | R2 | R3, E | E2 | E3, A2>
190
+ } = stm.acquireUseRelease
191
+
192
+ /**
193
+ * @since 2.0.0
194
+ * @category utils
195
+ */
196
+ export declare namespace All {
197
+ type STMAny = STM<any, any, any>
198
+
199
+ type ReturnTuple<T extends ReadonlyArray<STM<any, any, any>>, Discard extends boolean> = STM<
200
+ T[number] extends never ? never
201
+ : [T[number]] extends [{ [STMTypeId]: { _R: (_: never) => infer R } }] ? R
202
+ : never,
203
+ T[number] extends never ? never
204
+ : [T[number]] extends [{ [STMTypeId]: { _E: (_: never) => infer E } }] ? E
205
+ : never,
206
+ Discard extends true ? void
207
+ : T[number] extends never ? []
208
+ : { -readonly [K in keyof T]: [T[K]] extends [STM<infer _R, infer _E, infer A>] ? A : never }
209
+ > extends infer X ? X : never
210
+
211
+ type ReturnIterable<T extends Iterable<STMAny>, Discard extends boolean> = [T] extends
212
+ [Iterable<STM.Variance<infer R, infer E, infer A>>] ? STM<R, E, Discard extends true ? void : Array<A>> : never
213
+
214
+ type ReturnObject<T extends Record<string, STMAny>, Discard extends boolean> = STM<
215
+ keyof T extends never ? never
216
+ : [T[keyof T]] extends [{ [STMTypeId]: { _R: (_: never) => infer R } }] ? R
217
+ : never,
218
+ keyof T extends never ? never
219
+ : [T[keyof T]] extends [{ [STMTypeId]: { _E: (_: never) => infer E } }] ? E
220
+ : never,
221
+ Discard extends true ? void
222
+ : { -readonly [K in keyof T]: [T[K]] extends [STM.Variance<infer _R, infer _E, infer A>] ? A : never }
223
+ >
224
+
225
+ /**
226
+ * @since 2.0.0
227
+ * @category utils
228
+ */
229
+ export type Options = { readonly discard?: boolean }
230
+ type IsDiscard<A> = [Extract<A, { readonly discard: true }>] extends [never] ? false : true
231
+ type Narrow<A> = (A extends [] ? [] : never) | A
232
+
233
+ /**
234
+ * @since 2.0.0
235
+ * @category utils
236
+ */
237
+ export interface Signature {
238
+ <Arg extends ReadonlyArray<STMAny> | Iterable<STMAny> | Record<string, STMAny>, O extends Options>(
239
+ arg: Narrow<Arg>,
240
+ options?: O
241
+ ): [Arg] extends [ReadonlyArray<STMAny>] ? ReturnTuple<Arg, IsDiscard<O>>
242
+ : [Arg] extends [Iterable<STMAny>] ? ReturnIterable<Arg, IsDiscard<O>>
243
+ : [Arg] extends [Record<string, STMAny>] ? ReturnObject<Arg, IsDiscard<O>>
244
+ : never
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Runs all the provided transactional effects in sequence respecting the
250
+ * structure provided in input.
251
+ *
252
+ * Supports multiple arguments, a single argument tuple / array or record /
253
+ * struct.
254
+ *
255
+ * @since 2.0.0
256
+ * @category constructors
257
+ */
258
+ export const all: All.Signature = stm.all
259
+
260
+ /**
261
+ * Maps the success value of this effect to the specified constant value.
262
+ *
263
+ * @since 2.0.0
264
+ * @category mapping
265
+ */
266
+ export const as: {
267
+ <A2>(value: A2): <R, E, A>(self: STM<R, E, A>) => STM<R, E, A2>
268
+ <R, E, A, A2>(self: STM<R, E, A>, value: A2): STM<R, E, A2>
269
+ } = stm.as
270
+
271
+ /**
272
+ * Maps the success value of this effect to an optional value.
273
+ *
274
+ * @since 2.0.0
275
+ * @category mapping
276
+ */
277
+ export const asSome: <R, E, A>(self: STM<R, E, A>) => STM<R, E, Option.Option<A>> = stm.asSome
278
+
279
+ /**
280
+ * Maps the error value of this effect to an optional value.
281
+ *
282
+ * @since 2.0.0
283
+ * @category mapping
284
+ */
285
+ export const asSomeError: <R, E, A>(self: STM<R, E, A>) => STM<R, Option.Option<E>, A> = stm.asSomeError
286
+
287
+ /**
288
+ * This function maps the success value of an `STM` to `void`. If the original
289
+ * `STM` succeeds, the returned `STM` will also succeed. If the original `STM`
290
+ * fails, the returned `STM` will fail with the same error.
291
+ *
292
+ * @since 2.0.0
293
+ * @category mapping
294
+ */
295
+ export const asUnit: <R, E, A>(self: STM<R, E, A>) => STM<R, E, void> = stm.asUnit
296
+
297
+ /**
298
+ * Creates an `STM` value from a partial (but pure) function.
299
+ *
300
+ * @since 2.0.0
301
+ * @category constructors
302
+ */
303
+ export const attempt: <A>(evaluate: LazyArg<A>) => STM<never, unknown, A> = stm.attempt
304
+
305
+ /**
306
+ * Recovers from all errors.
307
+ *
308
+ * @since 2.0.0
309
+ * @category error handling
310
+ */
311
+ export const catchAll: {
312
+ <E, R1, E1, B>(f: (e: E) => STM<R1, E1, B>): <R, A>(self: STM<R, E, A>) => STM<R1 | R, E1, B | A>
313
+ <R, A, E, R1, E1, B>(self: STM<R, E, A>, f: (e: E) => STM<R1, E1, B>): STM<R | R1, E1, A | B>
314
+ } = core.catchAll
315
+
316
+ /**
317
+ * Recovers from some or all of the error cases.
318
+ *
319
+ * @since 2.0.0
320
+ * @category error handling
321
+ */
322
+ export const catchSome: {
323
+ <E, R2, E2, A2>(
324
+ pf: (error: E) => Option.Option<STM<R2, E2, A2>>
325
+ ): <R, A>(
326
+ self: STM<R, E, A>
327
+ ) => STM<R2 | R, E | E2, A2 | A>
328
+ <R, A, E, R2, E2, A2>(
329
+ self: STM<R, E, A>,
330
+ pf: (error: E) => Option.Option<STM<R2, E2, A2>>
331
+ ): STM<R | R2, E | E2, A | A2>
332
+ } = stm.catchSome
333
+
334
+ /**
335
+ * Recovers from the specified tagged error.
336
+ *
337
+ * @since 2.0.0
338
+ * @category error handling
339
+ */
340
+ export const catchTag: {
341
+ <K extends E["_tag"] & string, E extends { _tag: string }, R1, E1, A1>(
342
+ k: K,
343
+ f: (e: Extract<E, { _tag: K }>) => STM<R1, E1, A1>
344
+ ): <R, A>(self: STM<R, E, A>) => STM<R1 | R, E1 | Exclude<E, { _tag: K }>, A1 | A>
345
+ <R, E extends { _tag: string }, A, K extends E["_tag"] & string, R1, E1, A1>(
346
+ self: STM<R, E, A>,
347
+ k: K,
348
+ f: (e: Extract<E, { _tag: K }>) => STM<R1, E1, A1>
349
+ ): STM<R | R1, E1 | Exclude<E, { _tag: K }>, A | A1>
350
+ } = stm.catchTag
351
+
352
+ /**
353
+ * Recovers from multiple tagged errors.
354
+ *
355
+ * @since 2.0.0
356
+ * @category error handling
357
+ */
358
+ export const catchTags: {
359
+ <
360
+ E extends { _tag: string },
361
+ Cases extends { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => STM<any, any, any>) }
362
+ >(
363
+ cases: Cases
364
+ ): <R, A>(
365
+ self: STM<R, E, A>
366
+ ) => STM<
367
+ | R
368
+ | { [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => STM<infer R, any, any> ? R : never }[keyof Cases],
369
+ | Exclude<E, { _tag: keyof Cases }>
370
+ | { [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => STM<any, infer E, any> ? E : never }[keyof Cases],
371
+ | A
372
+ | { [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => STM<any, any, infer A> ? A : never }[keyof Cases]
373
+ >
374
+ <
375
+ R,
376
+ E extends { _tag: string },
377
+ A,
378
+ Cases extends { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => STM<any, any, any>) }
379
+ >(
380
+ self: STM<R, E, A>,
381
+ cases: Cases
382
+ ): STM<
383
+ | R
384
+ | { [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => STM<infer R, any, any> ? R : never }[keyof Cases],
385
+ | Exclude<E, { _tag: keyof Cases }>
386
+ | { [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => STM<any, infer E, any> ? E : never }[keyof Cases],
387
+ | A
388
+ | { [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => STM<any, any, infer A> ? A : never }[keyof Cases]
389
+ >
390
+ } = stm.catchTags
391
+
392
+ /**
393
+ * Checks the condition, and if it's true, returns unit, otherwise, retries.
394
+ *
395
+ * @since 2.0.0
396
+ * @category constructors
397
+ */
398
+ export const check: (predicate: LazyArg<boolean>) => STM<never, never, void> = stm.check
399
+
400
+ /**
401
+ * Simultaneously filters and maps the value produced by this effect.
402
+ *
403
+ * @since 2.0.0
404
+ * @category mutations
405
+ */
406
+ export const collect: {
407
+ <A, A2>(pf: (a: A) => Option.Option<A2>): <R, E>(self: STM<R, E, A>) => STM<R, E, A2>
408
+ <R, E, A, A2>(self: STM<R, E, A>, pf: (a: A) => Option.Option<A2>): STM<R, E, A2>
409
+ } = stm.collect
410
+
411
+ /**
412
+ * Simultaneously filters and maps the value produced by this effect.
413
+ *
414
+ * @since 2.0.0
415
+ * @category mutations
416
+ */
417
+ export const collectSTM: {
418
+ <A, R2, E2, A2>(pf: (a: A) => Option.Option<STM<R2, E2, A2>>): <R, E>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, A2>
419
+ <R, E, A, R2, E2, A2>(self: STM<R, E, A>, pf: (a: A) => Option.Option<STM<R2, E2, A2>>): STM<R | R2, E | E2, A2>
420
+ } = stm.collectSTM
421
+
422
+ /**
423
+ * Commits this transaction atomically.
424
+ *
425
+ * @since 2.0.0
426
+ * @category destructors
427
+ */
428
+ export const commit: <R, E, A>(self: STM<R, E, A>) => Effect.Effect<R, E, A> = core.commit
429
+
430
+ /**
431
+ * Commits this transaction atomically, regardless of whether the transaction
432
+ * is a success or a failure.
433
+ *
434
+ * @since 2.0.0
435
+ * @category destructors
436
+ */
437
+ export const commitEither: <R, E, A>(self: STM<R, E, A>) => Effect.Effect<R, E, A> = stm.commitEither
438
+
439
+ /**
440
+ * Similar to Either.cond, evaluate the predicate, return the given A as
441
+ * success if predicate returns true, and the given E as error otherwise
442
+ *
443
+ * @since 2.0.0
444
+ * @category constructors
445
+ */
446
+ export const cond: <E, A>(predicate: LazyArg<boolean>, error: LazyArg<E>, result: LazyArg<A>) => STM<never, E, A> =
447
+ stm.cond
448
+
449
+ /**
450
+ * Retrieves the environment inside an stm.
451
+ *
452
+ * @since 2.0.0
453
+ * @category constructors
454
+ */
455
+ export const context: <R>() => STM<R, never, Context.Context<R>> = core.context
456
+
457
+ /**
458
+ * Accesses the environment of the transaction to perform a transaction.
459
+ *
460
+ * @since 2.0.0
461
+ * @category constructors
462
+ */
463
+ export const contextWith: <R0, R>(f: (environment: Context.Context<R0>) => R) => STM<R0, never, R> = core.contextWith
464
+
465
+ /**
466
+ * Accesses the environment of the transaction to perform a transaction.
467
+ *
468
+ * @since 2.0.0
469
+ * @category constructors
470
+ */
471
+ export const contextWithSTM: <R0, R, E, A>(
472
+ f: (environment: Context.Context<R0>) => STM<R, E, A>
473
+ ) => STM<R0 | R, E, A> = core.contextWithSTM
474
+
475
+ /**
476
+ * Transforms the environment being provided to this effect with the specified
477
+ * function.
478
+ *
479
+ * @since 2.0.0
480
+ * @category context
481
+ */
482
+ export const mapInputContext: {
483
+ <R0, R>(f: (context: Context.Context<R0>) => Context.Context<R>): <E, A>(self: STM<R, E, A>) => STM<R0, E, A>
484
+ <E, A, R0, R>(self: STM<R, E, A>, f: (context: Context.Context<R0>) => Context.Context<R>): STM<R0, E, A>
485
+ } = core.mapInputContext
486
+
487
+ /**
488
+ * Fails the transactional effect with the specified defect.
489
+ *
490
+ * @since 2.0.0
491
+ * @category constructors
492
+ */
493
+ export const die: (defect: unknown) => STM<never, never, never> = core.die
494
+
495
+ /**
496
+ * Kills the fiber running the effect with a `Cause.RuntimeException` that
497
+ * contains the specified message.
498
+ *
499
+ * @since 2.0.0
500
+ * @category constructors
501
+ */
502
+ export const dieMessage: (message: string) => STM<never, never, never> = core.dieMessage
503
+
504
+ /**
505
+ * Fails the transactional effect with the specified lazily evaluated defect.
506
+ *
507
+ * @since 2.0.0
508
+ * @category constructors
509
+ */
510
+ export const dieSync: (evaluate: LazyArg<unknown>) => STM<never, never, never> = core.dieSync
511
+
512
+ /**
513
+ * Converts the failure channel into an `Either`.
514
+ *
515
+ * @since 2.0.0
516
+ * @category mutations
517
+ */
518
+ export const either: <R, E, A>(self: STM<R, E, A>) => STM<R, never, Either.Either<E, A>> = stm.either
519
+
520
+ /**
521
+ * Executes the specified finalization transaction whether or not this effect
522
+ * succeeds. Note that as with all STM transactions, if the full transaction
523
+ * fails, everything will be rolled back.
524
+ *
525
+ * @since 2.0.0
526
+ * @category finalization
527
+ */
528
+ export const ensuring: {
529
+ <R1, B>(finalizer: STM<R1, never, B>): <R, E, A>(self: STM<R, E, A>) => STM<R1 | R, E, A>
530
+ <R, E, A, R1, B>(self: STM<R, E, A>, finalizer: STM<R1, never, B>): STM<R | R1, E, A>
531
+ } = core.ensuring
532
+
533
+ /**
534
+ * Returns an effect that ignores errors and runs repeatedly until it
535
+ * eventually succeeds.
536
+ *
537
+ * @since 2.0.0
538
+ * @category mutations
539
+ */
540
+ export const eventually: <R, E, A>(self: STM<R, E, A>) => STM<R, E, A> = stm.eventually
541
+
542
+ /**
543
+ * Determines whether all elements of the `Iterable<A>` satisfy the effectual
544
+ * predicate.
545
+ *
546
+ * @since 2.0.0
547
+ * @category constructors
548
+ */
549
+ export const every: {
550
+ <A, R, E>(predicate: (a: A) => STM<R, E, boolean>): (iterable: Iterable<A>) => STM<R, E, boolean>
551
+ <A, R, E>(iterable: Iterable<A>, predicate: (a: A) => STM<R, E, boolean>): STM<R, E, boolean>
552
+ } = stm.every
553
+
554
+ /**
555
+ * Determines whether any element of the `Iterable[A]` satisfies the effectual
556
+ * predicate `f`.
557
+ *
558
+ * @since 2.0.0
559
+ * @category constructors
560
+ */
561
+ export const exists: {
562
+ <A, R, E>(predicate: (a: A) => STM<R, E, boolean>): (iterable: Iterable<A>) => STM<R, E, boolean>
563
+ <A, R, E>(iterable: Iterable<A>, predicate: (a: A) => STM<R, E, boolean>): STM<R, E, boolean>
564
+ } = stm.exists
565
+
566
+ /**
567
+ * Fails the transactional effect with the specified error.
568
+ *
569
+ * @since 2.0.0
570
+ * @category constructors
571
+ */
572
+ export const fail: <E>(error: E) => STM<never, E, never> = core.fail
573
+
574
+ /**
575
+ * Fails the transactional effect with the specified lazily evaluated error.
576
+ *
577
+ * @since 2.0.0
578
+ * @category constructors
579
+ */
580
+ export const failSync: <E>(evaluate: LazyArg<E>) => STM<never, E, never> = core.failSync
581
+
582
+ /**
583
+ * Returns the fiber id of the fiber committing the transaction.
584
+ *
585
+ * @since 2.0.0
586
+ * @category constructors
587
+ */
588
+ export const fiberId: STM<never, never, FiberId.FiberId> = stm.fiberId
589
+
590
+ /**
591
+ * Filters the collection using the specified effectual predicate.
592
+ *
593
+ * @since 2.0.0
594
+ * @category constructors
595
+ */
596
+ export const filter: {
597
+ <A, R, E>(predicate: (a: A) => STM<R, E, boolean>): (iterable: Iterable<A>) => STM<R, E, Array<A>>
598
+ <A, R, E>(iterable: Iterable<A>, predicate: (a: A) => STM<R, E, boolean>): STM<R, E, Array<A>>
599
+ } = stm.filter
600
+
601
+ /**
602
+ * Filters the collection using the specified effectual predicate, removing
603
+ * all elements that satisfy the predicate.
604
+ *
605
+ * @since 2.0.0
606
+ * @category constructors
607
+ */
608
+ export const filterNot: {
609
+ <A, R, E>(predicate: (a: A) => STM<R, E, boolean>): (iterable: Iterable<A>) => STM<R, E, Array<A>>
610
+ <A, R, E>(iterable: Iterable<A>, predicate: (a: A) => STM<R, E, boolean>): STM<R, E, Array<A>>
611
+ } = stm.filterNot
612
+
613
+ /**
614
+ * Dies with specified defect if the predicate fails.
615
+ *
616
+ * @since 2.0.0
617
+ * @category filtering
618
+ */
619
+ export const filterOrDie: {
620
+ <A, B extends A>(refinement: Refinement<A, B>, defect: LazyArg<unknown>): <R, E>(self: STM<R, E, A>) => STM<R, E, B>
621
+ <A, X extends A>(predicate: Predicate<X>, defect: LazyArg<unknown>): <R, E>(self: STM<R, E, A>) => STM<R, E, A>
622
+ <R, E, A, B extends A>(self: STM<R, E, A>, refinement: Refinement<A, B>, defect: LazyArg<unknown>): STM<R, E, B>
623
+ <R, E, A, X extends A>(self: STM<R, E, A>, predicate: Predicate<X>, defect: LazyArg<unknown>): STM<R, E, A>
624
+ } = stm.filterOrDie
625
+
626
+ /**
627
+ * Dies with a `Cause.RuntimeException` having the specified message if the
628
+ * predicate fails.
629
+ *
630
+ * @since 2.0.0
631
+ * @category filtering
632
+ */
633
+ export const filterOrDieMessage: {
634
+ <A, B extends A>(refinement: Refinement<A, B>, message: string): <R, E>(self: STM<R, E, A>) => STM<R, E, B>
635
+ <A, X extends A>(predicate: Predicate<X>, message: string): <R, E>(self: STM<R, E, A>) => STM<R, E, A>
636
+ <R, E, A, B extends A>(self: STM<R, E, A>, refinement: Refinement<A, B>, message: string): STM<R, E, B>
637
+ <R, E, A, X extends A>(self: STM<R, E, A>, predicate: Predicate<X>, message: string): STM<R, E, A>
638
+ } = stm.filterOrDieMessage
639
+
640
+ /**
641
+ * Supplies `orElse` if the predicate fails.
642
+ *
643
+ * @since 2.0.0
644
+ * @category filtering
645
+ */
646
+ export const filterOrElse: {
647
+ <A, B extends A, X extends A, R2, E2, A2>(
648
+ refinement: Refinement<A, B>,
649
+ orElse: (a: X) => STM<R2, E2, A2>
650
+ ): <R, E>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, B | A2>
651
+ <A, X extends A, Y extends A, R2, E2, A2>(
652
+ predicate: Predicate<X>,
653
+ orElse: (a: Y) => STM<R2, E2, A2>
654
+ ): <R, E>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, A | A2>
655
+ <R, E, A, B extends A, X extends A, R2, E2, A2>(
656
+ self: STM<R, E, A>,
657
+ refinement: Refinement<A, B>,
658
+ orElse: (a: X) => STM<R2, E2, A2>
659
+ ): STM<R | R2, E | E2, B | A2>
660
+ <R, E, A, X extends A, Y extends A, R2, E2, A2>(
661
+ self: STM<R, E, A>,
662
+ predicate: Predicate<X>,
663
+ orElse: (a: Y) => STM<R2, E2, A2>
664
+ ): STM<R | R2, E | E2, A | A2>
665
+ } = stm.filterOrElse
666
+
667
+ /**
668
+ * Fails with the specified error if the predicate fails.
669
+ *
670
+ * @since 2.0.0
671
+ * @category filtering
672
+ */
673
+ export const filterOrFail: {
674
+ <A, B extends A, X extends A, E2>(
675
+ refinement: Refinement<A, B>,
676
+ orFailWith: (a: X) => E2
677
+ ): <R, E>(self: STM<R, E, A>) => STM<R, E2 | E, B>
678
+ <A, X extends A, Y extends A, E2>(
679
+ predicate: Predicate<X>,
680
+ orFailWith: (a: Y) => E2
681
+ ): <R, E>(self: STM<R, E, A>) => STM<R, E2 | E, A>
682
+ <R, E, A, B extends A, X extends A, E2>(
683
+ self: STM<R, E, A>,
684
+ refinement: Refinement<A, B>,
685
+ orFailWith: (a: X) => E2
686
+ ): STM<R, E | E2, B>
687
+ <R, E, A, X extends A, Y extends A, E2>(
688
+ self: STM<R, E, A>,
689
+ predicate: Predicate<X>,
690
+ orFailWith: (a: Y) => E2
691
+ ): STM<R, E | E2, A>
692
+ } = stm.filterOrFail
693
+
694
+ /**
695
+ * Feeds the value produced by this effect to the specified function, and then
696
+ * runs the returned effect as well to produce its results.
697
+ *
698
+ * @since 2.0.0
699
+ * @category sequencing
700
+ */
701
+ export const flatMap: {
702
+ <A, R1, E1, A2>(f: (a: A) => STM<R1, E1, A2>): <R, E>(self: STM<R, E, A>) => STM<R1 | R, E1 | E, A2>
703
+ <R, E, A, R1, E1, A2>(self: STM<R, E, A>, f: (a: A) => STM<R1, E1, A2>): STM<R | R1, E | E1, A2>
704
+ } = core.flatMap
705
+
706
+ /**
707
+ * Flattens out a nested `STM` effect.
708
+ *
709
+ * @since 2.0.0
710
+ * @category sequencing
711
+ */
712
+ export const flatten: <R, E, R2, E2, A>(self: STM<R, E, STM<R2, E2, A>>) => STM<R | R2, E | E2, A> = stm.flatten
713
+
714
+ /**
715
+ * Flips the success and failure channels of this transactional effect. This
716
+ * allows you to use all methods on the error channel, possibly before
717
+ * flipping back.
718
+ *
719
+ * @since 2.0.0
720
+ * @category mutations
721
+ */
722
+ export const flip: <R, E, A>(self: STM<R, E, A>) => STM<R, A, E> = stm.flip
723
+
724
+ /**
725
+ * Swaps the error/value parameters, applies the function `f` and flips the
726
+ * parameters back
727
+ *
728
+ * @since 2.0.0
729
+ * @category mutations
730
+ */
731
+ export const flipWith: {
732
+ <R, A, E, R2, A2, E2>(f: (stm: STM<R, A, E>) => STM<R2, A2, E2>): (self: STM<R, E, A>) => STM<R | R2, E | E2, A | A2>
733
+ <R, A, E, R2, A2, E2>(self: STM<R, E, A>, f: (stm: STM<R, A, E>) => STM<R2, A2, E2>): STM<R | R2, E | E2, A | A2>
734
+ } = stm.flipWith
735
+
736
+ /**
737
+ * Folds over the `STM` effect, handling both failure and success, but not
738
+ * retry.
739
+ *
740
+ * @since 2.0.0
741
+ * @category folding
742
+ */
743
+ export const match: {
744
+ <E, A2, A, A3>(
745
+ options: {
746
+ readonly onFailure: (error: E) => A2
747
+ readonly onSuccess: (value: A) => A3
748
+ }
749
+ ): <R>(self: STM<R, E, A>) => STM<R, never, A2 | A3>
750
+ <R, E, A2, A, A3>(
751
+ self: STM<R, E, A>,
752
+ options: {
753
+ readonly onFailure: (error: E) => A2
754
+ readonly onSuccess: (value: A) => A3
755
+ }
756
+ ): STM<R, never, A2 | A3>
757
+ } = stm.match
758
+
759
+ /**
760
+ * Effectfully folds over the `STM` effect, handling both failure and success.
761
+ *
762
+ * @since 2.0.0
763
+ * @category folding
764
+ */
765
+ export const matchSTM: {
766
+ <E, R1, E1, A1, A, R2, E2, A2>(
767
+ options: {
768
+ readonly onFailure: (e: E) => STM<R1, E1, A1>
769
+ readonly onSuccess: (a: A) => STM<R2, E2, A2>
770
+ }
771
+ ): <R>(self: STM<R, E, A>) => STM<R1 | R2 | R, E1 | E2, A1 | A2>
772
+ <R, E, R1, E1, A1, A, R2, E2, A2>(
773
+ self: STM<R, E, A>,
774
+ options: {
775
+ readonly onFailure: (e: E) => STM<R1, E1, A1>
776
+ readonly onSuccess: (a: A) => STM<R2, E2, A2>
777
+ }
778
+ ): STM<R | R1 | R2, E1 | E2, A1 | A2>
779
+ } = core.matchSTM
780
+
781
+ /**
782
+ * Applies the function `f` to each element of the `Iterable<A>` and returns
783
+ * a transactional effect that produces a new `Chunk<A2>`.
784
+ *
785
+ * @since 2.0.0
786
+ * @category traversing
787
+ */
788
+ export const forEach: {
789
+ <A, R, E, A2>(
790
+ f: (a: A) => STM<R, E, A2>,
791
+ options?: { readonly discard?: false }
792
+ ): (elements: Iterable<A>) => STM<R, E, Array<A2>>
793
+ <A, R, E, A2>(
794
+ f: (a: A) => STM<R, E, A2>,
795
+ options: { readonly discard: true }
796
+ ): (elements: Iterable<A>) => STM<R, E, void>
797
+ <A, R, E, A2>(
798
+ elements: Iterable<A>,
799
+ f: (a: A) => STM<R, E, A2>,
800
+ options?: { readonly discard?: false }
801
+ ): STM<R, E, Array<A2>>
802
+ <A, R, E, A2>(elements: Iterable<A>, f: (a: A) => STM<R, E, A2>, options: { readonly discard: true }): STM<R, E, void>
803
+ } = stm.forEach
804
+
805
+ /**
806
+ * Lifts an `Either` into a `STM`.
807
+ *
808
+ * @since 2.0.0
809
+ * @category constructors
810
+ */
811
+ export const fromEither: <E, A>(either: Either.Either<E, A>) => STM<never, E, A> = stm.fromEither
812
+
813
+ /**
814
+ * Lifts an `Option` into a `STM`.
815
+ *
816
+ * @since 2.0.0
817
+ * @category constructors
818
+ */
819
+ export const fromOption: <A>(option: Option.Option<A>) => STM<never, Option.Option<never>, A> = stm.fromOption
820
+
821
+ /**
822
+ * @since 2.0.0
823
+ * @category models
824
+ */
825
+ export interface Adapter {
826
+ <R, E, A>(self: STM<R, E, A>): STMGen<R, E, A>
827
+ <A, _R, _E, _A>(a: A, ab: (a: A) => STM<_R, _E, _A>): STMGen<_R, _E, _A>
828
+ <A, B, _R, _E, _A>(a: A, ab: (a: A) => B, bc: (b: B) => STM<_R, _E, _A>): STMGen<_R, _E, _A>
829
+ <A, B, C, _R, _E, _A>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => STM<_R, _E, _A>): STMGen<_R, _E, _A>
830
+ <A, B, C, D, _R, _E, _A>(
831
+ a: A,
832
+ ab: (a: A) => B,
833
+ bc: (b: B) => C,
834
+ cd: (c: C) => D,
835
+ de: (d: D) => STM<_R, _E, _A>
836
+ ): STMGen<_R, _E, _A>
837
+ <A, B, C, D, E, _R, _E, _A>(
838
+ a: A,
839
+ ab: (a: A) => B,
840
+ bc: (b: B) => C,
841
+ cd: (c: C) => D,
842
+ de: (d: D) => E,
843
+ ef: (e: E) => STM<_R, _E, _A>
844
+ ): STMGen<_R, _E, _A>
845
+ <A, B, C, D, E, F, _R, _E, _A>(
846
+ a: A,
847
+ ab: (a: A) => B,
848
+ bc: (b: B) => C,
849
+ cd: (c: C) => D,
850
+ de: (d: D) => E,
851
+ ef: (e: E) => F,
852
+ fg: (f: F) => STM<_R, _E, _A>
853
+ ): STMGen<_R, _E, _A>
854
+ <A, B, C, D, E, F, G, _R, _E, _A>(
855
+ a: A,
856
+ ab: (a: A) => B,
857
+ bc: (b: B) => C,
858
+ cd: (c: C) => D,
859
+ de: (d: D) => E,
860
+ ef: (e: E) => F,
861
+ fg: (f: F) => G,
862
+ gh: (g: F) => STM<_R, _E, _A>
863
+ ): STMGen<_R, _E, _A>
864
+ <A, B, C, D, E, F, G, H, _R, _E, _A>(
865
+ a: A,
866
+ ab: (a: A) => B,
867
+ bc: (b: B) => C,
868
+ cd: (c: C) => D,
869
+ de: (d: D) => E,
870
+ ef: (e: E) => F,
871
+ fg: (f: F) => G,
872
+ gh: (g: G) => H,
873
+ hi: (g: H) => STM<_R, _E, _A>
874
+ ): STMGen<_R, _E, _A>
875
+ <A, B, C, D, E, F, G, H, I, _R, _E, _A>(
876
+ a: A,
877
+ ab: (a: A) => B,
878
+ bc: (b: B) => C,
879
+ cd: (c: C) => D,
880
+ de: (d: D) => E,
881
+ ef: (e: E) => F,
882
+ fg: (f: F) => G,
883
+ gh: (g: G) => H,
884
+ hi: (h: H) => I,
885
+ ij: (i: I) => STM<_R, _E, _A>
886
+ ): STMGen<_R, _E, _A>
887
+ <A, B, C, D, E, F, G, H, I, J, _R, _E, _A>(
888
+ a: A,
889
+ ab: (a: A) => B,
890
+ bc: (b: B) => C,
891
+ cd: (c: C) => D,
892
+ de: (d: D) => E,
893
+ ef: (e: E) => F,
894
+ fg: (f: F) => G,
895
+ gh: (g: G) => H,
896
+ hi: (h: H) => I,
897
+ ij: (i: I) => J,
898
+ jk: (j: J) => STM<_R, _E, _A>
899
+ ): STMGen<_R, _E, _A>
900
+ <A, B, C, D, E, F, G, H, I, J, K, _R, _E, _A>(
901
+ a: A,
902
+ ab: (a: A) => B,
903
+ bc: (b: B) => C,
904
+ cd: (c: C) => D,
905
+ de: (d: D) => E,
906
+ ef: (e: E) => F,
907
+ fg: (f: F) => G,
908
+ gh: (g: G) => H,
909
+ hi: (h: H) => I,
910
+ ij: (i: I) => J,
911
+ jk: (j: J) => K,
912
+ kl: (k: K) => STM<_R, _E, _A>
913
+ ): STMGen<_R, _E, _A>
914
+ <A, B, C, D, E, F, G, H, I, J, K, L, _R, _E, _A>(
915
+ a: A,
916
+ ab: (a: A) => B,
917
+ bc: (b: B) => C,
918
+ cd: (c: C) => D,
919
+ de: (d: D) => E,
920
+ ef: (e: E) => F,
921
+ fg: (f: F) => G,
922
+ gh: (g: G) => H,
923
+ hi: (h: H) => I,
924
+ ij: (i: I) => J,
925
+ jk: (j: J) => K,
926
+ kl: (k: K) => L,
927
+ lm: (l: L) => STM<_R, _E, _A>
928
+ ): STMGen<_R, _E, _A>
929
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, _R, _E, _A>(
930
+ a: A,
931
+ ab: (a: A) => B,
932
+ bc: (b: B) => C,
933
+ cd: (c: C) => D,
934
+ de: (d: D) => E,
935
+ ef: (e: E) => F,
936
+ fg: (f: F) => G,
937
+ gh: (g: G) => H,
938
+ hi: (h: H) => I,
939
+ ij: (i: I) => J,
940
+ jk: (j: J) => K,
941
+ kl: (k: K) => L,
942
+ lm: (l: L) => M,
943
+ mn: (m: M) => STM<_R, _E, _A>
944
+ ): STMGen<_R, _E, _A>
945
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, _R, _E, _A>(
946
+ a: A,
947
+ ab: (a: A) => B,
948
+ bc: (b: B) => C,
949
+ cd: (c: C) => D,
950
+ de: (d: D) => E,
951
+ ef: (e: E) => F,
952
+ fg: (f: F) => G,
953
+ gh: (g: G) => H,
954
+ hi: (h: H) => I,
955
+ ij: (i: I) => J,
956
+ jk: (j: J) => K,
957
+ kl: (k: K) => L,
958
+ lm: (l: L) => M,
959
+ mn: (m: M) => N,
960
+ no: (n: N) => STM<_R, _E, _A>
961
+ ): STMGen<_R, _E, _A>
962
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, _R, _E, _A>(
963
+ a: A,
964
+ ab: (a: A) => B,
965
+ bc: (b: B) => C,
966
+ cd: (c: C) => D,
967
+ de: (d: D) => E,
968
+ ef: (e: E) => F,
969
+ fg: (f: F) => G,
970
+ gh: (g: G) => H,
971
+ hi: (h: H) => I,
972
+ ij: (i: I) => J,
973
+ jk: (j: J) => K,
974
+ kl: (k: K) => L,
975
+ lm: (l: L) => M,
976
+ mn: (m: M) => N,
977
+ no: (n: N) => O,
978
+ op: (o: O) => STM<_R, _E, _A>
979
+ ): STMGen<_R, _E, _A>
980
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, _R, _E, _A>(
981
+ a: A,
982
+ ab: (a: A) => B,
983
+ bc: (b: B) => C,
984
+ cd: (c: C) => D,
985
+ de: (d: D) => E,
986
+ ef: (e: E) => F,
987
+ fg: (f: F) => G,
988
+ gh: (g: G) => H,
989
+ hi: (h: H) => I,
990
+ ij: (i: I) => J,
991
+ jk: (j: J) => K,
992
+ kl: (k: K) => L,
993
+ lm: (l: L) => M,
994
+ mn: (m: M) => N,
995
+ no: (n: N) => O,
996
+ op: (o: O) => P,
997
+ pq: (p: P) => STM<_R, _E, _A>
998
+ ): STMGen<_R, _E, _A>
999
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, _R, _E, _A>(
1000
+ a: A,
1001
+ ab: (a: A) => B,
1002
+ bc: (b: B) => C,
1003
+ cd: (c: C) => D,
1004
+ de: (d: D) => E,
1005
+ ef: (e: E) => F,
1006
+ fg: (f: F) => G,
1007
+ gh: (g: G) => H,
1008
+ hi: (h: H) => I,
1009
+ ij: (i: I) => J,
1010
+ jk: (j: J) => K,
1011
+ kl: (k: K) => L,
1012
+ lm: (l: L) => M,
1013
+ mn: (m: M) => N,
1014
+ no: (n: N) => O,
1015
+ op: (o: O) => P,
1016
+ pq: (p: P) => Q,
1017
+ qr: (q: Q) => STM<_R, _E, _A>
1018
+ ): STMGen<_R, _E, _A>
1019
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, _R, _E, _A>(
1020
+ a: A,
1021
+ ab: (a: A) => B,
1022
+ bc: (b: B) => C,
1023
+ cd: (c: C) => D,
1024
+ de: (d: D) => E,
1025
+ ef: (e: E) => F,
1026
+ fg: (f: F) => G,
1027
+ gh: (g: G) => H,
1028
+ hi: (h: H) => I,
1029
+ ij: (i: I) => J,
1030
+ jk: (j: J) => K,
1031
+ kl: (k: K) => L,
1032
+ lm: (l: L) => M,
1033
+ mn: (m: M) => N,
1034
+ no: (n: N) => O,
1035
+ op: (o: O) => P,
1036
+ pq: (p: P) => Q,
1037
+ qr: (q: Q) => R,
1038
+ rs: (r: R) => STM<_R, _E, _A>
1039
+ ): STMGen<_R, _E, _A>
1040
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, _R, _E, _A>(
1041
+ a: A,
1042
+ ab: (a: A) => B,
1043
+ bc: (b: B) => C,
1044
+ cd: (c: C) => D,
1045
+ de: (d: D) => E,
1046
+ ef: (e: E) => F,
1047
+ fg: (f: F) => G,
1048
+ gh: (g: G) => H,
1049
+ hi: (h: H) => I,
1050
+ ij: (i: I) => J,
1051
+ jk: (j: J) => K,
1052
+ kl: (k: K) => L,
1053
+ lm: (l: L) => M,
1054
+ mn: (m: M) => N,
1055
+ no: (n: N) => O,
1056
+ op: (o: O) => P,
1057
+ pq: (p: P) => Q,
1058
+ qr: (q: Q) => R,
1059
+ rs: (r: R) => S,
1060
+ st: (s: S) => STM<_R, _E, _A>
1061
+ ): STMGen<_R, _E, _A>
1062
+ <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, _R, _E, _A>(
1063
+ a: A,
1064
+ ab: (a: A) => B,
1065
+ bc: (b: B) => C,
1066
+ cd: (c: C) => D,
1067
+ de: (d: D) => E,
1068
+ ef: (e: E) => F,
1069
+ fg: (f: F) => G,
1070
+ gh: (g: G) => H,
1071
+ hi: (h: H) => I,
1072
+ ij: (i: I) => J,
1073
+ jk: (j: J) => K,
1074
+ kl: (k: K) => L,
1075
+ lm: (l: L) => M,
1076
+ mn: (m: M) => N,
1077
+ no: (n: N) => O,
1078
+ op: (o: O) => P,
1079
+ pq: (p: P) => Q,
1080
+ qr: (q: Q) => R,
1081
+ rs: (r: R) => S,
1082
+ st: (s: S) => T,
1083
+ tu: (s: T) => STM<_R, _E, _A>
1084
+ ): STMGen<_R, _E, _A>
1085
+ }
1086
+
1087
+ /**
1088
+ * @since 2.0.0
1089
+ * @category constructors
1090
+ */
1091
+ export const gen: <Eff extends STMGen<any, any, any>, AEff>(
1092
+ f: (resume: Adapter) => Generator<Eff, AEff, any>
1093
+ ) => STM<
1094
+ [Eff] extends [never] ? never : [Eff] extends [STMGen<infer R, any, any>] ? R : never,
1095
+ [Eff] extends [never] ? never : [Eff] extends [STMGen<any, infer E, any>] ? E : never,
1096
+ AEff
1097
+ > = stm.gen
1098
+
1099
+ /**
1100
+ * Returns a successful effect with the head of the list if the list is
1101
+ * non-empty or fails with the error `None` if the list is empty.
1102
+ *
1103
+ * @since 2.0.0
1104
+ * @category getters
1105
+ */
1106
+ export const head: <R, E, A>(self: STM<R, E, Iterable<A>>) => STM<R, Option.Option<E>, A> = stm.head
1107
+
1108
+ const if_: {
1109
+ <R1, R2, E1, E2, A, A1>(
1110
+ options: {
1111
+ readonly onTrue: STM<R1, E1, A>
1112
+ readonly onFalse: STM<R2, E2, A1>
1113
+ }
1114
+ ): <R = never, E = never>(self: boolean | STM<R, E, boolean>) => STM<R1 | R2 | R, E1 | E2 | E, A | A1>
1115
+ <R, E, R1, R2, E1, E2, A, A1>(
1116
+ self: boolean,
1117
+ options: {
1118
+ readonly onTrue: STM<R1, E1, A>
1119
+ readonly onFalse: STM<R2, E2, A1>
1120
+ }
1121
+ ): STM<R | R1 | R2, E | E1 | E2, A | A1>
1122
+ <R, E, R1, R2, E1, E2, A, A1>(
1123
+ self: STM<R, E, boolean>,
1124
+ options: {
1125
+ readonly onTrue: STM<R1, E1, A>
1126
+ readonly onFalse: STM<R2, E2, A1>
1127
+ }
1128
+ ): STM<R | R1 | R2, E | E1 | E2, A | A1>
1129
+ } = stm.if_
1130
+
1131
+ export {
1132
+ /**
1133
+ * Runs `onTrue` if the result of `b` is `true` and `onFalse` otherwise.
1134
+ *
1135
+ * @since 2.0.0
1136
+ * @category mutations
1137
+ */
1138
+ if_ as if
1139
+ }
1140
+
1141
+ /**
1142
+ * Returns a new effect that ignores the success or failure of this effect.
1143
+ *
1144
+ * @since 2.0.0
1145
+ * @category mutations
1146
+ */
1147
+ export const ignore: <R, E, A>(self: STM<R, E, A>) => STM<R, never, void> = stm.ignore
1148
+
1149
+ /**
1150
+ * Interrupts the fiber running the effect.
1151
+ *
1152
+ * @since 2.0.0
1153
+ * @category constructors
1154
+ */
1155
+ export const interrupt: STM<never, never, never> = core.interrupt
1156
+
1157
+ /**
1158
+ * Interrupts the fiber running the effect with the specified `FiberId`.
1159
+ *
1160
+ * @since 2.0.0
1161
+ * @category constructors
1162
+ */
1163
+ export const interruptAs: (fiberId: FiberId.FiberId) => STM<never, never, never> = core.interruptAs
1164
+
1165
+ /**
1166
+ * Returns whether this transactional effect is a failure.
1167
+ *
1168
+ * @since 2.0.0
1169
+ * @category getters
1170
+ */
1171
+ export const isFailure: <R, E, A>(self: STM<R, E, A>) => STM<R, never, boolean> = stm.isFailure
1172
+
1173
+ /**
1174
+ * Returns whether this transactional effect is a success.
1175
+ *
1176
+ * @since 2.0.0
1177
+ * @category getters
1178
+ */
1179
+ export const isSuccess: <R, E, A>(self: STM<R, E, A>) => STM<R, never, boolean> = stm.isSuccess
1180
+
1181
+ /**
1182
+ * Iterates with the specified transactional function. The moral equivalent
1183
+ * of:
1184
+ *
1185
+ * ```ts
1186
+ * const s = initial
1187
+ *
1188
+ * while (cont(s)) {
1189
+ * s = body(s)
1190
+ * }
1191
+ *
1192
+ * return s
1193
+ * ```
1194
+ *
1195
+ * @since 2.0.0
1196
+ * @category constructors
1197
+ */
1198
+ export const iterate: <R, E, Z>(
1199
+ initial: Z,
1200
+ options: {
1201
+ readonly while: (z: Z) => boolean
1202
+ readonly body: (z: Z) => STM<R, E, Z>
1203
+ }
1204
+ ) => STM<R, E, Z> = stm.iterate
1205
+
1206
+ /**
1207
+ * Loops with the specified transactional function, collecting the results
1208
+ * into a list. The moral equivalent of:
1209
+ *
1210
+ * ```ts
1211
+ * const as = []
1212
+ * let s = initial
1213
+ *
1214
+ * while (cont(s)) {
1215
+ * as.push(body(s))
1216
+ * s = inc(s)
1217
+ * }
1218
+ *
1219
+ * return as
1220
+ * ```
1221
+ *
1222
+ * @since 2.0.0
1223
+ * @category constructors
1224
+ */
1225
+ export const loop: {
1226
+ <Z, R, E, A>(
1227
+ initial: Z,
1228
+ options: {
1229
+ readonly while: (z: Z) => boolean
1230
+ readonly step: (z: Z) => Z
1231
+ readonly body: (z: Z) => STM<R, E, A>
1232
+ readonly discard?: false
1233
+ }
1234
+ ): STM<R, E, Array<A>>
1235
+ <Z, R, E, A>(
1236
+ initial: Z,
1237
+ options: {
1238
+ readonly while: (z: Z) => boolean
1239
+ readonly step: (z: Z) => Z
1240
+ readonly body: (z: Z) => STM<R, E, A>
1241
+ readonly discard: true
1242
+ }
1243
+ ): STM<R, E, void>
1244
+ } = stm.loop
1245
+
1246
+ /**
1247
+ * Maps the value produced by the effect.
1248
+ *
1249
+ * @since 2.0.0
1250
+ * @category mapping
1251
+ */
1252
+ export const map: {
1253
+ <A, B>(f: (a: A) => B): <R, E>(self: STM<R, E, A>) => STM<R, E, B>
1254
+ <R, E, A, B>(self: STM<R, E, A>, f: (a: A) => B): STM<R, E, B>
1255
+ } = core.map
1256
+
1257
+ /**
1258
+ * Maps the value produced by the effect with the specified function that may
1259
+ * throw exceptions but is otherwise pure, translating any thrown exceptions
1260
+ * into typed failed effects.
1261
+ *
1262
+ * @since 2.0.0
1263
+ * @category mapping
1264
+ */
1265
+ export const mapAttempt: {
1266
+ <A, B>(f: (a: A) => B): <R, E>(self: STM<R, E, A>) => STM<R, unknown, B>
1267
+ <R, E, A, B>(self: STM<R, E, A>, f: (a: A) => B): STM<R, unknown, B>
1268
+ } = stm.mapAttempt
1269
+
1270
+ /**
1271
+ * Returns an `STM` effect whose failure and success channels have been mapped
1272
+ * by the specified pair of functions, `f` and `g`.
1273
+ *
1274
+ * @since 2.0.0
1275
+ * @category mapping
1276
+ */
1277
+ export const mapBoth: {
1278
+ <E, E2, A, A2>(
1279
+ options: {
1280
+ readonly onFailure: (error: E) => E2
1281
+ readonly onSuccess: (value: A) => A2
1282
+ }
1283
+ ): <R>(self: STM<R, E, A>) => STM<R, E2, A2>
1284
+ <R, E, E2, A, A2>(
1285
+ self: STM<R, E, A>,
1286
+ options: {
1287
+ readonly onFailure: (error: E) => E2
1288
+ readonly onSuccess: (value: A) => A2
1289
+ }
1290
+ ): STM<R, E2, A2>
1291
+ } = stm.mapBoth
1292
+
1293
+ /**
1294
+ * Maps from one error type to another.
1295
+ *
1296
+ * @since 2.0.0
1297
+ * @category mapping
1298
+ */
1299
+ export const mapError: {
1300
+ <E, E2>(f: (error: E) => E2): <R, A>(self: STM<R, E, A>) => STM<R, E2, A>
1301
+ <R, A, E, E2>(self: STM<R, E, A>, f: (error: E) => E2): STM<R, E2, A>
1302
+ } = stm.mapError
1303
+
1304
+ /**
1305
+ * Returns a new effect where the error channel has been merged into the
1306
+ * success channel to their common combined type.
1307
+ *
1308
+ * @since 2.0.0
1309
+ * @category mutations
1310
+ */
1311
+ export const merge: <R, E, A>(self: STM<R, E, A>) => STM<R, never, E | A> = stm.merge
1312
+
1313
+ /**
1314
+ * Merges an `Iterable<STM>` to a single `STM`, working sequentially.
1315
+ *
1316
+ * @since 2.0.0
1317
+ * @category constructors
1318
+ */
1319
+ export const mergeAll: {
1320
+ <A2, A>(zero: A2, f: (a2: A2, a: A) => A2): <R, E>(iterable: Iterable<STM<R, E, A>>) => STM<R, E, A2>
1321
+ <R, E, A2, A>(iterable: Iterable<STM<R, E, A>>, zero: A2, f: (a2: A2, a: A) => A2): STM<R, E, A2>
1322
+ } = stm.mergeAll
1323
+
1324
+ /**
1325
+ * Returns a new effect where boolean value of this effect is negated.
1326
+ *
1327
+ * @since 2.0.0
1328
+ * @category mutations
1329
+ */
1330
+ export const negate: <R, E>(self: STM<R, E, boolean>) => STM<R, E, boolean> = stm.negate
1331
+
1332
+ /**
1333
+ * Requires the option produced by this value to be `None`.
1334
+ *
1335
+ * @since 2.0.0
1336
+ * @category mutations
1337
+ */
1338
+ export const none: <R, E, A>(self: STM<R, E, Option.Option<A>>) => STM<R, Option.Option<E>, void> = stm.none
1339
+
1340
+ /**
1341
+ * Converts the failure channel into an `Option`.
1342
+ *
1343
+ * @since 2.0.0
1344
+ * @category mutations
1345
+ */
1346
+ export const option: <R, E, A>(self: STM<R, E, A>) => STM<R, never, Option.Option<A>> = stm.option
1347
+
1348
+ /**
1349
+ * Translates `STM` effect failure into death of the fiber, making all
1350
+ * failures unchecked and not a part of the type of the effect.
1351
+ *
1352
+ * @since 2.0.0
1353
+ * @category error handling
1354
+ */
1355
+ export const orDie: <R, E, A>(self: STM<R, E, A>) => STM<R, never, A> = stm.orDie
1356
+
1357
+ /**
1358
+ * Keeps none of the errors, and terminates the fiber running the `STM` effect
1359
+ * with them, using the specified function to convert the `E` into a defect.
1360
+ *
1361
+ * @since 2.0.0
1362
+ * @category error handling
1363
+ */
1364
+ export const orDieWith: {
1365
+ <E>(f: (error: E) => unknown): <R, A>(self: STM<R, E, A>) => STM<R, never, A>
1366
+ <R, A, E>(self: STM<R, E, A>, f: (error: E) => unknown): STM<R, never, A>
1367
+ } = stm.orDieWith
1368
+
1369
+ /**
1370
+ * Tries this effect first, and if it fails or retries, tries the other
1371
+ * effect.
1372
+ *
1373
+ * @since 2.0.0
1374
+ * @category error handling
1375
+ */
1376
+ export const orElse: {
1377
+ <R2, E2, A2>(that: LazyArg<STM<R2, E2, A2>>): <R, E, A>(self: STM<R, E, A>) => STM<R2 | R, E2, A2 | A>
1378
+ <R, E, A, R2, E2, A2>(self: STM<R, E, A>, that: LazyArg<STM<R2, E2, A2>>): STM<R | R2, E2, A | A2>
1379
+ } = stm.orElse
1380
+
1381
+ /**
1382
+ * Returns a transactional effect that will produce the value of this effect
1383
+ * in left side, unless it fails or retries, in which case, it will produce
1384
+ * the value of the specified effect in right side.
1385
+ *
1386
+ * @since 2.0.0
1387
+ * @category error handling
1388
+ */
1389
+ export const orElseEither: {
1390
+ <R2, E2, A2>(that: LazyArg<STM<R2, E2, A2>>): <R, E, A>(self: STM<R, E, A>) => STM<R2 | R, E2, Either.Either<A, A2>>
1391
+ <R, E, A, R2, E2, A2>(self: STM<R, E, A>, that: LazyArg<STM<R2, E2, A2>>): STM<R | R2, E2, Either.Either<A, A2>>
1392
+ } = stm.orElseEither
1393
+
1394
+ /**
1395
+ * Tries this effect first, and if it fails or retries, fails with the
1396
+ * specified error.
1397
+ *
1398
+ * @since 2.0.0
1399
+ * @category error handling
1400
+ */
1401
+ export const orElseFail: {
1402
+ <E2>(error: LazyArg<E2>): <R, E, A>(self: STM<R, E, A>) => STM<R, E2, A>
1403
+ <R, E, A, E2>(self: STM<R, E, A>, error: LazyArg<E2>): STM<R, E2, A>
1404
+ } = stm.orElseFail
1405
+
1406
+ /**
1407
+ * Returns an effect that will produce the value of this effect, unless it
1408
+ * fails with the `None` value, in which case it will produce the value of the
1409
+ * specified effect.
1410
+ *
1411
+ * @since 2.0.0
1412
+ * @category error handling
1413
+ */
1414
+ export const orElseOptional: {
1415
+ <R2, E2, A2>(
1416
+ that: LazyArg<STM<R2, Option.Option<E2>, A2>>
1417
+ ): <R, E, A>(
1418
+ self: STM<R, Option.Option<E>, A>
1419
+ ) => STM<R2 | R, Option.Option<E2 | E>, A2 | A>
1420
+ <R, E, A, R2, E2, A2>(
1421
+ self: STM<R, Option.Option<E>, A>,
1422
+ that: LazyArg<STM<R2, Option.Option<E2>, A2>>
1423
+ ): STM<R | R2, Option.Option<E | E2>, A | A2>
1424
+ } = stm.orElseOptional
1425
+
1426
+ /**
1427
+ * Tries this effect first, and if it fails or retries, succeeds with the
1428
+ * specified value.
1429
+ *
1430
+ * @since 2.0.0
1431
+ * @category error handling
1432
+ */
1433
+ export const orElseSucceed: {
1434
+ <A2>(value: LazyArg<A2>): <R, E, A>(self: STM<R, E, A>) => STM<R, never, A2 | A>
1435
+ <R, E, A, A2>(self: STM<R, E, A>, value: LazyArg<A2>): STM<R, never, A | A2>
1436
+ } = stm.orElseSucceed
1437
+
1438
+ /**
1439
+ * Tries this effect first, and if it enters retry, then it tries the other
1440
+ * effect. This is an equivalent of Haskell's orElse.
1441
+ *
1442
+ * @since 2.0.0
1443
+ * @category error handling
1444
+ */
1445
+ export const orTry: {
1446
+ <R1, E1, A1>(that: LazyArg<STM<R1, E1, A1>>): <R, E, A>(self: STM<R, E, A>) => STM<R1 | R, E1 | E, A1 | A>
1447
+ <R, E, A, R1, E1, A1>(self: STM<R, E, A>, that: LazyArg<STM<R1, E1, A1>>): STM<R | R1, E | E1, A | A1>
1448
+ } = core.orTry
1449
+
1450
+ /**
1451
+ * Feeds elements of type `A` to a function `f` that returns an effect.
1452
+ * Collects all successes and failures in a tupled fashion.
1453
+ *
1454
+ * @since 2.0.0
1455
+ * @category traversing
1456
+ */
1457
+ export const partition: {
1458
+ <R, E, A, A2>(f: (a: A) => STM<R, E, A2>): (elements: Iterable<A>) => STM<R, never, readonly [Array<E>, Array<A2>]>
1459
+ <R, E, A, A2>(elements: Iterable<A>, f: (a: A) => STM<R, E, A2>): STM<R, never, readonly [Array<E>, Array<A2>]>
1460
+ } = stm.partition
1461
+
1462
+ /**
1463
+ * Provides the transaction its required environment, which eliminates its
1464
+ * dependency on `R`.
1465
+ *
1466
+ * @since 2.0.0
1467
+ * @category context
1468
+ */
1469
+ export const provideContext: {
1470
+ <R>(env: Context.Context<R>): <E, A>(self: STM<R, E, A>) => STM<never, E, A>
1471
+ <E, A, R>(self: STM<R, E, A>, env: Context.Context<R>): STM<never, E, A>
1472
+ } = stm.provideContext
1473
+
1474
+ /**
1475
+ * Splits the context into two parts, providing one part using the
1476
+ * specified layer and leaving the remainder `R0`.
1477
+ *
1478
+ * @since 2.0.0
1479
+ * @category context
1480
+ */
1481
+ export const provideSomeContext: {
1482
+ <R>(context: Context.Context<R>): <R1, E, A>(self: STM<R1, E, A>) => STM<Exclude<R1, R>, E, A>
1483
+ <R, R1, E, A>(self: STM<R1, E, A>, context: Context.Context<R>): STM<Exclude<R1, R>, E, A>
1484
+ } = stm.provideSomeContext
1485
+
1486
+ /**
1487
+ * Provides the effect with the single service it requires. If the transactional
1488
+ * effect requires more than one service use `provideEnvironment` instead.
1489
+ *
1490
+ * @since 2.0.0
1491
+ * @category context
1492
+ */
1493
+ export const provideService: {
1494
+ <T extends Context.Tag<any, any>>(
1495
+ tag: T,
1496
+ resource: Context.Tag.Service<T>
1497
+ ): <R, E, A>(self: STM<R, E, A>) => STM<Exclude<R, Context.Tag.Identifier<T>>, E, A>
1498
+ <R, E, A, T extends Context.Tag<any, any>>(
1499
+ self: STM<R, E, A>,
1500
+ tag: T,
1501
+ resource: Context.Tag.Service<T>
1502
+ ): STM<Exclude<R, Context.Tag.Identifier<T>>, E, A>
1503
+ } = stm.provideService
1504
+
1505
+ /**
1506
+ * Provides the effect with the single service it requires. If the transactional
1507
+ * effect requires more than one service use `provideEnvironment` instead.
1508
+ *
1509
+ * @since 2.0.0
1510
+ * @category context
1511
+ */
1512
+ export const provideServiceSTM: {
1513
+ <T extends Context.Tag<any, any>, R1, E1>(
1514
+ tag: T,
1515
+ stm: STM<R1, E1, Context.Tag.Service<T>>
1516
+ ): <R, E, A>(self: STM<R, E, A>) => STM<R1 | Exclude<R, Context.Tag.Identifier<T>>, E1 | E, A>
1517
+ <R, E, A, T extends Context.Tag<any, any>, R1, E1>(
1518
+ self: STM<R, E, A>,
1519
+ tag: T,
1520
+ stm: STM<R1, E1, Context.Tag.Service<T>>
1521
+ ): STM<R1 | Exclude<R, Context.Tag.Identifier<T>>, E | E1, A>
1522
+ } = stm.provideServiceSTM
1523
+
1524
+ /**
1525
+ * Folds an `Iterable<A>` using an effectual function f, working sequentially
1526
+ * from left to right.
1527
+ *
1528
+ * @since 2.0.0
1529
+ * @category constructors
1530
+ */
1531
+ export const reduce: {
1532
+ <S, A, R, E>(zero: S, f: (s: S, a: A) => STM<R, E, S>): (iterable: Iterable<A>) => STM<R, E, S>
1533
+ <S, A, R, E>(iterable: Iterable<A>, zero: S, f: (s: S, a: A) => STM<R, E, S>): STM<R, E, S>
1534
+ } = stm.reduce
1535
+
1536
+ /**
1537
+ * Reduces an `Iterable<STM>` to a single `STM`, working sequentially.
1538
+ *
1539
+ * @since 2.0.0
1540
+ * @category constructors
1541
+ */
1542
+ export const reduceAll: {
1543
+ <R2, E2, A>(
1544
+ initial: STM<R2, E2, A>,
1545
+ f: (x: A, y: A) => A
1546
+ ): <R, E>(
1547
+ iterable: Iterable<STM<R, E, A>>
1548
+ ) => STM<R2 | R, E2 | E, A>
1549
+ <R, E, R2, E2, A>(
1550
+ iterable: Iterable<STM<R, E, A>>,
1551
+ initial: STM<R2, E2, A>,
1552
+ f: (x: A, y: A) => A
1553
+ ): STM<R | R2, E | E2, A>
1554
+ } = stm.reduceAll
1555
+
1556
+ /**
1557
+ * Folds an `Iterable<A>` using an effectual function f, working sequentially
1558
+ * from right to left.
1559
+ *
1560
+ * @since 2.0.0
1561
+ * @category constructors
1562
+ */
1563
+ export const reduceRight: {
1564
+ <S, A, R, E>(zero: S, f: (s: S, a: A) => STM<R, E, S>): (iterable: Iterable<A>) => STM<R, E, S>
1565
+ <S, A, R, E>(iterable: Iterable<A>, zero: S, f: (s: S, a: A) => STM<R, E, S>): STM<R, E, S>
1566
+ } = stm.reduceRight
1567
+
1568
+ /**
1569
+ * Keeps some of the errors, and terminates the fiber with the rest.
1570
+ *
1571
+ * @since 2.0.0
1572
+ * @category mutations
1573
+ */
1574
+ export const refineOrDie: {
1575
+ <E, E2>(pf: (error: E) => Option.Option<E2>): <R, A>(self: STM<R, E, A>) => STM<R, E2, A>
1576
+ <R, A, E, E2>(self: STM<R, E, A>, pf: (error: E) => Option.Option<E2>): STM<R, E2, A>
1577
+ } = stm.refineOrDie
1578
+
1579
+ /**
1580
+ * Keeps some of the errors, and terminates the fiber with the rest, using the
1581
+ * specified function to convert the `E` into a `Throwable`.
1582
+ *
1583
+ * @since 2.0.0
1584
+ * @category mutations
1585
+ */
1586
+ export const refineOrDieWith: {
1587
+ <E, E2>(pf: (error: E) => Option.Option<E2>, f: (error: E) => unknown): <R, A>(self: STM<R, E, A>) => STM<R, E2, A>
1588
+ <R, A, E, E2>(self: STM<R, E, A>, pf: (error: E) => Option.Option<E2>, f: (error: E) => unknown): STM<R, E2, A>
1589
+ } = stm.refineOrDieWith
1590
+
1591
+ /**
1592
+ * Fail with the returned value if the `PartialFunction` matches, otherwise
1593
+ * continue with our held value.
1594
+ *
1595
+ * @since 2.0.0
1596
+ * @category mutations
1597
+ */
1598
+ export const reject: {
1599
+ <A, E2>(pf: (a: A) => Option.Option<E2>): <R, E>(self: STM<R, E, A>) => STM<R, E2 | E, A>
1600
+ <R, E, A, E2>(self: STM<R, E, A>, pf: (a: A) => Option.Option<E2>): STM<R, E | E2, A>
1601
+ } = stm.reject
1602
+
1603
+ /**
1604
+ * Continue with the returned computation if the specified partial function
1605
+ * matches, translating the successful match into a failure, otherwise continue
1606
+ * with our held value.
1607
+ *
1608
+ * @since 2.0.0
1609
+ * @category mutations
1610
+ */
1611
+ export const rejectSTM: {
1612
+ <A, R2, E2>(pf: (a: A) => Option.Option<STM<R2, E2, E2>>): <R, E>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, A>
1613
+ <R, E, A, R2, E2>(self: STM<R, E, A>, pf: (a: A) => Option.Option<STM<R2, E2, E2>>): STM<R | R2, E | E2, A>
1614
+ } = stm.rejectSTM
1615
+
1616
+ /**
1617
+ * Repeats this `STM` effect until its result satisfies the specified
1618
+ * predicate.
1619
+ *
1620
+ * **WARNING**: `repeatUntil` uses a busy loop to repeat the effect and will
1621
+ * consume a thread until it completes (it cannot yield). This is because STM
1622
+ * describes a single atomic transaction which must either complete, retry or
1623
+ * fail a transaction before yielding back to the Effect runtime.
1624
+ * - Use `retryUntil` instead if you don't need to maintain transaction
1625
+ * state for repeats.
1626
+ * - Ensure repeating the STM effect will eventually satisfy the predicate.
1627
+ *
1628
+ * @since 2.0.0
1629
+ * @category mutations
1630
+ */
1631
+ export const repeatUntil: {
1632
+ <A>(predicate: Predicate<A>): <R, E>(self: STM<R, E, A>) => STM<R, E, A>
1633
+ <R, E, A>(self: STM<R, E, A>, predicate: Predicate<A>): STM<R, E, A>
1634
+ } = stm.repeatUntil
1635
+
1636
+ /**
1637
+ * Repeats this `STM` effect while its result satisfies the specified
1638
+ * predicate.
1639
+ *
1640
+ * **WARNING**: `repeatWhile` uses a busy loop to repeat the effect and will
1641
+ * consume a thread until it completes (it cannot yield). This is because STM
1642
+ * describes a single atomic transaction which must either complete, retry or
1643
+ * fail a transaction before yielding back to the Effect runtime.
1644
+ * - Use `retryWhile` instead if you don't need to maintain transaction
1645
+ * state for repeats.
1646
+ * - Ensure repeating the STM effect will eventually not satisfy the
1647
+ * predicate.
1648
+ *
1649
+ * @since 2.0.0
1650
+ * @category mutations
1651
+ */
1652
+ export const repeatWhile: {
1653
+ <A>(predicate: Predicate<A>): <R, E>(self: STM<R, E, A>) => STM<R, E, A>
1654
+ <R, E, A>(self: STM<R, E, A>, predicate: Predicate<A>): STM<R, E, A>
1655
+ } = stm.repeatWhile
1656
+
1657
+ /**
1658
+ * Replicates the given effect n times. If 0 or negative numbers are given, an
1659
+ * empty `Chunk` will be returned.
1660
+ *
1661
+ * @since 2.0.0
1662
+ * @category constructors
1663
+ */
1664
+ export const replicate: {
1665
+ (n: number): <R, E, A>(self: STM<R, E, A>) => Array<STM<R, E, A>>
1666
+ <R, E, A>(self: STM<R, E, A>, n: number): Array<STM<R, E, A>>
1667
+ } = stm.replicate
1668
+
1669
+ /**
1670
+ * Performs this transaction the specified number of times and collects the
1671
+ * results.
1672
+ *
1673
+ * @since 2.0.0
1674
+ * @category constructors
1675
+ */
1676
+ export const replicateSTM: {
1677
+ (n: number): <R, E, A>(self: STM<R, E, A>) => STM<R, E, Array<A>>
1678
+ <R, E, A>(self: STM<R, E, A>, n: number): STM<R, E, Array<A>>
1679
+ } = stm.replicateSTM
1680
+
1681
+ /**
1682
+ * Performs this transaction the specified number of times, discarding the
1683
+ * results.
1684
+ *
1685
+ * @since 2.0.0
1686
+ * @category constructors
1687
+ */
1688
+ export const replicateSTMDiscard: {
1689
+ (n: number): <R, E, A>(self: STM<R, E, A>) => STM<R, E, void>
1690
+ <R, E, A>(self: STM<R, E, A>, n: number): STM<R, E, void>
1691
+ } = stm.replicateSTMDiscard
1692
+
1693
+ /**
1694
+ * Abort and retry the whole transaction when any of the underlying
1695
+ * transactional variables have changed.
1696
+ *
1697
+ * @since 2.0.0
1698
+ * @category error handling
1699
+ */
1700
+ export const retry: STM<never, never, never> = core.retry
1701
+
1702
+ /**
1703
+ * Filters the value produced by this effect, retrying the transaction until
1704
+ * the predicate returns `true` for the value.
1705
+ *
1706
+ * @since 2.0.0
1707
+ * @category mutations
1708
+ */
1709
+ export const retryUntil: {
1710
+ <A>(predicate: Predicate<A>): <R, E>(self: STM<R, E, A>) => STM<R, E, A>
1711
+ <R, E, A>(self: STM<R, E, A>, predicate: Predicate<A>): STM<R, E, A>
1712
+ } = stm.retryUntil
1713
+
1714
+ /**
1715
+ * Filters the value produced by this effect, retrying the transaction while
1716
+ * the predicate returns `true` for the value.
1717
+ *
1718
+ * @since 2.0.0
1719
+ * @category mutations
1720
+ */
1721
+ export const retryWhile: {
1722
+ <A>(predicate: Predicate<A>): <R, E>(self: STM<R, E, A>) => STM<R, E, A>
1723
+ <R, E, A>(self: STM<R, E, A>, predicate: Predicate<A>): STM<R, E, A>
1724
+ } = stm.retryWhile
1725
+
1726
+ /**
1727
+ * Converts an option on values into an option on errors.
1728
+ *
1729
+ * @since 2.0.0
1730
+ * @category getters
1731
+ */
1732
+ export const some: <R, E, A>(self: STM<R, E, Option.Option<A>>) => STM<R, Option.Option<E>, A> = stm.some
1733
+
1734
+ /**
1735
+ * Returns an `STM` effect that succeeds with the specified value.
1736
+ *
1737
+ * @since 2.0.0
1738
+ * @category constructors
1739
+ */
1740
+ export const succeed: <A>(value: A) => STM<never, never, A> = core.succeed
1741
+
1742
+ /**
1743
+ * Returns an effect with the empty value.
1744
+ *
1745
+ * @since 2.0.0
1746
+ * @category constructors
1747
+ */
1748
+ export const succeedNone: STM<never, never, Option.Option<never>> = stm.succeedNone
1749
+
1750
+ /**
1751
+ * Returns an effect with the optional value.
1752
+ *
1753
+ * @since 2.0.0
1754
+ * @category constructors
1755
+ */
1756
+ export const succeedSome: <A>(value: A) => STM<never, never, Option.Option<A>> = stm.succeedSome
1757
+
1758
+ /**
1759
+ * Summarizes a `STM` effect by computing a provided value before and after
1760
+ * execution, and then combining the values to produce a summary, together
1761
+ * with the result of execution.
1762
+ *
1763
+ * @since 2.0.0
1764
+ * @category mutations
1765
+ */
1766
+ export const summarized: {
1767
+ <R2, E2, A2, A3>(
1768
+ summary: STM<R2, E2, A2>,
1769
+ f: (before: A2, after: A2) => A3
1770
+ ): <R, E, A>(
1771
+ self: STM<R, E, A>
1772
+ ) => STM<R2 | R, E2 | E, readonly [A3, A]>
1773
+ <R, E, A, R2, E2, A2, A3>(
1774
+ self: STM<R, E, A>,
1775
+ summary: STM<R2, E2, A2>,
1776
+ f: (before: A2, after: A2) => A3
1777
+ ): STM<R | R2, E | E2, readonly [A3, A]>
1778
+ } = stm.summarized
1779
+
1780
+ /**
1781
+ * Suspends creation of the specified transaction lazily.
1782
+ *
1783
+ * @since 2.0.0
1784
+ * @category constructors
1785
+ */
1786
+ export const suspend: <R, E, A>(evaluate: LazyArg<STM<R, E, A>>) => STM<R, E, A> = stm.suspend
1787
+
1788
+ /**
1789
+ * Returns an `STM` effect that succeeds with the specified lazily evaluated
1790
+ * value.
1791
+ *
1792
+ * @since 2.0.0
1793
+ * @category constructors
1794
+ */
1795
+ export const sync: <A>(evaluate: () => A) => STM<never, never, A> = core.sync
1796
+
1797
+ /**
1798
+ * "Peeks" at the success of transactional effect.
1799
+ *
1800
+ * @since 2.0.0
1801
+ * @category sequencing
1802
+ */
1803
+ export const tap: {
1804
+ <A, X extends A, R2, E2, _>(f: (a: X) => STM<R2, E2, _>): <R, E>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, A>
1805
+ <R, E, A, X extends A, R2, E2, _>(self: STM<R, E, A>, f: (a: X) => STM<R2, E2, _>): STM<R | R2, E | E2, A>
1806
+ } = stm.tap
1807
+
1808
+ /**
1809
+ * "Peeks" at both sides of an transactional effect.
1810
+ *
1811
+ * @since 2.0.0
1812
+ * @category sequencing
1813
+ */
1814
+ export const tapBoth: {
1815
+ <E, XE extends E, R2, E2, A2, A, XA extends A, R3, E3, A3>(
1816
+ options: { readonly onFailure: (error: XE) => STM<R2, E2, A2>; readonly onSuccess: (value: XA) => STM<R3, E3, A3> }
1817
+ ): <R>(self: STM<R, E, A>) => STM<R2 | R3 | R, E | E2 | E3, A>
1818
+ <R, E, XE extends E, R2, E2, A2, A, XA extends A, R3, E3, A3>(
1819
+ self: STM<R, E, A>,
1820
+ options: { readonly onFailure: (error: XE) => STM<R2, E2, A2>; readonly onSuccess: (value: XA) => STM<R3, E3, A3> }
1821
+ ): STM<R | R2 | R3, E | E2 | E3, A>
1822
+ } = stm.tapBoth
1823
+
1824
+ /**
1825
+ * "Peeks" at the error of the transactional effect.
1826
+ *
1827
+ * @since 2.0.0
1828
+ * @category sequencing
1829
+ */
1830
+ export const tapError: {
1831
+ <E, X extends E, R2, E2, _>(f: (error: X) => STM<R2, E2, _>): <R, A>(self: STM<R, E, A>) => STM<R2 | R, E | E2, A>
1832
+ <R, A, E, X extends E, R2, E2, _>(self: STM<R, E, A>, f: (error: X) => STM<R2, E2, _>): STM<R | R2, E | E2, A>
1833
+ } = stm.tapError
1834
+
1835
+ const try_: {
1836
+ <A, E>(options: {
1837
+ readonly try: LazyArg<A>
1838
+ readonly catch: (u: unknown) => E
1839
+ }): STM<never, E, A>
1840
+ <A>(try_: LazyArg<A>): STM<never, unknown, A>
1841
+ } = stm.try_
1842
+ export {
1843
+ /**
1844
+ * Imports a synchronous side-effect into a pure value, translating any thrown
1845
+ * exceptions into typed failed effects.
1846
+ *
1847
+ * @since 2.0.0
1848
+ * @category constructors
1849
+ */
1850
+ try_ as try
1851
+ }
1852
+
1853
+ /**
1854
+ * The moral equivalent of `if (!p) exp`
1855
+ *
1856
+ * @since 2.0.0
1857
+ * @category mutations
1858
+ */
1859
+ export const unless: {
1860
+ (predicate: LazyArg<boolean>): <R, E, A>(self: STM<R, E, A>) => STM<R, E, Option.Option<A>>
1861
+ <R, E, A>(self: STM<R, E, A>, predicate: LazyArg<boolean>): STM<R, E, Option.Option<A>>
1862
+ } = stm.unless
1863
+
1864
+ /**
1865
+ * The moral equivalent of `if (!p) exp` when `p` has side-effects
1866
+ *
1867
+ * @since 2.0.0
1868
+ * @category mutations
1869
+ */
1870
+ export const unlessSTM: {
1871
+ <R2, E2>(predicate: STM<R2, E2, boolean>): <R, E, A>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, Option.Option<A>>
1872
+ <R, E, A, R2, E2>(self: STM<R, E, A>, predicate: STM<R2, E2, boolean>): STM<R | R2, E | E2, Option.Option<A>>
1873
+ } = stm.unlessSTM
1874
+
1875
+ /**
1876
+ * Converts an option on errors into an option on values.
1877
+ *
1878
+ * @since 2.0.0
1879
+ * @category getters
1880
+ */
1881
+ export const unsome: <R, E, A>(self: STM<R, Option.Option<E>, A>) => STM<R, E, Option.Option<A>> = stm.unsome
1882
+
1883
+ /**
1884
+ * Returns an `STM` effect that succeeds with `Unit`.
1885
+ *
1886
+ * @since 2.0.0
1887
+ * @category constructors
1888
+ */
1889
+ export const unit: STM<never, never, void> = stm.unit
1890
+
1891
+ /**
1892
+ * Feeds elements of type `A` to `f` and accumulates all errors in error
1893
+ * channel or successes in success channel.
1894
+ *
1895
+ * This combinator is lossy meaning that if there are errors all successes
1896
+ * will be lost. To retain all information please use `STM.partition`.
1897
+ *
1898
+ * @since 2.0.0
1899
+ * @category mutations
1900
+ */
1901
+ export const validateAll: {
1902
+ <R, E, A, B>(f: (a: A) => STM<R, E, B>): (elements: Iterable<A>) => STM<R, [E, ...Array<E>], Array<B>>
1903
+ <R, E, A, B>(elements: Iterable<A>, f: (a: A) => STM<R, E, B>): STM<R, [E, ...Array<E>], Array<B>>
1904
+ } = stm.validateAll
1905
+
1906
+ /**
1907
+ * Feeds elements of type `A` to `f` until it succeeds. Returns first success
1908
+ * or the accumulation of all errors.
1909
+ *
1910
+ * @since 2.0.0
1911
+ * @category mutations
1912
+ */
1913
+ export const validateFirst: {
1914
+ <R, E, A, B>(f: (a: A) => STM<R, E, B>): (elements: Iterable<A>) => STM<R, Array<E>, B>
1915
+ <R, E, A, B>(elements: Iterable<A>, f: (a: A) => STM<R, E, B>): STM<R, Array<E>, B>
1916
+ } = stm.validateFirst
1917
+
1918
+ /**
1919
+ * The moral equivalent of `if (p) exp`.
1920
+ *
1921
+ * @since 2.0.0
1922
+ * @category mutations
1923
+ */
1924
+ export const when: {
1925
+ (predicate: LazyArg<boolean>): <R, E, A>(self: STM<R, E, A>) => STM<R, E, Option.Option<A>>
1926
+ <R, E, A>(self: STM<R, E, A>, predicate: LazyArg<boolean>): STM<R, E, Option.Option<A>>
1927
+ } = stm.when
1928
+
1929
+ /**
1930
+ * The moral equivalent of `if (p) exp` when `p` has side-effects.
1931
+ *
1932
+ * @since 2.0.0
1933
+ * @category mutations
1934
+ */
1935
+ export const whenSTM: {
1936
+ <R2, E2>(predicate: STM<R2, E2, boolean>): <R, E, A>(self: STM<R, E, A>) => STM<R2 | R, E2 | E, Option.Option<A>>
1937
+ <R, E, A, R2, E2>(self: STM<R, E, A>, predicate: STM<R2, E2, boolean>): STM<R | R2, E | E2, Option.Option<A>>
1938
+ } = stm.whenSTM
1939
+
1940
+ /**
1941
+ * Sequentially zips this value with the specified one.
1942
+ *
1943
+ * @since 2.0.0
1944
+ * @category zipping
1945
+ */
1946
+ export const zip: {
1947
+ <R1, E1, A1>(that: STM<R1, E1, A1>): <R, E, A>(self: STM<R, E, A>) => STM<R1 | R, E1 | E, readonly [A, A1]>
1948
+ <R, E, A, R1, E1, A1>(self: STM<R, E, A>, that: STM<R1, E1, A1>): STM<R | R1, E | E1, readonly [A, A1]>
1949
+ } = core.zip
1950
+
1951
+ /**
1952
+ * Sequentially zips this value with the specified one, discarding the second
1953
+ * element of the tuple.
1954
+ *
1955
+ * @since 2.0.0
1956
+ * @category zipping
1957
+ */
1958
+ export const zipLeft: {
1959
+ <R1, E1, A1>(that: STM<R1, E1, A1>): <R, E, A>(self: STM<R, E, A>) => STM<R1 | R, E1 | E, A>
1960
+ <R, E, A, R1, E1, A1>(self: STM<R, E, A>, that: STM<R1, E1, A1>): STM<R | R1, E | E1, A>
1961
+ } = core.zipLeft
1962
+
1963
+ /**
1964
+ * Sequentially zips this value with the specified one, discarding the first
1965
+ * element of the tuple.
1966
+ *
1967
+ * @since 2.0.0
1968
+ * @category zipping
1969
+ */
1970
+ export const zipRight: {
1971
+ <R1, E1, A1>(that: STM<R1, E1, A1>): <R, E, A>(self: STM<R, E, A>) => STM<R1 | R, E1 | E, A1>
1972
+ <R, E, A, R1, E1, A1>(self: STM<R, E, A>, that: STM<R1, E1, A1>): STM<R | R1, E | E1, A1>
1973
+ } = core.zipRight
1974
+
1975
+ /**
1976
+ * Sequentially zips this value with the specified one, combining the values
1977
+ * using the specified combiner function.
1978
+ *
1979
+ * @since 2.0.0
1980
+ * @category zipping
1981
+ */
1982
+ export const zipWith: {
1983
+ <R1, E1, A1, A, A2>(
1984
+ that: STM<R1, E1, A1>,
1985
+ f: (a: A, b: A1) => A2
1986
+ ): <R, E>(
1987
+ self: STM<R, E, A>
1988
+ ) => STM<R1 | R, E1 | E, A2>
1989
+ <R, E, R1, E1, A1, A, A2>(
1990
+ self: STM<R, E, A>,
1991
+ that: STM<R1, E1, A1>,
1992
+ f: (a: A, b: A1) => A2
1993
+ ): STM<R | R1, E | E1, A2>
1994
+ } = core.zipWith
1995
+
1996
+ /**
1997
+ * This function takes an iterable of `STM` values and returns a new
1998
+ * `STM` value that represents the first `STM` value in the iterable
1999
+ * that succeeds. If all of the `Effect` values in the iterable fail, then
2000
+ * the resulting `STM` value will fail as well.
2001
+ *
2002
+ * This function is sequential, meaning that the `STM` values in the
2003
+ * iterable will be executed in sequence, and the first one that succeeds
2004
+ * will determine the outcome of the resulting `STM` value.
2005
+ *
2006
+ * @param effects - The iterable of `STM` values to evaluate.
2007
+ *
2008
+ * @returns A new `STM` value that represents the first successful
2009
+ * `STM` value in the iterable, or a failed `STM` value if all of the
2010
+ * `STM` values in the iterable fail.
2011
+ *
2012
+ * @since 2.0.0
2013
+ * @category elements
2014
+ */
2015
+ export const firstSuccessOf = <R, E, A>(effects: Iterable<STM<R, E, A>>): STM<R, E, A> =>
2016
+ suspend<R, E, A>(() => {
2017
+ const list = Chunk.fromIterable(effects)
2018
+ if (!Chunk.isNonEmpty(list)) {
2019
+ return dieSync(() => Cause.IllegalArgumentException(`Received an empty collection of effects`))
2020
+ }
2021
+ return Chunk.reduce(
2022
+ Chunk.tailNonEmpty(list),
2023
+ Chunk.headNonEmpty(list),
2024
+ (left, right) => orElse(left, () => right)
2025
+ )
2026
+ })
2027
+
2028
+ /**
2029
+ * @category do notation
2030
+ * @since 2.0.0
2031
+ */
2032
+ export const Do: STM<never, never, {}> = succeed({})
2033
+
2034
+ /**
2035
+ * @category do notation
2036
+ * @since 2.0.0
2037
+ */
2038
+ export const bind: {
2039
+ <N extends string, K, R2, E2, A>(
2040
+ tag: Exclude<N, keyof K>,
2041
+ f: (_: K) => STM<R2, E2, A>
2042
+ ): <R, E>(self: STM<R, E, K>) => STM<R2 | R, E2 | E, Effect.MergeRecord<K, { [k in N]: A }>>
2043
+ <R, E, N extends string, K, R2, E2, A>(
2044
+ self: STM<R, E, K>,
2045
+ tag: Exclude<N, keyof K>,
2046
+ f: (_: K) => STM<R2, E2, A>
2047
+ ): STM<R | R2, E | E2, Effect.MergeRecord<K, { [k in N]: A }>>
2048
+ } = stm.bind
2049
+
2050
+ const let_: {
2051
+ <N extends string, K, A>(
2052
+ tag: Exclude<N, keyof K>,
2053
+ f: (_: K) => A
2054
+ ): <R, E>(self: STM<R, E, K>) => STM<R, E, Effect.MergeRecord<K, { [k in N]: A }>>
2055
+ <R, E, K, N extends string, A>(
2056
+ self: STM<R, E, K>,
2057
+ tag: Exclude<N, keyof K>,
2058
+ f: (_: K) => A
2059
+ ): STM<R, E, Effect.MergeRecord<K, { [k in N]: A }>>
2060
+ } = stm.let_
2061
+ export {
2062
+ /**
2063
+ * @category do notation
2064
+ * @since 2.0.0
2065
+ */
2066
+ let_ as let
2067
+ }
2068
+
2069
+ /**
2070
+ * @category do notation
2071
+ * @since 2.0.0
2072
+ */
2073
+ export const bindTo: {
2074
+ <N extends string>(tag: N): <R, E, A>(self: STM<R, E, A>) => STM<R, E, Record<N, A>>
2075
+ <R, E, A, N extends string>(self: STM<R, E, A>, tag: N): STM<R, E, Record<N, A>>
2076
+ } = stm.bindTo