@fncts/io 0.0.48 → 0.0.49

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 (675) hide show
  1. package/Cached/api.d.ts +1 -1
  2. package/Channel/api.d.ts +80 -80
  3. package/Channel/core-api.d.ts +26 -26
  4. package/Console/definition.d.ts +1 -0
  5. package/CountdownLatch.d.ts +1 -0
  6. package/Fiber/FiberMessage.d.ts +6 -28
  7. package/Fiber/FiberRuntime.d.ts +108 -77
  8. package/Fiber/api/interruptAs.d.ts +2 -2
  9. package/Fiber/definition.d.ts +2 -0
  10. package/FiberScope/definition.d.ts +3 -0
  11. package/FiberSet.d.ts +2 -1
  12. package/Future/State.d.ts +59 -0
  13. package/Future/api.d.ts +8 -3
  14. package/Future/constructors.d.ts +1 -1
  15. package/Future/definition.d.ts +1 -17
  16. package/Future.d.ts +1 -0
  17. package/Hub/api.d.ts +15 -15
  18. package/IO/api/array.d.ts +22 -0
  19. package/IO/api/awaitAllChildren.d.ts +6 -0
  20. package/IO/api/cachedInvalidate.d.ts +15 -0
  21. package/IO/api/forkDaemon.d.ts +1 -1
  22. package/IO/api/onTermination.d.ts +1 -2
  23. package/IO/api/transplant.d.ts +11 -1
  24. package/IO/api.d.ts +247 -225
  25. package/IO/definition.d.ts +12 -25
  26. package/IO.d.ts +3 -1
  27. package/Random/definition.d.ts +1 -0
  28. package/Ref/Synchronized/api.d.ts +1 -1
  29. package/Semaphore/Reservation.d.ts +15 -0
  30. package/Semaphore/constructors.d.ts +13 -0
  31. package/Semaphore/definition.d.ts +29 -0
  32. package/Semaphore.d.ts +3 -40
  33. package/Stream/api.d.ts +164 -164
  34. package/_cjs/Cached/api.cjs +1 -2
  35. package/_cjs/Cached/api.cjs.map +1 -1
  36. package/_cjs/Cached/internal.cjs +1 -2
  37. package/_cjs/Cached/internal.cjs.map +1 -1
  38. package/_cjs/Channel/api/interruptWhen.cjs +1 -2
  39. package/_cjs/Channel/api/interruptWhen.cjs.map +1 -1
  40. package/_cjs/Channel/api/mapOutConcurrentIO.cjs +2 -3
  41. package/_cjs/Channel/api/mapOutConcurrentIO.cjs.map +1 -1
  42. package/_cjs/Channel/api/mergeAll.cjs +1 -2
  43. package/_cjs/Channel/api/mergeAll.cjs.map +1 -1
  44. package/_cjs/Channel/api/mergeAllUnboundedWith.cjs +1 -2
  45. package/_cjs/Channel/api/mergeAllUnboundedWith.cjs.map +1 -1
  46. package/_cjs/Channel/api/mergeAllWith.cjs +2 -3
  47. package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
  48. package/_cjs/Channel/api/mergeMap.cjs +1 -2
  49. package/_cjs/Channel/api/mergeMap.cjs.map +1 -1
  50. package/_cjs/Channel/api/mergeWith.cjs +1 -2
  51. package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
  52. package/_cjs/Channel/api/run.cjs +1 -2
  53. package/_cjs/Channel/api/run.cjs.map +1 -1
  54. package/_cjs/Channel/api/runCollect.cjs +1 -2
  55. package/_cjs/Channel/api/runCollect.cjs.map +1 -1
  56. package/_cjs/Channel/api/runDrain.cjs +1 -2
  57. package/_cjs/Channel/api/runDrain.cjs.map +1 -1
  58. package/_cjs/Channel/api/runScoped.cjs +3 -4
  59. package/_cjs/Channel/api/runScoped.cjs.map +1 -1
  60. package/_cjs/Channel/api/toPull.cjs +2 -3
  61. package/_cjs/Channel/api/toPull.cjs.map +1 -1
  62. package/_cjs/Channel/api/zipConcurrent.cjs +1 -2
  63. package/_cjs/Channel/api/zipConcurrent.cjs.map +1 -1
  64. package/_cjs/Channel/api.cjs +206 -207
  65. package/_cjs/Channel/api.cjs.map +1 -1
  66. package/_cjs/Channel/core-api.cjs +43 -42
  67. package/_cjs/Channel/core-api.cjs.map +1 -1
  68. package/_cjs/Channel/internal/ChannelExecutor.cjs +4 -5
  69. package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
  70. package/_cjs/Channel/internal/ChannelState.cjs +1 -2
  71. package/_cjs/Channel/internal/ChannelState.cjs.map +1 -1
  72. package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +1 -2
  73. package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
  74. package/_cjs/Clock/api.cjs +1 -2
  75. package/_cjs/Clock/api.cjs.map +1 -1
  76. package/_cjs/Clock/definition.cjs +1 -2
  77. package/_cjs/Clock/definition.cjs.map +1 -1
  78. package/_cjs/Clock/live.cjs +1 -2
  79. package/_cjs/Clock/live.cjs.map +1 -1
  80. package/_cjs/Console/api.cjs +1 -2
  81. package/_cjs/Console/api.cjs.map +1 -1
  82. package/_cjs/Console/definition.cjs +2 -2
  83. package/_cjs/Console/definition.cjs.map +1 -1
  84. package/_cjs/Console/live.cjs +1 -2
  85. package/_cjs/Console/live.cjs.map +1 -1
  86. package/_cjs/CountdownLatch.cjs +3 -3
  87. package/_cjs/CountdownLatch.cjs.map +1 -1
  88. package/_cjs/Differ/api.cjs +1 -2
  89. package/_cjs/Differ/api.cjs.map +1 -1
  90. package/_cjs/Fiber/FiberMessage.cjs +3 -24
  91. package/_cjs/Fiber/FiberMessage.cjs.map +1 -1
  92. package/_cjs/Fiber/FiberRuntime.cjs +879 -636
  93. package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
  94. package/_cjs/Fiber/api/awaitAll.cjs +1 -2
  95. package/_cjs/Fiber/api/awaitAll.cjs.map +1 -1
  96. package/_cjs/Fiber/api/collectAll.cjs +2 -3
  97. package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
  98. package/_cjs/Fiber/api/fromIO.cjs +1 -2
  99. package/_cjs/Fiber/api/fromIO.cjs.map +1 -1
  100. package/_cjs/Fiber/api/interrupt.cjs +2 -3
  101. package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
  102. package/_cjs/Fiber/api/interruptAll.cjs +2 -3
  103. package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
  104. package/_cjs/Fiber/api/interruptAs.cjs +5 -10
  105. package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
  106. package/_cjs/Fiber/api/interruptFork.cjs +2 -3
  107. package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
  108. package/_cjs/Fiber/api/join.cjs +1 -2
  109. package/_cjs/Fiber/api/join.cjs.map +1 -1
  110. package/_cjs/Fiber/api/joinAll.cjs +1 -2
  111. package/_cjs/Fiber/api/joinAll.cjs.map +1 -1
  112. package/_cjs/Fiber/api/mapFiber.cjs +1 -2
  113. package/_cjs/Fiber/api/mapFiber.cjs.map +1 -1
  114. package/_cjs/Fiber/api/mapIO.cjs +2 -3
  115. package/_cjs/Fiber/api/mapIO.cjs.map +1 -1
  116. package/_cjs/Fiber/api/zipWith.cjs +2 -3
  117. package/_cjs/Fiber/api/zipWith.cjs.map +1 -1
  118. package/_cjs/Fiber/constructors.cjs +2 -3
  119. package/_cjs/Fiber/constructors.cjs.map +1 -1
  120. package/_cjs/Fiber/definition.cjs +6 -4
  121. package/_cjs/Fiber/definition.cjs.map +1 -1
  122. package/_cjs/FiberRef/api/locallyScoped.cjs +1 -2
  123. package/_cjs/FiberRef/api/locallyScoped.cjs.map +1 -1
  124. package/_cjs/FiberRef/api/locallyScopedWith.cjs +1 -2
  125. package/_cjs/FiberRef/api/locallyScopedWith.cjs.map +1 -1
  126. package/_cjs/FiberRef/constructors.cjs +1 -2
  127. package/_cjs/FiberRef/constructors.cjs.map +1 -1
  128. package/_cjs/FiberRef/definition.cjs +1 -2
  129. package/_cjs/FiberRef/definition.cjs.map +1 -1
  130. package/_cjs/FiberRef/operations.cjs +1 -2
  131. package/_cjs/FiberRef/operations.cjs.map +1 -1
  132. package/_cjs/FiberRef/unsafe.cjs +1 -2
  133. package/_cjs/FiberRef/unsafe.cjs.map +1 -1
  134. package/_cjs/FiberRefs/Patch.cjs +1 -2
  135. package/_cjs/FiberRefs/Patch.cjs.map +1 -1
  136. package/_cjs/FiberRefs/api.cjs +1 -2
  137. package/_cjs/FiberRefs/api.cjs.map +1 -1
  138. package/_cjs/FiberRefs/definition.cjs +1 -2
  139. package/_cjs/FiberRefs/definition.cjs.map +1 -1
  140. package/_cjs/FiberScope/definition.cjs +29 -6
  141. package/_cjs/FiberScope/definition.cjs.map +1 -1
  142. package/_cjs/FiberSet.cjs +16 -15
  143. package/_cjs/FiberSet.cjs.map +1 -1
  144. package/_cjs/FiberStatus/definition.cjs +1 -2
  145. package/_cjs/FiberStatus/definition.cjs.map +1 -1
  146. package/_cjs/Future/State.cjs +108 -0
  147. package/_cjs/Future/State.cjs.map +1 -0
  148. package/_cjs/Future/api.cjs +71 -64
  149. package/_cjs/Future/api.cjs.map +1 -1
  150. package/_cjs/Future/constructors.cjs +3 -4
  151. package/_cjs/Future/constructors.cjs.map +1 -1
  152. package/_cjs/Future/definition.cjs +1 -15
  153. package/_cjs/Future/definition.cjs.map +1 -1
  154. package/_cjs/Future.cjs +11 -0
  155. package/_cjs/Future.cjs.map +1 -1
  156. package/_cjs/Hub/api.cjs +56 -57
  157. package/_cjs/Hub/api.cjs.map +1 -1
  158. package/_cjs/Hub/internal.cjs +1 -2
  159. package/_cjs/Hub/internal.cjs.map +1 -1
  160. package/_cjs/IO/api/acquireRelease.cjs +1 -2
  161. package/_cjs/IO/api/acquireRelease.cjs.map +1 -1
  162. package/_cjs/IO/api/acquireReleaseExit.cjs +1 -2
  163. package/_cjs/IO/api/acquireReleaseExit.cjs.map +1 -1
  164. package/_cjs/IO/api/acquireReleaseInterruptible.cjs +1 -2
  165. package/_cjs/IO/api/acquireReleaseInterruptible.cjs.map +1 -1
  166. package/_cjs/IO/api/acquireReleaseInterruptibleExit.cjs +1 -2
  167. package/_cjs/IO/api/acquireReleaseInterruptibleExit.cjs.map +1 -1
  168. package/_cjs/IO/api/addFinalizer.cjs +1 -2
  169. package/_cjs/IO/api/addFinalizer.cjs.map +1 -1
  170. package/_cjs/IO/api/addFinalizerExit.cjs +1 -2
  171. package/_cjs/IO/api/addFinalizerExit.cjs.map +1 -1
  172. package/_cjs/IO/api/all.cjs +1 -2
  173. package/_cjs/IO/api/all.cjs.map +1 -1
  174. package/_cjs/IO/api/array.cjs +51 -0
  175. package/_cjs/IO/api/array.cjs.map +1 -0
  176. package/_cjs/IO/api/asyncIO.cjs +1 -2
  177. package/_cjs/IO/api/asyncIO.cjs.map +1 -1
  178. package/_cjs/IO/api/asyncInterrupt.cjs +1 -2
  179. package/_cjs/IO/api/asyncInterrupt.cjs.map +1 -1
  180. package/_cjs/IO/api/awaitAllChildren.cjs +17 -0
  181. package/_cjs/IO/api/awaitAllChildren.cjs.map +1 -0
  182. package/_cjs/IO/api/blocking.cjs +1 -2
  183. package/_cjs/IO/api/blocking.cjs.map +1 -1
  184. package/_cjs/IO/api/bracket.cjs +1 -2
  185. package/_cjs/IO/api/bracket.cjs.map +1 -1
  186. package/_cjs/IO/api/bracketExit.cjs +1 -2
  187. package/_cjs/IO/api/bracketExit.cjs.map +1 -1
  188. package/_cjs/IO/api/cachedInvalidate.cjs +47 -0
  189. package/_cjs/IO/api/cachedInvalidate.cjs.map +1 -0
  190. package/_cjs/IO/api/clockWith.cjs +1 -2
  191. package/_cjs/IO/api/clockWith.cjs.map +1 -1
  192. package/_cjs/IO/api/concurrency.cjs +1 -2
  193. package/_cjs/IO/api/concurrency.cjs.map +1 -1
  194. package/_cjs/IO/api/concurrentFinalizers.cjs +1 -2
  195. package/_cjs/IO/api/concurrentFinalizers.cjs.map +1 -1
  196. package/_cjs/IO/api/consoleWith.cjs +1 -2
  197. package/_cjs/IO/api/consoleWith.cjs.map +1 -1
  198. package/_cjs/IO/api/daemonChildren.cjs +1 -2
  199. package/_cjs/IO/api/daemonChildren.cjs.map +1 -1
  200. package/_cjs/IO/api/delay.cjs +1 -2
  201. package/_cjs/IO/api/delay.cjs.map +1 -1
  202. package/_cjs/IO/api/descriptor.cjs +1 -2
  203. package/_cjs/IO/api/descriptor.cjs.map +1 -1
  204. package/_cjs/IO/api/diffFiberRefs.cjs +1 -2
  205. package/_cjs/IO/api/diffFiberRefs.cjs.map +1 -1
  206. package/_cjs/IO/api/disconnect.cjs +2 -3
  207. package/_cjs/IO/api/disconnect.cjs.map +1 -1
  208. package/_cjs/IO/api/ensuringChildren.cjs +1 -2
  209. package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
  210. package/_cjs/IO/api/environment.cjs +1 -2
  211. package/_cjs/IO/api/environment.cjs.map +1 -1
  212. package/_cjs/IO/api/foreachConcurrent.cjs +36 -30
  213. package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
  214. package/_cjs/IO/api/foreachExec.cjs +1 -2
  215. package/_cjs/IO/api/foreachExec.cjs.map +1 -1
  216. package/_cjs/IO/api/fork.cjs +2 -3
  217. package/_cjs/IO/api/fork.cjs.map +1 -1
  218. package/_cjs/IO/api/forkAll.cjs +1 -2
  219. package/_cjs/IO/api/forkAll.cjs.map +1 -1
  220. package/_cjs/IO/api/forkDaemon.cjs +5 -6
  221. package/_cjs/IO/api/forkDaemon.cjs.map +1 -1
  222. package/_cjs/IO/api/forkIn.cjs +1 -2
  223. package/_cjs/IO/api/forkIn.cjs.map +1 -1
  224. package/_cjs/IO/api/forkScoped.cjs +1 -2
  225. package/_cjs/IO/api/forkScoped.cjs.map +1 -1
  226. package/_cjs/IO/api/fulfill.cjs +1 -2
  227. package/_cjs/IO/api/fulfill.cjs.map +1 -1
  228. package/_cjs/IO/api/interrupt.cjs +4 -5
  229. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  230. package/_cjs/IO/api/memoize.cjs +1 -2
  231. package/_cjs/IO/api/memoize.cjs.map +1 -1
  232. package/_cjs/IO/api/onTermination.cjs +2 -3
  233. package/_cjs/IO/api/onTermination.cjs.map +1 -1
  234. package/_cjs/IO/api/once.cjs +1 -2
  235. package/_cjs/IO/api/once.cjs.map +1 -1
  236. package/_cjs/IO/api/patchFiberRefs.cjs +1 -2
  237. package/_cjs/IO/api/patchFiberRefs.cjs.map +1 -1
  238. package/_cjs/IO/api/provideLayer.cjs +1 -2
  239. package/_cjs/IO/api/provideLayer.cjs.map +1 -1
  240. package/_cjs/IO/api/provideScope.cjs +1 -2
  241. package/_cjs/IO/api/provideScope.cjs.map +1 -1
  242. package/_cjs/IO/api/provideSomeLayer.cjs +1 -2
  243. package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
  244. package/_cjs/IO/api/provideSomeRuntime.cjs +1 -2
  245. package/_cjs/IO/api/provideSomeRuntime.cjs.map +1 -1
  246. package/_cjs/IO/api/race.cjs +2 -3
  247. package/_cjs/IO/api/race.cjs.map +1 -1
  248. package/_cjs/IO/api/raceFirst.cjs +1 -2
  249. package/_cjs/IO/api/raceFirst.cjs.map +1 -1
  250. package/_cjs/IO/api/raceWith.cjs +1 -2
  251. package/_cjs/IO/api/raceWith.cjs.map +1 -1
  252. package/_cjs/IO/api/randomWith.cjs +1 -2
  253. package/_cjs/IO/api/randomWith.cjs.map +1 -1
  254. package/_cjs/IO/api/repeat.cjs +1 -2
  255. package/_cjs/IO/api/repeat.cjs.map +1 -1
  256. package/_cjs/IO/api/retry.cjs +1 -2
  257. package/_cjs/IO/api/retry.cjs.map +1 -1
  258. package/_cjs/IO/api/schedule.cjs +1 -2
  259. package/_cjs/IO/api/schedule.cjs.map +1 -1
  260. package/_cjs/IO/api/scope.cjs +1 -2
  261. package/_cjs/IO/api/scope.cjs.map +1 -1
  262. package/_cjs/IO/api/scopeWith.cjs +1 -2
  263. package/_cjs/IO/api/scopeWith.cjs.map +1 -1
  264. package/_cjs/IO/api/scoped.cjs +1 -2
  265. package/_cjs/IO/api/scoped.cjs.map +1 -1
  266. package/_cjs/IO/api/sleep.cjs +1 -2
  267. package/_cjs/IO/api/sleep.cjs.map +1 -1
  268. package/_cjs/IO/api/stateful.cjs +1 -2
  269. package/_cjs/IO/api/stateful.cjs.map +1 -1
  270. package/_cjs/IO/api/supervised.cjs +1 -2
  271. package/_cjs/IO/api/supervised.cjs.map +1 -1
  272. package/_cjs/IO/api/timeout.cjs +9 -11
  273. package/_cjs/IO/api/timeout.cjs.map +1 -1
  274. package/_cjs/IO/api/transplant.cjs +22 -7
  275. package/_cjs/IO/api/transplant.cjs.map +1 -1
  276. package/_cjs/IO/api/whenFiberRef.cjs +1 -2
  277. package/_cjs/IO/api/whenFiberRef.cjs.map +1 -1
  278. package/_cjs/IO/api/whenRef.cjs +1 -2
  279. package/_cjs/IO/api/whenRef.cjs.map +1 -1
  280. package/_cjs/IO/api/withChildren.cjs +1 -2
  281. package/_cjs/IO/api/withChildren.cjs.map +1 -1
  282. package/_cjs/IO/api/withEarlyRelease.cjs +1 -2
  283. package/_cjs/IO/api/withEarlyRelease.cjs.map +1 -1
  284. package/_cjs/IO/api/withFinalizer.cjs +1 -2
  285. package/_cjs/IO/api/withFinalizer.cjs.map +1 -1
  286. package/_cjs/IO/api/withFinalizerExit.cjs +1 -2
  287. package/_cjs/IO/api/withFinalizerExit.cjs.map +1 -1
  288. package/_cjs/IO/api/zipConcurrent.cjs +5 -6
  289. package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
  290. package/_cjs/IO/api.cjs +522 -473
  291. package/_cjs/IO/api.cjs.map +1 -1
  292. package/_cjs/IO/definition.cjs +2 -3
  293. package/_cjs/IO/definition.cjs.map +1 -1
  294. package/_cjs/IO/runtime.cjs +9 -10
  295. package/_cjs/IO/runtime.cjs.map +1 -1
  296. package/_cjs/IO.cjs +33 -11
  297. package/_cjs/IO.cjs.map +1 -1
  298. package/_cjs/IOEnv/definition.cjs +1 -2
  299. package/_cjs/IOEnv/definition.cjs.map +1 -1
  300. package/_cjs/IOEnv/live.cjs +1 -2
  301. package/_cjs/IOEnv/live.cjs.map +1 -1
  302. package/_cjs/IOEnv/services.cjs +1 -2
  303. package/_cjs/IOEnv/services.cjs.map +1 -1
  304. package/_cjs/Layer/MemoMap.cjs +1 -2
  305. package/_cjs/Layer/MemoMap.cjs.map +1 -1
  306. package/_cjs/Layer/api.cjs +1 -2
  307. package/_cjs/Layer/api.cjs.map +1 -1
  308. package/_cjs/Logger/api.cjs +1 -2
  309. package/_cjs/Logger/api.cjs.map +1 -1
  310. package/_cjs/Logger/constructors.cjs +1 -2
  311. package/_cjs/Logger/constructors.cjs.map +1 -1
  312. package/_cjs/MVar/api.cjs +1 -2
  313. package/_cjs/MVar/api.cjs.map +1 -1
  314. package/_cjs/Push/api.cjs +2 -3
  315. package/_cjs/Push/api.cjs.map +1 -1
  316. package/_cjs/Push/internal.cjs +1 -2
  317. package/_cjs/Push/internal.cjs.map +1 -1
  318. package/_cjs/Queue/api/dimapIO.cjs +1 -2
  319. package/_cjs/Queue/api/dimapIO.cjs.map +1 -1
  320. package/_cjs/Queue/api/filterInputIO.cjs +1 -2
  321. package/_cjs/Queue/api/filterInputIO.cjs.map +1 -1
  322. package/_cjs/Queue/api/filterOutputIO.cjs +1 -2
  323. package/_cjs/Queue/api/filterOutputIO.cjs.map +1 -1
  324. package/_cjs/Queue/api/poll.cjs +1 -2
  325. package/_cjs/Queue/api/poll.cjs.map +1 -1
  326. package/_cjs/Queue/api/takeBetween.cjs +1 -2
  327. package/_cjs/Queue/api/takeBetween.cjs.map +1 -1
  328. package/_cjs/Queue/api/takeN.cjs +1 -2
  329. package/_cjs/Queue/api/takeN.cjs.map +1 -1
  330. package/_cjs/Queue/api/zipWithIO.cjs +1 -2
  331. package/_cjs/Queue/api/zipWithIO.cjs.map +1 -1
  332. package/_cjs/Queue/constructors.cjs +1 -2
  333. package/_cjs/Queue/constructors.cjs.map +1 -1
  334. package/_cjs/Queue/internal.cjs +1 -2
  335. package/_cjs/Queue/internal.cjs.map +1 -1
  336. package/_cjs/Queue/strategy.cjs +1 -2
  337. package/_cjs/Queue/strategy.cjs.map +1 -1
  338. package/_cjs/Random/api.cjs +1 -2
  339. package/_cjs/Random/api.cjs.map +1 -1
  340. package/_cjs/Random/definition.cjs +2 -2
  341. package/_cjs/Random/definition.cjs.map +1 -1
  342. package/_cjs/Random/live.cjs +1 -2
  343. package/_cjs/Random/live.cjs.map +1 -1
  344. package/_cjs/Ref/Atomic.cjs +1 -2
  345. package/_cjs/Ref/Atomic.cjs.map +1 -1
  346. package/_cjs/Ref/Derived.cjs +1 -2
  347. package/_cjs/Ref/Derived.cjs.map +1 -1
  348. package/_cjs/Ref/DerivedAll.cjs +1 -2
  349. package/_cjs/Ref/DerivedAll.cjs.map +1 -1
  350. package/_cjs/Ref/Synchronized/api.cjs +2 -3
  351. package/_cjs/Ref/Synchronized/api.cjs.map +1 -1
  352. package/_cjs/Ref/Synchronized/constructors.cjs +2 -3
  353. package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
  354. package/_cjs/Ref/Synchronized/definition.cjs +2 -3
  355. package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
  356. package/_cjs/Ref/api/collect.cjs +1 -2
  357. package/_cjs/Ref/api/collect.cjs.map +1 -1
  358. package/_cjs/Ref/api/dimap.cjs +1 -2
  359. package/_cjs/Ref/api/dimap.cjs.map +1 -1
  360. package/_cjs/Ref/api/filter.cjs +1 -2
  361. package/_cjs/Ref/api/filter.cjs.map +1 -1
  362. package/_cjs/Ref/api/modify.cjs +1 -2
  363. package/_cjs/Ref/api/modify.cjs.map +1 -1
  364. package/_cjs/Ref/api.cjs +1 -2
  365. package/_cjs/Ref/api.cjs.map +1 -1
  366. package/_cjs/Ref/constructors.cjs +1 -2
  367. package/_cjs/Ref/constructors.cjs.map +1 -1
  368. package/_cjs/RefSubject/Atomic.cjs +1 -2
  369. package/_cjs/RefSubject/Atomic.cjs.map +1 -1
  370. package/_cjs/RefSubject/Synchronized/api.cjs +1 -2
  371. package/_cjs/RefSubject/Synchronized/api.cjs.map +1 -1
  372. package/_cjs/RefSubject/Synchronized/definition.cjs +1 -2
  373. package/_cjs/RefSubject/Synchronized/definition.cjs.map +1 -1
  374. package/_cjs/RefSubject/api.cjs +1 -2
  375. package/_cjs/RefSubject/api.cjs.map +1 -1
  376. package/_cjs/Reloadable/api.cjs +1 -2
  377. package/_cjs/Reloadable/api.cjs.map +1 -1
  378. package/_cjs/Reloadable/constructors.cjs +1 -2
  379. package/_cjs/Reloadable/constructors.cjs.map +1 -1
  380. package/_cjs/Reloadable/definition.cjs +1 -2
  381. package/_cjs/Reloadable/definition.cjs.map +1 -1
  382. package/_cjs/RuntimeFlags/Patch.cjs +1 -2
  383. package/_cjs/RuntimeFlags/Patch.cjs.map +1 -1
  384. package/_cjs/RuntimeFlags/RuntimeFlags.cjs +1 -2
  385. package/_cjs/RuntimeFlags/RuntimeFlags.cjs.map +1 -1
  386. package/_cjs/STM/api/atomically.cjs +1 -2
  387. package/_cjs/STM/api/atomically.cjs.map +1 -1
  388. package/_cjs/STM/api/core-api.cjs +1 -2
  389. package/_cjs/STM/api/core-api.cjs.map +1 -1
  390. package/_cjs/STM/api.cjs +1 -2
  391. package/_cjs/STM/api.cjs.map +1 -1
  392. package/_cjs/STM/definition.cjs +2 -3
  393. package/_cjs/STM/definition.cjs.map +1 -1
  394. package/_cjs/STM/driver.cjs +1 -2
  395. package/_cjs/STM/driver.cjs.map +1 -1
  396. package/_cjs/STM/internal/CommitState.cjs +1 -2
  397. package/_cjs/STM/internal/CommitState.cjs.map +1 -1
  398. package/_cjs/STM/internal/Journal.cjs +1 -2
  399. package/_cjs/STM/internal/Journal.cjs.map +1 -1
  400. package/_cjs/Schedule/Decision.cjs +1 -2
  401. package/_cjs/Schedule/Decision.cjs.map +1 -1
  402. package/_cjs/Schedule/api/driver.cjs +1 -2
  403. package/_cjs/Schedule/api/driver.cjs.map +1 -1
  404. package/_cjs/Schedule/api.cjs +1 -2
  405. package/_cjs/Schedule/api.cjs.map +1 -1
  406. package/_cjs/Scope/Finalizer/definition.cjs +1 -2
  407. package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
  408. package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -2
  409. package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs.map +1 -1
  410. package/_cjs/Scope/ReleaseMap/api.cjs +1 -2
  411. package/_cjs/Scope/ReleaseMap/api.cjs.map +1 -1
  412. package/_cjs/Scope/ReleaseMap/constructors.cjs +1 -2
  413. package/_cjs/Scope/ReleaseMap/constructors.cjs.map +1 -1
  414. package/_cjs/Scope/ReleaseMap/definition.cjs +1 -2
  415. package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
  416. package/_cjs/Scope/api.cjs +1 -2
  417. package/_cjs/Scope/api.cjs.map +1 -1
  418. package/_cjs/Scope/definition.cjs +1 -2
  419. package/_cjs/Scope/definition.cjs.map +1 -1
  420. package/_cjs/ScopedRef/api.cjs +2 -3
  421. package/_cjs/ScopedRef/api.cjs.map +1 -1
  422. package/_cjs/Semaphore/Reservation.cjs +24 -0
  423. package/_cjs/Semaphore/Reservation.cjs.map +1 -0
  424. package/_cjs/Semaphore/constructors.cjs +25 -0
  425. package/_cjs/Semaphore/constructors.cjs.map +1 -0
  426. package/_cjs/Semaphore/definition.cjs +149 -0
  427. package/_cjs/Semaphore/definition.cjs.map +1 -0
  428. package/_cjs/Semaphore.cjs +31 -138
  429. package/_cjs/Semaphore.cjs.map +1 -1
  430. package/_cjs/Sink/api.cjs +1 -2
  431. package/_cjs/Sink/api.cjs.map +1 -1
  432. package/_cjs/State/api.cjs +1 -2
  433. package/_cjs/State/api.cjs.map +1 -1
  434. package/_cjs/Stream/api/zipAllWith.cjs +1 -2
  435. package/_cjs/Stream/api/zipAllWith.cjs.map +1 -1
  436. package/_cjs/Stream/api/zipWith.cjs +1 -2
  437. package/_cjs/Stream/api/zipWith.cjs.map +1 -1
  438. package/_cjs/Stream/api/zipWithChunks.cjs +1 -2
  439. package/_cjs/Stream/api/zipWithChunks.cjs.map +1 -1
  440. package/_cjs/Stream/api.cjs +702 -703
  441. package/_cjs/Stream/api.cjs.map +1 -1
  442. package/_cjs/Stream/internal/Handoff.cjs +1 -2
  443. package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
  444. package/_cjs/Stream/internal/Pull.cjs +1 -2
  445. package/_cjs/Stream/internal/Pull.cjs.map +1 -1
  446. package/_cjs/Stream/internal/Take.cjs +1 -2
  447. package/_cjs/Stream/internal/Take.cjs.map +1 -1
  448. package/_cjs/Stream/internal/util.cjs +1 -2
  449. package/_cjs/Stream/internal/util.cjs.map +1 -1
  450. package/_cjs/Subject/Atomic.cjs +1 -2
  451. package/_cjs/Subject/Atomic.cjs.map +1 -1
  452. package/_cjs/Subject/api.cjs +1 -2
  453. package/_cjs/Subject/api.cjs.map +1 -1
  454. package/_cjs/SubscriptionRef.cjs +2 -3
  455. package/_cjs/SubscriptionRef.cjs.map +1 -1
  456. package/_cjs/Supervisor/api.cjs +1 -2
  457. package/_cjs/Supervisor/api.cjs.map +1 -1
  458. package/_cjs/Supervisor/constructors.cjs +1 -2
  459. package/_cjs/Supervisor/constructors.cjs.map +1 -1
  460. package/_cjs/Supervisor/definition.cjs +1 -2
  461. package/_cjs/Supervisor/definition.cjs.map +1 -1
  462. package/_cjs/SupervisorPatch.cjs +1 -2
  463. package/_cjs/SupervisorPatch.cjs.map +1 -1
  464. package/_cjs/TExit/definition.cjs +1 -2
  465. package/_cjs/TExit/definition.cjs.map +1 -1
  466. package/_cjs/TFuture/api.cjs +1 -2
  467. package/_cjs/TFuture/api.cjs.map +1 -1
  468. package/_cjs/TFuture/constructors.cjs +1 -2
  469. package/_cjs/TFuture/constructors.cjs.map +1 -1
  470. package/_cjs/TFuture/definition.cjs +1 -2
  471. package/_cjs/TFuture/definition.cjs.map +1 -1
  472. package/_cjs/TReentrantLock/api.cjs +1 -2
  473. package/_cjs/TReentrantLock/api.cjs.map +1 -1
  474. package/_cjs/TReentrantLock/definition.cjs +1 -2
  475. package/_cjs/TReentrantLock/definition.cjs.map +1 -1
  476. package/_cjs/TRef/api.cjs +1 -2
  477. package/_cjs/TRef/api.cjs.map +1 -1
  478. package/_cjs/TRef/constructors.cjs +1 -2
  479. package/_cjs/TRef/constructors.cjs.map +1 -1
  480. package/_cjs/TRef/definition.cjs +1 -2
  481. package/_cjs/TRef/definition.cjs.map +1 -1
  482. package/_cjs/TSemaphore/api.cjs +1 -2
  483. package/_cjs/TSemaphore/api.cjs.map +1 -1
  484. package/_cjs/TSemaphore/constructors.cjs +1 -2
  485. package/_cjs/TSemaphore/constructors.cjs.map +1 -1
  486. package/_cjs/TSemaphore/definition.cjs +1 -2
  487. package/_cjs/TSemaphore/definition.cjs.map +1 -1
  488. package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +1 -2
  489. package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -1
  490. package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +1 -2
  491. package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -1
  492. package/_cjs/collection/immutable/Conc/filterIO.cjs +1 -2
  493. package/_cjs/collection/immutable/Conc/filterIO.cjs.map +1 -1
  494. package/_cjs/collection/immutable/Conc/findIO.cjs +1 -2
  495. package/_cjs/collection/immutable/Conc/findIO.cjs.map +1 -1
  496. package/_cjs/collection/immutable/Conc/mapIO.cjs +1 -2
  497. package/_cjs/collection/immutable/Conc/mapIO.cjs.map +1 -1
  498. package/_cjs/collection/immutable/Conc/takeWhileIO.cjs +1 -2
  499. package/_cjs/collection/immutable/Conc/takeWhileIO.cjs.map +1 -1
  500. package/_cjs/data/Exit/foreachIO.cjs +1 -2
  501. package/_cjs/data/Exit/foreachIO.cjs.map +1 -1
  502. package/_cjs/internal/HashedPair.cjs +1 -2
  503. package/_cjs/internal/HashedPair.cjs.map +1 -1
  504. package/_cjs/internal/Hub.cjs +1 -2
  505. package/_cjs/internal/Hub.cjs.map +1 -1
  506. package/_cjs/internal/MutableQueue.cjs +1 -2
  507. package/_cjs/internal/MutableQueue.cjs.map +1 -1
  508. package/_cjs/internal/Scheduler.cjs +1 -2
  509. package/_cjs/internal/Scheduler.cjs.map +1 -1
  510. package/_cjs/internal/StackTraceBuilder.cjs +1 -2
  511. package/_cjs/internal/StackTraceBuilder.cjs.map +1 -1
  512. package/_mjs/Cached/api.mjs.map +1 -1
  513. package/_mjs/Channel/api/mapOutConcurrentIO.mjs +1 -1
  514. package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
  515. package/_mjs/Channel/api/runScoped.mjs +2 -2
  516. package/_mjs/Channel/api/runScoped.mjs.map +1 -1
  517. package/_mjs/Channel/api/toPull.mjs +1 -1
  518. package/_mjs/Channel/api/toPull.mjs.map +1 -1
  519. package/_mjs/Channel/api.mjs +205 -205
  520. package/_mjs/Channel/api.mjs.map +1 -1
  521. package/_mjs/Channel/core-api.mjs +43 -42
  522. package/_mjs/Channel/core-api.mjs.map +1 -1
  523. package/_mjs/Channel/internal/ChannelExecutor.mjs +3 -3
  524. package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
  525. package/_mjs/Console/definition.mjs +1 -0
  526. package/_mjs/Console/definition.mjs.map +1 -1
  527. package/_mjs/CountdownLatch.mjs +2 -1
  528. package/_mjs/CountdownLatch.mjs.map +1 -1
  529. package/_mjs/Fiber/FiberMessage.mjs +2 -20
  530. package/_mjs/Fiber/FiberMessage.mjs.map +1 -1
  531. package/_mjs/Fiber/FiberRuntime.mjs +877 -633
  532. package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
  533. package/_mjs/Fiber/api/collectAll.mjs +1 -1
  534. package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
  535. package/_mjs/Fiber/api/interrupt.mjs +1 -1
  536. package/_mjs/Fiber/api/interrupt.mjs.map +1 -1
  537. package/_mjs/Fiber/api/interruptAll.mjs +1 -1
  538. package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
  539. package/_mjs/Fiber/api/interruptAs.mjs +4 -7
  540. package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
  541. package/_mjs/Fiber/api/interruptFork.mjs +1 -1
  542. package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
  543. package/_mjs/Fiber/api/mapIO.mjs +1 -1
  544. package/_mjs/Fiber/api/mapIO.mjs.map +1 -1
  545. package/_mjs/Fiber/api/zipWith.mjs +1 -1
  546. package/_mjs/Fiber/api/zipWith.mjs.map +1 -1
  547. package/_mjs/Fiber/constructors.mjs +1 -1
  548. package/_mjs/Fiber/constructors.mjs.map +1 -1
  549. package/_mjs/Fiber/definition.mjs +5 -2
  550. package/_mjs/Fiber/definition.mjs.map +1 -1
  551. package/_mjs/FiberScope/definition.mjs +28 -4
  552. package/_mjs/FiberScope/definition.mjs.map +1 -1
  553. package/_mjs/FiberSet.mjs +14 -12
  554. package/_mjs/FiberSet.mjs.map +1 -1
  555. package/_mjs/Future/State.mjs +96 -0
  556. package/_mjs/Future/State.mjs.map +1 -0
  557. package/_mjs/Future/api.mjs +67 -61
  558. package/_mjs/Future/api.mjs.map +1 -1
  559. package/_mjs/Future/constructors.mjs +3 -3
  560. package/_mjs/Future/constructors.mjs.map +1 -1
  561. package/_mjs/Future/definition.mjs +0 -12
  562. package/_mjs/Future/definition.mjs.map +1 -1
  563. package/_mjs/Future.mjs +1 -0
  564. package/_mjs/Future.mjs.map +1 -1
  565. package/_mjs/Hub/api.mjs +55 -55
  566. package/_mjs/Hub/api.mjs.map +1 -1
  567. package/_mjs/IO/api/array.mjs +42 -0
  568. package/_mjs/IO/api/array.mjs.map +1 -0
  569. package/_mjs/IO/api/asyncInterrupt.mjs.map +1 -1
  570. package/_mjs/IO/api/awaitAllChildren.mjs +10 -0
  571. package/_mjs/IO/api/awaitAllChildren.mjs.map +1 -0
  572. package/_mjs/IO/api/cachedInvalidate.mjs +39 -0
  573. package/_mjs/IO/api/cachedInvalidate.mjs.map +1 -0
  574. package/_mjs/IO/api/disconnect.mjs +1 -1
  575. package/_mjs/IO/api/disconnect.mjs.map +1 -1
  576. package/_mjs/IO/api/foreachConcurrent.mjs +35 -28
  577. package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
  578. package/_mjs/IO/api/fork.mjs +1 -1
  579. package/_mjs/IO/api/fork.mjs.map +1 -1
  580. package/_mjs/IO/api/forkDaemon.mjs +4 -4
  581. package/_mjs/IO/api/forkDaemon.mjs.map +1 -1
  582. package/_mjs/IO/api/interrupt.mjs +3 -3
  583. package/_mjs/IO/api/onTermination.mjs +1 -1
  584. package/_mjs/IO/api/onTermination.mjs.map +1 -1
  585. package/_mjs/IO/api/race.mjs +1 -1
  586. package/_mjs/IO/api/race.mjs.map +1 -1
  587. package/_mjs/IO/api/timeout.mjs +8 -9
  588. package/_mjs/IO/api/timeout.mjs.map +1 -1
  589. package/_mjs/IO/api/transplant.mjs +19 -5
  590. package/_mjs/IO/api/transplant.mjs.map +1 -1
  591. package/_mjs/IO/api/zipConcurrent.mjs +4 -4
  592. package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
  593. package/_mjs/IO/api.mjs +515 -468
  594. package/_mjs/IO/api.mjs.map +1 -1
  595. package/_mjs/IO/definition.mjs +1 -1
  596. package/_mjs/IO/definition.mjs.map +1 -1
  597. package/_mjs/IO/runtime.mjs +8 -8
  598. package/_mjs/IO/runtime.mjs.map +1 -1
  599. package/_mjs/IO.mjs +3 -1
  600. package/_mjs/IO.mjs.map +1 -1
  601. package/_mjs/IOEnv/definition.mjs.map +1 -1
  602. package/_mjs/Push/api.mjs +1 -1
  603. package/_mjs/Random/definition.mjs +1 -0
  604. package/_mjs/Random/definition.mjs.map +1 -1
  605. package/_mjs/Ref/Synchronized/api.mjs +1 -1
  606. package/_mjs/Ref/Synchronized/api.mjs.map +1 -1
  607. package/_mjs/Ref/Synchronized/constructors.mjs +1 -1
  608. package/_mjs/Ref/Synchronized/definition.mjs +1 -1
  609. package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
  610. package/_mjs/STM/definition.mjs +1 -1
  611. package/_mjs/ScopedRef/api.mjs +1 -1
  612. package/_mjs/ScopedRef/api.mjs.map +1 -1
  613. package/_mjs/Semaphore/Reservation.mjs +16 -0
  614. package/_mjs/Semaphore/Reservation.mjs.map +1 -0
  615. package/_mjs/Semaphore/constructors.mjs +17 -0
  616. package/_mjs/Semaphore/constructors.mjs.map +1 -0
  617. package/_mjs/Semaphore/definition.mjs +141 -0
  618. package/_mjs/Semaphore/definition.mjs.map +1 -0
  619. package/_mjs/Semaphore.mjs +4 -133
  620. package/_mjs/Semaphore.mjs.map +1 -1
  621. package/_mjs/Stream/api.mjs +701 -701
  622. package/_mjs/Stream/api.mjs.map +1 -1
  623. package/_mjs/SubscriptionRef.mjs +1 -1
  624. package/_src/Cached/api.ts +3 -3
  625. package/_src/Channel/api/toPull.ts +1 -1
  626. package/_src/Channel/api.ts +273 -272
  627. package/_src/Channel/core-api.ts +57 -55
  628. package/_src/Channel/internal/ChannelExecutor.ts +3 -3
  629. package/_src/Console/definition.ts +1 -0
  630. package/_src/CountdownLatch.ts +2 -0
  631. package/_src/Fiber/FiberMessage.ts +3 -28
  632. package/_src/Fiber/FiberRuntime.ts +988 -616
  633. package/_src/Fiber/api/interruptAs.ts +4 -3
  634. package/_src/Fiber/constructors.ts +1 -1
  635. package/_src/Fiber/definition.ts +4 -0
  636. package/_src/FiberScope/definition.ts +40 -2
  637. package/_src/FiberSet.ts +6 -2
  638. package/_src/Future/State.ts +128 -0
  639. package/_src/Future/api.ts +62 -51
  640. package/_src/Future/constructors.ts +4 -2
  641. package/_src/Future/definition.ts +2 -17
  642. package/_src/Future.ts +4 -3
  643. package/_src/Hub/api.ts +61 -61
  644. package/_src/IO/api/addFinalizerExit.ts +4 -4
  645. package/_src/IO/api/array.ts +49 -0
  646. package/_src/IO/api/asyncInterrupt.ts +1 -1
  647. package/_src/IO/api/awaitAllChildren.ts +6 -0
  648. package/_src/IO/api/cachedInvalidate.ts +42 -0
  649. package/_src/IO/api/foreachConcurrent.ts +39 -23
  650. package/_src/IO/api/fork.ts +1 -1
  651. package/_src/IO/api/forkDaemon.ts +2 -2
  652. package/_src/IO/api/memoize.ts +3 -3
  653. package/_src/IO/api/onTermination.ts +2 -2
  654. package/_src/IO/api/transplant.ts +26 -3
  655. package/_src/IO/api/zipConcurrent.ts +2 -2
  656. package/_src/IO/api.ts +547 -525
  657. package/_src/IO/definition.ts +4 -28
  658. package/_src/IO/runtime.ts +0 -1
  659. package/_src/IO.ts +65 -63
  660. package/_src/IOEnv/definition.ts +1 -4
  661. package/_src/Random/definition.ts +1 -0
  662. package/_src/Ref/Synchronized/api.ts +2 -2
  663. package/_src/Ref/Synchronized/definition.ts +1 -1
  664. package/_src/Semaphore/Reservation.ts +15 -0
  665. package/_src/Semaphore/constructors.ts +14 -0
  666. package/_src/Semaphore/definition.ts +180 -0
  667. package/_src/Semaphore.ts +5 -159
  668. package/_src/Stream/api.ts +679 -679
  669. package/package.json +4 -4
  670. package/IO/api/sequenceT.d.ts +0 -26
  671. package/_cjs/IO/api/sequenceT.cjs +0 -18
  672. package/_cjs/IO/api/sequenceT.cjs.map +0 -1
  673. package/_mjs/IO/api/sequenceT.mjs +0 -10
  674. package/_mjs/IO/api/sequenceT.mjs.map +0 -1
  675. package/_src/IO/api/sequenceT.ts +0 -16
