@fncts/io 0.0.10 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (439) hide show
  1. package/Cached/api.d.ts +2 -3
  2. package/Channel/api/interruptWhen.d.ts +1 -1
  3. package/Channel/api/mapOutIOC.d.ts +1 -1
  4. package/Channel/api/mergeAll.d.ts +1 -1
  5. package/Channel/api/mergeAllUnboundedWith.d.ts +1 -1
  6. package/Channel/api/mergeAllWith.d.ts +1 -1
  7. package/Channel/api/mergeMap.d.ts +1 -1
  8. package/Channel/api/mergeWith.d.ts +1 -1
  9. package/Channel/api/runScoped.d.ts +1 -2
  10. package/Channel/api/toPull.d.ts +1 -2
  11. package/Channel/api/zipC.d.ts +3 -3
  12. package/Channel/api.d.ts +48 -49
  13. package/Channel/core-api.d.ts +10 -10
  14. package/Channel/definition.d.ts +12 -12
  15. package/Channel/internal/MergeDecision.d.ts +1 -1
  16. package/Channel/internal/SingleProducerAsyncInput.d.ts +1 -1
  17. package/Clock/api.d.ts +1 -1
  18. package/Fiber/FiberContext.d.ts +3 -3
  19. package/Fiber/api/awaitAll.d.ts +1 -1
  20. package/Fiber/api/evalOnIO.d.ts +1 -1
  21. package/Fiber/api/joinAll.d.ts +1 -1
  22. package/Fiber/definition.d.ts +1 -1
  23. package/FiberRef/api/locallyScoped.d.ts +1 -2
  24. package/FiberRef/api/locallyScopedWith.d.ts +1 -2
  25. package/FiberRef/constructors.d.ts +1 -2
  26. package/FiberRef/unsafe.d.ts +6 -0
  27. package/Future/api.d.ts +1 -1
  28. package/Future/constructors.d.ts +1 -1
  29. package/Hub/api.d.ts +6 -7
  30. package/Hub/definition.d.ts +6 -7
  31. package/Hub/internal.d.ts +0 -1
  32. package/IO/api/acquireRelease.d.ts +1 -2
  33. package/IO/api/acquireReleaseExit.d.ts +1 -2
  34. package/IO/api/acquireReleaseInterruptible.d.ts +1 -2
  35. package/IO/api/acquireReleaseInterruptibleExit.d.ts +1 -2
  36. package/IO/api/addFinalizer.d.ts +1 -2
  37. package/IO/api/addFinalizerExit.d.ts +1 -2
  38. package/IO/api/bracket.d.ts +1 -1
  39. package/IO/api/bracketExit.d.ts +1 -1
  40. package/IO/api/clockWith.d.ts +1 -1
  41. package/IO/api/concurrentFinalizers.d.ts +1 -2
  42. package/IO/api/consoleWith.d.ts +1 -1
  43. package/IO/api/core-scope.d.ts +1 -1
  44. package/IO/api/ensuringChildren.d.ts +1 -1
  45. package/IO/api/environment.d.ts +8 -10
  46. package/IO/api/forkScoped.d.ts +1 -2
  47. package/IO/api/interrupt.d.ts +3 -3
  48. package/IO/api/onExit.d.ts +1 -1
  49. package/IO/api/onTermination.d.ts +1 -1
  50. package/IO/api/provideSomeLayer.d.ts +1 -1
  51. package/IO/api/race.d.ts +1 -1
  52. package/IO/api/raceFirst.d.ts +1 -1
  53. package/IO/api/randomWith.d.ts +1 -1
  54. package/IO/api/repeat.d.ts +3 -3
  55. package/IO/api/retry.d.ts +3 -3
  56. package/IO/api/schedule.d.ts +2 -2
  57. package/IO/api/scope.d.ts +1 -2
  58. package/IO/api/scopeWith.d.ts +1 -2
  59. package/IO/api/scoped.d.ts +2 -3
  60. package/IO/api/sequenceT.d.ts +3 -3
  61. package/IO/api/stateful.d.ts +1 -2
  62. package/IO/api/withEarlyRelease.d.ts +1 -2
  63. package/IO/api/withFinalizer.d.ts +1 -2
  64. package/IO/api/withFinalizerExit.d.ts +1 -2
  65. package/IO/api/zipC.d.ts +2 -2
  66. package/IO/api.d.ts +50 -50
  67. package/IO/definition.d.ts +28 -24
  68. package/IO/runtime.d.ts +23 -10
  69. package/IOEnv/definition.d.ts +2 -3
  70. package/IOEnv/live.d.ts +1 -1
  71. package/IOSpec.d.ts +1 -2
  72. package/Layer/MemoMap.d.ts +2 -3
  73. package/Layer/api.d.ts +30 -32
  74. package/Layer/definition.d.ts +7 -8
  75. package/Queue/api/dimapIO.d.ts +3 -3
  76. package/Queue/api/filterInputIO.d.ts +4 -4
  77. package/Queue/api/filterOutputIO.d.ts +6 -6
  78. package/Queue/api/zipWithIO.d.ts +9 -9
  79. package/Queue/definition.d.ts +7 -7
  80. package/Queue/internal.d.ts +1 -1
  81. package/Random/api.d.ts +4 -4
  82. package/Random/live.d.ts +1 -1
  83. package/Ref/Atomic/Atomic.d.ts +3 -3
  84. package/Ref/Derived.d.ts +3 -3
  85. package/Ref/DerivedAll.d.ts +3 -3
  86. package/Ref/Synchronized/api.d.ts +15 -15
  87. package/Ref/Synchronized/definition.d.ts +2 -2
  88. package/Ref/api/get.d.ts +1 -1
  89. package/Ref/api/modify.d.ts +9 -9
  90. package/Ref/api/set.d.ts +1 -1
  91. package/Ref/definition.d.ts +13 -13
  92. package/STM/api/core-api.d.ts +4 -4
  93. package/STM/api/core-constructors.d.ts +7 -7
  94. package/STM/api.d.ts +27 -39
  95. package/STM/definition.d.ts +9 -8
  96. package/STM/driver.d.ts +1 -1
  97. package/STM/internal/Journal.d.ts +4 -3
  98. package/Schedule/Decision.d.ts +10 -4
  99. package/Schedule/Driver.d.ts +3 -3
  100. package/Schedule/api.d.ts +55 -43
  101. package/Schedule/definition.d.ts +1 -1
  102. package/Scope/Finalizer/definition.d.ts +2 -2
  103. package/Scope/ReleaseMap/api.d.ts +1 -1
  104. package/Scope/ReleaseMap/definition.d.ts +1 -1
  105. package/Scope/api.d.ts +3 -4
  106. package/ScopedRef/api.d.ts +1 -2
  107. package/ScopedRef/definition.d.ts +1 -2
  108. package/Sink/api.d.ts +255 -75
  109. package/State/api.d.ts +1 -2
  110. package/Stream/api/zipAllWith.d.ts +1 -1
  111. package/Stream/api/zipWith.d.ts +1 -1
  112. package/Stream/api/zipWithChunks.d.ts +1 -1
  113. package/Stream/api.d.ts +91 -93
  114. package/Stream/definition.d.ts +3 -3
  115. package/Stream/internal/Take.d.ts +1 -1
  116. package/Supervisor/constructors.d.ts +2 -2
  117. package/TFuture/api.d.ts +1 -1
  118. package/TFuture/definition.d.ts +1 -1
  119. package/TReentrantLock/api.d.ts +2 -3
  120. package/TRef/api.d.ts +11 -11
  121. package/TRef/constructors.d.ts +2 -2
  122. package/TSemaphore/api.d.ts +2 -2
  123. package/TSemaphore/definition.d.ts +1 -1
  124. package/_cjs/Cached/api.cjs.map +1 -1
  125. package/_cjs/Channel/api/mapOutIOC.cjs +1 -1
  126. package/_cjs/Channel/api/mapOutIOC.cjs.map +1 -1
  127. package/_cjs/Channel/api/mergeAllWith.cjs +3 -3
  128. package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
  129. package/_cjs/Channel/api.cjs.map +1 -1
  130. package/_cjs/Channel/definition.cjs.map +1 -1
  131. package/_cjs/Clock/live.cjs.map +1 -1
  132. package/_cjs/Fiber/FiberContext.cjs +5 -7
  133. package/_cjs/Fiber/FiberContext.cjs.map +1 -1
  134. package/_cjs/FiberRef/unsafe.cjs +9 -1
  135. package/_cjs/FiberRef/unsafe.cjs.map +1 -1
  136. package/_cjs/Future/api.cjs.map +1 -1
  137. package/_cjs/Hub/api.cjs +1 -1
  138. package/_cjs/Hub/api.cjs.map +1 -1
  139. package/_cjs/Hub/internal.cjs +4 -12
  140. package/_cjs/Hub/internal.cjs.map +1 -1
  141. package/_cjs/IO/api/addFinalizerExit.cjs +4 -8
  142. package/_cjs/IO/api/addFinalizerExit.cjs.map +1 -1
  143. package/_cjs/IO/api/ensuringChildren.cjs +1 -1
  144. package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
  145. package/_cjs/IO/api/environment.cjs +2 -3
  146. package/_cjs/IO/api/environment.cjs.map +1 -1
  147. package/_cjs/IO/api/interrupt.cjs +1 -1
  148. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  149. package/_cjs/IO/api/memoize.cjs +4 -8
  150. package/_cjs/IO/api/memoize.cjs.map +1 -1
  151. package/_cjs/IO/api/provideSomeLayer.cjs +1 -2
  152. package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
  153. package/_cjs/IO/api/scope.cjs +1 -1
  154. package/_cjs/IO/api/scope.cjs.map +1 -1
  155. package/_cjs/IO/api/scoped.cjs.map +1 -1
  156. package/_cjs/IO/api/withChildren.cjs +1 -1
  157. package/_cjs/IO/api/withChildren.cjs.map +1 -1
  158. package/_cjs/IO/api.cjs +1 -1
  159. package/_cjs/IO/api.cjs.map +1 -1
  160. package/_cjs/IO/definition.cjs +5 -8
  161. package/_cjs/IO/definition.cjs.map +1 -1
  162. package/_cjs/IO/runtime.cjs +69 -21
  163. package/_cjs/IO/runtime.cjs.map +1 -1
  164. package/_cjs/Layer/MemoMap.cjs +22 -38
  165. package/_cjs/Layer/MemoMap.cjs.map +1 -1
  166. package/_cjs/Layer/api.cjs +6 -4
  167. package/_cjs/Layer/api.cjs.map +1 -1
  168. package/_cjs/Layer/definition.cjs.map +1 -1
  169. package/_cjs/Queue/internal.cjs +2 -2
  170. package/_cjs/Queue/internal.cjs.map +1 -1
  171. package/_cjs/Queue/strategy.cjs +1 -5
  172. package/_cjs/Queue/strategy.cjs.map +1 -1
  173. package/_cjs/Ref/Atomic/Atomic.cjs.map +1 -1
  174. package/_cjs/Ref/Derived.cjs.map +1 -1
  175. package/_cjs/Ref/DerivedAll.cjs.map +1 -1
  176. package/_cjs/Ref/Synchronized/constructors.cjs +7 -11
  177. package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
  178. package/_cjs/STM/api/core-constructors.cjs.map +1 -1
  179. package/_cjs/STM/api.cjs +59 -78
  180. package/_cjs/STM/api.cjs.map +1 -1
  181. package/_cjs/STM/definition.cjs.map +1 -1
  182. package/_cjs/STM/driver.cjs +7 -5
  183. package/_cjs/STM/driver.cjs.map +1 -1
  184. package/_cjs/STM/internal/Journal.cjs +20 -22
  185. package/_cjs/STM/internal/Journal.cjs.map +1 -1
  186. package/_cjs/Schedule/Decision.cjs +17 -0
  187. package/_cjs/Schedule/Decision.cjs.map +1 -1
  188. package/_cjs/Schedule/api/driver.cjs +22 -21
  189. package/_cjs/Schedule/api/driver.cjs.map +1 -1
  190. package/_cjs/Schedule/api.cjs +91 -66
  191. package/_cjs/Schedule/api.cjs.map +1 -1
  192. package/_cjs/Scope/Finalizer/definition.cjs +4 -6
  193. package/_cjs/Scope/Finalizer/definition.cjs.map +1 -1
  194. package/_cjs/Scope/ReleaseMap/definition.cjs +2 -4
  195. package/_cjs/Scope/ReleaseMap/definition.cjs.map +1 -1
  196. package/_cjs/Scope/api.cjs +2 -12
  197. package/_cjs/Scope/api.cjs.map +1 -1
  198. package/_cjs/ScopedRef/api.cjs +14 -22
  199. package/_cjs/ScopedRef/api.cjs.map +1 -1
  200. package/_cjs/Sink/api.cjs +424 -131
  201. package/_cjs/Sink/api.cjs.map +1 -1
  202. package/_cjs/Stream/api.cjs +94 -94
  203. package/_cjs/Stream/api.cjs.map +1 -1
  204. package/_cjs/Supervisor/constructors.cjs +14 -8
  205. package/_cjs/Supervisor/constructors.cjs.map +1 -1
  206. package/_cjs/TFuture/definition.cjs +2 -4
  207. package/_cjs/TFuture/definition.cjs.map +1 -1
  208. package/_cjs/TSemaphore/api.cjs +7 -7
  209. package/_cjs/TSemaphore/api.cjs.map +1 -1
  210. package/_cjs/TSemaphore/definition.cjs +2 -4
  211. package/_cjs/TSemaphore/definition.cjs.map +1 -1
  212. package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +38 -0
  213. package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -0
  214. package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +38 -0
  215. package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -0
  216. package/_cjs/internal/Scheduler.cjs +64 -14
  217. package/_cjs/internal/Scheduler.cjs.map +1 -1
  218. package/_mjs/Cached/api.mjs.map +1 -1
  219. package/_mjs/Channel/api/mapOutIOC.mjs +1 -1
  220. package/_mjs/Channel/api/mapOutIOC.mjs.map +1 -1
  221. package/_mjs/Channel/api/mergeAllWith.mjs +3 -3
  222. package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
  223. package/_mjs/Channel/api.mjs.map +1 -1
  224. package/_mjs/Channel/definition.mjs.map +1 -1
  225. package/_mjs/Clock/live.mjs.map +1 -1
  226. package/_mjs/Fiber/FiberContext.mjs +5 -6
  227. package/_mjs/Fiber/FiberContext.mjs.map +1 -1
  228. package/_mjs/FiberRef/unsafe.mjs +6 -0
  229. package/_mjs/FiberRef/unsafe.mjs.map +1 -1
  230. package/_mjs/Future/api.mjs.map +1 -1
  231. package/_mjs/Hub/api.mjs +1 -1
  232. package/_mjs/Hub/api.mjs.map +1 -1
  233. package/_mjs/Hub/internal.mjs +4 -12
  234. package/_mjs/Hub/internal.mjs.map +1 -1
  235. package/_mjs/IO/api/addFinalizerExit.mjs +4 -8
  236. package/_mjs/IO/api/addFinalizerExit.mjs.map +1 -1
  237. package/_mjs/IO/api/ensuringChildren.mjs +1 -1
  238. package/_mjs/IO/api/ensuringChildren.mjs.map +1 -1
  239. package/_mjs/IO/api/environment.mjs +2 -3
  240. package/_mjs/IO/api/environment.mjs.map +1 -1
  241. package/_mjs/IO/api/interrupt.mjs +1 -1
  242. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  243. package/_mjs/IO/api/memoize.mjs +4 -8
  244. package/_mjs/IO/api/memoize.mjs.map +1 -1
  245. package/_mjs/IO/api/provideSomeLayer.mjs +1 -2
  246. package/_mjs/IO/api/provideSomeLayer.mjs.map +1 -1
  247. package/_mjs/IO/api/scope.mjs +1 -1
  248. package/_mjs/IO/api/scope.mjs.map +1 -1
  249. package/_mjs/IO/api/scoped.mjs.map +1 -1
  250. package/_mjs/IO/api/withChildren.mjs +1 -1
  251. package/_mjs/IO/api/withChildren.mjs.map +1 -1
  252. package/_mjs/IO/api.mjs +1 -1
  253. package/_mjs/IO/api.mjs.map +1 -1
  254. package/_mjs/IO/definition.mjs +3 -5
  255. package/_mjs/IO/definition.mjs.map +1 -1
  256. package/_mjs/IO/runtime.mjs +61 -18
  257. package/_mjs/IO/runtime.mjs.map +1 -1
  258. package/_mjs/Layer/MemoMap.mjs +22 -38
  259. package/_mjs/Layer/MemoMap.mjs.map +1 -1
  260. package/_mjs/Layer/api.mjs +5 -4
  261. package/_mjs/Layer/api.mjs.map +1 -1
  262. package/_mjs/Layer/definition.mjs.map +1 -1
  263. package/_mjs/Queue/internal.mjs +2 -2
  264. package/_mjs/Queue/internal.mjs.map +1 -1
  265. package/_mjs/Queue/strategy.mjs +1 -5
  266. package/_mjs/Queue/strategy.mjs.map +1 -1
  267. package/_mjs/Ref/Atomic/Atomic.mjs.map +1 -1
  268. package/_mjs/Ref/Derived.mjs.map +1 -1
  269. package/_mjs/Ref/DerivedAll.mjs.map +1 -1
  270. package/_mjs/Ref/Synchronized/constructors.mjs +7 -11
  271. package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
  272. package/_mjs/STM/api/core-constructors.mjs.map +1 -1
  273. package/_mjs/STM/api.mjs +52 -72
  274. package/_mjs/STM/api.mjs.map +1 -1
  275. package/_mjs/STM/definition.mjs.map +1 -1
  276. package/_mjs/STM/driver.mjs +6 -5
  277. package/_mjs/STM/driver.mjs.map +1 -1
  278. package/_mjs/STM/internal/Journal.mjs +20 -21
  279. package/_mjs/STM/internal/Journal.mjs.map +1 -1
  280. package/_mjs/Schedule/Decision.mjs +9 -0
  281. package/_mjs/Schedule/Decision.mjs.map +1 -1
  282. package/_mjs/Schedule/api/driver.mjs +20 -20
  283. package/_mjs/Schedule/api/driver.mjs.map +1 -1
  284. package/_mjs/Schedule/api.mjs +84 -63
  285. package/_mjs/Schedule/api.mjs.map +1 -1
  286. package/_mjs/Scope/Finalizer/definition.mjs +4 -5
  287. package/_mjs/Scope/Finalizer/definition.mjs.map +1 -1
  288. package/_mjs/Scope/ReleaseMap/definition.mjs +2 -3
  289. package/_mjs/Scope/ReleaseMap/definition.mjs.map +1 -1
  290. package/_mjs/Scope/api.mjs +2 -12
  291. package/_mjs/Scope/api.mjs.map +1 -1
  292. package/_mjs/ScopedRef/api.mjs +14 -22
  293. package/_mjs/ScopedRef/api.mjs.map +1 -1
  294. package/_mjs/Sink/api.mjs +414 -129
  295. package/_mjs/Sink/api.mjs.map +1 -1
  296. package/_mjs/Stream/api.mjs +94 -94
  297. package/_mjs/Stream/api.mjs.map +1 -1
  298. package/_mjs/Supervisor/constructors.mjs +9 -6
  299. package/_mjs/Supervisor/constructors.mjs.map +1 -1
  300. package/_mjs/TFuture/definition.mjs +2 -3
  301. package/_mjs/TFuture/definition.mjs.map +1 -1
  302. package/_mjs/TSemaphore/api.mjs +4 -4
  303. package/_mjs/TSemaphore/api.mjs.map +1 -1
  304. package/_mjs/TSemaphore/definition.mjs +2 -3
  305. package/_mjs/TSemaphore/definition.mjs.map +1 -1
  306. package/_mjs/collection/immutable/Conc/dropUntilIO.mjs +26 -0
  307. package/_mjs/collection/immutable/Conc/dropUntilIO.mjs.map +1 -0
  308. package/_mjs/collection/immutable/Conc/dropWhileIO.mjs +26 -0
  309. package/_mjs/collection/immutable/Conc/dropWhileIO.mjs.map +1 -0
  310. package/_mjs/internal/Scheduler.mjs +62 -15
  311. package/_mjs/internal/Scheduler.mjs.map +1 -1
  312. package/_src/Cached/api.ts +3 -3
  313. package/_src/Channel/api/interruptWhen.ts +1 -1
  314. package/_src/Channel/api/mapOutIOC.ts +2 -2
  315. package/_src/Channel/api/mergeAll.ts +1 -1
  316. package/_src/Channel/api/mergeAllUnboundedWith.ts +1 -1
  317. package/_src/Channel/api/mergeAllWith.ts +3 -3
  318. package/_src/Channel/api/mergeMap.ts +1 -1
  319. package/_src/Channel/api/mergeWith.ts +9 -9
  320. package/_src/Channel/api/runScoped.ts +1 -1
  321. package/_src/Channel/api/toPull.ts +1 -1
  322. package/_src/Channel/api/zipC.ts +3 -3
  323. package/_src/Channel/api.ts +69 -69
  324. package/_src/Channel/core-api.ts +11 -11
  325. package/_src/Channel/definition.ts +12 -12
  326. package/_src/Channel/internal/MergeDecision.ts +1 -1
  327. package/_src/Clock/live.ts +1 -1
  328. package/_src/Fiber/FiberContext.ts +10 -8
  329. package/_src/Fiber/api/awaitAll.ts +1 -1
  330. package/_src/Fiber/api/evalOnIO.ts +1 -1
  331. package/_src/Fiber/api/joinAll.ts +1 -1
  332. package/_src/Fiber/definition.ts +1 -1
  333. package/_src/FiberRef/api/locallyScoped.ts +1 -1
  334. package/_src/FiberRef/api/locallyScopedWith.ts +1 -1
  335. package/_src/FiberRef/constructors.ts +2 -2
  336. package/_src/FiberRef/unsafe.ts +7 -0
  337. package/_src/Future/api.ts +3 -3
  338. package/_src/Future/constructors.ts +1 -1
  339. package/_src/Hub/api.ts +11 -11
  340. package/_src/Hub/definition.ts +6 -6
  341. package/_src/Hub/internal.ts +15 -15
  342. package/_src/IO/api/acquireRelease.ts +1 -1
  343. package/_src/IO/api/acquireReleaseExit.ts +1 -1
  344. package/_src/IO/api/acquireReleaseInterruptible.ts +1 -1
  345. package/_src/IO/api/acquireReleaseInterruptibleExit.ts +1 -1
  346. package/_src/IO/api/addFinalizer.ts +1 -1
  347. package/_src/IO/api/addFinalizerExit.ts +5 -7
  348. package/_src/IO/api/bracket.ts +1 -1
  349. package/_src/IO/api/bracketExit.ts +1 -1
  350. package/_src/IO/api/concurrentFinalizers.ts +1 -1
  351. package/_src/IO/api/core-scope.ts +1 -1
  352. package/_src/IO/api/ensuringChildren.ts +2 -2
  353. package/_src/IO/api/environment.ts +9 -11
  354. package/_src/IO/api/forkScoped.ts +1 -1
  355. package/_src/IO/api/interrupt.ts +3 -3
  356. package/_src/IO/api/memoize.ts +3 -3
  357. package/_src/IO/api/onExit.ts +1 -1
  358. package/_src/IO/api/onTermination.ts +1 -1
  359. package/_src/IO/api/provideSomeLayer.ts +1 -2
  360. package/_src/IO/api/race.ts +1 -1
  361. package/_src/IO/api/raceFirst.ts +1 -1
  362. package/_src/IO/api/repeat.ts +4 -4
  363. package/_src/IO/api/retry.ts +4 -4
  364. package/_src/IO/api/schedule.ts +3 -3
  365. package/_src/IO/api/scope.ts +1 -1
  366. package/_src/IO/api/scopeWith.ts +1 -1
  367. package/_src/IO/api/scoped.ts +2 -2
  368. package/_src/IO/api/sequenceT.ts +1 -1
  369. package/_src/IO/api/stateful.ts +1 -1
  370. package/_src/IO/api/withChildren.ts +1 -1
  371. package/_src/IO/api/withEarlyRelease.ts +1 -1
  372. package/_src/IO/api/withFinalizer.ts +1 -1
  373. package/_src/IO/api/withFinalizerExit.ts +1 -1
  374. package/_src/IO/api/zipC.ts +2 -2
  375. package/_src/IO/api.ts +48 -48
  376. package/_src/IO/definition.ts +29 -24
  377. package/_src/IO/runtime.ts +66 -12
  378. package/_src/IOEnv/definition.ts +1 -1
  379. package/_src/Layer/MemoMap.ts +19 -19
  380. package/_src/Layer/api.ts +38 -38
  381. package/_src/Layer/definition.ts +5 -5
  382. package/_src/Queue/api/dimapIO.ts +10 -10
  383. package/_src/Queue/api/filterInputIO.ts +4 -4
  384. package/_src/Queue/api/filterOutputIO.ts +6 -6
  385. package/_src/Queue/api/zipWithIO.ts +10 -10
  386. package/_src/Queue/definition.ts +7 -7
  387. package/_src/Queue/internal.ts +7 -7
  388. package/_src/Queue/strategy.ts +4 -4
  389. package/_src/Random/api.ts +1 -1
  390. package/_src/Ref/Atomic/Atomic.ts +3 -3
  391. package/_src/Ref/Derived.ts +3 -3
  392. package/_src/Ref/DerivedAll.ts +3 -3
  393. package/_src/Ref/Synchronized/api.ts +15 -15
  394. package/_src/Ref/Synchronized/constructors.ts +4 -4
  395. package/_src/Ref/Synchronized/definition.ts +2 -2
  396. package/_src/Ref/api/get.ts +2 -2
  397. package/_src/Ref/api/modify.ts +9 -9
  398. package/_src/Ref/api/set.ts +1 -1
  399. package/_src/Ref/definition.ts +13 -13
  400. package/_src/STM/api/core-api.ts +6 -6
  401. package/_src/STM/api/core-constructors.ts +7 -7
  402. package/_src/STM/api.ts +58 -89
  403. package/_src/STM/definition.ts +6 -6
  404. package/_src/STM/driver.ts +3 -3
  405. package/_src/STM/internal/Journal.ts +25 -16
  406. package/_src/Schedule/Decision.ts +10 -3
  407. package/_src/Schedule/Driver.ts +2 -2
  408. package/_src/Schedule/api/driver.ts +6 -6
  409. package/_src/Schedule/api.ts +97 -77
  410. package/_src/Schedule/definition.ts +1 -1
  411. package/_src/Scope/Finalizer/definition.ts +2 -2
  412. package/_src/Scope/ReleaseMap/api.ts +1 -1
  413. package/_src/Scope/ReleaseMap/definition.ts +1 -1
  414. package/_src/Scope/api.ts +11 -11
  415. package/_src/ScopedRef/api.ts +12 -17
  416. package/_src/ScopedRef/definition.ts +1 -1
  417. package/_src/Sink/api.ts +441 -86
  418. package/_src/State/api.ts +1 -1
  419. package/_src/Stream/api/zipAllWith.ts +2 -2
  420. package/_src/Stream/api/zipWith.ts +1 -1
  421. package/_src/Stream/api/zipWithChunks.ts +2 -2
  422. package/_src/Stream/api.ts +150 -149
  423. package/_src/Stream/definition.ts +3 -3
  424. package/_src/Stream/internal/Take.ts +1 -1
  425. package/_src/Supervisor/constructors.ts +7 -3
  426. package/_src/TFuture/api.ts +1 -1
  427. package/_src/TFuture/definition.ts +1 -1
  428. package/_src/TReentrantLock/api.ts +2 -2
  429. package/_src/TRef/api.ts +11 -11
  430. package/_src/TRef/constructors.ts +2 -2
  431. package/_src/TSemaphore/api.ts +2 -2
  432. package/_src/TSemaphore/definition.ts +1 -1
  433. package/_src/collection/immutable/Conc/dropUntilIO.ts +24 -0
  434. package/_src/collection/immutable/Conc/dropWhileIO.ts +26 -0
  435. package/_src/internal/Scheduler.ts +59 -15
  436. package/collection/immutable/Conc/dropUntilIO.d.ts +7 -0
  437. package/collection/immutable/Conc/dropWhileIO.d.ts +7 -0
  438. package/internal/Scheduler.d.ts +18 -1
  439. package/package.json +3 -3
