effect 3.10.18 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/dist/cjs/Array.js +206 -0
  2. package/dist/cjs/Array.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +181 -24
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/BigInt.js +54 -0
  6. package/dist/cjs/BigInt.js.map +1 -1
  7. package/dist/cjs/Boolean.js +24 -0
  8. package/dist/cjs/Boolean.js.map +1 -1
  9. package/dist/cjs/Brand.js +4 -0
  10. package/dist/cjs/Brand.js.map +1 -1
  11. package/dist/cjs/Channel.js +44 -4
  12. package/dist/cjs/Channel.js.map +1 -1
  13. package/dist/cjs/Chunk.js +8 -0
  14. package/dist/cjs/Chunk.js.map +1 -1
  15. package/dist/cjs/Config.js +10 -1
  16. package/dist/cjs/Config.js.map +1 -1
  17. package/dist/cjs/Context.js +50 -1
  18. package/dist/cjs/Context.js.map +1 -1
  19. package/dist/cjs/Cron.js +81 -67
  20. package/dist/cjs/Cron.js.map +1 -1
  21. package/dist/cjs/Data.js +14 -0
  22. package/dist/cjs/Data.js.map +1 -1
  23. package/dist/cjs/DateTime.js +178 -664
  24. package/dist/cjs/DateTime.js.map +1 -1
  25. package/dist/cjs/Duration.js +2 -0
  26. package/dist/cjs/Duration.js.map +1 -1
  27. package/dist/cjs/Effect.js +296 -4
  28. package/dist/cjs/Effect.js.map +1 -1
  29. package/dist/cjs/Either.js +38 -2
  30. package/dist/cjs/Either.js.map +1 -1
  31. package/dist/cjs/FiberHandle.js +6 -0
  32. package/dist/cjs/FiberHandle.js.map +1 -1
  33. package/dist/cjs/FiberMap.js +6 -0
  34. package/dist/cjs/FiberMap.js.map +1 -1
  35. package/dist/cjs/FiberSet.js +6 -0
  36. package/dist/cjs/FiberSet.js.map +1 -1
  37. package/dist/cjs/Function.js +34 -0
  38. package/dist/cjs/Function.js.map +1 -1
  39. package/dist/cjs/GlobalValue.js +2 -0
  40. package/dist/cjs/GlobalValue.js.map +1 -1
  41. package/dist/cjs/HashMap.js.map +1 -1
  42. package/dist/cjs/Inspectable.js +8 -4
  43. package/dist/cjs/Inspectable.js.map +1 -1
  44. package/dist/cjs/Iterable.js +18 -0
  45. package/dist/cjs/Iterable.js.map +1 -1
  46. package/dist/cjs/JSONSchema.js.map +1 -1
  47. package/dist/cjs/List.js +4 -0
  48. package/dist/cjs/List.js.map +1 -1
  49. package/dist/cjs/Logger.js +26 -0
  50. package/dist/cjs/Logger.js.map +1 -1
  51. package/dist/cjs/Mailbox.js +2 -0
  52. package/dist/cjs/Mailbox.js.map +1 -1
  53. package/dist/cjs/ManagedRuntime.js +2 -0
  54. package/dist/cjs/ManagedRuntime.js.map +1 -1
  55. package/dist/cjs/Metric.js +10 -0
  56. package/dist/cjs/Metric.js.map +1 -1
  57. package/dist/cjs/Micro.js +1104 -1069
  58. package/dist/cjs/Micro.js.map +1 -1
  59. package/dist/cjs/Number.js +44 -0
  60. package/dist/cjs/Number.js.map +1 -1
  61. package/dist/cjs/Option.js +70 -0
  62. package/dist/cjs/Option.js.map +1 -1
  63. package/dist/cjs/Order.js +2 -0
  64. package/dist/cjs/Order.js.map +1 -1
  65. package/dist/cjs/Ordering.js +4 -0
  66. package/dist/cjs/Ordering.js.map +1 -1
  67. package/dist/cjs/Predicate.js +68 -0
  68. package/dist/cjs/Predicate.js.map +1 -1
  69. package/dist/cjs/Random.js +4 -0
  70. package/dist/cjs/Random.js.map +1 -1
  71. package/dist/cjs/RateLimiter.js +4 -0
  72. package/dist/cjs/RateLimiter.js.map +1 -1
  73. package/dist/cjs/RcMap.js +2 -0
  74. package/dist/cjs/RcMap.js.map +1 -1
  75. package/dist/cjs/RcRef.js +2 -0
  76. package/dist/cjs/RcRef.js.map +1 -1
  77. package/dist/cjs/Record.js +56 -0
  78. package/dist/cjs/Record.js.map +1 -1
  79. package/dist/cjs/Redacted.js +8 -0
  80. package/dist/cjs/Redacted.js.map +1 -1
  81. package/dist/cjs/RegExp.js +4 -0
  82. package/dist/cjs/RegExp.js.map +1 -1
  83. package/dist/cjs/Request.js +4 -0
  84. package/dist/cjs/Request.js.map +1 -1
  85. package/dist/cjs/RequestResolver.js +2 -0
  86. package/dist/cjs/RequestResolver.js.map +1 -1
  87. package/dist/cjs/Runtime.js +6 -0
  88. package/dist/cjs/Runtime.js.map +1 -1
  89. package/dist/cjs/STM.js.map +1 -1
  90. package/dist/cjs/Schema.js +91 -8
  91. package/dist/cjs/Schema.js.map +1 -1
  92. package/dist/cjs/Sink.js +9 -1
  93. package/dist/cjs/Sink.js.map +1 -1
  94. package/dist/cjs/Stream.js +179 -7
  95. package/dist/cjs/Stream.js.map +1 -1
  96. package/dist/cjs/String.js +62 -0
  97. package/dist/cjs/String.js.map +1 -1
  98. package/dist/cjs/Struct.js +12 -0
  99. package/dist/cjs/Struct.js.map +1 -1
  100. package/dist/cjs/Symbol.js +2 -0
  101. package/dist/cjs/Symbol.js.map +1 -1
  102. package/dist/cjs/Trie.js +56 -0
  103. package/dist/cjs/Trie.js.map +1 -1
  104. package/dist/cjs/Tuple.js +18 -0
  105. package/dist/cjs/Tuple.js.map +1 -1
  106. package/dist/cjs/Utils.js +7 -1
  107. package/dist/cjs/Utils.js.map +1 -1
  108. package/dist/cjs/internal/channel/channelExecutor.js +5 -9
  109. package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
  110. package/dist/cjs/internal/channel.js +156 -130
  111. package/dist/cjs/internal/channel.js.map +1 -1
  112. package/dist/cjs/internal/config.js +13 -4
  113. package/dist/cjs/internal/config.js.map +1 -1
  114. package/dist/cjs/internal/context.js +46 -3
  115. package/dist/cjs/internal/context.js.map +1 -1
  116. package/dist/cjs/internal/dateTime.js +747 -0
  117. package/dist/cjs/internal/dateTime.js.map +1 -0
  118. package/dist/cjs/internal/fiberRuntime.js +34 -11
  119. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  120. package/dist/cjs/internal/groupBy.js +9 -3
  121. package/dist/cjs/internal/groupBy.js.map +1 -1
  122. package/dist/cjs/internal/layer.js +1 -1
  123. package/dist/cjs/internal/layer.js.map +1 -1
  124. package/dist/cjs/internal/mailbox.js +1 -1
  125. package/dist/cjs/internal/mailbox.js.map +1 -1
  126. package/dist/cjs/internal/sink.js +25 -21
  127. package/dist/cjs/internal/sink.js.map +1 -1
  128. package/dist/cjs/internal/stream.js +70 -71
  129. package/dist/cjs/internal/stream.js.map +1 -1
  130. package/dist/cjs/internal/version.js +1 -1
  131. package/dist/cjs/internal/version.js.map +1 -1
  132. package/dist/dts/Array.d.ts +534 -0
  133. package/dist/dts/Array.d.ts.map +1 -1
  134. package/dist/dts/BigDecimal.d.ts +172 -1
  135. package/dist/dts/BigDecimal.d.ts.map +1 -1
  136. package/dist/dts/BigInt.d.ts +114 -0
  137. package/dist/dts/BigInt.d.ts.map +1 -1
  138. package/dist/dts/Boolean.d.ts +56 -0
  139. package/dist/dts/Boolean.d.ts.map +1 -1
  140. package/dist/dts/Brand.d.ts +6 -0
  141. package/dist/dts/Brand.d.ts.map +1 -1
  142. package/dist/dts/Channel.d.ts +66 -5
  143. package/dist/dts/Channel.d.ts.map +1 -1
  144. package/dist/dts/Chunk.d.ts +30 -0
  145. package/dist/dts/Chunk.d.ts.map +1 -1
  146. package/dist/dts/Config.d.ts +25 -1
  147. package/dist/dts/Config.d.ts.map +1 -1
  148. package/dist/dts/Context.d.ts +155 -0
  149. package/dist/dts/Context.d.ts.map +1 -1
  150. package/dist/dts/Cron.d.ts +21 -6
  151. package/dist/dts/Cron.d.ts.map +1 -1
  152. package/dist/dts/Data.d.ts +26 -0
  153. package/dist/dts/Data.d.ts.map +1 -1
  154. package/dist/dts/DateTime.d.ts +192 -49
  155. package/dist/dts/DateTime.d.ts.map +1 -1
  156. package/dist/dts/Duration.d.ts +2 -0
  157. package/dist/dts/Duration.d.ts.map +1 -1
  158. package/dist/dts/Effect.d.ts +658 -1
  159. package/dist/dts/Effect.d.ts.map +1 -1
  160. package/dist/dts/Either.d.ts +84 -2
  161. package/dist/dts/Either.d.ts.map +1 -1
  162. package/dist/dts/FiberHandle.d.ts +6 -0
  163. package/dist/dts/FiberHandle.d.ts.map +1 -1
  164. package/dist/dts/FiberMap.d.ts +6 -0
  165. package/dist/dts/FiberMap.d.ts.map +1 -1
  166. package/dist/dts/FiberSet.d.ts +6 -0
  167. package/dist/dts/FiberSet.d.ts.map +1 -1
  168. package/dist/dts/Function.d.ts +50 -0
  169. package/dist/dts/Function.d.ts.map +1 -1
  170. package/dist/dts/GlobalValue.d.ts +2 -0
  171. package/dist/dts/GlobalValue.d.ts.map +1 -1
  172. package/dist/dts/HashMap.d.ts +6 -0
  173. package/dist/dts/HashMap.d.ts.map +1 -1
  174. package/dist/dts/Inspectable.d.ts.map +1 -1
  175. package/dist/dts/Iterable.d.ts +26 -0
  176. package/dist/dts/Iterable.d.ts.map +1 -1
  177. package/dist/dts/JSONSchema.d.ts +1 -0
  178. package/dist/dts/JSONSchema.d.ts.map +1 -1
  179. package/dist/dts/List.d.ts +20 -0
  180. package/dist/dts/List.d.ts.map +1 -1
  181. package/dist/dts/Logger.d.ts +34 -0
  182. package/dist/dts/Logger.d.ts.map +1 -1
  183. package/dist/dts/Mailbox.d.ts +2 -0
  184. package/dist/dts/Mailbox.d.ts.map +1 -1
  185. package/dist/dts/ManagedRuntime.d.ts +2 -0
  186. package/dist/dts/ManagedRuntime.d.ts.map +1 -1
  187. package/dist/dts/Metric.d.ts +18 -0
  188. package/dist/dts/Metric.d.ts.map +1 -1
  189. package/dist/dts/Micro.d.ts +880 -863
  190. package/dist/dts/Micro.d.ts.map +1 -1
  191. package/dist/dts/Number.d.ts +104 -0
  192. package/dist/dts/Number.d.ts.map +1 -1
  193. package/dist/dts/Option.d.ts +142 -0
  194. package/dist/dts/Option.d.ts.map +1 -1
  195. package/dist/dts/Order.d.ts +2 -0
  196. package/dist/dts/Order.d.ts.map +1 -1
  197. package/dist/dts/Ordering.d.ts +8 -0
  198. package/dist/dts/Ordering.d.ts.map +1 -1
  199. package/dist/dts/Predicate.d.ts +104 -0
  200. package/dist/dts/Predicate.d.ts.map +1 -1
  201. package/dist/dts/Random.d.ts +4 -0
  202. package/dist/dts/Random.d.ts.map +1 -1
  203. package/dist/dts/RateLimiter.d.ts +4 -0
  204. package/dist/dts/RateLimiter.d.ts.map +1 -1
  205. package/dist/dts/RcMap.d.ts +6 -0
  206. package/dist/dts/RcMap.d.ts.map +1 -1
  207. package/dist/dts/RcRef.d.ts +2 -0
  208. package/dist/dts/RcRef.d.ts.map +1 -1
  209. package/dist/dts/Record.d.ts +136 -0
  210. package/dist/dts/Record.d.ts.map +1 -1
  211. package/dist/dts/Redacted.d.ts +8 -0
  212. package/dist/dts/Redacted.d.ts.map +1 -1
  213. package/dist/dts/RegExp.d.ts +4 -0
  214. package/dist/dts/RegExp.d.ts.map +1 -1
  215. package/dist/dts/Request.d.ts +4 -0
  216. package/dist/dts/Request.d.ts.map +1 -1
  217. package/dist/dts/RequestResolver.d.ts +6 -0
  218. package/dist/dts/RequestResolver.d.ts.map +1 -1
  219. package/dist/dts/Runtime.d.ts +18 -0
  220. package/dist/dts/Runtime.d.ts.map +1 -1
  221. package/dist/dts/STM.d.ts +2 -0
  222. package/dist/dts/STM.d.ts.map +1 -1
  223. package/dist/dts/Schema.d.ts +90 -0
  224. package/dist/dts/Schema.d.ts.map +1 -1
  225. package/dist/dts/Sink.d.ts +8 -0
  226. package/dist/dts/Sink.d.ts.map +1 -1
  227. package/dist/dts/Stream.d.ts +394 -32
  228. package/dist/dts/Stream.d.ts.map +1 -1
  229. package/dist/dts/String.d.ts +94 -0
  230. package/dist/dts/String.d.ts.map +1 -1
  231. package/dist/dts/Struct.d.ts +24 -0
  232. package/dist/dts/Struct.d.ts.map +1 -1
  233. package/dist/dts/Symbol.d.ts +2 -0
  234. package/dist/dts/Symbol.d.ts.map +1 -1
  235. package/dist/dts/Trie.d.ts +132 -0
  236. package/dist/dts/Trie.d.ts.map +1 -1
  237. package/dist/dts/Tuple.d.ts +42 -0
  238. package/dist/dts/Tuple.d.ts.map +1 -1
  239. package/dist/dts/Types.d.ts +24 -0
  240. package/dist/dts/Types.d.ts.map +1 -1
  241. package/dist/dts/Utils.d.ts +4 -0
  242. package/dist/dts/Utils.d.ts.map +1 -1
  243. package/dist/dts/internal/context.d.ts +1 -1
  244. package/dist/dts/internal/context.d.ts.map +1 -1
  245. package/dist/dts/internal/dateTime.d.ts +2 -0
  246. package/dist/dts/internal/dateTime.d.ts.map +1 -0
  247. package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
  248. package/dist/dts/internal/stream.d.ts.map +1 -1
  249. package/dist/esm/Array.js +208 -0
  250. package/dist/esm/Array.js.map +1 -1
  251. package/dist/esm/BigDecimal.js +175 -20
  252. package/dist/esm/BigDecimal.js.map +1 -1
  253. package/dist/esm/BigInt.js +54 -0
  254. package/dist/esm/BigInt.js.map +1 -1
  255. package/dist/esm/Boolean.js +24 -0
  256. package/dist/esm/Boolean.js.map +1 -1
  257. package/dist/esm/Brand.js +4 -0
  258. package/dist/esm/Brand.js.map +1 -1
  259. package/dist/esm/Channel.js +42 -2
  260. package/dist/esm/Channel.js.map +1 -1
  261. package/dist/esm/Chunk.js +8 -0
  262. package/dist/esm/Chunk.js.map +1 -1
  263. package/dist/esm/Config.js +9 -0
  264. package/dist/esm/Config.js.map +1 -1
  265. package/dist/esm/Context.js +49 -0
  266. package/dist/esm/Context.js.map +1 -1
  267. package/dist/esm/Cron.js +81 -67
  268. package/dist/esm/Cron.js.map +1 -1
  269. package/dist/esm/Data.js +16 -0
  270. package/dist/esm/Data.js.map +1 -1
  271. package/dist/esm/DateTime.js +176 -627
  272. package/dist/esm/DateTime.js.map +1 -1
  273. package/dist/esm/Duration.js +2 -0
  274. package/dist/esm/Duration.js.map +1 -1
  275. package/dist/esm/Effect.js +297 -0
  276. package/dist/esm/Effect.js.map +1 -1
  277. package/dist/esm/Either.js +40 -2
  278. package/dist/esm/Either.js.map +1 -1
  279. package/dist/esm/FiberHandle.js +6 -0
  280. package/dist/esm/FiberHandle.js.map +1 -1
  281. package/dist/esm/FiberMap.js +6 -0
  282. package/dist/esm/FiberMap.js.map +1 -1
  283. package/dist/esm/FiberSet.js +6 -0
  284. package/dist/esm/FiberSet.js.map +1 -1
  285. package/dist/esm/Function.js +34 -0
  286. package/dist/esm/Function.js.map +1 -1
  287. package/dist/esm/GlobalValue.js +2 -0
  288. package/dist/esm/GlobalValue.js.map +1 -1
  289. package/dist/esm/HashMap.js.map +1 -1
  290. package/dist/esm/Inspectable.js +8 -4
  291. package/dist/esm/Inspectable.js.map +1 -1
  292. package/dist/esm/Iterable.js +18 -0
  293. package/dist/esm/Iterable.js.map +1 -1
  294. package/dist/esm/JSONSchema.js.map +1 -1
  295. package/dist/esm/List.js +4 -0
  296. package/dist/esm/List.js.map +1 -1
  297. package/dist/esm/Logger.js +26 -0
  298. package/dist/esm/Logger.js.map +1 -1
  299. package/dist/esm/Mailbox.js +2 -0
  300. package/dist/esm/Mailbox.js.map +1 -1
  301. package/dist/esm/ManagedRuntime.js +2 -0
  302. package/dist/esm/ManagedRuntime.js.map +1 -1
  303. package/dist/esm/Metric.js +10 -0
  304. package/dist/esm/Metric.js.map +1 -1
  305. package/dist/esm/Micro.js +1077 -1037
  306. package/dist/esm/Micro.js.map +1 -1
  307. package/dist/esm/Number.js +44 -0
  308. package/dist/esm/Number.js.map +1 -1
  309. package/dist/esm/Option.js +72 -0
  310. package/dist/esm/Option.js.map +1 -1
  311. package/dist/esm/Order.js +2 -0
  312. package/dist/esm/Order.js.map +1 -1
  313. package/dist/esm/Ordering.js +4 -0
  314. package/dist/esm/Ordering.js.map +1 -1
  315. package/dist/esm/Predicate.js +68 -0
  316. package/dist/esm/Predicate.js.map +1 -1
  317. package/dist/esm/Random.js +4 -0
  318. package/dist/esm/Random.js.map +1 -1
  319. package/dist/esm/RateLimiter.js +4 -0
  320. package/dist/esm/RateLimiter.js.map +1 -1
  321. package/dist/esm/RcMap.js +2 -0
  322. package/dist/esm/RcMap.js.map +1 -1
  323. package/dist/esm/RcRef.js +2 -0
  324. package/dist/esm/RcRef.js.map +1 -1
  325. package/dist/esm/Record.js +56 -0
  326. package/dist/esm/Record.js.map +1 -1
  327. package/dist/esm/Redacted.js +8 -0
  328. package/dist/esm/Redacted.js.map +1 -1
  329. package/dist/esm/RegExp.js +4 -0
  330. package/dist/esm/RegExp.js.map +1 -1
  331. package/dist/esm/Request.js +4 -0
  332. package/dist/esm/Request.js.map +1 -1
  333. package/dist/esm/RequestResolver.js +2 -0
  334. package/dist/esm/RequestResolver.js.map +1 -1
  335. package/dist/esm/Runtime.js +6 -0
  336. package/dist/esm/Runtime.js.map +1 -1
  337. package/dist/esm/STM.js.map +1 -1
  338. package/dist/esm/Schema.js +88 -0
  339. package/dist/esm/Schema.js.map +1 -1
  340. package/dist/esm/Sink.js +8 -0
  341. package/dist/esm/Sink.js.map +1 -1
  342. package/dist/esm/Stream.js +183 -5
  343. package/dist/esm/Stream.js.map +1 -1
  344. package/dist/esm/String.js +62 -0
  345. package/dist/esm/String.js.map +1 -1
  346. package/dist/esm/Struct.js +12 -0
  347. package/dist/esm/Struct.js.map +1 -1
  348. package/dist/esm/Symbol.js +2 -0
  349. package/dist/esm/Symbol.js.map +1 -1
  350. package/dist/esm/Trie.js +56 -0
  351. package/dist/esm/Trie.js.map +1 -1
  352. package/dist/esm/Tuple.js +22 -0
  353. package/dist/esm/Tuple.js.map +1 -1
  354. package/dist/esm/Utils.js +5 -0
  355. package/dist/esm/Utils.js.map +1 -1
  356. package/dist/esm/internal/channel/channelExecutor.js +5 -7
  357. package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
  358. package/dist/esm/internal/channel.js +152 -129
  359. package/dist/esm/internal/channel.js.map +1 -1
  360. package/dist/esm/internal/config.js +11 -3
  361. package/dist/esm/internal/config.js.map +1 -1
  362. package/dist/esm/internal/context.js +42 -2
  363. package/dist/esm/internal/context.js.map +1 -1
  364. package/dist/esm/internal/dateTime.js +704 -0
  365. package/dist/esm/internal/dateTime.js.map +1 -0
  366. package/dist/esm/internal/fiberRuntime.js +31 -9
  367. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  368. package/dist/esm/internal/groupBy.js +9 -3
  369. package/dist/esm/internal/groupBy.js.map +1 -1
  370. package/dist/esm/internal/layer.js +1 -1
  371. package/dist/esm/internal/layer.js.map +1 -1
  372. package/dist/esm/internal/mailbox.js +1 -1
  373. package/dist/esm/internal/mailbox.js.map +1 -1
  374. package/dist/esm/internal/sink.js +23 -20
  375. package/dist/esm/internal/sink.js.map +1 -1
  376. package/dist/esm/internal/stream.js +66 -69
  377. package/dist/esm/internal/stream.js.map +1 -1
  378. package/dist/esm/internal/version.js +1 -1
  379. package/dist/esm/internal/version.js.map +1 -1
  380. package/package.json +1 -1
  381. package/src/Array.ts +534 -0
  382. package/src/BigDecimal.ts +247 -21
  383. package/src/BigInt.ts +114 -0
  384. package/src/Boolean.ts +56 -0
  385. package/src/Brand.ts +6 -0
  386. package/src/Channel.ts +81 -5
  387. package/src/Chunk.ts +32 -0
  388. package/src/Config.ts +26 -1
  389. package/src/Context.ts +163 -0
  390. package/src/Cron.ts +91 -68
  391. package/src/Data.ts +26 -0
  392. package/src/DateTime.ts +307 -757
  393. package/src/Duration.ts +2 -0
  394. package/src/Effect.ts +910 -1
  395. package/src/Either.ts +84 -2
  396. package/src/FiberHandle.ts +6 -0
  397. package/src/FiberMap.ts +6 -0
  398. package/src/FiberSet.ts +6 -0
  399. package/src/Function.ts +50 -0
  400. package/src/GlobalValue.ts +2 -0
  401. package/src/HashMap.ts +6 -0
  402. package/src/Inspectable.ts +11 -7
  403. package/src/Iterable.ts +26 -0
  404. package/src/JSONSchema.ts +1 -0
  405. package/src/List.ts +24 -0
  406. package/src/Logger.ts +34 -0
  407. package/src/Mailbox.ts +2 -0
  408. package/src/ManagedRuntime.ts +2 -0
  409. package/src/Metric.ts +18 -0
  410. package/src/Micro.ts +2007 -1745
  411. package/src/Number.ts +104 -0
  412. package/src/Option.ts +142 -0
  413. package/src/Order.ts +2 -0
  414. package/src/Ordering.ts +8 -0
  415. package/src/Predicate.ts +104 -0
  416. package/src/Random.ts +4 -0
  417. package/src/RateLimiter.ts +4 -0
  418. package/src/RcMap.ts +6 -0
  419. package/src/RcRef.ts +2 -0
  420. package/src/Record.ts +136 -0
  421. package/src/Redacted.ts +8 -0
  422. package/src/RegExp.ts +4 -0
  423. package/src/Request.ts +4 -0
  424. package/src/RequestResolver.ts +6 -0
  425. package/src/Runtime.ts +18 -0
  426. package/src/STM.ts +2 -0
  427. package/src/Schema.ts +124 -0
  428. package/src/Sink.ts +11 -0
  429. package/src/Stream.ts +399 -44
  430. package/src/String.ts +94 -0
  431. package/src/Struct.ts +24 -0
  432. package/src/Symbol.ts +2 -0
  433. package/src/Trie.ts +132 -0
  434. package/src/Tuple.ts +42 -0
  435. package/src/Types.ts +24 -0
  436. package/src/Utils.ts +8 -0
  437. package/src/internal/channel/channelExecutor.ts +37 -33
  438. package/src/internal/channel.ts +504 -467
  439. package/src/internal/config.ts +18 -6
  440. package/src/internal/context.ts +56 -4
  441. package/src/internal/dateTime.ts +1126 -0
  442. package/src/internal/fiberRuntime.ts +35 -16
  443. package/src/internal/groupBy.ts +13 -22
  444. package/src/internal/layer.ts +5 -8
  445. package/src/internal/mailbox.ts +6 -4
  446. package/src/internal/sink.ts +55 -35
  447. package/src/internal/stream.ts +299 -299
  448. package/src/internal/version.ts +1 -1
