effect 3.8.3 → 3.8.5

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 (599) hide show
  1. package/dist/cjs/Array.js.map +1 -1
  2. package/dist/cjs/BigDecimal.js +2 -3
  3. package/dist/cjs/BigDecimal.js.map +1 -1
  4. package/dist/cjs/BigInt.js.map +1 -1
  5. package/dist/cjs/Boolean.js.map +1 -1
  6. package/dist/cjs/Cause.js.map +1 -1
  7. package/dist/cjs/Channel.js.map +1 -1
  8. package/dist/cjs/ChildExecutorDecision.js.map +1 -1
  9. package/dist/cjs/Chunk.js.map +1 -1
  10. package/dist/cjs/Config.js.map +1 -1
  11. package/dist/cjs/ConfigError.js.map +1 -1
  12. package/dist/cjs/ConfigProvider.js.map +1 -1
  13. package/dist/cjs/ConfigProviderPathPatch.js.map +1 -1
  14. package/dist/cjs/Console.js.map +1 -1
  15. package/dist/cjs/Context.js.map +1 -1
  16. package/dist/cjs/Cron.js.map +1 -1
  17. package/dist/cjs/Data.js.map +1 -1
  18. package/dist/cjs/DateTime.js.map +1 -1
  19. package/dist/cjs/Deferred.js.map +1 -1
  20. package/dist/cjs/Differ.js.map +1 -1
  21. package/dist/cjs/Duration.js.map +1 -1
  22. package/dist/cjs/Effect.js.map +1 -1
  23. package/dist/cjs/Either.js.map +1 -1
  24. package/dist/cjs/Equivalence.js.map +1 -1
  25. package/dist/cjs/ExecutionStrategy.js.map +1 -1
  26. package/dist/cjs/Exit.js.map +1 -1
  27. package/dist/cjs/Fiber.js.map +1 -1
  28. package/dist/cjs/FiberHandle.js.map +1 -1
  29. package/dist/cjs/FiberId.js.map +1 -1
  30. package/dist/cjs/FiberMap.js.map +1 -1
  31. package/dist/cjs/FiberRef.js.map +1 -1
  32. package/dist/cjs/FiberRefs.js.map +1 -1
  33. package/dist/cjs/FiberRefsPatch.js.map +1 -1
  34. package/dist/cjs/FiberSet.js.map +1 -1
  35. package/dist/cjs/Function.js.map +1 -1
  36. package/dist/cjs/GroupBy.js.map +1 -1
  37. package/dist/cjs/Hash.js.map +1 -1
  38. package/dist/cjs/HashMap.js.map +1 -1
  39. package/dist/cjs/HashSet.js.map +1 -1
  40. package/dist/cjs/Iterable.js.map +1 -1
  41. package/dist/cjs/KeyedPool.js.map +1 -1
  42. package/dist/cjs/Layer.js.map +1 -1
  43. package/dist/cjs/List.js.map +1 -1
  44. package/dist/cjs/LogLevel.js.map +1 -1
  45. package/dist/cjs/Logger.js.map +1 -1
  46. package/dist/cjs/Mailbox.js.map +1 -1
  47. package/dist/cjs/MergeDecision.js.map +1 -1
  48. package/dist/cjs/MergeState.js.map +1 -1
  49. package/dist/cjs/MergeStrategy.js.map +1 -1
  50. package/dist/cjs/Metric.js.map +1 -1
  51. package/dist/cjs/MetricHook.js.map +1 -1
  52. package/dist/cjs/MetricKey.js.map +1 -1
  53. package/dist/cjs/MetricPolling.js.map +1 -1
  54. package/dist/cjs/MetricState.js.map +1 -1
  55. package/dist/cjs/Micro.js +54 -23
  56. package/dist/cjs/Micro.js.map +1 -1
  57. package/dist/cjs/MutableHashMap.js.map +1 -1
  58. package/dist/cjs/MutableHashSet.js.map +1 -1
  59. package/dist/cjs/MutableList.js.map +1 -1
  60. package/dist/cjs/MutableQueue.js.map +1 -1
  61. package/dist/cjs/MutableRef.js.map +1 -1
  62. package/dist/cjs/Number.js.map +1 -1
  63. package/dist/cjs/Option.js.map +1 -1
  64. package/dist/cjs/Order.js.map +1 -1
  65. package/dist/cjs/Ordering.js.map +1 -1
  66. package/dist/cjs/Pipeable.js.map +1 -1
  67. package/dist/cjs/Pool.js.map +1 -1
  68. package/dist/cjs/Predicate.js.map +1 -1
  69. package/dist/cjs/PubSub.js.map +1 -1
  70. package/dist/cjs/Queue.js.map +1 -1
  71. package/dist/cjs/RcMap.js.map +1 -1
  72. package/dist/cjs/Readable.js.map +1 -1
  73. package/dist/cjs/Record.js.map +1 -1
  74. package/dist/cjs/RedBlackTree.js.map +1 -1
  75. package/dist/cjs/Ref.js.map +1 -1
  76. package/dist/cjs/Request.js.map +1 -1
  77. package/dist/cjs/RequestResolver.js.map +1 -1
  78. package/dist/cjs/Runtime.js.map +1 -1
  79. package/dist/cjs/RuntimeFlags.js.map +1 -1
  80. package/dist/cjs/RuntimeFlagsPatch.js.map +1 -1
  81. package/dist/cjs/STM.js.map +1 -1
  82. package/dist/cjs/Schedule.js.map +1 -1
  83. package/dist/cjs/ScheduleInterval.js.map +1 -1
  84. package/dist/cjs/ScheduleIntervals.js.map +1 -1
  85. package/dist/cjs/Scheduler.js.map +1 -1
  86. package/dist/cjs/Scope.js +25 -15
  87. package/dist/cjs/Scope.js.map +1 -1
  88. package/dist/cjs/ScopedRef.js.map +1 -1
  89. package/dist/cjs/Sink.js.map +1 -1
  90. package/dist/cjs/SortedMap.js.map +1 -1
  91. package/dist/cjs/SortedSet.js.map +1 -1
  92. package/dist/cjs/Stream.js +17 -3
  93. package/dist/cjs/Stream.js.map +1 -1
  94. package/dist/cjs/StreamHaltStrategy.js.map +1 -1
  95. package/dist/cjs/String.js.map +1 -1
  96. package/dist/cjs/Struct.js.map +1 -1
  97. package/dist/cjs/Subscribable.js.map +1 -1
  98. package/dist/cjs/SubscriptionRef.js.map +1 -1
  99. package/dist/cjs/SynchronizedRef.js.map +1 -1
  100. package/dist/cjs/TArray.js.map +1 -1
  101. package/dist/cjs/TDeferred.js.map +1 -1
  102. package/dist/cjs/TMap.js.map +1 -1
  103. package/dist/cjs/TPriorityQueue.js.map +1 -1
  104. package/dist/cjs/TPubSub.js.map +1 -1
  105. package/dist/cjs/TQueue.js.map +1 -1
  106. package/dist/cjs/TReentrantLock.js.map +1 -1
  107. package/dist/cjs/TRef.js.map +1 -1
  108. package/dist/cjs/TSemaphore.js.map +1 -1
  109. package/dist/cjs/TSet.js.map +1 -1
  110. package/dist/cjs/Take.js.map +1 -1
  111. package/dist/cjs/TestAnnotationMap.js.map +1 -1
  112. package/dist/cjs/TestClock.js.map +1 -1
  113. package/dist/cjs/TestServices.js.map +1 -1
  114. package/dist/cjs/Trie.js.map +1 -1
  115. package/dist/cjs/Tuple.js.map +1 -1
  116. package/dist/cjs/Unify.js.map +1 -1
  117. package/dist/cjs/UpstreamPullRequest.js.map +1 -1
  118. package/dist/cjs/UpstreamPullStrategy.js.map +1 -1
  119. package/dist/cjs/Utils.js +1 -14
  120. package/dist/cjs/Utils.js.map +1 -1
  121. package/dist/cjs/internal/core.js +4 -3
  122. package/dist/cjs/internal/core.js.map +1 -1
  123. package/dist/cjs/internal/runtime.js +1 -1
  124. package/dist/cjs/internal/runtime.js.map +1 -1
  125. package/dist/cjs/internal/stream.js +12 -3
  126. package/dist/cjs/internal/stream.js.map +1 -1
  127. package/dist/cjs/internal/version.js +1 -1
  128. package/dist/dts/Array.d.ts +2684 -0
  129. package/dist/dts/Array.d.ts.map +1 -1
  130. package/dist/dts/BigDecimal.d.ts +558 -1
  131. package/dist/dts/BigDecimal.d.ts.map +1 -1
  132. package/dist/dts/BigInt.d.ts +490 -0
  133. package/dist/dts/BigInt.d.ts.map +1 -1
  134. package/dist/dts/Boolean.d.ts +228 -0
  135. package/dist/dts/Boolean.d.ts.map +1 -1
  136. package/dist/dts/Cause.d.ts +172 -0
  137. package/dist/dts/Cause.d.ts.map +1 -1
  138. package/dist/dts/Channel.d.ts +750 -0
  139. package/dist/dts/Channel.d.ts.map +1 -1
  140. package/dist/dts/ChildExecutorDecision.d.ts +12 -0
  141. package/dist/dts/ChildExecutorDecision.d.ts.map +1 -1
  142. package/dist/dts/Chunk.d.ts +791 -0
  143. package/dist/dts/Chunk.d.ts.map +1 -1
  144. package/dist/dts/Config.d.ts +174 -0
  145. package/dist/dts/Config.d.ts.map +1 -1
  146. package/dist/dts/ConfigError.d.ts +16 -0
  147. package/dist/dts/ConfigError.d.ts.map +1 -1
  148. package/dist/dts/ConfigProvider.d.ts +84 -0
  149. package/dist/dts/ConfigProvider.d.ts.map +1 -1
  150. package/dist/dts/ConfigProviderPathPatch.d.ts +32 -0
  151. package/dist/dts/ConfigProviderPathPatch.d.ts.map +1 -1
  152. package/dist/dts/Console.d.ts +24 -0
  153. package/dist/dts/Console.d.ts.map +1 -1
  154. package/dist/dts/Context.d.ts +232 -0
  155. package/dist/dts/Context.d.ts.map +1 -1
  156. package/dist/dts/Cron.d.ts +12 -0
  157. package/dist/dts/Cron.d.ts.map +1 -1
  158. package/dist/dts/Data.d.ts +165 -0
  159. package/dist/dts/Data.d.ts.map +1 -1
  160. package/dist/dts/DateTime.d.ts +878 -0
  161. package/dist/dts/DateTime.d.ts.map +1 -1
  162. package/dist/dts/Deferred.d.ts +170 -0
  163. package/dist/dts/Deferred.d.ts.map +1 -1
  164. package/dist/dts/Differ.d.ts +78 -0
  165. package/dist/dts/Differ.d.ts.map +1 -1
  166. package/dist/dts/Duration.d.ts +130 -0
  167. package/dist/dts/Duration.d.ts.map +1 -1
  168. package/dist/dts/Effect.d.ts +4117 -3
  169. package/dist/dts/Effect.d.ts.map +1 -1
  170. package/dist/dts/Either.d.ts +620 -0
  171. package/dist/dts/Either.d.ts.map +1 -1
  172. package/dist/dts/Equivalence.d.ts +24 -0
  173. package/dist/dts/Equivalence.d.ts.map +1 -1
  174. package/dist/dts/ExecutionStrategy.d.ts +14 -0
  175. package/dist/dts/ExecutionStrategy.d.ts.map +1 -1
  176. package/dist/dts/Exit.d.ts +252 -0
  177. package/dist/dts/Exit.d.ts.map +1 -1
  178. package/dist/dts/Fiber.d.ts +182 -0
  179. package/dist/dts/Fiber.d.ts.map +1 -1
  180. package/dist/dts/FiberHandle.d.ts +42 -0
  181. package/dist/dts/FiberHandle.d.ts.map +1 -1
  182. package/dist/dts/FiberId.d.ts +24 -0
  183. package/dist/dts/FiberId.d.ts.map +1 -1
  184. package/dist/dts/FiberMap.d.ts +102 -0
  185. package/dist/dts/FiberMap.d.ts.map +1 -1
  186. package/dist/dts/FiberRef.d.ts +80 -0
  187. package/dist/dts/FiberRef.d.ts.map +1 -1
  188. package/dist/dts/FiberRefs.d.ts +84 -0
  189. package/dist/dts/FiberRefs.d.ts.map +1 -1
  190. package/dist/dts/FiberRefsPatch.d.ts +30 -0
  191. package/dist/dts/FiberRefsPatch.d.ts.map +1 -1
  192. package/dist/dts/FiberSet.d.ts +38 -0
  193. package/dist/dts/FiberSet.d.ts.map +1 -1
  194. package/dist/dts/Function.d.ts +144 -28
  195. package/dist/dts/Function.d.ts.map +1 -1
  196. package/dist/dts/GroupBy.d.ts +38 -0
  197. package/dist/dts/GroupBy.d.ts.map +1 -1
  198. package/dist/dts/Hash.d.ts +8 -0
  199. package/dist/dts/Hash.d.ts.map +1 -1
  200. package/dist/dts/HashMap.d.ts +300 -0
  201. package/dist/dts/HashMap.d.ts.map +1 -1
  202. package/dist/dts/HashSet.d.ts +284 -0
  203. package/dist/dts/HashSet.d.ts.map +1 -1
  204. package/dist/dts/Iterable.d.ts +454 -0
  205. package/dist/dts/Iterable.d.ts.map +1 -1
  206. package/dist/dts/KeyedPool.d.ts +34 -0
  207. package/dist/dts/KeyedPool.d.ts.map +1 -1
  208. package/dist/dts/Layer.d.ts +414 -0
  209. package/dist/dts/Layer.d.ts.map +1 -1
  210. package/dist/dts/List.d.ts +430 -0
  211. package/dist/dts/List.d.ts.map +1 -1
  212. package/dist/dts/LogLevel.d.ts +46 -0
  213. package/dist/dts/LogLevel.d.ts.map +1 -1
  214. package/dist/dts/Logger.d.ts +194 -0
  215. package/dist/dts/Logger.d.ts.map +1 -1
  216. package/dist/dts/Mailbox.d.ts +16 -0
  217. package/dist/dts/Mailbox.d.ts.map +1 -1
  218. package/dist/dts/MergeDecision.d.ts +8 -0
  219. package/dist/dts/MergeDecision.d.ts.map +1 -1
  220. package/dist/dts/MergeState.d.ts +8 -0
  221. package/dist/dts/MergeState.d.ts.map +1 -1
  222. package/dist/dts/MergeStrategy.d.ts +12 -0
  223. package/dist/dts/MergeStrategy.d.ts.map +1 -1
  224. package/dist/dts/Metric.d.ts +410 -0
  225. package/dist/dts/Metric.d.ts.map +1 -1
  226. package/dist/dts/MetricHook.d.ts +24 -0
  227. package/dist/dts/MetricHook.d.ts.map +1 -1
  228. package/dist/dts/MetricKey.d.ts +48 -0
  229. package/dist/dts/MetricKey.d.ts.map +1 -1
  230. package/dist/dts/MetricPolling.d.ts +40 -0
  231. package/dist/dts/MetricPolling.d.ts.map +1 -1
  232. package/dist/dts/MetricState.d.ts +16 -0
  233. package/dist/dts/MetricState.d.ts.map +1 -1
  234. package/dist/dts/Micro.d.ts +1203 -25
  235. package/dist/dts/Micro.d.ts.map +1 -1
  236. package/dist/dts/MutableHashMap.d.ts +50 -0
  237. package/dist/dts/MutableHashMap.d.ts.map +1 -1
  238. package/dist/dts/MutableHashSet.d.ts +24 -0
  239. package/dist/dts/MutableHashSet.d.ts.map +1 -1
  240. package/dist/dts/MutableList.d.ts +36 -0
  241. package/dist/dts/MutableList.d.ts.map +1 -1
  242. package/dist/dts/MutableQueue.d.ts +62 -0
  243. package/dist/dts/MutableQueue.d.ts.map +1 -1
  244. package/dist/dts/MutableRef.d.ts +56 -0
  245. package/dist/dts/MutableRef.d.ts.map +1 -1
  246. package/dist/dts/Number.d.ts +474 -0
  247. package/dist/dts/Number.d.ts.map +1 -1
  248. package/dist/dts/Option.d.ts +1019 -0
  249. package/dist/dts/Option.d.ts.map +1 -1
  250. package/dist/dts/Order.d.ts +24 -0
  251. package/dist/dts/Order.d.ts.map +1 -1
  252. package/dist/dts/Ordering.d.ts +66 -0
  253. package/dist/dts/Ordering.d.ts.map +1 -1
  254. package/dist/dts/Pipeable.d.ts +21 -21
  255. package/dist/dts/Pipeable.d.ts.map +1 -1
  256. package/dist/dts/Pool.d.ts +16 -0
  257. package/dist/dts/Pool.d.ts.map +1 -1
  258. package/dist/dts/Predicate.d.ts +498 -0
  259. package/dist/dts/Predicate.d.ts.map +1 -1
  260. package/dist/dts/PubSub.d.ts +28 -0
  261. package/dist/dts/PubSub.d.ts.map +1 -1
  262. package/dist/dts/Queue.d.ts +104 -0
  263. package/dist/dts/Queue.d.ts.map +1 -1
  264. package/dist/dts/RcMap.d.ts +70 -0
  265. package/dist/dts/RcMap.d.ts.map +1 -1
  266. package/dist/dts/Readable.d.ts +16 -0
  267. package/dist/dts/Readable.d.ts.map +1 -1
  268. package/dist/dts/Record.d.ts +800 -0
  269. package/dist/dts/Record.d.ts.map +1 -1
  270. package/dist/dts/RedBlackTree.d.ts +300 -0
  271. package/dist/dts/RedBlackTree.d.ts.map +1 -1
  272. package/dist/dts/Ref.d.ts +88 -0
  273. package/dist/dts/Ref.d.ts.map +1 -1
  274. package/dist/dts/Request.d.ts +76 -0
  275. package/dist/dts/Request.d.ts.map +1 -1
  276. package/dist/dts/RequestResolver.d.ts +144 -0
  277. package/dist/dts/RequestResolver.d.ts.map +1 -1
  278. package/dist/dts/Runtime.d.ts +126 -0
  279. package/dist/dts/Runtime.d.ts.map +1 -1
  280. package/dist/dts/RuntimeFlags.d.ts +100 -0
  281. package/dist/dts/RuntimeFlags.d.ts.map +1 -1
  282. package/dist/dts/RuntimeFlagsPatch.d.ts +112 -0
  283. package/dist/dts/RuntimeFlagsPatch.d.ts.map +1 -1
  284. package/dist/dts/STM.d.ts +1090 -0
  285. package/dist/dts/STM.d.ts.map +1 -1
  286. package/dist/dts/Schedule.d.ts +704 -0
  287. package/dist/dts/Schedule.d.ts.map +1 -1
  288. package/dist/dts/ScheduleInterval.d.ts +68 -0
  289. package/dist/dts/ScheduleInterval.d.ts.map +1 -1
  290. package/dist/dts/ScheduleIntervals.d.ts +50 -0
  291. package/dist/dts/ScheduleIntervals.d.ts.map +1 -1
  292. package/dist/dts/Scope.d.ts +76 -15
  293. package/dist/dts/Scope.d.ts.map +1 -1
  294. package/dist/dts/ScopedRef.d.ts +22 -0
  295. package/dist/dts/ScopedRef.d.ts.map +1 -1
  296. package/dist/dts/Sink.d.ts +464 -0
  297. package/dist/dts/Sink.d.ts.map +1 -1
  298. package/dist/dts/SortedMap.d.ts +76 -0
  299. package/dist/dts/SortedMap.d.ts.map +1 -1
  300. package/dist/dts/SortedSet.d.ts +142 -0
  301. package/dist/dts/SortedSet.d.ts.map +1 -1
  302. package/dist/dts/Stream.d.ts +4998 -1
  303. package/dist/dts/Stream.d.ts.map +1 -1
  304. package/dist/dts/StreamHaltStrategy.d.ts +12 -0
  305. package/dist/dts/StreamHaltStrategy.d.ts.map +1 -1
  306. package/dist/dts/String.d.ts +200 -0
  307. package/dist/dts/String.d.ts.map +1 -1
  308. package/dist/dts/Struct.d.ts +84 -0
  309. package/dist/dts/Struct.d.ts.map +1 -1
  310. package/dist/dts/Subscribable.d.ts +16 -0
  311. package/dist/dts/Subscribable.d.ts.map +1 -1
  312. package/dist/dts/SubscriptionRef.d.ts +152 -0
  313. package/dist/dts/SubscriptionRef.d.ts.map +1 -1
  314. package/dist/dts/SynchronizedRef.d.ts +152 -0
  315. package/dist/dts/SynchronizedRef.d.ts.map +1 -1
  316. package/dist/dts/TArray.d.ts +426 -0
  317. package/dist/dts/TArray.d.ts.map +1 -1
  318. package/dist/dts/TDeferred.d.ts +24 -0
  319. package/dist/dts/TDeferred.d.ts.map +1 -1
  320. package/dist/dts/TMap.d.ts +366 -0
  321. package/dist/dts/TMap.d.ts.map +1 -1
  322. package/dist/dts/TPriorityQueue.d.ts +60 -0
  323. package/dist/dts/TPriorityQueue.d.ts.map +1 -1
  324. package/dist/dts/TPubSub.d.ts +28 -0
  325. package/dist/dts/TPubSub.d.ts.map +1 -1
  326. package/dist/dts/TQueue.d.ts +108 -0
  327. package/dist/dts/TQueue.d.ts.map +1 -1
  328. package/dist/dts/TReentrantLock.d.ts +36 -0
  329. package/dist/dts/TReentrantLock.d.ts.map +1 -1
  330. package/dist/dts/TRef.d.ts +88 -0
  331. package/dist/dts/TRef.d.ts.map +1 -1
  332. package/dist/dts/TSemaphore.d.ts +40 -0
  333. package/dist/dts/TSemaphore.d.ts.map +1 -1
  334. package/dist/dts/TSet.d.ts +254 -0
  335. package/dist/dts/TSet.d.ts.map +1 -1
  336. package/dist/dts/Take.d.ts +56 -0
  337. package/dist/dts/Take.d.ts.map +1 -1
  338. package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
  339. package/dist/dts/TestClock.d.ts.map +1 -1
  340. package/dist/dts/TestServices.d.ts.map +1 -1
  341. package/dist/dts/Trie.d.ts +906 -0
  342. package/dist/dts/Trie.d.ts.map +1 -1
  343. package/dist/dts/Tuple.d.ts +144 -0
  344. package/dist/dts/Tuple.d.ts.map +1 -1
  345. package/dist/dts/Unify.d.ts +18 -0
  346. package/dist/dts/Unify.d.ts.map +1 -1
  347. package/dist/dts/UpstreamPullRequest.d.ts +12 -0
  348. package/dist/dts/UpstreamPullRequest.d.ts.map +1 -1
  349. package/dist/dts/UpstreamPullStrategy.d.ts +12 -0
  350. package/dist/dts/UpstreamPullStrategy.d.ts.map +1 -1
  351. package/dist/dts/Utils.d.ts.map +1 -1
  352. package/dist/dts/internal/stream.d.ts.map +1 -1
  353. package/dist/esm/Array.js.map +1 -1
  354. package/dist/esm/BigDecimal.js +2 -2
  355. package/dist/esm/BigDecimal.js.map +1 -1
  356. package/dist/esm/BigInt.js.map +1 -1
  357. package/dist/esm/Boolean.js.map +1 -1
  358. package/dist/esm/Cause.js.map +1 -1
  359. package/dist/esm/Channel.js.map +1 -1
  360. package/dist/esm/ChildExecutorDecision.js.map +1 -1
  361. package/dist/esm/Chunk.js.map +1 -1
  362. package/dist/esm/Config.js.map +1 -1
  363. package/dist/esm/ConfigError.js.map +1 -1
  364. package/dist/esm/ConfigProvider.js.map +1 -1
  365. package/dist/esm/ConfigProviderPathPatch.js.map +1 -1
  366. package/dist/esm/Console.js.map +1 -1
  367. package/dist/esm/Context.js.map +1 -1
  368. package/dist/esm/Cron.js.map +1 -1
  369. package/dist/esm/Data.js.map +1 -1
  370. package/dist/esm/DateTime.js.map +1 -1
  371. package/dist/esm/Deferred.js.map +1 -1
  372. package/dist/esm/Differ.js.map +1 -1
  373. package/dist/esm/Duration.js.map +1 -1
  374. package/dist/esm/Effect.js.map +1 -1
  375. package/dist/esm/Either.js.map +1 -1
  376. package/dist/esm/Equivalence.js.map +1 -1
  377. package/dist/esm/ExecutionStrategy.js.map +1 -1
  378. package/dist/esm/Exit.js.map +1 -1
  379. package/dist/esm/Fiber.js.map +1 -1
  380. package/dist/esm/FiberHandle.js.map +1 -1
  381. package/dist/esm/FiberId.js.map +1 -1
  382. package/dist/esm/FiberMap.js.map +1 -1
  383. package/dist/esm/FiberRef.js.map +1 -1
  384. package/dist/esm/FiberRefs.js.map +1 -1
  385. package/dist/esm/FiberRefsPatch.js.map +1 -1
  386. package/dist/esm/FiberSet.js.map +1 -1
  387. package/dist/esm/Function.js.map +1 -1
  388. package/dist/esm/GroupBy.js.map +1 -1
  389. package/dist/esm/Hash.js.map +1 -1
  390. package/dist/esm/HashMap.js.map +1 -1
  391. package/dist/esm/HashSet.js.map +1 -1
  392. package/dist/esm/Iterable.js.map +1 -1
  393. package/dist/esm/KeyedPool.js.map +1 -1
  394. package/dist/esm/Layer.js.map +1 -1
  395. package/dist/esm/List.js.map +1 -1
  396. package/dist/esm/LogLevel.js.map +1 -1
  397. package/dist/esm/Logger.js.map +1 -1
  398. package/dist/esm/Mailbox.js.map +1 -1
  399. package/dist/esm/MergeDecision.js.map +1 -1
  400. package/dist/esm/MergeState.js.map +1 -1
  401. package/dist/esm/MergeStrategy.js.map +1 -1
  402. package/dist/esm/Metric.js.map +1 -1
  403. package/dist/esm/MetricHook.js.map +1 -1
  404. package/dist/esm/MetricKey.js.map +1 -1
  405. package/dist/esm/MetricPolling.js.map +1 -1
  406. package/dist/esm/MetricState.js.map +1 -1
  407. package/dist/esm/Micro.js +50 -20
  408. package/dist/esm/Micro.js.map +1 -1
  409. package/dist/esm/MutableHashMap.js.map +1 -1
  410. package/dist/esm/MutableHashSet.js.map +1 -1
  411. package/dist/esm/MutableList.js.map +1 -1
  412. package/dist/esm/MutableQueue.js.map +1 -1
  413. package/dist/esm/MutableRef.js.map +1 -1
  414. package/dist/esm/Number.js.map +1 -1
  415. package/dist/esm/Option.js.map +1 -1
  416. package/dist/esm/Order.js.map +1 -1
  417. package/dist/esm/Ordering.js.map +1 -1
  418. package/dist/esm/Pipeable.js.map +1 -1
  419. package/dist/esm/Pool.js.map +1 -1
  420. package/dist/esm/Predicate.js.map +1 -1
  421. package/dist/esm/PubSub.js.map +1 -1
  422. package/dist/esm/Queue.js.map +1 -1
  423. package/dist/esm/RcMap.js.map +1 -1
  424. package/dist/esm/Readable.js.map +1 -1
  425. package/dist/esm/Record.js.map +1 -1
  426. package/dist/esm/RedBlackTree.js.map +1 -1
  427. package/dist/esm/Ref.js.map +1 -1
  428. package/dist/esm/Request.js.map +1 -1
  429. package/dist/esm/RequestResolver.js.map +1 -1
  430. package/dist/esm/Runtime.js.map +1 -1
  431. package/dist/esm/RuntimeFlags.js.map +1 -1
  432. package/dist/esm/RuntimeFlagsPatch.js.map +1 -1
  433. package/dist/esm/STM.js.map +1 -1
  434. package/dist/esm/Schedule.js.map +1 -1
  435. package/dist/esm/ScheduleInterval.js.map +1 -1
  436. package/dist/esm/ScheduleIntervals.js.map +1 -1
  437. package/dist/esm/Scheduler.js.map +1 -1
  438. package/dist/esm/Scope.js +25 -15
  439. package/dist/esm/Scope.js.map +1 -1
  440. package/dist/esm/ScopedRef.js.map +1 -1
  441. package/dist/esm/Sink.js.map +1 -1
  442. package/dist/esm/SortedMap.js.map +1 -1
  443. package/dist/esm/SortedSet.js.map +1 -1
  444. package/dist/esm/Stream.js +14 -0
  445. package/dist/esm/Stream.js.map +1 -1
  446. package/dist/esm/StreamHaltStrategy.js.map +1 -1
  447. package/dist/esm/String.js.map +1 -1
  448. package/dist/esm/Struct.js.map +1 -1
  449. package/dist/esm/Subscribable.js.map +1 -1
  450. package/dist/esm/SubscriptionRef.js.map +1 -1
  451. package/dist/esm/SynchronizedRef.js.map +1 -1
  452. package/dist/esm/TArray.js.map +1 -1
  453. package/dist/esm/TDeferred.js.map +1 -1
  454. package/dist/esm/TMap.js.map +1 -1
  455. package/dist/esm/TPriorityQueue.js.map +1 -1
  456. package/dist/esm/TPubSub.js.map +1 -1
  457. package/dist/esm/TQueue.js.map +1 -1
  458. package/dist/esm/TReentrantLock.js.map +1 -1
  459. package/dist/esm/TRef.js.map +1 -1
  460. package/dist/esm/TSemaphore.js.map +1 -1
  461. package/dist/esm/TSet.js.map +1 -1
  462. package/dist/esm/Take.js.map +1 -1
  463. package/dist/esm/TestAnnotationMap.js.map +1 -1
  464. package/dist/esm/TestClock.js.map +1 -1
  465. package/dist/esm/TestServices.js.map +1 -1
  466. package/dist/esm/Trie.js.map +1 -1
  467. package/dist/esm/Tuple.js.map +1 -1
  468. package/dist/esm/Unify.js.map +1 -1
  469. package/dist/esm/UpstreamPullRequest.js.map +1 -1
  470. package/dist/esm/UpstreamPullStrategy.js.map +1 -1
  471. package/dist/esm/Utils.js +1 -14
  472. package/dist/esm/Utils.js.map +1 -1
  473. package/dist/esm/internal/core.js +1 -1
  474. package/dist/esm/internal/core.js.map +1 -1
  475. package/dist/esm/internal/runtime.js +1 -1
  476. package/dist/esm/internal/runtime.js.map +1 -1
  477. package/dist/esm/internal/stream.js +9 -0
  478. package/dist/esm/internal/stream.js.map +1 -1
  479. package/dist/esm/internal/version.js +1 -1
  480. package/package.json +1 -1
  481. package/src/Array.ts +2723 -36
  482. package/src/BigDecimal.ts +585 -18
  483. package/src/BigInt.ts +516 -16
  484. package/src/Boolean.ts +241 -8
  485. package/src/Cause.ts +177 -1
  486. package/src/Channel.ts +766 -49
  487. package/src/ChildExecutorDecision.ts +12 -0
  488. package/src/Chunk.ts +818 -4
  489. package/src/Config.ts +187 -8
  490. package/src/ConfigError.ts +16 -0
  491. package/src/ConfigProvider.ts +89 -1
  492. package/src/ConfigProviderPathPatch.ts +32 -0
  493. package/src/Console.ts +37 -8
  494. package/src/Context.ts +232 -0
  495. package/src/Cron.ts +12 -0
  496. package/src/Data.ts +165 -0
  497. package/src/DateTime.ts +1006 -50
  498. package/src/Deferred.ts +170 -0
  499. package/src/Differ.ts +89 -27
  500. package/src/Duration.ts +156 -16
  501. package/src/Effect.ts +4297 -123
  502. package/src/Either.ts +650 -34
  503. package/src/Equivalence.ts +24 -0
  504. package/src/ExecutionStrategy.ts +29 -10
  505. package/src/Exit.ts +252 -0
  506. package/src/Fiber.ts +182 -0
  507. package/src/FiberHandle.ts +42 -0
  508. package/src/FiberId.ts +24 -0
  509. package/src/FiberMap.ts +144 -21
  510. package/src/FiberRef.ts +80 -0
  511. package/src/FiberRefs.ts +84 -0
  512. package/src/FiberRefsPatch.ts +35 -1
  513. package/src/FiberSet.ts +38 -0
  514. package/src/Function.ts +416 -31
  515. package/src/GroupBy.ts +38 -0
  516. package/src/Hash.ts +8 -0
  517. package/src/HashMap.ts +300 -0
  518. package/src/HashSet.ts +284 -0
  519. package/src/Iterable.ts +456 -6
  520. package/src/KeyedPool.ts +34 -0
  521. package/src/Layer.ts +426 -30
  522. package/src/List.ts +476 -3
  523. package/src/LogLevel.ts +46 -0
  524. package/src/Logger.ts +195 -4
  525. package/src/Mailbox.ts +16 -0
  526. package/src/MergeDecision.ts +8 -0
  527. package/src/MergeState.ts +8 -0
  528. package/src/MergeStrategy.ts +25 -8
  529. package/src/Metric.ts +426 -15
  530. package/src/MetricHook.ts +24 -0
  531. package/src/MetricKey.ts +62 -8
  532. package/src/MetricPolling.ts +42 -6
  533. package/src/MetricState.ts +16 -0
  534. package/src/Micro.ts +1350 -102
  535. package/src/MutableHashMap.ts +105 -1
  536. package/src/MutableHashSet.ts +24 -0
  537. package/src/MutableList.ts +36 -0
  538. package/src/MutableQueue.ts +62 -0
  539. package/src/MutableRef.ts +56 -0
  540. package/src/Number.ts +500 -16
  541. package/src/Option.ts +1042 -16
  542. package/src/Order.ts +24 -0
  543. package/src/Ordering.ts +66 -0
  544. package/src/Pipeable.ts +224 -21
  545. package/src/Pool.ts +16 -0
  546. package/src/Predicate.ts +498 -0
  547. package/src/PubSub.ts +28 -0
  548. package/src/Queue.ts +104 -0
  549. package/src/RcMap.ts +70 -0
  550. package/src/Readable.ts +18 -7
  551. package/src/Record.ts +814 -40
  552. package/src/RedBlackTree.ts +305 -1
  553. package/src/Ref.ts +88 -0
  554. package/src/Request.ts +76 -0
  555. package/src/RequestResolver.ts +145 -4
  556. package/src/Runtime.ts +134 -2
  557. package/src/RuntimeFlags.ts +100 -0
  558. package/src/RuntimeFlagsPatch.ts +112 -0
  559. package/src/STM.ts +1107 -11
  560. package/src/Schedule.ts +704 -0
  561. package/src/ScheduleInterval.ts +68 -0
  562. package/src/ScheduleIntervals.ts +50 -0
  563. package/src/Scheduler.ts +2 -0
  564. package/src/Scope.ts +83 -15
  565. package/src/ScopedRef.ts +22 -0
  566. package/src/Sink.ts +464 -0
  567. package/src/SortedMap.ts +76 -0
  568. package/src/SortedSet.ts +143 -3
  569. package/src/Stream.ts +5041 -54
  570. package/src/StreamHaltStrategy.ts +29 -12
  571. package/src/String.ts +200 -0
  572. package/src/Struct.ts +86 -7
  573. package/src/Subscribable.ts +16 -0
  574. package/src/SubscriptionRef.ts +159 -11
  575. package/src/SynchronizedRef.ts +169 -8
  576. package/src/TArray.ts +431 -1
  577. package/src/TDeferred.ts +24 -0
  578. package/src/TMap.ts +381 -12
  579. package/src/TPriorityQueue.ts +60 -0
  580. package/src/TPubSub.ts +28 -0
  581. package/src/TQueue.ts +108 -0
  582. package/src/TReentrantLock.ts +36 -0
  583. package/src/TRef.ts +88 -0
  584. package/src/TSemaphore.ts +40 -0
  585. package/src/TSet.ts +280 -12
  586. package/src/Take.ts +56 -0
  587. package/src/TestAnnotationMap.ts +45 -1
  588. package/src/TestClock.ts +6 -0
  589. package/src/TestServices.ts +66 -0
  590. package/src/Trie.ts +906 -0
  591. package/src/Tuple.ts +157 -8
  592. package/src/Unify.ts +19 -3
  593. package/src/UpstreamPullRequest.ts +12 -0
  594. package/src/UpstreamPullStrategy.ts +12 -0
  595. package/src/Utils.ts +1 -15
  596. package/src/internal/core.ts +1 -1
  597. package/src/internal/runtime.ts +1 -1
  598. package/src/internal/stream.ts +27 -0
  599. package/src/internal/version.ts +1 -1
