@fncts/io 0.0.22 → 0.0.24

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 (486) hide show
  1. package/Cached/definition.d.ts +6 -4
  2. package/Cached/internal.d.ts +4 -4
  3. package/Channel/api.d.ts +4 -4
  4. package/Channel/definition.d.ts +35 -14
  5. package/Channel/internal/ChannelExecutor.d.ts +1 -0
  6. package/Channel/internal/MergeDecision.d.ts +10 -6
  7. package/CountdownLatch.d.ts +1 -1
  8. package/Differ/definition.d.ts +2 -4
  9. package/Fiber/FiberRuntime.d.ts +9 -11
  10. package/Fiber/definition.d.ts +12 -6
  11. package/FiberRef/definition.d.ts +6 -2
  12. package/FiberRefs/api.d.ts +1 -1
  13. package/FiberRefs/definition.d.ts +1 -1
  14. package/Hub/definition.d.ts +29 -15
  15. package/IO/api/descriptor.d.ts +12 -0
  16. package/IO/api/interrupt.d.ts +19 -19
  17. package/IO/api/onTermination.d.ts +0 -1
  18. package/IO/api/sequenceT.d.ts +19 -3
  19. package/IO/api.d.ts +5 -0
  20. package/IO/definition.d.ts +40 -26
  21. package/IO.d.ts +1 -1
  22. package/Layer/definition.d.ts +17 -13
  23. package/Logger/definition.d.ts +10 -6
  24. package/MVar/api.d.ts +101 -0
  25. package/MVar/definition.d.ts +43 -0
  26. package/MVar.d.ts +2 -0
  27. package/Push/api.d.ts +7 -4
  28. package/Push/definition.d.ts +10 -3
  29. package/Push/internal.d.ts +1 -1
  30. package/Queue/api/dimapIO.d.ts +17 -13
  31. package/Queue/definition.d.ts +26 -18
  32. package/Ref/Derived.d.ts +3 -1
  33. package/Ref/Synchronized/constructors.d.ts +6 -1
  34. package/Ref/Synchronized/definition.d.ts +4 -2
  35. package/Ref/definition.d.ts +36 -25
  36. package/Ref.d.ts +0 -1
  37. package/RefSubject/definition.d.ts +17 -11
  38. package/Reloadable/definition.d.ts +5 -1
  39. package/STM/api/atomically.d.ts +9 -0
  40. package/STM/api.d.ts +12 -6
  41. package/STM/definition.d.ts +28 -15
  42. package/STM/internal/Entry.d.ts +2 -2
  43. package/STM/internal/TryCommit.d.ts +2 -2
  44. package/STM/internal/Versioned.d.ts +1 -1
  45. package/STM.d.ts +1 -0
  46. package/Schedule/definition.d.ts +7 -3
  47. package/Scope/definition.d.ts +1 -1
  48. package/ScopedRef/definition.d.ts +1 -1
  49. package/State/api.d.ts +1 -1
  50. package/State/definition.d.ts +5 -2
  51. package/State/internal.d.ts +6 -2
  52. package/Stream/definition.d.ts +26 -5
  53. package/Stream/internal/Handoff.d.ts +21 -15
  54. package/Stream/internal/SinkEndReason.d.ts +2 -2
  55. package/Subject/Atomic.d.ts +8 -4
  56. package/SupervisorPatch.d.ts +1 -1
  57. package/TExit/definition.d.ts +5 -5
  58. package/TRef/definition.d.ts +16 -14
  59. package/TRef.d.ts +0 -1
  60. package/_cjs/Cached/definition.cjs +4 -2
  61. package/_cjs/Cached/definition.cjs.map +1 -1
  62. package/_cjs/Cached/internal.cjs +7 -6
  63. package/_cjs/Cached/internal.cjs.map +1 -1
  64. package/_cjs/Channel/api/mapOutConcurrentIO.cjs +1 -1
  65. package/_cjs/Channel/api/mergeAllWith.cjs +1 -1
  66. package/_cjs/Channel/api.cjs +20 -20
  67. package/_cjs/Channel/api.cjs.map +1 -1
  68. package/_cjs/Channel/definition.cjs +13 -3
  69. package/_cjs/Channel/definition.cjs.map +1 -1
  70. package/_cjs/Channel/internal/ChannelExecutor.cjs +11 -6
  71. package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
  72. package/_cjs/Channel/internal/MergeDecision.cjs +7 -3
  73. package/_cjs/Channel/internal/MergeDecision.cjs.map +1 -1
  74. package/_cjs/CountdownLatch.cjs +4 -2
  75. package/_cjs/CountdownLatch.cjs.map +1 -1
  76. package/_cjs/Differ/definition.cjs +3 -1
  77. package/_cjs/Differ/definition.cjs.map +1 -1
  78. package/_cjs/Fiber/FiberRuntime.cjs +96 -89
  79. package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
  80. package/_cjs/Fiber/definition.cjs +8 -4
  81. package/_cjs/Fiber/definition.cjs.map +1 -1
  82. package/_cjs/FiberRef/definition.cjs +8 -4
  83. package/_cjs/FiberRef/definition.cjs.map +1 -1
  84. package/_cjs/Future/api.cjs +17 -6
  85. package/_cjs/Future/api.cjs.map +1 -1
  86. package/_cjs/Hub/api.cjs +5 -5
  87. package/_cjs/Hub/api.cjs.map +1 -1
  88. package/_cjs/Hub/definition.cjs +9 -7
  89. package/_cjs/Hub/definition.cjs.map +1 -1
  90. package/_cjs/Hub/internal.cjs +6 -6
  91. package/_cjs/Hub/internal.cjs.map +1 -1
  92. package/_cjs/IO/api/asyncIO.cjs +1 -1
  93. package/_cjs/IO/api/asyncIO.cjs.map +1 -1
  94. package/_cjs/IO/api/asyncInterrupt.cjs +2 -2
  95. package/_cjs/IO/api/asyncInterrupt.cjs.map +1 -1
  96. package/_cjs/IO/api/bracketExit.cjs +1 -1
  97. package/_cjs/IO/api/bracketExit.cjs.map +1 -1
  98. package/_cjs/IO/api/{onExit.cjs → descriptor.cjs} +20 -9
  99. package/_cjs/IO/api/descriptor.cjs.map +1 -0
  100. package/_cjs/IO/api/foreachConcurrent.cjs +2 -2
  101. package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
  102. package/_cjs/IO/api/forkIn.cjs +1 -1
  103. package/_cjs/IO/api/forkIn.cjs.map +1 -1
  104. package/_cjs/IO/api/forkScoped.cjs +1 -1
  105. package/_cjs/IO/api/forkScoped.cjs.map +1 -1
  106. package/_cjs/IO/api/fulfill.cjs +1 -1
  107. package/_cjs/IO/api/fulfill.cjs.map +1 -1
  108. package/_cjs/IO/api/interrupt.cjs +52 -43
  109. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  110. package/_cjs/IO/api/onTermination.cjs +7 -6
  111. package/_cjs/IO/api/onTermination.cjs.map +1 -1
  112. package/_cjs/IO/api/race.cjs +1 -1
  113. package/_cjs/IO/api/race.cjs.map +1 -1
  114. package/_cjs/IO/api/sequenceT.cjs +1 -1
  115. package/_cjs/IO/api/sequenceT.cjs.map +1 -1
  116. package/_cjs/IO/api/zipConcurrent.cjs +1 -1
  117. package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
  118. package/_cjs/IO/api.cjs +13 -5
  119. package/_cjs/IO/api.cjs.map +1 -1
  120. package/_cjs/IO/definition.cjs +26 -21
  121. package/_cjs/IO/definition.cjs.map +1 -1
  122. package/_cjs/IO.cjs +11 -11
  123. package/_cjs/Layer/MemoMap.cjs +30 -31
  124. package/_cjs/Layer/MemoMap.cjs.map +1 -1
  125. package/_cjs/Layer/api.cjs +1 -1
  126. package/_cjs/Layer/api.cjs.map +1 -1
  127. package/_cjs/Layer/definition.cjs +12 -10
  128. package/_cjs/Layer/definition.cjs.map +1 -1
  129. package/_cjs/Logger/definition.cjs +3 -1
  130. package/_cjs/Logger/definition.cjs.map +1 -1
  131. package/_cjs/MVar/api.cjs +170 -0
  132. package/_cjs/MVar/api.cjs.map +1 -0
  133. package/_cjs/MVar/definition.cjs +28 -0
  134. package/_cjs/MVar/definition.cjs.map +1 -0
  135. package/_cjs/MVar.cjs +28 -0
  136. package/_cjs/MVar.cjs.map +1 -0
  137. package/_cjs/Push/api.cjs +39 -36
  138. package/_cjs/Push/api.cjs.map +1 -1
  139. package/_cjs/Push/definition.cjs +9 -2
  140. package/_cjs/Push/definition.cjs.map +1 -1
  141. package/_cjs/Push/internal.cjs +4 -2
  142. package/_cjs/Push/internal.cjs.map +1 -1
  143. package/_cjs/Queue/api/dimapIO.cjs +10 -10
  144. package/_cjs/Queue/api/dimapIO.cjs.map +1 -1
  145. package/_cjs/Queue/api/filterInputIO.cjs +4 -4
  146. package/_cjs/Queue/api/filterInputIO.cjs.map +1 -1
  147. package/_cjs/Queue/api/filterOutputIO.cjs +7 -7
  148. package/_cjs/Queue/api/filterOutputIO.cjs.map +1 -1
  149. package/_cjs/Queue/definition.cjs +3 -1
  150. package/_cjs/Queue/definition.cjs.map +1 -1
  151. package/_cjs/Queue/internal.cjs +2 -2
  152. package/_cjs/Queue/internal.cjs.map +1 -1
  153. package/_cjs/Queue/strategy.cjs +2 -2
  154. package/_cjs/Queue/strategy.cjs.map +1 -1
  155. package/_cjs/Ref/Derived.cjs +8 -4
  156. package/_cjs/Ref/Derived.cjs.map +1 -1
  157. package/_cjs/Ref/Synchronized/constructors.cjs +16 -7
  158. package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
  159. package/_cjs/Ref/Synchronized/definition.cjs +16 -12
  160. package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
  161. package/_cjs/Ref/definition.cjs +3 -2
  162. package/_cjs/Ref/definition.cjs.map +1 -1
  163. package/_cjs/Ref.cjs +0 -11
  164. package/_cjs/Ref.cjs.map +1 -1
  165. package/_cjs/RefSubject/Synchronized/api.cjs +1 -1
  166. package/_cjs/RefSubject/definition.cjs +9 -5
  167. package/_cjs/RefSubject/definition.cjs.map +1 -1
  168. package/_cjs/Reloadable/definition.cjs +4 -2
  169. package/_cjs/Reloadable/definition.cjs.map +1 -1
  170. package/_cjs/STM/api/atomically.cjs +55 -0
  171. package/_cjs/STM/api/atomically.cjs.map +1 -0
  172. package/_cjs/STM/api.cjs +65 -91
  173. package/_cjs/STM/api.cjs.map +1 -1
  174. package/_cjs/STM/definition.cjs +32 -19
  175. package/_cjs/STM/definition.cjs.map +1 -1
  176. package/_cjs/STM/driver.cjs +3 -3
  177. package/_cjs/STM/driver.cjs.map +1 -1
  178. package/_cjs/STM/internal/Entry.cjs +6 -3
  179. package/_cjs/STM/internal/Entry.cjs.map +1 -1
  180. package/_cjs/STM/internal/TryCommit.cjs +5 -2
  181. package/_cjs/STM/internal/TryCommit.cjs.map +1 -1
  182. package/_cjs/STM/internal/Versioned.cjs +3 -1
  183. package/_cjs/STM/internal/Versioned.cjs.map +1 -1
  184. package/_cjs/STM.cjs +11 -0
  185. package/_cjs/STM.cjs.map +1 -1
  186. package/_cjs/Schedule/definition.cjs +3 -1
  187. package/_cjs/Schedule/definition.cjs.map +1 -1
  188. package/_cjs/Scope/api.cjs +1 -2
  189. package/_cjs/Scope/api.cjs.map +1 -1
  190. package/_cjs/Scope/definition.cjs +5 -3
  191. package/_cjs/Scope/definition.cjs.map +1 -1
  192. package/_cjs/ScopedRef/api.cjs +2 -2
  193. package/_cjs/ScopedRef/api.cjs.map +1 -1
  194. package/_cjs/ScopedRef/definition.cjs +3 -1
  195. package/_cjs/ScopedRef/definition.cjs.map +1 -1
  196. package/_cjs/State/api.cjs +2 -2
  197. package/_cjs/State/api.cjs.map +1 -1
  198. package/_cjs/State/definition.cjs +4 -2
  199. package/_cjs/State/definition.cjs.map +1 -1
  200. package/_cjs/State/internal.cjs +7 -3
  201. package/_cjs/State/internal.cjs.map +1 -1
  202. package/_cjs/Stream/api.cjs +1 -1
  203. package/_cjs/Stream/definition.cjs +4 -2
  204. package/_cjs/Stream/definition.cjs.map +1 -1
  205. package/_cjs/Stream/internal/Handoff.cjs +37 -37
  206. package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
  207. package/_cjs/Stream/internal/SinkEndReason.cjs +6 -3
  208. package/_cjs/Stream/internal/SinkEndReason.cjs.map +1 -1
  209. package/_cjs/Subject/Atomic.cjs +6 -4
  210. package/_cjs/Subject/Atomic.cjs.map +1 -1
  211. package/_cjs/SubscriptionRef.cjs +1 -1
  212. package/_cjs/SupervisorPatch.cjs +3 -1
  213. package/_cjs/SupervisorPatch.cjs.map +1 -1
  214. package/_cjs/TExit/definition.cjs +25 -24
  215. package/_cjs/TExit/definition.cjs.map +1 -1
  216. package/_cjs/TFuture/constructors.cjs +1 -1
  217. package/_cjs/TReentrantLock/api.cjs +10 -9
  218. package/_cjs/TReentrantLock/api.cjs.map +1 -1
  219. package/_cjs/TRef/constructors.cjs +1 -1
  220. package/_cjs/TRef/definition.cjs +21 -21
  221. package/_cjs/TRef/definition.cjs.map +1 -1
  222. package/_cjs/TRef.cjs +0 -11
  223. package/_cjs/TRef.cjs.map +1 -1
  224. package/_cjs/TSemaphore/api.cjs +2 -2
  225. package/_cjs/TSemaphore/api.cjs.map +1 -1
  226. package/_cjs/TSemaphore/constructors.cjs +1 -1
  227. package/_cjs/internal/IsFatal.cjs +3 -1
  228. package/_cjs/internal/IsFatal.cjs.map +1 -1
  229. package/_mjs/Cached/definition.mjs +4 -2
  230. package/_mjs/Cached/definition.mjs.map +1 -1
  231. package/_mjs/Cached/internal.mjs +3 -5
  232. package/_mjs/Cached/internal.mjs.map +1 -1
  233. package/_mjs/Channel/api/mapOutConcurrentIO.mjs +1 -1
  234. package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
  235. package/_mjs/Channel/api.mjs +15 -14
  236. package/_mjs/Channel/api.mjs.map +1 -1
  237. package/_mjs/Channel/definition.mjs +9 -1
  238. package/_mjs/Channel/definition.mjs.map +1 -1
  239. package/_mjs/Channel/internal/ChannelExecutor.mjs +11 -6
  240. package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
  241. package/_mjs/Channel/internal/MergeDecision.mjs +4 -1
  242. package/_mjs/Channel/internal/MergeDecision.mjs.map +1 -1
  243. package/_mjs/CountdownLatch.mjs +3 -1
  244. package/_mjs/CountdownLatch.mjs.map +1 -1
  245. package/_mjs/Differ/definition.mjs +3 -1
  246. package/_mjs/Differ/definition.mjs.map +1 -1
  247. package/_mjs/Fiber/FiberRuntime.mjs +97 -90
  248. package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
  249. package/_mjs/Fiber/definition.mjs +5 -2
  250. package/_mjs/Fiber/definition.mjs.map +1 -1
  251. package/_mjs/FiberRef/definition.mjs +6 -3
  252. package/_mjs/FiberRef/definition.mjs.map +1 -1
  253. package/_mjs/Future/api.mjs +17 -6
  254. package/_mjs/Future/api.mjs.map +1 -1
  255. package/_mjs/Hub/api.mjs +6 -6
  256. package/_mjs/Hub/api.mjs.map +1 -1
  257. package/_mjs/Hub/definition.mjs +5 -4
  258. package/_mjs/Hub/definition.mjs.map +1 -1
  259. package/_mjs/Hub/internal.mjs +6 -6
  260. package/_mjs/Hub/internal.mjs.map +1 -1
  261. package/_mjs/IO/api/asyncIO.mjs +1 -1
  262. package/_mjs/IO/api/asyncIO.mjs.map +1 -1
  263. package/_mjs/IO/api/asyncInterrupt.mjs +2 -2
  264. package/_mjs/IO/api/asyncInterrupt.mjs.map +1 -1
  265. package/_mjs/IO/api/bracketExit.mjs +1 -1
  266. package/_mjs/IO/api/bracketExit.mjs.map +1 -1
  267. package/_mjs/IO/api/descriptor.mjs +20 -0
  268. package/_mjs/IO/api/descriptor.mjs.map +1 -0
  269. package/_mjs/IO/api/foreachConcurrent.mjs +2 -2
  270. package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
  271. package/_mjs/IO/api/forkIn.mjs +1 -1
  272. package/_mjs/IO/api/forkIn.mjs.map +1 -1
  273. package/_mjs/IO/api/forkScoped.mjs +1 -1
  274. package/_mjs/IO/api/forkScoped.mjs.map +1 -1
  275. package/_mjs/IO/api/fulfill.mjs +1 -1
  276. package/_mjs/IO/api/fulfill.mjs.map +1 -1
  277. package/_mjs/IO/api/interrupt.mjs +46 -38
  278. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  279. package/_mjs/IO/api/onTermination.mjs +7 -6
  280. package/_mjs/IO/api/onTermination.mjs.map +1 -1
  281. package/_mjs/IO/api/race.mjs +1 -1
  282. package/_mjs/IO/api/race.mjs.map +1 -1
  283. package/_mjs/IO/api/sequenceT.mjs +1 -1
  284. package/_mjs/IO/api/sequenceT.mjs.map +1 -1
  285. package/_mjs/IO/api/zipConcurrent.mjs +1 -1
  286. package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
  287. package/_mjs/IO/api.mjs +10 -3
  288. package/_mjs/IO/api.mjs.map +1 -1
  289. package/_mjs/IO/definition.mjs +23 -19
  290. package/_mjs/IO/definition.mjs.map +1 -1
  291. package/_mjs/IO.mjs +1 -1
  292. package/_mjs/IO.mjs.map +1 -1
  293. package/_mjs/Layer/MemoMap.mjs +28 -29
  294. package/_mjs/Layer/MemoMap.mjs.map +1 -1
  295. package/_mjs/Layer/api.mjs +2 -2
  296. package/_mjs/Layer/api.mjs.map +1 -1
  297. package/_mjs/Layer/definition.mjs +9 -8
  298. package/_mjs/Layer/definition.mjs.map +1 -1
  299. package/_mjs/Logger/definition.mjs +1 -0
  300. package/_mjs/Logger/definition.mjs.map +1 -1
  301. package/_mjs/MVar/api.mjs +150 -0
  302. package/_mjs/MVar/api.mjs.map +1 -0
  303. package/_mjs/MVar/definition.mjs +18 -0
  304. package/_mjs/MVar/definition.mjs.map +1 -0
  305. package/_mjs/MVar.mjs +4 -0
  306. package/_mjs/MVar.mjs.map +1 -0
  307. package/_mjs/Push/api.mjs +39 -36
  308. package/_mjs/Push/api.mjs.map +1 -1
  309. package/_mjs/Push/definition.mjs +5 -0
  310. package/_mjs/Push/definition.mjs.map +1 -1
  311. package/_mjs/Push/internal.mjs +4 -2
  312. package/_mjs/Push/internal.mjs.map +1 -1
  313. package/_mjs/Queue/api/dimapIO.mjs +11 -11
  314. package/_mjs/Queue/api/dimapIO.mjs.map +1 -1
  315. package/_mjs/Queue/api/filterInputIO.mjs +5 -5
  316. package/_mjs/Queue/api/filterInputIO.mjs.map +1 -1
  317. package/_mjs/Queue/api/filterOutputIO.mjs +8 -8
  318. package/_mjs/Queue/api/filterOutputIO.mjs.map +1 -1
  319. package/_mjs/Queue/definition.mjs +1 -0
  320. package/_mjs/Queue/definition.mjs.map +1 -1
  321. package/_mjs/Queue/internal.mjs +2 -2
  322. package/_mjs/Queue/internal.mjs.map +1 -1
  323. package/_mjs/Queue/strategy.mjs +2 -2
  324. package/_mjs/Queue/strategy.mjs.map +1 -1
  325. package/_mjs/Ref/Derived.mjs +6 -3
  326. package/_mjs/Ref/Derived.mjs.map +1 -1
  327. package/_mjs/Ref/Synchronized/constructors.mjs +15 -7
  328. package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
  329. package/_mjs/Ref/Synchronized/definition.mjs +13 -10
  330. package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
  331. package/_mjs/Ref/definition.mjs +1 -1
  332. package/_mjs/Ref/definition.mjs.map +1 -1
  333. package/_mjs/Ref.mjs +0 -1
  334. package/_mjs/Ref.mjs.map +1 -1
  335. package/_mjs/RefSubject/Synchronized/api.mjs +1 -1
  336. package/_mjs/RefSubject/definition.mjs +10 -3
  337. package/_mjs/RefSubject/definition.mjs.map +1 -1
  338. package/_mjs/Reloadable/definition.mjs +2 -1
  339. package/_mjs/Reloadable/definition.mjs.map +1 -1
  340. package/_mjs/STM/api/atomically.mjs +47 -0
  341. package/_mjs/STM/api/atomically.mjs.map +1 -0
  342. package/_mjs/STM/api.mjs +61 -88
  343. package/_mjs/STM/api.mjs.map +1 -1
  344. package/_mjs/STM/definition.mjs +27 -17
  345. package/_mjs/STM/definition.mjs.map +1 -1
  346. package/_mjs/STM/driver.mjs +3 -3
  347. package/_mjs/STM/driver.mjs.map +1 -1
  348. package/_mjs/STM/internal/Entry.mjs +5 -2
  349. package/_mjs/STM/internal/Entry.mjs.map +1 -1
  350. package/_mjs/STM/internal/TryCommit.mjs +6 -2
  351. package/_mjs/STM/internal/TryCommit.mjs.map +1 -1
  352. package/_mjs/STM/internal/Versioned.mjs +3 -1
  353. package/_mjs/STM/internal/Versioned.mjs.map +1 -1
  354. package/_mjs/STM.mjs +1 -0
  355. package/_mjs/STM.mjs.map +1 -1
  356. package/_mjs/Schedule/definition.mjs +1 -0
  357. package/_mjs/Schedule/definition.mjs.map +1 -1
  358. package/_mjs/Scope/api.mjs +1 -2
  359. package/_mjs/Scope/api.mjs.map +1 -1
  360. package/_mjs/Scope/definition.mjs +4 -2
  361. package/_mjs/Scope/definition.mjs.map +1 -1
  362. package/_mjs/ScopedRef/api.mjs +2 -2
  363. package/_mjs/ScopedRef/api.mjs.map +1 -1
  364. package/_mjs/ScopedRef/definition.mjs +3 -1
  365. package/_mjs/ScopedRef/definition.mjs.map +1 -1
  366. package/_mjs/State/api.mjs +1 -1
  367. package/_mjs/State/api.mjs.map +1 -1
  368. package/_mjs/State/definition.mjs +4 -1
  369. package/_mjs/State/definition.mjs.map +1 -1
  370. package/_mjs/State/internal.mjs +5 -2
  371. package/_mjs/State/internal.mjs.map +1 -1
  372. package/_mjs/Stream/api.mjs +1 -1
  373. package/_mjs/Stream/definition.mjs +2 -1
  374. package/_mjs/Stream/definition.mjs.map +1 -1
  375. package/_mjs/Stream/internal/Handoff.mjs +40 -32
  376. package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
  377. package/_mjs/Stream/internal/SinkEndReason.mjs +6 -2
  378. package/_mjs/Stream/internal/SinkEndReason.mjs.map +1 -1
  379. package/_mjs/Subject/Atomic.mjs +4 -2
  380. package/_mjs/Subject/Atomic.mjs.map +1 -1
  381. package/_mjs/SubscriptionRef.mjs +1 -1
  382. package/_mjs/SupervisorPatch.mjs +3 -1
  383. package/_mjs/SupervisorPatch.mjs.map +1 -1
  384. package/_mjs/TExit/definition.mjs +25 -24
  385. package/_mjs/TExit/definition.mjs.map +1 -1
  386. package/_mjs/TFuture/constructors.mjs +1 -1
  387. package/_mjs/TReentrantLock/api.mjs +10 -9
  388. package/_mjs/TReentrantLock/api.mjs.map +1 -1
  389. package/_mjs/TRef/constructors.mjs +1 -1
  390. package/_mjs/TRef/definition.mjs +19 -20
  391. package/_mjs/TRef/definition.mjs.map +1 -1
  392. package/_mjs/TRef.mjs +0 -1
  393. package/_mjs/TRef.mjs.map +1 -1
  394. package/_mjs/TSemaphore/api.mjs +2 -2
  395. package/_mjs/TSemaphore/api.mjs.map +1 -1
  396. package/_mjs/TSemaphore/constructors.mjs +1 -1
  397. package/_mjs/internal/IsFatal.mjs +3 -1
  398. package/_mjs/internal/IsFatal.mjs.map +1 -1
  399. package/_src/Cached/definition.ts +6 -4
  400. package/_src/Cached/internal.ts +4 -4
  401. package/_src/Channel/api.ts +14 -15
  402. package/_src/Channel/definition.ts +37 -14
  403. package/_src/Channel/internal/ChannelExecutor.ts +14 -3
  404. package/_src/Channel/internal/MergeDecision.ts +11 -6
  405. package/_src/CountdownLatch.ts +1 -1
  406. package/_src/Differ/definition.ts +2 -4
  407. package/_src/Fiber/FiberRuntime.ts +54 -50
  408. package/_src/Fiber/definition.ts +15 -8
  409. package/_src/FiberRef/definition.ts +9 -4
  410. package/_src/FiberRefs/api.ts +1 -1
  411. package/_src/FiberRefs/definition.ts +1 -1
  412. package/_src/Future/api.ts +14 -5
  413. package/_src/Hub/api.ts +9 -7
  414. package/_src/Hub/definition.ts +30 -15
  415. package/_src/IO/api/descriptor.ts +14 -0
  416. package/_src/IO/api/interrupt.ts +72 -55
  417. package/_src/IO/api/onTermination.ts +8 -7
  418. package/_src/IO/api/sequenceT.ts +4 -6
  419. package/_src/IO/api.ts +8 -1
  420. package/_src/IO/definition.ts +36 -27
  421. package/_src/IO.ts +1 -1
  422. package/_src/Layer/MemoMap.ts +1 -1
  423. package/_src/Layer/api.ts +2 -2
  424. package/_src/Layer/definition.ts +18 -13
  425. package/_src/Logger/definition.ts +9 -4
  426. package/_src/MVar/api.ts +185 -0
  427. package/_src/MVar/definition.ts +45 -0
  428. package/_src/MVar.ts +4 -0
  429. package/_src/Push/api.ts +7 -4
  430. package/_src/Push/definition.ts +12 -3
  431. package/_src/Push/internal.ts +2 -2
  432. package/_src/Queue/api/dimapIO.ts +24 -13
  433. package/_src/Queue/api/filterInputIO.ts +9 -7
  434. package/_src/Queue/api/filterOutputIO.ts +9 -7
  435. package/_src/Queue/definition.ts +27 -18
  436. package/_src/Ref/Derived.ts +4 -1
  437. package/_src/Ref/Synchronized/constructors.ts +9 -0
  438. package/_src/Ref/Synchronized/definition.ts +5 -2
  439. package/_src/Ref/definition.ts +36 -25
  440. package/_src/Ref.ts +0 -1
  441. package/_src/RefSubject/definition.ts +19 -12
  442. package/_src/Reloadable/definition.ts +6 -1
  443. package/_src/STM/api/atomically.ts +43 -0
  444. package/_src/STM/api.ts +20 -38
  445. package/_src/STM/definition.ts +33 -20
  446. package/_src/STM/driver.ts +3 -3
  447. package/_src/STM/internal/Entry.ts +2 -2
  448. package/_src/STM/internal/TryCommit.ts +4 -4
  449. package/_src/STM/internal/Versioned.ts +1 -1
  450. package/_src/STM.ts +1 -0
  451. package/_src/Schedule/definition.ts +8 -3
  452. package/_src/Scope/definition.ts +2 -2
  453. package/_src/ScopedRef/definition.ts +1 -1
  454. package/_src/State/api.ts +1 -1
  455. package/_src/State/definition.ts +6 -3
  456. package/_src/State/internal.ts +8 -3
  457. package/_src/Stream/definition.ts +17 -5
  458. package/_src/Stream/internal/Handoff.ts +31 -24
  459. package/_src/Stream/internal/SinkEndReason.ts +2 -2
  460. package/_src/Subject/Atomic.ts +8 -4
  461. package/_src/SupervisorPatch.ts +1 -1
  462. package/_src/TExit/definition.ts +11 -12
  463. package/_src/TRef/definition.ts +18 -14
  464. package/_src/TRef.ts +0 -1
  465. package/_src/global.ts +4 -0
  466. package/_src/internal/IsFatal.ts +1 -1
  467. package/global.d.ts +4 -0
  468. package/internal/IsFatal.d.ts +1 -1
  469. package/package.json +2 -2
  470. package/IO/api/onExit.d.ts +0 -7
  471. package/Ref/symbols.d.ts +0 -30
  472. package/TRef/symbols.d.ts +0 -20
  473. package/_cjs/IO/api/onExit.cjs.map +0 -1
  474. package/_cjs/Ref/symbols.cjs +0 -37
  475. package/_cjs/Ref/symbols.cjs.map +0 -1
  476. package/_cjs/TRef/symbols.cjs +0 -27
  477. package/_cjs/TRef/symbols.cjs.map +0 -1
  478. package/_mjs/IO/api/onExit.mjs +0 -11
  479. package/_mjs/IO/api/onExit.mjs.map +0 -1
  480. package/_mjs/Ref/symbols.mjs +0 -25
  481. package/_mjs/Ref/symbols.mjs.map +0 -1
  482. package/_mjs/TRef/symbols.mjs +0 -17
  483. package/_mjs/TRef/symbols.mjs.map +0 -1
  484. package/_src/IO/api/onExit.ts +0 -11
  485. package/_src/Ref/symbols.ts +0 -29
  486. package/_src/TRef/symbols.ts +0 -19
