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
@@ -33,6 +33,7 @@ export const accumulateChunks = internal.accumulateChunks;
33
33
  * stream is consumed.
34
34
  *
35
35
  * @example
36
+ * ```ts
36
37
  * import { Console, Effect, Stream } from "effect"
37
38
  *
38
39
  * // Simulating File operations
@@ -54,6 +55,7 @@ export const accumulateChunks = internal.accumulateChunks;
54
55
  * // Opening file.txt
55
56
  * // Closing file.txt
56
57
  * // { _id: 'Chunk', values: [ [ 'Line 1', 'Line 2', 'Line 3' ] ] }
58
+ * ```
57
59
  *
58
60
  * @since 2.0.0
59
61
  * @category constructors
@@ -107,12 +109,14 @@ export const aggregateWithinEither = internal.aggregateWithinEither;
107
109
  * Maps the success values of this stream to the specified constant value.
108
110
  *
109
111
  * @example
112
+ * ```ts
110
113
  * import { Effect, Stream } from "effect"
111
114
  *
112
115
  * const stream = Stream.range(1, 5).pipe(Stream.as(null))
113
116
  *
114
117
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
115
118
  * // { _id: 'Chunk', values: [ null, null, null, null, null ] }
119
+ * ```
116
120
  *
117
121
  * @since 2.0.0
118
122
  * @category mapping