package/src/Micro.ts CHANGED
@@ -64,11 +64,11 @@ export type runSymbol = typeof runSymbol
64
64
  */
65
65
  export interface Micro<out A, out E = never, out R = never> extends Effect<A, E, R> {
66
66
  readonly [TypeId]: Micro.Variance<A, E, R>
67
- readonly [runSymbol]: (env: Env<any>, onExit: (exit: MicroExit<A, E>) => void) => void
67
+ [runSymbol](env: Env<any>, onExit: (exit: MicroExit<A, E>) => void): void
68
+ [Symbol.iterator](): MicroIterator<Micro<A, E, R>>
68
69
  [Unify.typeSymbol]?: unknown
69
70
  [Unify.unifySymbol]?: MicroUnify<this>
70
71
  [Unify.ignoreSymbol]?: MicroUnifyIgnore
71
- [Symbol.iterator](): MicroIterator<Micro<A, E, R>>
72
72
  }
73
73
 
74
74
  /**
@@ -144,6 +144,58 @@ export interface MicroIterator<T extends Micro<any, any, any>> {
144
144
  next(...args: ReadonlyArray<any>): IteratorResult<YieldWrap<T>, Micro.Success<T>>
145
145
  }
146
146
 
147
+ /**
148
+ * @since 3.8.4
149
+ * @experimental
150
+ * @category models
151
+ */
152
+ export interface MicroClass {
153
+ new<A, E = never, R = never>(): Micro<A, E, R>
154
+ }
155
+
156
+ // ----------------------------------------------------------------------------
157
+ // Microable
158
+ // ----------------------------------------------------------------------------
159
+
160
+ const MicroProto = {
161
+ ...Effectable.EffectPrototype,
162
+ _op: "Micro",
163
+ [TypeId]: {
164
+ _A: identity,
165
+ _E: identity,
166
+ _R: identity
167
+ },
168
+ [Symbol.iterator]() {
169
+ return new SingleShotGen(new YieldWrap(this)) as any
170
+ }
171
+ }
172
+
173
+ const MicroBase: MicroClass = (function() {
174
+ function Base() {}
175
+ Base.prototype = MicroProto
176
+ return Base as any
177
+ })()
178
+
179
+ /**
180
+ * @since 3.8.4
181
+ * @experimental
182
+ * @category constructors
183
+ */
184
+ export abstract class Class<out A, out E = never, out R = never> extends MicroBase<A, E, R> {
185
+ /**
186
+ * @since 3.8.4
187
+ * @experimental
188
+ */
189
+ abstract asMicro(): Micro<A, E, R>
190
+ /**
191
+ * @since 3.8.4
192
+ * @experimental
193
+ */
194
+ [runSymbol](env: Env<any>, onExit: (exit: MicroExit<A, E>) => void): void {
195
+ this.asMicro()[runSymbol](env, onExit)
196
+ }
197
+ }
198
+
147
199
  // ----------------------------------------------------------------------------