@@ -1,23 +1,17 @@
1
- /**
2
- * A lightweight alternative to the `Effect` data type, with a subset of the functionality.
3
- *
4
- * @since 3.4.0
5
- * @experimental
6
- */
7
- import type { Channel, ChannelTypeId } from "./Channel.js";
1
+ import type { Channel } from "./Channel.js";
8
2
  import * as Context from "./Context.js";
9
- import type { Effect, EffectTypeId, EffectUnify, EffectUnifyIgnore } from "./Effect.js";
3
+ import type { Effect, EffectUnify, EffectUnifyIgnore } from "./Effect.js";
4
+ import * as Effectable from "./Effectable.js";
10
5
  import * as Either from "./Either.js";
11
- import { type LazyArg } from "./Function.js";
6
+ import type { LazyArg } from "./Function.js";
12
7
  import type { TypeLambda } from "./HKT.js";
13
8
  import type { Inspectable } from "./Inspectable.js";
14
9
  import * as Option from "./Option.js";
15
- import { type Pipeable } from "./Pipeable.js";
16
- import { type Predicate, type Refinement } from "./Predicate.js";
17
- import type { ReadonlyRecord } from "./Record.js";
18
- import type { Sink, SinkTypeId } from "./Sink.js";
19
- import type { Stream, StreamTypeId } from "./Stream.js";
20
- import type { Concurrency, Covariant, Equals, NoInfer, NotFunction, Simplify } from "./Types.js";
10
+ import type { Pipeable } from "./Pipeable.js";
11
+ import type { Predicate, Refinement } from "./Predicate.js";
12
+ import type { Sink } from "./Sink.js";
13
+ import type { Stream } from "./Stream.js";
14
+ import type { Concurrency, Covariant, Equals, NotFunction, Simplify } from "./Types.js";
21
15
  import type * as Unify from "./Unify.js";
22
16
  import { YieldWrap } from "./Utils.js";
23
17
  /**
@@ -35,15 +29,15 @@ export type TypeId = typeof TypeId;
35
29
  /**
36
30
  * @since 3.4.0
37
31
  * @experimental
38
- * @category symbols
32
+ * @category MicroExit
39
33
  */
40
- export declare const runSymbol: unique symbol;
34
+ export declare const MicroExitTypeId: unique symbol;
41
35
  /**
42
36
  * @since 3.4.0
43
37
  * @experimental
44
- * @category symbols
38
+ * @category MicroExit
45
39
  */
46
- export type runSymbol = typeof runSymbol;
40
+ export type MicroExitTypeId = typeof TypeId;
47
41
  /**
48
42
  * A lightweight alternative to the `Effect` data type, with a subset of the functionality.
49
43
  *
@@ -53,7 +47,6 @@ export type runSymbol = typeof runSymbol;
53
47
  */