@@ -145,37 +145,37 @@ exports.zipRight = void 0;
145
145
  exports.zipWithIndex_ = zipWithIndex_;
146
146
  exports.zipWithLatest = zipWithLatest;
147
147
  var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api"));
148
- var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Schedule/api"));
149
- var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
150
- var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Either/destructors"));
151
- var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/Handoff"));
152
- var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/constructors"));
153
- var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/empty"));
154
- var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Schedule/api/driver"));
155
- var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/sequenceT"));
156
- var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api"));
157
- var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/core-api"));
158
- var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api"));
159
- var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/api/set"));
160
- var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/api/get"));
161
- var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/api/modify"));
162
- var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/runScoped"));
163
- var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/forkScoped"));
164
- var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Either/constructors"));
165
- var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
166
- var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
167
- var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/SinkEndReason"));
168
- var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Fiber/api/join"));
169
- var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
170
- var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/forkDaemon"));
171
- var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Cause/api"));
172
- var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/raceWith"));
173
- var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/Take"));
174
- var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Queue/api/operations"));
175
- var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/runtime"));
176
- var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Queue/constructors"));
177
- var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
178
- var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/acquireReleaseExit"));
148
+ var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/acquireRelease"));
149
+ var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/acquireReleaseExit"));
150
+ var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Schedule/api"));
151
+ var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
152
+ var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Either/destructors"));
153
+ var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/Handoff"));
154
+ var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/constructors"));
155
+ var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/empty"));
156
+ var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Schedule/api/driver"));
157
+ var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/all"));
158
+ var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api"));
159
+ var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/core-api"));
160
+ var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api"));
161
+ var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/api/set"));
162
+ var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/api/get"));
163
+ var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Ref/api/modify"));
164
+ var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/runScoped"));
165
+ var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/forkScoped"));
166
+ var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Either/constructors"));
167
+ var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
168
+ var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
169
+ var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/SinkEndReason"));
170
+ var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Fiber/api/join"));
171
+ var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
172
+ var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/forkDaemon"));
173
+ var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Cause/api"));
174
+ var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/raceWith"));
175
+ var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/Take"));
176
+ var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Queue/api/operations"));
177
+ var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/runtime"));
178
+ var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Queue/constructors"));
179
179
  var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/fork"));
180
180
  var tsplus_module_34 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Hub/api"));
181
181
  var tsplus_module_35 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/replicate"));
@@ -189,24 +189,24 @@ var tsplus_module_42 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require
189
189
  var tsplus_module_43 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Clock/api"));
190
190
  var tsplus_module_44 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/transplant"));
191
191
  var tsplus_module_45 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/HashMap/api"));
192
- var tsplus_module_46 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Semaphore"));
193
- var tsplus_module_47 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Sink/api"));
194
- var tsplus_module_48 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Predicate/api"));
192
+ var tsplus_module_46 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Semaphore/constructors"));
193
+ var tsplus_module_47 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Predicate/api"));
194
+ var tsplus_module_48 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Sink/api"));
195
195
  var tsplus_module_49 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Fiber/api/poll"));
196
196
  var tsplus_module_50 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/environment"));
197
197
  var tsplus_module_51 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/collection/immutable/Conc/findIO"));
198
198
  var tsplus_module_52 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Exit/definition"));
199
- var tsplus_module_53 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/definition"));
200
- var tsplus_module_54 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/Pull"));
201
- var tsplus_module_55 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Queue/api/takeBetween"));
202
- var tsplus_module_56 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/interruptWhen"));
203
- var tsplus_module_57 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/mapOutConcurrentIO"));
204
- var tsplus_module_58 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/mergeMap"));
199
+ var tsplus_module_53 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Stream/internal/Pull"));
200
+ var tsplus_module_54 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Queue/api/takeBetween"));
201
+ var tsplus_module_55 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/interruptWhen"));
202
+ var tsplus_module_56 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/mapOutConcurrentIO"));
203
+ var tsplus_module_57 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/mergeMap"));
204
+ var tsplus_module_58 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/mergeWith"));
205
205
  var tsplus_module_59 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/internal/MergeDecision"));
206
- var tsplus_module_60 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/mergeWith"));
207
- var tsplus_module_61 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Layer/MemoMap"));
208
- var tsplus_module_62 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Layer/api"));
209
- var tsplus_module_63 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/runDrain"));
206
+ var tsplus_module_60 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Layer/MemoMap"));
207
+ var tsplus_module_61 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Layer/api"));
208
+ var tsplus_module_62 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/Channel/api/runDrain"));
209
+ var tsplus_module_63 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/collection/immutable/Conc/definition"));
210
210
  var tsplus_module_64 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
211
211
  var tsplus_module_65 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/base/data/exceptions"));
212
212
  var tsplus_module_66 = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@fncts/io/IO/api/interrupt"));
@@ -217,19 +217,16 @@ var _function = /*#__PURE__*/require("@fncts/base/data/function");
217
217
  var _definition4 = /*#__PURE__*/require("./definition.cjs");
218
218
  var _Handoff2 = /*#__PURE__*/require("./internal/Handoff.cjs");
219
219
  var _SinkEndReason2 = /*#__PURE__*/require("./internal/SinkEndReason.cjs");
220
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
221
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
220
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
222
221
  const fileName_1 = "(@fncts/io) src/Stream/api.ts";
223
222
  const aggregateAsyncWithin = exports.aggregateAsyncWithin = aggregateAsyncWithin_1;
224
223
  const aggregateAsyncWithinEither = exports.aggregateAsyncWithinEither = aggregateAsyncWithinEither_1;
225
- const zipRight = exports.zipRight = zipRight_1;
226
224
  const asyncInterrupt = exports.asyncInterrupt = asyncInterrupt_1;
227
225
  const asyncMaybe = exports.asyncMaybe = asyncMaybe_1;
228
226
  const broadcastedQueues = exports.broadcastedQueues = broadcastedQueues_1;
229
227
  const broadcastedQueuesDynamic = exports.broadcastedQueuesDynamic = broadcastedQueuesDynamic_1;
230
228
  const catchAll = exports.catchAll = catchAll_1;
231
229
  const catchAllCause = exports.catchAllCause = catchAllCause_1;
232
- const flatMap = exports.flatMap = flatMap_1;
233
230
  const chunks = exports.chunks = chunks_1;
234
231
  const concat = exports.concat = concat_1;
235
232
  const crossWith = exports.crossWith = crossWith_1;
@@ -238,20 +235,21 @@ const distributedWithDynamic = exports.distributedWithDynamic = distributedWithD
238
235
  const drain = exports.drain = drain_1;
239
236
  const drop = exports.drop = drop_1;
240
237
  const dropWhile = exports.dropWhile = dropWhile_1;
238
+ const flatMap = exports.flatMap = flatMap_1;
239
+ const zipRight = exports.zipRight = zipRight_1;
241
240
  const ensuring = exports.ensuring = ensuring_1;
242
241
  const environment = exports.environment = environment_1;
243
242
  const execute = exports.execute = execute_1;
244
- const failNow = exports.failNow = failNow_1;
245
243
  const failCauseNow = exports.failCauseNow = failCauseNow_1;
244
+ const failNow = exports.failNow = failNow_1;
246
245
  const filterMap = exports.filterMap = filterMap_1;
247
246
  const flatten = exports.flatten = flatten_1;
247
+ const flattenChunks = exports.flattenChunks = flattenChunks_1;
248
248
  const flattenExitOption = exports.flattenExitOption = flattenExitOption_1;
249
249
  const flattenTake = exports.flattenTake = flattenTake_1;
250
- const flattenChunks = exports.flattenChunks = flattenChunks_1;
251
250
  const forever = exports.forever = forever_1;
252
- const fromChunkNow = exports.fromChunkNow = fromChunkNow_1;
253
251
  const fromChunk = exports.fromChunk = fromChunk_1;
254
- const scoped = exports.scoped = scoped_1;
252
+ const fromChunkNow = exports.fromChunkNow = fromChunkNow_1;
255
253
  const fromIO = exports.fromIO = fromIO_1;
256
254
  const fromIOMaybe = exports.fromIOMaybe = fromIOMaybe_1;
257
255
  const fromPull = exports.fromPull = fromPull_1;
@@ -267,24 +265,25 @@ const mapConcatChunk = exports.mapConcatChunk = mapConcatChunk_1;
267
265
  const mapError = exports.mapError = mapError_1;
268
266
  const mapIO = exports.mapIO = mapIO_1;
269
267
  const merge = exports.merge = merge_1;
270
- const mergeMap = exports.mergeMap = mergeMap_1;
271
268
  const mergeEither = exports.mergeEither = mergeEither_1;
269
+ const mergeMap = exports.mergeMap = mergeMap_1;
272
270
  const mergeWith = exports.mergeWith = mergeWith_1;
273
271
  const orElse = exports.orElse = orElse_1;
274
272
  const pipeThrough = exports.pipeThrough = pipeThrough_1;
275
273
  const pipeThroughChannelOrFail = exports.pipeThroughChannelOrFail = pipeThroughChannelOrFail_1;
276
274
  const provideEnvironment = exports.provideEnvironment = provideEnvironment_1;
277
275
  const provideLayer = exports.provideLayer = provideLayer_1;
278
- const repeatIOMaybe = exports.repeatIOMaybe = repeatIOMaybe_1;
279
276
  const repeatIOChunkMaybe = exports.repeatIOChunkMaybe = repeatIOChunkMaybe_1;
277
+ const repeatIOMaybe = exports.repeatIOMaybe = repeatIOMaybe_1;
280
278
  const run = exports.run = run_1;
281
279
  const runForeachScoped = exports.runForeachScoped = runForeachScoped_1;
282
- const runIntoQueueScoped = exports.runIntoQueueScoped = runIntoQueueScoped_1;
283
- const runIntoQueueElementsScoped = exports.runIntoQueueElementsScoped = runIntoQueueElementsScoped_1;
284
280
  const runIntoHubScoped = exports.runIntoHubScoped = runIntoHubScoped_1;
281
+ const runIntoQueueElementsScoped = exports.runIntoQueueElementsScoped = runIntoQueueElementsScoped_1;
282
+ const runIntoQueueScoped = exports.runIntoQueueScoped = runIntoQueueScoped_1;
285
283
  const runScoped = exports.runScoped = runScoped_1;
286
284
  const scanIO = exports.scanIO = scanIO_1;
287
285
  const scanReduceIO = exports.scanReduceIO = scanReduceIO_1;
286
+ const scoped = exports.scoped = scoped_1;
288
287
  const succeedNow = exports.succeedNow = succeedNow_1;
289
288
  const tap = exports.tap = tap_1;
290
289
  const tapError = exports.tapError = tapError_1;
@@ -294,9 +293,9 @@ const toPull = exports.toPull = toPull_1;
294
293
  const toQueue = exports.toQueue = toQueue_1;
295
294
  const toQueueOfElements = exports.toQueueOfElements = toQueueOfElements_1;
296
295
  const toQueueUnbounded = exports.toQueueUnbounded = toQueueUnbounded_1;
296
+ const unfoldChunk = exports.unfoldChunk = unfoldChunk_1;
297
297
  const unfoldChunkIO = exports.unfoldChunkIO = unfoldChunkIO_1;
298
298
  const unfoldIO = exports.unfoldIO = unfoldIO_1;
299
- const unfoldChunk = exports.unfoldChunk = unfoldChunk_1;
300
299
  const unwrap = exports.unwrap = unwrap_1;
301
300
  const unwrapScoped = exports.unwrapScoped = unwrapScoped_1;
302
301
  /**
@@ -307,6 +306,24 @@ const unwrapScoped = exports.unwrapScoped = unwrapScoped_1;
307
306
  function absolve(self, __tsplusTrace) {
308
307
  return mapIO_1(either => tsplus_module_1.fromEither(() => either, __tsplusTrace), __tsplusTrace)(self);
309
308
  }
309
+ /**
310
+ * Creates a stream from a single value that will get cleaned up after the
311
+ * stream is consumed
312
+ *
313
+ * @tsplus static fncts.io.StreamOps acquireRelease
314
+ */
315
+ function acquireRelease(acquire, release, __tsplusTrace) {
316
+ return scoped_1(() => tsplus_module_2.acquireRelease(() => acquire, release, __tsplusTrace), __tsplusTrace);
317
+ }
318
+ /**
319
+ * Creates a stream from a single value that will get cleaned up after the
320
+ * stream is consumed
321
+ *
322
+ * @tsplus static fncts.io.StreamOps acquireReleaseExit
323
+ */
324
+ function acquireReleaseExit(acquire, release, __tsplusTrace) {
325
+ return scoped_1(() => tsplus_module_3.acquireReleaseExit(() => acquire, release, __tsplusTrace), __tsplusTrace);
326
+ }
310
327
  /**
311
328
  * Aggregates elements of this stream using the provided sink for as long
312
329
  * as the downstream operators on the stream are busy.
@@ -323,7 +340,7 @@ function absolve(self, __tsplusTrace) {
323
340
  */
324
341
  function aggregateAsync(sink, __tsplusTrace) {
325
342
  return stream => {
326
- return aggregateAsyncWithin_1(sink, tsplus_module_2.forever, __tsplusTrace)(stream);
343
+ return aggregateAsyncWithin_1(sink, tsplus_module_4.forever, __tsplusTrace)(stream);
327
344
  };
328
345
  }
329
346
  /**
@@ -333,7 +350,7 @@ function aggregateAsync(sink, __tsplusTrace) {
333
350
  */
334
351
  function aggregateAsyncWithin_1(sink, schedule, __tsplusTrace) {
335
352
  return stream => {
336
- return filterMap_1(cb => tsplus_module_4.match(() => tsplus_module_3.nothing(__tsplusTrace), tsplus_module_3.just)(cb), __tsplusTrace)(aggregateAsyncWithinEither_1(sink, schedule, __tsplusTrace)(stream));
353
+ return filterMap_1(cb => tsplus_module_6.match(() => tsplus_module_5.nothing(__tsplusTrace), tsplus_module_5.just)(cb), __tsplusTrace)(aggregateAsyncWithinEither_1(sink, schedule, __tsplusTrace)(stream));
337
354
  };
338
355
  }
339
356
  /**
@@ -352,76 +369,52 @@ function aggregateAsyncWithin_1(sink, schedule, __tsplusTrace) {
352
369
  */
353
370
  function aggregateAsyncWithinEither_1(sink, schedule, __tsplusTrace) {
354
371
  return stream => {
355
- const deps = tsplus_module_9.sequenceT(tsplus_module_5.make(), tsplus_module_6.make(() => new _SinkEndReason2.ScheduleEnd(), __tsplusTrace), tsplus_module_6.make(() => tsplus_module_7.empty(), __tsplusTrace), tsplus_module_8.driver(schedule, __tsplusTrace), tsplus_module_6.make(() => false, __tsplusTrace));
372
+ const deps = tsplus_module_11.all([tsplus_module_7.make(), tsplus_module_8.make(() => new _SinkEndReason2.ScheduleEnd(), __tsplusTrace), tsplus_module_8.make(() => tsplus_module_9.empty(), __tsplusTrace), tsplus_module_10.driver(schedule, __tsplusTrace), tsplus_module_8.make(() => false, __tsplusTrace)]);
356
373
  return flatMap_1(([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed]) => {
357
- const handoffProducer = tsplus_module_10.readWithCause(_in => tsplus_module_11.zipRight(handoffProducer)(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.emit(_in))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff)), _ => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.end(new _SinkEndReason2.UpstreamEnd()))(handoff)));
358
- const handoffConsumer = tsplus_module_10.unwrap(() => tsplus_module_1.flatMap(leftovers => {
359
- if (tsplus_module_12.isNonEmpty(leftovers)) {
360
- return tsplus_module_1.zipRight(tsplus_module_1.succeedNow(tsplus_module_11.zipRight(handoffConsumer)(tsplus_module_10.writeNow(leftovers)), __tsplusTrace), __tsplusTrace)(tsplus_module_13.set(true, __tsplusTrace)(consumed));
374
+ const handoffProducer = tsplus_module_12.readWithCause(_in => tsplus_module_13.zipRight(handoffProducer)(tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_7.emit(_in))(handoff))), cause => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_7.halt(cause))(handoff)), _ => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_7.end(new _SinkEndReason2.UpstreamEnd()))(handoff)));
375
+ const handoffConsumer = tsplus_module_12.unwrap(() => tsplus_module_1.flatMap(leftovers => {
376
+ if (tsplus_module_14.isNonEmpty(leftovers)) {
377
+ return tsplus_module_1.zipRight(tsplus_module_1.succeedNow(tsplus_module_13.zipRight(handoffConsumer)(tsplus_module_12.writeNow(leftovers)), __tsplusTrace), __tsplusTrace)(tsplus_module_15.set(true, __tsplusTrace)(consumed));
361
378
  } else {
362
- return tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
379
+ return tsplus_module_1.map(signal => tsplus_module_7.matchSignal({
363
380
  Emit: ({
364
381
  els
365
- }) => tsplus_module_11.zipRight(handoffConsumer)(tsplus_module_11.zipRight(tsplus_module_10.writeNow(els))(tsplus_module_10.fromIO(() => tsplus_module_13.set(true, __tsplusTrace)(consumed)))),
382
+ }) => tsplus_module_13.zipRight(handoffConsumer)(tsplus_module_13.zipRight(tsplus_module_12.writeNow(els))(tsplus_module_12.fromIO(() => tsplus_module_15.set(true, __tsplusTrace)(consumed)))),
366
383
  Halt: ({
367
384
  error
368
- }) => tsplus_module_11.failCause(() => error),
385
+ }) => tsplus_module_13.failCause(() => error),
369
386
  End: ({
370
387
  reason
371
388
  }) => {
372
389
  if (reason._tag === "ScheduleEnd" /* SinkEndReasonTag.ScheduleEnd */) {
373
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_10.fromIO(() => tsplus_module_13.set(new _SinkEndReason2.ScheduleEnd(), __tsplusTrace)(sinkEndReason)) : tsplus_module_11.zipRight(handoffConsumer)(tsplus_module_10.fromIO(() => tsplus_module_13.set(new _SinkEndReason2.ScheduleEnd(), __tsplusTrace)(sinkEndReason))), __tsplusTrace)(tsplus_module_14.get(consumed, __tsplusTrace)));
390
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_12.fromIO(() => tsplus_module_15.set(new _SinkEndReason2.ScheduleEnd(), __tsplusTrace)(sinkEndReason)) : tsplus_module_13.zipRight(handoffConsumer)(tsplus_module_12.fromIO(() => tsplus_module_15.set(new _SinkEndReason2.ScheduleEnd(), __tsplusTrace)(sinkEndReason))), __tsplusTrace)(tsplus_module_16.get(consumed, __tsplusTrace)));
374
391
  } else {
375
- return tsplus_module_10.fromIO(() => tsplus_module_13.set(reason, __tsplusTrace)(sinkEndReason));
392
+ return tsplus_module_12.fromIO(() => tsplus_module_15.set(reason, __tsplusTrace)(sinkEndReason));
376
393
  }