@@ -5,7 +5,7 @@
5
5
  export class Driver<State, Env, In, Out> {
6
6
  constructor(
7
7
  readonly next: (inp: In, __tsplusTrace?: string) => IO<Env, Nothing, Out>,
8
- readonly last: IO<unknown, NoSuchElementError, Out>,
8
+ readonly last: IO<never, NoSuchElementError, Out>,
9
9
  readonly reset: UIO<void>,
10
10
  readonly state: UIO<State>,
11
11
  ) {}
@@ -16,7 +16,7 @@ export class Driver<State, Env, In, Out> {
16
16
  */
17
17
  export function makeDriver<State, Env, In, Out>(
18
18
  next: (inp: In, __tsplusTrace?: string) => IO<Env, Nothing, Out>,
19
- last: IO<unknown, NoSuchElementError, Out>,
19
+ last: IO<never, NoSuchElementError, Out>,
20
20
  reset: UIO<void>,
21
21
  state: UIO<State>,
22
22
  ): Driver<State, Env, In, Out> {
@@ -9,17 +9,17 @@ export function driver<State, Env, In, Out>(
9
9
  ): UIO<Schedule.Driver<State, Env, In, Out>> {
10
10
  return Ref.make<readonly [Maybe<Out>, State]>([Nothing(), schedule.initial]).map((ref) => {
11
11
  const next = (inp: In, __tsplusTrace?: string) =>
12
- IO.gen(function* (_) {
13
- const state = yield* _(ref.get.map(([_, s]) => s));
14
- const now = yield* _(Clock.currentTime);
15
- const [state1, out, decision] = yield* _(schedule.step(now, inp, state));
16
- return yield* _(
12
+ Do((_) => {
13
+ const state = _(ref.get.map(([_, s]) => s));
14
+ const now = _(Clock.currentTime);
15
+ const [state1, out, decision] = _(schedule.step(now, inp, state));
16
+ return _(
17
17
  decision.match(
18
18
  () => ref.set([Just(out), state1]).apSecond(IO.failNow(Nothing() as Nothing)),
19
19
  (interval) =>
20
20
  ref
21
21
  .set([Just(out), state1])
22
- .apSecond(Clock.sleep(Duration.fromInterval(now, interval.startMilliseconds)))
22
+ .apSecond(Clock.sleep(Duration.fromInterval(now, interval.start)))
23
23
  .as(out),
24
24
  ),
25
25
  );
@@ -30,7 +30,7 @@ export function addDelay_<State, Env, In, Out>(
30
30
  export function addDelayIO_<State, Env, In, Out, Env1>(
31
31
  self: Schedule.WithState<State, Env, In, Out>,
32
32
  f: (out: Out) => URIO<Env1, number>,
33
- ): Schedule.WithState<State, Env & Env1, In, Out> {
33
+ ): Schedule.WithState<State, Env | Env1, In, Out> {
34
34
  return self.modifyDelayIO((out, duration) => f(out).map((d) => duration + d));
35
35
  }
36
36
 
@@ -40,7 +40,7 @@ export function addDelayIO_<State, Env, In, Out, Env1>(
40
40
  export function andThen<State, Env, In, Out, State1, Env1, In1, Out1>(
41
41
  self: Schedule.WithState<State, Env, In, Out>,
42
42
  that: Schedule.WithState<State1, Env1, In1, Out1>,
43
- ): Schedule.WithState<readonly [State, State1, boolean], Env & Env1, In & In1, Out | Out1> {
43
+ ): Schedule.WithState<readonly [State, State1, boolean], Env | Env1, In & In1, Out | Out1> {
44
44
  return self.andThenEither(that).map((out) => out.value);
45
45
  }
46
46
 
@@ -50,8 +50,8 @@ export function andThen<State, Env, In, Out, State1, Env1, In1, Out1>(
50
50
  export function andThenEither_<State, Env, In, Out, State1, Env1, In1, Out1>(
51
51
  self: Schedule.WithState<State, Env, In, Out>,
52
52
  that: Schedule.WithState<State1, Env1, In1, Out1>,
53
- ): Schedule.WithState<readonly [State, State1, boolean], Env & Env1, In & In1, Either<Out, Out1>> {
54
- return Schedule<readonly [State, State1, boolean], Env & Env1, In & In1, Either<Out, Out1>>(
53
+ ): Schedule.WithState<readonly [State, State1, boolean], Env | Env1, In & In1, Either<Out, Out1>> {
54
+ return Schedule<readonly [State, State1, boolean], Env | Env1, In & In1, Either<Out, Out1>>(
55
55
  [self.initial, that.initial, true],
56
56
  (now, inp, [s1, s2, onLeft]) => {
57
57
  if (onLeft) {
@@ -99,7 +99,7 @@ export function check_<State, Env, In, Out>(
99
99
  export function checkIO_<State, Env, In, Out, Env1>(
100
100
  self: Schedule.WithState<State, Env, In, Out>,
101
101
  test: (inp: In, out: Out) => URIO<Env1, boolean>,
102
- ): Schedule.WithState<State, Env & Env1, In, Out> {
102
+ ): Schedule.WithState<State, Env | Env1, In, Out> {
103
103
  return Schedule(self.initial, (now, inp, state) =>
104
104
  self.step(now, inp, state).flatMap(([state, out, decision]) =>
105
105
  decision.match(
@@ -117,7 +117,7 @@ export function checkIO_<State, Env, In, Out, Env1>(
117
117
  export function compose_<S, R, I, O, S1, R1, O2>(
118
118
  self: Schedule.WithState<S, R, I, O>,
119
119
  that: Schedule.WithState<S1, R1, O, O2>,
120
- ): Schedule.WithState<readonly [S, S1], R & R1, I, O2> {
120
+ ): Schedule.WithState<readonly [S, S1], R | R1, I, O2> {
121
121
  return Schedule([self.initial, that.initial], (now, inp, state) =>
122
122
  self.step(now, inp, state[0]).flatMap(([lState, out, decision]) =>
123
123
  decision.match(
@@ -160,7 +160,7 @@ export function contramapEnvironment_<S, R, I, O, R1>(
160
160
  export function contramapIO_<S, R, I, O, R1, I2>(
161
161
  self: Schedule.WithState<S, R, I, O>,
162
162
  f: (inp: I2) => URIO<R1, I>,
163
- ): Schedule.WithState<S, R & R1, I2, O> {
163
+ ): Schedule.WithState<S, R | R1, I2, O> {
164
164
  return Schedule(self.initial, (now, inp2, state) => f(inp2).flatMap((inp) => self.step(now, inp, state)));
165
165
  }
166
166
 
@@ -187,7 +187,7 @@ export function delayedSelf_<S, R, I, O>(
187
187
  export function delayedIO_<S, R, I, O, R1>(
188
188
  self: Schedule.WithState<S, R, I, O>,
189
189
  f: (delay: number) => URIO<R1, number>,
190
- ): Schedule.WithState<S, R & R1, I, O> {
190
+ ): Schedule.WithState<S, R | R1, I, O> {
191
191
  return self.modifyDelayIO((_, delay) => f(delay));
192
192
  }
193
193
 
@@ -200,7 +200,7 @@ export function delays<S, R, I, O>(self: Schedule.WithState<S, R, I, O>): Schedu
200
200
  decision.match(
201
201
  () => IO.succeedNow([state, 0, Decision.Done]),
202
202
  (interval) => {
203
- const delay = interval.startMilliseconds - now;
203
+ const delay = interval.start - now;
204
204
  return IO.succeedNow([state, delay, Decision.Continue(interval)]);
205
205
  },
206
206
  ),
@@ -226,19 +226,19 @@ export function dimapIO_<S, R, I, O, R1, I2, R2, O2>(
226
226
  self: Schedule.WithState<S, R, I, O>,
227
227
  f: (inp2: I2) => URIO<R1, I>,
228
228
  g: (out: O) => URIO<R2, O2>,
229
- ): Schedule.WithState<S, R & R1 & R2, I2, O2> {
229
+ ): Schedule.WithState<S, R | R1 | R2, I2, O2> {
230
230
  return self.contramapIO(f).mapIO(g);
231
231
  }
232
232
 
233
233
  /**
234
234
  * @tsplus static fncts.io.ScheduleOps duration
235
235
  */
236
- export function duration(duration: number): Schedule.WithState<boolean, unknown, unknown, number> {
237
- return Schedule<boolean, unknown, unknown, number>(true, (now, _, state) =>
236
+ export function duration(duration: number): Schedule.WithState<boolean, never, unknown, number> {
237
+ return Schedule<boolean, never, unknown, number>(true, (now, _, state) =>
238
238
  IO.succeed(() => {
239
239
  if (state) {
240
240
  const interval = Interval.after(now + duration);
241
- return [false, duration, Decision.Continue(interval)];
241
+ return [false, duration, Decision.continueWith(interval)];
242
242
  } else {
243
243
  return [false, 0, Decision.Done];
244
244
  }
@@ -246,21 +246,41 @@ export function duration(duration: number): Schedule.WithState<boolean, unknown,
246
246
  );
247
247
  }
248
248
 
249
+ /**
250
+ * @tsplus fluent fncts.io.Schedule either
251
+ * @tsplus operator fncts.io.Schedule ||
252
+ */
253
+ export function either<S, R, I, O, S1, R1, I1, O1>(
254
+ self: Schedule.WithState<S, R, I, O>,
255
+ that: Schedule.WithState<S1, R1, I1, O1>,
256
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
257
+ return self.unionWith(that, (interval1, interval2) => interval1 || interval2);
258
+ }
259
+
260
+ /**
261
+ * @tsplus fluent fncts.io.Schedule eitherWith
262
+ */
263
+ export function eitherWith<S, R, I, O, S1, R1, I1, O1, O2>(
264
+ self: Schedule.WithState<S, R, I, O>,
265
+ that: Schedule.WithState<S1, R1, I1, O1>,
266
+ f: (out1: O, out2: O1) => O2,
267
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O2> {
268
+ return (self || that).map(f.tupled);
269
+ }
270
+
249
271
  /**
250
272
  * @tsplus static fncts.io.ScheduleOps elapsed
251
273
  */
252
- export const elapsed: Schedule.WithState<Maybe<number>, unknown, unknown, number> = Schedule(
253
- Nothing(),
254
- (now, _, state) =>
255
- IO.succeed(
256
- state.match(
257
- () => [Just(now), 0, Decision.Continue(Interval(now, Number.MAX_SAFE_INTEGER))],
258
- (start) => {
259
- const duration = now - start;
260
- return [Just(start), duration, Decision.Continue(Interval(now, Number.MAX_SAFE_INTEGER))];
261
- },
262
- ),
274
+ export const elapsed: Schedule.WithState<Maybe<number>, never, unknown, number> = Schedule(Nothing(), (now, _, state) =>
275
+ IO.succeed(
276
+ state.match(
277
+ () => [Just(now), 0, Decision.continueWith(Interval(now, Number.MAX_SAFE_INTEGER))],
278
+ (start) => {
279
+ const duration = now - start;
280
+ return [Just(start), duration, Decision.continueWith(Interval(now, Number.MAX_SAFE_INTEGER))];
281
+ },
263
282
  ),
283
+ ),
264
284
  );
265
285
 
266
286
  /**
@@ -283,7 +303,7 @@ export function ensuring_<S, R, I, O>(
283
303
  /**
284
304
  * @tsplus static fncts.io.ScheduleOps exponential
285
305
  */
286
- export function exponential(base: number, factor = 2): Schedule.WithState<number, unknown, unknown, number> {
306
+ export function exponential(base: number, factor = 2): Schedule.WithState<number, never, unknown, number> {
287
307
  return Schedule.delayed(Schedule.forever.map((i) => base * Math.pow(factor, i)));
288
308
  }
289
309
 
@@ -303,20 +323,20 @@ export function exponential(base: number, factor = 2): Schedule.WithState<number
303
323
  */
304
324
  export function fixed(
305
325
  interval: number,
306
- ): Schedule.WithState<readonly [Maybe<readonly [number, number]>, number], unknown, unknown, number> {
326
+ ): Schedule.WithState<readonly [Maybe<readonly [number, number]>, number], never, unknown, number> {
307
327
  return Schedule([Nothing(), 0], (now, inp, [ms, n]) =>
308
328
  IO.succeed(
309
329
  ms.match(
310
330
  () => {
311
331
  const nextRun = now + interval;
312
- return [[Just([now, nextRun]), n + 1], n, Decision.Continue(Interval.after(nextRun))];
332
+ return [[Just([now, nextRun]), n + 1], n, Decision.continueWith(Interval.after(nextRun))];
313
333
  },
314
334
  ([startMillis, lastRun]) => {
315
335
  const runningBehind = now > lastRun + interval;
316
336
  const boundary = interval === 0 ? interval : interval - ((now - startMillis) % interval);
317
337
  const sleepTime = boundary === 0 ? interval : boundary;
318
338
  const nextRun = runningBehind ? now : now + sleepTime;
319
- return [[Just([startMillis, nextRun]), n + 1], n, Decision.Continue(Interval.after(nextRun))];
339
+ return [[Just([startMillis, nextRun]), n + 1], n, Decision.continueWith(Interval.after(nextRun))];
320
340
  },
321
341
  ),
322
342
  ),
@@ -341,7 +361,7 @@ export function foldIO_<S, R, I, O, Z, R1>(
341
361
  self: Schedule.WithState<S, R, I, O>,
342
362
  z: Z,
343
363
  f: (z: Z, out: O) => URIO<R1, Z>,
344
- ): Schedule.WithState<readonly [S, Z], R & R1, I, Z> {
364
+ ): Schedule.WithState<readonly [S, Z], R | R1, I, Z> {
345
365
  return Schedule([self.initial, z], (now, inp, [s, z]) =>
346
366
  self.step(now, inp, s).flatMap(([s, out, decision]) =>
347
367
  decision.match(
@@ -374,8 +394,8 @@ export const forever = Schedule.unfold(0, (n) => n + 1);
374
394
  /**
375
395
  * @tsplus static fncts.io.ScheduleOps identity
376
396
  */
377
- export function identity<A>(): Schedule.WithState<void, unknown, A, A> {
378
- return Schedule(undefined, (now, inp, state) => IO.succeed([state, inp, Decision.Continue(Interval.after(now))]));
397
+ export function identity<A>(): Schedule.WithState<void, never, A, A> {
398
+ return Schedule(undefined, (now, inp, state) => IO.succeed([state, inp, Decision.continueWith(Interval.after(now))]));
379
399
  }
380
400
 
381
401
  function intersectWithLoop<S, R, I, O, S1, R1, I1, O1>(
@@ -384,24 +404,24 @@ function intersectWithLoop<S, R, I, O, S1, R1, I1, O1>(
384
404
  inp: I & I1,
385
405
  lState: S,
386
406
  out: O,
387
- lInterval: Interval,
407
+ lInterval: Intervals,
388
408
  rState: S1,
389
409
  out2: O1,
390
- rInterval: Interval,
391
- f: (lInterval: Interval, rInterval: Interval) => Interval,
392
- ): IO<R & R1, never, readonly [readonly [S, S1], readonly [O, O1], Decision]> {
410
+ rInterval: Intervals,
411
+ f: (lInterval: Intervals, rInterval: Intervals) => Intervals,
412
+ ): IO<R | R1, never, readonly [readonly [S, S1], readonly [O, O1], Decision]> {
393
413
  const combined = f(lInterval, rInterval);
394
414
  if (combined.isNonEmpty) {
395
415
  return IO.succeedNow([[lState, rState], [out, out2], Decision.Continue(combined)]);
396
416
  } else if (lInterval < rInterval) {
397
- return self.step(lInterval.endMilliseconds, inp, lState).flatMap(([lState, out, decision]) =>
417
+ return self.step(lInterval.end, inp, lState).flatMap(([lState, out, decision]) =>
398
418
  decision.match(
399
419
  () => IO.succeedNow([[lState, rState], [out, out2], Decision.Done]),
400
420
  (lInterval) => intersectWithLoop(self, that, inp, lState, out, lInterval, rState, out2, rInterval, f),
401
421
  ),
402
422
  );
403
423
  } else {
404
- return that.step(rInterval.endMilliseconds, inp, rState).flatMap(([rState, out2, decision]) =>
424
+ return that.step(rInterval.end, inp, rState).flatMap(([rState, out2, decision]) =>
405
425
  decision.match(
406
426
  () => IO.succeedNow([[lState, rState], [out, out2], Decision.Done]),
407
427
  (rInterval) => intersectWithLoop(self, that, inp, lState, out, lInterval, rState, out2, rInterval, f),
@@ -416,8 +436,8 @@ function intersectWithLoop<S, R, I, O, S1, R1, I1, O1>(
416
436
  export function intersectWith_<S, R, I, O, S1, R1, I1, O1>(
417
437
  self: Schedule.WithState<S, R, I, O>,
418
438
  that: Schedule.WithState<S1, R1, I1, O1>,
419
- f: (int1: Interval, int2: Interval) => Interval,
420
- ): Schedule.WithState<readonly [S, S1], R & R1, I & I1, readonly [O, O1]> {
439
+ f: (int1: Intervals, int2: Intervals) => Intervals,
440
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
421
441
  return Schedule([self.initial, that.initial] as const, (now, inp, state) => {
422
442
  const left = self.step(now, inp, state[0]);
423
443
  const right = that.step(now, inp, state[1]);
@@ -435,7 +455,7 @@ export function intersectWith_<S, R, I, O, S1, R1, I1, O1>(
435
455
  /**
436
456
  * @tsplus static fncts.io.Schedule linear
437
457
  */
438
- export function linear(base: number): Schedule.WithState<number, unknown, unknown, number> {
458
+ export function linear(base: number): Schedule.WithState<number, never, unknown, number> {
439
459
  return Schedule.delayed(Schedule.forever.map((i) => base * (i + 1)));
440
460
  }
441
461
 
@@ -455,7 +475,7 @@ export function map_<State, Env, In, Out, Out1>(
455
475
  export function mapIO_<State, Env, In, Out, Env1, Out1>(
456
476
  self: Schedule.WithState<State, Env, In, Out>,
457
477
  f: (out: Out) => URIO<Env1, Out1>,
458
- ): Schedule.WithState<State, Env & Env1, In, Out1> {
478
+ ): Schedule.WithState<State, Env | Env1, In, Out1> {
459
479
  return Schedule(self.initial, (now, inp, state) =>
460
480
  self.step(now, inp, state).flatMap(([state, out, decision]) => f(out).map((out1) => [state, out1, decision])),
461
481
  );
@@ -467,21 +487,21 @@ export function mapIO_<State, Env, In, Out, Env1, Out1>(
467
487
  export function modifyDelayIO_<State, Env, In, Out, Env1>(
468
488
  self: Schedule.WithState<State, Env, In, Out>,
469
489
  f: (out: Out, duration: number) => URIO<Env1, number>,
470
- ): Schedule.WithState<State, Env & Env1, In, Out> {
490
+ ): Schedule.WithState<State, Env | Env1, In, Out> {
471
491
  return Schedule(self.initial, (now, inp, state) =>
472
492
  self.step(now, inp, state).flatMap(([state, out, decision]) =>
473
493
  decision.match(
474
494
  () => IO.succeedNow([state, out, decision]),
475
495
  (interval) => {
476
- const delay = Interval(now, interval.startMilliseconds).size;
496
+ const delay = Interval(now, interval.start).size;
477
497
 
478
498
  return f(out, delay).map((duration) => {
479
- const oldStart = interval.startMilliseconds;
499
+ const oldStart = interval.start;
480
500
  const newStart = now + duration;
481
501
  const delta = newStart - oldStart;
482
- const newEnd = interval.endMilliseconds + delta;
502
+ const newEnd = interval.end + delta;
483
503
  const newInterval = Interval(newStart, newEnd);
484
- return [state, out, Decision.Continue(newInterval)];
504
+ return [state, out, Decision.continueWith(newInterval)];
485
505
  });
486
506
  },
487
507
  ),
@@ -495,7 +515,7 @@ export function modifyDelayIO_<State, Env, In, Out, Env1>(
495
515
  export function onDecision_<S, R, I, O, R1>(
496
516
  self: Schedule.WithState<S, R, I, O>,
497
517
  f: (state: S, out: O, decision: Decision) => URIO<R1, any>,
498
- ): Schedule.WithState<S, R & R1, I, O> {
518
+ ): Schedule.WithState<S, R | R1, I, O> {
499
519
  return Schedule(self.initial, (now, inp, state) =>
500
520
  self.step(now, inp, state).flatMap(([state, out, decision]) => f(state, out, decision).as([state, out, decision])),
501
521
  );
@@ -507,7 +527,7 @@ export function onDecision_<S, R, I, O, R1>(
507
527
  export function provideEnvironment_<S, R, I, O>(
508
528
  self: Schedule.WithState<S, R, I, O>,
509
529
  env: Environment<R>,
510
- ): Schedule.WithState<S, unknown, I, O> {
530
+ ): Schedule.WithState<S, never, I, O> {
511
531
  return Schedule(self.initial, (now, inp, state) => self.step(now, inp, state).provideEnvironment(env));
512
532
  }
513
533
 
@@ -527,7 +547,7 @@ export function reconsider_<S, R, I, O, O2>(
527
547
  export function reconsiderIO_<S, R, I, O, R1, O1>(
528
548
  self: Schedule.WithState<S, R, I, O>,
529
549
  f: (state: S, out: O, decision: Decision) => URIO<R1, Either<O1, readonly [O1, Interval]>>,
530
- ): Schedule.WithState<S, R & R1, I, O1> {
550
+ ): Schedule.WithState<S, R | R1, I, O1> {
531
551
  return Schedule(self.initial, (now, inp, state) =>
532
552
  self.step(now, inp, state).flatMap(([state, out, decision]) =>
533
553
  decision.match(
@@ -542,7 +562,7 @@ export function reconsiderIO_<S, R, I, O, R1, O1>(
542
562
  f(state, out, decision).map((r) =>
543
563
  r.match(
544
564
  (out1) => [state, out1, Decision.Done],
545
- ([out1, interval]) => [state, out1, Decision.Continue(interval)],
565
+ ([out1, interval]) => [state, out1, Decision.continueWith(interval)],
546
566
  ),
547
567
  ),
548
568
  ),
@@ -553,14 +573,14 @@ export function reconsiderIO_<S, R, I, O, R1, O1>(
553
573
  /**
554
574
  * @tsplus static fncts.io.Schedule recurs
555
575
  */
556
- export function recurs(n: number): Schedule.WithState<number, unknown, unknown, number> {
576
+ export function recurs(n: number): Schedule.WithState<number, never, unknown, number> {
557
577
  return Schedule.forever.whileOutput((_) => _ < n);
558
578
  }
559
579
 
560
580
  /**
561
581
  * @tsplus static fncts.io.Schedule recurWhile
562
582
  */
563
- export function recurWhile<A>(f: (a: A) => boolean): Schedule.WithState<void, unknown, A, A> {
583
+ export function recurWhile<A>(f: (a: A) => boolean): Schedule.WithState<void, never, A, A> {
564
584
  return identity<A>().whileInput(f);
565
585
  }
566
586
 
@@ -574,14 +594,14 @@ export function recurWhileIO<R, A>(f: (a: A) => URIO<R, boolean>): Schedule.With
574
594
  /**
575
595
  * @tsplus static fncts.io.Schedule recurWhileEquals
576
596
  */
577
- export function recurWhileEquals<A>(value: Lazy<A>): Schedule.WithState<void, unknown, A, A> {
597
+ export function recurWhileEquals<A>(value: Lazy<A>): Schedule.WithState<void, never, A, A> {
578
598
  return identity<A>().whileInput((a) => Equatable.strictEquals(a, value()));
579
599
  }
580
600
 
581
601
  /**
582
602
  * @tsplus static fncts.io.Schedule recurUntil
583
603
  */
584
- export function recurUntil<A>(f: (a: A) => boolean): Schedule.WithState<void, unknown, A, A> {
604
+ export function recurUntil<A>(f: (a: A) => boolean): Schedule.WithState<void, never, A, A> {
585
605
  return identity<A>().untilInput(f);
586
606
  }
587
607
 
@@ -595,7 +615,7 @@ export function recurUntilIO<R, A>(f: (a: A) => URIO<R, boolean>): Schedule.With
595
615
  /**
596
616
  * @tsplus static fncts.io.Schedule recurUntilEquals
597
617
  */
598
- export function recurUntilEquals<A>(value: Lazy<A>): Schedule.WithState<void, unknown, A, A> {
618
+ export function recurUntilEquals<A>(value: Lazy<A>): Schedule.WithState<void, never, A, A> {
599
619
  return identity<A>().untilInput((a) => Equatable.strictEquals(a, value()));
600
620
  }
601
621
 
@@ -652,7 +672,7 @@ export function run_<S, R, I, O>(
652
672
  return self.step(now, xs.head, state).flatMap(([state, out, decision]) =>
653
673
  decision.match(
654
674
  () => IO.succeed(acc.append(out)),
655
- (interval) => loop(interval.startMilliseconds, xs.tail, state, acc.append(out)),
675
+ (interval) => loop(interval.start, xs.tail, state, acc.append(out)),
656
676
  ),
657
677
  );
658
678
  }
@@ -663,14 +683,14 @@ export function run_<S, R, I, O>(
663
683
  /**
664
684
  * @tsplus static fncts.io.Schedule spaced
665
685
  */
666
- export function spaced(duration: number): Schedule.WithState<number, unknown, unknown, number> {
686
+ export function spaced(duration: number): Schedule.WithState<number, never, unknown, number> {
667
687
  return Schedule.forever.addDelay(() => duration);
668
688
  }
669
689
 
670
690
  /**
671
691
  * @tsplus static fncts.io.Schedule succeed
672
692
  */
673
- export function succeed<A>(a: Lazy<A>): Schedule.WithState<number, unknown, unknown, A> {
693
+ export function succeed<A>(a: Lazy<A>): Schedule.WithState<number, never, unknown, A> {
674
694
  return Schedule.forever.as(a);
675
695
  }
676
696
 
@@ -680,7 +700,7 @@ export function succeed<A>(a: Lazy<A>): Schedule.WithState<number, unknown, unkn
680
700
  export function tapInput_<S, R, I, O, R1>(
681
701
  self: Schedule.WithState<S, R, I, O>,
682
702
  f: (inp: I) => URIO<R1, any>,
683
- ): Schedule.WithState<S, R & R1, I, O> {
703
+ ): Schedule.WithState<S, R | R1, I, O> {
684
704
  return Schedule(self.initial, (now, inp, state) => f(inp).apSecond(self.step(now, inp, state)));
685
705
  }
686
706
 
@@ -690,7 +710,7 @@ export function tapInput_<S, R, I, O, R1>(
690
710
  export function tapOutput_<S, R, I, O, R1>(
691
711
  self: Schedule.WithState<S, R, I, O>,
692
712
  f: (out: O) => URIO<R1, any>,
693
- ): Schedule.WithState<S, R & R1, I, O> {
713
+ ): Schedule.WithState<S, R | R1, I, O> {
694
714
  return Schedule(self.initial, (now, inp, state) => self.step(now, inp, state).tap(([_, out]) => f(out)));
695
715
  }
696
716
 
@@ -700,8 +720,8 @@ export function tapOutput_<S, R, I, O, R1>(
700
720
  export function unionWith_<S, R, I, O, S1, R1, I1, O1>(
701
721
  self: Schedule.WithState<S, R, I, O>,
702
722
  that: Schedule.WithState<S1, R1, I1, O1>,
703
- f: (int1: Interval, int2: Interval) => Interval,
704
- ): Schedule.WithState<readonly [S, S1], R & R1, I & I1, readonly [O, O1]> {
723
+ f: (int1: Intervals, int2: Intervals) => Intervals,
724
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
705
725
  return Schedule([self.initial, that.initial], (now, inp, state) => {
706
726
  const left = self.step(now, inp, state[0]);
707
727
  const right = that.step(now, inp, state[1]);
@@ -729,9 +749,9 @@ export function unionWith_<S, R, I, O, S1, R1, I1, O1>(
729
749
  /**
730
750
  * @tsplus static fncts.io.ScheduleOps unfold
731
751
  */
732
- export function unfold<A>(a: Lazy<A>, f: (a: A) => A): Schedule.WithState<A, unknown, unknown, A> {
733
- return Schedule<A, unknown, unknown, A>(a(), (now, inp, state) =>
734
- IO.succeed([f(state), state, Decision.Continue(Interval(now, Number.MAX_SAFE_INTEGER))]),
752
+ export function unfold<A>(a: Lazy<A>, f: (a: A) => A): Schedule.WithState<A, never, unknown, A> {
753
+ return Schedule<A, never, unknown, A>(a(), (now, inp, state) =>
754
+ IO.succeed([f(state), state, Decision.continueWith(Interval(now, Number.MAX_SAFE_INTEGER))]),
735
755
  );
736
756
  }
737
757
 
@@ -751,7 +771,7 @@ export function untilInput_<S, R, I, O>(
751
771
  export function untilInputIO_<S, R, I, O, R1>(
752
772
  self: Schedule.WithState<S, R, I, O>,
753
773
  f: (inp: I) => URIO<R1, boolean>,
754
- ): Schedule.WithState<S, R & R1, I, O> {
774
+ ): Schedule.WithState<S, R | R1, I, O> {
755
775
  return self.checkIO((inp) => f(inp).map((b) => !b));
756
776
  }
757
777
 
@@ -771,14 +791,14 @@ export function untilOutput_<S, R, I, O>(
771
791
  export function untilOutputIO_<S, R, I, O, R1>(
772
792
  self: Schedule.WithState<S, R, I, O>,
773
793
  f: (out: O) => URIO<R1, boolean>,
774
- ): Schedule.WithState<S, R & R1, I, O> {
794
+ ): Schedule.WithState<S, R | R1, I, O> {
775
795
  return self.checkIO((_, out) => f(out).map((b) => !b));
776
796
  }
777
797
 
778
798
  /**
779
799
  * @tsplus static fncts.io.Schedule upTo
780
800
  */
781
- export function upTo(duration: number): Schedule.WithState<Maybe<number>, unknown, unknown, number> {
801
+ export function upTo(duration: number): Schedule.WithState<Maybe<number>, never, unknown, number> {
782
802
  return Schedule.elapsed.whileOutput((n) => n < duration);
783
803
  }
784
804
 
@@ -798,7 +818,7 @@ export function whileInput_<S, R, I, O>(
798
818
  export function whileInputIO_<S, R, I, O, R1>(
799
819
  self: Schedule.WithState<S, R, I, O>,
800
820
  f: (inp: I) => URIO<R1, boolean>,
801
- ): Schedule.WithState<S, R & R1, I, O> {
821
+ ): Schedule.WithState<S, R | R1, I, O> {
802
822
  return self.checkIO((inp) => f(inp));
803
823
  }
804
824
 
@@ -818,7 +838,7 @@ export function whileOutput_<S, R, I, O>(
818
838
  export function whileOutputIO_<S, R, I, O, R1>(
819
839
  self: Schedule.WithState<S, R, I, O>,
820
840
  f: (out: O) => URIO<R1, boolean>,
821
- ): Schedule.WithState<S, R & R1, I, O> {
841
+ ): Schedule.WithState<S, R | R1, I, O> {
822
842
  return self.checkIO((_, out) => f(out));
823
843
  }
824
844
 
@@ -827,15 +847,15 @@ export function whileOutputIO_<S, R, I, O, R1>(
827
847
  */
828
848
  export function windowed(
829
849
  interval: number,
830
- ): Schedule.WithState<readonly [Maybe<number>, number], unknown, unknown, number> {
850
+ ): Schedule.WithState<readonly [Maybe<number>, number], never, unknown, number> {
831
851
  return Schedule([Nothing(), 0], (now, inp, [m, n]) =>
832
852
  IO.succeed(() =>
833
853
  m.match(
834
- () => [[Just(now), n + 1], n, Decision.Continue(Interval.after(now + interval))],
854
+ () => [[Just(now), n + 1], n, Decision.continueWith(Interval.after(now + interval))],
835
855
  (startMillis) => [
836
856
  [Just(startMillis), n + 1],
837
857
  n,
838
- Decision.Continue(Interval.after(now + (interval - ((now - startMillis) % interval)))),
858
+ Decision.continueWith(Interval.after(now + (interval - ((now - startMillis) % interval)))),
839
859
  ],
840
860
  ),
841
861
  ),
@@ -848,7 +868,7 @@ export function windowed(
848
868
  export function zip_<S, R, I, O, S1, R1, I1, O1>(
849
869
  self: Schedule.WithState<S, R, I, O>,
850
870
  that: Schedule.WithState<S1, R1, I1, O1>,
851
- ): Schedule.WithState<readonly [S, S1], R & R1, I & I1, readonly [O, O1]> {
871
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, readonly [O, O1]> {
852
872
  return self.intersectWith(that, (lInterval, rInterval) => lInterval.intersect(rInterval));
853
873
  }
854
874
 
@@ -858,7 +878,7 @@ export function zip_<S, R, I, O, S1, R1, I1, O1>(
858
878
  export function zipLeft_<S, R, I, O, S1, R1, I1, O1>(
859
879
  self: Schedule.WithState<S, R, I, O>,
860
880
  that: Schedule.WithState<S1, R1, I1, O1>,
861
- ): Schedule.WithState<readonly [S, S1], R & R1, I & I1, O> {
881
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O> {
862
882
  return self.zip(that).map(([out]) => out);
863
883
  }
864
884
 
@@ -868,7 +888,7 @@ export function zipLeft_<S, R, I, O, S1, R1, I1, O1>(
868
888
  export function zipRight_<S, R, I, O, S1, R1, I1, O1>(
869
889
  self: Schedule.WithState<S, R, I, O>,
870
890
  that: Schedule.WithState<S1, R1, I1, O1>,
871
- ): Schedule.WithState<readonly [S, S1], R & R1, I & I1, O1> {
891
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O1> {
872
892
  return self.zip(that).map(([_, out1]) => out1);
873
893
  }
874
894
 
@@ -879,6 +899,6 @@ export function zipWith_<S, R, I, O, S1, R1, I1, O2, O3>(
879
899
  self: Schedule.WithState<S, R, I, O>,
880
900
  that: Schedule.WithState<S1, R1, I1, O2>,
881
901
  f: (out1: O, out2: O2) => O3,
882
- ): Schedule.WithState<readonly [S, S1], R & R1, I & I1, O3> {
902
+ ): Schedule.WithState<readonly [S, S1], R | R1, I & I1, O3> {
883
903
  return self.zip(that).map(([out1, out2]) => f(out1, out2));
884
904
  }
@@ -32,7 +32,7 @@ import type { Driver as Driver_ } from "./Driver.js";
32
32
  * @tsplus companion fncts.io.ScheduleOps
33
33
  */
34
34
  export abstract class Schedule<Env, In, Out> {
35
- readonly _Env!: (_: Env) => void;
35
+ readonly _Env!: () => Env;
36
36
  readonly _In!: (_: In) => void;
37
37
  readonly _Out!: () => Out;
38
38
  readonly _State!: unknown;
@@ -1,5 +1,5 @@
1
1
  interface FinalizerN extends HKT {
2
- readonly [HKT.T]: Finalizer;
2
+ readonly type: Finalizer;
3
3
  }
4
4
 
5
5
  /**
@@ -10,7 +10,7 @@ export interface Finalizer
10
10
  {
11
11
  readonly Finalizer: unique symbol;
12
12
  },
13
- (exit: Exit<any, any>) => IO<unknown, never, any>
13
+ (exit: Exit<any, any>) => IO<never, never, any>
14
14
  > {}
15
15
 
16
16
  /**
@@ -23,7 +23,7 @@ export function addIfOpen_(releaseMap: ReleaseMap, finalizer: Finalizer): UIO<Ma
23
23
  /**
24
24
  * @tsplus fluent fncts.io.Scope.ReleaseMap release
25
25
  */
26
- export function release_(releaseMap: ReleaseMap, key: number, exit: Exit<any, any>): IO<unknown, never, any> {
26
+ export function release_(releaseMap: ReleaseMap, key: number, exit: Exit<any, any>): IO<never, never, any> {
27
27
  return ReleaseMap.reverseGet(releaseMap).modify((s) => {
28
28
  switch (s._tag) {
29
29
  case "Exited": {
@@ -15,7 +15,7 @@ export class Running {
15
15
  export type State = Exited | Running;
16
16
 
17
17
  interface ReleaseMapN extends HKT {
18
- readonly [HKT.T]: ReleaseMap;
18
+ readonly type: ReleaseMap;
19
19
  }
20
20
 
21
21
  /**