148
200
  // MicroCause
149
201
  // ----------------------------------------------------------------------------
@@ -351,7 +403,17 @@ export const causeSquash = <E>(self: MicroCause<E>): unknown =>
351
403
  * @category MicroCause
352
404
  */
353
405
  export const causeWithTrace: {
406
+ /**
407
+ * @since 3.4.6
408
+ * @experimental
409
+ * @category MicroCause
410
+ */
354
411
  (trace: string): <E>(self: MicroCause<E>) => MicroCause<E>
412
+ /**
413
+ * @since 3.4.6
414
+ * @experimental
415
+ * @category MicroCause
416
+ */
355
417
  <E>(self: MicroCause<E>, trace: string): MicroCause<E>
356
418
  } = dual(2, <E>(self: MicroCause<E>, trace: string): MicroCause<E> => {
357
419
  const traces = [...self.traces, trace]
@@ -512,31 +574,6 @@ export interface Env<R> extends Pipeable {
512
574
  readonly refs: ReadonlyRecord<string, unknown>
513
575
  }
514
576
 
515
- /**
516
- * @since 3.4.0
517
- * @experimental
518
- * @category environment
519
- */
520
- export const EnvRefTypeId: unique symbol = Symbol.for("effect/Micro/EnvRef")
521
-
522
- /**
523
- * @since 3.4.0
524
- * @experimental
525
- * @category environment
526
- */
527
- export type EnvRefTypeId = typeof EnvRefTypeId
528
-
529
- /**
530
- * @since 3.4.0
531
- * @experimental
532
- * @category environment
533
- */
534
- export interface EnvRef<A> {
535
- readonly [EnvRefTypeId]: EnvRefTypeId
536
- readonly key: string
537
- readonly initial: A
538
- }
539
-
540
577
  const EnvProto = {
541
578
  [EnvTypeId]: {
542
579
  _R: identity
@@ -579,7 +616,17 @@ export const envUnsafeMakeEmpty = (): Env<never> => {
579
616
  * @category environment
580
617
  */
581
618
  export const envGet: {
619
+ /**
620
+ * @since 3.4.0
621
+ * @experimental
622
+ * @category environment
623
+ */
582
624
  <A>(ref: EnvRef<A>): <R>(self: Env<R>) => A
625
+ /**
626
+ * @since 3.4.0
627
+ * @experimental
628
+ * @category environment
629
+ */
583
630
  <A, R>(self: Env<R>, ref: EnvRef<A>): A
584
631
  } = dual(2, <R, A>(self: Env<R>, ref: EnvRef<A>): A => ref.key in self.refs ? (self.refs[ref.key] as A) : ref.initial)
585
632
 
@@ -589,7 +636,17 @@ export const envGet: {
589
636
  * @category environment
590
637
  */
591
638
  export const envSet: {
639
+ /**
640
+ * @since 3.4.0
641
+ * @experimental
642
+ * @category environment
643
+ */
592
644
  <A>(ref: EnvRef<A>, value: A): <R>(self: Env<R>) => Env<R>
645
+ /**
646
+ * @since 3.4.0
647
+ * @experimental
648
+ * @category environment
649
+ */
593
650
  <A, R>(self: Env<R>, ref: EnvRef<A>, value: A): Env<R>
594
651
  } = dual(3, <R, A>(self: Env<R>, ref: EnvRef<A>, value: A): Env<R> => {
595
652
  const refs = Object.assign(Object.create(null), self.refs)
@@ -603,7 +660,17 @@ export const envSet: {
603
660
  * @category environment
604
661
  */
605
662
  export const envMutate: {
663
+ /**
664
+ * @since 3.4.0
665
+ * @experimental
666
+ * @category environment
667
+ */
606
668
  (f: (map: Record<string, unknown>) => void): <R>(self: Env<R>) => Env<R>
669
+ /**
670
+ * @since 3.4.0
671
+ * @experimental
672
+ * @category environment
673
+ */
607
674
  <R>(self: Env<R>, f: (map: Record<string, unknown>) => void): Env<R>
608
675
  } = dual(
609
676
  2,
@@ -657,7 +724,21 @@ export const getEnvRef = <A>(envRef: EnvRef<A>): Micro<A> =>
657
724
  * @category environment
658
725
  */
659
726
  export const locally: {
727
+ /**
728
+ * Set the value of the given `EnvRef` for the duration of the effect.
729
+ *
730
+ * @since 3.4.0
731
+ * @experimental
732
+ * @category environment
733
+ */
660
734
  <A>(fiberRef: EnvRef<A>, value: A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R>
735
+ /**
736
+ * Set the value of the given `EnvRef` for the duration of the effect.
737
+ *
738
+ * @since 3.4.0
739
+ * @experimental
740
+ * @category environment
741
+ */
661
742
  <XA, E, R, A>(self: Micro<XA, E, R>, fiberRef: EnvRef<A>, value: A): Micro<XA, E, R>
662
743
  } = dual(
663
744
  3,
@@ -682,7 +763,21 @@ export const context = <R>(): Micro<Context.Context<R>> => getEnvRef(currentCont
682
763
  * @category environment
683
764
  */
684
765
  export const provideContext: {
766
+ /**
767
+ * Merge the given `Context` with the current context.
768
+ *
769
+ * @since 3.4.0
770
+ * @experimental
771
+ * @category environment
772
+ */
685
773
  <XR>(context: Context.Context<XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, XR>>
774
+ /**
775
+ * Merge the given `Context` with the current context.
776
+ *
777
+ * @since 3.4.0
778
+ * @experimental
779
+ * @category environment
780
+ */
686
781
  <A, E, R, XR>(self: Micro<A, E, R>, context: Context.Context<XR>): Micro<A, E, Exclude<R, XR>>
687
782
  } = dual(
688
783
  2,
@@ -702,7 +797,21 @@ export const provideContext: {
702
797
  * @category environment
703
798
  */
704
799
  export const provideService: {
800
+ /**
801
+ * Add the provided service to the current context.
802
+ *
803
+ * @since 3.4.0
804
+ * @experimental
805
+ * @category environment
806
+ */
705
807
  <I, S>(tag: Context.Tag<I, S>, service: S): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, I>>
808
+ /**
809
+ * Add the provided service to the current context.
810
+ *
811
+ * @since 3.4.0
812
+ * @experimental
813
+ * @category environment
814
+ */
706
815
  <A, E, R, I, S>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, service: S): Micro<A, E, Exclude<R, I>>
707
816
  } = dual(
708
817
  3,
@@ -723,10 +832,26 @@ export const provideService: {
723
832
  * @category environment
724
833
  */
725
834
  export const provideServiceEffect: {
835
+ /**
836
+ * Create a service using the provided `Micro` effect, and add it to the
837
+ * current context.
838
+ *
839
+ * @since 3.4.6
840
+ * @experimental
841
+ * @category environment
842
+ */
726
843
  <I, S, E2, R2>(
727
844
  tag: Context.Tag<I, S>,
728
845
  acquire: Micro<S, E2, R2>
729
846
  ): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | E2, Exclude<R, I> | R2>
847
+ /**
848
+ * Create a service using the provided `Micro` effect, and add it to the
849
+ * current context.
850
+ *
851
+ * @since 3.4.6
852
+ * @experimental
853
+ * @category environment
854
+ */
730
855
  <A, E, R, I, S, E2, R2>(
731
856
  self: Micro<A, E, R>,
732
857
  tag: Context.Tag<I, S>,
@@ -818,8 +943,59 @@ export class MicroSchedulerDefault implements MicroScheduler {
818
943
  // Env refs
819
944
  // ========================================================================
820
945
 
821
- const EnvRefProto = {
822
- [EnvRefTypeId]: EnvRefTypeId
946
+ /**
947
+ * @since 3.4.0
948
+ * @experimental
949
+ * @category environment
950
+ */
951
+ export const EnvRefTypeId: unique symbol = Symbol.for("effect/Micro/EnvRef")
952
+
953
+ /**
954
+ * @since 3.4.0
955
+ * @experimental
956
+ * @category environment
957
+ */
958
+ export type EnvRefTypeId = typeof EnvRefTypeId
959
+
960
+ /**
961
+ * @since 3.4.0
962
+ * @experimental
963
+ * @category environment
964
+ */
965
+ export interface EnvRef<A> extends Micro<A> {
966
+ readonly [EnvRefTypeId]: EnvRefTypeId
967
+ readonly key: string
968
+ readonly initial: A
969
+
970
+ [Unify.typeSymbol]?: unknown
971
+ [Unify.unifySymbol]?: EnvRefUnify<this>
972
+ [Unify.ignoreSymbol]?: EnvRefUnifyIgnore
973
+ }
974
+
975
+ /**
976
+ * @category models
977
+ * @since 3.8.4
978
+ * @experimental
979
+ */
980
+ export interface EnvRefUnify<A extends { [Unify.typeSymbol]?: any }> extends MicroUnify<A> {
981
+ EnvRef?: () => A[Unify.typeSymbol] extends EnvRef<infer A0> | infer _ ? EnvRef<A0> : never
982
+ }
983
+
984
+ /**
985
+ * @category models
986
+ * @since 3.8.4
987
+ * @experimental
988
+ */
989
+ export interface EnvRefUnifyIgnore extends MicroUnifyIgnore {
990
+ Micro?: true
991
+ }
992
+
993
+ const EnvRefProto: ThisType<EnvRef<any>> = {
994
+ ...MicroProto,
995
+ [EnvRefTypeId]: EnvRefTypeId,
996
+ [runSymbol](env: Env<any>, onExit: (exit: MicroExit<any, any>) => void) {
997
+ getEnvRef(this)[runSymbol](env, onExit)
998
+ }
823
999
  }
824
1000
 
825
1001
  /**
@@ -917,7 +1093,39 @@ export const currentScheduler: EnvRef<MicroScheduler> = envRefMake(
917
1093
  * )
918
1094
  */
919
1095
  export const withConcurrency: {
1096
+ /**
1097
+ * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1098
+ * api to control the concurrency of that `Micro` when it is run.
1099
+ *
1100
+ * @since 3.4.0
1101
+ * @experimental
1102
+ * @category environment refs
1103
+ * @example
1104
+ * import * as Micro from "effect/Micro"
1105
+ *
1106
+ * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
1107
+ * concurrency: "inherit"
1108
+ * }).pipe(
1109
+ * Micro.withConcurrency(2) // use a concurrency of 2
1110
+ * )
1111
+ */
920
1112
  (concurrency: "unbounded" | number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>
1113
+ /**
1114
+ * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1115
+ * api to control the concurrency of that `Micro` when it is run.
1116
+ *
1117
+ * @since 3.4.0
1118
+ * @experimental
1119
+ * @category environment refs
1120
+ * @example
1121
+ * import * as Micro from "effect/Micro"
1122
+ *
1123
+ * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
1124
+ * concurrency: "inherit"
1125
+ * }).pipe(
1126
+ * Micro.withConcurrency(2) // use a concurrency of 2
1127
+ * )
1128
+ */
921
1129
  <A, E, R>(self: Micro<A, E, R>, concurrency: "unbounded" | number): Micro<A, E, R>
922
1130
  } = dual(
923
1131
  2,
@@ -929,19 +1137,6 @@ export const withConcurrency: {
929
1137
  // constructors
930
1138
  // ----------------------------------------------------------------------------
931
1139
 
932
- const MicroProto = {
933
- ...Effectable.EffectPrototype,
934
- _op: "Micro",
935
- [TypeId]: {
936
- _A: identity,
937
- _E: identity,
938
- _R: identity
939
- },
940
- [Symbol.iterator]() {
941
- return new SingleShotGen(new YieldWrap(this)) as any
942
- }
943
- }
944
-
945
1140
  const microDepthState = globalValue("effect/Micro/microDepthState", () => ({
946
1141
  depth: 0,
947
1142
  maxDepthBeforeYield: currentMaxDepthBeforeYield.initial
@@ -1417,7 +1612,23 @@ export const flatten = <A, E, R, E2, R2>(self: Micro<Micro<A, E, R>, E2, R2>): M
1417
1612
  * @category mapping & sequencing
1418
1613
  */
1419
1614
  export const map: {
1615
+ /**
1616
+ * Transforms the success value of the `Micro` effect with the specified
1617
+ * function.
1618
+ *
1619
+ * @since 3.4.0
1620
+ * @experimental
1621
+ * @category mapping & sequencing
1622
+ */
1420
1623
  <A, B>(f: (a: A) => B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>
1624
+ /**
1625
+ * Transforms the success value of the `Micro` effect with the specified
1626
+ * function.
1627
+ *
1628
+ * @since 3.4.0
1629
+ * @experimental
1630
+ * @category mapping & sequencing
1631
+ */
1421
1632
  <A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R>
1422
1633
  } = dual(2, <A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R> =>
1423
1634
  make(function(env, onExit) {
@@ -1435,7 +1646,23 @@ export const map: {
1435
1646
  * @category mapping & sequencing
1436
1647
  */
1437
1648
  export const as: {
1649
+ /**
1650
+ * Create a `Micro` effect that will replace the success value of the given
1651
+ * effect.
1652
+ *
1653
+ * @since 3.4.0
1654
+ * @experimental
1655
+ * @category mapping & sequencing
1656
+ */
1438
1657
  <A, B>(value: B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>
1658
+ /**
1659
+ * Create a `Micro` effect that will replace the success value of the given
1660
+ * effect.
1661
+ *
1662
+ * @since 3.4.0
1663
+ * @experimental
1664
+ * @category mapping & sequencing
1665
+ */
1439
1666
  <A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R>
1440
1667
  } = dual(2, <A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R> => map(self, (_) => value))
1441
1668
 
@@ -1457,7 +1684,23 @@ export const asSome = <A, E, R>(self: Micro<A, E, R>): Micro<Option.Option<A>, E
1457
1684
  * @category mapping & sequencing
1458
1685
  */
1459
1686
  export const flatMap: {
1687
+ /**
1688
+ * Map the success value of this `Micro` effect to another `Micro` effect, then
1689
+ * flatten the result.
1690
+ *
1691
+ * @since 3.4.0
1692
+ * @experimental
1693
+ * @category mapping & sequencing
1694
+ */
1460
1695
  <A, B, E2, R2>(f: (a: A) => Micro<B, E2, R2>): <E, R>(self: Micro<A, E, R>) => Micro<B, E | E2, R | R2>
1696
+ /**
1697
+ * Map the success value of this `Micro` effect to another `Micro` effect, then
1698
+ * flatten the result.
1699
+ *
1700
+ * @since 3.4.0
1701
+ * @experimental
1702
+ * @category mapping & sequencing
1703
+ */
1461
1704
  <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: A) => Micro<B, E2, R2>): Micro<B, E | E2, R | R2>
1462
1705
  } = dual(
1463
1706
  2,
@@ -1497,25 +1740,65 @@ export const flip = <A, E, R>(self: Micro<A, E, R>): Micro<E, A, R> =>
1497
1740
  * @category mapping & sequencing
1498
1741
  */
1499
1742
  export const andThen: {
1500
- <A, X>(
1501
- f: (a: A) => X
1502
- ): <E, R>(
1743
+ /**
1744
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1745
+ * a single api.
1746
+ *
1747
+ * It also allows you to pass in a `Micro` effect directly, which will be
1748
+ * executed after the current effect.
1749
+ *
1750
+ * @since 3.4.0
1751
+ * @experimental
1752
+ * @category mapping & sequencing
1753
+ */
1754
+ <A, X>(f: (a: A) => X): <E, R>(
1503
1755
  self: Micro<A, E, R>
1504
1756
  ) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1>
1505
1757
  : Micro<X, E, R>
1506
- <X>(
1507
- f: NotFunction<X>
1508
- ): <A, E, R>(
1758
+ /**
1759
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1760
+ * a single api.
1761
+ *
1762
+ * It also allows you to pass in a `Micro` effect directly, which will be
1763
+ * executed after the current effect.
1764
+ *
1765
+ * @since 3.4.0
1766
+ * @experimental
1767
+ * @category mapping & sequencing
1768
+ */
1769
+ <X>(f: NotFunction<X>): <A, E, R>(
1509
1770
  self: Micro<A, E, R>
1510
1771
  ) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1>
1511
1772
  : Micro<X, E, R>
1773
+ /**
1774
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1775
+ * a single api.
1776
+ *
1777
+ * It also allows you to pass in a `Micro` effect directly, which will be
1778
+ * executed after the current effect.
1779
+ *
1780
+ * @since 3.4.0
1781
+ * @experimental
1782
+ * @category mapping & sequencing
1783
+ */
1512
1784
  <A, E, R, X>(
1513
1785
  self: Micro<A, E, R>,
1514
1786
  f: (a: A) => X
1515
1787
  ): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1>
1516
1788
  : Micro<X, E, R>
1517
- <A, E, R, X>(
1518
- self: Micro<A, E, R>,
1789
+ /**
1790
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1791
+ * a single api.
1792
+ *
1793
+ * It also allows you to pass in a `Micro` effect directly, which will be
1794
+ * executed after the current effect.
1795
+ *
1796
+ * @since 3.4.0
1797
+ * @experimental
1798
+ * @category mapping & sequencing
1799
+ */
1800
+ <A, E, R, X>(
1801
+ self: Micro<A, E, R>,
1519
1802
  f: NotFunction<X>
1520
1803
  ): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1>
1521
1804
  : Micro<X, E, R>
@@ -1549,23 +1832,55 @@ export const andThen: {
1549
1832
  * @category mapping & sequencing
1550
1833
  */
1551
1834
  export const tap: {
1552
- <A, X>(
1553
- f: (a: NoInfer<A>) => X
1554
- ): <E, R>(
1835
+ /**
1836
+ * Execute a side effect from the success value of the `Micro` effect.
1837
+ *
1838
+ * It is similar to the `andThen` api, but the success value is ignored.
1839
+ *
1840
+ * @since 3.4.0
1841
+ * @experimental
1842
+ * @category mapping & sequencing
1843
+ */
1844
+ <A, X>(f: (a: NoInfer<A>) => X): <E, R>(
1555
1845
  self: Micro<A, E, R>
1556
1846
  ) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1>
1557
1847
  : Micro<A, E, R>
1558
- <X>(
1559
- f: NotFunction<X>
1560
- ): <A, E, R>(
1848
+ /**
1849
+ * Execute a side effect from the success value of the `Micro` effect.
1850
+ *
1851
+ * It is similar to the `andThen` api, but the success value is ignored.
1852
+ *
1853
+ * @since 3.4.0
1854
+ * @experimental
1855
+ * @category mapping & sequencing
1856
+ */
1857
+ <X>(f: NotFunction<X>): <A, E, R>(
1561
1858
  self: Micro<A, E, R>
1562
1859
  ) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1>
1563
1860
  : Micro<A, E, R>
1861
+ /**
1862
+ * Execute a side effect from the success value of the `Micro` effect.
1863
+ *
1864
+ * It is similar to the `andThen` api, but the success value is ignored.
1865
+ *
1866
+ * @since 3.4.0
1867
+ * @experimental
1868
+ * @category mapping & sequencing
1869
+ */
1564
1870
  <A, E, R, X>(
1565
1871
  self: Micro<A, E, R>,
1566
1872
  f: (a: NoInfer<A>) => X
1567
1873
  ): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1>
1568
1874
  : Micro<A, E, R>
1875
+ /**
1876
+ * Execute a side effect from the success value of the `Micro` effect.
1877
+ *
1878
+ * It is similar to the `andThen` api, but the success value is ignored.
1879
+ *
1880
+ * @since 3.4.0
1881
+ * @experimental
1882
+ * @category mapping & sequencing
1883
+ */
1569
1884
  <A, E, R, X>(
1570
1885
  self: Micro<A, E, R>,
1571
1886
  f: NotFunction<X>
@@ -1732,7 +2047,23 @@ export const raceAllFirst = <Eff extends Micro<any, any, any>>(
1732
2047
  * @category sequencing
1733
2048
  */
1734
2049
  export const race: {
2050
+ /**
2051
+ * Returns an effect that races two effects, yielding the value of the first
2052
+ * effect to succeed. Losers of the race will be interrupted immediately
2053
+ *
2054
+ * @since 3.4.0
2055
+ * @experimental
2056
+ * @category sequencing
2057
+ */
1735
2058
  <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>
2059
+ /**
2060
+ * Returns an effect that races two effects, yielding the value of the first
2061
+ * effect to succeed. Losers of the race will be interrupted immediately
2062
+ *
2063
+ * @since 3.4.0
2064
+ * @experimental
2065
+ * @category sequencing
2066
+ */
1736
2067
  <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>
1737
2068
  } = dual(
1738
2069
  2,
@@ -1749,7 +2080,23 @@ export const race: {
1749
2080
  * @category sequencing
1750
2081
  */
1751
2082
  export const raceFirst: {
2083
+ /**
2084
+ * Returns an effect that races two effects, yielding the value of the first
2085
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately
2086
+ *
2087
+ * @since 3.4.0
2088
+ * @experimental
2089
+ * @category sequencing
2090
+ */
1752
2091
  <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>
2092
+ /**
2093
+ * Returns an effect that races two effects, yielding the value of the first
2094
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately
2095
+ *
2096
+ * @since 3.4.0
2097
+ * @experimental
2098
+ * @category sequencing
2099
+ */
1753
2100
  <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>
1754
2101
  } = dual(
1755
2102
  2,
@@ -1770,12 +2117,36 @@ export const raceFirst: {
1770
2117
  * @category zipping
1771
2118
  */
1772
2119
  export const zip: {
2120
+ // ----------------------------------------------------------------------------
2121
+ // zipping
2122
+ // ----------------------------------------------------------------------------
2123
+
2124
+ /**
2125
+ * Combine two `Micro` effects into a single effect that produces a tuple of
2126
+ * their results.
2127
+ *
2128
+ * @since 3.4.0
2129
+ * @experimental
2130
+ * @category zipping
2131
+ */
1773
2132
  <A2, E2, R2>(
1774
2133
  that: Micro<A2, E2, R2>,
1775
2134
  options?:
1776
2135
  | { readonly concurrent?: boolean | undefined }
1777
2136
  | undefined
1778
2137
  ): <A, E, R>(self: Micro<A, E, R>) => Micro<[A, A2], E2 | E, R2 | R>
2138
+ // ----------------------------------------------------------------------------
2139
+ // zipping
2140
+ // ----------------------------------------------------------------------------
2141
+
2142
+ /**
2143
+ * Combine two `Micro` effects into a single effect that produces a tuple of
2144
+ * their results.
2145
+ *
2146
+ * @since 3.4.0
2147
+ * @experimental
2148
+ * @category zipping
2149
+ */
1779
2150
  <A, E, R, A2, E2, R2>(
1780
2151
  self: Micro<A, E, R>,
1781
2152
  that: Micro<A2, E2, R2>,
@@ -1797,11 +2168,29 @@ export const zip: {
1797
2168
  * @category zipping
1798
2169
  */
1799
2170
  export const zipWith: {
2171
+ /**
2172
+ * The `Micro.zipWith` function combines two `Micro` effects and allows you to
2173
+ * apply a function to the results of the combined effects, transforming them
2174
+ * into a single value.
2175
+ *
2176
+ * @since 3.4.3
2177
+ * @experimental
2178
+ * @category zipping
2179
+ */
1800
2180
  <A2, E2, R2, A, B>(
1801
2181
  that: Micro<A2, E2, R2>,
1802
2182
  f: (a: A, b: A2) => B,
1803
2183
  options?: { readonly concurrent?: boolean | undefined }
1804
2184
  ): <E, R>(self: Micro<A, E, R>) => Micro<B, E2 | E, R2 | R>
2185
+ /**
2186
+ * The `Micro.zipWith` function combines two `Micro` effects and allows you to
2187
+ * apply a function to the results of the combined effects, transforming them
2188
+ * into a single value.
2189
+ *
2190
+ * @since 3.4.3
2191
+ * @experimental
2192
+ * @category zipping
2193
+ */
1805
2194
  <A, E, R, A2, E2, R2, B>(
1806
2195
  self: Micro<A, E, R>,
1807
2196
  that: Micro<A2, E2, R2>,
@@ -1837,19 +2226,79 @@ export const zipWith: {
1837
2226
  * @category filtering & conditionals
1838
2227
  */
1839
2228
  export const filterOrFailCause: {
2229
+ // ----------------------------------------------------------------------------
2230
+ // filtering & conditionals
2231
+ // ----------------------------------------------------------------------------
2232
+
2233
+ /**
2234
+ * Filter the specified effect with the provided function, failing with specified
2235
+ * `MicroCause` if the predicate fails.
2236
+ *
2237
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2238
+ * refine and narrow down the type of the success channel by providing a
2239
+ *
2240
+ * @since 3.4.0
2241
+ * @experimental
2242
+ * @category filtering & conditionals
2243
+ */
1840
2244
  <A, B extends A, E2>(
1841
2245
  refinement: Refinement<A, B>,
1842
2246
  orFailWith: (a: NoInfer<A>) => MicroCause<E2>
1843
2247
  ): <E, R>(self: Micro<A, E, R>) => Micro<B, E2 | E, R>
2248
+ // ----------------------------------------------------------------------------
2249
+ // filtering & conditionals
2250
+ // ----------------------------------------------------------------------------
2251
+
2252
+ /**
2253
+ * Filter the specified effect with the provided function, failing with specified
2254
+ * `MicroCause` if the predicate fails.
2255
+ *
2256
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2257
+ * refine and narrow down the type of the success channel by providing a
2258
+ *
2259
+ * @since 3.4.0
2260
+ * @experimental
2261
+ * @category filtering & conditionals
2262
+ */
1844
2263
  <A, E2>(
1845
2264
  predicate: Predicate<NoInfer<A>>,
1846
2265
  orFailWith: (a: NoInfer<A>) => MicroCause<E2>
1847
2266
  ): <E, R>(self: Micro<A, E, R>) => Micro<A, E2 | E, R>
2267
+ // ----------------------------------------------------------------------------
2268
+ // filtering & conditionals
2269
+ // ----------------------------------------------------------------------------
2270
+
2271
+ /**
2272
+ * Filter the specified effect with the provided function, failing with specified
2273
+ * `MicroCause` if the predicate fails.
2274
+ *
2275
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2276
+ * refine and narrow down the type of the success channel by providing a
2277
+ *
2278
+ * @since 3.4.0
2279
+ * @experimental
2280
+ * @category filtering & conditionals
2281
+ */
1848
2282
  <A, E, R, B extends A, E2>(
1849
2283
  self: Micro<A, E, R>,
1850
2284
  refinement: Refinement<A, B>,
1851
2285
  orFailWith: (a: A) => MicroCause<E2>
1852
2286
  ): Micro<B, E | E2, R>
2287
+ // ----------------------------------------------------------------------------
2288
+ // filtering & conditionals
2289
+ // ----------------------------------------------------------------------------
2290
+
2291
+ /**
2292
+ * Filter the specified effect with the provided function, failing with specified
2293
+ * `MicroCause` if the predicate fails.
2294
+ *
2295
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2296
+ * refine and narrow down the type of the success channel by providing a
2297
+ *
2298
+ * @since 3.4.0
2299
+ * @experimental
2300
+ * @category filtering & conditionals
2301
+ */
1853
2302
  <A, E, R, E2>(
1854
2303
  self: Micro<A, E, R>,
1855
2304
  predicate: Predicate<A>,
@@ -1873,19 +2322,63 @@ export const filterOrFailCause: {
1873
2322
  * @category filtering & conditionals
1874
2323
  */
1875
2324
  export const filterOrFail: {
2325
+ /**
2326
+ * Filter the specified effect with the provided function, failing with specified
2327
+ * error if the predicate fails.
2328
+ *
2329
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2330
+ * refine and narrow down the type of the success channel by providing a
2331
+ *
2332
+ * @since 3.4.0
2333
+ * @experimental
2334
+ * @category filtering & conditionals
2335
+ */
1876
2336
  <A, B extends A, E2>(
1877
2337
  refinement: Refinement<A, B>,
1878
2338
  orFailWith: (a: NoInfer<A>) => E2
1879
2339
  ): <E, R>(self: Micro<A, E, R>) => Micro<B, E2 | E, R>
2340
+ /**
2341
+ * Filter the specified effect with the provided function, failing with specified
2342
+ * error if the predicate fails.
2343
+ *
2344
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2345
+ * refine and narrow down the type of the success channel by providing a
2346
+ *
2347
+ * @since 3.4.0
2348
+ * @experimental
2349
+ * @category filtering & conditionals
2350
+ */
1880
2351
  <A, E2>(
1881
2352
  predicate: Predicate<NoInfer<A>>,
1882
2353
  orFailWith: (a: NoInfer<A>) => E2
1883
2354
  ): <E, R>(self: Micro<A, E, R>) => Micro<A, E2 | E, R>
2355
+ /**
2356
+ * Filter the specified effect with the provided function, failing with specified
2357
+ * error if the predicate fails.
2358
+ *
2359
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2360
+ * refine and narrow down the type of the success channel by providing a
2361
+ *
2362
+ * @since 3.4.0
2363
+ * @experimental
2364
+ * @category filtering & conditionals
2365
+ */
1884
2366
  <A, E, R, B extends A, E2>(
1885
2367
  self: Micro<A, E, R>,
1886
2368
  refinement: Refinement<A, B>,
1887
2369
  orFailWith: (a: A) => E2
1888
2370
  ): Micro<B, E | E2, R>
2371
+ /**
2372
+ * Filter the specified effect with the provided function, failing with specified
2373
+ * error if the predicate fails.
2374
+ *
2375
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
2376
+ * refine and narrow down the type of the success channel by providing a
2377
+ *
2378
+ * @since 3.4.0
2379
+ * @experimental
2380
+ * @category filtering & conditionals
2381
+ */
1889
2382
  <A, E, R, E2>(self: Micro<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => E2): Micro<A, E | E2, R>
1890
2383
  } = dual((args) => isMicro(args[0]), <A, E, R, B extends A, E2>(
1891
2384
  self: Micro<A, E, R>,
@@ -1901,9 +2394,23 @@ export const filterOrFail: {
1901
2394
  * @category filtering & conditionals
1902
2395
  */
1903
2396
  export const when: {
2397
+ /**
2398
+ * The moral equivalent of `if (p) exp`.
2399
+ *
2400
+ * @since 3.4.0
2401
+ * @experimental
2402
+ * @category filtering & conditionals
2403
+ */
1904
2404
  <E2 = never, R2 = never>(
1905
2405
  condition: LazyArg<boolean> | Micro<boolean, E2, R2>
1906
2406
  ): <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E | E2, R | R2>
2407
+ /**
2408
+ * The moral equivalent of `if (p) exp`.
2409
+ *
2410
+ * @since 3.4.0
2411
+ * @experimental
2412
+ * @category filtering & conditionals
2413
+ */
1907
2414
  <A, E, R, E2 = never, R2 = never>(
1908
2415
  self: Micro<A, E, R>,
1909
2416
  condition: LazyArg<boolean> | Micro<boolean, E2, R2>
@@ -1932,16 +2439,49 @@ export const when: {
1932
2439
  * @category repetition
1933
2440
  */
1934
2441
  export const repeatExit: {
1935
- <A, E>(options: {
1936
- while: Predicate<MicroExit<A, E>>
1937
- times?: number | undefined
1938
- schedule?: MicroSchedule | undefined
1939
- }): <R>(self: Micro<A, E, R>) => Micro<A, E, R>
1940
- <A, E, R>(self: Micro<A, E, R>, options: {
1941
- while: Predicate<MicroExit<A, E>>
1942
- times?: number | undefined
1943
- schedule?: MicroSchedule | undefined
1944
- }): Micro<A, E, R>
2442
+ // ----------------------------------------------------------------------------
2443
+ // repetition
2444
+ // ----------------------------------------------------------------------------
2445
+
2446
+ /**
2447
+ * Repeat the given `Micro` using the provided options.
2448
+ *
2449
+ * The `while` predicate will be checked after each iteration, and can use the
2450
+ * fall `MicroExit` of the effect to determine if the repetition should continue.
2451
+ *
2452
+ * @since 3.4.6
2453
+ * @experimental
2454
+ * @category repetition
2455
+ */
2456
+ <A, E>(
2457
+ options: {
2458
+ while: Predicate<MicroExit<A, E>>
2459
+ times?: number | undefined
2460
+ schedule?: MicroSchedule | undefined
2461
+ }
2462
+ ): <R>(self: Micro<A, E, R>) => Micro<A, E, R>
2463
+ // ----------------------------------------------------------------------------
2464
+ // repetition
2465
+ // ----------------------------------------------------------------------------
2466
+
2467
+ /**
2468
+ * Repeat the given `Micro` using the provided options.
2469
+ *
2470
+ * The `while` predicate will be checked after each iteration, and can use the
2471
+ * fall `MicroExit` of the effect to determine if the repetition should continue.
2472
+ *
2473
+ * @since 3.4.6
2474
+ * @experimental
2475
+ * @category repetition
2476
+ */
2477
+ <A, E, R>(
2478
+ self: Micro<A, E, R>,
2479
+ options: {
2480
+ while: Predicate<MicroExit<A, E>>
2481
+ times?: number | undefined
2482
+ schedule?: MicroSchedule | undefined
2483
+ }
2484
+ ): Micro<A, E, R>
1945
2485
  } = dual(2, <A, E, R>(self: Micro<A, E, R>, options: {
1946
2486
  while: Predicate<MicroExit<A, E>>
1947
2487
  times?: number | undefined
@@ -1984,6 +2524,14 @@ export const repeatExit: {
1984
2524
  * @category repetition
1985
2525
  */
1986
2526
  export const repeat: {
2527
+ /**
2528
+ * Repeat the given `Micro` effect using the provided options. Only successful
2529
+ * results will be repeated.
2530
+ *
2531
+ * @since 3.4.0
2532
+ * @experimental
2533
+ * @category repetition
2534
+ */
1987
2535
  <A, E>(
1988
2536
  options?: {
1989
2537
  while?: Predicate<A> | undefined
@@ -1991,6 +2539,14 @@ export const repeat: {
1991
2539
  schedule?: MicroSchedule | undefined
1992
2540
  } | undefined
1993
2541
  ): <R>(self: Micro<A, E, R>) => Micro<A, E, R>
2542
+ /**
2543
+ * Repeat the given `Micro` effect using the provided options. Only successful
2544
+ * results will be repeated.
2545
+ *
2546
+ * @since 3.4.0
2547
+ * @experimental
2548
+ * @category repetition
2549
+ */
1994
2550
  <A, E, R>(
1995
2551
  self: Micro<A, E, R>,
1996
2552
  options?: {
@@ -2077,7 +2633,23 @@ export const scheduleExponential = (baseMillis: number, factor = 2): MicroSchedu
2077
2633
  * @category scheduling
2078
2634
  */
2079
2635
  export const scheduleAddDelay: {
2636
+ /**
2637
+ * Returns a new `MicroSchedule` with an added calculated delay to each delay
2638
+ * returned by this schedule.
2639
+ *
2640
+ * @since 3.4.6
2641
+ * @experimental
2642
+ * @category scheduling
2643
+ */
2080
2644
  (f: () => number): (self: MicroSchedule) => MicroSchedule
2645
+ /**
2646
+ * Returns a new `MicroSchedule` with an added calculated delay to each delay
2647
+ * returned by this schedule.
2648
+ *
2649
+ * @since 3.4.6
2650
+ * @experimental
2651
+ * @category scheduling
2652
+ */
2081
2653
  (self: MicroSchedule, f: () => number): MicroSchedule
2082
2654
  } = dual(
2083
2655
  2,
@@ -2094,7 +2666,23 @@ export const scheduleAddDelay: {
2094
2666
  * @category scheduling
2095
2667
  */
2096
2668
  export const scheduleWithMaxDelay: {
2669
+ /**
2670
+ * Transform a `MicroSchedule` to one that will have a delay that will never exceed
2671
+ * the specified maximum.
2672
+ *
2673
+ * @since 3.4.6
2674
+ * @experimental
2675
+ * @category scheduling
2676
+ */
2097
2677
  (max: number): (self: MicroSchedule) => MicroSchedule
2678
+ /**
2679
+ * Transform a `MicroSchedule` to one that will have a delay that will never exceed
2680
+ * the specified maximum.
2681
+ *
2682
+ * @since 3.4.6
2683
+ * @experimental
2684
+ * @category scheduling
2685
+ */
2098
2686
  (self: MicroSchedule, max: number): MicroSchedule
2099
2687
  } = dual(
2100
2688
  2,
@@ -2111,7 +2699,23 @@ export const scheduleWithMaxDelay: {
2111
2699
  * @category scheduling
2112
2700
  */
2113
2701
  export const scheduleWithMaxElapsed: {
2702
+ /**
2703
+ * Transform a `MicroSchedule` to one that will stop repeating after the specified
2704
+ * amount of time.
2705
+ *
2706
+ * @since 3.4.6
2707
+ * @experimental
2708
+ * @category scheduling
2709
+ */
2114
2710
  (max: number): (self: MicroSchedule) => MicroSchedule
2711
+ /**
2712
+ * Transform a `MicroSchedule` to one that will stop repeating after the specified
2713
+ * amount of time.
2714
+ *
2715
+ * @since 3.4.6
2716
+ * @experimental
2717
+ * @category scheduling
2718
+ */
2115
2719
  (self: MicroSchedule, max: number): MicroSchedule
2116
2720
  } = dual(
2117
2721
  2,
@@ -2128,7 +2732,23 @@ export const scheduleWithMaxElapsed: {
2128
2732
  * @category scheduling
2129
2733
  */
2130
2734
  export const scheduleUnion: {
2735
+ /**
2736
+ * Combines two `MicroSchedule`s, by recurring if either schedule wants to
2737
+ * recur, using the minimum of the two durations between recurrences.
2738
+ *
2739
+ * @since 3.4.6
2740
+ * @experimental
2741
+ * @category scheduling
2742
+ */
2131
2743
  (that: MicroSchedule): (self: MicroSchedule) => MicroSchedule
2744
+ /**
2745
+ * Combines two `MicroSchedule`s, by recurring if either schedule wants to
2746
+ * recur, using the minimum of the two durations between recurrences.
2747
+ *
2748
+ * @since 3.4.6
2749
+ * @experimental
2750
+ * @category scheduling
2751
+ */
2132
2752
  (self: MicroSchedule, that: MicroSchedule): MicroSchedule
2133
2753
  } = dual(
2134
2754
  2,
@@ -2145,7 +2765,23 @@ export const scheduleUnion: {
2145
2765
  * @category scheduling
2146
2766
  */
2147
2767
  export const scheduleIntersect: {
2768
+ /**
2769
+ * Combines two `MicroSchedule`s, by recurring only if both schedules want to
2770
+ * recur, using the maximum of the two durations between recurrences.
2771
+ *
2772
+ * @since 3.4.6
2773
+ * @experimental
2774
+ * @category scheduling
2775
+ */
2148
2776
  (that: MicroSchedule): (self: MicroSchedule) => MicroSchedule
2777
+ /**
2778
+ * Combines two `MicroSchedule`s, by recurring only if both schedules want to
2779
+ * recur, using the maximum of the two durations between recurrences.
2780
+ *
2781
+ * @since 3.4.6
2782
+ * @experimental
2783
+ * @category scheduling
2784
+ */
2149
2785
  (self: MicroSchedule, that: MicroSchedule): MicroSchedule
2150
2786
  } = dual(
2151
2787
  2,
@@ -2166,9 +2802,33 @@ export const scheduleIntersect: {
2166
2802
  * @category error handling
2167
2803
  */
2168
2804
  export const catchAllCause: {
2805
+ // ----------------------------------------------------------------------------
2806
+ // error handling
2807
+ // ----------------------------------------------------------------------------
2808
+
2809
+ /**
2810
+ * Catch the full `MicroCause` object of the given `Micro` effect, allowing you to
2811
+ * recover from any kind of cause.
2812
+ *
2813
+ * @since 3.4.6
2814
+ * @experimental
2815
+ * @category error handling
2816
+ */
2169
2817
  <E, B, E2, R2>(
2170
2818
  f: (cause: NoInfer<MicroCause<E>>) => Micro<B, E2, R2>
2171
2819
  ): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>
2820
+ // ----------------------------------------------------------------------------
2821
+ // error handling
2822
+ // ----------------------------------------------------------------------------
2823
+
2824
+ /**
2825
+ * Catch the full `MicroCause` object of the given `Micro` effect, allowing you to
2826
+ * recover from any kind of cause.
2827
+ *
2828
+ * @since 3.4.6
2829
+ * @experimental
2830
+ * @category error handling
2831
+ */
2172
2832
  <A, E, R, B, E2, R2>(
2173
2833
  self: Micro<A, E, R>,
2174
2834
  f: (cause: NoInfer<MicroCause<E>>) => Micro<B, E2, R2>
@@ -2190,19 +2850,51 @@ export const catchAllCause: {
2190
2850
  * @category error handling
2191
2851
  */
2192
2852
  export const catchCauseIf: {
2853
+ /**
2854
+ * Selectively catch a `MicroCause` object of the given `Micro` effect,
2855
+ * using the provided predicate to determine if the failure should be caught.
2856
+ *
2857
+ * @since 3.4.6
2858
+ * @experimental
2859
+ * @category error handling
2860
+ */
2193
2861
  <E, B, E2, R2, EB extends MicroCause<E>>(
2194
2862
  refinement: Refinement<MicroCause<E>, EB>,
2195
2863
  f: (cause: EB) => Micro<B, E2, R2>
2196
2864
  ): <A, R>(self: Micro<A, E, R>) => Micro<A | B, Exclude<E, MicroCause.Error<EB>> | E2, R | R2>
2865
+ /**
2866
+ * Selectively catch a `MicroCause` object of the given `Micro` effect,
2867
+ * using the provided predicate to determine if the failure should be caught.
2868
+ *
2869
+ * @since 3.4.6
2870
+ * @experimental
2871
+ * @category error handling
2872
+ */
2197
2873
  <E, B, E2, R2>(
2198
2874
  predicate: Predicate<MicroCause<NoInfer<E>>>,
2199
2875
  f: (cause: NoInfer<MicroCause<E>>) => Micro<B, E2, R2>
2200
2876
  ): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E | E2, R | R2>
2877
+ /**
2878
+ * Selectively catch a `MicroCause` object of the given `Micro` effect,
2879
+ * using the provided predicate to determine if the failure should be caught.
2880
+ *
2881
+ * @since 3.4.6
2882
+ * @experimental
2883
+ * @category error handling
2884
+ */
2201
2885
  <A, E, R, B, E2, R2, EB extends MicroCause<E>>(
2202
2886
  self: Micro<A, E, R>,
2203
2887
  refinement: Refinement<MicroCause<E>, EB>,
2204
2888
  f: (cause: EB) => Micro<B, E2, R2>
2205
2889
  ): Micro<A | B, Exclude<E, MicroCause.Error<EB>> | E2, R | R2>
2890
+ /**
2891
+ * Selectively catch a `MicroCause` object of the given `Micro` effect,
2892
+ * using the provided predicate to determine if the failure should be caught.
2893
+ *
2894
+ * @since 3.4.6
2895
+ * @experimental
2896
+ * @category error handling
2897
+ */
2206
2898
  <A, E, R, B, E2, R2>(
2207
2899
  self: Micro<A, E, R>,
2208
2900
  predicate: Predicate<MicroCause<NoInfer<E>>>,
@@ -2233,9 +2925,25 @@ export const catchCauseIf: {
2233
2925
  * @category error handling
2234
2926
  */
2235
2927
  export const catchAll: {
2236
- <E, B, E2, R2>(
2237
- f: (e: NoInfer<E>) => Micro<B, E2, R2>
2238
- ): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>
2928
+ /**
2929
+ * Catch the error of the given `Micro` effect, allowing you to recover from it.
2930
+ *
2931
+ * It only catches expected (`MicroCause.Fail`) errors.
2932
+ *
2933
+ * @since 3.4.6
2934
+ * @experimental
2935
+ * @category error handling
2936
+ */
2937
+ <E, B, E2, R2>(f: (e: NoInfer<E>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>
2938
+ /**
2939
+ * Catch the error of the given `Micro` effect, allowing you to recover from it.
2940
+ *
2941
+ * It only catches expected (`MicroCause.Fail`) errors.
2942
+ *
2943
+ * @since 3.4.6
2944
+ * @experimental
2945
+ * @category error handling
2946
+ */
2239
2947
  <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (e: NoInfer<E>) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>
2240
2948
  } = dual(
2241
2949
  2,
@@ -2253,9 +2961,21 @@ export const catchAll: {
2253
2961
  * @category error handling
2254
2962
  */
2255
2963
  export const catchAllDefect: {
2256
- <E, B, E2, R2>(
2257
- f: (defect: unknown) => Micro<B, E2, R2>
2258
- ): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E | E2, R | R2>
2964
+ /**
2965
+ * Catch any unexpected errors of the given `Micro` effect, allowing you to recover from them.
2966
+ *
2967
+ * @since 3.4.6
2968
+ * @experimental
2969
+ * @category error handling
2970
+ */
2971
+ <E, B, E2, R2>(f: (defect: unknown) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E | E2, R | R2>
2972
+ /**
2973
+ * Catch any unexpected errors of the given `Micro` effect, allowing you to recover from them.
2974
+ *
2975
+ * @since 3.4.6
2976
+ * @experimental
2977
+ * @category error handling
2978
+ */
2259
2979
  <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (defect: unknown) => Micro<B, E2, R2>): Micro<A | B, E | E2, R | R2>
2260
2980
  } = dual(
2261
2981
  2,
@@ -2271,9 +2991,23 @@ export const catchAllDefect: {
2271
2991
  * @category error handling
2272
2992
  */
2273
2993
  export const tapErrorCause: {
2994
+ /**
2995
+ * Perform a side effect using the full `MicroCause` object of the given `Micro`.
2996
+ *
2997
+ * @since 3.4.6
2998
+ * @experimental
2999
+ * @category error handling
3000
+ */
2274
3001
  <E, B, E2, R2>(
2275
3002
  f: (cause: NoInfer<MicroCause<E>>) => Micro<B, E2, R2>
2276
3003
  ): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3004
+ /**
3005
+ * Perform a side effect using the full `MicroCause` object of the given `Micro`.
3006
+ *
3007
+ * @since 3.4.6
3008
+ * @experimental
3009
+ * @category error handling
3010
+ */
2277
3011
  <A, E, R, B, E2, R2>(
2278
3012
  self: Micro<A, E, R>,
2279
3013
  f: (cause: NoInfer<MicroCause<E>>) => Micro<B, E2, R2>
@@ -2295,19 +3029,51 @@ export const tapErrorCause: {
2295
3029
  * @category error handling
2296
3030
  */
2297
3031
  export const tapErrorCauseIf: {
3032
+ /**
3033
+ * Perform a side effect using if a `MicroCause` object matches the specified
3034
+ * predicate.
3035
+ *
3036
+ * @since 3.4.0
3037
+ * @experimental
3038
+ * @category error handling
3039
+ */
2298
3040
  <E, B, E2, R2, EB extends MicroCause<E>>(
2299
3041
  refinement: Refinement<MicroCause<E>, EB>,
2300
3042
  f: (a: EB) => Micro<B, E2, R2>
2301
3043
  ): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3044
+ /**
3045
+ * Perform a side effect using if a `MicroCause` object matches the specified
3046
+ * predicate.
3047
+ *
3048
+ * @since 3.4.0
3049
+ * @experimental
3050
+ * @category error handling
3051
+ */
2302
3052
  <E, B, E2, R2>(
2303
3053
  predicate: (cause: NoInfer<MicroCause<E>>) => boolean,
2304
3054
  f: (a: NoInfer<MicroCause<E>>) => Micro<B, E2, R2>
2305
3055
  ): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3056
+ /**
3057
+ * Perform a side effect using if a `MicroCause` object matches the specified
3058
+ * predicate.
3059
+ *
3060
+ * @since 3.4.0
3061
+ * @experimental
3062
+ * @category error handling
3063
+ */
2306
3064
  <A, E, R, B, E2, R2, EB extends MicroCause<E>>(
2307
3065
  self: Micro<A, E, R>,
2308
3066
  refinement: Refinement<MicroCause<E>, EB>,
2309
3067
  f: (a: EB) => Micro<B, E2, R2>
2310
3068
  ): Micro<A, E | E2, R | R2>
3069
+ /**
3070
+ * Perform a side effect using if a `MicroCause` object matches the specified
3071
+ * predicate.
3072
+ *
3073
+ * @since 3.4.0
3074
+ * @experimental
3075
+ * @category error handling
3076
+ */
2311
3077
  <A, E, R, B, E2, R2>(
2312
3078
  self: Micro<A, E, R>,
2313
3079
  predicate: (cause: NoInfer<MicroCause<E>>) => boolean,
@@ -2330,9 +3096,21 @@ export const tapErrorCauseIf: {
2330
3096
  * @category error handling
2331
3097
  */
2332
3098
  export const tapError: {
2333
- <E, B, E2, R2>(
2334
- f: (e: NoInfer<E>) => Micro<B, E2, R2>
2335
- ): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3099
+ /**
3100
+ * Perform a side effect from expected errors of the given `Micro`.
3101
+ *
3102
+ * @since 3.4.6
3103
+ * @experimental
3104
+ * @category error handling
3105
+ */
3106
+ <E, B, E2, R2>(f: (e: NoInfer<E>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3107
+ /**
3108
+ * Perform a side effect from expected errors of the given `Micro`.
3109
+ *
3110
+ * @since 3.4.6
3111
+ * @experimental
3112
+ * @category error handling
3113
+ */
2336
3114
  <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (e: NoInfer<E>) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>
2337
3115
  } = dual(
2338
3116
  2,
@@ -2348,9 +3126,21 @@ export const tapError: {
2348
3126
  * @category error handling
2349
3127
  */
2350
3128
  export const tapDefect: {
2351
- <E, B, E2, R2>(
2352
- f: (defect: unknown) => Micro<B, E2, R2>
2353
- ): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3129
+ /**
3130
+ * Perform a side effect from unexpected errors of the given `Micro`.
3131
+ *
3132
+ * @since 3.4.6
3133
+ * @experimental
3134
+ * @category error handling
3135
+ */
3136
+ <E, B, E2, R2>(f: (defect: unknown) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>
3137
+ /**
3138
+ * Perform a side effect from unexpected errors of the given `Micro`.
3139
+ *
3140
+ * @since 3.4.6
3141
+ * @experimental
3142
+ * @category error handling
3143
+ */
2354
3144
  <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (defect: unknown) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>
2355
3145
  } = dual(
2356
3146
  2,
@@ -2366,19 +3156,47 @@ export const tapDefect: {
2366
3156
  * @category error handling
2367
3157
  */
2368
3158
  export const catchIf: {
3159
+ /**
3160
+ * Catch any expected errors that match the specified predicate.
3161
+ *
3162
+ * @since 3.4.0
3163
+ * @experimental
3164
+ * @category error handling
3165
+ */
2369
3166
  <E, EB extends E, A2, E2, R2>(
2370
3167
  refinement: Refinement<NoInfer<E>, EB>,
2371
3168
  f: (e: EB) => Micro<A2, E2, R2>
2372
3169
  ): <A, R>(self: Micro<A, E, R>) => Micro<A2 | A, E2 | Exclude<E, EB>, R2 | R>
3170
+ /**
3171
+ * Catch any expected errors that match the specified predicate.
3172
+ *
3173
+ * @since 3.4.0
3174
+ * @experimental
3175
+ * @category error handling
3176
+ */
2373
3177
  <E, A2, E2, R2>(
2374
3178
  predicate: Predicate<NoInfer<E>>,
2375
3179
  f: (e: NoInfer<E>) => Micro<A2, E2, R2>
2376
3180
  ): <A, R>(self: Micro<A, E, R>) => Micro<A2 | A, E | E2, R2 | R>
3181
+ /**
3182
+ * Catch any expected errors that match the specified predicate.
3183
+ *
3184
+ * @since 3.4.0
3185
+ * @experimental
3186
+ * @category error handling
3187
+ */
2377
3188
  <A, E, R, EB extends E, A2, E2, R2>(
2378
3189
  self: Micro<A, E, R>,
2379
3190
  refinement: Refinement<E, EB>,
2380
3191
  f: (e: EB) => Micro<A2, E2, R2>
2381
3192
  ): Micro<A | A2, E2 | Exclude<E, EB>, R | R2>
3193
+ /**
3194
+ * Catch any expected errors that match the specified predicate.
3195
+ *
3196
+ * @since 3.4.0
3197
+ * @experimental
3198
+ * @category error handling
3199
+ */
2382
3200
  <A, E, R, A2, E2, R2>(
2383
3201
  self: Micro<A, E, R>,
2384
3202
  predicate: Predicate<E>,
@@ -2406,10 +3224,24 @@ export const catchIf: {
2406
3224
  * @category error handling
2407
3225
  */
2408
3226
  export const catchTag: {
3227
+ /**
3228
+ * Recovers from the specified tagged error.
3229
+ *
3230
+ * @since 3.4.0
3231
+ * @experimental
3232
+ * @category error handling
3233
+ */
2409
3234
  <K extends E extends { _tag: string } ? E["_tag"] : never, E, A1, E1, R1>(
2410
3235
  k: K,
2411
3236
  f: (e: Extract<E, { _tag: K }>) => Micro<A1, E1, R1>
2412
3237
  ): <A, R>(self: Micro<A, E, R>) => Micro<A1 | A, E1 | Exclude<E, { _tag: K }>, R1 | R>
3238
+ /**
3239
+ * Recovers from the specified tagged error.
3240
+ *
3241
+ * @since 3.4.0
3242
+ * @experimental
3243
+ * @category error handling
3244
+ */
2413
3245
  <A, E, R, K extends E extends { _tag: string } ? E["_tag"] : never, R1, E1, A1>(
2414
3246
  self: Micro<A, E, R>,
2415
3247
  k: K,
@@ -2430,7 +3262,21 @@ export const catchTag: {
2430
3262
  * @category error handling
2431
3263
  */
2432
3264
  export const mapErrorCause: {
3265
+ /**
3266
+ * Transform the full `MicroCause` object of the given `Micro` effect.
3267
+ *
3268
+ * @since 3.4.6
3269
+ * @experimental
3270
+ * @category error handling
3271
+ */
2433
3272
  <E, E2>(f: (e: MicroCause<E>) => MicroCause<E2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E2, R>
3273
+ /**
3274
+ * Transform the full `MicroCause` object of the given `Micro` effect.
3275
+ *
3276
+ * @since 3.4.6
3277
+ * @experimental
3278
+ * @category error handling
3279
+ */
2434
3280
  <A, E, R, E2>(self: Micro<A, E, R>, f: (e: MicroCause<E>) => MicroCause<E2>): Micro<A, E2, R>
2435
3281
  } = dual(
2436
3282
  2,
@@ -2446,7 +3292,21 @@ export const mapErrorCause: {
2446
3292
  * @category error handling
2447
3293
  */
2448
3294
  export const mapError: {
3295
+ /**
3296
+ * Transform any expected errors of the given `Micro` effect.
3297
+ *
3298
+ * @since 3.4.0
3299
+ * @experimental
3300
+ * @category error handling
3301
+ */
2449
3302
  <E, E2>(f: (e: E) => E2): <A, R>(self: Micro<A, E, R>) => Micro<A, E2, R>
3303
+ /**
3304
+ * Transform any expected errors of the given `Micro` effect.
3305
+ *
3306
+ * @since 3.4.0
3307
+ * @experimental
3308
+ * @category error handling
3309
+ */
2450
3310
  <A, E, R, E2>(self: Micro<A, E, R>, f: (e: E) => E2): Micro<A, E2, R>
2451
3311
  } = dual(
2452
3312
  2,
@@ -2471,7 +3331,21 @@ export const orDie = <A, E, R>(self: Micro<A, E, R>): Micro<A, never, R> => catc
2471
3331
  * @category error handling
2472
3332
  */
2473
3333
  export const orElseSucceed: {
3334
+ /**
3335
+ * Recover from all errors by succeeding with the given value.
3336
+ *
3337
+ * @since 3.4.0
3338
+ * @experimental
3339
+ * @category error handling
3340
+ */
2474
3341
  <B>(f: LazyArg<B>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | B, never, R>
3342
+ /**
3343
+ * Recover from all errors by succeeding with the given value.
3344
+ *
3345
+ * @since 3.4.0
3346
+ * @experimental
3347
+ * @category error handling
3348
+ */
2475
3349
  <A, E, R, B>(self: Micro<A, E, R>, f: LazyArg<B>): Micro<A | B, never, R>
2476
3350
  } = dual(
2477
3351
  2,
@@ -2534,6 +3408,13 @@ export const either = <A, E, R>(self: Micro<A, E, R>): Micro<Either.Either<A, E>
2534
3408
  * @category error handling
2535
3409
  */
2536
3410
  export const retry: {
3411
+ /**
3412
+ * Retry the given `Micro` effect using the provided options.
3413
+ *
3414
+ * @since 3.4.0
3415
+ * @experimental
3416
+ * @category error handling
3417
+ */
2537
3418
  <A, E>(
2538
3419
  options?: {
2539
3420
  while?: Predicate<E> | undefined
@@ -2541,6 +3422,13 @@ export const retry: {
2541
3422
  schedule?: MicroSchedule | undefined
2542
3423
  } | undefined
2543
3424
  ): <R>(self: Micro<A, E, R>) => Micro<A, E, R>
3425
+ /**
3426
+ * Retry the given `Micro` effect using the provided options.
3427
+ *
3428
+ * @since 3.4.0
3429
+ * @experimental
3430
+ * @category error handling
3431
+ */
2544
3432
  <A, E, R>(
2545
3433
  self: Micro<A, E, R>,
2546
3434
  options?: {
@@ -2573,7 +3461,23 @@ export const retry: {
2573
3461
  * @category error handling
2574
3462
  */
2575
3463
  export const withTrace: {
3464
+ /**
3465
+ * Add a stack trace to any failures that occur in the effect. The trace will be
3466
+ * added to the `traces` field of the `MicroCause` object.
3467
+ *
3468
+ * @since 3.4.0
3469
+ * @experimental
3470
+ * @category error handling
3471
+ */
2576
3472
  (name: string): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>
3473
+ /**
3474
+ * Add a stack trace to any failures that occur in the effect. The trace will be
3475
+ * added to the `traces` field of the `MicroCause` object.
3476
+ *
3477
+ * @since 3.4.0
3478
+ * @experimental
3479
+ * @category error handling
3480
+ */
2577
3481
  <A, E, R>(self: Micro<A, E, R>, name: string): Micro<A, E, R>
2578
3482
  } = function() {
2579
3483
  const prevLimit = globalThis.Error.stackTraceLimit
@@ -2614,12 +3518,30 @@ export const withTrace: {
2614
3518
  * @category pattern matching
2615
3519
  */
2616
3520
  export const matchCauseEffect: {
3521
+ // ----------------------------------------------------------------------------
3522
+ // pattern matching
3523
+ // ----------------------------------------------------------------------------
3524
+
3525
+ /**
3526
+ * @since 3.4.6
3527
+ * @experimental
3528
+ * @category pattern matching
3529
+ */
2617
3530
  <E, A2, E2, R2, A, A3, E3, R3>(
2618
3531
  options: {
2619
3532
  readonly onFailure: (cause: MicroCause<E>) => Micro<A2, E2, R2>
2620
3533
  readonly onSuccess: (a: A) => Micro<A3, E3, R3>
2621
3534
  }
2622
3535
  ): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, E2 | E3, R2 | R3 | R>
3536
+ // ----------------------------------------------------------------------------
3537
+ // pattern matching
3538
+ // ----------------------------------------------------------------------------
3539
+
3540
+ /**
3541
+ * @since 3.4.6
3542
+ * @experimental
3543
+ * @category pattern matching
3544
+ */
2623
3545
  <A, E, R, A2, E2, R2, A3, E3, R3>(
2624
3546
  self: Micro<A, E, R>,
2625
3547
  options: {
@@ -2654,12 +3576,22 @@ export const matchCauseEffect: {
2654
3576
  * @category pattern matching
2655
3577
  */
2656
3578
  export const matchCause: {
3579
+ /**
3580
+ * @since 3.4.6
3581
+ * @experimental
3582
+ * @category pattern matching
3583
+ */
2657
3584
  <E, A2, A, A3>(
2658
3585
  options: {
2659
3586
  readonly onFailure: (cause: MicroCause<E>) => A2
2660
3587
  readonly onSuccess: (a: A) => A3
2661
3588
  }
2662
3589
  ): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, never, R>
3590
+ /**
3591
+ * @since 3.4.6
3592
+ * @experimental
3593
+ * @category pattern matching
3594
+ */
2663
3595
  <A, E, R, A2, A3>(
2664
3596
  self: Micro<A, E, R>,
2665
3597
  options: {
@@ -2688,12 +3620,22 @@ export const matchCause: {
2688
3620
  * @category pattern matching
2689
3621
  */
2690
3622
  export const matchEffect: {
3623
+ /**
3624
+ * @since 3.4.6
3625
+ * @experimental
3626
+ * @category pattern matching
3627
+ */
2691
3628
  <E, A2, E2, R2, A, A3, E3, R3>(
2692
3629
  options: {
2693
3630
  readonly onFailure: (e: E) => Micro<A2, E2, R2>
2694
3631
  readonly onSuccess: (a: A) => Micro<A3, E3, R3>
2695
3632
  }
2696
3633
  ): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, E2 | E3, R2 | R3 | R>
3634
+ /**
3635
+ * @since 3.4.6
3636
+ * @experimental
3637
+ * @category pattern matching
3638
+ */
2697
3639
  <A, E, R, A2, E2, R2, A3, E3, R3>(
2698
3640
  self: Micro<A, E, R>,
2699
3641
  options: {
@@ -2722,12 +3664,22 @@ export const matchEffect: {
2722
3664
  * @category pattern matching
2723
3665
  */
2724
3666
  export const match: {
3667
+ /**
3668
+ * @since 3.4.0
3669
+ * @experimental
3670
+ * @category pattern matching
3671
+ */
2725
3672
  <E, A2, A, A3>(
2726
3673
  options: {
2727
3674
  readonly onFailure: (error: E) => A2
2728
3675
  readonly onSuccess: (value: A) => A3
2729
3676
  }
2730
3677
  ): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, never, R>
3678
+ /**
3679
+ * @since 3.4.0
3680
+ * @experimental
3681
+ * @category pattern matching
3682
+ */
2731
3683
  <A, E, R, A2, A3>(
2732
3684
  self: Micro<A, E, R>,
2733
3685
  options: {
@@ -2780,7 +3732,23 @@ export const sleep = (millis: number): Micro<void> =>
2780
3732
  * @category delays & timeouts
2781
3733
  */
2782
3734
  export const delay: {
3735
+ /**
3736
+ * Returns an effect that will delay the execution of this effect by the
3737
+ * specified duration.
3738
+ *
3739
+ * @since 3.4.0
3740
+ * @experimental
3741
+ * @category delays & timeouts
3742
+ */
2783
3743
  (millis: number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>
3744
+ /**
3745
+ * Returns an effect that will delay the execution of this effect by the
3746
+ * specified duration.
3747
+ *
3748
+ * @since 3.4.0
3749
+ * @experimental
3750
+ * @category delays & timeouts
3751
+ */
2784
3752
  <A, E, R>(self: Micro<A, E, R>, millis: number): Micro<A, E, R>
2785
3753
  } = dual(
2786
3754
  2,
@@ -2798,14 +3766,39 @@ export const delay: {
2798
3766
  * @category delays & timeouts
2799
3767
  */
2800
3768
  export const timeoutOrElse: {
2801
- <A2, E2, R2>(options: {
2802
- readonly duration: number
2803
- readonly onTimeout: LazyArg<Micro<A2, E2, R2>>
2804
- }): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>
2805
- <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, options: {
2806
- readonly duration: number
2807
- readonly onTimeout: LazyArg<Micro<A2, E2, R2>>
2808
- }): Micro<A | A2, E | E2, R | R2>
3769
+ /**
3770
+ * Returns an effect that will timeout this effect, that will execute the
3771
+ * fallback effect if the timeout elapses before the effect has produced a value.
3772
+ *
3773
+ * If the timeout elapses, the running effect will be safely interrupted.
3774
+ *
3775
+ * @since 3.4.0
3776
+ * @experimental
3777
+ * @category delays & timeouts
3778
+ */
3779
+ <A2, E2, R2>(
3780
+ options: {
3781
+ readonly duration: number
3782
+ readonly onTimeout: LazyArg<Micro<A2, E2, R2>>
3783
+ }
3784
+ ): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>
3785
+ /**
3786
+ * Returns an effect that will timeout this effect, that will execute the
3787
+ * fallback effect if the timeout elapses before the effect has produced a value.
3788
+ *
3789
+ * If the timeout elapses, the running effect will be safely interrupted.
3790
+ *
3791
+ * @since 3.4.0
3792
+ * @experimental
3793
+ * @category delays & timeouts
3794
+ */
3795
+ <A, E, R, A2, E2, R2>(
3796
+ self: Micro<A, E, R>,
3797
+ options: {
3798
+ readonly duration: number
3799
+ readonly onTimeout: LazyArg<Micro<A2, E2, R2>>
3800
+ }
3801
+ ): Micro<A | A2, E | E2, R | R2>
2809
3802
  } = dual(
2810
3803
  2,
2811
3804
  <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, options: {
@@ -2827,7 +3820,29 @@ export const timeoutOrElse: {
2827
3820
  * @category delays & timeouts
2828
3821
  */
2829
3822
  export const timeout: {
3823
+ /**
3824
+ * Returns an effect that will timeout this effect, that will fail with a
3825
+ * `TimeoutException` if the timeout elapses before the effect has produced a
3826
+ * value.
3827
+ *
3828
+ * If the timeout elapses, the running effect will be safely interrupted.
3829
+ *
3830
+ * @since 3.4.0
3831
+ * @experimental
3832
+ * @category delays & timeouts
3833
+ */
2830
3834
  (millis: number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | TimeoutException, R>
3835
+ /**
3836
+ * Returns an effect that will timeout this effect, that will fail with a
3837
+ * `TimeoutException` if the timeout elapses before the effect has produced a
3838
+ * value.
3839
+ *
3840
+ * If the timeout elapses, the running effect will be safely interrupted.
3841
+ *
3842
+ * @since 3.4.0
3843
+ * @experimental
3844
+ * @category delays & timeouts
3845
+ */
2831
3846
  <A, E, R>(self: Micro<A, E, R>, millis: number): Micro<A, E | TimeoutException, R>
2832
3847
  } = dual(
2833
3848
  2,
@@ -2847,7 +3862,29 @@ export const timeout: {
2847
3862
  * @category delays & timeouts
2848
3863
  */
2849
3864
  export const timeoutOption: {
3865
+ /**
3866
+ * Returns an effect that will timeout this effect, succeeding with a `None`
3867
+ * if the timeout elapses before the effect has produced a value; and `Some` of
3868
+ * the produced value otherwise.
3869
+ *
3870
+ * If the timeout elapses, the running effect will be safely interrupted.
3871
+ *
3872
+ * @since 3.4.0
3873
+ * @experimental
3874
+ * @category delays & timeouts
3875
+ */
2850
3876
  (millis: number): <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E, R>
3877
+ /**
3878
+ * Returns an effect that will timeout this effect, succeeding with a `None`
3879
+ * if the timeout elapses before the effect has produced a value; and `Some` of
3880
+ * the produced value otherwise.
3881
+ *
3882
+ * If the timeout elapses, the running effect will be safely interrupted.
3883
+ *
3884
+ * @since 3.4.0
3885
+ * @experimental
3886
+ * @category delays & timeouts
3887
+ */
2851
3888
  <A, E, R>(self: Micro<A, E, R>, millis: number): Micro<Option.Option<A>, E, R>
2852
3889
  } = dual(
2853
3890
  2,
@@ -3004,7 +4041,21 @@ export const scope: Micro<MicroScope, never, MicroScope> = service(MicroScope)
3004
4041
  * @category resources & finalization
3005
4042
  */
3006
4043
  export const provideScope: {
4044
+ /**
4045
+ * Provide a `MicroScope` to an effect.
4046
+ *
4047
+ * @since 3.4.0
4048
+ * @experimental
4049
+ * @category resources & finalization
4050
+ */
3007
4051
  (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, MicroScope>>
4052
+ /**
4053
+ * Provide a `MicroScope` to an effect.
4054
+ *
4055
+ * @since 3.4.0
4056
+ * @experimental
4057
+ * @category resources & finalization
4058
+ */
3008
4059
  <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<A, E, Exclude<R, MicroScope>>
3009
4060
  } = dual(
3010
4061
  2,
@@ -3063,9 +4114,25 @@ export const addFinalizer = (
3063
4114
  * @category resources & finalization
3064
4115
  */
3065
4116
  export const onExit: {
4117
+ /**
4118
+ * When the `Micro` effect is completed, run the given finalizer effect with the
4119
+ * `MicroExit` of the executed effect.
4120
+ *
4121
+ * @since 3.4.6
4122
+ * @experimental
4123
+ * @category resources & finalization
4124
+ */
3066
4125
  <A, E, XE, XR>(
3067
4126
  f: (exit: MicroExit<A, E>) => Micro<void, XE, XR>
3068
4127
  ): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4128
+ /**
4129
+ * When the `Micro` effect is completed, run the given finalizer effect with the
4130
+ * `MicroExit` of the executed effect.
4131
+ *
4132
+ * @since 3.4.6
4133
+ * @experimental
4134
+ * @category resources & finalization
4135
+ */
3069
4136
  <A, E, R, XE, XR>(self: Micro<A, E, R>, f: (exit: MicroExit<A, E>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>
3070
4137
  } = dual(
3071
4138
  2,
@@ -3084,19 +4151,51 @@ export const onExit: {
3084
4151
  * @category resources & finalization
3085
4152
  */
3086
4153
  export const onExitIf: {
4154
+ /**
4155
+ * When the `Micro` effect is completed, run the given finalizer effect if it
4156
+ * matches the specified predicate.
4157
+ *
4158
+ * @since 3.4.6
4159
+ * @experimental
4160
+ * @category resources & finalization
4161
+ */
3087
4162
  <A, E, XE, XR, B extends MicroExit<A, E>>(
3088
4163
  refinement: Refinement<MicroExit<A, E>, B>,
3089
4164
  f: (exit: B) => Micro<void, XE, XR>
3090
4165
  ): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4166
+ /**
4167
+ * When the `Micro` effect is completed, run the given finalizer effect if it
4168
+ * matches the specified predicate.
4169
+ *
4170
+ * @since 3.4.6
4171
+ * @experimental
4172
+ * @category resources & finalization
4173
+ */
3091
4174
  <A, E, XE, XR>(
3092
4175
  predicate: Predicate<MicroExit<NoInfer<A>, NoInfer<E>>>,
3093
4176
  f: (exit: MicroExit<NoInfer<A>, NoInfer<E>>) => Micro<void, XE, XR>
3094
4177
  ): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4178
+ /**
4179
+ * When the `Micro` effect is completed, run the given finalizer effect if it
4180
+ * matches the specified predicate.
4181
+ *
4182
+ * @since 3.4.6
4183
+ * @experimental
4184
+ * @category resources & finalization
4185
+ */
3095
4186
  <A, E, R, XE, XR, B extends MicroExit<A, E>>(
3096
4187
  self: Micro<A, E, R>,
3097
4188
  refinement: Refinement<MicroExit<A, E>, B>,
3098
4189
  f: (exit: B) => Micro<void, XE, XR>
3099
4190
  ): Micro<A, E | XE, R | XR>
4191
+ /**
4192
+ * When the `Micro` effect is completed, run the given finalizer effect if it
4193
+ * matches the specified predicate.
4194
+ *
4195
+ * @since 3.4.6
4196
+ * @experimental
4197
+ * @category resources & finalization
4198
+ */
3100
4199
  <A, E, R, XE, XR>(
3101
4200
  self: Micro<A, E, R>,
3102
4201
  predicate: Predicate<MicroExit<NoInfer<A>, NoInfer<E>>>,
@@ -3134,9 +4233,21 @@ export const onExitIf: {
3134
4233
  * @category resources & finalization
3135
4234
  */
3136
4235
  export const ensuring: {
3137
- <XE, XR>(
3138
- finalizer: Micro<void, XE, XR>
3139
- ): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4236
+ /**
4237
+ * Regardless of the result of the this `Micro` effect, run the finalizer effect.
4238
+ *
4239
+ * @since 3.4.0
4240
+ * @experimental
4241
+ * @category resources & finalization
4242
+ */
4243
+ <XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4244
+ /**
4245
+ * Regardless of the result of the this `Micro` effect, run the finalizer effect.
4246
+ *
4247
+ * @since 3.4.0
4248
+ * @experimental
4249
+ * @category resources & finalization
4250
+ */
3140
4251
  <A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>
3141
4252
  } = dual(
3142
4253
  2,
@@ -3153,9 +4264,25 @@ export const ensuring: {
3153
4264
  * @category resources & finalization
3154
4265
  */
3155
4266
  export const onError: {
4267
+ /**
4268
+ * When the `Micro` effect fails, run the given finalizer effect with the
4269
+ * `MicroCause` of the executed effect.
4270
+ *
4271
+ * @since 3.4.6
4272
+ * @experimental
4273
+ * @category resources & finalization
4274
+ */
3156
4275
  <A, E, XE, XR>(
3157
4276
  f: (cause: MicroCause<NoInfer<E>>) => Micro<void, XE, XR>
3158
4277
  ): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4278
+ /**
4279
+ * When the `Micro` effect fails, run the given finalizer effect with the
4280
+ * `MicroCause` of the executed effect.
4281
+ *
4282
+ * @since 3.4.6
4283
+ * @experimental
4284
+ * @category resources & finalization
4285
+ */
3159
4286
  <A, E, R, XE, XR>(
3160
4287
  self: Micro<A, E, R>,
3161
4288
  f: (cause: MicroCause<NoInfer<E>>) => Micro<void, XE, XR>
@@ -3176,9 +4303,21 @@ export const onError: {
3176
4303
  * @category resources & finalization
3177
4304
  */
3178
4305
  export const onInterrupt: {
3179
- <XE, XR>(
3180
- finalizer: Micro<void, XE, XR>
3181
- ): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4306
+ /**
4307
+ * If this `Micro` effect is aborted, run the finalizer effect.
4308
+ *
4309
+ * @since 3.4.6
4310
+ * @experimental
4311
+ * @category resources & finalization
4312
+ */
4313
+ <XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>
4314
+ /**
4315
+ * If this `Micro` effect is aborted, run the finalizer effect.
4316
+ *
4317
+ * @since 3.4.6
4318
+ * @experimental
4319
+ * @category resources & finalization
4320
+ */
3182
4321
  <A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>
3183
4322
  } = dual(
3184
4323
  2,
@@ -3434,14 +4573,48 @@ export const all = <
3434
4573
  * @category collecting & elements
3435
4574
  */
3436
4575
  export const forEach: {
3437
- <A, B, E, R>(iterable: Iterable<A>, f: (a: A, index: number) => Micro<B, E, R>, options?: {
3438
- readonly concurrency?: Concurrency | undefined
3439
- readonly discard?: false | undefined
3440
- }): Micro<Array<B>, E, R>
3441
- <A, B, E, R>(iterable: Iterable<A>, f: (a: A, index: number) => Micro<B, E, R>, options: {
3442
- readonly concurrency?: Concurrency | undefined
3443
- readonly discard: true
3444
- }): Micro<void, E, R>
4576
+ /**
4577
+ * For each element of the provided iterable, run the effect and collect the results.
4578
+ *
4579
+ * If the `discard` option is set to `true`, the results will be discarded and
4580
+ * the effect will return `void`.
4581
+ *
4582
+ * The `concurrency` option can be set to control how many effects are run in
4583
+ * parallel. By default, the effects are run sequentially.
4584
+ *
4585
+ * @since 3.4.0
4586
+ * @experimental
4587
+ * @category collecting & elements
4588
+ */
4589
+ <A, B, E, R>(
4590
+ iterable: Iterable<A>,
4591
+ f: (a: A, index: number) => Micro<B, E, R>,
4592
+ options?: {
4593
+ readonly concurrency?: Concurrency | undefined
4594
+ readonly discard?: false | undefined
4595
+ }
4596
+ ): Micro<Array<B>, E, R>
4597
+ /**
4598
+ * For each element of the provided iterable, run the effect and collect the results.
4599
+ *
4600
+ * If the `discard` option is set to `true`, the results will be discarded and
4601
+ * the effect will return `void`.
4602
+ *
4603
+ * The `concurrency` option can be set to control how many effects are run in
4604
+ * parallel. By default, the effects are run sequentially.
4605
+ *
4606
+ * @since 3.4.0
4607
+ * @experimental
4608
+ * @category collecting & elements
4609
+ */
4610
+ <A, B, E, R>(
4611
+ iterable: Iterable<A>,
4612
+ f: (a: A, index: number) => Micro<B, E, R>,
4613
+ options: {
4614
+ readonly concurrency?: Concurrency | undefined
4615
+ readonly discard: true
4616
+ }
4617
+ ): Micro<void, E, R>
3445
4618
  } = <
3446
4619
  A,
3447
4620
  B,
@@ -3583,7 +4756,21 @@ export const Do: Micro<{}> = succeed({})
3583
4756
  * @category do notation
3584
4757
  */
3585
4758
  export const bindTo: {
4759
+ /**
4760
+ * Bind the success value of this `Micro` effect to the provided name.
4761
+ *
4762
+ * @since 3.4.0
4763
+ * @experimental
4764
+ * @category do notation
4765
+ */
3586
4766
  <N extends string>(name: N): <A, E, R>(self: Micro<A, E, R>) => Micro<{ [K in N]: A }, E, R>
4767
+ /**
4768
+ * Bind the success value of this `Micro` effect to the provided name.
4769
+ *
4770
+ * @since 3.4.0
4771
+ * @experimental
4772
+ * @category do notation
4773
+ */
3587
4774
  <A, E, R, N extends string>(self: Micro<A, E, R>, name: N): Micro<{ [K in N]: A }, E, R>
3588
4775
  } = doNotation.bindTo<MicroTypeLambda>(map)
3589
4776
 
@@ -3595,10 +4782,24 @@ export const bindTo: {
3595
4782
  * @category do notation
3596
4783
  */
3597
4784
  export const bind: {
4785
+ /**
4786
+ * Bind the success value of this `Micro` effect to the provided name.
4787
+ *
4788
+ * @since 3.4.0
4789
+ * @experimental
4790
+ * @category do notation
4791
+ */
3598
4792
  <N extends string, A extends Record<string, any>, B, E2, R2>(
3599
4793
  name: N,
3600
4794
  f: (a: A) => Micro<B, E2, R2>
3601
4795
  ): <E, R>(self: Micro<A, E, R>) => Micro<Simplify<Omit<A, N> & { [K in N]: B }>, E | E2, R | R2>
4796
+ /**
4797
+ * Bind the success value of this `Micro` effect to the provided name.
4798
+ *
4799
+ * @since 3.4.0
4800
+ * @experimental
4801
+ * @category do notation
4802
+ */
3602
4803
  <A extends Record<string, any>, E, R, B, E2, R2, N extends string>(
3603
4804
  self: Micro<A, E, R>,
3604
4805
  name: N,
@@ -3652,7 +4853,7 @@ export type HandleTypeId = typeof HandleTypeId
3652
4853
  * @experimental
3653
4854
  * @category handle & forking
3654
4855
  */
3655
- export interface Handle<A, E = never> {
4856
+ export interface Handle<A, E = never> extends Micro<A, E> {
3656
4857
  readonly [HandleTypeId]: HandleTypeId
3657
4858
  readonly await: Micro<MicroExit<A, E>>
3658
4859
  readonly join: Micro<A, E>
@@ -3661,6 +4862,28 @@ export interface Handle<A, E = never> {
3661
4862
  readonly addObserver: (observer: (exit: MicroExit<A, E>) => void) => void
3662
4863
  readonly removeObserver: (observer: (exit: MicroExit<A, E>) => void) => void
3663
4864
  readonly unsafePoll: () => MicroExit<A, E> | null
4865
+
4866
+ [Unify.typeSymbol]?: unknown
4867
+ [Unify.unifySymbol]?: HandleUnify<this>
4868
+ [Unify.ignoreSymbol]?: HandleUnifyIgnore
4869
+ }
4870
+
4871
+ /**
4872
+ * @category models
4873
+ * @since 3.8.4
4874
+ * @experimental
4875
+ */
4876
+ export interface HandleUnify<A extends { [Unify.typeSymbol]?: any }> extends MicroUnify<A> {
4877
+ Handle?: () => A[Unify.typeSymbol] extends Handle<infer A0, infer E0> | infer _ ? Handle<A0, E0> : never
4878
+ }
4879
+
4880
+ /**
4881
+ * @category models
4882
+ * @since 3.8.4
4883
+ * @experimental
4884
+ */
4885
+ export interface HandleUnifyIgnore extends MicroUnifyIgnore {
4886
+ Micro?: true
3664
4887
  }
3665
4888
 
3666
4889
  /**
@@ -3671,7 +4894,7 @@ export interface Handle<A, E = never> {
3671
4894
  export const isHandle = (u: unknown): u is Handle<unknown, unknown> =>
3672
4895
  typeof u === "object" && u !== null && HandleTypeId in u
3673
4896
 
3674
- class HandleImpl<A, E> implements Handle<A, E> {
4897
+ class HandleImpl<A, E> extends Class<A, E> implements Handle<A, E> {
3675
4898
  readonly [HandleTypeId]: HandleTypeId
3676
4899
 
3677
4900
  readonly observers: Set<(exit: MicroExit<A, E>) => void> = new Set()
@@ -3680,6 +4903,7 @@ class HandleImpl<A, E> implements Handle<A, E> {
3680
4903
  readonly isRoot: boolean
3681
4904
 
3682
4905
  constructor(readonly parentSignal: AbortSignal, controller?: AbortController) {
4906
+ super()
3683
4907
  this[HandleTypeId] = HandleTypeId
3684
4908
  this.isRoot = controller !== undefined
3685
4909
  this._controller = controller ?? new AbortController()
@@ -3746,6 +4970,10 @@ class HandleImpl<A, E> implements Handle<A, E> {
3746
4970
  return this.await
3747
4971
  })
3748
4972
  }
4973
+
4974
+ asMicro(): Micro<A, E> {
4975
+ return this.join
4976
+ }
3749
4977
  }
3750
4978
 
3751
4979
  /**
@@ -3813,7 +5041,27 @@ export const forkDaemon = <A, E, R>(self: Micro<A, E, R>): Micro<Handle<A, E>, n
3813
5041
  * @category handle & forking
3814
5042
  */
3815
5043
  export const forkIn: {
5044
+ /**
5045
+ * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
5046
+ * aborted.
5047
+ *
5048
+ * The lifetime of the handle will be attached to the provided `MicroScope`.
5049
+ *
5050
+ * @since 3.4.0
5051
+ * @experimental
5052
+ * @category handle & forking
5053
+ */
3816
5054
  (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>
5055
+ /**
5056
+ * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
5057
+ * aborted.
5058
+ *
5059
+ * The lifetime of the handle will be attached to the provided `MicroScope`.
5060
+ *
5061
+ * @since 3.4.0
5062
+ * @experimental
5063
+ * @category handle & forking
5064
+ */
3817
5065
  <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<Handle<A, E>, never, R>
3818
5066
  } = dual(
3819
5067
  2,