377
394
  }
378
- })(signal), __tsplusTrace)(tsplus_module_5.take(handoff));
395
+ })(signal), __tsplusTrace)(tsplus_module_7.take(handoff));
379
396
  }
380
- }, __tsplusTrace)(tsplus_module_15.getAndSet(tsplus_module_7.empty(), __tsplusTrace)(sinkLeftovers)));
397
+ }, __tsplusTrace)(tsplus_module_17.getAndSet(tsplus_module_9.empty(), __tsplusTrace)(sinkLeftovers)));
381
398
  function timeout(lastB, __tsplusTrace) {
382
399
  return scheduleDriver.next(lastB, __tsplusTrace);
383
400
  }
384
401
  const scheduledAggregator = (sinkFiber, scheduleFiber) => {
385
- const forkSink = tsplus_module_1.zipRight(tsplus_module_17.forkScoped(tsplus_module_16.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace), __tsplusTrace)(tsplus_module_13.set(false, __tsplusTrace)(consumed));
402
+ const forkSink = tsplus_module_1.zipRight(tsplus_module_19.forkScoped(tsplus_module_18.runScoped(tsplus_module_12.doneCollect(tsplus_module_12.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace), __tsplusTrace)(tsplus_module_15.set(false, __tsplusTrace)(consumed));
386
403
  function handleSide(leftovers, b, c, __tsplusTrace) {
387
- return tsplus_module_10.unwrap(() => tsplus_module_1.zipRight(tsplus_module_1.map(reason => tsplus_module_21.matchSinkEndReason({
388
- ScheduleEnd: () => tsplus_module_10.unwrapScoped(() => tsplus_module_1.flatMap(consumed_ => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => {
389
- const toWrite = tsplus_module_20.match(() => tsplus_module_19.make(tsplus_module_18.right(b, __tsplusTrace)), c => tsplus_module_19.make(tsplus_module_18.right(b, __tsplusTrace), tsplus_module_18.left(c, __tsplusTrace)))(c);
390
- return consumed_ ? tsplus_module_11.zipRight(scheduledAggregator(sinkFiber, scheduleFiber))(tsplus_module_10.write(() => toWrite)) : scheduledAggregator(sinkFiber, scheduleFiber);
391
- }, __tsplusTrace)(tsplus_module_17.forkScoped(timeout(tsplus_module_3.just(b, __tsplusTrace), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(forkSink), __tsplusTrace)(tsplus_module_14.get(consumed, __tsplusTrace))),
392
- UpstreamEnd: () => tsplus_module_10.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_10.write(() => tsplus_module_19.make(tsplus_module_18.right(b, __tsplusTrace))) : tsplus_module_10.unit, __tsplusTrace)(tsplus_module_14.get(consumed, __tsplusTrace)))
393
- })(reason), __tsplusTrace)(tsplus_module_14.get(sinkEndReason, __tsplusTrace)), __tsplusTrace)(tsplus_module_13.set(tsplus_module_12.flatten(leftovers), __tsplusTrace)(sinkLeftovers)));
404
+ return tsplus_module_12.unwrap(() => tsplus_module_1.zipRight(tsplus_module_1.map(reason => tsplus_module_23.matchSinkEndReason({
405
+ ScheduleEnd: () => tsplus_module_12.unwrapScoped(() => tsplus_module_1.flatMap(consumed_ => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => {
406
+ const toWrite = tsplus_module_22.match(() => tsplus_module_21.make(tsplus_module_20.right(b, __tsplusTrace)), c => tsplus_module_21.make(tsplus_module_20.right(b, __tsplusTrace), tsplus_module_20.left(c, __tsplusTrace)))(c);
407
+ return consumed_ ? tsplus_module_13.zipRight(scheduledAggregator(sinkFiber, scheduleFiber))(tsplus_module_12.write(() => toWrite)) : scheduledAggregator(sinkFiber, scheduleFiber);
408
+ }, __tsplusTrace)(tsplus_module_19.forkScoped(timeout(tsplus_module_5.just(b, __tsplusTrace), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(forkSink), __tsplusTrace)(tsplus_module_16.get(consumed, __tsplusTrace))),
409
+ UpstreamEnd: () => tsplus_module_12.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_12.write(() => tsplus_module_21.make(tsplus_module_20.right(b, __tsplusTrace))) : tsplus_module_12.unit, __tsplusTrace)(tsplus_module_16.get(consumed, __tsplusTrace)))
410
+ })(reason), __tsplusTrace)(tsplus_module_16.get(sinkEndReason, __tsplusTrace)), __tsplusTrace)(tsplus_module_15.set(tsplus_module_14.flatten(leftovers), __tsplusTrace)(sinkLeftovers)));
394
411
  }
395
- return tsplus_module_10.unwrap(() => tsplus_module_26.raceWith(() => tsplus_module_22.join(scheduleFiber, __tsplusTrace), (sinkExit, scheduleFiber) => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_1.fromExit(() => sinkExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_23.interrupt(scheduleFiber)), (scheduleExit, sinkFiber) => tsplus_module_1.matchCauseIO(cause => tsplus_module_4.match(() => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_5.offer(tsplus_module_5.end(new _SinkEndReason2.ScheduleEnd()))(handoff), __tsplusTrace)), cause => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff), __tsplusTrace)))(tsplus_module_25.failureOrCause(cause)), c => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.just(c, __tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_5.offer(tsplus_module_5.end(new _SinkEndReason2.ScheduleEnd()))(handoff), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fromExit(() => scheduleExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)));
412
+ return tsplus_module_12.unwrap(() => tsplus_module_28.raceWith(() => tsplus_module_24.join(scheduleFiber, __tsplusTrace), (sinkExit, scheduleFiber) => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_1.fromExit(() => sinkExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_25.interrupt(scheduleFiber)), (scheduleExit, sinkFiber) => tsplus_module_1.matchCauseIO(cause => tsplus_module_6.match(() => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_24.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_26.forkDaemon(tsplus_module_7.offer(tsplus_module_7.end(new _SinkEndReason2.ScheduleEnd()))(handoff), __tsplusTrace)), cause => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_24.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_26.forkDaemon(tsplus_module_7.offer(tsplus_module_7.halt(cause))(handoff), __tsplusTrace)))(tsplus_module_27.failureOrCause(cause)), c => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_5.just(c, __tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_24.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_26.forkDaemon(tsplus_module_7.offer(tsplus_module_7.end(new _SinkEndReason2.ScheduleEnd()))(handoff), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fromExit(() => scheduleExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.join(sinkFiber, __tsplusTrace)));
396
413
  };
397
- return unwrapScoped_1(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => new _definition4.Stream(scheduledAggregator(sinkFiber, scheduleFiber)), __tsplusTrace)(tsplus_module_17.forkScoped(timeout(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_17.forkScoped(tsplus_module_16.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace)), __tsplusTrace)(tsplus_module_17.forkScoped(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(handoffProducer)(stream.channel)), __tsplusTrace)), __tsplusTrace);
414
+ return unwrapScoped_1(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => new _definition4.Stream(scheduledAggregator(sinkFiber, scheduleFiber)), __tsplusTrace)(tsplus_module_19.forkScoped(timeout(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_19.forkScoped(tsplus_module_18.runScoped(tsplus_module_12.doneCollect(tsplus_module_12.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace)), __tsplusTrace)(tsplus_module_19.forkScoped(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(handoffProducer)(stream.channel)), __tsplusTrace)), __tsplusTrace);
398
415
  }, __tsplusTrace)(fromIO_1(deps, __tsplusTrace));
399
416
  };
400
417
  }
401
- /**
402
- * Composes this stream with the specified stream to create a cartesian product of elements,
403
- * but keeps only elements from this stream.
404
- * The `that` stream would be run multiple times, for every element in the `this` stream.
405
- *
406
- * @tsplus pipeable fncts.io.Stream zipLeft
407
- */
408
- function zipLeft(that, __tsplusTrace) {
409
- return stream => {
410
- return crossWith_1(that, (a, _) => a, __tsplusTrace)(stream);
411
- };
412
- }
413
- /**
414
- * Composes this stream with the specified stream to create a cartesian product of elements,
415
- * but keeps only elements from the other stream.
416
- * The `that` stream would be run multiple times, for every element in the `this` stream.
417
- *
418
- * @tsplus pipeable fncts.io.Stream zipRight
419
- */
420
- function zipRight_1(that, __tsplusTrace) {
421
- return stream => {
422
- return crossWith_1(that, (_, b) => b, __tsplusTrace)(stream);
423
- };
424
- }
425
418
  /**
426
419
  * Maps the success values of this stream to the specified constant value.
427
420
  *
@@ -432,57 +425,57 @@ function as(b, __tsplusTrace) {
432
425
  return map_1(() => b(), __tsplusTrace)(stream);
433
426
  };
434
427
  }
428
+ /**
429
+ * @tsplus static fncts.io.StreamOps async
430
+ */
431
+ function async(register, outputBuffer = 16, __tsplusTrace) {
432
+ return asyncMaybe_1(cb => {
433
+ register(cb);
434
+ return tsplus_module_5.nothing(__tsplusTrace);
435
+ }, outputBuffer, __tsplusTrace);
436
+ }
435
437
  /**
436
438
  * @tsplus static fncts.io.StreamOps asyncInterrupt
437
439
  */
438
440
  function asyncInterrupt_1(register, outputBuffer = 16, __tsplusTrace) {
439
- return unwrapScoped_1(tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(eitherStream => tsplus_module_4.match(canceler => {
440
- const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), as => tsplus_module_11.zipRight(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_28.take(output, __tsplusTrace))));
441
+ return unwrapScoped_1(tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(eitherStream => tsplus_module_6.match(canceler => {
442
+ const loop = tsplus_module_12.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_22.match(() => tsplus_module_13.endNow(undefined), tsplus_module_12.failNow)(maybeError), as => tsplus_module_13.zipRight(loop)(tsplus_module_12.writeNow(as)), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_29.done(take), __tsplusTrace)(tsplus_module_30.take(output, __tsplusTrace))));
441
443
  return ensuring_1(canceler, __tsplusTrace)(new _definition4.Stream(loop));
442
- }, stream => unwrap_1(tsplus_module_1.as(() => stream, __tsplusTrace)(tsplus_module_28.shutdown(output, __tsplusTrace)), __tsplusTrace))(eitherStream), __tsplusTrace)(tsplus_module_1.succeed(() => register((k, cb) => {
443
- const effect = tsplus_module_1.flatMap(a => tsplus_module_28.offer(a, __tsplusTrace)(output), __tsplusTrace)(tsplus_module_27.fromPull(k));
444
+ }, stream => unwrap_1(tsplus_module_1.as(() => stream, __tsplusTrace)(tsplus_module_30.shutdown(output, __tsplusTrace)), __tsplusTrace))(eitherStream), __tsplusTrace)(tsplus_module_1.succeed(() => register((k, cb) => {
445
+ const effect = tsplus_module_1.flatMap(a => tsplus_module_30.offer(a, __tsplusTrace)(output), __tsplusTrace)(tsplus_module_29.fromPull(k));
444
446
  const fiber = runtime.makeFiber(effect, __tsplusTrace);
445
447
  if (cb) {
446
448
  fiber.addObserver(cb);
447
449
  }
448
450
  fiber.start(effect);
449
- }), __tsplusTrace)), __tsplusTrace)(tsplus_module_29.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(outputBuffer, __tsplusTrace), queue => tsplus_module_28.shutdown(queue, __tsplusTrace), __tsplusTrace)), __tsplusTrace);
450
- }
451
- /**
452
- * Creates a stream from an asynchronous callback that can be called multiple times.
453
- * The registration of the callback can possibly return the stream synchronously.
454
- * The optionality of the error type `E` can be used to signal the end of the stream,
455
- * by setting it to `None`.
456
- *
457
- * @tsplus static fncts.io.StreamOps asyncMaybe
458
- */
459
- function asyncMaybe_1(register, outputBuffer = 16, __tsplusTrace) {
460
- return asyncInterrupt_1(k => tsplus_module_20.match(() => tsplus_module_18.left(tsplus_module_1.unit, __tsplusTrace), tsplus_module_18.right)(register(k)), outputBuffer, __tsplusTrace);
461
- }
462
- /**
463
- * @tsplus static fncts.io.StreamOps async
464
- */
465
- function async(register, outputBuffer = 16, __tsplusTrace) {
466
- return asyncMaybe_1(cb => {
467
- register(cb);
468
- return tsplus_module_3.nothing(__tsplusTrace);
469
- }, outputBuffer, __tsplusTrace);
451
+ }), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeBounded(outputBuffer, __tsplusTrace), queue => tsplus_module_30.shutdown(queue, __tsplusTrace), __tsplusTrace)), __tsplusTrace);
470
452
  }
471
453
  /**
472
454
  * @tsplus static fncts.io.StreamOps asyncIO
473
455
  */
474
456
  function asyncIO(register, outputBuffer = 16, __tsplusTrace) {
475
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(() => {
476
- const loop = tsplus_module_10.unwrap(() => tsplus_module_1.matchCauseIO(cause => tsplus_module_1.as(() => tsplus_module_4.match(maybeError => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), tsplus_module_11.failCauseNow)(tsplus_module_25.failureOrCause(cause)), __tsplusTrace)(tsplus_module_28.shutdown(output, __tsplusTrace)), as => tsplus_module_1.succeed(() => tsplus_module_11.zipRight(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_28.take(output, __tsplusTrace))));
457
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(() => {
458
+ const loop = tsplus_module_12.unwrap(() => tsplus_module_1.matchCauseIO(cause => tsplus_module_1.as(() => tsplus_module_6.match(maybeError => tsplus_module_22.match(() => tsplus_module_13.endNow(undefined), tsplus_module_12.failNow)(maybeError), tsplus_module_13.failCauseNow)(tsplus_module_27.failureOrCause(cause)), __tsplusTrace)(tsplus_module_30.shutdown(output, __tsplusTrace)), as => tsplus_module_1.succeed(() => tsplus_module_13.zipRight(loop)(tsplus_module_12.writeNow(as)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_29.done(take), __tsplusTrace)(tsplus_module_30.take(output, __tsplusTrace))));
477
459
  return loop;
478
460
  }, __tsplusTrace)(register((k, cb) => {
479
- const io = tsplus_module_1.flatMap(a => tsplus_module_28.offer(a, __tsplusTrace)(output), __tsplusTrace)(tsplus_module_27.fromPull(k));
461
+ const io = tsplus_module_1.flatMap(a => tsplus_module_30.offer(a, __tsplusTrace)(output), __tsplusTrace)(tsplus_module_29.fromPull(k));
480
462
  const fiber = runtime.makeFiber(io, __tsplusTrace);
481
463
  if (cb) {
482
464
  fiber.addObserver(cb);
483
465
  }
484
466
  fiber.start(io);
485
- })), __tsplusTrace)(tsplus_module_29.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(outputBuffer, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace))));
467
+ })), __tsplusTrace)(tsplus_module_31.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeBounded(outputBuffer, __tsplusTrace), _ => tsplus_module_30.shutdown(_, __tsplusTrace), __tsplusTrace))));
468
+ }
469
+ /**
470
+ * Creates a stream from an asynchronous callback that can be called multiple times.
471
+ * The registration of the callback can possibly return the stream synchronously.
472
+ * The optionality of the error type `E` can be used to signal the end of the stream,
473
+ * by setting it to `None`.
474
+ *
475
+ * @tsplus static fncts.io.StreamOps asyncMaybe
476
+ */
477
+ function asyncMaybe_1(register, outputBuffer = 16, __tsplusTrace) {
478
+ return asyncInterrupt_1(k => tsplus_module_22.match(() => tsplus_module_20.left(tsplus_module_1.unit, __tsplusTrace), tsplus_module_20.right)(register(k)), outputBuffer, __tsplusTrace);
486
479
  }
487
480
  /**
488
481
  * Returns a stream whose failure and success channels have been mapped by
@@ -493,24 +486,6 @@ function asyncIO(register, outputBuffer = 16, __tsplusTrace) {
493
486
  function bimap(f, g, __tsplusTrace) {
494
487
  return stream => map_1(g, __tsplusTrace)(mapError_1(f, __tsplusTrace)(stream));
495
488
  }
496
- /**
497
- * Creates a stream from a single value that will get cleaned up after the
498
- * stream is consumed
499
- *
500
- * @tsplus static fncts.io.StreamOps acquireRelease
501
- */
502
- function acquireRelease(acquire, release, __tsplusTrace) {
503
- return scoped_1(() => tsplus_module_31.acquireRelease(() => acquire, release, __tsplusTrace), __tsplusTrace);
504
- }
505
- /**
506
- * Creates a stream from a single value that will get cleaned up after the
507
- * stream is consumed
508
- *
509
- * @tsplus static fncts.io.StreamOps acquireReleaseExit
510
- */
511
- function acquireReleaseExit(acquire, release, __tsplusTrace) {
512
- return scoped_1(() => tsplus_module_32.acquireReleaseExit(() => acquire, release, __tsplusTrace), __tsplusTrace);
513
- }
514
489
  /**
515
490
  * Fan out the stream, producing a list of streams that have the same elements as this stream.
516
491
  * The driver stream will only ever advance of the `maximumLag` chunks before the
@@ -520,7 +495,7 @@ function acquireReleaseExit(acquire, release, __tsplusTrace) {
520
495
  */
521
496
  function broadcast(n, maximumLag, __tsplusTrace) {
522
497
  return stream => {
523
- return tsplus_module_1.map(c => tsplus_module_12.map(hub => flattenTake_1(fromQueueWithShutdown_1(hub), __tsplusTrace))(c), __tsplusTrace)(broadcastedQueues_1(n, maximumLag, __tsplusTrace)(stream));
498
+ return tsplus_module_1.map(c => tsplus_module_14.map(hub => flattenTake_1(fromQueueWithShutdown_1(hub), __tsplusTrace))(c), __tsplusTrace)(broadcastedQueues_1(n, maximumLag, __tsplusTrace)(stream));
524
499
  };
525
500
  }
526
501
  /**
@@ -570,8 +545,8 @@ function broadcastedQueuesDynamic_1(maximumLag, __tsplusTrace) {
570
545
  function buffer(capacity, __tsplusTrace) {
571
546
  return stream => {
572
547
  const queue = toQueueOfElements_1(capacity, __tsplusTrace)(stream);
573
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
574
- const process = tsplus_module_11.flatMap(exit => tsplus_module_36.match(cause => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow)(tsplus_module_25.flipCauseOption(cause)), value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(tsplus_module_19.single(value))))(exit))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
548
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(queue => {
549
+ const process = tsplus_module_13.flatMap(exit => tsplus_module_36.match(cause => tsplus_module_22.match(() => tsplus_module_13.endNow(undefined), tsplus_module_13.failCauseNow)(tsplus_module_27.flipCauseOption(cause)), value => tsplus_module_13.zipRight(process)(tsplus_module_12.writeNow(tsplus_module_21.single(value))))(exit))(tsplus_module_12.fromIO(() => tsplus_module_30.take(queue, __tsplusTrace)));
575
550
  return process;
576
551
  }, __tsplusTrace)(queue)));
577
552
  };
@@ -582,12 +557,20 @@ function buffer(capacity, __tsplusTrace) {
582
557
  function bufferChunks(capacity, __tsplusTrace) {
583
558
  return stream => {
584
559
  const queue = toQueue_1(capacity, __tsplusTrace)(stream);
585
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
586
- const process = tsplus_module_11.flatMap(take => tsplus_module_27.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
560
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(queue => {
561
+ const process = tsplus_module_13.flatMap(take => tsplus_module_29.match(tsplus_module_13.endNow(undefined), tsplus_module_13.failCauseNow, value => tsplus_module_13.zipRight(process)(tsplus_module_12.writeNow(value)))(take))(tsplus_module_12.fromIO(() => tsplus_module_30.take(queue, __tsplusTrace)));
587
562
  return process;
588
563
  }, __tsplusTrace)(queue)));
589
564
  };
590
565
  }
566
+ function bufferSignalConsumer(queue, __tsplusTrace) {
567
+ const process = tsplus_module_13.flatMap(([take, promise]) => tsplus_module_13.zipRight(tsplus_module_29.match(tsplus_module_13.endNow(undefined), tsplus_module_13.failCauseNow, value => tsplus_module_13.zipRight(process)(tsplus_module_12.writeNow(value)))(take))(tsplus_module_12.fromIO(() => tsplus_module_37.succeed_(undefined, __tsplusTrace)(promise))))(tsplus_module_12.fromIO(() => tsplus_module_30.take(queue, __tsplusTrace)));
568
+ return process;
569
+ }
570
+ function bufferSignalProducer(queue, ref, __tsplusTrace) {
571
+ const terminate = take => tsplus_module_12.fromIO(() => tsplus_module_1.flatMap(latch => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_37.wait(p, __tsplusTrace)), __tsplusTrace)(tsplus_module_15.set(p, __tsplusTrace)(ref)), __tsplusTrace)(tsplus_module_30.offer((0, _function.tuple)(take, p), __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace)), __tsplusTrace)(tsplus_module_37.wait(latch, __tsplusTrace)), __tsplusTrace)(tsplus_module_16.get(ref, __tsplusTrace)));
572
+ return tsplus_module_12.readWith(inp => tsplus_module_13.zipRight(bufferSignalProducer(queue, ref, __tsplusTrace))(tsplus_module_12.fromIO(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(added => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_1.when(() => added, __tsplusTrace)(tsplus_module_15.set(p, __tsplusTrace)(ref))), __tsplusTrace)(tsplus_module_30.offer((0, _function.tuple)(tsplus_module_29.chunk(inp), p), __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace)))), e => terminate(tsplus_module_29.fail(e)), () => terminate(tsplus_module_29.end));
573
+ }
591
574
  /**
592
575
  * Allows a faster producer to progress independently of a slower consumer by buffering
593
576
  * elements into an unbounded queue.
@@ -596,19 +579,11 @@ function bufferChunks(capacity, __tsplusTrace) {
596
579
  */
597
580
  function bufferUnbounded(stream, __tsplusTrace) {
598
581
  const queue = toQueueUnbounded_1(stream, __tsplusTrace);
599
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
600
- const process = tsplus_module_11.flatMap(take => tsplus_module_27.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
582
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(queue => {
583
+ const process = tsplus_module_13.flatMap(take => tsplus_module_29.match(tsplus_module_13.endNow(undefined), tsplus_module_13.failCauseNow, value => tsplus_module_13.zipRight(process)(tsplus_module_12.writeNow(value)))(take))(tsplus_module_12.fromIO(() => tsplus_module_30.take(queue, __tsplusTrace)));
601
584
  return process;
602
585
  }, __tsplusTrace)(queue)));
603
586
  }
604
- function bufferSignalProducer(queue, ref, __tsplusTrace) {
605
- const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(latch => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_37.wait(p, __tsplusTrace)), __tsplusTrace)(tsplus_module_13.set(p, __tsplusTrace)(ref)), __tsplusTrace)(tsplus_module_28.offer((0, _function.tuple)(take, p), __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace)), __tsplusTrace)(tsplus_module_37.wait(latch, __tsplusTrace)), __tsplusTrace)(tsplus_module_14.get(ref, __tsplusTrace)));
606
- return tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(bufferSignalProducer(queue, ref, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(added => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_1.when(() => added, __tsplusTrace)(tsplus_module_13.set(p, __tsplusTrace)(ref))), __tsplusTrace)(tsplus_module_28.offer((0, _function.tuple)(tsplus_module_27.chunk(inp), p), __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace)))), e => terminate(tsplus_module_27.fail(e)), () => terminate(tsplus_module_27.end));
607
- }
608
- function bufferSignalConsumer(queue, __tsplusTrace) {
609
- const process = tsplus_module_11.flatMap(([take, promise]) => tsplus_module_11.zipRight(tsplus_module_27.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_37.succeed_(undefined, __tsplusTrace)(promise))))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
610
- return process;
611
- }
612
587
  /**
613
588
  * Switches over to the stream produced by the provided function in case this one
614
589
  * fails with a typed error.
@@ -617,7 +592,7 @@ function bufferSignalConsumer(queue, __tsplusTrace) {
617
592
  */
618
593
  function catchAll_1(f, __tsplusTrace) {
619
594
  return stream => {
620
- return catchAllCause_1(cause => tsplus_module_4.match(f, failCauseNow_1)(tsplus_module_25.failureOrCause(cause)), __tsplusTrace)(stream);
595
+ return catchAllCause_1(cause => tsplus_module_6.match(f, failCauseNow_1)(tsplus_module_27.failureOrCause(cause)), __tsplusTrace)(stream);
621
596
  };
622
597
  }
623
598
  /**
@@ -629,7 +604,7 @@ function catchAll_1(f, __tsplusTrace) {
629
604
  */
630
605
  function catchAllCause_1(f, __tsplusTrace) {
631
606
  return stream => {
632
- const channel = tsplus_module_10.catchAllCause(cause => f(cause).channel)(stream.channel);
607
+ const channel = tsplus_module_12.catchAllCause(cause => f(cause).channel)(stream.channel);
633
608
  return new _definition4.Stream(channel);
634
609
  };
635
610
  }
@@ -657,23 +632,30 @@ function catchJustCause(pf, __tsplusTrace) {
657
632
  };
658
633
  }
659
634
  /**
660
- * Returns a stream made of the concatenation in strict order of all the streams
661
- * produced by passing each element of this stream to `f`
635
+ * Returns a new stream that only emits elements that are not equal to the
636
+ * previous element emitted, using the specified function to determine
637
+ * whether two elements are equal.
662
638
  *
663
- * @tsplus pipeable fncts.io.Stream flatMap
639
+ * @tsplus pipeable fncts.io.Stream changesWith
664
640
  */
665
- function flatMap_1(f, __tsplusTrace) {
641
+ function changesWith(f, __tsplusTrace) {
666
642
  return stream => {
667
- return new _definition4.Stream(tsplus_module_10.concatMap(as => tsplus_module_12.foldLeft(tsplus_module_10.unit, (s, a) => tsplus_module_11.flatMap(() => a)(s))(tsplus_module_12.map(a => f(a).channel)(as)))(stream.channel));
643
+ return new _definition4.Stream(tsplus_module_12.pipeTo(changesWithWriter(f, tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace))(stream.channel));
668
644
  };
669
645
  }
646
+ function changesWithWriter(f, last, __tsplusTrace) {
647
+ return tsplus_module_12.readWithCause(chunk => {
648
+ const [newLast, newChunk] = tsplus_module_14.foldLeft([last, tsplus_module_9.empty()], ([maybeLast, os], o1) => tsplus_module_22.match(() => [tsplus_module_5.just(o1, __tsplusTrace), tsplus_module_14.append(o1)(os)], o => f(o, o1) ? [tsplus_module_5.just(o1, __tsplusTrace), os] : [tsplus_module_5.just(o1, __tsplusTrace), tsplus_module_14.append(o1)(os)])(maybeLast))(chunk);
649
+ return tsplus_module_13.zipRight(changesWithWriter(f, newLast, __tsplusTrace))(tsplus_module_12.writeNow(newChunk));
650
+ }, tsplus_module_13.failCauseNow, () => tsplus_module_12.unit);
651
+ }
670
652
  /**
671
653
  * Exposes the underlying chunks of the stream as a stream of chunks of elements
672
654
  *
673
655
  * @tsplus getter fncts.io.Stream chunks
674
656
  */
675
657
  function chunks_1(stream, __tsplusTrace) {
676
- return mapChunks_1(tsplus_module_19.single, __tsplusTrace)(stream);
658
+ return mapChunks_1(tsplus_module_21.single, __tsplusTrace)(stream);
677
659
  }
678
660
  /**
679
661
  * Performs the specified stream transformation with the chunk structure of
@@ -686,24 +668,6 @@ function chunksWith(f, __tsplusTrace) {
686
668
  return flattenChunks_1(f(chunks_1(self, __tsplusTrace)), __tsplusTrace);
687
669
  };
688
670
  }
689
- function changesWithWriter(f, last, __tsplusTrace) {
690
- return tsplus_module_10.readWithCause(chunk => {
691
- const [newLast, newChunk] = tsplus_module_12.foldLeft([last, tsplus_module_7.empty()], ([maybeLast, os], o1) => tsplus_module_20.match(() => [tsplus_module_3.just(o1, __tsplusTrace), tsplus_module_12.append(o1)(os)], o => f(o, o1) ? [tsplus_module_3.just(o1, __tsplusTrace), os] : [tsplus_module_3.just(o1, __tsplusTrace), tsplus_module_12.append(o1)(os)])(maybeLast))(chunk);
692
- return tsplus_module_11.zipRight(changesWithWriter(f, newLast, __tsplusTrace))(tsplus_module_10.writeNow(newChunk));
693
- }, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
694
- }
695
- /**
696
- * Returns a new stream that only emits elements that are not equal to the
697
- * previous element emitted, using the specified function to determine
698
- * whether two elements are equal.
699
- *
700
- * @tsplus pipeable fncts.io.Stream changesWith
701
- */
702
- function changesWith(f, __tsplusTrace) {
703
- return stream => {
704
- return new _definition4.Stream(tsplus_module_10.pipeTo(changesWithWriter(f, tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace))(stream.channel));
705
- };
706
- }
707
671
  /**
708
672
  * Transforms all elements of the stream for as long as the specified partial function is defined.
709
673
  *
@@ -711,34 +675,31 @@ function changesWith(f, __tsplusTrace) {
711
675
  */
712
676
  function collectWhile(pf, __tsplusTrace) {
713
677
  return stream => {
714
- const loop = tsplus_module_10.readWith(inp => {
715
- const mapped = tsplus_module_12.collectWhile(pf)(inp);
678
+ const loop = tsplus_module_12.readWith(inp => {
679
+ const mapped = tsplus_module_14.collectWhile(pf)(inp);
716
680
  if (mapped.length === inp.length) {
717
- return tsplus_module_11.zipRight(loop)(tsplus_module_10.writeNow(mapped));
681
+ return tsplus_module_13.zipRight(loop)(tsplus_module_12.writeNow(mapped));
718
682
  } else {
719
- return tsplus_module_10.writeNow(mapped);
683
+ return tsplus_module_12.writeNow(mapped);
720
684
  }
721
- }, tsplus_module_10.failNow, tsplus_module_11.succeedNow);
722
- return new _definition4.Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
685
+ }, tsplus_module_12.failNow, tsplus_module_13.succeedNow);
686
+ return new _definition4.Stream(tsplus_module_12.pipeTo(loop)(stream.channel));
723
687
  };
724
688
  }
725
689
  /**
726
690
  * Effectfully transforms all elements of the stream for as long as the specified partial function is defined.
727
691
  */
728
692
  function collectWhileIO(stream, pf, __tsplusTrace) {
729
- return new _definition4.Stream(tsplus_module_10.pipeTo(collectWhileIOLoop(tsplus_module_40.empty()[Symbol.iterator](), pf, __tsplusTrace))(stream.channel));
693
+ return new _definition4.Stream(tsplus_module_12.pipeTo(collectWhileIOLoop(tsplus_module_40.empty()[Symbol.iterator](), pf, __tsplusTrace))(stream.channel));
730
694
  }
731
695
  function collectWhileIOLoop(iterator, pf, __tsplusTrace) {
732
696
  const next = iterator.next();
733
697
  if (next.done) {
734
- return tsplus_module_10.readWithCause(elem => collectWhileIOLoop(elem[Symbol.iterator](), pf, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
698
+ return tsplus_module_12.readWithCause(elem => collectWhileIOLoop(elem[Symbol.iterator](), pf, __tsplusTrace), tsplus_module_13.failCauseNow, tsplus_module_13.succeedNow);
735
699
  } else {
736
- return tsplus_module_10.unwrap(() => tsplus_module_20.match(() => tsplus_module_1.succeedNow(tsplus_module_10.unit, __tsplusTrace), b => tsplus_module_1.map(b => tsplus_module_11.zipRight(collectWhileIOLoop(iterator, pf, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_19.single(b))), __tsplusTrace)(b))(pf(next.value)));
700
+ return tsplus_module_12.unwrap(() => tsplus_module_22.match(() => tsplus_module_1.succeedNow(tsplus_module_12.unit, __tsplusTrace), b => tsplus_module_1.map(b => tsplus_module_13.zipRight(collectWhileIOLoop(iterator, pf, __tsplusTrace))(tsplus_module_12.writeNow(tsplus_module_21.single(b))), __tsplusTrace)(b))(pf(next.value)));
737
701
  }
738
702
  }
739
- function combineProducer(handoff, latch, __tsplusTrace) {
740
- return tsplus_module_11.zipRight(tsplus_module_10.readWithCause(value => tsplus_module_11.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_41.succeed(value, __tsplusTrace))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_41.failCause(tsplus_module_25.map(tsplus_module_3.just)(cause), __tsplusTrace))(handoff)), () => tsplus_module_11.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_41.fail(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace))(handoff)))))(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)));
741
- }
742
703
  /**
743
704
  * Combines the elements from this stream and the specified stream by repeatedly applying the
744
705
  * function `f` to extract an element using both sides and conceptually "offer"
@@ -751,16 +712,13 @@ function combineProducer(handoff, latch, __tsplusTrace) {
751
712
  */