@@ -129,6 +133,7 @@ export {
129
133
  * executed if the `Fiber` executing this Effect is interrupted.
130
134
  *
131
135
  * @example
136
+ * ```ts
132
137
  * import type { StreamEmit } from "effect"
133
138
  * import { Chunk, Effect, Option, Stream } from "effect"
134
139
  *
@@ -151,6 +156,7 @@ export {
151
156
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
152
157
  * // { _id: 'Chunk', values: [ 1, 2 ] }
153
158
  *
159
+ * ```
154
160
  * @since 2.0.0
155
161
  * @category constructors
156
162
  */
@@ -179,6 +185,7 @@ export const asyncEffect = internal.asyncEffect;
179
185
  * second argument with the `bufferSize` and `strategy` fields.
180
186
  *
181
187
  * @example
188
+ * ```ts
182
189
  * import { Effect, Stream } from "effect"
183
190
  *
184
191
  * Stream.asyncPush<string>((emit) =>
@@ -193,6 +200,7 @@ export const asyncEffect = internal.asyncEffect;
193
200
  * clearInterval(handle)
194
201
  * })
195
202
  * ), { bufferSize: 16, strategy: "dropping" })
203
+ * ```
196
204
  *
197
205
  * @since 3.6.0
198
206
  * @category constructors
@@ -223,6 +231,7 @@ export const branchAfter = internal.branchAfter;
223
231
  * chunks before the slowest downstream stream.
224
232
  *
225
233
  * @example
234
+ * ```ts
226
235
  * import { Console, Effect, Fiber, Schedule, Stream } from "effect"
227
236
  *
228
237
  * const numbers = Effect.scoped(
@@ -292,6 +301,7 @@ export const branchAfter = internal.branchAfter;
292
301
  * // Logging to the Console: 19
293
302
  * // Logging to the Console: 20
294
303
  * // { _id: 'Chunk', values: [ undefined ] }
304
+ * ```
295
305
  *
296
306
  * @since 2.0.0
297
307
  * @category utils
@@ -346,6 +356,7 @@ export const broadcastedQueuesDynamic = internal.broadcastedQueuesDynamic;
346
356
  * of 2 for better performance.
347
357
  *
348
358
  * @example
359
+ * ```ts
349
360
  * import { Console, Effect, Schedule, Stream } from "effect"
350
361
  *
351
362
  * const stream = Stream.range(1, 10).pipe(
@@ -372,6 +383,7 @@ export const broadcastedQueuesDynamic = internal.broadcastedQueuesDynamic;
372
383
  * // after buffering: 5
373
384
  * // before buffering: 10
374
385
  * // ...
386
+ * ```
375
387
  *
376
388
  * @since 2.0.0
377
389
  * @category utils
@@ -442,12 +454,14 @@ export const catchSomeCause = internal.catchSomeCause;
442
454
  * elements are equal.
443
455
  *
444
456
  * @example
457
+ * ```ts
445
458
  * import { Effect, Stream } from "effect"
446
459
  *
447
460
  * const stream = Stream.make(1, 1, 1, 2, 2, 3, 4).pipe(Stream.changes)
448
461
  *
449
462
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
450
463
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4 ] }
464
+ * ```
451
465
  *
452
466
  * @since 2.0.0
453
467
  * @category utils
@@ -518,6 +532,7 @@ export const combineChunks = internal.combineChunks;
518
532
  * specified stream.
519
533
  *
520
534
  * @example
535
+ * ```ts
521
536
  * import { Effect, Stream } from "effect"
522
537
  *
523
538
  * const s1 = Stream.make(1, 2, 3)
@@ -527,6 +542,7 @@ export const combineChunks = internal.combineChunks;
527
542
  *
528
543
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
529
544
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5 ] }
545
+ * ```
530
546
  *
531
547
  * @since 2.0.0
532
548
  * @category utils
@@ -536,6 +552,7 @@ export const concat = internal.concat;
536
552
  * Concatenates all of the streams in the chunk to one stream.
537
553
  *
538
554
  * @example
555
+ * ```ts
539
556
  * import { Chunk, Effect, Stream } from "effect"
540
557
  *
541
558
  * const s1 = Stream.make(1, 2, 3)
@@ -552,6 +569,7 @@ export const concat = internal.concat;
552
569
  * // 5, 6, 7, 8
553
570
  * // ]
554
571
  * // }
572
+ * ```
555
573
  *
556
574
  * @since 2.0.0
557
575
  * @category constructors
@@ -565,6 +583,7 @@ export const concatAll = internal.concatAll;
565
583
  * See also `Stream.zip` for the more common point-wise variant.
566
584
  *
567
585
  * @example
586
+ * ```ts
568
587
  * import { Effect, Stream } from "effect"
569
588
  *
570
589
  * const s1 = Stream.make(1, 2, 3)
@@ -579,6 +598,7 @@ export const concatAll = internal.concatAll;
579
598
  * // [ 1, "a" ], [ 1, "b" ], [ 2, "a" ], [ 2, "b" ], [ 3, "a" ], [ 3, "b" ]
580
599
  * // ]
581
600
  * // }
601
+ * ```
582
602
  *
583
603
  * @since 2.0.0
584
604
  * @category utils
@@ -630,6 +650,7 @@ export const crossWith = internal.crossWith;
630
650
  * has paused typing so as to not prematurely recommend results.
631
651
  *
632
652
  * @example
653
+ * ```ts
633
654
  * import { Effect, Stream } from "effect"
634
655
  *
635
656
  * let last = Date.now()
@@ -667,6 +688,7 @@ export const crossWith = internal.crossWith;
667
688
  * // Received 8 after 1ms
668
689
  * // > Emitted 8 after 101ms
669
690
  * // { _id: 'Chunk', values: [ 3, 6, 8 ] }
691
+ * ```
670
692
  *
671
693
  * @since 2.0.0
672
694
  * @category utils
@@ -719,6 +741,7 @@ export const distributedWithDynamic = internal.distributedWithDynamic;
719
741
  * elements. Useful for sequencing effects using streams:
720
742
  *
721
743
  * @example
744
+ * ```ts
722
745
  * import { Effect, Stream } from "effect"
723
746
  *
724
747
  * // We create a stream and immediately drain it.
@@ -726,6 +749,7 @@ export const distributedWithDynamic = internal.distributedWithDynamic;
726
749
  *
727
750
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
728
751
  * // { _id: 'Chunk', values: [] }
752
+ * ```
729
753
  *
730
754
  * @since 2.0.0
731
755
  * @category utils
@@ -803,12 +827,14 @@ export const either = internal.either;
803
827
  * The empty stream.
804
828
  *
805
829
  * @example
830
+ * ```ts
806
831
  * import { Effect, Stream } from "effect"
807
832
  *
808
833
  * const stream = Stream.empty
809
834
  *
810
835
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
811
836
  * // { _id: 'Chunk', values: [] }
837
+ * ```
812
838
  *
813
839
  * @since 2.0.0
814
840
  * @category constructors
@@ -818,6 +844,7 @@ export const empty = internal.empty;
818
844
  * Executes the provided finalizer after this stream's finalizers run.
819
845
  *
820
846
  * @example
847
+ * ```ts
821
848
  * import { Console, Effect, Stream } from "effect"
822
849
  *
823
850
  * const program = Stream.fromEffect(Console.log("Application Logic.")).pipe(
@@ -832,6 +859,7 @@ export const empty = internal.empty;
832
859
  * // Finalizing the stream
833
860
  * // Doing some other works after stream's finalization
834
861
  * // { _id: 'Chunk', values: [ undefined, undefined ] }
862
+ * ```
835
863
  *
836
864
  * @since 2.0.0
837
865
  * @category utils
@@ -883,6 +911,7 @@ export const execute = internal.execute;
883
911
  * Terminates with the specified error.
884
912
  *
885
913
  * @example
914
+ * ```ts
886
915
  * import { Effect, Stream } from "effect"
887
916
  *
888
917
  * const stream = Stream.fail("Uh oh!")
@@ -893,6 +922,7 @@ export const execute = internal.execute;
893
922
  * // _tag: 'Failure',
894
923
  * // cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' }
895
924
  * // }
925
+ * ```
896
926
  *
897
927
  * @since 2.0.0
898
928
  * @category constructors
@@ -923,12 +953,14 @@ export const failCauseSync = internal.failCauseSync;
923
953
  * Filters the elements emitted by this stream using the provided function.
924
954
  *
925
955
  * @example
956
+ * ```ts
926
957
  * import { Effect, Stream } from "effect"
927
958
  *
928
959
  * const stream = Stream.range(1, 11).pipe(Stream.filter((n) => n % 2 === 0))
929
960
  *
930
961
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
931
962
  * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
963
+ * ```
932
964
  *
933
965
  * @since 2.0.0
934
966
  * @category filtering
@@ -976,6 +1008,7 @@ export const filterMapWhileEffect = internal.filterMapWhileEffect;
976
1008
  * when it ends.
977
1009
  *
978
1010
  * @example
1011
+ * ```ts
979
1012
  * import { Console, Effect, Stream } from "effect"
980
1013
  *
981
1014
  * const application = Stream.fromEffect(Console.log("Application Logic."))
@@ -997,6 +1030,7 @@ export const filterMapWhileEffect = internal.filterMapWhileEffect;
997
1030
  * // Deleting dir: tmp
998
1031
  * // Temporary directory was deleted.
999
1032
  * // { _id: 'Chunk', values: [ undefined, undefined ] }
1033
+ * ```
1000
1034
  *
1001
1035
  * @since 2.0.0
1002
1036
  * @category constructors
@@ -1090,6 +1124,7 @@ export const forever = internal.forever;
1090
1124
  * Creates a stream from an `AsyncIterable`.
1091
1125
  *
1092
1126
  * @example
1127
+ * ```ts
1093
1128
  * import { Effect, Stream } from "effect"
1094
1129
  *
1095
1130
  * const myAsyncIterable = async function*() {
@@ -1104,6 +1139,7 @@ export const forever = internal.forever;
1104
1139
  *
1105
1140
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1106
1141
  * // { _id: 'Chunk', values: [ 1, 2 ] }
1142
+ * ```
1107
1143
  *
1108
1144
  * @since 2.0.0
1109
1145
  * @category constructors
@@ -1127,6 +1163,7 @@ export const toChannel = internal.toChannel;
1127
1163
  * Creates a stream from a `Chunk` of values.
1128
1164
  *
1129
1165
  * @example
1166
+ * ```ts
1130
1167
  * import { Chunk, Effect, Stream } from "effect"
1131
1168
  *
1132
1169
  * // Creating a stream with values from a single Chunk
@@ -1134,6 +1171,7 @@ export const toChannel = internal.toChannel;
1134
1171
  *
1135
1172
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1136
1173
  * // { _id: 'Chunk', values: [ 1, 2, 3 ] }
1174
+ * ```
1137
1175
  *
1138
1176
  * @since 2.0.0
1139
1177
  * @category constructors
@@ -1159,6 +1197,7 @@ export const fromChunkQueue = internal.fromChunkQueue;
1159
1197
  * Creates a stream from an arbitrary number of chunks.
1160
1198
  *
1161
1199
  * @example
1200
+ * ```ts
1162
1201
  * import { Chunk, Effect, Stream } from "effect"
1163
1202
  *
1164
1203
  * // Creating a stream with values from multiple Chunks
@@ -1166,6 +1205,7 @@ export const fromChunkQueue = internal.fromChunkQueue;
1166
1205
  *
1167
1206
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1168
1207
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5, 6 ] }
1208
+ * ```
1169
1209
  *
1170
1210
  * @since 2.0.0
1171
1211
  * @category constructors
@@ -1176,12 +1216,14 @@ export const fromChunks = internal.fromChunks;
1176
1216
  * with the failure value of this effect.
1177
1217
  *
1178
1218
  * @example
1219
+ * ```ts
1179
1220
  * import { Effect, Random, Stream } from "effect"
1180
1221
  *
1181
1222
  * const stream = Stream.fromEffect(Random.nextInt)
1182
1223
  *
1183
1224
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1184
1225
  * // Example Output: { _id: 'Chunk', values: [ 922694024 ] }
1226
+ * ```
1185
1227
  *
1186
1228
  * @since 2.0.0
1187
1229
  * @category constructors
@@ -1214,6 +1256,7 @@ export const fromTPubSub = internal.fromTPubSub;
1214
1256
  * Creates a new `Stream` from an iterable collection of values.
1215
1257
  *
1216
1258
  * @example
1259
+ * ```ts
1217
1260
  * import { Effect, Stream } from "effect"
1218
1261
  *
1219
1262
  * const numbers = [1, 2, 3]
@@ -1222,6 +1265,7 @@ export const fromTPubSub = internal.fromTPubSub;
1222
1265
  *
1223
1266
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1224
1267
  * // { _id: 'Chunk', values: [ 1, 2, 3 ] }
1268
+ * ```
1225
1269
  *
1226
1270
  * @since 2.0.0
1227
1271
  * @category constructors
@@ -1231,6 +1275,7 @@ export const fromIterable = internal.fromIterable;
1231
1275
  * Creates a stream from an effect producing a value of type `Iterable<A>`.
1232
1276
  *
1233
1277
  * @example
1278
+ * ```ts
1234
1279
  * import { Context, Effect, Stream } from "effect"
1235
1280
  *
1236
1281
  * class Database extends Context.Tag("Database")<
@@ -1246,6 +1291,7 @@ export const fromIterable = internal.fromIterable;
1246
1291
  * // Stream.runCollect(stream.pipe(Stream.provideService(Database, { getUsers: Effect.succeed(["user1", "user2"]) })))
1247
1292
  * // ).then(console.log)
1248
1293
  * // { _id: 'Chunk', values: [ 'user1', 'user2' ] }
1294
+ * ```
1249
1295
  *
1250
1296
  * @since 2.0.0
1251
1297
  * @category constructors
@@ -1308,6 +1354,7 @@ export const fromReadableStreamByob = internal.fromReadableStreamByob;
1308
1354
  * schedule, continuing for as long as the schedule continues.
1309
1355
  *
1310
1356
  * @example
1357
+ * ```ts
1311
1358
  * import { Effect, Schedule, Stream } from "effect"
1312
1359
  *
1313
1360
  * // Emits values every 1 second for a total of 5 emissions
@@ -1319,6 +1366,7 @@ export const fromReadableStreamByob = internal.fromReadableStreamByob;
1319
1366
  *
1320
1367
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1321
1368
  * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }
1369
+ * ```
1322
1370
  *
1323
1371
  * @since 2.0.0
1324
1372
  * @category constructors
@@ -1336,6 +1384,7 @@ export const groupAdjacentBy = internal.groupAdjacentBy;
1336
1384
  * More powerful version of `Stream.groupByKey`.
1337
1385
  *
1338
1386
  * @example
1387
+ * ```ts
1339
1388
  * import { Chunk, Effect, GroupBy, Stream } from "effect"
1340
1389
  *
1341
1390
  * const groupByKeyResult = Stream.fromIterable([
@@ -1363,6 +1412,7 @@ export const groupAdjacentBy = internal.groupAdjacentBy;
1363
1412
  * // _id: 'Chunk',
1364
1413
  * // values: [ [ 'M', 1 ], [ 'J', 3 ], [ 'R', 2 ], [ 'P', 2 ] ]
1365
1414
  * // }
1415
+ * ```
1366
1416
  *
1367
1417
  * @since 2.0.0
1368
1418
  * @category grouping
@@ -1410,6 +1460,7 @@ export const groupByKey = _groupBy.groupByKey;
1410
1460
  * Partitions the stream with specified `chunkSize`.
1411
1461
  *
1412
1462
  * @example
1463
+ * ```ts
1413
1464
  * import { Effect, Stream } from "effect"
1414
1465
  *
1415
1466
  * const stream = Stream.range(0, 8).pipe(Stream.grouped(3))
@@ -1424,6 +1475,7 @@ export const groupByKey = _groupBy.groupByKey;
1424
1475
  * // [length]: 3
1425
1476
  * // ]
1426
1477
  * // }
1478
+ * ```
1427
1479
  *
1428
1480
  * @since 2.0.0
1429
1481
  * @category grouping
@@ -1434,6 +1486,7 @@ export const grouped = internal.grouped;
1434
1486
  * `duration` has passed, whichever is satisfied first.
1435
1487
  *
1436
1488
  * @example
1489
+ * ```ts
1437
1490
  * import { Chunk, Effect, Schedule, Stream } from "effect"
1438
1491
  *
1439
1492
  * const stream = Stream.range(0, 9).pipe(
@@ -1469,6 +1522,7 @@ export const grouped = internal.grouped;
1469
1522
  * // ]
1470
1523
  * // }
1471
1524
  * // ]
1525
+ * ```
1472
1526
  *
1473
1527
  * @since 2.0.0
1474
1528
  * @category grouping
@@ -1522,6 +1576,7 @@ export const identity = internal.identityStream;
1522
1576
  * pulled.
1523
1577
  *
1524
1578
  * @example
1579
+ * ```ts
1525
1580
  * import { Effect, Stream } from "effect"
1526
1581
  *
1527
1582
  * const s1 = Stream.make(1, 2, 3)
@@ -1531,6 +1586,7 @@ export const identity = internal.identityStream;
1531
1586
  *
1532
1587
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1533
1588
  * // { _id: 'Chunk', values: [ 1, 4, 2, 5, 3, 6 ] }
1589
+ * ```
1534
1590
  * @since 2.0.0
1535
1591
  * @category utils
1536
1592
  */
@@ -1545,6 +1601,7 @@ export const interleave = internal.interleave;
1545
1601
  * ignored.
1546
1602
  *
1547
1603
  * @example
1604
+ * ```ts
1548
1605
  * import { Effect, Stream } from "effect"
1549
1606
  *
1550
1607
  * const s1 = Stream.make(1, 3, 5, 7, 9)
@@ -1562,6 +1619,7 @@ export const interleave = internal.interleave;
1562
1619
  * // 8, 5, 10, 7, 9
1563
1620
  * // ]
1564
1621
  * // }
1622
+ * ```
1565
1623
  *
1566
1624
  * @since 2.0.0
1567
1625
  * @category utils
@@ -1571,6 +1629,7 @@ export const interleaveWith = internal.interleaveWith;
1571
1629
  * Intersperse stream with provided `element`.
1572
1630
  *
1573
1631
  * @example
1632
+ * ```ts
1574
1633
  * import { Effect, Stream } from "effect"
1575
1634
  *
1576
1635
  * const stream = Stream.make(1, 2, 3, 4, 5).pipe(Stream.intersperse(0))
@@ -1583,6 +1642,7 @@ export const interleaveWith = internal.interleaveWith;
1583
1642
  * // 0, 4, 0, 5
1584
1643
  * // ]
1585
1644
  * // }
1645
+ * ```
1586
1646
  *
1587
1647
  * @since 2.0.0
1588
1648
  * @category utils
@@ -1592,6 +1652,7 @@ export const intersperse = internal.intersperse;
1592
1652
  * Intersperse the specified element, also adding a prefix and a suffix.
1593
1653
  *
1594
1654
  * @example
1655
+ * ```ts
1595
1656
  * import { Effect, Stream } from "effect"
1596
1657
  *
1597
1658
  * const stream = Stream.make(1, 2, 3, 4, 5).pipe(
@@ -1611,6 +1672,7 @@ export const intersperse = internal.intersperse;
1611
1672
  * // ']'
1612
1673
  * // ]
1613
1674
  * // }
1675
+ * ```
1614
1676
  *
1615
1677
  * @since 2.0.0
1616
1678
  * @category utils
@@ -1653,6 +1715,7 @@ export const interruptWhenDeferred = internal.interruptWhenDeferred;
1653
1715
  * f(f(f(a))), ...
1654
1716
  *
1655
1717
  * @example
1718
+ * ```ts
1656
1719
  * import { Effect, Stream } from "effect"
1657
1720
  *
1658
1721
  * // An infinite Stream of numbers starting from 1 and incrementing
@@ -1660,6 +1723,7 @@ export const interruptWhenDeferred = internal.interruptWhenDeferred;
1660
1723
  *
1661
1724
  * // Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(10)))).then(console.log)
1662
1725
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }
1726
+ * ```
1663
1727
  *
1664
1728
  * @since 2.0.0
1665
1729
  * @category constructors
@@ -1669,12 +1733,14 @@ export const iterate = internal.iterate;
1669
1733
  * Creates a stream from an sequence of values.
1670
1734
  *
1671
1735
  * @example
1736
+ * ```ts
1672
1737
  * import { Effect, Stream } from "effect"
1673
1738
  *
1674
1739
  * const stream = Stream.make(1, 2, 3)
1675
1740
  *
1676
1741
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1677
1742
  * // { _id: 'Chunk', values: [ 1, 2, 3 ] }
1743
+ * ```
1678
1744
  *
1679
1745
  * @since 2.0.0
1680
1746
  * @category constructors
@@ -1684,12 +1750,14 @@ export const make = internal.make;
1684
1750
  * Transforms the elements of this stream using the supplied function.
1685
1751
  *
1686
1752
  * @example
1753
+ * ```ts
1687
1754
  * import { Effect, Stream } from "effect"
1688
1755
  *
1689
1756
  * const stream = Stream.make(1, 2, 3).pipe(Stream.map((n) => n + 1))
1690
1757
  *
1691
1758
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1692
1759
  * // { _id: 'Chunk', values: [ 2, 3, 4 ] }
1760
+ * ```
1693
1761
  *
1694
1762
  * @since 2.0.0
1695
1763
  * @category mapping
@@ -1699,6 +1767,7 @@ export const map = internal.map;
1699
1767
  * Statefully maps over the elements of this stream to produce new elements.
1700
1768
  *
1701
1769
  * @example
1770
+ * ```ts
1702
1771
  * import { Effect, Stream } from "effect"
1703
1772
  *
1704
1773
  * const runningTotal = (stream: Stream.Stream<number>): Stream.Stream<number> =>
@@ -1709,6 +1778,7 @@ export const map = internal.map;
1709
1778
  * // console.log
1710
1779
  * // )
1711
1780
  * // { _id: "Chunk", values: [ 0, 1, 3, 6, 10, 15, 21 ] }
1781
+ * ```
1712
1782
  *
1713
1783
  * @since 2.0.0
1714
1784
  * @category mapping
@@ -1749,6 +1819,7 @@ export const mapChunksEffect = internal.mapChunksEffect;
1749
1819
  * output of this stream.
1750
1820
  *
1751
1821
  * @example
1822
+ * ```ts
1752
1823
  * import { Effect, Stream } from "effect"
1753
1824
  *
1754
1825
  * const numbers = Stream.make("1-2-3", "4-5", "6").pipe(
@@ -1758,6 +1829,7 @@ export const mapChunksEffect = internal.mapChunksEffect;
1758
1829
  *
1759
1830
  * // Effect.runPromise(Stream.runCollect(numbers)).then(console.log)
1760
1831
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5, 6 ] }
1832
+ * ```
1761
1833
  *
1762
1834
  * @since 2.0.0
1763
1835
  * @category mapping
@@ -1791,6 +1863,7 @@ export const mapConcatEffect = internal.mapConcatEffect;
1791
1863
  * Maps over elements of the stream with the specified effectful function.
1792
1864
  *
1793
1865
  * @example
1866
+ * ```ts
1794
1867
  * import { Effect, Random, Stream } from "effect"
1795
1868
  *
1796
1869
  * const stream = Stream.make(10, 20, 30).pipe(
@@ -1799,6 +1872,7 @@ export const mapConcatEffect = internal.mapConcatEffect;
1799
1872
  *
1800
1873
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1801
1874
  * // Example Output: { _id: 'Chunk', values: [ 7, 19, 8 ] }
1875
+ * ```
1802
1876
  *
1803
1877
  * @since 2.0.0
1804
1878
  * @category mapping
@@ -1825,6 +1899,7 @@ export const mapErrorCause = internal.mapErrorCause;
1825
1899
  * no termination strategy is specified.
1826
1900
  *
1827
1901
  * @example
1902
+ * ```ts
1828
1903
  * import { Effect, Schedule, Stream } from "effect"
1829
1904
  *
1830
1905
  * const s1 = Stream.make(1, 2, 3).pipe(
@@ -1838,6 +1913,7 @@ export const mapErrorCause = internal.mapErrorCause;
1838
1913
  *
1839
1914
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1840
1915
  * // { _id: 'Chunk', values: [ 1, 4, 2, 3, 5, 6 ] }
1916
+ * ```
1841
1917
  *
1842
1918
  * @since 2.0.0
1843
1919
  * @category utils
@@ -1858,12 +1934,14 @@ export const mergeAll = internal.mergeAll;
1858
1934
  * @since 3.8.5
1859
1935
  *
1860
1936
  * @example
1937
+ * ```ts
1861
1938
  * import { Stream } from "effect"
1862
1939
  * // Stream.Stream<{ _tag: "a"; value: number; } | { _tag: "b"; value: string; }>
1863
1940
  * const res = Stream.mergeWithTag({
1864
1941
  * a: Stream.make(0),
1865
1942
  * b: Stream.make("")
1866
1943
  * }, { concurrency: "unbounded" })
1944
+ * ```
1867
1945
  */
1868
1946
  export const mergeWithTag = internal.mergeWithTag;
1869
1947
  /**
@@ -1874,6 +1952,7 @@ export const mergeWithTag = internal.mergeWithTag;
1874
1952
  * no termination strategy is specified.
1875
1953
  *
1876
1954
  * @example
1955
+ * ```ts
1877
1956
  * import { Effect, Schedule, Stream } from "effect"
1878
1957
  *
1879
1958
  * const s1 = Stream.make("1", "2", "3").pipe(
@@ -1890,6 +1969,7 @@ export const mergeWithTag = internal.mergeWithTag;
1890
1969
  *
1891
1970
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
1892
1971
  * // { _id: 'Chunk', values: [ 1, 4, 2, 3, 5, 6 ] }
1972
+ * ```
1893
1973
  *
1894
1974
  * @since 2.0.0
1895
1975
  * @category utils
@@ -1938,6 +2018,7 @@ export const never = internal.never;
1938
2018
  * Adds an effect to be executed at the end of the stream.
1939
2019
  *
1940
2020
  * @example
2021
+ * ```ts
1941
2022
  * import { Console, Effect, Stream } from "effect"
1942
2023
  *
1943
2024
  * const stream = Stream.make(1, 2, 3).pipe(
@@ -1952,6 +2033,7 @@ export const never = internal.never;
1952
2033
  * // after mapping: 6
1953
2034
  * // Stream ended
1954
2035
  * // { _id: 'Chunk', values: [ 2, 4, 6 ] }
2036
+ * ```
1955
2037
  *
1956
2038
  * @since 3.6.0
1957
2039
  * @category sequencing
@@ -1979,6 +2061,7 @@ export const onDone = internal.onDone;
1979
2061
  * Adds an effect to be executed at the start of the stream.
1980
2062
  *
1981
2063
  * @example
2064
+ * ```ts
1982
2065
  * import { Console, Effect, Stream } from "effect"
1983
2066
  *
1984
2067
  * const stream = Stream.make(1, 2, 3).pipe(
@@ -1993,6 +2076,7 @@ export const onDone = internal.onDone;
1993
2076
  * // after mapping: 4
1994
2077
  * // after mapping: 6
1995
2078
  * // { _id: 'Chunk', values: [ 2, 4, 6 ] }
2079
+ * ```
1996
2080
  *
1997
2081
  * @since 3.6.0
1998
2082
  * @category sequencing
@@ -2075,6 +2159,7 @@ export const orElseSucceed = internal.orElseSucceed;
2075
2159
  * APIs, hence the name.
2076
2160
  *
2077
2161
  * @example
2162
+ * ```ts
2078
2163
  * import { Effect, Option, Stream } from "effect"
2079
2164
  *
2080
2165
  * const stream = Stream.paginate(0, (n) => [
@@ -2084,6 +2169,7 @@ export const orElseSucceed = internal.orElseSucceed;
2084
2169
  *
2085
2170
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2086
2171
  * // { _id: 'Chunk', values: [ 0, 1, 2, 3 ] }
2172
+ * ```
2087
2173
  *
2088
2174
  * @since 2.0.0
2089
2175
  * @category constructors
@@ -2118,11 +2204,12 @@ export const paginateChunkEffect = internal.paginateChunkEffect;
2118
2204
  export const paginateEffect = internal.paginateEffect;
2119
2205
  /**
2120
2206
  * Partition a stream using a predicate. The first stream will contain all
2121
- * element evaluated to true and the second one will contain all element
2122
- * evaluated to false. The faster stream may advance by up to buffer elements
2207
+ * element evaluated to false and the second one will contain all element
2208
+ * evaluated to true. The faster stream may advance by up to buffer elements
2123
2209
  * further than the slower one.
2124
2210
  *
2125
2211
  * @example
2212
+ * ```ts
2126
2213
  * import { Effect, Stream } from "effect"
2127
2214
  *
2128
2215
  * const partition = Stream.range(1, 10).pipe(
@@ -2131,15 +2218,16 @@ export const paginateEffect = internal.paginateEffect;
2131
2218
  *
2132
2219
  * const program = Effect.scoped(
2133
2220
  * Effect.gen(function*() {
2134
- * const [evens, odds] = yield* partition
2135
- * console.log(yield* Stream.runCollect(evens))
2221
+ * const [odds, evens] = yield* partition
2136
2222
  * console.log(yield* Stream.runCollect(odds))
2223
+ * console.log(yield* Stream.runCollect(evens))
2137
2224
  * })
2138
2225
  * )
2139
2226
  *
2140
2227
  * // Effect.runPromise(program)
2141
- * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
2142
2228
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
2229
+ * // { _id: 'Chunk', values: [ 2, 4, 6, 8, 10 ] }
2230
+ * ```
2143
2231
  *
2144
2232
  * @since 2.0.0
2145
2233
  * @category utils
@@ -2150,6 +2238,7 @@ export const partition = internal.partition;
2150
2238
  * up to buffer elements further than the slower one.
2151
2239
  *
2152
2240
  * @example
2241
+ * ```ts
2153
2242
  * import { Effect, Either, Stream } from "effect"
2154
2243
  *
2155
2244
  * const partition = Stream.range(1, 9).pipe(
@@ -2170,6 +2259,7 @@ export const partition = internal.partition;
2170
2259
  * // Effect.runPromise(program)
2171
2260
  * // { _id: 'Chunk', values: [ 2, 4, 6, 8 ] }
2172
2261
  * // { _id: 'Chunk', values: [ 1, 3, 5, 7, 9 ] }
2262
+ * ```
2173
2263
  *
2174
2264
  * @since 2.0.0
2175
2265
  * @category utils
@@ -2278,6 +2368,7 @@ export const provideSomeLayer = internal.provideSomeLayer;
2278
2368
  * Any upstream failures will cause the returned stream to fail.
2279
2369
  *
2280
2370
  * @example
2371
+ * ```ts
2281
2372
  * import { Stream, Schedule, Console, Effect } from "effect"
2282
2373
  *
2283
2374
  * const stream = Stream.fromSchedule(Schedule.spaced('2 millis')).pipe(
@@ -2294,6 +2385,7 @@ export const provideSomeLayer = internal.provideSomeLayer;
2294
2385
  * // 3
2295
2386
  * // 4
2296
2387
  * // 5
2388
+ * ```
2297
2389
  * @since 3.7.0
2298
2390
  * @category racing
2299
2391
  */
@@ -2305,6 +2397,7 @@ export const race = internal.race;
2305
2397
  * Any upstream failures will cause the returned stream to fail.
2306
2398
  *
2307
2399
  * @example
2400
+ * ```ts
2308
2401
  * import { Stream, Schedule, Console, Effect } from "effect"
2309
2402
  *
2310
2403
  * const stream = Stream.raceAll(
@@ -2321,6 +2414,7 @@ export const race = internal.race;
2321
2414
  * // 3
2322
2415
  * // 4
2323
2416
  * // 5
2417
+ * ```
2324
2418
  * @since 3.5.0
2325
2419
  * @category racing
2326
2420
  */
@@ -2329,6 +2423,7 @@ export const raceAll = internal.raceAll;
2329
2423
  * Constructs a stream from a range of integers, including both endpoints.
2330
2424
  *
2331
2425
  * @example
2426
+ * ```ts
2332
2427
  * import { Effect, Stream } from "effect"
2333
2428
  *
2334
2429
  * // A Stream with a range of numbers from 1 to 5
@@ -2336,6 +2431,7 @@ export const raceAll = internal.raceAll;
2336
2431
  *
2337
2432
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2338
2433
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5 ] }
2434
+ * ```
2339
2435
  *
2340
2436
  * @since 2.0.0
2341
2437
  * @category constructors
@@ -2369,12 +2465,14 @@ export const refineOrDieWith = internal.refineOrDieWith;
2369
2465
  * execute normally, and then repeat again according to the provided schedule.
2370
2466
  *
2371
2467
  * @example
2468
+ * ```ts
2372
2469
  * import { Effect, Schedule, Stream } from "effect"
2373
2470
  *
2374
2471
  * const stream = Stream.repeat(Stream.succeed(1), Schedule.forever)
2375
2472
  *
2376
2473
  * // Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)
2377
2474
  * // { _id: 'Chunk', values: [ 1, 1, 1, 1, 1 ] }
2475
+ * ```
2378
2476
  *
2379
2477
  * @since 2.0.0
2380
2478
  * @category utils
@@ -2385,12 +2483,14 @@ export const repeat = internal.repeat;
2385
2483
  * forever.
2386
2484
  *
2387
2485
  * @example
2486
+ * ```ts
2388
2487
  * import { Effect, Random, Stream } from "effect"
2389
2488
  *
2390
2489
  * const stream = Stream.repeatEffect(Random.nextInt)
2391
2490
  *
2392
2491
  * // Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)
2393
2492
  * // Example Output: { _id: 'Chunk', values: [ 3891571149, 4239494205, 2352981603, 2339111046, 1488052210 ] }
2493
+ * ```
2394
2494
  *
2395
2495
  * @since 2.0.0
2396
2496
  * @category constructors
@@ -2417,6 +2517,7 @@ export const repeatEffectChunkOption = internal.repeatEffectChunkOption;
2417
2517
  * with `None`.
2418
2518
  *
2419
2519
  * @example
2520
+ * ```ts
2420
2521
  * // In this example, we're draining an Iterator to create a stream from it
2421
2522
  * import { Stream, Effect, Option } from "effect"
2422
2523
  *
@@ -2431,6 +2532,7 @@ export const repeatEffectChunkOption = internal.repeatEffectChunkOption;
2431
2532
  * })
2432
2533
  * )
2433
2534
  * )
2535
+ * ```
2434
2536
  *
2435
2537
  * @since 2.0.0
2436
2538
  * @category constructors
@@ -2484,12 +2586,14 @@ export const repeatElementsWith = internal.repeatElementsWith;
2484
2586
  * Repeats the provided value infinitely.
2485
2587
  *
2486
2588
  * @example
2589
+ * ```ts
2487
2590
  * import { Effect, Stream } from "effect"
2488
2591
  *
2489
2592
  * const stream = Stream.repeatValue(0)
2490
2593
  *
2491
2594
  * // Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)
2492
2595
  * // { _id: 'Chunk', values: [ 0, 0, 0, 0, 0 ] }
2596
+ * ```
2493
2597
  *
2494
2598
  * @since 2.0.0
2495
2599
  * @category constructors
@@ -2733,12 +2837,14 @@ export const runSum = internal.runSum;
2733
2837
  * intermediate results of type `S` given an initial S.
2734
2838
  *
2735
2839
  * @example
2840
+ * ```ts
2736
2841
  * import { Effect, Stream } from "effect"
2737
2842
  *
2738
2843
  * const stream = Stream.range(1, 6).pipe(Stream.scan(0, (a, b) => a + b))
2739
2844
  *
2740
2845
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2741
2846
  * // { _id: 'Chunk', values: [ 0, 1, 3, 6, 10, 15, 21 ] }
2847
+ * ```
2742
2848
  *
2743
2849
  * @since 2.0.0
2744
2850
  * @category utils
@@ -2792,6 +2898,7 @@ export const scheduleWith = internal.scheduleWith;
2792
2898
  * Creates a single-valued stream from a scoped resource.
2793
2899
  *
2794
2900
  * @example
2901
+ * ```ts
2795
2902
  * import { Console, Effect, Stream } from "effect"
2796
2903
  *
2797
2904
  * // Creating a single-valued stream from a scoped resource
@@ -2808,11 +2915,21 @@ export const scheduleWith = internal.scheduleWith;
2808
2915
  * // use
2809
2916
  * // release
2810
2917
  * // { _id: 'Chunk', values: [ undefined ] }
2918
+ * ```
2811
2919
  *
2812
2920
  * @since 2.0.0
2813
2921
  * @category constructors
2814
2922
  */
2815
2923
  export const scoped = internal.scoped;
2924
+ /**
2925
+ * Use a function that receives a scope and returns an effect to emit an output
2926
+ * element. The output element will be the result of the returned effect, if
2927
+ * successful.
2928
+ *
2929
+ * @since 3.11.0
2930
+ * @category constructors
2931
+ */
2932
+ export const scopedWith = internal.scopedWith;
2816
2933
  /**
2817
2934
  * Emits a sliding window of `n` elements.
2818
2935
  *
@@ -2898,6 +3015,7 @@ export const splitLines = internal.splitLines;
2898
3015
  * Creates a single-valued pure stream.
2899
3016
  *
2900
3017
  * @example
3018
+ * ```ts
2901
3019
  * import { Effect, Stream } from "effect"
2902
3020
  *
2903
3021
  * // A Stream with a single number
@@ -2905,6 +3023,7 @@ export const splitLines = internal.splitLines;
2905
3023
  *
2906
3024
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2907
3025
  * // { _id: 'Chunk', values: [ 3 ] }
3026
+ * ```
2908
3027
  *
2909
3028
  * @since 2.0.0
2910
3029
  * @category constructors
@@ -2928,12 +3047,14 @@ export const suspend = internal.suspend;
2928
3047
  * Takes the specified number of elements from this stream.
2929
3048
  *
2930
3049
  * @example
3050
+ * ```ts
2931
3051
  * import { Effect, Stream } from "effect"
2932
3052
  *
2933
3053
  * const stream = Stream.take(Stream.iterate(0, (n) => n + 1), 5)
2934
3054
  *
2935
3055
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2936
3056
  * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }
3057
+ * ```
2937
3058
  *
2938
3059
  * @since 2.0.0
2939
3060
  * @category utils
@@ -2943,12 +3064,14 @@ export const take = internal.take;
2943
3064
  * Takes the last specified number of elements from this stream.
2944
3065
  *
2945
3066
  * @example
3067
+ * ```ts
2946
3068
  * import { Effect, Stream } from "effect"
2947
3069
  *
2948
3070
  * const stream = Stream.takeRight(Stream.make(1, 2, 3, 4, 5, 6), 3)
2949
3071
  *
2950
3072
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2951
3073
  * // { _id: 'Chunk', values: [ 4, 5, 6 ] }
3074
+ * ```
2952
3075
  *
2953
3076
  * @since 2.0.0
2954
3077
  * @category utils
@@ -2959,12 +3082,14 @@ export const takeRight = internal.takeRight;
2959
3082
  * `true`.
2960
3083
  *
2961
3084
  * @example
3085
+ * ```ts
2962
3086
  * import { Effect, Stream } from "effect"
2963
3087
  *
2964
3088
  * const stream = Stream.takeUntil(Stream.iterate(0, (n) => n + 1), (n) => n === 4)
2965
3089
  *
2966
3090
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2967
3091
  * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }
3092
+ * ```
2968
3093
  *
2969
3094
  * @since 2.0.0
2970
3095
  * @category utils
@@ -2983,12 +3108,14 @@ export const takeUntilEffect = internal.takeUntilEffect;
2983
3108
  * evaluates to `true`.
2984
3109
  *
2985
3110
  * @example
3111
+ * ```ts
2986
3112
  * import { Effect, Stream } from "effect"
2987
3113
  *
2988
3114
  * const stream = Stream.takeWhile(Stream.iterate(0, (n) => n + 1), (n) => n < 5)
2989
3115
  *
2990
3116
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
2991
3117
  * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4 ] }
3118
+ * ```
2992
3119
  *
2993
3120
  * @since 2.0.0
2994
3121
  * @category utils
@@ -2998,6 +3125,7 @@ export const takeWhile = internal.takeWhile;
2998
3125
  * Adds an effect to consumption of every element of the stream.
2999
3126
  *
3000
3127
  * @example
3128
+ * ```ts
3001
3129
  * import { Console, Effect, Stream } from "effect"
3002
3130
  *
3003
3131
  * const stream = Stream.make(1, 2, 3).pipe(
@@ -3014,6 +3142,7 @@ export const takeWhile = internal.takeWhile;
3014
3142
  * // before mapping: 3
3015
3143
  * // after mapping: 6
3016
3144
  * // { _id: 'Chunk', values: [ 2, 4, 6 ] }
3145
+ * ```
3017
3146
  *
3018
3147
  * @since 2.0.0
3019
3148
  * @category sequencing
@@ -3064,6 +3193,7 @@ export const tapSink = internal.tapSink;
3064
3193
  * Defaults to the "shape" strategy.
3065
3194
  *
3066
3195
  * @example
3196
+ * ```ts
3067
3197
  * import { Chunk, Effect, Schedule, Stream } from "effect"
3068
3198
  *
3069
3199
  * let last = Date.now()
@@ -3099,6 +3229,7 @@ export const tapSink = internal.tapSink;
3099
3229
  * // Received 5 after 52ms
3100
3230
  * // > Emitted 5 after 49ms
3101
3231
  * // { _id: 'Chunk', values: [ 0, 1, 2, 3, 4, 5 ] }
3232
+ * ```
3102
3233
  *
3103
3234
  * @since 2.0.0
3104
3235
  * @category utils
@@ -3125,6 +3256,7 @@ export const throttleEffect = internal.throttleEffect;
3125
3256
  * A stream that emits void values spaced by the specified duration.
3126
3257
  *
3127
3258
  * @example
3259
+ * ```ts
3128
3260
  * import { Effect, Stream } from "effect"
3129
3261
  *
3130
3262
  * let last = Date.now()
@@ -3144,6 +3276,7 @@ export const throttleEffect = internal.throttleEffect;
3144
3276
  * // tick after 1002ms
3145
3277
  * // tick after 1002ms
3146
3278
  * // { _id: 'Chunk', values: [ undefined, undefined, undefined, undefined, undefined ] }
3279
+ * ```
3147
3280
  *
3148
3281
  * @since 2.0.0
3149
3282
  * @category constructors
@@ -3195,6 +3328,7 @@ export const toPubSub = internal.toPubSub;
3195
3328
  * the stream's output.
3196
3329
  *
3197
3330
  * @example
3331
+ * ```ts
3198
3332
  * import { Effect, Stream } from "effect"
3199
3333
  *
3200
3334
  * // Simulate a chunked stream
@@ -3219,6 +3353,7 @@ export const toPubSub = internal.toPubSub;
3219
3353
  * // "_id": "Option",
3220
3354
  * // "_tag": "None"
3221
3355
  * // }
3356
+ * ```
3222
3357
  *
3223
3358
  * @since 2.0.0
3224
3359
  * @category destructors
@@ -3282,12 +3417,14 @@ export const transduce = internal.transduce;
3282
3417
  * Creates a stream by peeling off the "layers" of a value of type `S`.
3283
3418
  *
3284
3419
  * @example
3420
+ * ```ts
3285
3421
  * import { Effect, Option, Stream } from "effect"
3286
3422
  *
3287
3423
  * const stream = Stream.unfold(1, (n) => Option.some([n, n + 1]))
3288
3424
  *
3289
3425
  * // Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)
3290
3426
  * // { _id: 'Chunk', values: [ 1, 2, 3, 4, 5 ] }
3427
+ * ```
3291
3428
  *
3292
3429
  * @since 2.0.0
3293
3430
  * @category constructors
@@ -3313,6 +3450,7 @@ export const unfoldChunkEffect = internal.unfoldChunkEffect;
3313
3450
  * `S`.
3314
3451
  *
3315
3452
  * @example
3453
+ * ```ts
3316
3454
  * import { Effect, Option, Random, Stream } from "effect"
3317
3455
  *
3318
3456
  * const stream = Stream.unfoldEffect(1, (n) =>
@@ -3322,6 +3460,7 @@ export const unfoldChunkEffect = internal.unfoldChunkEffect;
3322
3460
  *
3323
3461
  * // Effect.runPromise(Stream.runCollect(stream.pipe(Stream.take(5)))).then(console.log)
3324
3462
  * // { _id: 'Chunk', values: [ 1, -1, -1, -1, -1 ] }
3463
+ * ```
3325
3464
  *
3326
3465
  * @since 2.0.0
3327
3466
  * @category constructors
@@ -3333,6 +3472,7 @@ export {
3333
3472
  * A stream that contains a single `void` value.
3334
3473
  *
3335
3474
  * @example
3475
+ * ```ts
3336
3476
  * import { Effect, Stream } from "effect"
3337
3477
  *
3338
3478
  * const stream = Stream.void
@@ -3340,6 +3480,7 @@ export {
3340
3480
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
3341
3481
  * // { _id: 'Chunk', values: [ undefined ] }
3342
3482
  *
3483
+ * ```
3343
3484
  * @since 2.0.0
3344
3485
  * @category constructors
3345
3486
  */
@@ -3358,6 +3499,15 @@ export const unwrap = internal.unwrap;
3358
3499
  * @category constructors
3359
3500
  */
3360
3501
  export const unwrapScoped = internal.unwrapScoped;
3502
+ /**
3503
+ * Creates a stream produced from a function which receives a `Scope` and
3504
+ * returns an `Effect`. The resulting stream will emit a single element, which
3505
+ * will be the result of the returned effect, if successful.
3506
+ *
3507
+ * @since 3.11.0
3508
+ * @category constructors
3509
+ */
3510
+ export const unwrapScopedWith = internal.unwrapScopedWith;
3361
3511
  /**
3362
3512
  * Updates the specified service within the context of the `Stream`.
3363
3513
  *
@@ -3411,6 +3561,7 @@ export const withSpan = internal.withSpan;
3411
3561
  * The new stream will end when one of the sides ends.
3412
3562
  *
3413
3563
  * @example
3564
+ * ```ts
3414
3565
  * import { Effect, Stream } from "effect"
3415
3566
  *
3416
3567
  * // We create two streams and zip them together.
@@ -3421,6 +3572,7 @@ export const withSpan = internal.withSpan;
3421
3572
  *
3422
3573
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
3423
3574
  * // { _id: 'Chunk', values: [ [ 1, 'a' ], [ 2, 'b' ], [ 3, 'c' ] ] }
3575
+ * ```
3424
3576
  *
3425
3577
  * @since 2.0.0
3426
3578
  * @category zipping
@@ -3444,6 +3596,7 @@ export const zipFlatten = internal.zipFlatten;
3444
3596
  * have different lengths and one of the streams has ended before the other.
3445
3597
  *
3446
3598
  * @example
3599
+ * ```ts
3447
3600
  * import { Effect, Stream } from "effect"
3448
3601
  *
3449
3602
  * const stream = Stream.zipAll(Stream.make(1, 2, 3, 4, 5, 6), {
@@ -3454,6 +3607,7 @@ export const zipFlatten = internal.zipFlatten;
3454
3607
  *
3455
3608
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
3456
3609
  * // { _id: "Chunk", values: [ [ 1, "a" ], [ 2, "b" ], [ 3, "c" ], [ 4, "x" ], [ 5, "x" ], [ 6, "x" ] ] }
3610
+ * ```
3457
3611
  *
3458
3612
  * @since 2.0.0
3459
3613
  * @category zipping
@@ -3547,6 +3701,7 @@ export const zipAllSortedByKeyWith = internal.zipAllSortedByKeyWith;
3547
3701
  * lengths and one of the streams has ended before the other.
3548
3702
  *
3549
3703
  * @example
3704
+ * ```ts
3550
3705
  * import { Effect, Stream } from "effect"
3551
3706
  *
3552
3707
  * const stream = Stream.zipAllWith(Stream.make(1, 2, 3, 4, 5, 6), {
@@ -3558,6 +3713,7 @@ export const zipAllSortedByKeyWith = internal.zipAllSortedByKeyWith;
3558
3713
  *
3559
3714
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
3560
3715
  * // { _id: "Chunk", values: [ [ 0, "a" ], [ 1, "b" ], [ 2, "c" ], [ 4, "x" ], [ 5, "x" ], [ 6, "x" ] ] }
3716
+ * ```
3561
3717
  *
3562
3718
  * @since 2.0.0
3563
3719
  * @category zipping
@@ -3573,6 +3729,7 @@ export const zipAllWith = internal.zipAllWith;
3573
3729
  * used for zipping.
3574
3730
  *
3575
3731
  * @example
3732
+ * ```ts
3576
3733
  * import { Effect, Schedule, Stream } from "effect"
3577
3734
  *
3578
3735
  * const s1 = Stream.make(1, 2, 3).pipe(
@@ -3587,6 +3744,7 @@ export const zipAllWith = internal.zipAllWith;
3587
3744
  *
3588
3745
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
3589
3746
  * // { _id: "Chunk", values: [ [ 1, "a" ], [ 1, "b" ], [ 2, "b" ], [ 2, "c" ], [ 2, "d" ], [ 3, "d" ] ] }
3747
+ * ```
3590
3748
  *
3591
3749
  * @since 2.0.0
3592
3750
  * @category zipping
@@ -3601,6 +3759,7 @@ export const zipLatest = internal.zipLatest;
3601
3759
  * used for zipping.
3602
3760
  *
3603
3761
  * @example
3762
+ * ```ts
3604
3763
  * import { Stream, Schedule, Console, Effect } from "effect"
3605
3764
  *
3606
3765
  * const stream = Stream.zipLatestAll(
@@ -3618,6 +3777,7 @@ export const zipLatest = internal.zipLatest;
3618
3777
  * // [ 3, 1, 0 ]
3619
3778
  * // [ 3, 1, 1 ]
3620
3779
  * // .....
3780
+ * ```
3621
3781
  *
3622
3782
  * @since 3.3.0
3623
3783
  * @category zipping
@@ -3663,6 +3823,7 @@ export const zipRight = internal.zipRight;
3663
3823
  * The new stream will end when one of the sides ends.
3664
3824
  *
3665
3825
  * @example
3826
+ * ```ts
3666
3827
  * import { Effect, Stream } from "effect"
3667
3828
  *
3668
3829
  * // We create two streams and zip them with custom logic.
@@ -3674,6 +3835,7 @@ export const zipRight = internal.zipRight;
3674
3835
  *
3675
3836
  * // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
3676
3837
  * // { _id: 'Chunk', values: [ [ 0, 'a' ], [ 1, 'b' ], [ 2, 'c' ] ] }
3838
+ * ```
3677
3839
  *
3678
3840
  * @since 2.0.0
3679
3841
  * @category zipping
@@ -3693,6 +3855,7 @@ export const zipWithChunks = internal.zipWithChunks;
3693
3855
  * Zips each element with the next element if present.
3694
3856
  *
3695
3857
  * @example
3858
+ * ```ts
3696
3859
  * import { Chunk, Effect, Stream } from "effect"
3697
3860
  *
3698
3861
  * const stream = Stream.zipWithNext(Stream.make(1, 2, 3, 4))
@@ -3704,6 +3867,7 @@ export const zipWithChunks = internal.zipWithChunks;
3704
3867
  * // [ 3, { _id: 'Option', _tag: 'Some', value: 4 } ],
3705
3868
  * // [ 4, { _id: 'Option', _tag: 'None' } ]
3706
3869
  * // ]
3870
+ * ```
3707
3871
  *
3708
3872
  * @since 2.0.0
3709
3873
  * @category zipping
@@ -3714,6 +3878,7 @@ export const zipWithNext = internal.zipWithNext;
3714
3878
  * `None`.
3715
3879
  *
3716
3880
  * @example
3881
+ * ```ts
3717
3882
  * import { Chunk, Effect, Stream } from "effect"
3718
3883
  *
3719
3884
  * const stream = Stream.zipWithPrevious(Stream.make(1, 2, 3, 4))
@@ -3725,6 +3890,7 @@ export const zipWithNext = internal.zipWithNext;
3725
3890
  * // [ { _id: 'Option', _tag: 'Some', value: 2 }, 3 ],
3726
3891
  * // [ { _id: 'Option', _tag: 'Some', value: 3 }, 4 ]
3727
3892
  * // ]
3893
+ * ```
3728
3894
  *
3729
3895
  * @since 2.0.0
3730
3896
  * @category zipping
@@ -3734,6 +3900,7 @@ export const zipWithPrevious = internal.zipWithPrevious;
3734
3900
  * Zips each element with both the previous and next element.
3735
3901
  *
3736
3902
  * @example
3903
+ * ```ts
3737
3904
  * import { Chunk, Effect, Stream } from "effect"
3738
3905
  *
3739
3906
  * const stream = Stream.zipWithPreviousAndNext(Stream.make(1, 2, 3, 4))
@@ -3761,6 +3928,7 @@ export const zipWithPrevious = internal.zipWithPrevious;
3761
3928
  * // { _id: 'Option', _tag: 'None' }
3762
3929
  * // ]
3763
3930
  * // ]
3931
+ * ```
3764
3932
  *
3765
3933
  * @since 2.0.0
3766
3934
  * @category zipping
@@ -3770,6 +3938,7 @@ export const zipWithPreviousAndNext = internal.zipWithPreviousAndNext;
3770
3938
  * Zips this stream together with the index of elements.
3771
3939
  *
3772
3940
  * @example
3941
+ * ```ts
3773
3942
  * import { Effect, Stream } from "effect"
3774
3943
  *
3775
3944
  * const stream = Stream.make("Mary", "James", "Robert", "Patricia")
@@ -3781,6 +3950,7 @@ export const zipWithPreviousAndNext = internal.zipWithPreviousAndNext;
3781
3950
  * // _id: 'Chunk',
3782
3951
  * // values: [ [ 'Mary', 0 ], [ 'James', 1 ], [ 'Robert', 2 ], [ 'Patricia', 3 ] ]
3783
3952
  * // }
3953
+ * ```
3784
3954
  *
3785
3955
  * @since 2.0.0
3786
3956
  * @category zipping
@@ -3805,6 +3975,7 @@ export const zipWithIndex = internal.zipWithIndex;
3805
3975
  * @see {@link let_ let}
3806
3976
  *
3807
3977
  * @example
3978
+ * ```ts
3808
3979
  * import { Chunk, Effect, pipe, Stream } from "effect"
3809
3980
  *
3810
3981
  * const result = pipe(
@@ -3814,6 +3985,7 @@ export const zipWithIndex = internal.zipWithIndex;
3814
3985
  * Stream.let("sum", ({ x, y }) => x + y)
3815
3986
  * )
3816
3987
  * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
3988
+ * ```
3817
3989
  *
3818
3990
  * @category do notation
3819
3991
  * @since 2.0.0
@@ -3835,6 +4007,7 @@ export const Do = internal.Do;
3835
4007
  * @see {@link let_ let}
3836
4008
  *
3837
4009
  * @example
4010
+ * ```ts
3838
4011
  * import { Chunk, Effect, pipe, Stream } from "effect"
3839
4012
  *
3840
4013
  * const result = pipe(
@@ -3844,6 +4017,7 @@ export const Do = internal.Do;
3844
4017
  * Stream.let("sum", ({ x, y }) => x + y)
3845
4018
  * )
3846
4019
  * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
4020
+ * ```
3847
4021
  *
3848
4022
  * @category do notation
3849
4023
  * @since 2.0.0
@@ -3877,6 +4051,7 @@ export const bindEffect = _groupBy.bindEffect;
3877
4051
  * @see {@link let_ let}
3878
4052
  *
3879
4053
  * @example
4054
+ * ```ts
3880
4055
  * import { Chunk, Effect, pipe, Stream } from "effect"
3881
4056
  *
3882
4057
  * const result = pipe(
@@ -3886,6 +4061,7 @@ export const bindEffect = _groupBy.bindEffect;
3886
4061
  * Stream.let("sum", ({ x, y }) => x + y)
3887
4062
  * )
3888
4063
  * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
4064
+ * ```
3889
4065
  *
3890
4066
  * @category do notation
3891
4067
  * @since 2.0.0
@@ -3909,6 +4085,7 @@ export {
3909
4085
  * @see {@link bindEffect}
3910
4086
  *
3911
4087
  * @example
4088
+ * ```ts
3912
4089
  * import { Chunk, Effect, pipe, Stream } from "effect"
3913
4090
  *
3914
4091
  * const result = pipe(
@@ -3919,6 +4096,7 @@ export {
3919
4096
  * )
3920
4097
  * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
3921
4098
  *
4099
+ * ```
3922
4100
  * @category do notation
3923
4101
  * @since 2.0.0
3924
4102
  */