@@ -1,3 +1,6 @@
1
+ export const LayerVariance = Symbol.for("fncts.io.Layer.Variance");
2
+ export type LayerVariance = typeof LayerVariance;
3
+
1
4
  export const LayerHash = Symbol.for("fncts.io.Layer.Hash");
2
5
  export type LayerHash = typeof LayerHash;
3
6
 
@@ -6,9 +9,11 @@ export type LayerHash = typeof LayerHash;
6
9
  * @tsplus companion fncts.io.LayerOps
7
10
  */
8
11
  export abstract class Layer<RIn, E, ROut> {
9
- readonly _R!: () => RIn;
10
- readonly _E!: () => E;
11
- readonly _A!: () => ROut;
12
+ declare [LayerVariance]: {
13
+ readonly _RIn: (_: never) => RIn;
14
+ readonly _E: (_: never) => E;
15
+ readonly _ROut: (_: never) => ROut;
16
+ };
12
17
 
13
18
  [LayerHash]: PropertyKey = Symbol();
14
19
 
@@ -25,7 +30,7 @@ export type Concrete =
25
30
  | Defer<any, any, any>
26
31
  | To<any, any, any, any, any>
27
32
  | ZipWith<any, any, any, any, any, any, any>
28
- | ZipWithC<any, any, any, any, any, any, any>;
33
+ | ZipWithConcurrent<any, any, any, any, any, any, any>;
29
34
 
30
35
  /**
31
36
  * @tsplus fluent fncts.io.Layer concrete
@@ -35,13 +40,13 @@ export function concrete(self: Layer<any, any, any>): asserts self is Concrete {
35
40
  }
36
41
 
37
42
  export const enum LayerTag {
38
- Fold = "Fold",
39
- Fresh = "Fresh",
40
- Scoped = "Scoped",
41
- Defer = "Defer",
42
- To = "To",
43
- ZipWith = "ZipWith",
44
- ZipWithC = "ZipWithC",
43
+ Fold,
44
+ Fresh,
45
+ Scoped,
46
+ Defer,
47
+ To,
48
+ ZipWith,
49
+ ZipWithConcurrent,
45
50
  }
46
51
 
47
52
  export class Fold<RIn, E, ROut, RIn1, E1, ROut1, RIn2, E2, ROut2> extends Layer<
@@ -100,8 +105,8 @@ export class ZipWith<RIn, E, ROut, RIn1, E1, ROut1, ROut2> extends Layer<RIn | R
100
105
  }
101
106
  }
102
107
 
103
- export class ZipWithC<RIn, E, ROut, RIn1, E1, ROut1, ROut2> extends Layer<RIn | RIn1, E | E1, ROut2> {
104
- readonly _tag = LayerTag.ZipWithC;
108
+ export class ZipWithConcurrent<RIn, E, ROut, RIn1, E1, ROut1, ROut2> extends Layer<RIn | RIn1, E | E1, ROut2> {
109
+ readonly _tag = LayerTag.ZipWithConcurrent;
105
110
  constructor(
106
111
  readonly self: Layer<RIn, E, ROut>,
107
112
  readonly that: Layer<RIn1, E1, ROut1>,
@@ -1,12 +1,17 @@
1
1
  import type { LogSpan } from "@fncts/io/LogSpan";
2
2
 
3
+ export const LoggerVariance = Symbol.for("fncts.io.Logger");
4
+ export type LoggerVariance = typeof LoggerVariance;
5
+
3
6
  /**
4
7
  * @tsplus type fncts.io.Logger
5
8
  * @tsplus companion fncts.io.LoggerOps
6
9
  */
7
- export class Logger<Message, Output> {
8
- readonly _Message!: (_: Message) => void;
9
- readonly _Output!: () => Output;
10
+ export class Logger<in Message, out Output> {
11
+ declare LoggerVariance: {
12
+ readonly _Message: (_: Message) => void;
13
+ readonly _Output: (_: never) => Output;
14
+ };
10
15
  constructor(
11
16
  readonly log: (
12
17
  trace: TraceElement,
@@ -14,7 +19,7 @@ export class Logger<Message, Output> {
14
19
  logLevel: LogLevel,
15
20
  message: () => Message,
16
21
  cause: Cause<any>,
17
- context: HashMap<FiberRef<unknown>, unknown>,
22
+ context: HashMap<FiberRef<any>, Cons<readonly [FiberId.Runtime, unknown]>>,
18
23
  spans: List<LogSpan>,
19
24
  annotations: HashMap<string, string>,
20
25
  ) => Output,
@@ -0,0 +1,185 @@
1
+ import type { MVar } from "./definition";
2
+
3
+ import { concrete } from "./definition.js";
4
+ import { MVarInternal } from "./definition.js";
5
+
6
+ /**
7
+ * @tsplus static fncts.io.MVarOps empty
8
+ */
9
+ export function empty<A>(): UIO<MVar<A>> {
10
+ return TRef.make<Maybe<A>>(Nothing()).map((content) => new MVarInternal(content)).commit;
11
+ }
12
+
13
+ /**
14
+ * @tsplus static fncts.io.MVarOps make
15
+ * @tsplus static fncts.io.MVarOps __call
16
+ */
17
+ export function make<A>(value: A): UIO<MVar<A>> {
18
+ return TRef.make(Just(value)).map((content) => new MVarInternal(content)).commit;
19
+ }
20
+
21
+ /**
22
+ * Check whether the `MVar` is empty.
23
+ *
24
+ * Notice that the boolean value returned is just a snapshot of the state of
25
+ * the `MVar`. By the time you get to react on its result, the `MVar` may have
26
+ * been filled (or emptied) - so be extremely careful when using this
27
+ * operation. Use `tryTake` instead if possible.
28
+ *
29
+ * @tsplus getter fncts.io.MVar isEmpty
30
+ */
31
+ export function isEmpty<A>(self: MVar<A>): UIO<boolean> {
32
+ concrete(self);
33
+ return self.content.get.map((value) => value.isNothing()).commit;
34
+ }
35
+
36
+ /**
37
+ * A slight variation on `update` that allows a value to be returned (`b`) in
38
+ * addition to the modified value of the `MVar`.
39
+ *
40
+ * @tsplus fluent fncts.io.MVar modify
41
+ */
42
+ export function modify<A, B>(self: MVar<A>, f: (a: A) => readonly [B, A]): UIO<B> {
43
+ concrete(self);
44
+ return self.content.get
45
+ .filterMap((value) =>
46
+ value.map((a) => {
47
+ const [b, newA] = f(a);
48
+ return [b, Just(newA)] as const;
49
+ }),
50
+ )
51
+ .flatMap(([b, newA]) => self.content.set(newA).as(b)).commit;
52
+ }
53
+
54
+ /**
55
+ * Put a value into an `MVar`. If the `MVar` is currently full, `put` will
56
+ * wait until it becomes empty.
57
+ *
58
+ * @tsplus fluent fncts.io.MVar put
59
+ */
60
+ export function put<A>(self: MVar<A>, value: A): UIO<void> {
61
+ concrete(self);
62
+ return (
63
+ self.content.get.filterMap((value) =>
64
+ value.match(
65
+ () => Just(undefined),
66
+ () => Nothing(),
67
+ ),
68
+ ) > self.content.set(Just(value))
69
+ ).commit;
70
+ }
71
+
72
+ /**
73
+ * Atomically read the contents of an `MVar`. If the `MVar` is currently
74
+ * empty, `read` will wait until it is full. `read` is guaranteed to receive
75
+ * the next `put`.
76
+ *
77
+ * @tsplus getter fncts.io.MVar read
78
+ */
79
+ export function read<A>(self: MVar<A>): UIO<A> {
80
+ concrete(self);
81
+ return self.content.get.filterMap(Function.identity).commit;
82
+ }
83
+
84
+ /**
85
+ * Take a value from an `MVar`, put a new value into the `MVar` and return the
86
+ * value taken.
87
+ *
88
+ * @tsplus fluent fncts.io.MVar swap
89
+ */
90
+ export function swap<A>(self: MVar<A>, value: A): UIO<A> {
91
+ concrete(self);
92
+ return Do((Δ) => {
93
+ const ref = Δ(self.content.get);
94
+ return Δ(
95
+ ref.match(
96
+ () => STM.retry,
97
+ (y) => self.content.set(Just(value)).as(y),
98
+ ),
99
+ );
100
+ }).commit;
101
+ }
102
+
103
+ /**
104
+ * Return the contents of the `MVar`. If the `MVar` is currently empty, `take`
105
+ * will wait until it is full. After a `take`, the `MVar` is left empty.
106
+ *
107
+ * @tsplus getter fncts.io.MVar take
108
+ */
109
+ export function take<A>(self: MVar<A>): UIO<A> {
110
+ concrete(self);
111
+ return self.content.get.filterMap(Function.identity).flatMap((a) => self.content.set(Nothing()).as(a)).commit;
112
+ }
113
+
114
+ /**
115
+ * A non-blocking version of `put`. The `tryPut` function attempts to put the
116
+ * value into the `MVar`, returning `true` if it was successful, or
117
+ * `false` otherwise.
118
+ *
119
+ * @tsplus fluent fncts.io.MVar tryPut
120
+ */
121
+ export function tryPut<A>(self: MVar<A>, value: A): UIO<boolean> {
122
+ concrete(self);
123
+ return self.content.get.flatMap((v) =>
124
+ v.match(
125
+ () => self.content.set(Just(value)).as(true),
126
+ () => STM.succeedNow(false),
127
+ ),
128
+ ).commit;
129
+ }
130
+
131
+ /**
132
+ * A non-blocking version of `read`. The `tryRead` function returns
133
+ * immediately, with `None` if the `MVar` was empty, or `Some(x)` if the
134
+ * `MVar` was full with contents `x`.
135
+ *
136
+ * @tsplus getter fncts.io.MVar tryRead
137
+ */
138
+ export function tryRead<A>(self: MVar<A>): UIO<Maybe<A>> {
139
+ concrete(self);
140
+ return self.content.get.commit;
141
+ }
142
+
143
+ /**
144
+ * A non-blocking version of `take`. The `tryTake` action returns immediately,
145
+ * with `None` if the `MVar` was empty, or `Some(x)` if the `MVar` was full
146
+ * with contents `x`. After `tryTake`, the `MVar` is left empty.
147
+ *
148
+ * @tsplus getter fncts.io.MVar tryTake
149
+ */
150
+ export function tryTake<A>(self: MVar<A>): UIO<Maybe<A>> {
151
+ concrete(self);
152
+ return Do((Δ) => {
153
+ const c = Δ(self.content.get);
154
+ return Δ(
155
+ c.match(
156
+ () => STM.succeedNow(Nothing()),
157
+ (a) => self.content.set(Nothing()) > STM.succeedNow(Just(a)),
158
+ ),
159
+ );
160
+ }).commit;
161
+ }
162
+
163
+ /**
164
+ * Replaces the contents of an `MVar` with the result of `f(a)`.
165
+ *
166
+ * @tsplus fluent fncts.io.MVar update
167
+ */
168
+ export function update<A>(self: MVar<A>, f: (a: A) => A): UIO<void> {
169
+ concrete(self);
170
+ return self.content.get.filterMap((value) => value.map(f)).flatMap((a) => self.content.set(Just(a))).commit;
171
+ }
172
+
173
+ /**
174
+ * @tsplus static fncts.io.MVarOps unsafeEmpty
175
+ */
176
+ export function unsafeEmpty<A>(): MVar<A> {
177
+ return new MVarInternal(TRef.unsafeMake<Maybe<A>>(Nothing()));
178
+ }
179
+
180
+ /**
181
+ * @tsplus static fncts.io.MVarOps unsafeMake
182
+ */
183
+ export function unsafeMake<A>(value: A): MVar<A> {
184
+ return new MVarInternal(TRef.unsafeMake<Maybe<A>>(Just(value)));
185
+ }
@@ -0,0 +1,45 @@
1
+ export const MVarVariance = Symbol.for("fncts.io.MVar.Variance");
2
+ export type MVarVariance = typeof MVarVariance;
3
+
4
+ export const MVarTypeId = Symbol.for("fncts.io.MVar");
5
+ export type MVarTypeId = typeof MVarTypeId;
6
+
7
+ /**
8
+ * An `MVar<A>` is a mutable location that is either empty or contains a value
9
+ * of type `A`. It has two fundamental operations: `put` which fills an `MVar`
10
+ * if it is empty and blocks otherwise, and `take` which empties an `MVar` if it
11
+ * is full and blocks otherwise. They can be used in multiple different ways:
12
+ *
13
+ * - As synchronized mutable variables,
14
+ * - As channels, with `take` and `put` as `receive` and `send`, and
15
+ * - As a binary semaphore `MVar<void>`, with `take` and `put` as `wait` and
16
+ * `signal`.
17
+ *
18
+ * They were introduced in the paper "Concurrent Haskell" by Simon Peyton Jones,
19
+ * Andrew Gordon and Sigbjorn Finne.
20
+ *
21
+ * @tsplus type fncts.io.MVar
22
+ * @tsplus companion fncts.io.MVarOps
23
+ */
24
+ export interface MVar<in out A> {
25
+ readonly [MVarVariance]: {
26
+ _A: (_: A) => A;
27
+ };
28
+ readonly [MVarTypeId]: MVarTypeId;
29
+ }
30
+
31
+ export class MVarInternal<in out A> implements MVar<A> {
32
+ readonly [MVarTypeId]: MVarTypeId = MVarTypeId;
33
+ declare [MVarVariance]: {
34
+ _A: (_: A) => A;
35
+ };
36
+ constructor(readonly content: TRef<Maybe<A>>) {}
37
+ }
38
+
39
+ /**
40
+ * @tsplus static fncts.io.MVarOps concrete
41
+ * @tsplus macro remove
42
+ */
43
+ export function concrete<A>(_: MVar<A>): asserts _ is MVarInternal<A> {
44
+ //
45
+ }
package/_src/MVar.ts ADDED
@@ -0,0 +1,4 @@
1
+ // codegen:start { preset: barrel, include: ./MVar/*.ts }
2
+ export * from "./MVar/api.js";
3
+ export * from "./MVar/definition.js";
4
+ // codegen:end
package/_src/Push/api.ts CHANGED
@@ -2,7 +2,7 @@ import type { _A, _E, _R } from "@fncts/base/types";
2
2
 
3
3
  import { AtomicReference } from "@fncts/base/internal/AtomicReference";
4
4
 
5
- import { Emitter, Push } from "./definition.js";
5
+ import { Emitter, Push, PushTypeId, PushVariance } from "./definition.js";
6
6
  import { earlyExit, onEarlyExit } from "./internal.js";
7
7
 
8
8
  /**
@@ -223,9 +223,12 @@ interface MulticastObserver<E, A> {
223
223
  }
224
224
 
225
225
  export class Multicast<R, E, A> implements Push<R, E, A>, Emitter<never, E, A> {
226
- declare _R: () => R;
227
- declare _E: () => E;
228
- declare _A: () => A;
226
+ readonly [PushTypeId]: PushTypeId = PushTypeId;
227
+ declare [PushVariance]: {
228
+ readonly _R: (_: never) => R;
229
+ readonly _E: (_: never) => E;
230
+ readonly _A: (_: never) => A;
231
+ };
229
232
  protected observers: Array<MulticastObserver<E, A>> = [];
230
233
  protected fiber: Fiber<never, unknown> | undefined;
231
234
  constructor(readonly push: Push<R, E, A>) {}
@@ -1,11 +1,20 @@
1
+ export const PushVariance = Symbol.for("fncts.io.Push.Variance");
2
+ export type PushVariance = typeof PushVariance;
3
+
4
+ export const PushTypeId = Symbol.for("fncts.io.Push");
5
+ export type PushTypeId = typeof PushTypeId;
6
+
1
7
  /**
2
8
  * @tsplus type fncts.io.Push
3
9
  * @tsplus companion fncts.io.PushOps
4
10
  */
5
11
  export class Push<R, E, A> {
6
- declare _R: (_: never) => R;
7
- declare _E: (_: never) => E;
8
- declare _A: (_: never) => A;
12
+ readonly [PushTypeId]: PushTypeId = PushTypeId;
13
+ declare [PushVariance]: {
14
+ readonly _R: (_: never) => R;
15
+ readonly _E: (_: never) => E;
16
+ readonly _A: (_: never) => A;
17
+ };
9
18
  constructor(readonly run: <R1>(emitter: Emitter<R1, E, A>) => IO<R | R1 | Scope, never, unknown>) {}
10
19
  }
11
20
 
@@ -14,11 +14,11 @@ export const EarlyExitTypeId = Symbol.for("fncts.io.Push.EarlyExit");
14
14
  export type EarlyExitTypeId = typeof EarlyExitTypeId;
15
15
 
16
16
  export class EarlyExit {
17
- readonly _typeId: EarlyExitTypeId = EarlyExitTypeId;
17
+ readonly [EarlyExitTypeId]: EarlyExitTypeId = EarlyExitTypeId;
18
18
  }
19
19
 
20
20
  export function isEarlyExit(u: unknown): u is EarlyExit {
21
- return hasTypeId(u, EarlyExitTypeId);
21
+ return isObject(u) && EarlyExitTypeId in u;
22
22
  }
23
23
 
24
24
  export const earlyExit = IO.haltNow(new EarlyExit());
@@ -1,7 +1,14 @@
1
1
  import type { UIO } from "@fncts/io/IO";
2
2
  import type { PDequeue, PDequeueInternal, PEnqueue, PEnqueueInternal } from "@fncts/io/Queue/definition";
3
3
 
4
- import { concrete, DequeueTypeId, EnqueueTypeId, QueueInternal, QueueTypeId } from "@fncts/io/Queue/definition";
4
+ import {
5
+ concrete,
6
+ DequeueTypeId,
7
+ EnqueueTypeId,
8
+ QueueInternal,
9
+ QueueTypeId,
10
+ QueueVariance,
11
+ } from "@fncts/io/Queue/definition";
5
12
 
6
13
  class DimapIO<RA, RB, EA, EB, A, B, RC, EC, C, RD, ED, D> extends QueueInternal<
7
14
  RC | RA,
@@ -125,12 +132,14 @@ export function map<B, C>(f: (b: B) => C, __tsplusTrace?: string) {
125
132
  class ContramapIO<RA, RB, EA, EB, A, B, RC, EC, C> implements PEnqueueInternal<RA | RC, RB, EA | EC, EB, C, B> {
126
133
  readonly [EnqueueTypeId]: EnqueueTypeId = EnqueueTypeId;
127
134
  readonly [QueueTypeId]: QueueTypeId = QueueTypeId;
128
- declare _RA: () => RA | RC;
129
- declare _RB: () => RB;
130
- declare _EA: () => EA | EC;
131
- declare _EB: () => EB;
132
- declare _A: (_: C) => void;
133
- declare _B: () => B;
135
+ declare [QueueVariance]: {
136
+ readonly _RA: (_: never) => RA | RC;
137
+ readonly _RB: (_: never) => RB;
138
+ readonly _EA: (_: never) => EA | EC;
139
+ readonly _EB: (_: never) => EB;
140
+ readonly _A: (_: C) => void;
141
+ readonly _B: (_: never) => B;
142
+ };
134
143
  constructor(readonly queue: PEnqueueInternal<RA, RB, EA, EB, A, B>, readonly f: (c: C) => IO<RC, EC, A>) {}
135
144
 
136
145
  awaitShutdown: UIO<void> = this.queue.awaitShutdown;
@@ -167,12 +176,14 @@ export function contramapEnqueueIO<A, RC, EC, C>(f: (c: C) => IO<RC, EC, A>, __t
167
176
  class MapIO<RA, RB, EA, EB, A, B, RC, EC, C> implements PDequeueInternal<RA, RB | RC, EA, EB | EC, A, C> {
168
177
  readonly [DequeueTypeId]: DequeueTypeId = DequeueTypeId;
169
178
  readonly [QueueTypeId]: QueueTypeId = QueueTypeId;
170
- declare _RA: () => RA;
171
- declare _RB: () => RB | RC;
172
- declare _EA: () => EA;
173
- declare _EB: () => EB | EC;
174
- declare _A: (_: A) => void;
175
- declare _B: () => C;
179
+ declare [QueueVariance]: {
180
+ readonly _RA: (_: never) => RA;
181
+ readonly _RB: (_: never) => RB | RC;
182
+ readonly _EA: (_: never) => EA;
183
+ readonly _EB: (_: never) => EB | EC;
184
+ readonly _A: (_: A) => void;
185
+ readonly _B: (_: never) => C;
186
+ };
176
187
  constructor(readonly queue: PDequeueInternal<RA, RB, EA, EB, A, B>, readonly f: (b: B) => IO<RC, EC, C>) {}
177
188
 
178
189
  awaitShutdown: UIO<void> = this.queue.awaitShutdown;
@@ -1,6 +1,6 @@
1
1
  import type { PEnqueue, PEnqueueInternal } from "@fncts/io/Queue/definition";
2
2
 
3
- import { concrete, EnqueueTypeId, QueueInternal, QueueTypeId } from "@fncts/io/Queue/definition";
3
+ import { concrete, EnqueueTypeId, QueueInternal, QueueTypeId , QueueVariance } from "@fncts/io/Queue/definition";
4
4
 
5
5
  class FilterInputIO<RA, RB, EA, EB, B, A, A1 extends A, R2, E2> extends QueueInternal<RA | R2, RB, EA | E2, EB, A1, B> {
6
6
  constructor(readonly queue: QueueInternal<RA, RB, EA, EB, A, B>, readonly f: (_: A1) => IO<R2, E2, boolean>) {
@@ -70,12 +70,14 @@ class FilterInputEnqueueIO<RA, RB, EA, EB, B, A, A1 extends A, R2, E2>
70
70
  {
71
71
  readonly [EnqueueTypeId]: EnqueueTypeId = EnqueueTypeId;
72
72
  readonly [QueueTypeId]: QueueTypeId = QueueTypeId;
73
- declare _RA: () => RA | R2;
74
- declare _RB: () => RB;
75
- declare _EA: () => EA | E2;
76
- declare _EB: () => EB;
77
- declare _A: (_: A1) => void;
78
- declare _B: () => B;
73
+ declare [QueueVariance]: {
74
+ readonly _RA: (_: never) => RA | R2;
75
+ readonly _RB: (_: never) => RB;
76
+ readonly _EA: (_: never) => EA | E2;
77
+ readonly _EB: (_: never) => EB;
78
+ readonly _A: (_: A1) => void;
79
+ readonly _B: (_: never) => B;
80
+ };
79
81
  constructor(readonly queue: PEnqueueInternal<RA, RB, EA, EB, A, B>, readonly f: (_: A1) => IO<R2, E2, boolean>) {}
80
82
 
81
83
  awaitShutdown: UIO<void> = this.queue.awaitShutdown;
@@ -1,6 +1,6 @@
1
1
  import type { PDequeue, PDequeueInternal } from "@fncts/io/Queue/definition";
2
2
 
3
- import { concrete, DequeueTypeId, QueueInternal, QueueTypeId } from "@fncts/io/Queue/definition";
3
+ import { concrete, DequeueTypeId, QueueInternal, QueueTypeId , QueueVariance } from "@fncts/io/Queue/definition";
4
4
 
5
5
  class FilterOutputIO<RA, RB, EA, EB, A, B, RB1, EB1> extends QueueInternal<RA, RB | RB1, EA, EB | EB1, A, B> {
6
6
  constructor(readonly queue: QueueInternal<RA, RB, EA, EB, A, B>, readonly f: (b: B) => IO<RB1, EB1, boolean>) {
@@ -78,12 +78,14 @@ class FilterOutputDequeueIO<RA, RB, EA, EB, A, B, RB1, EB1>
78
78
  {
79
79
  readonly [QueueTypeId]: QueueTypeId = QueueTypeId;
80
80
  readonly [DequeueTypeId]: DequeueTypeId = DequeueTypeId;
81
- declare _RA: () => RA;
82
- declare _RB: () => RB | RB1;
83
- declare _EA: () => EA;
84
- declare _EB: () => EB | EB1;
85
- declare _A: (_: A) => void;
86
- declare _B: () => B;
81
+ declare [QueueVariance]: {
82
+ readonly _RA: (_: never) => RA;
83
+ readonly _RB: (_: never) => RB | RB1;
84
+ readonly _EA: (_: never) => EA;
85
+ readonly _EB: (_: never) => EB | EB1;
86
+ readonly _A: (_: A) => void;
87
+ readonly _B: (_: never) => B;
88
+ };
87
89
  constructor(readonly queue: PDequeueInternal<RA, RB, EA, EB, A, B>, readonly f: (b: B) => IO<RB1, EB1, boolean>) {}
88
90
 
89
91
  awaitShutdown: UIO<void> = this.queue.awaitShutdown;
@@ -4,6 +4,9 @@ export type EnqueueTypeId = typeof EnqueueTypeId;
4
4
  export const DequeueTypeId = Symbol.for("fncts.io.Queue.Dequeue");
5
5
  export type DequeueTypeId = typeof DequeueTypeId;
6
6
 
7
+ export const QueueVariance = Symbol.for("fncts.io.Queue.Variance");
8
+ export type QueueVariance = typeof QueueVariance;
9
+
7
10
  export const QueueTypeId = Symbol.for("fncts.io.Queue");
8
11
  export type QueueTypeId = typeof QueueTypeId;
9
12
 
@@ -23,12 +26,14 @@ export interface PQueue<RA, RB, EA, EB, A, B> extends PEnqueue<RA, RB, EA, EB, A
23
26
  */
24
27
  export interface PQueueCommon<RA, RB, EA, EB, A, B> {
25
28
  readonly [QueueTypeId]: QueueTypeId;
26
- readonly _RA: () => RA;
27
- readonly _RB: () => RB;
28
- readonly _EA: () => EA;
29
- readonly _EB: () => EB;
30
- readonly _A: (_: A) => void;
31
- readonly _B: () => B;
29
+ readonly [QueueVariance]: {
30
+ readonly _RA: (_: never) => RA;
31
+ readonly _RB: (_: never) => RB;
32
+ readonly _EA: (_: never) => EA;
33
+ readonly _EB: (_: never) => EB;
34
+ readonly _A: (_: A) => void;
35
+ readonly _B: (_: never) => B;
36
+ };
32
37
  }
33
38
 
34
39
  /**
@@ -86,12 +91,14 @@ export abstract class QueueInternal<RA, RB, EA, EB, A, B>
86
91
  readonly [QueueTypeId]: QueueTypeId = QueueTypeId;
87
92
  readonly [DequeueTypeId]: DequeueTypeId = DequeueTypeId;
88
93
  readonly [EnqueueTypeId]: EnqueueTypeId = EnqueueTypeId;
89
- readonly _RA!: () => RA;
90
- readonly _RB!: () => RB;
91
- readonly _EA!: () => EA;
92
- readonly _EB!: () => EB;
93
- readonly _A!: (_: A) => void;
94
- readonly _B!: () => B;
94
+ declare [QueueVariance]: {
95
+ readonly _RA: (_: never) => RA;
96
+ readonly _RB: (_: never) => RB;
97
+ readonly _EA: (_: never) => EA;
98
+ readonly _EB: (_: never) => EB;
99
+ readonly _A: (_: A) => void;
100
+ readonly _B: (_: never) => B;
101
+ };
95
102
  /**
96
103
  * Waits until the queue is shutdown.
97
104
  * The `IO` returned by this method will not resume until the queue has been shutdown.
@@ -176,13 +183,15 @@ export declare namespace Queue {
176
183
  }
177
184
 
178
185
  export interface PQueueCommonInternal<RA, RB, EA, EB, A, B> {
179
- readonly _RA: () => RA;
180
- readonly _RB: () => RB;
181
- readonly _EA: () => EA;
182
- readonly _EB: () => EB;
183
- readonly _A: (_: A) => void;
184
- readonly _B: () => B;
185
186
  readonly [QueueTypeId]: QueueTypeId;
187
+ readonly [QueueVariance]: {
188
+ readonly _RA: (_: never) => RA;
189
+ readonly _RB: (_: never) => RB;
190
+ readonly _EA: (_: never) => EA;
191
+ readonly _EB: (_: never) => EB;
192
+ readonly _A: (_: A) => void;
193
+ readonly _B: (_: never) => B;
194
+ };
186
195
  /**
187
196
  * Waits until the queue is shutdown.
188
197
  * The `IO` returned by this method will not resume until the queue has been shutdown.
@@ -7,8 +7,11 @@ import { IO } from "@fncts/io/IO";
7
7
  import { RefInternal } from "./definition.js";
8
8
  import { DerivedAll } from "./DerivedAll.js";
9
9
 
10
+ export const DerivedTypeId = Symbol.for("fncts.io.Ref.Derived");
11
+ export type DerivedTypeId = typeof DerivedTypeId;
12
+
10
13
  export class Derived<EA, EB, A, B> extends RefInternal<never, never, EA, EB, A, B> {
11
- readonly _tag = "Derived";
14
+ readonly [DerivedTypeId]: DerivedTypeId = DerivedTypeId;
12
15
 
13
16
  constructor(
14
17
  readonly use: <X>(
@@ -1,5 +1,14 @@
1
1
  import { PSynchronizedInternal } from "./definition.js";
2
2
 
3
+ /**
4
+ * @tsplus static fncts.io.Ref.SynchronizedOps unsafeMake
5
+ */
6
+ export function unsafeMakeSynchronized<A>(a: A, __tsplusTrace?: string): Ref.Synchronized<A> {
7
+ const ref = Ref.unsafeMake(a);
8
+ const semaphore = TSemaphore.unsafeMake(1);
9
+ return new PSynchronizedInternal(semaphore, ref.get, (a: A) => ref.set(a));
10
+ }
11
+
3
12
  /**
4
13
  * @tsplus static fncts.io.Ref.SynchronizedOps make
5
14
  */
@@ -4,11 +4,14 @@ import { IO } from "@fncts/io/IO";
4
4
 
5
5
  import { RefInternal } from "../definition.js";
6
6
 
7
+ export const SynchronizedTypeId = Symbol.for("fncts.io.Ref.Synchronized");
8
+ export type SynchronizedTypeId = typeof SynchronizedTypeId;
9
+
7
10
  /**
8
11
  * @tsplus type fncts.io.Ref.Synchronized
9
12
  */
10
13
  export interface PSynchronized<RA, RB, EA, EB, A, B> extends PRef<RA, RB, EA, EB, A, B> {
11
- readonly _tag: "Synchronized";
14
+ readonly [SynchronizedTypeId]: SynchronizedTypeId;
12
15
  }
13
16
 
14
17
  /**
@@ -25,7 +28,7 @@ export const Synchronized: PSynchronizedOps = {};
25
28
  * @tsplus type fncts.io.Ref.Synchronized
26
29
  */
27
30
  export class PSynchronizedInternal<RA, RB, EA, EB, A, B> extends RefInternal<RA, RB, EA, EB, A, B> {
28
- readonly _tag = "Synchronized";
31
+ readonly [SynchronizedTypeId]: SynchronizedTypeId = SynchronizedTypeId;
29
32
  constructor(
30
33
  readonly semaphore: TSemaphore,
31
34
  readonly unsafeGet: IO<RB, EB, B>,