752
713
  function combine(that, s, f, __tsplusTrace) {
753
714
  return stream => {
754
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
755
- const pullLeft = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(left), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchL)));
756
- const pullRight = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(right), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchR)));
715
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
716
+ const pullLeft = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_7.take(left), __tsplusTrace)(tsplus_module_7.offer(undefined)(latchL)));
717
+ const pullRight = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_7.take(right), __tsplusTrace)(tsplus_module_7.offer(undefined)(latchR)));
757
718
  return unfoldIO_1(s, s => tsplus_module_1.flatMap(exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, __tsplusTrace), __tsplusTrace), __tsplusTrace)(f(s, pullLeft, pullRight)), __tsplusTrace).channel;
758
- }, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => (0, _function.tuple)(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineProducer(right, latchR, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(that.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineProducer(left, latchL, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
719
+ }, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => (0, _function.tuple)(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(combineProducer(right, latchR, __tsplusTrace))(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(that.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(combineProducer(left, latchL, __tsplusTrace))(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(stream.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()))));
759
720
  };
760
721
  }
761
- function combineChunksProducer(handoff, latch, __tsplusTrace) {
762
- return tsplus_module_11.zipRight(tsplus_module_10.readWithCause(chunk => tsplus_module_11.zipRight(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.chunk(chunk))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.failCause(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.end)(handoff))))(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)));
763
- }
764
722
  /**
765
723
  * Combines the chunks from this stream and the specified stream by repeatedly applying the
766
724
  * function `f` to extract a chunk using both sides and conceptually "offer"
@@ -771,13 +729,19 @@ function combineChunksProducer(handoff, latch, __tsplusTrace) {
771
729
  */
772
730
  function combineChunks(that, s, f, __tsplusTrace) {
773
731
  return stream => {
774
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
775
- const pullLeft = tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(left), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchL)));
776
- const pullRight = tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(right), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchR)));
732
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
733
+ const pullLeft = tsplus_module_1.flatMap(take => tsplus_module_29.done(take), __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_7.take(left), __tsplusTrace)(tsplus_module_7.offer(undefined)(latchL)));
734
+ const pullRight = tsplus_module_1.flatMap(take => tsplus_module_29.done(take), __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_7.take(right), __tsplusTrace)(tsplus_module_7.offer(undefined)(latchR)));
777
735
  return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap(exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, __tsplusTrace), __tsplusTrace), __tsplusTrace)(f(s, pullLeft, pullRight)), __tsplusTrace).channel;
778
- }, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => (0, _function.tuple)(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineChunksProducer(right, latchR, __tsplusTrace))(that.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineChunksProducer(left, latchL, __tsplusTrace))(stream.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
736
+ }, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => (0, _function.tuple)(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(combineChunksProducer(right, latchR, __tsplusTrace))(that.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(combineChunksProducer(left, latchL, __tsplusTrace))(stream.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()))));
779
737
  };
780
738
  }
739
+ function combineChunksProducer(handoff, latch, __tsplusTrace) {
740
+ return tsplus_module_13.zipRight(tsplus_module_12.readWithCause(chunk => tsplus_module_13.zipRight(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_29.chunk(chunk))(handoff))), cause => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_29.failCause(cause))(handoff)), () => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_29.end)(handoff))))(tsplus_module_12.fromIO(() => tsplus_module_7.take(latch)));
741
+ }
742
+ function combineProducer(handoff, latch, __tsplusTrace) {
743
+ return tsplus_module_13.zipRight(tsplus_module_12.readWithCause(value => tsplus_module_13.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_41.succeed(value, __tsplusTrace))(handoff))), cause => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_41.failCause(tsplus_module_27.map(tsplus_module_5.just)(cause), __tsplusTrace))(handoff)), () => tsplus_module_13.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_41.fail(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace))(handoff)))))(tsplus_module_12.fromIO(() => tsplus_module_7.take(latch)));
744
+ }
781
745
  /**
782
746
  * Concatenates the specified stream with this stream, resulting in a stream
783
747
  * that emits the elements from this stream and then the elements from the specified stream.
@@ -786,7 +750,18 @@ function combineChunks(that, s, f, __tsplusTrace) {
786
750
  */
787
751
  function concat_1(that, __tsplusTrace) {
788
752
  return stream => {
789
- return new _definition4.Stream(tsplus_module_11.zipRight(that.channel)(stream.channel));
753
+ return new _definition4.Stream(tsplus_module_13.zipRight(that.channel)(stream.channel));
754
+ };
755
+ }
756
+ /**
757
+ * Provides some of the environment required to run this effect,
758
+ * leaving the remainder `R0`.
759
+ *
760
+ * @tsplus pipeable fncts.io.Stream contramapEnvironment
761
+ */
762
+ function contramapEnvironment(f, __tsplusTrace) {
763
+ return ra => {
764
+ return flatMap_1(r0 => provideEnvironment_1(f(r0), __tsplusTrace)(ra), __tsplusTrace)(environment_1(__tsplusTrace));
790
765
  };
791
766
  }
792
767
  /**
@@ -797,7 +772,7 @@ function concat_1(that, __tsplusTrace) {
797
772
  */
798
773
  function cross(that, __tsplusTrace) {
799
774
  return stream => {
800
- return new _definition4.Stream(tsplus_module_10.concatMap(as => tsplus_module_10.mapOut(bs => tsplus_module_12.flatMap(a => tsplus_module_12.map(b => (0, _function.tuple)(a, b))(bs))(as))(that.channel))(stream.channel));
775
+ return new _definition4.Stream(tsplus_module_12.concatMap(as => tsplus_module_12.mapOut(bs => tsplus_module_14.flatMap(a => tsplus_module_14.map(b => (0, _function.tuple)(a, b))(bs))(as))(that.channel))(stream.channel));
801
776
  };
802
777
  }
803
778
  /**
@@ -812,17 +787,6 @@ function crossWith_1(fb, f, __tsplusTrace) {
812
787
  return flatMap_1(a => map_1(b => f(a, b), __tsplusTrace)(fb), __tsplusTrace)(fa);
813
788
  };
814
789
  }
815
- /**
816
- * Provides some of the environment required to run this effect,
817
- * leaving the remainder `R0`.
818
- *
819
- * @tsplus pipeable fncts.io.Stream contramapEnvironment
820
- */
821
- function contramapEnvironment(f, __tsplusTrace) {
822
- return ra => {
823
- return flatMap_1(r0 => provideEnvironment_1(f(r0), __tsplusTrace)(ra), __tsplusTrace)(environment_1(__tsplusTrace));
824
- };
825
- }
826
790
  /**
827
791
  * @tsplus pipeable fncts.io.Stream debounce
828
792
  */
@@ -830,57 +794,48 @@ function debounce(duration, __tsplusTrace) {
830
794
  return stream => {
831
795
  return unwrap_1(tsplus_module_44.transplant(grafter => tsplus_module_1.map(handoff => {
832
796
  function enqueue(last, __tsplusTrace) {
833
- return tsplus_module_1.map(f => consumer(tsplus_module_42.previous(f), __tsplusTrace), __tsplusTrace)(grafter(tsplus_module_33.fork(tsplus_module_1.as(() => last, __tsplusTrace)(tsplus_module_43.sleep(duration, __tsplusTrace)), __tsplusTrace)));
797
+ return tsplus_module_1.map(f => consumer(tsplus_module_42.previous(f), __tsplusTrace), __tsplusTrace)(grafter.graft(tsplus_module_33.fork(tsplus_module_1.as(() => last, __tsplusTrace)(tsplus_module_43.sleep(duration, __tsplusTrace)), __tsplusTrace), __tsplusTrace));
834
798
  }
835
- const producer = tsplus_module_10.readWithCause(inp => tsplus_module_20.match(() => producer, last => tsplus_module_11.zipRight(producer)(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.emit(tsplus_module_19.single(last)))(handoff))))(tsplus_module_12.last(inp)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.end(new _SinkEndReason2.UpstreamEnd()))(handoff)));
799
+ const producer = tsplus_module_12.readWithCause(inp => tsplus_module_22.match(() => producer, last => tsplus_module_13.zipRight(producer)(tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_7.emit(tsplus_module_21.single(last)))(handoff))))(tsplus_module_14.last(inp)), cause => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_7.halt(cause))(handoff)), () => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_7.end(new _SinkEndReason2.UpstreamEnd()))(handoff)));
836
800
  function consumer(state, __tsplusTrace) {
837
- return tsplus_module_10.unwrap(() => tsplus_module_42.match({
838
- NotStarted: () => tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
801
+ return tsplus_module_12.unwrap(() => tsplus_module_42.match({
802
+ NotStarted: () => tsplus_module_1.map(signal => tsplus_module_7.matchSignal({
839
803
  Emit: ({
840
804
  els
841
- }) => tsplus_module_10.unwrap(() => enqueue(els, __tsplusTrace)),
805
+ }) => tsplus_module_12.unwrap(() => enqueue(els, __tsplusTrace)),
842
806
  Halt: ({
843
807
  error
844
- }) => tsplus_module_11.failCauseNow(error),
845
- End: () => tsplus_module_10.unit
846
- })(signal), __tsplusTrace)(tsplus_module_5.take(handoff)),
808
+ }) => tsplus_module_13.failCauseNow(error),
809
+ End: () => tsplus_module_12.unit
810
+ })(signal), __tsplusTrace)(tsplus_module_7.take(handoff)),
847
811
  Current: ({
848
812
  fiber
849
- }) => tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
813
+ }) => tsplus_module_1.map(signal => tsplus_module_7.matchSignal({
850
814
  Emit: ({
851
815
  els
852
- }) => tsplus_module_10.unwrap(() => enqueue(els, __tsplusTrace)),
816
+ }) => tsplus_module_12.unwrap(() => enqueue(els, __tsplusTrace)),
853
817
  Halt: ({
854
818
  error
855
- }) => tsplus_module_11.failCauseNow(error),
856
- End: () => tsplus_module_10.unit
857
- })(signal), __tsplusTrace)(tsplus_module_22.join(fiber, __tsplusTrace)),
819
+ }) => tsplus_module_13.failCauseNow(error),
820
+ End: () => tsplus_module_12.unit
821
+ })(signal), __tsplusTrace)(tsplus_module_24.join(fiber, __tsplusTrace)),
858
822
  Previous: ({
859
823
  fiber
860
- }) => tsplus_module_26.raceWith(() => tsplus_module_5.take(handoff), (ex, current) => tsplus_module_36.match(cause => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(cause), __tsplusTrace)(tsplus_module_23.interrupt(current)), chunk => tsplus_module_1.succeedNow(tsplus_module_11.zipRight(consumer(tsplus_module_42.current(current), __tsplusTrace))(tsplus_module_10.writeNow(chunk)), __tsplusTrace))(ex), (ex, previous) => tsplus_module_36.match(cause => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(cause), __tsplusTrace)(tsplus_module_23.interrupt(previous)), signal => tsplus_module_5.matchSignal({
824
+ }) => tsplus_module_28.raceWith(() => tsplus_module_7.take(handoff), (ex, current) => tsplus_module_36.match(cause => tsplus_module_1.as(() => tsplus_module_13.failCauseNow(cause), __tsplusTrace)(tsplus_module_25.interrupt(current)), chunk => tsplus_module_1.succeedNow(tsplus_module_13.zipRight(consumer(tsplus_module_42.current(current), __tsplusTrace))(tsplus_module_12.writeNow(chunk)), __tsplusTrace))(ex), (ex, previous) => tsplus_module_36.match(cause => tsplus_module_1.as(() => tsplus_module_13.failCauseNow(cause), __tsplusTrace)(tsplus_module_25.interrupt(previous)), signal => tsplus_module_7.matchSignal({
861
825
  Emit: ({
862
826
  els
863
- }) => tsplus_module_1.zipRight(enqueue(els, __tsplusTrace), __tsplusTrace)(tsplus_module_23.interrupt(previous)),
827
+ }) => tsplus_module_1.zipRight(enqueue(els, __tsplusTrace), __tsplusTrace)(tsplus_module_25.interrupt(previous)),
864
828
  Halt: ({
865
829
  error
866
- }) => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(error), __tsplusTrace)(tsplus_module_23.interrupt(previous)),
867
- End: () => tsplus_module_1.map(chunk => tsplus_module_11.zipRight(tsplus_module_10.unit)(tsplus_module_10.writeNow(chunk)), __tsplusTrace)(tsplus_module_22.join(previous, __tsplusTrace))
868
- })(signal))(ex), __tsplusTrace)(tsplus_module_22.join(fiber, __tsplusTrace))
830
+ }) => tsplus_module_1.as(() => tsplus_module_13.failCauseNow(error), __tsplusTrace)(tsplus_module_25.interrupt(previous)),
831
+ End: () => tsplus_module_1.map(chunk => tsplus_module_13.zipRight(tsplus_module_12.unit)(tsplus_module_12.writeNow(chunk)), __tsplusTrace)(tsplus_module_24.join(previous, __tsplusTrace))
832
+ })(signal))(ex), __tsplusTrace)(tsplus_module_24.join(fiber, __tsplusTrace))
869
833
  })(state));
870
834
  }
871
- return zipRight_1(new _definition4.Stream(consumer(tsplus_module_42.notStarted, __tsplusTrace)), __tsplusTrace)(scoped_1(() => tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(producer)(stream.channel)), __tsplusTrace), __tsplusTrace));
872
- }, __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace), __tsplusTrace);
835
+ return zipRight_1(new _definition4.Stream(consumer(tsplus_module_42.notStarted, __tsplusTrace)), __tsplusTrace)(scoped_1(() => tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(producer)(stream.channel)), __tsplusTrace), __tsplusTrace));
836
+ }, __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace), __tsplusTrace);
873
837
  };
874
838
  }
875
- /**
876
- * @tsplus static fncts.io.StreamOps defer
877
- */
878
- function defer_1(self) {
879
- return new _definition4.Stream(tsplus_module_10.defer(() => self().channel));
880
- }
881
- function defaultIfEmptyWriter(fb, __tsplusTrace) {
882
- return tsplus_module_10.readWith(i => tsplus_module_12.isEmpty(i) ? defaultIfEmptyWriter(fb, __tsplusTrace) : tsplus_module_11.zipRight(tsplus_module_10.id())(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => fb.channel);
883
- }
884
839
  /**
885
840
  * Switches to the provided stream in case this one is empty.
886
841
  *
@@ -888,9 +843,18 @@ function defaultIfEmptyWriter(fb, __tsplusTrace) {
888
843
  */
889
844
  function defaultIfEmpty(fb, __tsplusTrace) {
890
845
  return fa => {
891
- return new _definition4.Stream(tsplus_module_10.pipeTo(defaultIfEmptyWriter(fb, __tsplusTrace))(fa.channel));
846
+ return new _definition4.Stream(tsplus_module_12.pipeTo(defaultIfEmptyWriter(fb, __tsplusTrace))(fa.channel));
892
847
  };
893
848
  }
849
+ function defaultIfEmptyWriter(fb, __tsplusTrace) {
850
+ return tsplus_module_12.readWith(i => tsplus_module_14.isEmpty(i) ? defaultIfEmptyWriter(fb, __tsplusTrace) : tsplus_module_13.zipRight(tsplus_module_12.id())(tsplus_module_12.writeNow(i)), tsplus_module_12.failNow, () => fb.channel);
851
+ }
852
+ /**
853
+ * @tsplus static fncts.io.StreamOps defer
854
+ */
855
+ function defer_1(self) {
856
+ return new _definition4.Stream(tsplus_module_12.defer(() => self().channel));
857
+ }
894
858
  /**
895
859
  * More powerful version of `broadcast`. Allows to provide a function that determines what
896
860
  * queues should receive which elements. The decide function will receive the indices of the queues
@@ -901,9 +865,9 @@ function defaultIfEmpty(fb, __tsplusTrace) {
901
865
  function distributedWith(n, maximumLag, decide, __tsplusTrace) {
902
866
  return self => {
903
867
  return tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(next => tsplus_module_1.flatMap(entries => {
904
- const [mappings, queues] = tsplus_module_12.foldRight([tsplus_module_45.empty(), tsplus_module_7.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_45.set(mapping[0], mapping[1])(mappings), tsplus_module_12.append(queue)(queues)])(entries);
868
+ const [mappings, queues] = tsplus_module_14.foldRight([tsplus_module_45.empty(), tsplus_module_9.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_45.set(mapping[0], mapping[1])(mappings), tsplus_module_14.append(queue)(queues)])(entries);
905
869
  return tsplus_module_1.as(() => queues, __tsplusTrace)(tsplus_module_37.succeed_(a => tsplus_module_1.map(f => key => f(tsplus_module_39.toUndefined(tsplus_module_45.get(key)(mappings))), __tsplusTrace)(decide(a)), __tsplusTrace)(p));
906
- }, __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_12.map(id => tsplus_module_1.map(([key, queue]) => [[key, id], queue], __tsplusTrace)(next))(tsplus_module_19.range(0, n)), __tsplusTrace)), __tsplusTrace)(distributedWithDynamic_1(maximumLag, a => tsplus_module_1.flatMap(f => f(a), __tsplusTrace)(tsplus_module_37.wait(p, __tsplusTrace)), () => tsplus_module_1.unit, __tsplusTrace)(self)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace));
870
+ }, __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_14.map(id => tsplus_module_1.map(([key, queue]) => [[key, id], queue], __tsplusTrace)(next))(tsplus_module_21.range(0, n)), __tsplusTrace)), __tsplusTrace)(distributedWithDynamic_1(maximumLag, a => tsplus_module_1.flatMap(f => f(a), __tsplusTrace)(tsplus_module_37.wait(p, __tsplusTrace)), () => tsplus_module_1.unit, __tsplusTrace)(self)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace));
907
871
  };
908
872
  }
909
873
  /**
@@ -918,20 +882,20 @@ function distributedWith(n, maximumLag, decide, __tsplusTrace) {
918
882
  */
919
883
  function distributedWithDynamic_1(maximumLag, decide, done = () => tsplus_module_1.unit, __tsplusTrace) {
920
884
  return self => {
921
- const offer = queuesRef => a => tsplus_module_1.flatMap(shouldProcess => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(ids => tsplus_module_12.isNonEmpty(ids) ? tsplus_module_15.update(map => tsplus_module_45.removeMany(ids)(map), __tsplusTrace)(queuesRef) : tsplus_module_1.unit, __tsplusTrace)(tsplus_module_1.foldLeft(queues, tsplus_module_7.empty(), (b, [id, queue]) => {
885
+ const offer = queuesRef => a => tsplus_module_1.flatMap(shouldProcess => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(ids => tsplus_module_14.isNonEmpty(ids) ? tsplus_module_17.update(map => tsplus_module_45.removeMany(ids)(map), __tsplusTrace)(queuesRef) : tsplus_module_1.unit, __tsplusTrace)(tsplus_module_1.foldLeft(queues, tsplus_module_9.empty(), (b, [id, queue]) => {
922
886
  if (shouldProcess(id)) {
923
- return tsplus_module_1.matchCauseIO(c => tsplus_module_25.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append(id)(b), __tsplusTrace) : tsplus_module_1.failCauseNow(c, __tsplusTrace), () => tsplus_module_1.succeedNow(b, __tsplusTrace), __tsplusTrace)(tsplus_module_28.offer(tsplus_module_41.succeed(a, __tsplusTrace), __tsplusTrace)(queue));
887
+ return tsplus_module_1.matchCauseIO(c => tsplus_module_27.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_14.append(id)(b), __tsplusTrace) : tsplus_module_1.failCauseNow(c, __tsplusTrace), () => tsplus_module_1.succeedNow(b, __tsplusTrace), __tsplusTrace)(tsplus_module_30.offer(tsplus_module_41.succeed(a, __tsplusTrace), __tsplusTrace)(queue));
924
888
  } else {
925
889
  return tsplus_module_1.succeedNow(b, __tsplusTrace);
926
890
  }
927
- }, __tsplusTrace)), __tsplusTrace)(tsplus_module_14.get(queuesRef, __tsplusTrace)), __tsplusTrace)(decide(a));
891
+ }, __tsplusTrace)), __tsplusTrace)(tsplus_module_16.get(queuesRef, __tsplusTrace)), __tsplusTrace)(decide(a));
928
892
  return tsplus_module_1.flatMap(queuesRef => tsplus_module_1.map(add => add, __tsplusTrace)(tsplus_module_1.flatMap(queuesLock => tsplus_module_1.flatMap(newQueue => {
929
- const finalize = endTake => queuesLock.withPermit(tsplus_module_1.asUnit(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(done(endTake)), __tsplusTrace)(tsplus_module_1.foreach(queues, queue => tsplus_module_1.catchJustCause(c => tsplus_module_25.interrupted(c) ? tsplus_module_3.just(tsplus_module_1.unit, __tsplusTrace) : tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace)(tsplus_module_28.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(map => tsplus_module_45.values(map), __tsplusTrace)(tsplus_module_14.get(queuesRef, __tsplusTrace))), __tsplusTrace)(tsplus_module_13.set(tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(() => {
893
+ const finalize = endTake => queuesLock.withPermit(tsplus_module_1.asUnit(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(done(endTake)), __tsplusTrace)(tsplus_module_1.foreach(queues, queue => tsplus_module_1.catchJustCause(c => tsplus_module_27.interrupted(c) ? tsplus_module_5.just(tsplus_module_1.unit, __tsplusTrace) : tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace)(tsplus_module_30.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(map => tsplus_module_45.values(map), __tsplusTrace)(tsplus_module_16.get(queuesRef, __tsplusTrace))), __tsplusTrace)(tsplus_module_15.set(tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(() => {
930
894
  const id = Symbol();
931
- return tsplus_module_1.map(() => (0, _function.tuple)(id, queue), __tsplusTrace)(tsplus_module_15.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef));
932
- }, __tsplusTrace)(tsplus_module_28.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_30.makeBounded(1, __tsplusTrace)), __tsplusTrace)(newQueue)), __tsplusTrace));
933
- return tsplus_module_1.map(() => queuesLock.withPermit(tsplus_module_1.flatten(tsplus_module_14.get(newQueue, __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_1.matchCauseIO(cause => finalize(tsplus_module_41.failCause(tsplus_module_25.map(tsplus_module_3.just)(cause), __tsplusTrace)), () => finalize(tsplus_module_41.fail(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace)), __tsplusTrace)(runForeachScoped_1(offer(queuesRef), __tsplusTrace)(self)), __tsplusTrace));
934
- }, __tsplusTrace)(tsplus_module_6.make(() => tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(id => tsplus_module_1.map(() => (0, _function.tuple)(id, queue), __tsplusTrace)(tsplus_module_15.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef)), __tsplusTrace)(tsplus_module_1.succeed(() => Symbol(), __tsplusTrace)), __tsplusTrace)(tsplus_module_30.makeBounded(maximumLag, __tsplusTrace)), __tsplusTrace)), __tsplusTrace)(tsplus_module_46.makeSemaphore(1, __tsplusTrace))), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_6.make(() => tsplus_module_45.empty(), __tsplusTrace), ref => tsplus_module_1.flatMap(qs => tsplus_module_1.foreach(tsplus_module_45.values(qs), q => tsplus_module_28.shutdown(q, __tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_14.get(ref, __tsplusTrace)), __tsplusTrace));
895
+ return tsplus_module_1.map(() => (0, _function.tuple)(id, queue), __tsplusTrace)(tsplus_module_17.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef));
896
+ }, __tsplusTrace)(tsplus_module_30.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_32.makeBounded(1, __tsplusTrace)), __tsplusTrace)(newQueue)), __tsplusTrace));
897
+ return tsplus_module_1.map(() => queuesLock.withPermit(tsplus_module_1.flatten(tsplus_module_16.get(newQueue, __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_1.matchCauseIO(cause => finalize(tsplus_module_41.failCause(tsplus_module_27.map(tsplus_module_5.just)(cause), __tsplusTrace)), () => finalize(tsplus_module_41.fail(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace)), __tsplusTrace)(runForeachScoped_1(offer(queuesRef), __tsplusTrace)(self)), __tsplusTrace));
898
+ }, __tsplusTrace)(tsplus_module_8.make(() => tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(id => tsplus_module_1.map(() => (0, _function.tuple)(id, queue), __tsplusTrace)(tsplus_module_17.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef)), __tsplusTrace)(tsplus_module_1.succeed(() => Symbol(), __tsplusTrace)), __tsplusTrace)(tsplus_module_32.makeBounded(maximumLag, __tsplusTrace)), __tsplusTrace)), __tsplusTrace)(tsplus_module_46.makeSemaphore(1, __tsplusTrace))), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_8.make(() => tsplus_module_45.empty(), __tsplusTrace), ref => tsplus_module_1.flatMap(qs => tsplus_module_1.foreach(tsplus_module_45.values(qs), q => tsplus_module_30.shutdown(q, __tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_16.get(ref, __tsplusTrace)), __tsplusTrace));
935
899
  };
936
900
  }
937
901
  /**
@@ -941,15 +905,7 @@ function distributedWithDynamic_1(maximumLag, decide, done = () => tsplus_module
941
905
  * @tsplus getter fncts.io.Stream drain
942
906
  */
943
907
  function drain_1(fa, __tsplusTrace) {
944
- return new _definition4.Stream(tsplus_module_10.drain(fa.channel));
945
- }
946
- function dropLoop(r, __tsplusTrace) {
947
- return tsplus_module_10.readWith(inp => {
948
- const dropped = tsplus_module_12.drop(r)(inp);
949
- const leftover = Math.max(0, r - inp.length);
950
- const more = tsplus_module_12.isEmpty(inp) || leftover > 0;
951
- return more ? dropLoop(leftover, __tsplusTrace) : tsplus_module_11.zipRight(tsplus_module_10.id())(tsplus_module_10.write(() => dropped));
952
- }, tsplus_module_10.failNow, () => tsplus_module_10.unit);
908
+ return new _definition4.Stream(tsplus_module_12.drain(fa.channel));
953
909
  }
954
910
  /**
955
911
  * Drops the specified number of elements from this stream.
@@ -958,29 +914,37 @@ function dropLoop(r, __tsplusTrace) {
958
914
  */
959
915
  function drop_1(n, __tsplusTrace) {
960
916
  return stream => {
961
- return new _definition4.Stream(tsplus_module_10.pipeTo(dropLoop(n, __tsplusTrace))(stream.channel));
917
+ return new _definition4.Stream(tsplus_module_12.pipeTo(dropLoop(n, __tsplusTrace))(stream.channel));
962
918
  };
963
919
  }
920
+ function dropLoop(r, __tsplusTrace) {
921
+ return tsplus_module_12.readWith(inp => {
922
+ const dropped = tsplus_module_14.drop(r)(inp);
923
+ const leftover = Math.max(0, r - inp.length);
924
+ const more = tsplus_module_14.isEmpty(inp) || leftover > 0;
925
+ return more ? dropLoop(leftover, __tsplusTrace) : tsplus_module_13.zipRight(tsplus_module_12.id())(tsplus_module_12.write(() => dropped));
926
+ }, tsplus_module_12.failNow, () => tsplus_module_12.unit);
927
+ }
964
928
  /**
965
- * Drops all elements of the stream for as long as the specified predicate
966
- * evaluates to `true`.
929
+ * Drops all elements of the stream until the specified predicate evaluates
930
+ * to `true`.
967
931
  *
968
- * @tsplus pipeable fncts.io.Stream dropWhile
932
+ * @tsplus pipeable fncts.io.Stream dropUntil
969
933
  */