54
48
  export interface Micro<out A, out E = never, out R = never> extends Effect<A, E, R> {
55
49
  readonly [TypeId]: Micro.Variance<A, E, R>;
56
- [runSymbol](env: Env<any>, onExit: (exit: MicroExit<A, E>) => void): void;
57
50
  [Symbol.iterator](): MicroIterator<Micro<A, E, R>>;
58
51
  [Unify.typeSymbol]?: unknown;
59
52
  [Unify.unifySymbol]?: MicroUnify<this>;
@@ -126,32 +119,6 @@ export declare const isMicro: (u: unknown) => u is Micro<any, any, any>;
126
119
  export interface MicroIterator<T extends Micro<any, any, any>> {
127
120
  next(...args: ReadonlyArray<any>): IteratorResult<YieldWrap<T>, Micro.Success<T>>;
128
121
  }
129
- /**
130
- * @since 3.8.4
131
- * @experimental
132
- * @category models
133
- */
134
- export interface MicroClass {
135
- new <A, E = never, R = never>(): Micro<A, E, R>;
136
- }
137
- declare const MicroBase: MicroClass;
138
- /**
139
- * @since 3.8.4
140
- * @experimental
141
- * @category constructors
142
- */
143
- export declare abstract class Class<out A, out E = never, out R = never> extends MicroBase<A, E, R> {
144
- /**
145
- * @since 3.8.4
146
- * @experimental
147
- */
148
- abstract asMicro(): Micro<A, E, R>;
149
- /**
150
- * @since 3.8.4
151
- * @experimental
152
- */
153
- [runSymbol](env: Env<any>, onExit: (exit: MicroExit<A, E>) => void): void;
154
- }
155
122
  /**
156
123
  * @since 3.4.6
157
124
  * @experimental
@@ -286,1080 +253,1093 @@ export declare const causeWithTrace: {
286
253
  <E>(self: MicroCause<E>, trace: string): MicroCause<E>;
287
254
  };
288
255
  /**
289
- * @since 3.4.6
290
- * @experimental
291
- * @category MicroExit
292
- */
293
- export declare namespace MicroExit {
294
- /**
295
- * @since 3.4.6
296
- * @experimental
297
- * @category MicroExit
298
- */
299
- type Success<A, E = never> = Either.Right<MicroCause<E>, A>;
300
- /**
301
- * @since 3.4.6
302
- * @experimental
303
- * @category MicroExit
304
- */
305
- type Failure<A, E = never> = Either.Left<MicroCause<E>, A>;
306
- }
307
- /**
308
- * The MicroExit type is a data type that represents the result of a Micro
309
- * computation.
310
- *
311
- * It uses the `Either` data type to represent the success and failure cases.
312
- *
313
- * @since 3.4.6
256
+ * @since 3.11.0
314
257
  * @experimental
315
- * @category MicroExit
258
+ * @category Fiber
316
259
  */
317
- export type MicroExit<A, E = never> = MicroExit.Success<A, E> | MicroExit.Failure<A, E>;
260
+ export declare const FiberTypeId: unique symbol;
318
261
  /**
319
- * @since 3.4.6
262
+ * @since 3.11.0
320
263
  * @experimental
321
- * @category MicroExit
264
+ * @category Fiber
322
265
  */
323
- export declare const exitInterrupt: MicroExit<never>;
266
+ export type FiberTypeId = typeof FiberTypeId;
324
267
  /**
325
- * @since 3.4.6
268
+ * @since 3.11.0
326
269
  * @experimental
327
- * @category MicroExit
270
+ * @category Fiber
328
271
  */
329
- export declare const exitSucceed: <A>(a: A) => MicroExit<A, never>;
272
+ export interface Fiber<out A, out E = never> {
273
+ readonly [FiberTypeId]: Fiber.Variance<A, E>;
274
+ readonly currentOpCount: number;
275
+ readonly getRef: <I, A>(ref: Context.Reference<I, A>) => A;
276
+ readonly context: Context.Context<never>;
277
+ readonly addObserver: (cb: (exit: MicroExit<A, E>) => void) => () => void;
278
+ readonly unsafeInterrupt: () => void;
279
+ readonly unsafePoll: () => MicroExit<A, E> | undefined;
280
+ }
330
281
  /**
331
- * @since 3.4.6
282
+ * @since 3.11.0
332
283
  * @experimental
333
- * @category MicroExit
284
+ * @category Fiber
334
285
  */
335
- export declare const exitFail: <E>(e: E) => MicroExit<never, E>;
286
+ export declare namespace Fiber {
287
+ /**
288
+ * @since 3.11.0
289
+ * @experimental
290
+ * @category Fiber
291
+ */
292
+ interface Variance<out A, out E = never> {
293
+ readonly _A: Covariant<A>;
294
+ readonly _E: Covariant<E>;
295
+ }
296
+ }
297
+ declare class FiberImpl<in out A = any, in out E = any> implements Fiber<A, E> {
298
+ context: Context.Context<never>;
299
+ interruptible: boolean;
300
+ readonly [FiberTypeId]: Fiber.Variance<A, E>;
301
+ readonly _stack: Array<Primitive>;
302
+ readonly _observers: Array<(exit: MicroExit<A, E>) => void>;
303
+ _exit: MicroExit<A, E> | undefined;
304
+ _children: Set<FiberImpl<any, any>> | undefined;
305
+ currentOpCount: number;
306
+ constructor(context: Context.Context<never>, interruptible?: boolean);
307
+ getRef<I, A>(ref: Context.Reference<I, A>): A;
308
+ addObserver(cb: (exit: MicroExit<A, E>) => void): () => void;
309
+ _interrupted: boolean;
310
+ unsafeInterrupt(): void;
311
+ unsafePoll(): MicroExit<A, E> | undefined;
312
+ evaluate(effect: Primitive): void;
313
+ runLoop(effect: Primitive): MicroExit<A, E> | Yield;
314
+ getCont<S extends successCont | failureCont>(symbol: S): (Primitive & Record<S, (value: any, fiber: FiberImpl) => Primitive>) | undefined;
315
+ _yielded: MicroExit<any, any> | (() => void) | undefined;
316
+ yieldWith(value: MicroExit<any, any> | (() => void)): Yield;
317
+ children(): Set<Fiber<any, any>>;
318
+ }
336
319
  /**
337
- * @since 3.4.6
320
+ * @since 3.11.0
338
321
  * @experimental
339
- * @category MicroExit
322
+ * @category Fiber
340
323
  */
341
- export declare const exitDie: (defect: unknown) => MicroExit<never>;
324
+ export declare const fiberAwait: <A, E>(self: Fiber<A, E>) => Micro<MicroExit<A, E>>;
342
325
  /**
343
- * @since 3.4.6
326
+ * @since 3.11.0
344
327
  * @experimental
345
- * @category MicroExit
328
+ * @category Fiber
346
329
  */
347
- export declare const exitFailCause: <E>(cause: MicroCause<E>) => MicroExit<never, E>;
330
+ export declare const fiberInterrupt: <A, E>(self: Fiber<A, E>) => Micro<void>;
348
331
  /**
349
- * @since 3.4.6
332
+ * @since 3.11.0
350
333
  * @experimental
351
- * @category MicroExit
334
+ * @category Fiber
352
335
  */
353
- export declare const exitIsSuccess: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Success<A, E>;
336
+ export declare const fiberInterruptAll: <A extends Iterable<Fiber<any, any>>>(fibers: A) => Micro<void>;
337
+ declare const identifier: unique symbol;
338
+ type identifier = typeof identifier;
339
+ declare const evaluate: unique symbol;
340
+ type evaluate = typeof evaluate;
341
+ declare const successCont: unique symbol;
342
+ type successCont = typeof successCont;
343
+ declare const failureCont: unique symbol;
344
+ type failureCont = typeof failureCont;
345
+ declare const ensureCont: unique symbol;
346
+ type ensureCont = typeof ensureCont;
347
+ declare const Yield: unique symbol;
348
+ type Yield = typeof Yield;
349
+ interface Primitive {
350
+ readonly [identifier]: string;
351
+ readonly [successCont]: ((value: unknown, fiber: FiberImpl) => Primitive | Yield) | undefined;
352
+ readonly [failureCont]: ((cause: MicroCause<unknown>, fiber: FiberImpl) => Primitive | Yield) | undefined;
353
+ readonly [ensureCont]: ((fiber: FiberImpl) => ((value: unknown, fiber: FiberImpl) => Primitive | Yield) | undefined) | undefined;
354
+ [evaluate](fiber: FiberImpl): Primitive | Yield;
355
+ }
354
356
  /**
355
- * @since 3.4.6
357
+ * Creates a `Micro` effect that will succeed with the specified constant value.
358
+ *
359
+ * @since 3.4.0
356
360
  * @experimental
357
- * @category MicroExit
361
+ * @category constructors
358
362
  */
359
- export declare const exitIsFailure: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E>;
363
+ export declare const succeed: <A>(value: A) => Micro<A>;
360
364
  /**
365
+ * Creates a `Micro` effect that will fail with the specified `MicroCause`.
366
+ *
361
367
  * @since 3.4.6
362
368
  * @experimental
363
- * @category MicroExit
369
+ * @category constructors
364
370
  */
365
- export declare const exitIsInterrupt: <A, E>(self: MicroExit<A, E>) => self is Either.Left<MicroCause.Interrupt, A>;
371
+ export declare const failCause: <E>(cause: MicroCause<E>) => Micro<never, E>;
366
372
  /**
367
- * @since 3.4.6
373
+ * Creates a `Micro` effect that will fail with the specified error.
374
+ *
375
+ * This will result in a `CauseFail`, where the error is tracked at the
376
+ * type level.
377
+ *
378
+ * @since 3.4.0
368
379
  * @experimental
369
- * @category MicroExit
380
+ * @category constructors
370
381
  */
371
- export declare const exitIsFail: <A, E>(self: MicroExit<A, E>) => self is Either.Left<MicroCause.Fail<E>, A>;
382
+ export declare const fail: <E>(error: E) => Micro<never, E>;
372
383
  /**
373
- * @since 3.4.6
384
+ * Creates a `Micro` effect that will succeed with the lazily evaluated value.
385
+ *
386
+ * If the evaluation of the value throws an error, the effect will fail with
387
+ * `CauseDie`.
388
+ *
389
+ * @since 3.4.0
374
390
  * @experimental
375
- * @category MicroExit
391
+ * @category constructors
376
392
  */
377
- export declare const exitIsDie: <A, E>(self: MicroExit<A, E>) => self is Either.Left<MicroCause.Die, A>;
393
+ export declare const sync: <A>(evaluate: LazyArg<A>) => Micro<A>;
378
394
  /**
379
- * @since 3.4.6
395
+ * Lazily creates a `Micro` effect from the given side-effect.
396
+ *
397
+ * @since 3.4.0
380
398
  * @experimental
381
- * @category MicroExit
399
+ * @category constructors
382
400
  */
383
- export declare const exitVoid: MicroExit<void>;
401
+ export declare const suspend: <A, E, R>(evaluate: LazyArg<Micro<A, E, R>>) => Micro<A, E, R>;
384
402
  /**
403
+ * Pause the execution of the current `Micro` effect, and resume it on the next
404
+ * scheduler tick.
405
+ *
385
406
  * @since 3.4.0
386
407
  * @experimental
387
- * @category environment
408
+ * @category constructors
388
409
  */
389
- export declare const EnvTypeId: unique symbol;
410
+ export declare const yieldNowWith: (priority?: number) => Micro<void>;
390
411
  /**
412
+ * Pause the execution of the current `Micro` effect, and resume it on the next
413
+ * scheduler tick.
414
+ *
391
415
  * @since 3.4.0
392
416
  * @experimental
393
- * @category environment
417
+ * @category constructors
394
418
  */
395
- export type EnvTypeId = typeof EnvTypeId;
419
+ export declare const yieldNow: Micro<void>;
396
420
  /**
421
+ * Creates a `Micro` effect that will succeed with `Option.Some` of the value.
422
+ *
397
423
  * @since 3.4.0
398
424
  * @experimental
399
- * @category environment
425
+ * @category constructors
400
426
  */
401
- export interface Env<R> extends Pipeable {
402
- readonly [EnvTypeId]: {
403
- _R: Covariant<R>;
404
- };
405
- readonly refs: ReadonlyRecord<string, unknown>;
406
- }
427
+ export declare const succeedSome: <A>(a: A) => Micro<Option.Option<A>>;
407
428
  /**
429
+ * Creates a `Micro` effect that will succeed with `Option.None`.
430
+ *
408
431
  * @since 3.4.0
409
432
  * @experimental
410
- * @category environment
433
+ * @category constructors
411
434
  */
412
- export declare const envMake: <R = never>(refs: Record<string, unknown>) => Env<R>;
435
+ export declare const succeedNone: Micro<Option.Option<never>>;
413
436
  /**
437
+ * Creates a `Micro` effect that will fail with the lazily evaluated `MicroCause`.
438
+ *
414
439
  * @since 3.4.0
415
440
  * @experimental
416
- * @category environment
441
+ * @category constructors
417
442
  */
418
- export declare const envUnsafeMakeEmpty: () => Env<never>;
443
+ export declare const failCauseSync: <E>(evaluate: LazyArg<MicroCause<E>>) => Micro<never, E>;
419
444
  /**
445
+ * Creates a `Micro` effect that will die with the specified error.
446
+ *
447
+ * This will result in a `CauseDie`, where the error is not tracked at
448
+ * the type level.
449
+ *
420
450
  * @since 3.4.0
421
451
  * @experimental
422
- * @category environment
452
+ * @category constructors
423
453
  */
424
- export declare const envGet: {
425
- /**
426
- * @since 3.4.0
427
- * @experimental
428
- * @category environment
429
- */
430
- <A>(ref: EnvRef<A>): <R>(self: Env<R>) => A;
431
- /**
432
- * @since 3.4.0
433
- * @experimental
434
- * @category environment
435
- */
436
- <A, R>(self: Env<R>, ref: EnvRef<A>): A;
437
- };
454
+ export declare const die: (defect: unknown) => Micro<never>;
438
455
  /**
439
- * @since 3.4.0
456
+ * Creates a `Micro` effect that will fail with the lazily evaluated error.
457
+ *
458
+ * This will result in a `CauseFail`, where the error is tracked at the
459
+ * type level.
460
+ *
461
+ * @since 3.4.6
440
462
  * @experimental
441
- * @category environment
463
+ * @category constructors
442
464
  */
443
- export declare const envSet: {
444
- /**
445
- * @since 3.4.0
446
- * @experimental
447
- * @category environment
448
- */
449
- <A>(ref: EnvRef<A>, value: A): <R>(self: Env<R>) => Env<R>;
450
- /**
451
- * @since 3.4.0
452
- * @experimental
453
- * @category environment
454
- */
455
- <A, R>(self: Env<R>, ref: EnvRef<A>, value: A): Env<R>;
456
- };
465
+ export declare const failSync: <E>(error: LazyArg<E>) => Micro<never, E>;
457
466
  /**
467
+ * Converts an `Option` into a `Micro` effect, that will fail with
468
+ * `NoSuchElementException` if the option is `None`. Otherwise, it will succeed with the
469
+ * value of the option.
470
+ *
458
471
  * @since 3.4.0
459
472
  * @experimental
460
- * @category environment
473
+ * @category constructors
461
474
  */
462
- export declare const envMutate: {
463
- /**
464
- * @since 3.4.0
465
- * @experimental
466
- * @category environment
467
- */
468
- (f: (map: Record<string, unknown>) => void): <R>(self: Env<R>) => Env<R>;
469
- /**
470
- * @since 3.4.0
471
- * @experimental
472
- * @category environment
473
- */
474
- <R>(self: Env<R>, f: (map: Record<string, unknown>) => void): Env<R>;
475
- };
475
+ export declare const fromOption: <A>(option: Option.Option<A>) => Micro<A, NoSuchElementException>;
476
476
  /**
477
- * Access the given `Context.Tag` from the environment.
477
+ * Converts an `Either` into a `Micro` effect, that will fail with the left side
478
+ * of the either if it is a `Left`. Otherwise, it will succeed with the right
479
+ * side of the either.
478
480
  *
479
481
  * @since 3.4.0
480
482
  * @experimental
481
- * @category environment
483
+ * @category constructors
482
484
  */
483
- export declare const service: <I, S>(tag: Context.Tag<I, S>) => Micro<S, never, I>;
485
+ export declare const fromEither: <R, L>(either: Either.Either<R, L>) => Micro<R, L>;
486
+ declare const void_: Micro<void>;
487
+ export {
484
488
  /**
485
- * Access the given `Context.Tag` from the environment, without tracking the
486
- * dependency at the type level.
487
- *
488
- * It will return an `Option` of the service, depending on whether it is
489
- * available in the environment or not.
489
+ * A `Micro` effect that will succeed with `void` (`undefined`).
490
490
  *
491
491
  * @since 3.4.0
492
492
  * @experimental
493
- * @category environment
493
+ * @category constructors
494
494
  */
495
- export declare const serviceOption: <I, S>(tag: Context.Tag<I, S>) => Micro<Option.Option<S>>;
495
+ void_ as void };
496
+ declare const try_: <A, E>(options: {
497
+ try: LazyArg<A>;
498
+ catch: (error: unknown) => E;
499
+ }) => Micro<A, E>;
500
+ export {
496
501
  /**
497
- * Retrieve the current value of the given `EnvRef`.
502
+ * The `Micro` equivalent of a try / catch block, which allows you to map
503
+ * thrown errors to a specific error type.
498
504
  *
499
505
  * @since 3.4.0
500
506
  * @experimental
501
- * @category environment
507
+ * @category constructors
508
+ * @example
509
+ * ```ts
510
+ * import { Micro } from "effect"
511
+ *
512
+ * Micro.try({
513
+ * try: () => throw new Error("boom"),
514
+ * catch: (cause) => new Error("caught", { cause })
515
+ * })
516
+ * ```
502
517
  */
503
- export declare const getEnvRef: <A>(envRef: EnvRef<A>) => Micro<A>;
518
+ try_ as try };
504
519
  /**
505
- * Set the value of the given `EnvRef` for the duration of the effect.
520
+ * Wrap a `Promise` into a `Micro` effect. Any errors will result in a
521
+ * `CauseDie`.
506
522
  *
507
523
  * @since 3.4.0
508
524
  * @experimental
509
- * @category environment
525
+ * @category constructors
510
526
  */
511
- export declare const locally: {
512
- /**
513
- * Set the value of the given `EnvRef` for the duration of the effect.
514
- *
515
- * @since 3.4.0
516
- * @experimental
517
- * @category environment
518
- */
519
- <A>(fiberRef: EnvRef<A>, value: A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R>;
520
- /**
521
- * Set the value of the given `EnvRef` for the duration of the effect.
522
- *
523
- * @since 3.4.0
524
- * @experimental
525
- * @category environment
526
- */
527
- <XA, E, R, A>(self: Micro<XA, E, R>, fiberRef: EnvRef<A>, value: A): Micro<XA, E, R>;
528
- };
527
+ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike<A>) => Micro<A>;
529
528
  /**
530
- * Access the current `Context` from the environment.
529
+ * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
530
+ * converted into a specific error type.
531
531
  *
532
532
  * @since 3.4.0
533
533
  * @experimental
534
- * @category environment
535
- */
536
- export declare const context: <R>() => Micro<Context.Context<R>>;
534
+ * @category constructors
535
+ * @example
536
+ * ```ts
537
+ * import { Micro } from "effect"
538
+ *
539
+ * Micro.tryPromise({
540
+ * try: () => Promise.resolve("success"),
541
+ * catch: (cause) => new Error("caught", { cause })
542
+ * })
543
+ * ```
544
+ */
545
+ export declare const tryPromise: <A, E>(options: {
546
+ readonly try: (signal: AbortSignal) => PromiseLike<A>;
547
+ readonly catch: (error: unknown) => E;
548
+ }) => Micro<A, E>;
537
549
  /**
538
- * Merge the given `Context` with the current context.
550
+ * Create a `Micro` effect using the current `Fiber`.
539
551
  *
540
552
  * @since 3.4.0
541
553
  * @experimental
542
- * @category environment
554
+ * @category constructors
543
555
  */
544
- export declare const provideContext: {
556
+ export declare const withFiber: <A, E = never, R = never>(evaluate: (fiber: FiberImpl<A, E>) => Micro<A, E, R>) => Micro<A, E, R>;
557
+ /**
558
+ * Flush any yielded effects that are waiting to be executed.
559
+ *
560
+ * @since 3.4.0
561
+ * @experimental
562
+ * @category constructors
563
+ */
564
+ export declare const yieldFlush: Micro<void>;
565
+ /**
566
+ * Create a `Micro` effect from an asynchronous computation.
567
+ *
568
+ * You can return a cleanup effect that will be run when the effect is aborted.
569
+ * It is also passed an `AbortSignal` that is triggered when the effect is
570
+ * aborted.
571
+ *
572
+ * @since 3.4.0
573
+ * @experimental
574
+ * @category constructors
575
+ */
576
+ export declare const async: <A, E = never, R = never>(register: (resume: (effect: Micro<A, E, R>) => void, signal: AbortSignal) => void | Micro<void, never, R>) => Micro<A, E, R>;
577
+ /**
578
+ * A `Micro` that will never succeed or fail. It wraps `setInterval` to prevent
579
+ * the Javascript runtime from exiting.
580
+ *
581
+ * @since 3.4.0
582
+ * @experimental
583
+ * @category constructors
584
+ */
585
+ export declare const never: Micro<never>;
586
+ /**
587
+ * @since 3.4.0
588
+ * @experimental
589
+ * @category constructors
590
+ */
591
+ export declare const gen: <Self, Eff extends YieldWrap<Micro<any, any, any>>, AEff>(...args: [self: Self, body: (this: Self) => Generator<Eff, AEff, never>] | [body: () => Generator<Eff, AEff, never>]) => Micro<AEff, [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer E, infer _R>>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer _E, infer R>>] ? R : never>;
592
+ /**
593
+ * Create a `Micro` effect that will replace the success value of the given
594
+ * effect.
595
+ *
596
+ * @since 3.4.0
597
+ * @experimental
598
+ * @category mapping & sequencing
599
+ */
600
+ export declare const as: {
545
601
  /**
546
- * Merge the given `Context` with the current context.
602
+ * Create a `Micro` effect that will replace the success value of the given
603
+ * effect.
547
604
  *
548
605
  * @since 3.4.0
549
606
  * @experimental
550
- * @category environment
607
+ * @category mapping & sequencing
551
608
  */
552
- <XR>(context: Context.Context<XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, XR>>;
609
+ <A, B>(value: B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
553
610
  /**
554
- * Merge the given `Context` with the current context.
611
+ * Create a `Micro` effect that will replace the success value of the given
612
+ * effect.
555
613
  *
556
614
  * @since 3.4.0
557
615
  * @experimental
558
- * @category environment
616
+ * @category mapping & sequencing
559
617
  */
560
- <A, E, R, XR>(self: Micro<A, E, R>, context: Context.Context<XR>): Micro<A, E, Exclude<R, XR>>;
618
+ <A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R>;
561
619
  };
562
620
  /**
563
- * Add the provided service to the current context.
621
+ * Wrap the success value of this `Micro` effect in an `Option.Some`.
564
622
  *
565
623
  * @since 3.4.0
566
624
  * @experimental
567
- * @category environment
625
+ * @category mapping & sequencing
568
626
  */
569
- export declare const provideService: {
627
+ export declare const asSome: <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E, R>;
628
+ /**
629
+ * Swap the error and success types of the `Micro` effect.
630
+ *
631
+ * @since 3.4.0
632
+ * @experimental
633
+ * @category mapping & sequencing
634
+ */
635
+ export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
636
+ /**
637
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
638
+ * a single api.
639
+ *
640
+ * It also allows you to pass in a `Micro` effect directly, which will be
641
+ * executed after the current effect.
642
+ *
643
+ * @since 3.4.0
644
+ * @experimental
645
+ * @category mapping & sequencing
646
+ */
647
+ export declare const andThen: {
570
648
  /**
571
- * Add the provided service to the current context.
649
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
650
+ * a single api.
651
+ *
652
+ * It also allows you to pass in a `Micro` effect directly, which will be
653
+ * executed after the current effect.
572
654
  *
573
655
  * @since 3.4.0
574
656
  * @experimental
575
- * @category environment
657
+ * @category mapping & sequencing
576
658
  */
577
- <I, S>(tag: Context.Tag<I, S>, service: S): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, I>>;
659
+ <A, X>(f: (a: A) => X): <E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
578
660
  /**
579
- * Add the provided service to the current context.
661
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
662
+ * a single api.
663
+ *
664
+ * It also allows you to pass in a `Micro` effect directly, which will be
665
+ * executed after the current effect.
580
666
  *
581
667
  * @since 3.4.0
582
668
  * @experimental
583
- * @category environment
669
+ * @category mapping & sequencing
584
670
  */
585
- <A, E, R, I, S>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, service: S): Micro<A, E, Exclude<R, I>>;
586
- };
587
- /**
588
- * Create a service using the provided `Micro` effect, and add it to the
589
- * current context.
590
- *
591
- * @since 3.4.6
592
- * @experimental
593
- * @category environment
594
- */
595
- export declare const provideServiceEffect: {
671
+ <X>(f: NotFunction<X>): <A, E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
596
672
  /**
597
- * Create a service using the provided `Micro` effect, and add it to the
598
- * current context.
673
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
674
+ * a single api.
599
675
  *
600
- * @since 3.4.6
676
+ * It also allows you to pass in a `Micro` effect directly, which will be
677
+ * executed after the current effect.
678
+ *
679
+ * @since 3.4.0
601
680
  * @experimental
602
- * @category environment
681
+ * @category mapping & sequencing
603
682
  */
604
- <I, S, E2, R2>(tag: Context.Tag<I, S>, acquire: Micro<S, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | E2, Exclude<R, I> | R2>;
683
+ <A, E, R, X>(self: Micro<A, E, R>, f: (a: A) => X): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
605
684
  /**
606
- * Create a service using the provided `Micro` effect, and add it to the
607
- * current context.
685
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
686
+ * a single api.
608
687
  *
609
- * @since 3.4.6
688
+ * It also allows you to pass in a `Micro` effect directly, which will be
689
+ * executed after the current effect.
690
+ *
691
+ * @since 3.4.0
610
692
  * @experimental
611
- * @category environment
693
+ * @category mapping & sequencing
612
694
  */
613
- <A, E, R, I, S, E2, R2>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, acquire: Micro<S, E2, R2>): Micro<A, E | E2, Exclude<R, I> | R2>;
695
+ <A, E, R, X>(self: Micro<A, E, R>, f: NotFunction<X>): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
614
696
  };
615
697
  /**
616
- * @since 3.5.9
617
- * @experimental
618
- * @category scheduler
619
- */
620
- export interface MicroScheduler {
621
- readonly scheduleTask: (task: () => void, priority: number) => void;
622
- readonly shouldYield: (env: Env<unknown>) => boolean;
623
- readonly flush: () => void;
624
- }
625
- /**
626
- * @since 3.5.9
698
+ * Execute a side effect from the success value of the `Micro` effect.
699
+ *
700
+ * It is similar to the `andThen` api, but the success value is ignored.
701
+ *
702
+ * @since 3.4.0
627
703
  * @experimental
628
- * @category scheduler
704
+ * @category mapping & sequencing
629
705
  */
630
- export declare class MicroSchedulerDefault implements MicroScheduler {
631
- private tasks;
632
- private running;
633
- /**
634
- * @since 3.5.9
635
- */
636
- scheduleTask(task: () => void, _priority: number): void;
706
+ export declare const tap: {
637
707
  /**
638
- * @since 3.5.9
708
+ * Execute a side effect from the success value of the `Micro` effect.
709
+ *
710
+ * It is similar to the `andThen` api, but the success value is ignored.
711
+ *
712
+ * @since 3.4.0
713
+ * @experimental
714
+ * @category mapping & sequencing
639
715
  */
640
- afterScheduled: () => void;
716
+ <A, X>(f: (a: NoInfer<A>) => X): <E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
641
717
  /**
642
- * @since 3.5.9
718
+ * Execute a side effect from the success value of the `Micro` effect.
719
+ *
720
+ * It is similar to the `andThen` api, but the success value is ignored.
721
+ *
722
+ * @since 3.4.0
723
+ * @experimental
724
+ * @category mapping & sequencing
643
725
  */
644
- runTasks(): void;
726
+ <X>(f: NotFunction<X>): <A, E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
645
727
  /**
646
- * @since 3.5.9
728
+ * Execute a side effect from the success value of the `Micro` effect.
729
+ *
730
+ * It is similar to the `andThen` api, but the success value is ignored.
731
+ *
732
+ * @since 3.4.0
733
+ * @experimental
734
+ * @category mapping & sequencing
647
735
  */
648
- shouldYield(_env: Env<unknown>): boolean;
736
+ <A, E, R, X>(self: Micro<A, E, R>, f: (a: NoInfer<A>) => X): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
649
737
  /**
650
- * @since 3.5.9
738
+ * Execute a side effect from the success value of the `Micro` effect.
739
+ *
740
+ * It is similar to the `andThen` api, but the success value is ignored.
741
+ *
742
+ * @since 3.4.0
743
+ * @experimental
744
+ * @category mapping & sequencing
651
745
  */
652
- flush(): void;
653
- }
746
+ <A, E, R, X>(self: Micro<A, E, R>, f: NotFunction<X>): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
747
+ };
654
748
  /**
749
+ * Replace the success value of the `Micro` effect with `void`.
750
+ *
655
751
  * @since 3.4.0
656
752
  * @experimental
657
- * @category environment
753
+ * @category mapping & sequencing
658
754
  */
659
- export declare const EnvRefTypeId: unique symbol;
755
+ export declare const asVoid: <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
660
756
  /**
661
- * @since 3.4.0
757
+ * Access the `MicroExit` of the given `Micro` effect.
758
+ *
759
+ * @since 3.4.6
662
760
  * @experimental
663
- * @category environment
761
+ * @category mapping & sequencing
664
762
  */
665
- export type EnvRefTypeId = typeof EnvRefTypeId;
763
+ export declare const exit: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroExit<A, E>, never, R>;
666
764
  /**
765
+ * Replace the error type of the given `Micro` with the full `MicroCause` object.
766
+ *
667
767
  * @since 3.4.0
668
768
  * @experimental
669
- * @category environment
769
+ * @category mapping & sequencing
670
770
  */
671
- export interface EnvRef<A> extends Micro<A> {
672
- readonly [EnvRefTypeId]: EnvRefTypeId;
673
- readonly key: string;
674
- readonly initial: A;
675
- [Unify.typeSymbol]?: unknown;
676
- [Unify.unifySymbol]?: EnvRefUnify<this>;
677
- [Unify.ignoreSymbol]?: EnvRefUnifyIgnore;
678
- }
771
+ export declare const sandbox: <A, E, R>(self: Micro<A, E, R>) => Micro<A, MicroCause<E>, R>;
679
772
  /**
680
- * @category models
681
- * @since 3.8.4
773
+ * Returns an effect that races all the specified effects,
774
+ * yielding the value of the first effect to succeed with a value. Losers of
775
+ * the race will be interrupted immediately
776
+ *
777
+ * @since 3.4.0
682
778
  * @experimental
779
+ * @category sequencing
683
780
  */
684
- export interface EnvRefUnify<A extends {
685
- [Unify.typeSymbol]?: any;
686
- }> extends MicroUnify<A> {
687
- EnvRef?: () => A[Unify.typeSymbol] extends EnvRef<infer A0> | infer _ ? EnvRef<A0> : never;
688
- }
689
- /**
690
- * @category models
691
- * @since 3.8.4
692
- * @experimental
693
- */
694
- export interface EnvRefUnifyIgnore extends MicroUnifyIgnore {
695
- Micro?: true;
696
- }
697
- /**
698
- * @since 3.4.0
699
- * @experimental
700
- * @category environment refs
701
- */
702
- export declare const envRefMake: <A>(key: string, initial: LazyArg<A>) => EnvRef<A>;
703
- /**
704
- * @since 3.4.0
705
- * @experimental
706
- * @category environment refs
707
- */
708
- export declare const currentAbortController: EnvRef<AbortController>;
709
- /**
710
- * @since 3.4.0
711
- * @experimental
712
- * @category environment refs
713
- */
714
- export declare const currentAbortSignal: EnvRef<AbortSignal>;
715
- /**
716
- * @since 3.4.0
717
- * @experimental
718
- * @category environment refs
719
- */
720
- export declare const currentContext: EnvRef<Context.Context<never>>;
721
- /**
722
- * @since 3.4.0
723
- * @experimental
724
- * @category environment refs
725
- */
726
- export declare const currentConcurrency: EnvRef<"unbounded" | number>;
727
- /**
728
- * @since 3.4.0
729
- * @experimental
730
- * @category environment refs
731
- */
732
- export declare const currentMaxDepthBeforeYield: EnvRef<number>;
781
+ export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
733
782
  /**
783
+ * Returns an effect that races all the specified effects,
784
+ * yielding the value of the first effect to succeed or fail. Losers of
785
+ * the race will be interrupted immediately
786
+ *
734
787
  * @since 3.4.0
735
788
  * @experimental
736
- * @category environment refs
789
+ * @category sequencing
737
790
  */
738
- export declare const currentScheduler: EnvRef<MicroScheduler>;
791
+ export declare const raceAllFirst: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
739
792
  /**
740
- * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
741
- * api to control the concurrency of that `Micro` when it is run.
793
+ * Returns an effect that races two effects, yielding the value of the first
794
+ * effect to succeed. Losers of the race will be interrupted immediately
742
795
  *
743
796
  * @since 3.4.0
744
797
  * @experimental
745
- * @category environment refs
746
- * @example
747
- * import * as Micro from "effect/Micro"
748
- *
749
- * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
750
- * concurrency: "inherit"
751
- * }).pipe(
752
- * Micro.withConcurrency(2) // use a concurrency of 2
753
- * )
798
+ * @category sequencing
754
799
  */
755
- export declare const withConcurrency: {
800
+ export declare const race: {
756
801
  /**
757
- * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
758
- * api to control the concurrency of that `Micro` when it is run.
802
+ * Returns an effect that races two effects, yielding the value of the first
803
+ * effect to succeed. Losers of the race will be interrupted immediately
759
804
  *
760
805
  * @since 3.4.0
761
806
  * @experimental
762
- * @category environment refs
763
- * @example
764
- * import * as Micro from "effect/Micro"
765
- *
766
- * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
767
- * concurrency: "inherit"
768
- * }).pipe(
769
- * Micro.withConcurrency(2) // use a concurrency of 2
770
- * )
807
+ * @category sequencing
771
808
  */
772
- (concurrency: "unbounded" | number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
809
+ <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
773
810
  /**
774
- * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
775
- * api to control the concurrency of that `Micro` when it is run.
811
+ * Returns an effect that races two effects, yielding the value of the first
812
+ * effect to succeed. Losers of the race will be interrupted immediately
776
813
  *
777
814
  * @since 3.4.0
778
815
  * @experimental
779
- * @category environment refs
780
- * @example
781
- * import * as Micro from "effect/Micro"
782
- *
783
- * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
784
- * concurrency: "inherit"
785
- * }).pipe(
786
- * Micro.withConcurrency(2) // use a concurrency of 2
787
- * )
816
+ * @category sequencing
788
817
  */
789
- <A, E, R>(self: Micro<A, E, R>, concurrency: "unbounded" | number): Micro<A, E, R>;
818
+ <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
790
819
  };
791
820
  /**
792
- * A low-level constructor for creating a `Micro` effect. It takes a function
793
- * that receives an environment and a callback which should be called with the
794
- * result of the effect.
795
- *
796
- * @since 3.4.0
797
- * @experimental
798
- * @category constructors
799
- */
800
- export declare const make: <R, A, E>(run: (env: Env<R>, onExit: (exit: MicroExit<A, E>) => void) => void) => Micro<A, E, R>;
801
- /**
802
- * Converts a `MicroExit` into a `Micro` effect.
803
- *
804
- * @since 3.4.6
805
- * @experimental
806
- * @category constructors
807
- */
808
- export declare const fromExit: <A, E>(self: MicroExit<A, E>) => Micro<A, E>;
809
- /**
810
- * Converts a lazy `MicroExit` into a `Micro` effect.
811
- *
812
- * @since 3.4.6
813
- * @experimental
814
- * @category constructors
815
- */
816
- export declare const fromExitSync: <A, E>(self: LazyArg<MicroExit<A, E>>) => Micro<A, E>;
817
- /**
818
- * Creates a `Micro` effect that will succeed with the specified constant value.
819
- *
820
- * @since 3.4.0
821
- * @experimental
822
- * @category constructors
823
- */
824
- export declare const succeed: <A>(a: A) => Micro<A>;
825
- /**
826
- * Creates a `Micro` effect that will succeed with `Option.Some` of the value.
821
+ * Returns an effect that races two effects, yielding the value of the first
822
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately
827
823
  *
828
824
  * @since 3.4.0
829
825
  * @experimental
830
- * @category constructors
826
+ * @category sequencing
831
827
  */
832
- export declare const succeedSome: <A>(a: A) => Micro<Option.Option<A>>;
828
+ export declare const raceFirst: {
829
+ /**
830
+ * Returns an effect that races two effects, yielding the value of the first
831
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately
832
+ *
833
+ * @since 3.4.0
834
+ * @experimental
835
+ * @category sequencing
836
+ */
837
+ <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
838
+ /**
839
+ * Returns an effect that races two effects, yielding the value of the first
840
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately
841
+ *
842
+ * @since 3.4.0
843
+ * @experimental
844
+ * @category sequencing
845
+ */
846
+ <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
847
+ };
833
848
  /**
834
- * Creates a `Micro` effect that will succeed with `Option.None`.
849
+ * Map the success value of this `Micro` effect to another `Micro` effect, then
850
+ * flatten the result.
835
851
  *
836
852
  * @since 3.4.0
837
853
  * @experimental
838
- * @category constructors
854
+ * @category mapping & sequencing
839
855
  */
840
- export declare const succeedNone: Micro<Option.Option<never>>;
856
+ export declare const flatMap: {
857
+ /**
858
+ * Map the success value of this `Micro` effect to another `Micro` effect, then
859
+ * flatten the result.
860
+ *
861
+ * @since 3.4.0
862
+ * @experimental
863
+ * @category mapping & sequencing
864
+ */
865
+ <A, B, E2, R2>(f: (a: A) => Micro<B, E2, R2>): <E, R>(self: Micro<A, E, R>) => Micro<B, E | E2, R | R2>;
866
+ /**
867
+ * Map the success value of this `Micro` effect to another `Micro` effect, then
868
+ * flatten the result.
869
+ *
870
+ * @since 3.4.0
871
+ * @experimental
872
+ * @category mapping & sequencing
873
+ */
874
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: A) => Micro<B, E2, R2>): Micro<B, E | E2, R | R2>;
875
+ };
841
876
  /**
842
- * Creates a `Micro` effect that will fail with the specified error.
843
- *
844
- * This will result in a `CauseFail`, where the error is tracked at the
845
- * type level.
877
+ * Flattens any nested `Micro` effects, merging the error and requirement types.
846
878
  *
847
879
  * @since 3.4.0
848
880
  * @experimental
849
- * @category constructors
881
+ * @category mapping & sequencing
850
882
  */
851
- export declare const fail: <E>(e: E) => Micro<never, E>;
883
+ export declare const flatten: <A, E, R, E2, R2>(self: Micro<Micro<A, E, R>, E2, R2>) => Micro<A, E | E2, R | R2>;
852
884
  /**
853
- * Creates a `Micro` effect that will fail with the lazily evaluated error.
854
- *
855
- * This will result in a `CauseFail`, where the error is tracked at the
856
- * type level.
885
+ * Transforms the success value of the `Micro` effect with the specified
886
+ * function.
857
887
  *
858
888
  * @since 3.4.0
859
889
  * @experimental
860
- * @category constructors
890
+ * @category mapping & sequencing
861
891
  */
862
- export declare const failSync: <E>(e: LazyArg<E>) => Micro<never, E>;
892
+ export declare const map: {
893
+ /**
894
+ * Transforms the success value of the `Micro` effect with the specified
895
+ * function.
896
+ *
897
+ * @since 3.4.0
898
+ * @experimental
899
+ * @category mapping & sequencing
900
+ */
901
+ <A, B>(f: (a: A) => B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
902
+ /**
903
+ * Transforms the success value of the `Micro` effect with the specified
904
+ * function.
905
+ *
906
+ * @since 3.4.0
907
+ * @experimental
908
+ * @category mapping & sequencing
909
+ */
910
+ <A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R>;
911
+ };
863
912
  /**
864
- * Creates a `Micro` effect that will die with the specified error.
865
- *
866
- * This will result in a `CauseDie`, where the error is not tracked at
867
- * the type level.
913
+ * The MicroExit type is a data type that represents the result of a Micro
914
+ * computation.
868
915
  *
869
- * @since 3.4.0
870
- * @experimental
871
- * @category constructors
872
- */
873
- export declare const die: (defect: unknown) => Micro<never>;
874
- /**
875
- * Creates a `Micro` effect that will fail with the specified `MicroCause`.
916
+ * It uses the `Either` data type to represent the success and failure cases.
876
917
  *
877
918
  * @since 3.4.6
878
919
  * @experimental
879
- * @category constructors
920
+ * @category MicroExit
880
921
  */
881
- export declare const failCause: <E>(cause: MicroCause<E>) => Micro<never, E>;
922
+ export type MicroExit<A, E = never> = MicroExit.Success<A, E> | MicroExit.Failure<A, E>;
882
923
  /**
883
- * Creates a `Micro` effect that will fail with the lazily evaluated `MicroCause`.
884
- *
885
924
  * @since 3.4.6
886
925
  * @experimental
887
- * @category constructors
888
- */
889
- export declare const failCauseSync: <E>(cause: LazyArg<MicroCause<E>>) => Micro<never, E>;
890
- /**
891
- * Creates a `Micro` effect that will succeed with the lazily evaluated value.
892
- *
893
- * If the evaluation of the value throws an error, the effect will fail with
894
- * `CauseDie`.
895
- *
896
- * @since 3.4.0
897
- * @experimental
898
- * @category constructors
926
+ * @category MicroExit
899
927
  */
900
- export declare const sync: <A>(evaluate: LazyArg<A>) => Micro<A>;
928
+ export declare namespace MicroExit {
929
+ /**
930
+ * @since 3.4.6
931
+ * @experimental
932
+ * @category MicroExit
933
+ */
934
+ interface Proto<out A, out E = never> extends Micro<A, E> {
935
+ readonly [MicroExitTypeId]: MicroExitTypeId;
936
+ }
937
+ /**
938
+ * @since 3.4.6
939
+ * @experimental
940
+ * @category MicroExit
941
+ */
942
+ interface Success<out A, out E> extends Proto<A, E> {
943
+ readonly _tag: "Success";
944
+ readonly value: A;
945
+ }
946
+ /**
947
+ * @since 3.4.6
948
+ * @experimental
949
+ * @category MicroExit
950
+ */
951
+ interface Failure<out A, out E> extends Proto<A, E> {
952
+ readonly _tag: "Failure";
953
+ readonly cause: MicroCause<E>;
954
+ }
955
+ }
901
956
  /**
902
- * Converts an `Option` into a `Micro` effect, that will fail with
903
- * `NoSuchElementException` if the option is `None`. Otherwise, it will succeed with the
904
- * value of the option.
905
- *
906
- * @since 3.4.0
957
+ * @since 3.4.6
907
958
  * @experimental
908
- * @category constructors
959
+ * @category MicroExit
909
960
  */
910
- export declare const fromOption: <A>(option: Option.Option<A>) => Micro<A, NoSuchElementException>;
961
+ export declare const isMicroExit: (u: unknown) => u is MicroExit<unknown, unknown>;
911
962
  /**
912
- * Converts an `Either` into a `Micro` effect, that will fail with the left side
913
- * of the either if it is a `Left`. Otherwise, it will succeed with the right
914
- * side of the either.
915
- *
916
- * @since 3.4.0
963
+ * @since 3.4.6
917
964
  * @experimental
918
- * @category constructors
965
+ * @category MicroExit
919
966
  */
920
- export declare const fromEither: <R, L>(either: Either.Either<R, L>) => Micro<R, L>;
967
+ export declare const exitSucceed: <A>(a: A) => MicroExit<A, never>;
921
968
  /**
922
- * Lazily creates a `Micro` effect from the given side-effect.
923
- *
924
- * @since 3.4.0
969
+ * @since 3.4.6
925
970
  * @experimental
926
- * @category constructors
971
+ * @category MicroExit
927
972
  */
928
- export declare const suspend: <A, E, R>(evaluate: LazyArg<Micro<A, E, R>>) => Micro<A, E, R>;
929
- declare const void_: Micro<void>;
930
- export {
973
+ export declare const exitFailCause: <E>(cause: MicroCause<E>) => MicroExit<never, E>;
931
974
  /**
932
- * A `Micro` effect that will succeed with `void` (`undefined`).
933
- *
934
- * @since 3.4.0
975
+ * @since 3.4.6
935
976
  * @experimental
936
- * @category constructors
977
+ * @category MicroExit
937
978
  */
938
- void_ as void };
979
+ export declare const exitInterrupt: MicroExit<never>;
939
980
  /**
940
- * Create a `Micro` effect from an asynchronous computation.
941
- *
942
- * You can return a cleanup effect that will be run when the effect is aborted.
943
- * It is also passed an `AbortSignal` that is triggered when the effect is
944
- * aborted.
945
- *
946
- * @since 3.4.0
981
+ * @since 3.4.6
947
982
  * @experimental
948
- * @category constructors
983
+ * @category MicroExit
949
984
  */
950
- export declare const async: <A, E = never, R = never>(register: (resume: (effect: Micro<A, E, R>) => void, signal: AbortSignal) => void | Micro<void, never, R>) => Micro<A, E, R>;
951
- declare const try_: <A, E>(options: {
952
- try: LazyArg<A>;
953
- catch: (error: unknown) => E;
954
- }) => Micro<A, E>;
955
- export {
985
+ export declare const exitFail: <E>(e: E) => MicroExit<never, E>;
956
986
  /**
957
- * The `Micro` equivalent of a try / catch block, which allows you to map
958
- * thrown errors to a specific error type.
959
- *
960
- * @since 3.4.0
987
+ * @since 3.4.6
961
988
  * @experimental
962
- * @category constructors
963
- * @example
964
- * import { Micro } from "effect"
965
- *
966
- * Micro.try({
967
- * try: () => throw new Error("boom"),
968
- * catch: (cause) => new Error("caught", { cause })
969
- * })
989
+ * @category MicroExit
970
990
  */
971
- try_ as try };
991
+ export declare const exitDie: (defect: unknown) => MicroExit<never>;
972
992
  /**
973
- * Wrap a `Promise` into a `Micro` effect. Any errors will result in a
974
- * `CauseDie`.
975
- *
976
- * @since 3.4.0
993
+ * @since 3.4.6
977
994
  * @experimental
978
- * @category constructors
995
+ * @category MicroExit
979
996
  */
980
- export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike<A>) => Micro<A>;
997
+ export declare const exitIsSuccess: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Success<A, E>;
981
998
  /**
982
- * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
983
- * converted into a specific error type.
984
- *
985
- * @since 3.4.0
999
+ * @since 3.4.6
986
1000
  * @experimental
987
- * @category constructors
988
- * @example
989
- * import { Micro } from "effect"
990
- *
991
- * Micro.tryPromise({
992
- * try: () => Promise.resolve("success"),
993
- * catch: (cause) => new Error("caught", { cause })
994
- * })
1001
+ * @category MicroExit
995
1002
  */
996
- export declare const tryPromise: <A, E>(options: {
997
- readonly try: (signal: AbortSignal) => PromiseLike<A>;
998
- readonly catch: (error: unknown) => E;
999
- }) => Micro<A, E>;
1003
+ export declare const exitIsFailure: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E>;
1000
1004
  /**
1001
- * Pause the execution of the current `Micro` effect, and resume it on the next
1002
- * iteration of the event loop.
1003
- *
1004
- * You can specify a priority for the task, which will determine when it is
1005
- * executed relative to other tasks.
1006
- *
1007
- * @since 3.4.0
1005
+ * @since 3.4.6
1008
1006
  * @experimental
1009
- * @category constructors
1007
+ * @category MicroExit
1010
1008
  */
1011
- export declare const yieldWithPriority: (priority: number) => Micro<void>;
1009
+ export declare const exitIsInterrupt: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E> & {
1010
+ readonly cause: MicroCause.Interrupt;
1011
+ };
1012
1012
  /**
1013
- * Pause the execution of the current `Micro` effect, and resume it on the next
1014
- * iteration of the event loop.
1015
- *
1016
- * @since 3.4.0
1013
+ * @since 3.4.6
1017
1014
  * @experimental
1018
- * @category constructors
1015
+ * @category MicroExit
1019
1016
  */
1020
- export declare const yieldNow: Micro<void>;
1017
+ export declare const exitIsFail: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E> & {
1018
+ readonly cause: MicroCause.Fail<E>;
1019
+ };
1021
1020
  /**
1022
- * Flush any yielded effects that are waiting to be executed.
1023
- *
1024
- * @since 3.4.0
1021
+ * @since 3.4.6
1025
1022
  * @experimental
1026
- * @category constructors
1023
+ * @category MicroExit
1027
1024
  */
1028
- export declare const yieldFlush: Micro<void>;
1029
- /**
1030
- * A `Micro` that will never succeed or fail. It wraps `setInterval` to prevent
1031
- * the Javascript runtime from exiting.
1032
- *
1033
- * @since 3.4.0
1025
+ export declare const exitIsDie: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E> & {
1026
+ readonly cause: MicroCause.Die;
1027
+ };
1028
+ /**
1029
+ * @since 3.4.6
1034
1030
  * @experimental
1035
- * @category constructors
1031
+ * @category MicroExit
1036
1032
  */
1037
- export declare const never: Micro<never>;
1033
+ export declare const exitVoid: MicroExit<void>;
1038
1034
  /**
1039
- * @since 3.4.0
1035
+ * @since 3.11.0
1040
1036
  * @experimental
1041
- * @category constructors
1037
+ * @category MicroExit
1042
1038
  */
1043
- export declare const gen: <Self, Eff extends YieldWrap<Micro<any, any, any>>, AEff>(...args: [self: Self, body: (this: Self) => Generator<Eff, AEff, never>] | [body: () => Generator<Eff, AEff, never>]) => Micro<AEff, [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer E, infer _R>>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer _E, infer R>>] ? R : never>;
1039
+ export declare const exitVoidAll: <I extends Iterable<MicroExit<any, any>>>(exits: I) => MicroExit<void, I extends Iterable<MicroExit<infer _A, infer _E>> ? _E : never>;
1044
1040
  /**
1045
- * Flattens any nested `Micro` effects, merging the error and requirement types.
1046
- *
1047
- * @since 3.4.0
1041
+ * @since 3.5.9
1048
1042
  * @experimental
1049
- * @category mapping & sequencing
1043
+ * @category scheduler
1050
1044
  */
1051
- export declare const flatten: <A, E, R, E2, R2>(self: Micro<Micro<A, E, R>, E2, R2>) => Micro<A, E | E2, R | R2>;
1045
+ export interface MicroScheduler {
1046
+ readonly scheduleTask: (task: () => void, priority: number) => void;
1047
+ readonly shouldYield: (fiber: Fiber<unknown, unknown>) => boolean;
1048
+ readonly flush: () => void;
1049
+ }
1052
1050
  /**
1053
- * Transforms the success value of the `Micro` effect with the specified
1054
- * function.
1055
- *
1056
- * @since 3.4.0
1051
+ * @since 3.5.9
1057
1052
  * @experimental
1058
- * @category mapping & sequencing
1053
+ * @category scheduler
1059
1054
  */
1060
- export declare const map: {
1055
+ export declare class MicroSchedulerDefault implements MicroScheduler {
1056
+ private tasks;
1057
+ private running;
1061
1058
  /**
1062
- * Transforms the success value of the `Micro` effect with the specified
1063
- * function.
1064
- *
1065
- * @since 3.4.0
1066
- * @experimental
1067
- * @category mapping & sequencing
1059
+ * @since 3.5.9
1068
1060
  */
1069
- <A, B>(f: (a: A) => B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
1061
+ scheduleTask(task: () => void, _priority: number): void;
1070
1062
  /**
1071
- * Transforms the success value of the `Micro` effect with the specified
1072
- * function.
1073
- *
1074
- * @since 3.4.0
1075
- * @experimental
1076
- * @category mapping & sequencing
1063
+ * @since 3.5.9
1077
1064
  */
1078
- <A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R>;
1079
- };
1065
+ afterScheduled: () => void;
1066
+ /**
1067
+ * @since 3.5.9
1068
+ */
1069
+ runTasks(): void;
1070
+ /**
1071
+ * @since 3.5.9
1072
+ */
1073
+ shouldYield(fiber: Fiber<unknown, unknown>): boolean;
1074
+ /**
1075
+ * @since 3.5.9
1076
+ */
1077
+ flush(): void;
1078
+ }
1080
1079
  /**
1081
- * Create a `Micro` effect that will replace the success value of the given
1082
- * effect.
1080
+ * Access the given `Context.Tag` from the environment.
1083
1081
  *
1084
1082
  * @since 3.4.0
1085
1083
  * @experimental
1086
- * @category mapping & sequencing
1084
+ * @category environment
1087
1085
  */
1088
- export declare const as: {
1086
+ export declare const service: {
1089
1087
  /**
1090
- * Create a `Micro` effect that will replace the success value of the given
1091
- * effect.
1088
+ * Access the given `Context.Tag` from the environment.
1092
1089
  *
1093
1090
  * @since 3.4.0
1094
1091
  * @experimental
1095
- * @category mapping & sequencing
1092
+ * @category environment
1096
1093
  */
1097
- <A, B>(value: B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
1094
+ <I, S>(tag: Context.Reference<I, S>): Micro<S>;
1098
1095
  /**
1099
- * Create a `Micro` effect that will replace the success value of the given
1100
- * effect.
1096
+ * Access the given `Context.Tag` from the environment.
1101
1097
  *
1102
1098
  * @since 3.4.0
1103
1099
  * @experimental
1104
- * @category mapping & sequencing
1100
+ * @category environment
1105
1101
  */
1106
- <A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R>;
1102
+ <I, S>(tag: Context.Tag<I, S>): Micro<S, never, I>;
1107
1103
  };
1108
1104
  /**
1109
- * Wrap the success value of this `Micro` effect in an `Option.Some`.
1105
+ * Access the given `Context.Tag` from the environment, without tracking the
1106
+ * dependency at the type level.
1107
+ *
1108
+ * It will return an `Option` of the service, depending on whether it is
1109
+ * available in the environment or not.
1110
1110
  *
1111
1111
  * @since 3.4.0
1112
1112
  * @experimental
1113
- * @category mapping & sequencing
1113
+ * @category environment
1114
1114
  */
1115
- export declare const asSome: <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E, R>;
1115
+ export declare const serviceOption: <I, S>(tag: Context.Tag<I, S>) => Micro<Option.Option<S>>;
1116
1116
  /**
1117
- * Map the success value of this `Micro` effect to another `Micro` effect, then
1118
- * flatten the result.
1117
+ * Update the Context with the given mapping function.
1119
1118
  *
1120
- * @since 3.4.0
1119
+ * @since 3.11.0
1121
1120
  * @experimental
1122
- * @category mapping & sequencing
1121
+ * @category environment
1123
1122
  */
1124
- export declare const flatMap: {
1123
+ export declare const updateContext: {
1125
1124
  /**
1126
- * Map the success value of this `Micro` effect to another `Micro` effect, then
1127
- * flatten the result.
1125
+ * Update the Context with the given mapping function.
1128
1126
  *
1129
- * @since 3.4.0
1127
+ * @since 3.11.0
1130
1128
  * @experimental
1131
- * @category mapping & sequencing
1129
+ * @category environment
1132
1130
  */
1133
- <A, B, E2, R2>(f: (a: A) => Micro<B, E2, R2>): <E, R>(self: Micro<A, E, R>) => Micro<B, E | E2, R | R2>;
1131
+ <R2, R>(f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): <A, E>(self: Micro<A, E, R>) => Micro<A, E, R2>;
1134
1132
  /**
1135
- * Map the success value of this `Micro` effect to another `Micro` effect, then
1136
- * flatten the result.
1133
+ * Update the Context with the given mapping function.
1137
1134
  *
1138
- * @since 3.4.0
1135
+ * @since 3.11.0
1139
1136
  * @experimental
1140
- * @category mapping & sequencing
1137
+ * @category environment
1141
1138
  */
1142
- <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: A) => Micro<B, E2, R2>): Micro<B, E | E2, R | R2>;
1139
+ <A, E, R, R2>(self: Micro<A, E, R>, f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): Micro<A, E, R2>;
1143
1140
  };
1144
1141
  /**
1145
- * Swap the error and success types of the `Micro` effect.
1146
- *
1147
- * @since 3.4.0
1148
- * @experimental
1149
- * @category mapping & sequencing
1150
- */
1151
- export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
1152
- /**
1153
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1154
- * a single api.
1155
- *
1156
- * It also allows you to pass in a `Micro` effect directly, which will be
1157
- * executed after the current effect.
1142
+ * Update the service for the given `Context.Tag` in the environment.
1158
1143
  *
1159
- * @since 3.4.0
1144
+ * @since 3.11.0
1160
1145
  * @experimental
1161
- * @category mapping & sequencing
1146
+ * @category environment
1162
1147
  */
1163
- export declare const andThen: {
1148
+ export declare const updateService: {
1164
1149
  /**
1165
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1166
- * a single api.
1167
- *
1168
- * It also allows you to pass in a `Micro` effect directly, which will be
1169
- * executed after the current effect.
1150
+ * Update the service for the given `Context.Tag` in the environment.
1170
1151
  *
1171
- * @since 3.4.0
1152
+ * @since 3.11.0
1172
1153
  * @experimental
1173
- * @category mapping & sequencing
1154
+ * @category environment
1174
1155
  */
1175
- <A, X>(f: (a: A) => X): <E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
1156
+ <I, A>(tag: Context.Reference<I, A>, f: (value: A) => A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R>;
1176
1157
  /**
1177
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1178
- * a single api.
1158
+ * Update the service for the given `Context.Tag` in the environment.
1179
1159
  *
1180
- * It also allows you to pass in a `Micro` effect directly, which will be
1181
- * executed after the current effect.
1182
- *
1183
- * @since 3.4.0
1160
+ * @since 3.11.0
1184
1161
  * @experimental
1185
- * @category mapping & sequencing
1162
+ * @category environment
1186
1163
  */
1187
- <X>(f: NotFunction<X>): <A, E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
1164
+ <I, A>(tag: Context.Tag<I, A>, f: (value: A) => A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R | I>;
1188
1165
  /**
1189
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1190
- * a single api.
1191
- *
1192
- * It also allows you to pass in a `Micro` effect directly, which will be
1193
- * executed after the current effect.
1166
+ * Update the service for the given `Context.Tag` in the environment.
1194
1167
  *
1195
- * @since 3.4.0
1168
+ * @since 3.11.0
1196
1169
  * @experimental
1197
- * @category mapping & sequencing
1170
+ * @category environment
1198
1171
  */
1199
- <A, E, R, X>(self: Micro<A, E, R>, f: (a: A) => X): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
1172
+ <XA, E, R, I, A>(self: Micro<XA, E, R>, tag: Context.Reference<I, A>, f: (value: A) => A): Micro<XA, E, R>;
1200
1173
  /**
1201
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
1202
- * a single api.
1203
- *
1204
- * It also allows you to pass in a `Micro` effect directly, which will be
1205
- * executed after the current effect.
1174
+ * Update the service for the given `Context.Tag` in the environment.
1206
1175
  *
1207
- * @since 3.4.0
1176
+ * @since 3.11.0
1208
1177
  * @experimental
1209
- * @category mapping & sequencing
1178
+ * @category environment
1210
1179
  */
1211
- <A, E, R, X>(self: Micro<A, E, R>, f: NotFunction<X>): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
1180
+ <XA, E, R, I, A>(self: Micro<XA, E, R>, tag: Context.Tag<I, A>, f: (value: A) => A): Micro<XA, E, R | I>;
1212
1181
  };
1213
1182
  /**
1214
- * Execute a side effect from the success value of the `Micro` effect.
1183
+ * Access the current `Context` from the environment.
1215
1184
  *
1216
- * It is similar to the `andThen` api, but the success value is ignored.
1185
+ * @since 3.4.0
1186
+ * @experimental
1187
+ * @category environment
1188
+ */
1189
+ export declare const context: <R>() => Micro<Context.Context<R>>;
1190
+ /**
1191
+ * Merge the given `Context` with the current context.
1217
1192
  *
1218
1193
  * @since 3.4.0
1219
1194
  * @experimental
1220
- * @category mapping & sequencing
1195
+ * @category environment
1221
1196
  */
1222
- export declare const tap: {
1223
- /**
1224
- * Execute a side effect from the success value of the `Micro` effect.
1225
- *
1226
- * It is similar to the `andThen` api, but the success value is ignored.
1227
- *
1228
- * @since 3.4.0
1229
- * @experimental
1230
- * @category mapping & sequencing
1231
- */
1232
- <A, X>(f: (a: NoInfer<A>) => X): <E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
1233
- /**
1234
- * Execute a side effect from the success value of the `Micro` effect.
1235
- *
1236
- * It is similar to the `andThen` api, but the success value is ignored.
1237
- *
1238
- * @since 3.4.0
1239
- * @experimental
1240
- * @category mapping & sequencing
1241
- */
1242
- <X>(f: NotFunction<X>): <A, E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
1197
+ export declare const provideContext: {
1243
1198
  /**
1244
- * Execute a side effect from the success value of the `Micro` effect.
1245
- *
1246
- * It is similar to the `andThen` api, but the success value is ignored.
1199
+ * Merge the given `Context` with the current context.
1247
1200
  *
1248
1201
  * @since 3.4.0
1249
1202
  * @experimental
1250
- * @category mapping & sequencing
1203
+ * @category environment
1251
1204
  */
1252
- <A, E, R, X>(self: Micro<A, E, R>, f: (a: NoInfer<A>) => X): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
1205
+ <XR>(context: Context.Context<XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, XR>>;
1253
1206
  /**
1254
- * Execute a side effect from the success value of the `Micro` effect.
1255
- *
1256
- * It is similar to the `andThen` api, but the success value is ignored.
1207
+ * Merge the given `Context` with the current context.
1257
1208
  *
1258
1209
  * @since 3.4.0
1259
1210
  * @experimental
1260
- * @category mapping & sequencing
1211
+ * @category environment
1261
1212
  */
1262
- <A, E, R, X>(self: Micro<A, E, R>, f: NotFunction<X>): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
1213
+ <A, E, R, XR>(self: Micro<A, E, R>, context: Context.Context<XR>): Micro<A, E, Exclude<R, XR>>;
1263
1214
  };
1264
1215
  /**
1265
- * Replace the success value of the `Micro` effect with `void`.
1266
- *
1267
- * @since 3.4.0
1268
- * @experimental
1269
- * @category mapping & sequencing
1270
- */
1271
- export declare const asVoid: <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
1272
- /**
1273
- * Access the `MicroExit` of the given `Micro` effect.
1274
- *
1275
- * @since 3.4.6
1276
- * @experimental
1277
- * @category mapping & sequencing
1278
- */
1279
- export declare const exit: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroExit<A, E>, never, R>;
1280
- /**
1281
- * Replace the error type of the given `Micro` with the full `MicroCause` object.
1282
- *
1283
- * @since 3.4.0
1284
- * @experimental
1285
- * @category mapping & sequencing
1286
- */
1287
- export declare const sandbox: <A, E, R>(self: Micro<A, E, R>) => Micro<A, MicroCause<E>, R>;
1288
- /**
1289
- * Returns an effect that races all the specified effects,
1290
- * yielding the value of the first effect to succeed with a value. Losers of
1291
- * the race will be interrupted immediately
1292
- *
1293
- * @since 3.4.0
1294
- * @experimental
1295
- * @category sequencing
1296
- */
1297
- export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
1298
- /**
1299
- * Returns an effect that races all the specified effects,
1300
- * yielding the value of the first effect to succeed or fail. Losers of
1301
- * the race will be interrupted immediately
1216
+ * Add the provided service to the current context.
1302
1217
  *
1303
1218
  * @since 3.4.0
1304
1219
  * @experimental
1305
- * @category sequencing
1220
+ * @category environment
1306
1221
  */
1307
- export declare const raceAllFirst: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
1222
+ export declare const provideService: {
1223
+ /**
1224
+ * Add the provided service to the current context.
1225
+ *
1226
+ * @since 3.4.0
1227
+ * @experimental
1228
+ * @category environment
1229
+ */
1230
+ <I, S>(tag: Context.Tag<I, S>, service: S): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, I>>;
1231
+ /**
1232
+ * Add the provided service to the current context.
1233
+ *
1234
+ * @since 3.4.0
1235
+ * @experimental
1236
+ * @category environment
1237
+ */
1238
+ <A, E, R, I, S>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, service: S): Micro<A, E, Exclude<R, I>>;
1239
+ };
1308
1240
  /**
1309
- * Returns an effect that races two effects, yielding the value of the first
1310
- * effect to succeed. Losers of the race will be interrupted immediately
1241
+ * Create a service using the provided `Micro` effect, and add it to the
1242
+ * current context.
1311
1243
  *
1312
- * @since 3.4.0
1244
+ * @since 3.4.6
1313
1245
  * @experimental
1314
- * @category sequencing
1246
+ * @category environment
1315
1247
  */
1316
- export declare const race: {
1248
+ export declare const provideServiceEffect: {
1317
1249
  /**
1318
- * Returns an effect that races two effects, yielding the value of the first
1319
- * effect to succeed. Losers of the race will be interrupted immediately
1250
+ * Create a service using the provided `Micro` effect, and add it to the
1251
+ * current context.
1320
1252
  *
1321
- * @since 3.4.0
1253
+ * @since 3.4.6
1322
1254
  * @experimental
1323
- * @category sequencing
1255
+ * @category environment
1324
1256
  */
1325
- <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
1257
+ <I, S, E2, R2>(tag: Context.Tag<I, S>, acquire: Micro<S, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | E2, Exclude<R, I> | R2>;
1326
1258
  /**
1327
- * Returns an effect that races two effects, yielding the value of the first
1328
- * effect to succeed. Losers of the race will be interrupted immediately
1259
+ * Create a service using the provided `Micro` effect, and add it to the
1260
+ * current context.
1329
1261
  *
1330
- * @since 3.4.0
1262
+ * @since 3.4.6
1331
1263
  * @experimental
1332
- * @category sequencing
1264
+ * @category environment
1333
1265
  */
1334
- <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
1266
+ <A, E, R, I, S, E2, R2>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, acquire: Micro<S, E2, R2>): Micro<A, E | E2, Exclude<R, I> | R2>;
1335
1267
  };
1268
+ declare const MaxOpsBeforeYield_base: Context.ReferenceClass<MaxOpsBeforeYield, "effect/Micro/currentMaxOpsBeforeYield", number>;
1336
1269
  /**
1337
- * Returns an effect that races two effects, yielding the value of the first
1338
- * effect to succeed *or* fail. Losers of the race will be interrupted immediately
1270
+ * @since 3.11.0
1271
+ * @experimental
1272
+ * @category references
1273
+ */
1274
+ export declare class MaxOpsBeforeYield extends MaxOpsBeforeYield_base {
1275
+ }
1276
+ declare const CurrentConcurrency_base: Context.ReferenceClass<CurrentConcurrency, "effect/Micro/currentConcurrency", number | "unbounded">;
1277
+ /**
1278
+ * @since 3.11.0
1279
+ * @experimental
1280
+ * @category environment refs
1281
+ */
1282
+ export declare class CurrentConcurrency extends CurrentConcurrency_base {
1283
+ }
1284
+ declare const CurrentScheduler_base: Context.ReferenceClass<CurrentScheduler, "effect/Micro/currentScheduler", MicroScheduler>;
1285
+ /**
1286
+ * @since 3.11.0
1287
+ * @experimental
1288
+ * @category environment refs
1289
+ */
1290
+ export declare class CurrentScheduler extends CurrentScheduler_base {
1291
+ }
1292
+ /**
1293
+ * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1294
+ * api to control the concurrency of that `Micro` when it is run.
1339
1295
  *
1340
1296
  * @since 3.4.0
1341
1297
  * @experimental
1342
- * @category sequencing
1298
+ * @category environment refs
1299
+ * @example
1300
+ * import * as Micro from "effect/Micro"
1301
+ *
1302
+ * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
1303
+ * concurrency: "inherit"
1304
+ * }).pipe(
1305
+ * Micro.withConcurrency(2) // use a concurrency of 2
1306
+ * )
1343
1307
  */
1344
- export declare const raceFirst: {
1308
+ export declare const withConcurrency: {
1345
1309
  /**
1346
- * Returns an effect that races two effects, yielding the value of the first
1347
- * effect to succeed *or* fail. Losers of the race will be interrupted immediately
1310
+ * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1311
+ * api to control the concurrency of that `Micro` when it is run.
1348
1312
  *
1349
1313
  * @since 3.4.0
1350
1314
  * @experimental
1351
- * @category sequencing
1315
+ * @category environment refs
1316
+ * @example
1317
+ * import * as Micro from "effect/Micro"
1318
+ *
1319
+ * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
1320
+ * concurrency: "inherit"
1321
+ * }).pipe(
1322
+ * Micro.withConcurrency(2) // use a concurrency of 2
1323
+ * )
1352
1324
  */
1353
- <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
1325
+ (concurrency: "unbounded" | number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1354
1326
  /**
1355
- * Returns an effect that races two effects, yielding the value of the first
1356
- * effect to succeed *or* fail. Losers of the race will be interrupted immediately
1327
+ * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1328
+ * api to control the concurrency of that `Micro` when it is run.
1357
1329
  *
1358
1330
  * @since 3.4.0
1359
1331
  * @experimental
1360
- * @category sequencing
1332
+ * @category environment refs
1333
+ * @example
1334
+ * import * as Micro from "effect/Micro"
1335
+ *
1336
+ * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
1337
+ * concurrency: "inherit"
1338
+ * }).pipe(
1339
+ * Micro.withConcurrency(2) // use a concurrency of 2
1340
+ * )
1361
1341
  */
1362
- <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
1342
+ <A, E, R>(self: Micro<A, E, R>, concurrency: "unbounded" | number): Micro<A, E, R>;
1363
1343
  };
1364
1344
  /**
1365
1345
  * Combine two `Micro` effects into a single effect that produces a tuple of
@@ -1653,6 +1633,84 @@ export declare const repeat: {
1653
1633
  schedule?: MicroSchedule | undefined;
1654
1634
  } | undefined): Micro<A, E, R>;
1655
1635
  };
1636
+ /**
1637
+ * Replicates the given effect `n` times.
1638
+ *
1639
+ * @since 3.11.0
1640
+ * @experimental
1641
+ * @category repetition
1642
+ */
1643
+ export declare const replicate: {
1644
+ /**
1645
+ * Replicates the given effect `n` times.
1646
+ *
1647
+ * @since 3.11.0
1648
+ * @experimental
1649
+ * @category repetition
1650
+ */
1651
+ (n: number): <A, E, R>(self: Micro<A, E, R>) => Array<Micro<A, E, R>>;
1652
+ /**
1653
+ * Replicates the given effect `n` times.
1654
+ *
1655
+ * @since 3.11.0
1656
+ * @experimental
1657
+ * @category repetition
1658
+ */
1659
+ <A, E, R>(self: Micro<A, E, R>, n: number): Array<Micro<A, E, R>>;
1660
+ };
1661
+ /**
1662
+ * Performs this effect the specified number of times and collects the
1663
+ * results.
1664
+ *
1665
+ * @since 3.11.0
1666
+ * @category repetition
1667
+ */
1668
+ export declare const replicateEffect: {
1669
+ /**
1670
+ * Performs this effect the specified number of times and collects the
1671
+ * results.
1672
+ *
1673
+ * @since 3.11.0
1674
+ * @category repetition
1675
+ */
1676
+ (n: number, options?: {
1677
+ readonly concurrency?: Concurrency | undefined;
1678
+ readonly discard?: false | undefined;
1679
+ }): <A, E, R>(self: Micro<A, E, R>) => Micro<Array<A>, E, R>;
1680
+ /**
1681
+ * Performs this effect the specified number of times and collects the
1682
+ * results.
1683
+ *
1684
+ * @since 3.11.0
1685
+ * @category repetition
1686
+ */
1687
+ (n: number, options: {
1688
+ readonly concurrency?: Concurrency | undefined;
1689
+ readonly discard: true;
1690
+ }): <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
1691
+ /**
1692
+ * Performs this effect the specified number of times and collects the
1693
+ * results.
1694
+ *
1695
+ * @since 3.11.0
1696
+ * @category repetition
1697
+ */
1698
+ <A, E, R>(self: Micro<A, E, R>, n: number, options?: {
1699
+ readonly concurrency?: Concurrency | undefined;
1700
+ readonly discard?: false | undefined;
1701
+ }): Micro<Array<A>, E, R>;
1702
+ /**
1703
+ * Performs this effect the specified number of times and collects the
1704
+ * results.
1705
+ *
1706
+ * @since 3.11.0
1707
+ * @category repetition
1708
+ */
1709
+ <A, E, R>(self: Micro<A, E, R>, n: number, options: {
1710
+ readonly concurrency?: Concurrency | undefined;
1711
+ readonly discard: true;
1712
+ }): Micro<void, E, R>;
1713
+ };
1656
1714
  /**
1657
1715
  * Repeat the given `Micro` effect forever, only stopping if the effect fails.
1658
1716
  *
@@ -2741,6 +2799,31 @@ export declare const onExit: {
2741
2799
  */
2742
2800
  <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>;
2743
2801
  };
2802
+ /**
2803
+ * Regardless of the result of the this `Micro` effect, run the finalizer effect.
2804
+ *
2805
+ * @since 3.4.0
2806
+ * @experimental
2807
+ * @category resources & finalization
2808
+ */
2809
+ export declare const ensuring: {
2810
+ /**
2811
+ * Regardless of the result of the this `Micro` effect, run the finalizer effect.
2812
+ *
2813
+ * @since 3.4.0
2814
+ * @experimental
2815
+ * @category resources & finalization
2816
+ */
2817
+ <XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
2818
+ /**
2819
+ * Regardless of the result of the this `Micro` effect, run the finalizer effect.
2820
+ *
2821
+ * @since 3.4.0
2822
+ * @experimental
2823
+ * @category resources & finalization
2824
+ */
2825
+ <A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
2826
+ };
2744
2827
  /**
2745
2828
  * When the `Micro` effect is completed, run the given finalizer effect if it
2746
2829
  * matches the specified predicate.
@@ -2787,31 +2870,6 @@ export declare const onExitIf: {
2787
2870
  */
2788
2871
  <A, E, R, XE, XR>(self: Micro<A, E, R>, predicate: Predicate<MicroExit<NoInfer<A>, NoInfer<E>>>, f: (exit: MicroExit<NoInfer<A>, NoInfer<E>>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
2789
2872
  };
2790
- /**
2791
- * Regardless of the result of the this `Micro` effect, run the finalizer effect.
2792
- *
2793
- * @since 3.4.0
2794
- * @experimental
2795
- * @category resources & finalization
2796
- */
2797
- export declare const ensuring: {
2798
- /**
2799
- * Regardless of the result of the this `Micro` effect, run the finalizer effect.
2800
- *
2801
- * @since 3.4.0
2802
- * @experimental
2803
- * @category resources & finalization
2804
- */
2805
- <XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
2806
- /**
2807
- * Regardless of the result of the this `Micro` effect, run the finalizer effect.
2808
- *
2809
- * @since 3.4.0
2810
- * @experimental
2811
- * @category resources & finalization
2812
- */
2813
- <A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
2814
- };
2815
2873
  /**
2816
2874
  * When the `Micro` effect fails, run the given finalizer effect with the
2817
2875
  * `MicroCause` of the executed effect.
@@ -2883,14 +2941,23 @@ export declare const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(acqu
2883
2941
  */
2884
2942
  export declare const interrupt: Micro<never>;
2885
2943
  /**
2886
- * Wrap the given `Micro` effect in an uninterruptible region, preventing the
2887
- * effect from being aborted.
2944
+ * Flag the effect as uninterruptible, which means that when the effect is
2945
+ * interrupted, it will be allowed to continue running until completion.
2888
2946
  *
2889
2947
  * @since 3.4.0
2890
2948
  * @experimental
2891
- * @category interruption
2949
+ * @category flags
2892
2950
  */
2893
2951
  export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
2952
+ /**
2953
+ * Flag the effect as interruptible, which means that when the effect is
2954
+ * interrupted, it will be interrupted immediately.
2955
+ *
2956
+ * @since 3.4.0
2957
+ * @experimental
2958
+ * @category flags
2959
+ */
2960
+ export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
2894
2961
  /**
2895
2962
  * Wrap the given `Micro` effect in an uninterruptible region, preventing the
2896
2963
  * effect from being aborted.
@@ -2902,6 +2969,7 @@ export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A
2902
2969
  * @experimental
2903
2970
  * @category interruption
2904
2971
  * @example
2972
+ * ```ts
2905
2973
  * import * as Micro from "effect/Micro"
2906
2974
  *
2907
2975
  * Micro.uninterruptibleMask((restore) =>
@@ -2909,17 +2977,9 @@ export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A
2909
2977
  * Micro.andThen(restore(Micro.sleep(1000))) // interruptible
2910
2978
  * )
2911
2979
  * )
2980
+ * ```
2912
2981
  */
2913
2982
  export declare const uninterruptibleMask: <A, E, R>(f: (restore: <A_1, E_1, R_1>(effect: Micro<A_1, E_1, R_1>) => Micro<A_1, E_1, R_1>) => Micro<A, E, R>) => Micro<A, E, R>;
2914
- /**
2915
- * Wrap the given `Micro` effect in an interruptible region, allowing the effect
2916
- * to be aborted.
2917
- *
2918
- * @since 3.4.0
2919
- * @experimental
2920
- * @category interruption
2921
- */
2922
- export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
2923
2983
  /**
2924
2984
  * @since 3.4.0
2925
2985
  * @experimental
@@ -2982,6 +3042,16 @@ export declare const all: <const Arg extends Iterable<Micro<any, any, any>> | Re
2982
3042
  readonly concurrency?: Concurrency | undefined;
2983
3043
  readonly discard?: boolean | undefined;
2984
3044
  }>(arg: Arg, options?: O) => All.Return<Arg, O>;
3045
+ /**
3046
+ * @since 3.11.0
3047
+ * @experimental
3048
+ * @category collecting & elements
3049
+ */
3050
+ export declare const whileLoop: <A, E, R>(options: {
3051
+ readonly while: LazyArg<boolean>;
3052
+ readonly body: LazyArg<Micro<A, E, R>>;
3053
+ readonly step: (a: A) => void;
3054
+ }) => Micro<void, E, R>;
2985
3055
  /**
2986
3056
  * For each element of the provided iterable, run the effect and collect the results.
2987
3057
  *
@@ -3139,60 +3209,6 @@ export {
3139
3209
  * @category do notation
3140
3210
  */
3141
3211
  let_ as let };
3142
- /**
3143
- * @since 3.4.0
3144
- * @experimental
3145
- * @category handle & forking
3146
- */
3147
- export declare const HandleTypeId: unique symbol;
3148
- /**
3149
- * @since 3.4.0
3150
- * @experimental
3151
- * @category handle & forking
3152
- */
3153
- export type HandleTypeId = typeof HandleTypeId;
3154
- /**
3155
- * @since 3.4.0
3156
- * @experimental
3157
- * @category handle & forking
3158
- */
3159
- export interface Handle<A, E = never> extends Micro<A, E> {
3160
- readonly [HandleTypeId]: HandleTypeId;
3161
- readonly await: Micro<MicroExit<A, E>>;
3162
- readonly join: Micro<A, E>;
3163
- readonly interrupt: Micro<MicroExit<A, E>>;
3164
- readonly unsafeInterrupt: () => void;
3165
- readonly addObserver: (observer: (exit: MicroExit<A, E>) => void) => void;
3166
- readonly removeObserver: (observer: (exit: MicroExit<A, E>) => void) => void;
3167
- readonly unsafePoll: () => MicroExit<A, E> | null;
3168
- [Unify.typeSymbol]?: unknown;
3169
- [Unify.unifySymbol]?: HandleUnify<this>;
3170
- [Unify.ignoreSymbol]?: HandleUnifyIgnore;
3171
- }
3172
- /**
3173
- * @category models
3174
- * @since 3.8.4
3175
- * @experimental
3176
- */
3177
- export interface HandleUnify<A extends {
3178
- [Unify.typeSymbol]?: any;
3179
- }> extends MicroUnify<A> {
3180
- Handle?: () => A[Unify.typeSymbol] extends Handle<infer A0, infer E0> | infer _ ? Handle<A0, E0> : never;
3181
- }
3182
- /**
3183
- * @category models
3184
- * @since 3.8.4
3185
- * @experimental
3186
- */
3187
- export interface HandleUnifyIgnore extends MicroUnifyIgnore {
3188
- Micro?: true;
3189
- }
3190
- /**
3191
- * @since 3.4.0
3192
- * @experimental
3193
- * @category handle & forking
3194
- */
3195
- export declare const isHandle: (u: unknown) => u is Handle<unknown, unknown>;
3196
3212
  /**
3197
3213
  * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3198
3214
  * aborted.
@@ -3203,7 +3219,7 @@ export declare const isHandle: (u: unknown) => u is Handle<unknown, unknown>;
3203
3219
  * @experimental
3204
3220
  * @category handle & forking
3205
3221
  */
3206
- export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>;
3222
+ export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
3207
3223
  /**
3208
3224
  * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3209
3225
  * aborted.
@@ -3214,7 +3230,7 @@ export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>
3214
3230
  * @experimental
3215
3231
  * @category handle & forking
3216
3232
  */
3217
- export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>;
3233
+ export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
3218
3234
  /**
3219
3235
  * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3220
3236
  * aborted.
@@ -3236,7 +3252,7 @@ export declare const forkIn: {
3236
3252
  * @experimental
3237
3253
  * @category handle & forking
3238
3254
  */
3239
- (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>;
3255
+ (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
3240
3256
  /**
3241
3257
  * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3242
3258
  * aborted.
@@ -3247,7 +3263,7 @@ export declare const forkIn: {
3247
3263
  * @experimental
3248
3264
  * @category handle & forking
3249
3265
  */
3250
- <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<Handle<A, E>, never, R>;
3266
+ <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<Fiber<A, E>, never, R>;
3251
3267
  };
3252
3268
  /**
3253
3269
  * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
@@ -3259,7 +3275,7 @@ export declare const forkIn: {
3259
3275
  * @experimental
3260
3276
  * @category handle & forking
3261
3277
  */
3262
- export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R | MicroScope>;
3278
+ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R | MicroScope>;
3263
3279
  /**
3264
3280
  * Execute the `Micro` effect and return a `Handle` that can be awaited, joined,
3265
3281
  * or aborted.
@@ -3271,6 +3287,7 @@ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle
3271
3287
  * @experimental
3272
3288
  * @category execution
3273
3289
  * @example
3290
+ * ```ts
3274
3291
  * import * as Micro from "effect/Micro"
3275
3292
  *
3276
3293
  * const handle = Micro.succeed(42).pipe(
@@ -3281,11 +3298,12 @@ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle
3281
3298
  * handle.addObserver((exit) => {
3282
3299
  * console.log(exit)
3283
3300
  * })
3301
+ * ```
3284
3302
  */
3285
3303
  export declare const runFork: <A, E>(effect: Micro<A, E>, options?: {
3286
3304
  readonly signal?: AbortSignal | undefined;
3287
3305
  readonly scheduler?: MicroScheduler | undefined;
3288
- } | undefined) => Handle<A, E>;
3306
+ } | undefined) => FiberImpl<A, E>;
3289
3307
  /**
3290
3308
  * Execute the `Micro` effect and return a `Promise` that resolves with the
3291
3309
  * `MicroExit` of the computation.
@@ -3336,12 +3354,11 @@ export declare const runSync: <A, E>(effect: Micro<A, E>) => A;
3336
3354
  * @category errors
3337
3355
  */
3338
3356
  export interface YieldableError extends Pipeable, Inspectable, Readonly<Error> {
3339
- readonly [EffectTypeId]: Effect.VarianceStruct<never, this, never>;
3340
- readonly [StreamTypeId]: Stream.VarianceStruct<never, this, never>;
3341
- readonly [SinkTypeId]: Sink.VarianceStruct<never, unknown, never, this, never>;
3342
- readonly [ChannelTypeId]: Channel.VarianceStruct<never, unknown, this, unknown, never, unknown, never>;
3357
+ readonly [Effectable.EffectTypeId]: Effect.VarianceStruct<never, this, never>;
3358
+ readonly [Effectable.StreamTypeId]: Stream.VarianceStruct<never, this, never>;
3359
+ readonly [Effectable.SinkTypeId]: Sink.VarianceStruct<never, unknown, never, this, never>;
3360
+ readonly [Effectable.ChannelTypeId]: Channel.VarianceStruct<never, unknown, this, unknown, never, unknown, never>;
3343
3361
  readonly [TypeId]: Micro.Variance<never, this, never>;
3344
- readonly [runSymbol]: (env: Env<any>, onExit: (exit: MicroExit<never, this>) => void) => void;
3345
3362
  [Symbol.iterator](): MicroIterator<Micro<never, this, never>>;
3346
3363
  }
3347
3364
  /**