970
- function dropWhile_1(p, __tsplusTrace) {
934
+ function dropUntil(p, __tsplusTrace) {
971
935
  return stream => {
972
- return pipeThrough_1(tsplus_module_47.makeDropWhile(p, __tsplusTrace), __tsplusTrace)(stream);
936
+ return drop_1(1, __tsplusTrace)(dropWhile_1(tsplus_module_47.invert(p), __tsplusTrace)(stream));
973
937
  };
974
938
  }
975
939
  /**
976
- * Drops all elements of the stream until the specified predicate evaluates
977
- * to `true`.
940
+ * Drops all elements of the stream for as long as the specified predicate
941
+ * evaluates to `true`.
978
942
  *
979
- * @tsplus pipeable fncts.io.Stream dropUntil
943
+ * @tsplus pipeable fncts.io.Stream dropWhile
980
944
  */
981
- function dropUntil(p, __tsplusTrace) {
945
+ function dropWhile_1(p, __tsplusTrace) {
982
946
  return stream => {
983
- return drop_1(1, __tsplusTrace)(dropWhile_1(tsplus_module_48.invert(p), __tsplusTrace)(stream));
947
+ return pipeThrough_1(tsplus_module_48.makeDropWhile(p, __tsplusTrace), __tsplusTrace)(stream);
984
948
  };
985
949
  }
986
950
  /**
@@ -993,16 +957,48 @@ function dropUntil(p, __tsplusTrace) {
993
957
  * @tsplus getter fncts.io.Stream either
994
958
  */
995
959
  function either(stream, __tsplusTrace) {
996
- return catchAll_1(e => succeedNow_1(tsplus_module_18.left(e, __tsplusTrace), __tsplusTrace), __tsplusTrace)(map_1(tsplus_module_18.right, __tsplusTrace)(stream));
960
+ return catchAll_1(e => succeedNow_1(tsplus_module_20.left(e, __tsplusTrace), __tsplusTrace), __tsplusTrace)(map_1(tsplus_module_20.right, __tsplusTrace)(stream));
961
+ }
962
+ /**
963
+ * Returns a stream made of the concatenation in strict order of all the streams
964
+ * produced by passing each element of this stream to `f`
965
+ *
966
+ * @tsplus pipeable fncts.io.Stream flatMap
967
+ */
968
+ function flatMap_1(f, __tsplusTrace) {
969
+ return stream => {
970
+ return new _definition4.Stream(tsplus_module_12.concatMap(as => tsplus_module_14.foldLeft(tsplus_module_12.unit, (s, a) => tsplus_module_13.flatMap(() => a)(s))(tsplus_module_14.map(a => f(a).channel)(as)))(stream.channel));
971
+ };
972
+ }
973
+ /**
974
+ * Composes this stream with the specified stream to create a cartesian product of elements,
975
+ * but keeps only elements from this stream.
976
+ * The `that` stream would be run multiple times, for every element in the `this` stream.
977
+ *
978
+ * @tsplus pipeable fncts.io.Stream zipLeft
979
+ */
980
+ function zipLeft(that, __tsplusTrace) {
981
+ return stream => {
982
+ return crossWith_1(that, (a, _) => a, __tsplusTrace)(stream);
983
+ };
984
+ }
985
+ /**
986
+ * Composes this stream with the specified stream to create a cartesian product of elements,
987
+ * but keeps only elements from the other stream.
988
+ * The `that` stream would be run multiple times, for every element in the `this` stream.
989
+ *
990
+ * @tsplus pipeable fncts.io.Stream zipRight
991
+ */
992
+ function zipRight_1(that, __tsplusTrace) {
993
+ return stream => {
994
+ return crossWith_1(that, (_, b) => b, __tsplusTrace)(stream);
995
+ };
997
996
  }
998
997
  /**
999
998
  * @tsplus static fncts.io.StreamOps empty
1000
999
  */
1001
- const empty_1 = /*#__PURE__*/fromChunkNow_1(/*#__PURE__*/tsplus_module_7.empty(), fileName_1 + ":1234:70");
1000
+ const empty_1 = /*#__PURE__*/fromChunkNow_1(/*#__PURE__*/tsplus_module_9.empty(), fileName_1 + ":1234:70");
1002
1001
  const empty = exports.empty = empty_1;
1003
- function endWhenWriter(fiber, __tsplusTrace) {
1004
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_20.match(() => tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(endWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(inp)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_36.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_49.poll(fiber, __tsplusTrace)));
1005
- }
1006
1002
  /**
1007
1003
  * Halts the evaluation of this stream when the provided IO completes. The given IO
1008
1004
  * will be forked as part of the returned stream, and its success will be discarded.
@@ -1016,15 +1012,18 @@ function endWhenWriter(fiber, __tsplusTrace) {
1016
1012
  */
1017
1013
  function endWhen(io, __tsplusTrace) {
1018
1014
  return stream => {
1019
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(fiber => tsplus_module_10.pipeTo(endWhenWriter(fiber, __tsplusTrace))(stream.channel), __tsplusTrace)(tsplus_module_17.forkScoped(io, __tsplusTrace))));
1015
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(fiber => tsplus_module_12.pipeTo(endWhenWriter(fiber, __tsplusTrace))(stream.channel), __tsplusTrace)(tsplus_module_19.forkScoped(io, __tsplusTrace))));
1020
1016
  };
1021
1017
  }
1018
+ function endWhenWriter(fiber, __tsplusTrace) {
1019
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_22.match(() => tsplus_module_12.readWith(inp => tsplus_module_13.zipRight(endWhenWriter(fiber, __tsplusTrace))(tsplus_module_12.writeNow(inp)), tsplus_module_12.failNow, () => tsplus_module_12.unit), exit => tsplus_module_36.match(tsplus_module_13.failCauseNow, () => tsplus_module_12.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_49.poll(fiber, __tsplusTrace)));
1020
+ }
1022
1021
  /**
1023
1022
  * @tsplus pipeable fncts.io.Stream ensuring
1024
1023
  */
1025
1024
  function ensuring_1(finalizer, __tsplusTrace) {
1026
1025
  return self => {
1027
- return new _definition4.Stream(tsplus_module_10.ensuring(finalizer)(self.channel));
1026
+ return new _definition4.Stream(tsplus_module_12.ensuring(finalizer)(self.channel));
1028
1027
  };
1029
1028
  }
1030
1029
  /**
@@ -1068,18 +1067,18 @@ function execute_1(io, __tsplusTrace) {
1068
1067
  /**
1069
1068
  * Halt a stream with the specified error
1070
1069
  *
1071
- * @tsplus static fncts.io.StreamOps failNow
1070
+ * @tsplus static fncts.io.StreamOps fail
1072
1071
  */
1073
- function failNow_1(error, __tsplusTrace) {
1074
- return new _definition4.Stream(tsplus_module_10.failNow(error));
1072
+ function fail(error, __tsplusTrace) {
1073
+ return new _definition4.Stream(tsplus_module_12.fail(error));
1075
1074
  }
1076
1075
  /**
1077
- * Halt a stream with the specified error
1076
+ * The stream that always halts with `cause`.
1078
1077
  *
1079
- * @tsplus static fncts.io.StreamOps fail
1078
+ * @tsplus static fncts.io.StreamOps failCause
1080
1079
  */
1081
- function fail(error, __tsplusTrace) {
1082
- return new _definition4.Stream(tsplus_module_10.fail(error));
1080
+ function failCause(cause, __tsplusTrace) {
1081
+ return fromIO_1(tsplus_module_1.failCause(cause, __tsplusTrace), __tsplusTrace);
1083
1082
  }
1084
1083
  /**
1085
1084
  * The stream that always halts with `cause`.
@@ -1090,16 +1089,16 @@ function failCauseNow_1(cause, __tsplusTrace) {
1090
1089
  return fromIO_1(tsplus_module_1.failCauseNow(cause, __tsplusTrace), __tsplusTrace);
1091
1090
  }
1092
1091
  /**
1093
- * The stream that always halts with `cause`.
1092
+ * Halt a stream with the specified error
1094
1093
  *
1095
- * @tsplus static fncts.io.StreamOps failCause
1094
+ * @tsplus static fncts.io.StreamOps failNow
1096
1095
  */
1097
- function failCause(cause, __tsplusTrace) {
1098
- return fromIO_1(tsplus_module_1.failCause(cause, __tsplusTrace), __tsplusTrace);
1096
+ function failNow_1(error, __tsplusTrace) {
1097
+ return new _definition4.Stream(tsplus_module_12.failNow(error));
1099
1098
  }
1100
1099
  function filter(predicate, __tsplusTrace) {
1101
1100
  return fa => {
1102
- return mapChunks_1(chunk => tsplus_module_12.filter(predicate)(chunk), __tsplusTrace)(fa);
1101
+ return mapChunks_1(chunk => tsplus_module_14.filter(predicate)(chunk), __tsplusTrace)(fa);
1103
1102
  };
1104
1103
  }
1105
1104
  /**
@@ -1107,15 +1106,15 @@ function filter(predicate, __tsplusTrace) {
1107
1106
  */
1108
1107
  function filterIO(f, __tsplusTrace) {
1109
1108
  return fa => {
1110
- return new _definition4.Stream(tsplus_module_10.pipeTo(filterIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
1109
+ return new _definition4.Stream(tsplus_module_12.pipeTo(filterIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
1111
1110
  };
1112
1111
  }
1113
1112
  function filterIOLoop(iterator, f, __tsplusTrace) {
1114
1113
  const next = iterator.next();
1115
1114
  if (next.done) {
1116
- return tsplus_module_10.readWithCause(elem => filterIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
1115
+ return tsplus_module_12.readWithCause(elem => filterIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_13.failCauseNow, tsplus_module_13.succeedNow);
1117
1116
  } else {
1118
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => b ? tsplus_module_11.zipRight(filterIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_19.single(next.value))) : filterIOLoop(iterator, f, __tsplusTrace), __tsplusTrace)(f(next.value)));
1117
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(b => b ? tsplus_module_13.zipRight(filterIOLoop(iterator, f, __tsplusTrace))(tsplus_module_12.writeNow(tsplus_module_21.single(next.value))) : filterIOLoop(iterator, f, __tsplusTrace), __tsplusTrace)(f(next.value)));
1119
1118
  }
1120
1119
  }
1121
1120
  /**
@@ -1123,7 +1122,7 @@ function filterIOLoop(iterator, f, __tsplusTrace) {
1123
1122
  */
1124
1123
  function filterMap_1(f, __tsplusTrace) {
1125
1124
  return fa => {
1126
- return mapChunks_1(chunk => tsplus_module_12.filterMap(f)(chunk), __tsplusTrace)(fa);
1125
+ return mapChunks_1(chunk => tsplus_module_14.filterMap(f)(chunk), __tsplusTrace)(fa);
1127
1126
  };
1128
1127
  }
1129
1128
  /**
@@ -1131,15 +1130,15 @@ function filterMap_1(f, __tsplusTrace) {
1131
1130
  */
1132
1131
  function filterMapIO(f, __tsplusTrace) {
1133
1132
  return fa => {
1134
- return new _definition4.Stream(tsplus_module_10.pipeTo(filterMapIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
1133
+ return new _definition4.Stream(tsplus_module_12.pipeTo(filterMapIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
1135
1134
  };
1136
1135
  }
1137
1136
  function filterMapIOLoop(iterator, f, __tsplusTrace) {
1138
1137
  const next = iterator.next();
1139
1138
  if (next.done) {
1140
- return tsplus_module_10.readWithCause(elem => filterMapIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
1139
+ return tsplus_module_12.readWithCause(elem => filterMapIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_13.failCauseNow, tsplus_module_13.succeedNow);
1141
1140
  } else {
1142
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => tsplus_module_20.match(() => filterMapIOLoop(iterator, f, __tsplusTrace), b => tsplus_module_11.zipRight(filterMapIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_19.single(b))))(b), __tsplusTrace)(f(next.value)));
1141
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(b => tsplus_module_22.match(() => filterMapIOLoop(iterator, f, __tsplusTrace), b => tsplus_module_13.zipRight(filterMapIOLoop(iterator, f, __tsplusTrace))(tsplus_module_12.writeNow(tsplus_module_21.single(b))))(b), __tsplusTrace)(f(next.value)));
1143
1142
  }
1144
1143
  }
1145
1144
  /**
@@ -1149,8 +1148,8 @@ function filterMapIOLoop(iterator, f, __tsplusTrace) {
1149
1148
  */
1150
1149
  function find(p, __tsplusTrace) {
1151
1150
  return stream => {
1152
- const loop = tsplus_module_10.readWith(inp => tsplus_module_20.match(() => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a)))(tsplus_module_12.find(p)(inp)), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1153
- return new _definition4.Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
1151
+ const loop = tsplus_module_12.readWith(inp => tsplus_module_22.match(() => loop, a => tsplus_module_12.writeNow(tsplus_module_21.single(a)))(tsplus_module_14.find(p)(inp)), tsplus_module_12.failNow, () => tsplus_module_12.unit);
1152
+ return new _definition4.Stream(tsplus_module_12.pipeTo(loop)(stream.channel));
1154
1153
  };
1155
1154
  }
1156
1155
  /**
@@ -1160,8 +1159,8 @@ function find(p, __tsplusTrace) {
1160
1159
  */
1161
1160
  function findIO(f, __tsplusTrace) {
1162
1161
  return stream => {
1163
- const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeA => tsplus_module_20.match(() => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a)))(maybeA), __tsplusTrace)(tsplus_module_51.findIO(f, __tsplusTrace)(inp))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1164
- return new _definition4.Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
1162
+ const loop = tsplus_module_12.readWith(inp => tsplus_module_12.unwrap(() => tsplus_module_1.map(maybeA => tsplus_module_22.match(() => loop, a => tsplus_module_12.writeNow(tsplus_module_21.single(a)))(maybeA), __tsplusTrace)(tsplus_module_51.findIO(f, __tsplusTrace)(inp))), tsplus_module_12.failNow, () => tsplus_module_12.unit);
1163
+ return new _definition4.Stream(tsplus_module_12.pipeTo(loop)(stream.channel));
1165
1164
  };
1166
1165
  }
1167
1166
  /**
@@ -1173,6 +1172,15 @@ function findIO(f, __tsplusTrace) {
1173
1172
  function flatten_1(self, __tsplusTrace) {
1174
1173
  return flatMap_1(_function.identity, __tsplusTrace)(self);
1175
1174
  }
1175
+ /**
1176
+ * Submerges the chunks carried by this stream into the stream's structure, while
1177
+ * still preserving them.
1178
+ *
1179
+ * @tsplus getter fncts.io.Stream flattenChunks
1180
+ */
1181
+ function flattenChunks_1(stream, __tsplusTrace) {
1182
+ return new _definition4.Stream(tsplus_module_12.mapOut(c => tsplus_module_14.flatten(c))(stream.channel));
1183
+ }
1176
1184
  /**
1177
1185
  * Unwraps `Exit` values that also signify end-of-stream by failing with `None`.
1178
1186
  *
@@ -1182,12 +1190,12 @@ function flatten_1(self, __tsplusTrace) {
1182
1190
  */
1183
1191
  function flattenExitOption_1(stream, __tsplusTrace) {
1184
1192
  const processChunk = (chunk, cont) => {
1185
- const [toEmit, rest] = tsplus_module_12.splitWhere(_ => !tsplus_module_52.isSuccess(_))(chunk);
1186
- const next = tsplus_module_20.match(() => cont, exit => tsplus_module_36.match(cause => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow)(tsplus_module_25.flipCauseOption(cause)), () => tsplus_module_11.endNow(undefined))(exit))(tsplus_module_12.head(rest));
1187
- return tsplus_module_11.zipRight(next)(tsplus_module_10.writeNow(tsplus_module_12.filterMap(exit => tsplus_module_36.match(() => tsplus_module_3.nothing(__tsplusTrace), tsplus_module_3.just)(exit))(toEmit)));
1193
+ const [toEmit, rest] = tsplus_module_14.splitWhere(_ => !tsplus_module_52.isSuccess(_))(chunk);
1194
+ const next = tsplus_module_22.match(() => cont, exit => tsplus_module_36.match(cause => tsplus_module_22.match(() => tsplus_module_13.endNow(undefined), tsplus_module_13.failCauseNow)(tsplus_module_27.flipCauseOption(cause)), () => tsplus_module_13.endNow(undefined))(exit))(tsplus_module_14.head(rest));
1195
+ return tsplus_module_13.zipRight(next)(tsplus_module_12.writeNow(tsplus_module_14.filterMap(exit => tsplus_module_36.match(() => tsplus_module_5.nothing(__tsplusTrace), tsplus_module_5.just)(exit))(toEmit)));
1188
1196
  };
1189
- const process = tsplus_module_10.readWithCause(chunk => processChunk(chunk, process), tsplus_module_11.failCauseNow, _ => tsplus_module_11.endNow(undefined));
1190
- return new _definition4.Stream(tsplus_module_10.pipeTo(process)(stream.channel));
1197
+ const process = tsplus_module_12.readWithCause(chunk => processChunk(chunk, process), tsplus_module_13.failCauseNow, _ => tsplus_module_13.endNow(undefined));
1198
+ return new _definition4.Stream(tsplus_module_12.pipeTo(process)(stream.channel));
1191
1199
  }
1192
1200
  /**
1193
1201
  * Unwraps `Exit` values and flatten chunks that also signify end-of-stream by failing with `None`.
@@ -1197,30 +1205,24 @@ function flattenExitOption_1(stream, __tsplusTrace) {
1197
1205
  function flattenTake_1(stream, __tsplusTrace) {
1198
1206
  return flattenChunks_1(flattenExitOption_1(map_1(take => take.exit, __tsplusTrace)(stream), __tsplusTrace), __tsplusTrace);
1199
1207
  }
1200
- /**
1201
- * Submerges the chunks carried by this stream into the stream's structure, while
1202
- * still preserving them.
1203
- *
1204
- * @tsplus getter fncts.io.Stream flattenChunks
1205
- */
1206
- function flattenChunks_1(stream, __tsplusTrace) {
1207
- return new _definition4.Stream(tsplus_module_10.mapOut(c => tsplus_module_12.flatten(c))(stream.channel));
1208
- }
1209
1208
  /**
1210
1209
  * Repeats this stream forever.
1211
1210
  *
1212
1211
  * @tsplus getter fncts.io.Stream forever
1213
1212
  */
1214
1213
  function forever_1(stream, __tsplusTrace) {
1215
- return new _definition4.Stream(tsplus_module_10.repeated(stream.channel));
1214
+ return new _definition4.Stream(tsplus_module_12.repeated(stream.channel));
1216
1215
  }
1217
1216
  /**
1218
- * Creates a stream from a `Chunk` of values
1219
- *
1220
- * @tsplus static fncts.io.StreamOps fromChunkNow
1217
+ * @tsplus static fncts.io.StreamOps fromAsyncIterable
1221
1218
  */
1222
- function fromChunkNow_1(c, __tsplusTrace) {
1223
- return new _definition4.Stream(tsplus_module_10.defer(() => tsplus_module_12.isEmpty(c) ? tsplus_module_10.unit : tsplus_module_10.writeNow(c)));
1219
+ function fromAsyncIterable(iterable, __tsplusTrace) {
1220
+ return new _definition4.Stream(fromAsyncIterableLoop(iterable[Symbol.asyncIterator](), __tsplusTrace));
1221
+ }
1222
+ function fromAsyncIterableLoop(iterator, __tsplusTrace) {
1223
+ return tsplus_module_12.unwrap(() => tsplus_module_1.async(k => {
1224
+ iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_13.end(() => undefined), __tsplusTrace)) : k(tsplus_module_1.succeedNow(tsplus_module_13.zipRight(fromAsyncIterableLoop(iterator, __tsplusTrace))(tsplus_module_12.writeNow(tsplus_module_21.single(result.value))), __tsplusTrace)));
1225
+ }));
1224
1226
  }
1225
1227
  /**
1226
1228
  * Creates a stream from a `Chunk` of values
@@ -1228,77 +1230,27 @@ function fromChunkNow_1(c, __tsplusTrace) {
1228
1230
  * @tsplus static fncts.io.StreamOps fromChunk
1229
1231
  */
1230
1232
  function fromChunk_1(c, __tsplusTrace) {
1231
- return new _definition4.Stream(tsplus_module_10.unwrap(() => tsplus_module_1.succeedNow(tsplus_module_10.write(c), __tsplusTrace)));
1233
+ return new _definition4.Stream(tsplus_module_12.unwrap(() => tsplus_module_1.succeedNow(tsplus_module_12.write(c), __tsplusTrace)));
1232
1234
  }
1233
1235
  /**
1234
- * @tsplus static fncts.io.StreamOps fromReadableStream
1236
+ * Creates a stream from a `Chunk` of values
1237
+ *
1238
+ * @tsplus static fncts.io.StreamOps fromChunkNow
1235
1239
  */
1236
- function fromReadableStream(evaluate, onError) {
1237
- return unwrapScoped_1(tsplus_module_1.map(reader => repeatIOMaybe_1(tsplus_module_1.flatMap(({
1238
- done,
1239
- value
1240
- }) => done ? tsplus_module_1.failNow(tsplus_module_3.nothing(fileName_1 + ":1606:38"), fileName_1 + ":1606:30") : tsplus_module_1.succeedNow(value, fileName_1 + ":1606:57"), fileName_1 + ":1605:88")(tsplus_module_1.fromPromiseCatch(() => reader.read(), reason => tsplus_module_3.just(onError(reason), fileName_1 + ":1605:62"), fileName_1 + ":1605:30")), fileName_1 + ":1604:29"), fileName_1 + ":1603:11")(tsplus_module_31.acquireRelease(() => tsplus_module_1.succeed(() => evaluate().getReader(), fileName_1 + ":1601:7"), reader => tsplus_module_1.fromPromiseHalt(() => reader.cancel(), fileName_1 + ":1602:53"), fileName_1 + ":1602:22")), fileName_1 + ":1600:29");
1240
+ function fromChunkNow_1(c, __tsplusTrace) {
1241
+ return new _definition4.Stream(tsplus_module_12.defer(() => tsplus_module_14.isEmpty(c) ? tsplus_module_12.unit : tsplus_module_12.writeNow(c)));
1241
1242
  }
1242
1243
  /**
1243
- * Creates a single-valued stream from a managed resource
1244
- *
1245
- * @tsplus static fncts.io.StreamOps scoped
1244
+ * @tsplus static fncts.io.StreamOps fromHub
1246
1245
  */
1247
- function scoped_1(stream, __tsplusTrace) {
1248
- return new _definition4.Stream(tsplus_module_10.scoped(() => tsplus_module_1.map(tsplus_module_19.single, __tsplusTrace)(stream())));
1246
+ function fromHub(hub, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1247
+ return flatMap_1(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(scoped_1(() => tsplus_module_34.subscribe(hub(), __tsplusTrace), __tsplusTrace));
1249
1248
  }
1250
1249
  /**
1251
- * Emits a sliding window of n elements.
1252
- *
1253
- * @tsplus pipeable fncts.io.Stream sliding
1250
+ * @tsplus static fncts.io.StreamOps fromHubScoped
1254
1251
  */
1255
- function sliding(chunkSize, stepSize, __tsplusTrace) {
1256
- return self => {
1257
- return defer_1(() => {
1258
- function slidingChunk(chunk, input) {
1259
- const updatedChunk = tsplus_module_12.concat(input)(chunk);
1260
- const length = updatedChunk.length;
1261
- if (length >= chunkSize) {
1262
- const array = new Array((length - chunkSize) / stepSize + 1);
1263
- let arrayIndex = 0;
1264
- let chunkIndex = 0;
1265
- while (chunkIndex + chunkSize <= length) {
1266
- array[arrayIndex] = tsplus_module_12.slice(chunkIndex, chunkIndex + chunkSize)(updatedChunk);
1267
- arrayIndex += 1;
1268
- chunkIndex += stepSize;
1269
- }
1270
- return [tsplus_module_12.drop(chunkIndex)(updatedChunk), tsplus_module_53.fromArray(array)];
1271
- } else {
1272
- return [updatedChunk, tsplus_module_7.empty()];
1273
- }
1274
- }
1275
- function sliding(chunk, written) {
1276
- return tsplus_module_10.readWithCause(input => {
1277
- const [updatedChunk, out] = slidingChunk(chunk, input);
1278
- if (tsplus_module_12.isEmpty(out)) {
1279
- return sliding(updatedChunk, written);
1280
- } else {
1281
- return tsplus_module_11.zipRight(sliding(updatedChunk, true))(tsplus_module_10.writeNow(out));
1282
- }
1283
- }, err => {
1284
- const index = written && chunkSize > stepSize ? chunkSize - stepSize : 0;
1285
- if (index >= chunk.length) {
1286
- return tsplus_module_11.failCauseNow(err);
1287
- } else {
1288
- return tsplus_module_11.zipRight(tsplus_module_11.failCauseNow(err))(tsplus_module_10.writeNow(tsplus_module_19.single(chunk)));
1289
- }
1290
- }, done => {
1291
- const index = written && chunkSize > stepSize ? chunkSize - stepSize : 0;
1292
- if (index >= chunk.length) {
1293
- return tsplus_module_11.succeedNow(done);
1294
- } else {
1295
- return tsplus_module_11.zipRight(tsplus_module_11.succeedNow(done))(tsplus_module_10.writeNow(tsplus_module_19.single(chunk)));
1296
- }
1297
- });
1298
- }
1299
- return new _definition4.Stream(tsplus_module_10.pipeTo(sliding(tsplus_module_7.empty(), false))(self.channel));
1300
- });
1301
- };
1252
+ function fromHubScoped(hub, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1253
+ return tsplus_module_1.defer(() => tsplus_module_1.map(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(tsplus_module_34.subscribe(hub(), __tsplusTrace)), __tsplusTrace);
1302
1254
  }
1303
1255
  /**
1304
1256
  * Creates a stream from an effect producing a value of type `A`
@@ -1306,7 +1258,7 @@ function sliding(chunkSize, stepSize, __tsplusTrace) {
1306
1258
  * @tsplus static fncts.io.StreamOps fromIO
1307
1259
  */
1308
1260
  function fromIO_1(fa, __tsplusTrace) {
1309
- return fromIOMaybe_1(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(fa), __tsplusTrace);
1261
+ return fromIOMaybe_1(tsplus_module_1.mapError(tsplus_module_5.just, __tsplusTrace)(fa), __tsplusTrace);
1310
1262
  }
1311
1263
  /**
1312
1264
  * Creates a stream from an effect producing a value of type `A` or an empty Stream
@@ -1314,31 +1266,20 @@ function fromIO_1(fa, __tsplusTrace) {
1314
1266
  * @tsplus static fncts.io.StreamOps fromIOMaybe
1315
1267
  */
1316
1268
  function fromIOMaybe_1(fa, __tsplusTrace) {
1317
- return new _definition4.Stream(tsplus_module_10.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_20.match(() => tsplus_module_10.unit, tsplus_module_10.failNow)(maybeError), a => tsplus_module_10.writeNow(tsplus_module_19.single(a)), __tsplusTrace)(fa)));
1318
- }
1319
- function fromAsyncIterableLoop(iterator, __tsplusTrace) {
1320
- return tsplus_module_10.unwrap(() => tsplus_module_1.async(k => {
1321
- iterator.next().then(result => result.done ? k(tsplus_module_1.succeedNow(tsplus_module_11.end(() => undefined), __tsplusTrace)) : k(tsplus_module_1.succeedNow(tsplus_module_11.zipRight(fromAsyncIterableLoop(iterator, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_19.single(result.value))), __tsplusTrace)));
1322
- }));
1323
- }
1324
- /**
1325
- * @tsplus static fncts.io.StreamOps fromAsyncIterable
1326
- */
1327
- function fromAsyncIterable(iterable, __tsplusTrace) {
1328
- return new _definition4.Stream(fromAsyncIterableLoop(iterable[Symbol.asyncIterator](), __tsplusTrace));
1269
+ return new _definition4.Stream(tsplus_module_12.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_22.match(() => tsplus_module_12.unit, tsplus_module_12.failNow)(maybeError), a => tsplus_module_12.writeNow(tsplus_module_21.single(a)), __tsplusTrace)(fa)));
1329
1270
  }
1330
1271
  /**
1331
1272
  * @tsplus static fncts.io.StreamOps fromIterable
1332
1273
  */
1333
1274
  function fromIterable(iterable, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1334
1275
  return unwrap_1(tsplus_module_1.succeed(() => {
1335
- const loop = iterator => tsplus_module_10.unwrap(() => tsplus_module_1.succeed(() => {
1276
+ const loop = iterator => tsplus_module_12.unwrap(() => tsplus_module_1.succeed(() => {
1336
1277
  let result = iterator.next();
1337
1278
  if (result.done) {
1338
- return tsplus_module_10.unit;
1279
+ return tsplus_module_12.unit;
1339
1280
  }
1340
1281
  if (maxChunkSize === 1) {
1341
- return tsplus_module_11.zipRight(loop(iterator))(tsplus_module_10.writeNow(tsplus_module_19.single(result.value)));
1282
+ return tsplus_module_13.zipRight(loop(iterator))(tsplus_module_12.writeNow(tsplus_module_21.single(result.value)));
1342
1283
  } else {
1343
1284
  const out = Array(maxChunkSize);
1344
1285
  out[0] = result.value;
@@ -1347,7 +1288,7 @@ function fromIterable(iterable, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE,
1347
1288
  out[count] = result.value;
1348
1289
  count++;
1349
1290
  }
1350
- return tsplus_module_11.zipRight(loop(iterator))(tsplus_module_10.writeNow(tsplus_module_19.from(out)));
1291
+ return tsplus_module_13.zipRight(loop(iterator))(tsplus_module_12.writeNow(tsplus_module_21.from(out)));
1351
1292
  }
1352
1293
  }, __tsplusTrace));
1353
1294
  return new _definition4.Stream(loop(iterable[Symbol.iterator]()));
@@ -1360,7 +1301,7 @@ function fromIterableSingle(iterable, __tsplusTrace) {
1360
1301
  return flatMap_1(iterator => repeatIOMaybe_1(tsplus_module_1.defer(() => {
1361
1302
  const value = iterator.next();
1362
1303
  if (value.done) {
1363
- return tsplus_module_1.failNow(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace);
1304
+ return tsplus_module_1.failNow(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace);
1364
1305
  } else {
1365
1306
  return tsplus_module_1.succeedNow(value.value, __tsplusTrace);
1366
1307
  }
@@ -1379,49 +1320,43 @@ function fromPull_1(scopedPull, __tsplusTrace) {
1379
1320
  */
1380
1321
  function fromQueue_1(queue, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1381
1322
  return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause(c => tsplus_module_1.flatMap(down => {
1382
- if (down && tsplus_module_25.interrupted(c)) {
1383
- return tsplus_module_54.end;
1323
+ if (down && tsplus_module_27.interrupted(c)) {
1324
+ return tsplus_module_53.end;
1384
1325
  } else {
1385
- return tsplus_module_54.failCause(c);
1326
+ return tsplus_module_53.failCause(c);
1386
1327
  }
1387
- }, __tsplusTrace)(tsplus_module_28.isShutdown(queue, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(tsplus_module_19.from, __tsplusTrace)(tsplus_module_55.takeBetween(1, maxChunkSize, __tsplusTrace)(queue))), __tsplusTrace);
1328
+ }, __tsplusTrace)(tsplus_module_30.isShutdown(queue, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(tsplus_module_21.from, __tsplusTrace)(tsplus_module_54.takeBetween(1, maxChunkSize, __tsplusTrace)(queue))), __tsplusTrace);
1388
1329
  }
1389
1330
  /**
1390
1331
  * @tsplus static fncts.io.StreamOps fromQueueWithShutdown
1391
1332
  */
1392
1333
  function fromQueueWithShutdown_1(queue, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1393
- return ensuring_1(tsplus_module_28.shutdown(queue, __tsplusTrace), __tsplusTrace)(fromQueue_1(queue, maxChunkSize, __tsplusTrace));
1334
+ return ensuring_1(tsplus_module_30.shutdown(queue, __tsplusTrace), __tsplusTrace)(fromQueue_1(queue, maxChunkSize, __tsplusTrace));
1394
1335
  }
1395
1336
  /**
1396
- * @tsplus static fncts.io.StreamOps fromHub
1397
- */
1398
- function fromHub(hub, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1399
- return flatMap_1(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(scoped_1(() => tsplus_module_34.subscribe(hub(), __tsplusTrace), __tsplusTrace));
1400
- }
1401
- /**
1402
- * @tsplus static fncts.io.StreamOps fromHubScoped
1337
+ * @tsplus static fncts.io.StreamOps fromReadableStream
1403
1338
  */
1404
- function fromHubScoped(hub, maxChunkSize = _definition4.DEFAULT_CHUNK_SIZE, __tsplusTrace) {
1405
- return tsplus_module_1.defer(() => tsplus_module_1.map(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(tsplus_module_34.subscribe(hub(), __tsplusTrace)), __tsplusTrace);
1339
+ function fromReadableStream(evaluate, onError) {
1340
+ return unwrapScoped_1(tsplus_module_1.map(reader => repeatIOMaybe_1(tsplus_module_1.flatMap(({
1341
+ done,
1342
+ value
1343
+ }) => done ? tsplus_module_1.failNow(tsplus_module_5.nothing(fileName_1 + ":1784:38"), fileName_1 + ":1784:30") : tsplus_module_1.succeedNow(value, fileName_1 + ":1784:57"), fileName_1 + ":1783:88")(tsplus_module_1.fromPromiseCatch(() => reader.read(), reason => tsplus_module_5.just(onError(reason), fileName_1 + ":1783:62"), fileName_1 + ":1783:30")), fileName_1 + ":1782:29"), fileName_1 + ":1781:11")(tsplus_module_2.acquireRelease(() => tsplus_module_1.succeed(() => evaluate().getReader(), fileName_1 + ":1779:7"), reader => tsplus_module_1.fromPromiseHalt(() => reader.cancel(), fileName_1 + ":1780:53"), fileName_1 + ":1780:22")), fileName_1 + ":1778:29");
1406
1344
  }
1407
1345
  /**
1408
1346
  * Halt a stream with the specified exception
1409
1347
  *
1410
- * @tsplus static fncts.io.StreamOps haltNow
1348
+ * @tsplus static fncts.io.StreamOps halt
1411
1349
  */
1412
- function haltNow(u, __tsplusTrace) {
1413
- return new _definition4.Stream(tsplus_module_10.halt(() => u));
1350
+ function halt_1(u, __tsplusTrace) {
1351
+ return new _definition4.Stream(tsplus_module_12.halt(u));
1414
1352
  }
1415
1353
  /**
1416
1354
  * Halt a stream with the specified exception
1417
1355
  *
1418
- * @tsplus static fncts.io.StreamOps halt
1356
+ * @tsplus static fncts.io.StreamOps haltNow
1419
1357
  */
1420
- function halt_1(u, __tsplusTrace) {
1421
- return new _definition4.Stream(tsplus_module_10.halt(u));
1422
- }
1423
- function haltWhenWriter(fiber, __tsplusTrace) {
1424
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_20.match(() => tsplus_module_10.readWith(i => tsplus_module_11.zipRight(haltWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_36.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_49.poll(fiber, __tsplusTrace)));
1358
+ function haltNow(u, __tsplusTrace) {
1359
+ return new _definition4.Stream(tsplus_module_12.halt(() => u));
1425
1360
  }
1426
1361
  /**
1427
1362
  * Halts the evaluation of this stream when the provided IO completes. The
@@ -1437,12 +1372,9 @@ function haltWhenWriter(fiber, __tsplusTrace) {
1437
1372
  */
1438
1373
  function haltWhen(io, __tsplusTrace) {
1439
1374
  return fa => {
1440
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(fiber => tsplus_module_10.pipeTo(haltWhenWriter(fiber, __tsplusTrace))(fa.channel), __tsplusTrace)(tsplus_module_17.forkScoped(io, __tsplusTrace))));
1375
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(fiber => tsplus_module_12.pipeTo(haltWhenWriter(fiber, __tsplusTrace))(fa.channel), __tsplusTrace)(tsplus_module_19.forkScoped(io, __tsplusTrace))));
1441
1376
  };
1442
1377
  }
1443
- function haltWhenFutureWriter(future, __tsplusTrace) {
1444
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeIO => tsplus_module_20.match(() => tsplus_module_10.readWith(i => tsplus_module_11.zipRight(haltWhenFutureWriter(future, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(() => tsplus_module_1.match(tsplus_module_10.failNow, () => tsplus_module_10.unit, __tsplusTrace)(io)))(maybeIO), __tsplusTrace)(tsplus_module_37.poll(future, __tsplusTrace)));
1445
- }
1446
1378
  /**
1447
1379
  * Halts the evaluation of this stream when the provided promise resolves.
1448
1380
  *
@@ -1452,20 +1384,23 @@ function haltWhenFutureWriter(future, __tsplusTrace) {
1452
1384
  */
1453
1385
  function haltWhenFuture(future, __tsplusTrace) {
1454
1386
  return fa => {
1455
- return new _definition4.Stream(tsplus_module_10.pipeTo(haltWhenFutureWriter(future, __tsplusTrace))(fa.channel));
1387
+ return new _definition4.Stream(tsplus_module_12.pipeTo(haltWhenFutureWriter(future, __tsplusTrace))(fa.channel));
1456
1388
  };
1457
1389
  }
1390
+ function haltWhenFutureWriter(future, __tsplusTrace) {
1391
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(maybeIO => tsplus_module_22.match(() => tsplus_module_12.readWith(i => tsplus_module_13.zipRight(haltWhenFutureWriter(future, __tsplusTrace))(tsplus_module_12.writeNow(i)), tsplus_module_12.failNow, () => tsplus_module_12.unit), io => tsplus_module_12.unwrap(() => tsplus_module_1.match(tsplus_module_12.failNow, () => tsplus_module_12.unit, __tsplusTrace)(io)))(maybeIO), __tsplusTrace)(tsplus_module_37.poll(future, __tsplusTrace)));
1392
+ }
1393
+ function haltWhenWriter(fiber, __tsplusTrace) {
1394
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_22.match(() => tsplus_module_12.readWith(i => tsplus_module_13.zipRight(haltWhenWriter(fiber, __tsplusTrace))(tsplus_module_12.writeNow(i)), tsplus_module_12.failNow, () => tsplus_module_12.unit), exit => tsplus_module_36.match(tsplus_module_13.failCauseNow, () => tsplus_module_12.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_49.poll(fiber, __tsplusTrace)));
1395
+ }
1458
1396
  /**
1459
1397
  * @tsplus pipeable fncts.io.Stream interleave
1460
1398
  */
1461
1399
  function interleave(sb, __tsplusTrace) {
1462
1400
  return sa => {
1463
- return interleaveWith_1(sb, forever_1(fromChunk_1(() => tsplus_module_19.make(true, false), __tsplusTrace), __tsplusTrace), __tsplusTrace)(sa);
1401
+ return interleaveWith_1(sb, forever_1(fromChunk_1(() => tsplus_module_21.make(true, false), __tsplusTrace), __tsplusTrace), __tsplusTrace)(sa);
1464
1402
  };
1465
1403
  }
1466
- function interleaveWithProducer(handoff, __tsplusTrace) {
1467
- return tsplus_module_10.readWithCause(value => tsplus_module_11.zipRight(interleaveWithProducer(handoff, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.single(value))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.failCause(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.end)(handoff)));
1468
- }
1469
1404
  /**
1470
1405
  * Combines this stream and the specified stream deterministically using the
1471
1406
  * stream of boolean values `b` to control which stream to pull from next.
@@ -1478,41 +1413,22 @@ function interleaveWithProducer(handoff, __tsplusTrace) {
1478
1413
  */
1479
1414
  function interleaveWith_1(sb, b, __tsplusTrace) {
1480
1415
  return sa => {
1481
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right]) => {
1482
- const process = (leftDone, rightDone) => tsplus_module_10.readWithCause(b => {
1416
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(([left, right]) => {
1417
+ const process = (leftDone, rightDone) => tsplus_module_12.readWithCause(b => {
1483
1418
  if (b && !leftDone) {
1484
- return tsplus_module_11.flatMap(take => tsplus_module_27.match(rightDone ? tsplus_module_10.unit : process(true, rightDone), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.zipRight(process(leftDone, rightDone))(tsplus_module_10.writeNow(chunk)))(take))(tsplus_module_10.fromIO(() => tsplus_module_5.take(left)));
1419
+ return tsplus_module_13.flatMap(take => tsplus_module_29.match(rightDone ? tsplus_module_12.unit : process(true, rightDone), tsplus_module_13.failCauseNow, chunk => tsplus_module_13.zipRight(process(leftDone, rightDone))(tsplus_module_12.writeNow(chunk)))(take))(tsplus_module_12.fromIO(() => tsplus_module_7.take(left)));
1485
1420
  }
1486
1421
  if (!b && !rightDone) {
1487
- return tsplus_module_11.flatMap(take => tsplus_module_27.match(leftDone ? tsplus_module_10.unit : process(leftDone, true), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.zipRight(process(leftDone, rightDone))(tsplus_module_10.writeNow(chunk)))(take))(tsplus_module_10.fromIO(() => tsplus_module_5.take(right)));
1422
+ return tsplus_module_13.flatMap(take => tsplus_module_29.match(leftDone ? tsplus_module_12.unit : process(leftDone, true), tsplus_module_13.failCauseNow, chunk => tsplus_module_13.zipRight(process(leftDone, rightDone))(tsplus_module_12.writeNow(chunk)))(take))(tsplus_module_12.fromIO(() => tsplus_module_7.take(right)));
1488
1423
  }
1489
1424
  return process(leftDone, rightDone);
1490
- }, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
1491
- return tsplus_module_10.pipeTo(process(false, false))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(b.channel));
1492
- }, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => (0, _function.tuple)(left, right), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(interleaveWithProducer(right, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(sb.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(interleaveWithProducer(left, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(sa.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
1425
+ }, tsplus_module_13.failCauseNow, () => tsplus_module_12.unit);
1426
+ return tsplus_module_12.pipeTo(process(false, false))(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(b.channel));
1427
+ }, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => (0, _function.tuple)(left, right), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(interleaveWithProducer(right, __tsplusTrace))(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(sb.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_18.runScoped(tsplus_module_12.pipeTo(interleaveWithProducer(left, __tsplusTrace))(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(sa.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_7.make()), __tsplusTrace)(tsplus_module_7.make()))));
1493
1428
  };
1494
1429
  }
1495
- function intersperseWriter(middle, isFirst, __tsplusTrace) {
1496
- return tsplus_module_10.readWith(inp => {
1497
- const builder = tsplus_module_12.builder();
1498
- let flagResult = isFirst;
1499
- tsplus_module_12.forEach(a => {
1500
- if (flagResult) {
1501
- flagResult = false;
1502
- builder.append(a);
1503
- } else {
1504
- builder.append(middle);
1505
- builder.append(a);
1506
- }
1507
- })(inp);
1508
- return tsplus_module_11.zipRight(intersperseWriter(middle, flagResult, __tsplusTrace))(tsplus_module_10.writeNow(builder.result()));
1509
- }, tsplus_module_10.failNow, () => tsplus_module_10.unit);
1510
- }
1511
- /**
1512
- * Intersperse stream with provided element
1513
- */
1514
- function intersperse(stream, middle, __tsplusTrace) {
1515
- return new _definition4.Stream(tsplus_module_10.pipeTo(intersperseWriter(middle, true, __tsplusTrace))(stream.channel));
1430
+ function interleaveWithProducer(handoff, __tsplusTrace) {
1431
+ return tsplus_module_12.readWithCause(value => tsplus_module_13.zipRight(interleaveWithProducer(handoff, __tsplusTrace))(tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_29.single(value))(handoff))), cause => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_29.failCause(cause))(handoff)), () => tsplus_module_12.fromIO(() => tsplus_module_7.offer(tsplus_module_29.end)(handoff)));
1516
1432
  }
1517
1433
  /**
1518
1434
  * Interrupts the evaluation of this stream when the provided IO completes. The given
@@ -1526,7 +1442,7 @@ function intersperse(stream, middle, __tsplusTrace) {
1526
1442
  */
1527
1443
  function interruptWhen(io, __tsplusTrace) {
1528
1444
  return stream => {
1529
- return new _definition4.Stream(tsplus_module_56.interruptWhen(io)(stream.channel));
1445
+ return new _definition4.Stream(tsplus_module_55.interruptWhen(io)(stream.channel));
1530
1446
  };
1531
1447
  }
1532
1448
  /**
@@ -1534,9 +1450,31 @@ function interruptWhen(io, __tsplusTrace) {
1534
1450
  */
1535
1451
  function interruptWhenFuture(future, __tsplusTrace) {
1536
1452
  return fa => {
1537
- return new _definition4.Stream(tsplus_module_56.interruptWhenFuture(future)(fa.channel));
1453
+ return new _definition4.Stream(tsplus_module_55.interruptWhenFuture(future)(fa.channel));
1538
1454
  };
1539
1455
  }
1456
+ /**
1457
+ * Intersperse stream with provided element
1458
+ */
1459
+ function intersperse(stream, middle, __tsplusTrace) {
1460
+ return new _definition4.Stream(tsplus_module_12.pipeTo(intersperseWriter(middle, true, __tsplusTrace))(stream.channel));
1461
+ }
1462
+ function intersperseWriter(middle, isFirst, __tsplusTrace) {
1463
+ return tsplus_module_12.readWith(inp => {
1464
+ const builder = tsplus_module_14.builder();
1465
+ let flagResult = isFirst;
1466
+ tsplus_module_14.forEach(a => {
1467
+ if (flagResult) {
1468
+ flagResult = false;
1469
+ builder.append(a);
1470
+ } else {
1471
+ builder.append(middle);
1472
+ builder.append(a);
1473
+ }
1474
+ })(inp);
1475
+ return tsplus_module_13.zipRight(intersperseWriter(middle, flagResult, __tsplusTrace))(tsplus_module_12.writeNow(builder.result()));
1476
+ }, tsplus_module_12.failNow, () => tsplus_module_12.unit);
1477
+ }
1540
1478
  /**
1541
1479
  * Transforms the elements of this stream using the supplied function.
1542
1480
  *
@@ -1544,15 +1482,9 @@ function interruptWhenFuture(future, __tsplusTrace) {
1544
1482
  */
1545
1483
  function map_1(f, __tsplusTrace) {
1546
1484
  return stream => {
1547
- return new _definition4.Stream(tsplus_module_10.mapOut(as => tsplus_module_12.map(f)(as))(stream.channel));
1485
+ return new _definition4.Stream(tsplus_module_12.mapOut(as => tsplus_module_14.map(f)(as))(stream.channel));
1548
1486
  };
1549
1487
  }
1550
- function mapAccumAccumulator(currS, f, __tsplusTrace) {
1551
- return tsplus_module_10.readWith(inp => {
1552
- const [nextS, bs] = tsplus_module_12.mapAccum(currS, f)(inp);
1553
- return tsplus_module_11.zipRight(mapAccumAccumulator(nextS, f, __tsplusTrace))(tsplus_module_10.writeNow(bs));
1554
- }, tsplus_module_10.failNow, () => tsplus_module_10.unit);
1555
- }
1556
1488
  /**
1557
1489
  * Statefully maps over the elements of this stream to produce new elements.
1558
1490
  *
@@ -1560,20 +1492,14 @@ function mapAccumAccumulator(currS, f, __tsplusTrace) {
1560
1492
  */
1561
1493
  function mapAccum_1(s, f, __tsplusTrace) {
1562
1494
  return stream => {
1563
- return new _definition4.Stream(tsplus_module_10.pipeTo(mapAccumAccumulator(s, f, __tsplusTrace))(stream.channel));
1495
+ return new _definition4.Stream(tsplus_module_12.pipeTo(mapAccumAccumulator(s, f, __tsplusTrace))(stream.channel));
1564
1496
  };
1565
1497
  }
1566
- function mapAccumIOAccumulator(s, f, __tsplusTrace) {
1567
- return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.defer(() => {
1568
- const outputChunk = tsplus_module_12.builder();
1569
- const emit = b => tsplus_module_1.succeed(() => {
1570
- outputChunk.append(b);
1571
- }, __tsplusTrace);
1572
- return tsplus_module_1.match(e => {
1573
- const partialResult = outputChunk.result();
1574
- return tsplus_module_12.isNonEmpty(partialResult) ? tsplus_module_11.zipRight(tsplus_module_10.failNow(e))(tsplus_module_10.writeNow(partialResult)) : tsplus_module_10.failNow(e);
1575
- }, s => tsplus_module_11.zipRight(mapAccumIOAccumulator(s, f, __tsplusTrace))(tsplus_module_10.writeNow(outputChunk.result())), __tsplusTrace)(tsplus_module_1.foldLeft(inp, s, (s1, a) => tsplus_module_1.flatMap(([b, s2]) => tsplus_module_1.as(() => s2, __tsplusTrace)(emit(b)), __tsplusTrace)(f(s1, a)), __tsplusTrace));
1576
- }, __tsplusTrace)), tsplus_module_10.failNow, () => tsplus_module_10.unit);
1498
+ function mapAccumAccumulator(currS, f, __tsplusTrace) {
1499
+ return tsplus_module_12.readWith(inp => {
1500
+ const [nextS, bs] = tsplus_module_14.mapAccum(currS, f)(inp);
1501
+ return tsplus_module_13.zipRight(mapAccumAccumulator(nextS, f, __tsplusTrace))(tsplus_module_12.writeNow(bs));
1502
+ }, tsplus_module_12.failNow, () => tsplus_module_12.unit);
1577
1503
  }
1578
1504
  /**
1579
1505
  * Statefully and effectfully maps over the elements of this stream to produce
@@ -1583,9 +1509,21 @@ function mapAccumIOAccumulator(s, f, __tsplusTrace) {
1583
1509
  */
1584
1510
  function mapAccumIO_1(s, f, __tsplusTrace) {
1585
1511
  return stream => {
1586
- return new _definition4.Stream(tsplus_module_10.pipeTo(mapAccumIOAccumulator(s, f, __tsplusTrace))(stream.channel));
1512
+ return new _definition4.Stream(tsplus_module_12.pipeTo(mapAccumIOAccumulator(s, f, __tsplusTrace))(stream.channel));
1587
1513
  };
1588
1514
  }
1515
+ function mapAccumIOAccumulator(s, f, __tsplusTrace) {
1516
+ return tsplus_module_12.readWith(inp => tsplus_module_12.unwrap(() => tsplus_module_1.defer(() => {
1517
+ const outputChunk = tsplus_module_14.builder();
1518
+ const emit = b => tsplus_module_1.succeed(() => {
1519
+ outputChunk.append(b);
1520
+ }, __tsplusTrace);
1521
+ return tsplus_module_1.match(e => {
1522
+ const partialResult = outputChunk.result();
1523
+ return tsplus_module_14.isNonEmpty(partialResult) ? tsplus_module_13.zipRight(tsplus_module_12.failNow(e))(tsplus_module_12.writeNow(partialResult)) : tsplus_module_12.failNow(e);
1524
+ }, s => tsplus_module_13.zipRight(mapAccumIOAccumulator(s, f, __tsplusTrace))(tsplus_module_12.writeNow(outputChunk.result())), __tsplusTrace)(tsplus_module_1.foldLeft(inp, s, (s1, a) => tsplus_module_1.flatMap(([b, s2]) => tsplus_module_1.as(() => s2, __tsplusTrace)(emit(b)), __tsplusTrace)(f(s1, a)), __tsplusTrace));
1525
+ }, __tsplusTrace)), tsplus_module_12.failNow, () => tsplus_module_12.unit);
1526
+ }
1589
1527
  /**
1590
1528
  * Transforms the chunks emitted by this stream.
1591
1529
  *
@@ -1593,7 +1531,7 @@ function mapAccumIO_1(s, f, __tsplusTrace) {
1593
1531
  */
1594
1532
  function mapChunks_1(f, __tsplusTrace) {
1595
1533
  return stream => {
1596
- return new _definition4.Stream(tsplus_module_10.mapOut(f)(stream.channel));
1534
+ return new _definition4.Stream(tsplus_module_12.mapOut(f)(stream.channel));
1597
1535
  };
1598
1536
  }
1599
1537
  /**
@@ -1603,7 +1541,7 @@ function mapChunks_1(f, __tsplusTrace) {
1603
1541
  */
1604
1542
  function mapChunksIO(f, __tsplusTrace) {
1605
1543
  return stream => {
1606
- return new _definition4.Stream(tsplus_module_10.mapOutIO(f)(stream.channel));
1544
+ return new _definition4.Stream(tsplus_module_12.mapOutIO(f)(stream.channel));
1607
1545
  };
1608
1546
  }
1609
1547
  /**
@@ -1614,7 +1552,7 @@ function mapChunksIO(f, __tsplusTrace) {
1614
1552
  */
1615
1553
  function mapConcat(f, __tsplusTrace) {
1616
1554
  return stream => {
1617
- return mapConcatChunk_1(a => tsplus_module_19.from(f(a)), __tsplusTrace)(stream);
1555
+ return mapConcatChunk_1(a => tsplus_module_21.from(f(a)), __tsplusTrace)(stream);
1618
1556
  };
1619
1557
  }
1620
1558
  /**
@@ -1625,7 +1563,7 @@ function mapConcat(f, __tsplusTrace) {
1625
1563
  */
1626
1564
  function mapConcatChunk_1(f, __tsplusTrace) {
1627
1565
  return stream => {
1628
- return mapChunks_1(c => tsplus_module_12.flatMap(f)(c), __tsplusTrace)(stream);
1566
+ return mapChunks_1(c => tsplus_module_14.flatMap(f)(c), __tsplusTrace)(stream);
1629
1567
  };
1630
1568
  }
1631
1569
  /**
@@ -1647,7 +1585,7 @@ function mapConcatChunkIO(f, __tsplusTrace) {
1647
1585
  */
1648
1586
  function mapConcatIO(f, __tsplusTrace) {
1649
1587
  return stream => {
1650
- return mapConcatChunk_1(_function.identity, __tsplusTrace)(mapIO_1(a => tsplus_module_1.map(tsplus_module_19.from, __tsplusTrace)(f(a)), __tsplusTrace)(stream));
1588
+ return mapConcatChunk_1(_function.identity, __tsplusTrace)(mapIO_1(a => tsplus_module_1.map(tsplus_module_21.from, __tsplusTrace)(f(a)), __tsplusTrace)(stream));
1651
1589
  };
1652
1590
  }
1653
1591
  /**
@@ -1657,7 +1595,7 @@ function mapConcatIO(f, __tsplusTrace) {
1657
1595
  */
1658
1596
  function mapError_1(f, __tsplusTrace) {
1659
1597
  return stream => {
1660
- return new _definition4.Stream(tsplus_module_10.mapError(f)(stream.channel));
1598
+ return new _definition4.Stream(tsplus_module_12.mapError(f)(stream.channel));
1661
1599
  };
1662
1600
  }
1663
1601
  /**
@@ -1667,7 +1605,7 @@ function mapError_1(f, __tsplusTrace) {
1667
1605
  */
1668
1606
  function mapErrorCause(f, __tsplusTrace) {
1669
1607
  return fa => {
1670
- return new _definition4.Stream(tsplus_module_10.mapErrorCause(f)(fa.channel));
1608
+ return new _definition4.Stream(tsplus_module_12.mapErrorCause(f)(fa.channel));
1671
1609
  };
1672
1610
  }
1673
1611
  /**
@@ -1677,17 +1615,9 @@ function mapErrorCause(f, __tsplusTrace) {
1677
1615
  */
1678
1616
  function mapIO_1(f, __tsplusTrace) {
1679
1617
  return stream => {
1680
- return new _definition4.Stream(tsplus_module_10.pipeTo(mapIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(stream.channel));
1618
+ return new _definition4.Stream(tsplus_module_12.pipeTo(mapIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(stream.channel));
1681
1619
  };
1682
1620
  }
1683
- function mapIOLoop(iterator, f, __tsplusTrace) {
1684
- const next = iterator.next();
1685
- if (next.done) {
1686
- return tsplus_module_10.readWithCause(elem => mapIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
1687
- } else {
1688
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => tsplus_module_11.zipRight(mapIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_19.single(b))), __tsplusTrace)(f(next.value)));
1689
- }
1690
- }
1691
1621
  /**
1692
1622
  * Maps over elements of the stream with the specified effectful function,
1693
1623
  * executing up to `n` invocations of `f` concurrently. Transformed elements
@@ -1699,7 +1629,7 @@ function mapIOLoop(iterator, f, __tsplusTrace) {
1699
1629
  */
1700
1630
  function mapIOConcurrently(n, f, __tsplusTrace) {
1701
1631
  return stream => {
1702
- return new _definition4.Stream(tsplus_module_10.mapOut(tsplus_module_19.single)(tsplus_module_57.mapOutConcurrentIO(n, f)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))));
1632
+ return new _definition4.Stream(tsplus_module_12.mapOut(tsplus_module_21.single)(tsplus_module_56.mapOutConcurrentIO(n, f)(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(stream.channel))));
1703
1633
  };
1704
1634
  }
1705
1635
  /**
@@ -1707,9 +1637,17 @@ function mapIOConcurrently(n, f, __tsplusTrace) {
1707
1637
  */
1708
1638
  function mapIOConcurrentlyUnordered(n, f) {
1709
1639
  return self => {
1710
- return pipeThroughChannelOrFail_1(tsplus_module_58.mergeMap(inp => fromIO_1(f(inp), fileName_1 + ":2310:41").channel, n, 16)(tsplus_module_10.concatMap(chunk => tsplus_module_10.writeChunk(chunk))(tsplus_module_10.id())))(self);
1640
+ return pipeThroughChannelOrFail_1(tsplus_module_57.mergeMap(inp => fromIO_1(f(inp), fileName_1 + ":2225:41").channel, n, 16)(tsplus_module_12.concatMap(chunk => tsplus_module_12.writeChunk(chunk))(tsplus_module_12.id())))(self);
1711
1641
  };
1712
1642
  }
1643
+ function mapIOLoop(iterator, f, __tsplusTrace) {
1644
+ const next = iterator.next();
1645
+ if (next.done) {
1646
+ return tsplus_module_12.readWithCause(elem => mapIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_13.failCauseNow, tsplus_module_13.succeedNow);
1647
+ } else {
1648
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(b => tsplus_module_13.zipRight(mapIOLoop(iterator, f, __tsplusTrace))(tsplus_module_12.writeNow(tsplus_module_21.single(b))), __tsplusTrace)(f(next.value)));
1649
+ }
1650
+ }
1713
1651
  /**
1714
1652
  * Merges this stream and the specified stream together.
1715
1653
  *
@@ -1723,6 +1661,14 @@ function merge_1(that, strategy = "Both", __tsplusTrace) {
1723
1661
  return mergeWith_1(that, _function.identity, _function.identity, strategy, __tsplusTrace)(self);
1724
1662
  };
1725
1663
  }
1664
+ /**
1665
+ * @tsplus pipeable fncts.io.Stream mergeEither
1666
+ */
1667
+ function mergeEither_1(fb, __tsplusTrace) {
1668
+ return fa => {
1669
+ return mergeWith_1(fb, tsplus_module_20.left, tsplus_module_20.right)(fa);
1670
+ };
1671
+ }
1726
1672
  /**
1727
1673
  * Merges this stream and the specified stream together. New produced stream
1728
1674
  * will terminate when either stream terminates.
@@ -1767,17 +1713,6 @@ function mergeLeft(that, __tsplusTrace) {
1767
1713
  return merge_1(drain_1(that, __tsplusTrace))(self);
1768
1714
  };
1769
1715
  }
1770
- /**
1771
- * Merges this stream and the specified stream together, discarding the values
1772
- * from the left stream.
1773
- *
1774
- * @tsplus pipeable fncts.io.Stream mergeRight
1775
- */
1776
- function mergeRight(that, __tsplusTrace) {
1777
- return self => {
1778
- return merge_1(that)(drain_1(self, __tsplusTrace));
1779
- };
1780
- }
1781
1716
  /**
1782
1717
  * Maps each element of this stream to another stream and returns the
1783
1718
  * non-deterministic merge of those streams, executing up to `n` inner streams
@@ -1788,7 +1723,7 @@ function mergeRight(that, __tsplusTrace) {
1788
1723
  */
1789
1724
  function mergeMap_1(f, n, bufferSize = 16, __tsplusTrace) {
1790
1725
  return ma => {
1791
- return new _definition4.Stream(tsplus_module_58.mergeMap(a => f(a).channel, n, bufferSize)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(ma.channel)));
1726
+ return new _definition4.Stream(tsplus_module_57.mergeMap(a => f(a).channel, n, bufferSize)(tsplus_module_12.concatMap(tsplus_module_12.writeChunk)(ma.channel)));
1792
1727
  };
1793
1728
  }
1794
1729
  /**
@@ -1804,24 +1739,27 @@ function mergeMapIO(f, n, bufferSize = 16, __tsplusTrace) {
1804
1739
  };
1805
1740
  }
1806
1741
  /**
1807
- * @tsplus pipeable fncts.io.Stream mergeEither
1742
+ * Merges this stream and the specified stream together, discarding the values
1743
+ * from the left stream.
1744
+ *
1745
+ * @tsplus pipeable fncts.io.Stream mergeRight
1808
1746
  */
1809
- function mergeEither_1(fb, __tsplusTrace) {
1810
- return fa => {
1811
- return mergeWith_1(fb, tsplus_module_18.left, tsplus_module_18.right)(fa);
1747
+ function mergeRight(that, __tsplusTrace) {
1748
+ return self => {
1749
+ return merge_1(that)(drain_1(self, __tsplusTrace));
1812
1750
  };
1813
1751
  }
1814
- function mergeWithHandler(terminate, __tsplusTrace) {
1815
- return exit => terminate || !tsplus_module_52.isSuccess(exit) ? tsplus_module_59.done(tsplus_module_1.fromExitNow(exit, __tsplusTrace)) : tsplus_module_59.wait(tsplus_module_1.fromExitNow);
1816
- }
1817
1752
  /**
1818
1753
  * @tsplus pipeable fncts.io.Stream mergeWith
1819
1754
  */
1820
1755
  function mergeWith_1(sb, l, r, strategy = "Both", __tsplusTrace) {
1821
1756
  return sa => {
1822
- return new _definition4.Stream(tsplus_module_60.mergeWith(map_1(r, __tsplusTrace)(sb).channel, mergeWithHandler(strategy === "Either" || strategy === "Left", __tsplusTrace), mergeWithHandler(strategy === "Either" || strategy === "Right", __tsplusTrace))(map_1(l, __tsplusTrace)(sa).channel));
1757
+ return new _definition4.Stream(tsplus_module_58.mergeWith(map_1(r, __tsplusTrace)(sb).channel, mergeWithHandler(strategy === "Either" || strategy === "Left", __tsplusTrace), mergeWithHandler(strategy === "Either" || strategy === "Right", __tsplusTrace))(map_1(l, __tsplusTrace)(sa).channel));
1823
1758
  };
1824
1759
  }
1760
+ function mergeWithHandler(terminate, __tsplusTrace) {
1761
+ return exit => terminate || !tsplus_module_52.isSuccess(exit) ? tsplus_module_59.done(tsplus_module_1.fromExitNow(exit, __tsplusTrace)) : tsplus_module_59.wait(tsplus_module_1.fromExitNow);
1762
+ }
1825
1763
  /**
1826
1764
  * Runs the specified effect if this stream fails, providing the error to the effect if it exists.
1827
1765
  *
@@ -1843,7 +1781,7 @@ function onError(cleanup, __tsplusTrace) {
1843
1781
  */
1844
1782
  function orElse_1(that, __tsplusTrace) {
1845
1783
  return stream => {
1846
- return new _definition4.Stream(tsplus_module_10.orElse(that().channel)(stream.channel));
1784
+ return new _definition4.Stream(tsplus_module_12.orElse(that().channel)(stream.channel));
1847
1785
  };
1848
1786
  }
1849
1787
  /**
@@ -1855,7 +1793,7 @@ function orElse_1(that, __tsplusTrace) {
1855
1793
  */
1856
1794
  function orElseEither(that, __tsplusTrace) {
1857
1795
  return stream => {
1858
- return orElse_1(() => map_1(tsplus_module_18.right, __tsplusTrace)(that()), __tsplusTrace)(map_1(tsplus_module_18.left, __tsplusTrace)(stream));
1796
+ return orElse_1(() => map_1(tsplus_module_20.right, __tsplusTrace)(that()), __tsplusTrace)(map_1(tsplus_module_20.left, __tsplusTrace)(stream));
1859
1797
  };
1860
1798
  }
1861
1799
  /**
@@ -1876,7 +1814,7 @@ function orElseFail(e, __tsplusTrace) {
1876
1814
  * See also Stream#catchAll.
1877
1815
  */
1878
1816
  function orElseOptional(stream, that, __tsplusTrace) {
1879
- return catchAll_1(maybeError => tsplus_module_20.match(() => that(), e => failNow_1(tsplus_module_3.just(e, __tsplusTrace), __tsplusTrace))(maybeError), __tsplusTrace)(stream);
1817
+ return catchAll_1(maybeError => tsplus_module_22.match(() => that(), e => failNow_1(tsplus_module_5.just(e, __tsplusTrace), __tsplusTrace))(maybeError), __tsplusTrace)(stream);
1880
1818
  }
1881
1819
  /**
1882
1820
  * Succeeds with the specified value if this one fails with a typed error.
@@ -1893,7 +1831,7 @@ function orElseSucceed(a, __tsplusTrace) {
1893
1831
  */
1894
1832
  function pipeThrough_1(sa, __tsplusTrace) {
1895
1833
  return ma => {
1896
- return new _definition4.Stream(tsplus_module_10.pipeToOrFail(sa.channel)(ma.channel));
1834
+ return new _definition4.Stream(tsplus_module_12.pipeToOrFail(sa.channel)(ma.channel));
1897
1835
  };
1898
1836
  }
1899
1837
  /**
@@ -1901,7 +1839,7 @@ function pipeThrough_1(sa, __tsplusTrace) {
1901
1839
  */
1902
1840
  function pipeThroughChannelOrFail_1(channel) {
1903
1841
  return self => {
1904
- return new _definition4.Stream(tsplus_module_10.pipeToOrFail(channel)(self.channel));
1842
+ return new _definition4.Stream(tsplus_module_12.pipeToOrFail(channel)(self.channel));
1905
1843
  };
1906
1844
  }
1907
1845
  /**
@@ -1912,7 +1850,7 @@ function pipeThroughChannelOrFail_1(channel) {
1912
1850
  */
1913
1851
  function provideEnvironment_1(r, __tsplusTrace) {
1914
1852
  return ra => {
1915
- return new _definition4.Stream(tsplus_module_10.provideEnvironment(() => r)(ra.channel));
1853
+ return new _definition4.Stream(tsplus_module_12.provideEnvironment(() => r)(ra.channel));
1916
1854
  };
1917
1855
  }
1918
1856
  /**
@@ -1920,7 +1858,7 @@ function provideEnvironment_1(r, __tsplusTrace) {
1920
1858
  */
1921
1859
  function provideLayer_1(layer, __tsplusTrace) {
1922
1860
  return self => {
1923
- return new _definition4.Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_10.provideEnvironment(() => r)(self.channel), __tsplusTrace)(tsplus_module_61.build(layer, __tsplusTrace))));
1861
+ return new _definition4.Stream(tsplus_module_12.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_12.provideEnvironment(() => r)(self.channel), __tsplusTrace)(tsplus_module_60.build(layer, __tsplusTrace))));
1924
1862
  };
1925
1863
  }
1926
1864
  /**
@@ -1929,7 +1867,19 @@ function provideLayer_1(layer, __tsplusTrace) {
1929
1867
  function provideSomeLayer(layer, __tsplusTrace) {
1930
1868
  return self => {
1931
1869
  // @ts-expect-error
1932
- return provideLayer_1(tsplus_module_62.and(layer, __tsplusTrace)(tsplus_module_62.environment(__tsplusTrace)), __tsplusTrace)(self);
1870
+ return provideLayer_1(tsplus_module_61.and(layer, __tsplusTrace)(tsplus_module_61.environment(__tsplusTrace)), __tsplusTrace)(self);
1871
+ };
1872
+ }
1873
+ /**
1874
+ * Re-chunks the elements of the stream into chunks of
1875
+ * `n` elements each.
1876
+ * The last chunk might contain less than `n` elements
1877
+ *
1878
+ * @tsplus pipeable fncts.io.Stream rechunk
1879
+ */
1880
+ function rechunk(n, __tsplusTrace) {
1881
+ return stream => {
1882
+ return new _definition4.Stream(tsplus_module_12.pipeTo(rechunkProcess(new Rechunker(n), n, __tsplusTrace))(stream.channel));
1933
1883
  };
1934
1884
  }
1935
1885
  class Rechunker {
@@ -1945,15 +1895,15 @@ class Rechunker {
1945
1895
  const result = this.builder;
1946
1896
  this.builder = [];
1947
1897
  this.pos = 0;
1948
- return tsplus_module_19.from(result);
1898
+ return tsplus_module_21.from(result);
1949
1899
  }
1950
1900
  return null;
1951
1901
  }
1952
1902
  emitOfNotEmpty() {
1953
1903
  if (this.pos !== 0) {
1954
- return tsplus_module_10.writeNow(tsplus_module_19.from(this.builder));
1904
+ return tsplus_module_12.writeNow(tsplus_module_21.from(this.builder));
1955
1905
  } else {
1956
- return tsplus_module_10.unit;
1906
+ return tsplus_module_12.unit;
1957
1907
  }
1958
1908
  }
1959
1909
  get isEmpty() {
@@ -1961,16 +1911,16 @@ class Rechunker {
1961
1911
  }
1962
1912
  }
1963
1913
  function rechunkProcess(rechunker, target, __tsplusTrace) {
1964
- return tsplus_module_10.readWithCause(chunk => {
1914
+ return tsplus_module_12.readWithCause(chunk => {
1965
1915
  if (chunk.length === target && rechunker.isEmpty) {
1966
- return tsplus_module_11.zipRight(rechunkProcess(rechunker, target, __tsplusTrace))(tsplus_module_10.writeNow(chunk));
1916
+ return tsplus_module_13.zipRight(rechunkProcess(rechunker, target, __tsplusTrace))(tsplus_module_12.writeNow(chunk));
1967
1917
  } else if (chunk.length > 0) {
1968
1918
  const chunks = [];
1969
1919
  let result = null;
1970
1920
  let i = 0;
1971
1921
  while (i < chunk.length) {
1972
1922
  while (i < chunk.length && result === null) {
1973
- result = rechunker.write(tsplus_module_12.unsafeGet(i)(chunk));
1923
+ result = rechunker.write(tsplus_module_14.unsafeGet(i)(chunk));
1974
1924
  i += 1;
1975
1925
  }
1976
1926
  if (result !== null) {
@@ -1978,39 +1928,35 @@ function rechunkProcess(rechunker, target, __tsplusTrace) {
1978
1928
  result = null;
1979
1929
  }
1980
1930
  }
1981
- return tsplus_module_11.zipRight(rechunkProcess(rechunker, target, __tsplusTrace))(tsplus_module_10.writeAll(chunks));
1931
+ return tsplus_module_13.zipRight(rechunkProcess(rechunker, target, __tsplusTrace))(tsplus_module_12.writeAll(chunks));
1982
1932
  } else {
1983
1933
  return rechunkProcess(rechunker, target, __tsplusTrace);
1984
1934
  }
1985
- }, cause => tsplus_module_11.zipRight(tsplus_module_11.failCauseNow(cause))(rechunker.emitOfNotEmpty()), () => rechunker.emitOfNotEmpty());
1935
+ }, cause => tsplus_module_13.zipRight(tsplus_module_13.failCauseNow(cause))(rechunker.emitOfNotEmpty()), () => rechunker.emitOfNotEmpty());
1986
1936
  }
1987
1937
  /**
1988
- * Re-chunks the elements of the stream into chunks of
1989
- * `n` elements each.
1990
- * The last chunk might contain less than `n` elements
1938
+ * Creates a stream from an effect producing a value of type `A` which repeats forever.
1991
1939
  *
1992
- * @tsplus pipeable fncts.io.Stream rechunk
1940
+ * @tsplus static fncts.io.StreamOps repeatIO
1993
1941
  */
1994
- function rechunk(n, __tsplusTrace) {
1995
- return stream => {
1996
- return new _definition4.Stream(tsplus_module_10.pipeTo(rechunkProcess(new Rechunker(n), n, __tsplusTrace))(stream.channel));
1997
- };
1942
+ function repeatIO(fa, __tsplusTrace) {
1943
+ return repeatIOMaybe_1(tsplus_module_1.mapError(tsplus_module_5.just, __tsplusTrace)(fa), __tsplusTrace);
1998
1944
  }
1999
1945
  /**
2000
- * Repeats the provided value infinitely.
1946
+ * Creates a stream from an effect producing chunks of `A` values which repeats forever.
2001
1947
  *
2002
- * @tsplus static fncts.io.StreamOps repeatValue
1948
+ * @tsplus static fncts.io.StreamOps repeatIOChunk
2003
1949
  */
2004
- function repeatValue(a, __tsplusTrace) {
2005
- return new _definition4.Stream(tsplus_module_10.repeated(tsplus_module_10.writeNow(tsplus_module_19.single(a))));
1950
+ function repeatIOChunk(fa, __tsplusTrace) {
1951
+ return repeatIOChunkMaybe_1(tsplus_module_1.mapError(tsplus_module_5.just, __tsplusTrace)(fa), __tsplusTrace);
2006
1952
  }
2007
1953
  /**
2008
- * Creates a stream from an effect producing a value of type `A` which repeats forever.
1954
+ * Creates a stream from an effect producing chunks of `A` values until it fails with None.
2009
1955
  *
2010
- * @tsplus static fncts.io.StreamOps repeatIO
1956
+ * @tsplus static fncts.io.StreamOps repeatIOChunkMaybe
2011
1957
  */
2012
- function repeatIO(fa, __tsplusTrace) {
2013
- return repeatIOMaybe_1(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(fa), __tsplusTrace);
1958
+ function repeatIOChunkMaybe_1(fa, __tsplusTrace) {
1959
+ return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll(maybeError => tsplus_module_22.match(() => tsplus_module_1.succeedNow(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace), tsplus_module_1.failNow)(maybeError), __tsplusTrace)(tsplus_module_1.map(chunk => tsplus_module_5.just((0, _function.tuple)(chunk, undefined), __tsplusTrace), __tsplusTrace)(fa)), __tsplusTrace);
2014
1960
  }
2015
1961
  /**
2016
1962
  * Creates a stream from an effect producing values of type `A` until it fails with None.
@@ -2018,23 +1964,15 @@ function repeatIO(fa, __tsplusTrace) {
2018
1964
  * @tsplus static fncts.io.StreamOps repeatIOMaybe
2019
1965
  */
2020
1966
  function repeatIOMaybe_1(fa, __tsplusTrace) {
2021
- return repeatIOChunkMaybe_1(tsplus_module_1.map(tsplus_module_19.single, __tsplusTrace)(fa), __tsplusTrace);
2022
- }
2023
- /**
2024
- * Creates a stream from an effect producing chunks of `A` values which repeats forever.
2025
- *
2026
- * @tsplus static fncts.io.StreamOps repeatIOChunk
2027
- */
2028
- function repeatIOChunk(fa, __tsplusTrace) {
2029
- return repeatIOChunkMaybe_1(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(fa), __tsplusTrace);
1967
+ return repeatIOChunkMaybe_1(tsplus_module_1.map(tsplus_module_21.single, __tsplusTrace)(fa), __tsplusTrace);
2030
1968
  }
2031
1969
  /**
2032
- * Creates a stream from an effect producing chunks of `A` values until it fails with None.
1970
+ * Repeats the provided value infinitely.
2033
1971
  *
2034
- * @tsplus static fncts.io.StreamOps repeatIOChunkMaybe
1972
+ * @tsplus static fncts.io.StreamOps repeatValue
2035
1973
  */
2036
- function repeatIOChunkMaybe_1(fa, __tsplusTrace) {
2037
- return unfoldChunkIO_1(undefined, _ => tsplus_module_1.catchAll(maybeError => tsplus_module_20.match(() => tsplus_module_1.succeedNow(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace), tsplus_module_1.failNow)(maybeError), __tsplusTrace)(tsplus_module_1.map(chunk => tsplus_module_3.just((0, _function.tuple)(chunk, undefined), __tsplusTrace), __tsplusTrace)(fa)), __tsplusTrace);
1974
+ function repeatValue(a, __tsplusTrace) {
1975
+ return new _definition4.Stream(tsplus_module_12.repeated(tsplus_module_12.writeNow(tsplus_module_21.single(a))));
2038
1976
  }
2039
1977
  /**
2040
1978
  * Runs the sink on the stream to produce either the sink's result or an error.
@@ -2043,7 +1981,7 @@ function repeatIOChunkMaybe_1(fa, __tsplusTrace) {
2043
1981
  */
2044
1982
  function run_1(sink, __tsplusTrace) {
2045
1983
  return stream => {
2046
- return tsplus_module_63.runDrain(tsplus_module_10.pipeToOrFail(sink.channel)(stream.channel));
1984
+ return tsplus_module_62.runDrain(tsplus_module_12.pipeToOrFail(sink.channel)(stream.channel));
2047
1985
  };
2048
1986
  }
2049
1987
  /**
@@ -2052,7 +1990,7 @@ function run_1(sink, __tsplusTrace) {
2052
1990
  * @tsplus getter fncts.io.Stream runCollect
2053
1991
  */
2054
1992
  function runCollect(stream, __tsplusTrace) {
2055
- return run_1(tsplus_module_47.makeCollectAll(__tsplusTrace), __tsplusTrace)(stream);
1993
+ return run_1(tsplus_module_48.makeCollectAll(__tsplusTrace), __tsplusTrace)(stream);
2056
1994
  }
2057
1995
  /**
2058
1996
  * Runs the stream and collects ignore its elements.
@@ -2060,14 +1998,14 @@ function runCollect(stream, __tsplusTrace) {
2060
1998
  * @tsplus getter fncts.io.Stream runDrain
2061
1999
  */
2062
2000
  function runDrain(stream, __tsplusTrace) {
2063
- return run_1(tsplus_module_47.drain, __tsplusTrace)(stream);
2001
+ return run_1(tsplus_module_48.drain, __tsplusTrace)(stream);
2064
2002
  }
2065
2003
  /**
2066
2004
  * @tsplus pipeable fncts.io.Stream runForeachScoped
2067
2005
  */
2068
2006
  function runForeachScoped_1(f, __tsplusTrace) {
2069
2007
  return self => {
2070
- return runScoped_1(tsplus_module_47.makeForeach(f, __tsplusTrace), __tsplusTrace)(self);
2008
+ return runScoped_1(tsplus_module_48.makeForeach(f, __tsplusTrace), __tsplusTrace)(self);
2071
2009
  };
2072
2010
  }
2073
2011
  /**
@@ -2078,20 +2016,19 @@ function runForeachScoped_1(f, __tsplusTrace) {
2078
2016
  */
2079
2017
  function runIntoElementsScoped_(queue, __tsplusTrace) {
2080
2018
  return stream => {
2081
- const writer = tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(writer)(tsplus_module_12.foldLeft(tsplus_module_10.unit, (channel, a) => tsplus_module_11.zipRight(tsplus_module_10.writeNow(tsplus_module_41.succeed(a, __tsplusTrace)))(channel))(inp)), err => tsplus_module_10.writeNow(tsplus_module_41.fail(tsplus_module_3.just(err, __tsplusTrace), __tsplusTrace)), () => tsplus_module_10.writeNow(tsplus_module_41.fail(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace)));
2082
- return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO(exit => tsplus_module_28.offer(exit, __tsplusTrace)(queue))(tsplus_module_10.pipeTo(writer)(stream.channel)))), __tsplusTrace);
2019
+ const writer = tsplus_module_12.readWith(inp => tsplus_module_13.zipRight(writer)(tsplus_module_14.foldLeft(tsplus_module_12.unit, (channel, a) => tsplus_module_13.zipRight(tsplus_module_12.writeNow(tsplus_module_41.succeed(a, __tsplusTrace)))(channel))(inp)), err => tsplus_module_12.writeNow(tsplus_module_41.fail(tsplus_module_5.just(err, __tsplusTrace), __tsplusTrace)), () => tsplus_module_12.writeNow(tsplus_module_41.fail(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace)));
2020
+ return tsplus_module_1.asUnit(tsplus_module_18.runScoped(tsplus_module_12.drain(tsplus_module_12.mapOutIO(exit => tsplus_module_30.offer(exit, __tsplusTrace)(queue))(tsplus_module_12.pipeTo(writer)(stream.channel)))), __tsplusTrace);
2083
2021
  };
2084
2022
  }
2085
2023
  /**
2086
- * Like `Stream#into`, but provides the result as a `Managed` to allow for scope
2024
+ * Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
2087
2025
  * composition.
2088
2026
  *
2089
- * @tsplus pipeable fncts.io.Stream runIntoQueueScoped
2027
+ * @tsplus pipeable fncts.io.Stream runIntoHubScoped
2090
2028
  */
2091
- function runIntoQueueScoped_1(queue, __tsplusTrace) {
2029
+ function runIntoHubScoped_1(hub, __tsplusTrace) {
2092
2030
  return stream => {
2093
- const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.zipRight(writer)(tsplus_module_10.writeNow(tsplus_module_27.chunk(inp))), cause => tsplus_module_10.writeNow(tsplus_module_27.failCause(cause)), _ => tsplus_module_10.writeNow(tsplus_module_27.end));
2094
- return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO(take => tsplus_module_28.offer(take, __tsplusTrace)(queue))(tsplus_module_10.pipeTo(writer)(stream.channel)))), __tsplusTrace);
2031
+ return runIntoQueueScoped_1(hub, __tsplusTrace)(stream);
2095
2032
  };
2096
2033
  }
2097
2034
  /**
@@ -2104,20 +2041,21 @@ function runIntoQueueElementsScoped_1(queue) {
2104
2041
  return self => {
2105
2042
  return tsplus_module_1.defer(() => {
2106
2043
  const queue0 = queue();
2107
- const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.zipRight(writer)(tsplus_module_10.fromIO(() => tsplus_module_28.offerAll(tsplus_module_12.map(a => tsplus_module_41.succeed(a, fileName_1 + ":2819:85"))(inp), fileName_1 + ":2819:57")(queue0))), cause => tsplus_module_10.fromIO(() => tsplus_module_28.offer(tsplus_module_41.failCause(tsplus_module_25.map(e => tsplus_module_3.just(e, fileName_1 + ":2820:84"))(cause), fileName_1 + ":2820:62"), fileName_1 + ":2820:47")(queue0)), () => tsplus_module_10.fromIO(() => tsplus_module_28.offer(tsplus_module_41.fail(tsplus_module_3.nothing(fileName_1 + ":2821:60"), fileName_1 + ":2821:52"), fileName_1 + ":2821:42")(queue0)));
2108
- return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.pipeTo(writer)(self.channel))), fileName_1 + ":2824:55");
2109
- }, fileName_1 + ":2816:20");
2044
+ const writer = tsplus_module_12.readWithCause(inp => tsplus_module_13.zipRight(writer)(tsplus_module_12.fromIO(() => tsplus_module_30.offerAll(tsplus_module_14.map(a => tsplus_module_41.succeed(a, fileName_1 + ":2746:85"))(inp), fileName_1 + ":2746:57")(queue0))), cause => tsplus_module_12.fromIO(() => tsplus_module_30.offer(tsplus_module_41.failCause(tsplus_module_27.map(e => tsplus_module_5.just(e, fileName_1 + ":2747:84"))(cause), fileName_1 + ":2747:62"), fileName_1 + ":2747:47")(queue0)), () => tsplus_module_12.fromIO(() => tsplus_module_30.offer(tsplus_module_41.fail(tsplus_module_5.nothing(fileName_1 + ":2748:60"), fileName_1 + ":2748:52"), fileName_1 + ":2748:42")(queue0)));
2045
+ return tsplus_module_1.asUnit(tsplus_module_18.runScoped(tsplus_module_12.drain(tsplus_module_12.pipeTo(writer)(self.channel))), fileName_1 + ":2751:55");
2046
+ }, fileName_1 + ":2743:20");
2110
2047
  };
2111
2048
  }
2112
2049
  /**
2113
- * Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
2050
+ * Like `Stream#into`, but provides the result as a `Managed` to allow for scope
2114
2051
  * composition.
2115
2052
  *
2116
- * @tsplus pipeable fncts.io.Stream runIntoHubScoped
2053
+ * @tsplus pipeable fncts.io.Stream runIntoQueueScoped
2117
2054
  */
2118
- function runIntoHubScoped_1(hub, __tsplusTrace) {
2055
+ function runIntoQueueScoped_1(queue, __tsplusTrace) {
2119
2056
  return stream => {
2120
- return runIntoQueueScoped_1(hub, __tsplusTrace)(stream);
2057
+ const writer = tsplus_module_12.readWithCause(inp => tsplus_module_13.zipRight(writer)(tsplus_module_12.writeNow(tsplus_module_29.chunk(inp))), cause => tsplus_module_12.writeNow(tsplus_module_29.failCause(cause)), _ => tsplus_module_12.writeNow(tsplus_module_29.end));
2058
+ return tsplus_module_1.asUnit(tsplus_module_18.runScoped(tsplus_module_12.drain(tsplus_module_12.mapOutIO(take => tsplus_module_30.offer(take, __tsplusTrace)(queue))(tsplus_module_12.pipeTo(writer)(stream.channel)))), __tsplusTrace);
2121
2059
  };
2122
2060
  }
2123
2061
  /**
@@ -2127,7 +2065,7 @@ function runIntoHubScoped_1(hub, __tsplusTrace) {
2127
2065
  */
2128
2066
  function runScoped_1(sink, __tsplusTrace) {
2129
2067
  return stream => {
2130
- return tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.pipeToOrFail(sink.channel)(stream.channel)));
2068
+ return tsplus_module_18.runScoped(tsplus_module_12.drain(tsplus_module_12.pipeToOrFail(sink.channel)(stream.channel)));
2131
2069
  };
2132
2070
  }
2133
2071
  /**
@@ -2171,7 +2109,68 @@ function scanReduce(f, __tsplusTrace) {
2171
2109
  */
2172
2110
  function scanReduceIO_1(f, __tsplusTrace) {
2173
2111
  return fa => {
2174
- return mapAccumIO_1(tsplus_module_3.nothing(__tsplusTrace), (s, a) => tsplus_module_20.match(() => tsplus_module_1.succeedNow([a, tsplus_module_3.just(a, __tsplusTrace)], __tsplusTrace), b => tsplus_module_1.map(b => [b, tsplus_module_3.just(b, __tsplusTrace)], __tsplusTrace)(f(b, a)))(s), __tsplusTrace)(fa);
2112
+ return mapAccumIO_1(tsplus_module_5.nothing(__tsplusTrace), (s, a) => tsplus_module_22.match(() => tsplus_module_1.succeedNow([a, tsplus_module_5.just(a, __tsplusTrace)], __tsplusTrace), b => tsplus_module_1.map(b => [b, tsplus_module_5.just(b, __tsplusTrace)], __tsplusTrace)(f(b, a)))(s), __tsplusTrace)(fa);
2113
+ };
2114
+ }
2115
+ /**
2116
+ * Creates a single-valued stream from a managed resource
2117
+ *
2118
+ * @tsplus static fncts.io.StreamOps scoped
2119
+ */
2120
+ function scoped_1(stream, __tsplusTrace) {
2121
+ return new _definition4.Stream(tsplus_module_12.scoped(() => tsplus_module_1.map(tsplus_module_21.single, __tsplusTrace)(stream())));
2122
+ }
2123
+ /**
2124
+ * Emits a sliding window of n elements.
2125
+ *
2126
+ * @tsplus pipeable fncts.io.Stream sliding
2127
+ */
2128
+ function sliding(chunkSize, stepSize, __tsplusTrace) {
2129
+ return self => {
2130
+ return defer_1(() => {
2131
+ function slidingChunk(chunk, input) {
2132
+ const updatedChunk = tsplus_module_14.concat(input)(chunk);
2133
+ const length = updatedChunk.length;
2134
+ if (length >= chunkSize) {
2135
+ const array = new Array((length - chunkSize) / stepSize + 1);
2136
+ let arrayIndex = 0;
2137
+ let chunkIndex = 0;
2138
+ while (chunkIndex + chunkSize <= length) {
2139
+ array[arrayIndex] = tsplus_module_14.slice(chunkIndex, chunkIndex + chunkSize)(updatedChunk);
2140
+ arrayIndex += 1;
2141
+ chunkIndex += stepSize;
2142
+ }
2143
+ return [tsplus_module_14.drop(chunkIndex)(updatedChunk), tsplus_module_63.fromArray(array)];
2144
+ } else {
2145
+ return [updatedChunk, tsplus_module_9.empty()];
2146
+ }
2147
+ }
2148
+ function sliding(chunk, written) {
2149
+ return tsplus_module_12.readWithCause(input => {
2150
+ const [updatedChunk, out] = slidingChunk(chunk, input);
2151
+ if (tsplus_module_14.isEmpty(out)) {
2152
+ return sliding(updatedChunk, written);
2153
+ } else {
2154
+ return tsplus_module_13.zipRight(sliding(updatedChunk, true))(tsplus_module_12.writeNow(out));
2155
+ }
2156
+ }, err => {
2157
+ const index = written && chunkSize > stepSize ? chunkSize - stepSize : 0;
2158
+ if (index >= chunk.length) {
2159
+ return tsplus_module_13.failCauseNow(err);
2160
+ } else {
2161
+ return tsplus_module_13.zipRight(tsplus_module_13.failCauseNow(err))(tsplus_module_12.writeNow(tsplus_module_21.single(chunk)));
2162
+ }
2163
+ }, done => {
2164
+ const index = written && chunkSize > stepSize ? chunkSize - stepSize : 0;
2165
+ if (index >= chunk.length) {
2166
+ return tsplus_module_13.succeedNow(done);
2167
+ } else {
2168
+ return tsplus_module_13.zipRight(tsplus_module_13.succeedNow(done))(tsplus_module_12.writeNow(tsplus_module_21.single(chunk)));
2169
+ }
2170
+ });
2171
+ }
2172
+ return new _definition4.Stream(tsplus_module_12.pipeTo(sliding(tsplus_module_9.empty(), false))(self.channel));
2173
+ });
2175
2174
  };
2176
2175
  }
2177
2176
  /**
@@ -2180,53 +2179,42 @@ function scanReduceIO_1(f, __tsplusTrace) {
2180
2179
  function split(predicate, __tsplusTrace) {
2181
2180
  return self => {
2182
2181
  function split(leftovers, input) {
2183
- const [chunk, remaining] = tsplus_module_12.splitWhere(predicate)(tsplus_module_12.concat(input)(leftovers));
2184
- if (tsplus_module_12.isEmpty(chunk) || tsplus_module_12.isEmpty(remaining)) {
2185
- return loop(tsplus_module_12.concat(tsplus_module_12.drop(1)(remaining))(chunk));
2182
+ const [chunk, remaining] = tsplus_module_14.splitWhere(predicate)(tsplus_module_14.concat(input)(leftovers));
2183
+ if (tsplus_module_14.isEmpty(chunk) || tsplus_module_14.isEmpty(remaining)) {
2184
+ return loop(tsplus_module_14.concat(tsplus_module_14.drop(1)(remaining))(chunk));
2186
2185
  } else {
2187
- return tsplus_module_11.zipRight(split(tsplus_module_7.empty(), tsplus_module_12.drop(1)(remaining)))(tsplus_module_10.writeNow(tsplus_module_19.single(chunk)));
2186
+ return tsplus_module_13.zipRight(split(tsplus_module_9.empty(), tsplus_module_14.drop(1)(remaining)))(tsplus_module_12.writeNow(tsplus_module_21.single(chunk)));
2188
2187
  }
2189
2188
  }
2190
2189
  function loop(leftovers) {
2191
- return tsplus_module_10.readWith(input => split(leftovers, input), tsplus_module_10.failNow, _ => {
2192
- if (tsplus_module_12.isEmpty(leftovers)) {
2193
- return tsplus_module_10.unit;
2194
- } else if (tsplus_module_64.isNothing(tsplus_module_12.find(predicate)(leftovers))) {
2195
- return tsplus_module_11.zipRight(tsplus_module_10.unit)(tsplus_module_10.writeNow(tsplus_module_19.single(leftovers)));
2190
+ return tsplus_module_12.readWith(input => split(leftovers, input), tsplus_module_12.failNow, _ => {
2191
+ if (tsplus_module_14.isEmpty(leftovers)) {
2192
+ return tsplus_module_12.unit;
2193
+ } else if (tsplus_module_64.isNothing(tsplus_module_14.find(predicate)(leftovers))) {
2194
+ return tsplus_module_13.zipRight(tsplus_module_12.unit)(tsplus_module_12.writeNow(tsplus_module_21.single(leftovers)));
2196
2195
  } else {
2197
- return tsplus_module_11.zipRight(tsplus_module_10.unit)(split(tsplus_module_7.empty(), leftovers));
2196
+ return tsplus_module_13.zipRight(tsplus_module_12.unit)(split(tsplus_module_9.empty(), leftovers));
2198
2197
  }
2199
2198
  });
2200
2199
  }
2201
- return new _definition4.Stream(tsplus_module_10.pipeTo(loop(tsplus_module_7.empty()))(self.channel));
2200
+ return new _definition4.Stream(tsplus_module_12.pipeTo(loop(tsplus_module_9.empty()))(self.channel));
2202
2201
  };
2203
2202
  }
2204
2203
  /**
2205
2204
  * Creates a single-valued pure stream
2206
2205
  *
2207
- * @tsplus static fncts.io.StreamOps succeedNow
2206
+ * @tsplus static fncts.io.StreamOps succeed
2208
2207
  */
2209
- function succeedNow_1(o, __tsplusTrace) {
2210
- return fromChunkNow_1(tsplus_module_19.single(o), __tsplusTrace);
2208
+ function succeed(a, __tsplusTrace) {
2209
+ return fromChunk_1(() => tsplus_module_21.single(a()), __tsplusTrace);
2211
2210
  }
2212
2211
  /**
2213
2212
  * Creates a single-valued pure stream
2214
2213
  *
2215
- * @tsplus static fncts.io.StreamOps succeed
2214
+ * @tsplus static fncts.io.StreamOps succeedNow
2216
2215
  */
2217
- function succeed(a, __tsplusTrace) {
2218
- return fromChunk_1(() => tsplus_module_19.single(a()), __tsplusTrace);
2219
- }
2220
- function takeLoop(n, __tsplusTrace) {
2221
- return tsplus_module_10.readWithCause(inp => {
2222
- const taken = tsplus_module_12.take(n)(inp);
2223
- const left = Math.max(n - taken.length, 0);
2224
- if (left > 0) {
2225
- return tsplus_module_11.zipRight(takeLoop(left, __tsplusTrace))(tsplus_module_10.writeNow(taken));
2226
- } else {
2227
- return tsplus_module_10.writeNow(taken);
2228
- }
2229
- }, tsplus_module_11.failCauseNow, tsplus_module_11.endNow);
2216
+ function succeedNow_1(o, __tsplusTrace) {
2217
+ return fromChunkNow_1(tsplus_module_21.single(o), __tsplusTrace);
2230
2218
  }
2231
2219
  /**
2232
2220
  * Takes the specified number of elements from this stream.
@@ -2241,7 +2229,29 @@ function take(n, __tsplusTrace) {
2241
2229
  if (!Number.isInteger(n)) {
2242
2230
  return halt_1(() => new tsplus_module_65.IllegalArgumentError(`${n} should be an integer`, "Stream.take"), __tsplusTrace);
2243
2231
  }
2244
- return new _definition4.Stream(tsplus_module_10.pipeTo(takeLoop(n, __tsplusTrace))(stream.channel));
2232
+ return new _definition4.Stream(tsplus_module_12.pipeTo(takeLoop(n, __tsplusTrace))(stream.channel));
2233
+ };
2234
+ }
2235
+ function takeLoop(n, __tsplusTrace) {
2236
+ return tsplus_module_12.readWithCause(inp => {
2237
+ const taken = tsplus_module_14.take(n)(inp);
2238
+ const left = Math.max(n - taken.length, 0);
2239
+ if (left > 0) {
2240
+ return tsplus_module_13.zipRight(takeLoop(left, __tsplusTrace))(tsplus_module_12.writeNow(taken));
2241
+ } else {
2242
+ return tsplus_module_12.writeNow(taken);
2243
+ }
2244
+ }, tsplus_module_13.failCauseNow, tsplus_module_13.endNow);
2245
+ }
2246
+ /**
2247
+ * Takes all elements of the stream until the specified predicate evaluates
2248
+ * to `true`.
2249
+ *
2250
+ * @tsplus pipeable fncts.io.Stream takeUntil
2251
+ */
2252
+ function takeUntil(p, __tsplusTrace) {
2253
+ return fa => {
2254
+ return new _definition4.Stream(tsplus_module_12.pipeTo(takeUntilLoop(p, __tsplusTrace))(fa.channel));
2245
2255
  };
2246
2256
  }
2247
2257
  /**
@@ -2249,38 +2259,27 @@ function take(n, __tsplusTrace) {
2249
2259
  */
2250
2260
  function takeUntilIO(f, __tsplusTrace) {
2251
2261
  return ma => {
2252
- return new _definition4.Stream(tsplus_module_10.pipeTo(takeUntilIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(ma.channel));
2262
+ return new _definition4.Stream(tsplus_module_12.pipeTo(takeUntilIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(ma.channel));
2253
2263
  };
2254
2264
  }
2255
2265
  function takeUntilIOLoop(iterator, f, __tsplusTrace) {
2256
2266
  const next = iterator.next();
2257
2267
  if (next.done) {
2258
- return tsplus_module_10.readWithCause(elem => takeUntilIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_11.failCauseNow, tsplus_module_11.succeedNow);
2268
+ return tsplus_module_12.readWithCause(elem => takeUntilIOLoop(elem[Symbol.iterator](), f, __tsplusTrace), tsplus_module_13.failCauseNow, tsplus_module_13.succeedNow);
2259
2269
  } else {
2260
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(b => b ? tsplus_module_10.writeNow(tsplus_module_19.single(next.value)) : tsplus_module_11.zipRight(takeUntilIOLoop(iterator, f, __tsplusTrace))(tsplus_module_10.writeNow(tsplus_module_19.single(next.value))), __tsplusTrace)(f(next.value)));
2270
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(b => b ? tsplus_module_12.writeNow(tsplus_module_21.single(next.value)) : tsplus_module_13.zipRight(takeUntilIOLoop(iterator, f, __tsplusTrace))(tsplus_module_12.writeNow(tsplus_module_21.single(next.value))), __tsplusTrace)(f(next.value)));
2261
2271
  }
2262
2272
  }
2263
2273
  function takeUntilLoop(p, __tsplusTrace) {
2264
- return tsplus_module_10.readWith(chunk => {
2265
- const taken = tsplus_module_12.takeWhile(tsplus_module_48.invert(p))(chunk);
2266
- const last = tsplus_module_12.take(1)(tsplus_module_12.drop(taken.length)(chunk));
2267
- if (tsplus_module_12.isEmpty(last)) {
2268
- return tsplus_module_11.zipRight(takeUntilLoop(p, __tsplusTrace))(tsplus_module_10.writeNow(taken));
2274
+ return tsplus_module_12.readWith(chunk => {
2275
+ const taken = tsplus_module_14.takeWhile(tsplus_module_47.invert(p))(chunk);
2276
+ const last = tsplus_module_14.take(1)(tsplus_module_14.drop(taken.length)(chunk));
2277
+ if (tsplus_module_14.isEmpty(last)) {
2278
+ return tsplus_module_13.zipRight(takeUntilLoop(p, __tsplusTrace))(tsplus_module_12.writeNow(taken));
2269
2279
  } else {
2270
- return tsplus_module_10.writeNow(tsplus_module_12.concat(last)(taken));
2280
+ return tsplus_module_12.writeNow(tsplus_module_14.concat(last)(taken));
2271
2281
  }
2272
- }, tsplus_module_10.failNow, tsplus_module_11.succeedNow);
2273
- }
2274
- /**
2275
- * Takes all elements of the stream until the specified predicate evaluates
2276
- * to `true`.
2277
- *
2278
- * @tsplus pipeable fncts.io.Stream takeUntil
2279
- */
2280
- function takeUntil(p, __tsplusTrace) {
2281
- return fa => {
2282
- return new _definition4.Stream(tsplus_module_10.pipeTo(takeUntilLoop(p, __tsplusTrace))(fa.channel));
2283
- };
2282
+ }, tsplus_module_12.failNow, tsplus_module_13.succeedNow);
2284
2283
  }
2285
2284
  /**
2286
2285
  * @tsplus pipeable fncts.io.Stream tap
@@ -2319,7 +2318,7 @@ function tapError_1(f, __tsplusTrace) {
2319
2318
  */
2320
2319
  function tapErrorCause(f, __tsplusTrace) {
2321
2320
  return self => {
2322
- return catchAllCause_1(e => fromIO_1(tsplus_module_1.zipRight(tsplus_module_1.refailCause(e, __tsplusTrace), __tsplusTrace)(f(e)), __tsplusTrace), __tsplusTrace)(self);
2321
+ return catchAllCause_1(e => fromIO_1(tsplus_module_1.zipRight(tsplus_module_1.refailCause(() => e, __tsplusTrace), __tsplusTrace)(f(e)), __tsplusTrace), __tsplusTrace)(self);
2323
2322
  };
2324
2323
  }
2325
2324
  /**
@@ -2332,9 +2331,9 @@ function tapSink(sink, __tsplusTrace) {
2332
2331
  return self => {
2333
2332
  return flatMap_1(([queue, future]) => {
2334
2333
  const right = flattenTake_1(fromQueue_1(queue, 1, __tsplusTrace), __tsplusTrace);
2335
- const loop = tsplus_module_10.readWithCause(chunk => tsplus_module_11.zipRight(loop)(tsplus_module_11.zipRight(tsplus_module_10.writeNow(chunk))(tsplus_module_10.fromIO(() => tsplus_module_28.offer(tsplus_module_27.chunk(chunk), __tsplusTrace)(queue)))), cause => tsplus_module_10.fromIO(() => tsplus_module_28.offer(tsplus_module_27.failCause(cause), __tsplusTrace)(queue)), () => tsplus_module_10.fromIO(() => tsplus_module_28.offer(tsplus_module_27.end, __tsplusTrace)(queue)));
2336
- return merge_1(execute_1(tsplus_module_66.ensuring(tsplus_module_37.succeed_(undefined, __tsplusTrace)(future), __tsplusTrace)(run_1(sink, __tsplusTrace)(right)), __tsplusTrace), "Both", __tsplusTrace)(new _definition4.Stream(tsplus_module_10.ensuring(tsplus_module_1.zipRight(tsplus_module_37.wait(future, __tsplusTrace), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_28.offer(tsplus_module_27.end, __tsplusTrace)(queue), __tsplusTrace)))(tsplus_module_10.pipeTo(loop)(self.channel))));
2337
- }, __tsplusTrace)(fromIO_1(tsplus_module_1.zip(tsplus_module_38.make(__tsplusTrace), __tsplusTrace)(tsplus_module_30.makeBounded(1, __tsplusTrace)), __tsplusTrace));
2334
+ const loop = tsplus_module_12.readWithCause(chunk => tsplus_module_13.zipRight(loop)(tsplus_module_13.zipRight(tsplus_module_12.writeNow(chunk))(tsplus_module_12.fromIO(() => tsplus_module_30.offer(tsplus_module_29.chunk(chunk), __tsplusTrace)(queue)))), cause => tsplus_module_12.fromIO(() => tsplus_module_30.offer(tsplus_module_29.failCause(cause), __tsplusTrace)(queue)), () => tsplus_module_12.fromIO(() => tsplus_module_30.offer(tsplus_module_29.end, __tsplusTrace)(queue)));
2335
+ return merge_1(execute_1(tsplus_module_66.ensuring(tsplus_module_37.succeed_(undefined, __tsplusTrace)(future), __tsplusTrace)(run_1(sink, __tsplusTrace)(right)), __tsplusTrace), "Both", __tsplusTrace)(new _definition4.Stream(tsplus_module_12.ensuring(tsplus_module_1.zipRight(tsplus_module_37.wait(future, __tsplusTrace), __tsplusTrace)(tsplus_module_26.forkDaemon(tsplus_module_30.offer(tsplus_module_29.end, __tsplusTrace)(queue), __tsplusTrace)))(tsplus_module_12.pipeTo(loop)(self.channel))));
2336
+ }, __tsplusTrace)(fromIO_1(tsplus_module_1.zip(tsplus_module_38.make(__tsplusTrace), __tsplusTrace)(tsplus_module_32.makeBounded(1, __tsplusTrace)), __tsplusTrace));
2338
2337
  };
2339
2338
  }
2340
2339
  /**
@@ -2350,18 +2349,6 @@ function throttleEnforce(costFn, units, duration, burst = 0, __tsplusTrace) {
2350
2349
  return throttleEnforceIO_1(chunk => tsplus_module_1.succeedNow(costFn(chunk), __tsplusTrace), units, duration, burst, __tsplusTrace)(sa);
2351
2350
  };
2352
2351
  }
2353
- function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp, __tsplusTrace) {
2354
- return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.zipWith(tsplus_module_43.currentTime, (weight, current) => {
2355
- const elapsed = current - timestamp;
2356
- const cycles = elapsed / duration;
2357
- const available = (() => {
2358
- const sum = tokens + cycles * units;
2359
- const max = units + burst < 0 ? Number.MAX_SAFE_INTEGER : units + burst;
2360
- return sum < 0 ? max : Math.min(sum, max);
2361
- })();
2362
- return weight <= available ? tsplus_module_11.zipRight(throttleEnforceIOLoop(costFn, units, duration, burst, available - weight, current, __tsplusTrace))(tsplus_module_10.writeNow(inp)) : throttleEnforceIOLoop(costFn, units, duration, burst, available - weight, current, __tsplusTrace);
2363
- }, __tsplusTrace)(costFn(inp))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
2364
- }
2365
2352
  /**
2366
2353
  * Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket
2367
2354
  * algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate
@@ -2372,9 +2359,21 @@ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp
2372
2359
  */
2373
2360
  function throttleEnforceIO_1(costFn, units, duration, burst = 0, __tsplusTrace) {
2374
2361
  return sa => {
2375
- return new _definition4.Stream(tsplus_module_11.flatMap(current => tsplus_module_10.pipeTo(throttleEnforceIOLoop(costFn, units, duration, burst, units, current, __tsplusTrace))(sa.channel))(tsplus_module_10.fromIO(() => tsplus_module_43.currentTime)));
2362
+ return new _definition4.Stream(tsplus_module_13.flatMap(current => tsplus_module_12.pipeTo(throttleEnforceIOLoop(costFn, units, duration, burst, units, current, __tsplusTrace))(sa.channel))(tsplus_module_12.fromIO(() => tsplus_module_43.currentTime)));
2376
2363
  };
2377
2364
  }
2365
+ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp, __tsplusTrace) {
2366
+ return tsplus_module_12.readWith(inp => tsplus_module_12.unwrap(() => tsplus_module_1.zipWith(tsplus_module_43.currentTime, (weight, current) => {
2367
+ const elapsed = current - timestamp;
2368
+ const cycles = elapsed / duration;
2369
+ const available = (() => {
2370
+ const sum = tokens + cycles * units;
2371
+ const max = units + burst < 0 ? Number.MAX_SAFE_INTEGER : units + burst;
2372
+ return sum < 0 ? max : Math.min(sum, max);
2373
+ })();
2374
+ return weight <= available ? tsplus_module_13.zipRight(throttleEnforceIOLoop(costFn, units, duration, burst, available - weight, current, __tsplusTrace))(tsplus_module_12.writeNow(inp)) : throttleEnforceIOLoop(costFn, units, duration, burst, available - weight, current, __tsplusTrace);
2375
+ }, __tsplusTrace)(costFn(inp))), tsplus_module_12.failNow, () => tsplus_module_12.unit);
2376
+ }
2378
2377
  /**
2379
2378
  * Converts the stream to a managed hub of chunks. After the managed hub is used,
2380
2379
  * the hub will never again produce values and should be discarded.
@@ -2383,7 +2382,7 @@ function throttleEnforceIO_1(costFn, units, duration, burst = 0, __tsplusTrace)
2383
2382
  */
2384
2383
  function toHub_1(capacity, __tsplusTrace) {
2385
2384
  return stream => {
2386
- return tsplus_module_1.flatMap(hub => tsplus_module_1.map(() => hub, __tsplusTrace)(tsplus_module_33.fork(runIntoHubScoped_1(hub, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_34.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_34.shutdown(_, __tsplusTrace), __tsplusTrace));
2385
+ return tsplus_module_1.flatMap(hub => tsplus_module_1.map(() => hub, __tsplusTrace)(tsplus_module_33.fork(runIntoHubScoped_1(hub, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_34.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_34.shutdown(_, __tsplusTrace), __tsplusTrace));
2387
2386
  };
2388
2387
  }
2389
2388
  /**
@@ -2392,7 +2391,7 @@ function toHub_1(capacity, __tsplusTrace) {
2392
2391
  * @tsplus getter fncts.io.Stream toPull
2393
2392
  */
2394
2393
  function toPull_1(stream, __tsplusTrace) {
2395
- return tsplus_module_1.map(io => tsplus_module_1.flatMap(r => tsplus_module_4.match(() => tsplus_module_1.failNow(tsplus_module_3.nothing(__tsplusTrace), __tsplusTrace), tsplus_module_1.succeedNow)(r), __tsplusTrace)(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(io)), __tsplusTrace)(tsplus_module_67.toPull(stream.channel));
2394
+ return tsplus_module_1.map(io => tsplus_module_1.flatMap(r => tsplus_module_6.match(() => tsplus_module_1.failNow(tsplus_module_5.nothing(__tsplusTrace), __tsplusTrace), tsplus_module_1.succeedNow)(r), __tsplusTrace)(tsplus_module_1.mapError(tsplus_module_5.just, __tsplusTrace)(io)), __tsplusTrace)(tsplus_module_67.toPull(stream.channel));
2396
2395
  }
2397
2396
  /**
2398
2397
  * Converts the stream to a managed queue of chunks. After the managed queue is used,
@@ -2402,7 +2401,7 @@ function toPull_1(stream, __tsplusTrace) {
2402
2401
  */
2403
2402
  function toQueue_1(capacity = 2, __tsplusTrace) {
2404
2403
  return stream => {
2405
- return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
2404
+ return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_30.shutdown(_, __tsplusTrace), __tsplusTrace));
2406
2405
  };
2407
2406
  }
2408
2407
  /**
@@ -2410,7 +2409,7 @@ function toQueue_1(capacity = 2, __tsplusTrace) {
2410
2409
  */
2411
2410
  function toQueueDropping(capacity = 2, __tsplusTrace) {
2412
2411
  return stream => {
2413
- return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeDropping(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
2412
+ return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeDropping(capacity, __tsplusTrace), _ => tsplus_module_30.shutdown(_, __tsplusTrace), __tsplusTrace));
2414
2413
  };
2415
2414
  }
2416
2415
  /**
@@ -2418,7 +2417,7 @@ function toQueueDropping(capacity = 2, __tsplusTrace) {
2418
2417
  */
2419
2418
  function toQueueOfElements_1(capacity = 2, __tsplusTrace) {
2420
2419
  return stream => {
2421
- return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_17.forkScoped(runIntoQueueElementsScoped_1(() => queue)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
2420
+ return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_19.forkScoped(runIntoQueueElementsScoped_1(() => queue)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_30.shutdown(_, __tsplusTrace), __tsplusTrace));
2422
2421
  };
2423
2422
  }
2424
2423
  /**
@@ -2426,7 +2425,7 @@ function toQueueOfElements_1(capacity = 2, __tsplusTrace) {
2426
2425
  */
2427
2426
  function toQueueSliding(capacity = 2, __tsplusTrace) {
2428
2427
  return stream => {
2429
- return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeSliding(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
2428
+ return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeSliding(capacity, __tsplusTrace), _ => tsplus_module_30.shutdown(_, __tsplusTrace), __tsplusTrace));
2430
2429
  };
2431
2430
  }
2432
2431
  /**
@@ -2436,7 +2435,7 @@ function toQueueSliding(capacity = 2, __tsplusTrace) {
2436
2435
  * @tsplus getter fncts.io.Stream toQueueUnbounded
2437
2436
  */
2438
2437
  function toQueueUnbounded_1(stream, __tsplusTrace) {
2439
- return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeUnbounded(__tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
2438
+ return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_2.acquireRelease(() => tsplus_module_32.makeUnbounded(__tsplusTrace), _ => tsplus_module_30.shutdown(_, __tsplusTrace), __tsplusTrace));
2440
2439
  }
2441
2440
  /**
2442
2441
  * @tsplus getter fncts.io.Stream toReadableStream
@@ -2446,21 +2445,30 @@ function toReadableStream(self, __tsplusTrace) {
2446
2445
  let scope;
2447
2446
  return new ReadableStream({
2448
2447
  start(controller) {
2449
- scope = tsplus_module_36.getOrThrow(tsplus_module_29.unsafeRun(tsplus_module_68.make));
2450
- pull = tsplus_module_1.asUnit(tsplus_module_1.catchAll(error => tsplus_module_20.match(() => tsplus_module_1.succeed(() => controller.close(), __tsplusTrace), error => tsplus_module_1.succeed(() => controller.error(error), __tsplusTrace))(error), __tsplusTrace)(tsplus_module_1.tapErrorCause(() => scope.close(() => tsplus_module_41.unit), __tsplusTrace)(tsplus_module_1.tap(chunk => tsplus_module_1.succeed(() => tsplus_module_12.forEach(a => {
2448
+ scope = tsplus_module_36.getOrThrow(tsplus_module_31.unsafeRun(tsplus_module_68.make));
2449
+ pull = tsplus_module_1.asUnit(tsplus_module_1.catchAll(error => tsplus_module_22.match(() => tsplus_module_1.succeed(() => controller.close(), __tsplusTrace), error => tsplus_module_1.succeed(() => controller.error(error), __tsplusTrace))(error), __tsplusTrace)(tsplus_module_1.tapErrorCause(() => scope.close(() => tsplus_module_41.unit), __tsplusTrace)(tsplus_module_1.tap(chunk => tsplus_module_1.succeed(() => tsplus_module_14.forEach(a => {
2451
2450
  controller.enqueue(a);
2452
- })(chunk), __tsplusTrace), __tsplusTrace)(tsplus_module_36.getOrThrow(tsplus_module_29.unsafeRun(tsplus_module_69.provideScope(scope)(toPull_1(self, __tsplusTrace))))))), __tsplusTrace);
2451
+ })(chunk), __tsplusTrace), __tsplusTrace)(tsplus_module_36.getOrThrow(tsplus_module_31.unsafeRun(tsplus_module_69.provideScope(scope)(toPull_1(self, __tsplusTrace))))))), __tsplusTrace);
2453
2452
  },
2454
2453
  pull() {
2455
- return tsplus_module_29.unsafeRunPromise(pull, __tsplusTrace);
2454
+ return tsplus_module_31.unsafeRunPromise(pull, __tsplusTrace);
2456
2455
  },
2457
2456
  cancel() {
2458
- return tsplus_module_29.unsafeRunPromise(scope.close(() => tsplus_module_41.unit), __tsplusTrace);
2457
+ return tsplus_module_31.unsafeRunPromise(scope.close(() => tsplus_module_41.unit), __tsplusTrace);
2459
2458
  }
2460
2459
  });
2461
2460
  }
2462
- function unfoldChunkIOLoop(s, f, __tsplusTrace) {
2463
- return tsplus_module_10.unwrap(() => tsplus_module_1.map(m => tsplus_module_20.match(() => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap(() => unfoldChunkIOLoop(s, f, __tsplusTrace))(tsplus_module_10.writeNow(as)))(m), __tsplusTrace)(f(s)));
2461
+ /**
2462
+ * @tsplus static fncts.io.StreamOps unfold
2463
+ */
2464
+ function unfold(s, f, __tsplusTrace) {
2465
+ return unfoldChunk_1(s, s => tsplus_module_39.map(([a, s]) => (0, _function.tuple)(tsplus_module_21.single(a), s))(f(s)), __tsplusTrace);
2466
+ }
2467
+ /**
2468
+ * @tsplus static fncts.io.StreamOps unfoldChunk
2469
+ */
2470
+ function unfoldChunk_1(s, f, __tsplusTrace) {
2471
+ return new _definition4.Stream(tsplus_module_12.defer(() => unfoldChunkLoop(s, f, __tsplusTrace)));
2464
2472
  }
2465
2473
  /**
2466
2474
  * Creates a stream by effectfully peeling off the "layers" of a value of type `S`
@@ -2470,28 +2478,19 @@ function unfoldChunkIOLoop(s, f, __tsplusTrace) {
2470
2478
  function unfoldChunkIO_1(s, f, __tsplusTrace) {
2471
2479
  return new _definition4.Stream(unfoldChunkIOLoop(s, f, __tsplusTrace));
2472
2480
  }
2481
+ function unfoldChunkIOLoop(s, f, __tsplusTrace) {
2482
+ return tsplus_module_12.unwrap(() => tsplus_module_1.map(m => tsplus_module_22.match(() => tsplus_module_12.unit, ([as, s]) => tsplus_module_13.flatMap(() => unfoldChunkIOLoop(s, f, __tsplusTrace))(tsplus_module_12.writeNow(as)))(m), __tsplusTrace)(f(s)));
2483
+ }
2484
+ function unfoldChunkLoop(s, f, __tsplusTrace) {
2485
+ return tsplus_module_22.match(() => tsplus_module_12.unit, ([as, s]) => tsplus_module_13.flatMap(() => unfoldChunkLoop(s, f, __tsplusTrace))(tsplus_module_12.writeNow(as)))(f(s));
2486
+ }
2473
2487
  /**
2474
2488
  * Creates a stream by effectfully peeling off the "layers" of a value of type `S`
2475
2489
  *
2476
2490
  * @tsplus static fncts.io.StreamOps unfoldIO
2477
2491
  */
2478
2492
  function unfoldIO_1(s, f, __tsplusTrace) {
2479
- return unfoldChunkIO_1(s, _ => tsplus_module_1.map(m => tsplus_module_39.map(([a, s]) => (0, _function.tuple)(tsplus_module_19.single(a), s))(m), __tsplusTrace)(f(_)), __tsplusTrace);
2480
- }
2481
- function unfoldChunkLoop(s, f, __tsplusTrace) {
2482
- return tsplus_module_20.match(() => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap(() => unfoldChunkLoop(s, f, __tsplusTrace))(tsplus_module_10.writeNow(as)))(f(s));
2483
- }
2484
- /**
2485
- * @tsplus static fncts.io.StreamOps unfoldChunk
2486
- */
2487
- function unfoldChunk_1(s, f, __tsplusTrace) {
2488
- return new _definition4.Stream(tsplus_module_10.defer(() => unfoldChunkLoop(s, f, __tsplusTrace)));
2489
- }
2490
- /**
2491
- * @tsplus static fncts.io.StreamOps unfold
2492
- */
2493
- function unfold(s, f, __tsplusTrace) {
2494
- return unfoldChunk_1(s, s => tsplus_module_39.map(([a, s]) => (0, _function.tuple)(tsplus_module_19.single(a), s))(f(s)), __tsplusTrace);
2493
+ return unfoldChunkIO_1(s, _ => tsplus_module_1.map(m => tsplus_module_39.map(([a, s]) => (0, _function.tuple)(tsplus_module_21.single(a), s))(m), __tsplusTrace)(f(_)), __tsplusTrace);
2495
2494
  }
2496
2495
  /**
2497
2496
  * Creates a stream produced from an IO
@@ -2529,9 +2528,9 @@ function zipWithIndex_(self, __tsplusTrace) {
2529
2528
  function zipWithLatest(fb, f, __tsplusTrace) {
2530
2529
  return fa => {
2531
2530
  function pullNonEmpty(pull, __tsplusTrace) {
2532
- return tsplus_module_1.flatMap(chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull, __tsplusTrace) : tsplus_module_1.succeedNow(chunk, __tsplusTrace), __tsplusTrace)(pull);
2531
+ return tsplus_module_1.flatMap(chunk => tsplus_module_14.isNonEmpty(chunk) ? pullNonEmpty(pull, __tsplusTrace) : tsplus_module_1.succeedNow(chunk, __tsplusTrace), __tsplusTrace)(pull);
2533
2532
  }
2534
- return fromPull_1(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => toPull_1(flatMap_1(([l, r, leftFirst]) => flatMap_1(latest => concat_1(flatMap_1(fromChunkNow_1, __tsplusTrace)(mapIO_1(ab => tsplus_module_4.match(leftChunk => tsplus_module_15.modify(([_, rightLatest]) => (0, _function.tuple)(tsplus_module_12.map(a => f(a, rightLatest))(leftChunk), (0, _function.tuple)(tsplus_module_12.unsafeGet(leftChunk.length - 1)(leftChunk), rightLatest)), __tsplusTrace)(latest), rightChunk => tsplus_module_15.modify(([leftLatest, _]) => (0, _function.tuple)(tsplus_module_12.map(b => f(leftLatest, b))(rightChunk), (0, _function.tuple)(leftLatest, tsplus_module_12.unsafeGet(rightChunk.length - 1)(rightChunk))), __tsplusTrace)(latest))(ab), __tsplusTrace)(mergeEither_1(repeatIOMaybe_1(right, __tsplusTrace), __tsplusTrace)(repeatIOMaybe_1(left, __tsplusTrace)))), __tsplusTrace)(fromChunk_1(() => leftFirst ? tsplus_module_12.map(b => f(tsplus_module_12.unsafeGet(l.length - 1)(l), b))(r) : tsplus_module_12.map(a => f(a, tsplus_module_12.unsafeGet(r.length - 1)(r)))(l), __tsplusTrace)), __tsplusTrace)(fromIO_1(tsplus_module_6.make(() => (0, _function.tuple)(tsplus_module_12.unsafeGet(l.length - 1)(l), tsplus_module_12.unsafeGet(r.length - 1)(r)), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(fromIOMaybe_1(tsplus_module_26.raceWith(() => right, (leftDone, rightFiber) => tsplus_module_1.zipWith(tsplus_module_22.join(rightFiber, __tsplusTrace), (l, r) => (0, _function.tuple)(l, r, true), __tsplusTrace)(tsplus_module_1.fromExitNow(leftDone, __tsplusTrace)), (rightDone, leftFiber) => tsplus_module_1.zipWith(tsplus_module_22.join(leftFiber, __tsplusTrace), (r, l) => (0, _function.tuple)(l, r, false), __tsplusTrace)(tsplus_module_1.fromExitNow(rightDone, __tsplusTrace)), __tsplusTrace)(left), __tsplusTrace)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fb, __tsplusTrace))), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fa, __tsplusTrace))), __tsplusTrace);
2533
+ return fromPull_1(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => toPull_1(flatMap_1(([l, r, leftFirst]) => flatMap_1(latest => concat_1(flatMap_1(fromChunkNow_1, __tsplusTrace)(mapIO_1(ab => tsplus_module_6.match(leftChunk => tsplus_module_17.modify(([_, rightLatest]) => (0, _function.tuple)(tsplus_module_14.map(a => f(a, rightLatest))(leftChunk), (0, _function.tuple)(tsplus_module_14.unsafeGet(leftChunk.length - 1)(leftChunk), rightLatest)), __tsplusTrace)(latest), rightChunk => tsplus_module_17.modify(([leftLatest, _]) => (0, _function.tuple)(tsplus_module_14.map(b => f(leftLatest, b))(rightChunk), (0, _function.tuple)(leftLatest, tsplus_module_14.unsafeGet(rightChunk.length - 1)(rightChunk))), __tsplusTrace)(latest))(ab), __tsplusTrace)(mergeEither_1(repeatIOMaybe_1(right, __tsplusTrace), __tsplusTrace)(repeatIOMaybe_1(left, __tsplusTrace)))), __tsplusTrace)(fromChunk_1(() => leftFirst ? tsplus_module_14.map(b => f(tsplus_module_14.unsafeGet(l.length - 1)(l), b))(r) : tsplus_module_14.map(a => f(a, tsplus_module_14.unsafeGet(r.length - 1)(r)))(l), __tsplusTrace)), __tsplusTrace)(fromIO_1(tsplus_module_8.make(() => (0, _function.tuple)(tsplus_module_14.unsafeGet(l.length - 1)(l), tsplus_module_14.unsafeGet(r.length - 1)(r)), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(fromIOMaybe_1(tsplus_module_28.raceWith(() => right, (leftDone, rightFiber) => tsplus_module_1.zipWith(tsplus_module_24.join(rightFiber, __tsplusTrace), (l, r) => (0, _function.tuple)(l, r, true), __tsplusTrace)(tsplus_module_1.fromExitNow(leftDone, __tsplusTrace)), (rightDone, leftFiber) => tsplus_module_1.zipWith(tsplus_module_24.join(leftFiber, __tsplusTrace), (r, l) => (0, _function.tuple)(l, r, false), __tsplusTrace)(tsplus_module_1.fromExitNow(rightDone, __tsplusTrace)), __tsplusTrace)(left), __tsplusTrace)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fb, __tsplusTrace))), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fa, __tsplusTrace))), __tsplusTrace);
2535
2534
  };
2536
2535
  }
2537
2536
  //# sourceMappingURL=api.cjs.map