@fncts/io 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (482) 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/interrupt.d.ts +19 -19
  16. package/IO/api/onTermination.d.ts +0 -1
  17. package/IO/api/sequenceT.d.ts +19 -3
  18. package/IO/api.d.ts +17 -1
  19. package/IO/definition.d.ts +40 -26
  20. package/IO.d.ts +0 -1
  21. package/Layer/definition.d.ts +17 -13
  22. package/Logger/definition.d.ts +10 -6
  23. package/MVar/api.d.ts +101 -0
  24. package/MVar/definition.d.ts +43 -0
  25. package/MVar.d.ts +2 -0
  26. package/Push/api.d.ts +7 -4
  27. package/Push/definition.d.ts +10 -3
  28. package/Push/internal.d.ts +1 -1
  29. package/Queue/api/dimapIO.d.ts +17 -13
  30. package/Queue/definition.d.ts +26 -18
  31. package/Ref/Derived.d.ts +3 -1
  32. package/Ref/Synchronized/constructors.d.ts +6 -1
  33. package/Ref/Synchronized/definition.d.ts +4 -2
  34. package/Ref/definition.d.ts +36 -25
  35. package/Ref.d.ts +0 -1
  36. package/RefSubject/definition.d.ts +17 -11
  37. package/Reloadable/definition.d.ts +5 -1
  38. package/STM/api/atomically.d.ts +9 -0
  39. package/STM/api.d.ts +12 -6
  40. package/STM/definition.d.ts +28 -15
  41. package/STM/internal/Entry.d.ts +2 -2
  42. package/STM/internal/TryCommit.d.ts +2 -2
  43. package/STM/internal/Versioned.d.ts +1 -1
  44. package/STM.d.ts +1 -0
  45. package/Schedule/definition.d.ts +7 -3
  46. package/Scope/definition.d.ts +1 -1
  47. package/ScopedRef/definition.d.ts +1 -1
  48. package/State/api.d.ts +1 -1
  49. package/State/definition.d.ts +5 -2
  50. package/State/internal.d.ts +6 -2
  51. package/Stream/definition.d.ts +26 -5
  52. package/Stream/internal/Handoff.d.ts +21 -15
  53. package/Stream/internal/SinkEndReason.d.ts +2 -2
  54. package/Subject/Atomic.d.ts +8 -4
  55. package/SupervisorPatch.d.ts +1 -1
  56. package/TExit/definition.d.ts +5 -5
  57. package/TRef/definition.d.ts +16 -14
  58. package/TRef.d.ts +0 -1
  59. package/_cjs/Cached/definition.cjs +4 -2
  60. package/_cjs/Cached/definition.cjs.map +1 -1
  61. package/_cjs/Cached/internal.cjs +7 -6
  62. package/_cjs/Cached/internal.cjs.map +1 -1
  63. package/_cjs/Channel/api/mapOutConcurrentIO.cjs +1 -1
  64. package/_cjs/Channel/api/mergeAllWith.cjs +1 -1
  65. package/_cjs/Channel/api.cjs +20 -20
  66. package/_cjs/Channel/api.cjs.map +1 -1
  67. package/_cjs/Channel/definition.cjs +13 -3
  68. package/_cjs/Channel/definition.cjs.map +1 -1
  69. package/_cjs/Channel/internal/ChannelExecutor.cjs +11 -6
  70. package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
  71. package/_cjs/Channel/internal/MergeDecision.cjs +7 -3
  72. package/_cjs/Channel/internal/MergeDecision.cjs.map +1 -1
  73. package/_cjs/CountdownLatch.cjs +4 -2
  74. package/_cjs/CountdownLatch.cjs.map +1 -1
  75. package/_cjs/Differ/definition.cjs +3 -1
  76. package/_cjs/Differ/definition.cjs.map +1 -1
  77. package/_cjs/Fiber/FiberRuntime.cjs +96 -89
  78. package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
  79. package/_cjs/Fiber/definition.cjs +8 -4
  80. package/_cjs/Fiber/definition.cjs.map +1 -1
  81. package/_cjs/FiberRef/definition.cjs +8 -4
  82. package/_cjs/FiberRef/definition.cjs.map +1 -1
  83. package/_cjs/Future/api.cjs +17 -6
  84. package/_cjs/Future/api.cjs.map +1 -1
  85. package/_cjs/Hub/api.cjs +5 -5
  86. package/_cjs/Hub/api.cjs.map +1 -1
  87. package/_cjs/Hub/definition.cjs +9 -7
  88. package/_cjs/Hub/definition.cjs.map +1 -1
  89. package/_cjs/Hub/internal.cjs +6 -6
  90. package/_cjs/Hub/internal.cjs.map +1 -1
  91. package/_cjs/IO/api/asyncIO.cjs +1 -1
  92. package/_cjs/IO/api/asyncIO.cjs.map +1 -1
  93. package/_cjs/IO/api/asyncInterrupt.cjs +2 -2
  94. package/_cjs/IO/api/asyncInterrupt.cjs.map +1 -1
  95. package/_cjs/IO/api/bracketExit.cjs +1 -1
  96. package/_cjs/IO/api/bracketExit.cjs.map +1 -1
  97. package/_cjs/IO/api/foreachConcurrent.cjs +2 -2
  98. package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
  99. package/_cjs/IO/api/forkIn.cjs +1 -1
  100. package/_cjs/IO/api/forkIn.cjs.map +1 -1
  101. package/_cjs/IO/api/forkScoped.cjs +1 -1
  102. package/_cjs/IO/api/forkScoped.cjs.map +1 -1
  103. package/_cjs/IO/api/fulfill.cjs +1 -1
  104. package/_cjs/IO/api/fulfill.cjs.map +1 -1
  105. package/_cjs/IO/api/interrupt.cjs +52 -43
  106. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  107. package/_cjs/IO/api/onTermination.cjs +7 -6
  108. package/_cjs/IO/api/onTermination.cjs.map +1 -1
  109. package/_cjs/IO/api/race.cjs +1 -1
  110. package/_cjs/IO/api/race.cjs.map +1 -1
  111. package/_cjs/IO/api/sequenceT.cjs +1 -1
  112. package/_cjs/IO/api/sequenceT.cjs.map +1 -1
  113. package/_cjs/IO/api/zipConcurrent.cjs +1 -1
  114. package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
  115. package/_cjs/IO/api.cjs +79 -53
  116. package/_cjs/IO/api.cjs.map +1 -1
  117. package/_cjs/IO/definition.cjs +26 -21
  118. package/_cjs/IO/definition.cjs.map +1 -1
  119. package/_cjs/IO.cjs +0 -11
  120. package/_cjs/IO.cjs.map +1 -1
  121. package/_cjs/Layer/MemoMap.cjs +30 -31
  122. package/_cjs/Layer/MemoMap.cjs.map +1 -1
  123. package/_cjs/Layer/api.cjs +1 -1
  124. package/_cjs/Layer/api.cjs.map +1 -1
  125. package/_cjs/Layer/definition.cjs +12 -10
  126. package/_cjs/Layer/definition.cjs.map +1 -1
  127. package/_cjs/Logger/definition.cjs +3 -1
  128. package/_cjs/Logger/definition.cjs.map +1 -1
  129. package/_cjs/MVar/api.cjs +170 -0
  130. package/_cjs/MVar/api.cjs.map +1 -0
  131. package/_cjs/MVar/definition.cjs +28 -0
  132. package/_cjs/MVar/definition.cjs.map +1 -0
  133. package/_cjs/MVar.cjs +28 -0
  134. package/_cjs/MVar.cjs.map +1 -0
  135. package/_cjs/Push/api.cjs +39 -36
  136. package/_cjs/Push/api.cjs.map +1 -1
  137. package/_cjs/Push/definition.cjs +9 -2
  138. package/_cjs/Push/definition.cjs.map +1 -1
  139. package/_cjs/Push/internal.cjs +4 -2
  140. package/_cjs/Push/internal.cjs.map +1 -1
  141. package/_cjs/Queue/api/dimapIO.cjs +10 -10
  142. package/_cjs/Queue/api/dimapIO.cjs.map +1 -1
  143. package/_cjs/Queue/api/filterInputIO.cjs +4 -4
  144. package/_cjs/Queue/api/filterInputIO.cjs.map +1 -1
  145. package/_cjs/Queue/api/filterOutputIO.cjs +7 -7
  146. package/_cjs/Queue/api/filterOutputIO.cjs.map +1 -1
  147. package/_cjs/Queue/definition.cjs +3 -1
  148. package/_cjs/Queue/definition.cjs.map +1 -1
  149. package/_cjs/Queue/internal.cjs +2 -2
  150. package/_cjs/Queue/internal.cjs.map +1 -1
  151. package/_cjs/Queue/strategy.cjs +2 -2
  152. package/_cjs/Queue/strategy.cjs.map +1 -1
  153. package/_cjs/Ref/Derived.cjs +8 -4
  154. package/_cjs/Ref/Derived.cjs.map +1 -1
  155. package/_cjs/Ref/Synchronized/constructors.cjs +16 -7
  156. package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
  157. package/_cjs/Ref/Synchronized/definition.cjs +16 -12
  158. package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
  159. package/_cjs/Ref/definition.cjs +3 -2
  160. package/_cjs/Ref/definition.cjs.map +1 -1
  161. package/_cjs/Ref.cjs +0 -11
  162. package/_cjs/Ref.cjs.map +1 -1
  163. package/_cjs/RefSubject/Synchronized/api.cjs +1 -1
  164. package/_cjs/RefSubject/definition.cjs +9 -5
  165. package/_cjs/RefSubject/definition.cjs.map +1 -1
  166. package/_cjs/Reloadable/definition.cjs +4 -2
  167. package/_cjs/Reloadable/definition.cjs.map +1 -1
  168. package/_cjs/STM/api/atomically.cjs +55 -0
  169. package/_cjs/STM/api/atomically.cjs.map +1 -0
  170. package/_cjs/STM/api.cjs +65 -91
  171. package/_cjs/STM/api.cjs.map +1 -1
  172. package/_cjs/STM/definition.cjs +32 -19
  173. package/_cjs/STM/definition.cjs.map +1 -1
  174. package/_cjs/STM/driver.cjs +3 -3
  175. package/_cjs/STM/driver.cjs.map +1 -1
  176. package/_cjs/STM/internal/Entry.cjs +6 -3
  177. package/_cjs/STM/internal/Entry.cjs.map +1 -1
  178. package/_cjs/STM/internal/TryCommit.cjs +5 -2
  179. package/_cjs/STM/internal/TryCommit.cjs.map +1 -1
  180. package/_cjs/STM/internal/Versioned.cjs +3 -1
  181. package/_cjs/STM/internal/Versioned.cjs.map +1 -1
  182. package/_cjs/STM.cjs +11 -0
  183. package/_cjs/STM.cjs.map +1 -1
  184. package/_cjs/Schedule/definition.cjs +3 -1
  185. package/_cjs/Schedule/definition.cjs.map +1 -1
  186. package/_cjs/Scope/api.cjs +1 -2
  187. package/_cjs/Scope/api.cjs.map +1 -1
  188. package/_cjs/Scope/definition.cjs +5 -3
  189. package/_cjs/Scope/definition.cjs.map +1 -1
  190. package/_cjs/ScopedRef/api.cjs +2 -2
  191. package/_cjs/ScopedRef/api.cjs.map +1 -1
  192. package/_cjs/ScopedRef/definition.cjs +3 -1
  193. package/_cjs/ScopedRef/definition.cjs.map +1 -1
  194. package/_cjs/State/api.cjs +2 -2
  195. package/_cjs/State/api.cjs.map +1 -1
  196. package/_cjs/State/definition.cjs +4 -2
  197. package/_cjs/State/definition.cjs.map +1 -1
  198. package/_cjs/State/internal.cjs +7 -3
  199. package/_cjs/State/internal.cjs.map +1 -1
  200. package/_cjs/Stream/api.cjs +1 -1
  201. package/_cjs/Stream/definition.cjs +4 -2
  202. package/_cjs/Stream/definition.cjs.map +1 -1
  203. package/_cjs/Stream/internal/Handoff.cjs +37 -37
  204. package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
  205. package/_cjs/Stream/internal/SinkEndReason.cjs +6 -3
  206. package/_cjs/Stream/internal/SinkEndReason.cjs.map +1 -1
  207. package/_cjs/Subject/Atomic.cjs +6 -4
  208. package/_cjs/Subject/Atomic.cjs.map +1 -1
  209. package/_cjs/SubscriptionRef.cjs +1 -1
  210. package/_cjs/SupervisorPatch.cjs +3 -1
  211. package/_cjs/SupervisorPatch.cjs.map +1 -1
  212. package/_cjs/TExit/definition.cjs +25 -24
  213. package/_cjs/TExit/definition.cjs.map +1 -1
  214. package/_cjs/TFuture/constructors.cjs +1 -1
  215. package/_cjs/TReentrantLock/api.cjs +10 -9
  216. package/_cjs/TReentrantLock/api.cjs.map +1 -1
  217. package/_cjs/TRef/constructors.cjs +1 -1
  218. package/_cjs/TRef/definition.cjs +21 -21
  219. package/_cjs/TRef/definition.cjs.map +1 -1
  220. package/_cjs/TRef.cjs +0 -11
  221. package/_cjs/TRef.cjs.map +1 -1
  222. package/_cjs/TSemaphore/api.cjs +2 -2
  223. package/_cjs/TSemaphore/api.cjs.map +1 -1
  224. package/_cjs/TSemaphore/constructors.cjs +1 -1
  225. package/_cjs/internal/IsFatal.cjs +3 -1
  226. package/_cjs/internal/IsFatal.cjs.map +1 -1
  227. package/_mjs/Cached/definition.mjs +4 -2
  228. package/_mjs/Cached/definition.mjs.map +1 -1
  229. package/_mjs/Cached/internal.mjs +3 -5
  230. package/_mjs/Cached/internal.mjs.map +1 -1
  231. package/_mjs/Channel/api/mapOutConcurrentIO.mjs +1 -1
  232. package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
  233. package/_mjs/Channel/api.mjs +15 -14
  234. package/_mjs/Channel/api.mjs.map +1 -1
  235. package/_mjs/Channel/definition.mjs +9 -1
  236. package/_mjs/Channel/definition.mjs.map +1 -1
  237. package/_mjs/Channel/internal/ChannelExecutor.mjs +11 -6
  238. package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
  239. package/_mjs/Channel/internal/MergeDecision.mjs +4 -1
  240. package/_mjs/Channel/internal/MergeDecision.mjs.map +1 -1
  241. package/_mjs/CountdownLatch.mjs +3 -1
  242. package/_mjs/CountdownLatch.mjs.map +1 -1
  243. package/_mjs/Differ/definition.mjs +3 -1
  244. package/_mjs/Differ/definition.mjs.map +1 -1
  245. package/_mjs/Fiber/FiberRuntime.mjs +97 -90
  246. package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
  247. package/_mjs/Fiber/definition.mjs +5 -2
  248. package/_mjs/Fiber/definition.mjs.map +1 -1
  249. package/_mjs/FiberRef/definition.mjs +6 -3
  250. package/_mjs/FiberRef/definition.mjs.map +1 -1
  251. package/_mjs/Future/api.mjs +17 -6
  252. package/_mjs/Future/api.mjs.map +1 -1
  253. package/_mjs/Hub/api.mjs +6 -6
  254. package/_mjs/Hub/api.mjs.map +1 -1
  255. package/_mjs/Hub/definition.mjs +5 -4
  256. package/_mjs/Hub/definition.mjs.map +1 -1
  257. package/_mjs/Hub/internal.mjs +6 -6
  258. package/_mjs/Hub/internal.mjs.map +1 -1
  259. package/_mjs/IO/api/asyncIO.mjs +1 -1
  260. package/_mjs/IO/api/asyncIO.mjs.map +1 -1
  261. package/_mjs/IO/api/asyncInterrupt.mjs +2 -2
  262. package/_mjs/IO/api/asyncInterrupt.mjs.map +1 -1
  263. package/_mjs/IO/api/bracketExit.mjs +1 -1
  264. package/_mjs/IO/api/bracketExit.mjs.map +1 -1
  265. package/_mjs/IO/api/foreachConcurrent.mjs +2 -2
  266. package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
  267. package/_mjs/IO/api/forkIn.mjs +1 -1
  268. package/_mjs/IO/api/forkIn.mjs.map +1 -1
  269. package/_mjs/IO/api/forkScoped.mjs +1 -1
  270. package/_mjs/IO/api/forkScoped.mjs.map +1 -1
  271. package/_mjs/IO/api/fulfill.mjs +1 -1
  272. package/_mjs/IO/api/fulfill.mjs.map +1 -1
  273. package/_mjs/IO/api/interrupt.mjs +46 -38
  274. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  275. package/_mjs/IO/api/onTermination.mjs +7 -6
  276. package/_mjs/IO/api/onTermination.mjs.map +1 -1
  277. package/_mjs/IO/api/race.mjs +1 -1
  278. package/_mjs/IO/api/race.mjs.map +1 -1
  279. package/_mjs/IO/api/sequenceT.mjs +1 -1
  280. package/_mjs/IO/api/sequenceT.mjs.map +1 -1
  281. package/_mjs/IO/api/zipConcurrent.mjs +1 -1
  282. package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
  283. package/_mjs/IO/api.mjs +73 -50
  284. package/_mjs/IO/api.mjs.map +1 -1
  285. package/_mjs/IO/definition.mjs +23 -19
  286. package/_mjs/IO/definition.mjs.map +1 -1
  287. package/_mjs/IO.mjs +0 -1
  288. package/_mjs/IO.mjs.map +1 -1
  289. package/_mjs/Layer/MemoMap.mjs +28 -29
  290. package/_mjs/Layer/MemoMap.mjs.map +1 -1
  291. package/_mjs/Layer/api.mjs +2 -2
  292. package/_mjs/Layer/api.mjs.map +1 -1
  293. package/_mjs/Layer/definition.mjs +9 -8
  294. package/_mjs/Layer/definition.mjs.map +1 -1
  295. package/_mjs/Logger/definition.mjs +1 -0
  296. package/_mjs/Logger/definition.mjs.map +1 -1
  297. package/_mjs/MVar/api.mjs +150 -0
  298. package/_mjs/MVar/api.mjs.map +1 -0
  299. package/_mjs/MVar/definition.mjs +18 -0
  300. package/_mjs/MVar/definition.mjs.map +1 -0
  301. package/_mjs/MVar.mjs +4 -0
  302. package/_mjs/MVar.mjs.map +1 -0
  303. package/_mjs/Push/api.mjs +39 -36
  304. package/_mjs/Push/api.mjs.map +1 -1
  305. package/_mjs/Push/definition.mjs +5 -0
  306. package/_mjs/Push/definition.mjs.map +1 -1
  307. package/_mjs/Push/internal.mjs +4 -2
  308. package/_mjs/Push/internal.mjs.map +1 -1
  309. package/_mjs/Queue/api/dimapIO.mjs +11 -11
  310. package/_mjs/Queue/api/dimapIO.mjs.map +1 -1
  311. package/_mjs/Queue/api/filterInputIO.mjs +5 -5
  312. package/_mjs/Queue/api/filterInputIO.mjs.map +1 -1
  313. package/_mjs/Queue/api/filterOutputIO.mjs +8 -8
  314. package/_mjs/Queue/api/filterOutputIO.mjs.map +1 -1
  315. package/_mjs/Queue/definition.mjs +1 -0
  316. package/_mjs/Queue/definition.mjs.map +1 -1
  317. package/_mjs/Queue/internal.mjs +2 -2
  318. package/_mjs/Queue/internal.mjs.map +1 -1
  319. package/_mjs/Queue/strategy.mjs +2 -2
  320. package/_mjs/Queue/strategy.mjs.map +1 -1
  321. package/_mjs/Ref/Derived.mjs +6 -3
  322. package/_mjs/Ref/Derived.mjs.map +1 -1
  323. package/_mjs/Ref/Synchronized/constructors.mjs +15 -7
  324. package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
  325. package/_mjs/Ref/Synchronized/definition.mjs +13 -10
  326. package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
  327. package/_mjs/Ref/definition.mjs +1 -1
  328. package/_mjs/Ref/definition.mjs.map +1 -1
  329. package/_mjs/Ref.mjs +0 -1
  330. package/_mjs/Ref.mjs.map +1 -1
  331. package/_mjs/RefSubject/Synchronized/api.mjs +1 -1
  332. package/_mjs/RefSubject/definition.mjs +10 -3
  333. package/_mjs/RefSubject/definition.mjs.map +1 -1
  334. package/_mjs/Reloadable/definition.mjs +2 -1
  335. package/_mjs/Reloadable/definition.mjs.map +1 -1
  336. package/_mjs/STM/api/atomically.mjs +47 -0
  337. package/_mjs/STM/api/atomically.mjs.map +1 -0
  338. package/_mjs/STM/api.mjs +61 -88
  339. package/_mjs/STM/api.mjs.map +1 -1
  340. package/_mjs/STM/definition.mjs +27 -17
  341. package/_mjs/STM/definition.mjs.map +1 -1
  342. package/_mjs/STM/driver.mjs +3 -3
  343. package/_mjs/STM/driver.mjs.map +1 -1
  344. package/_mjs/STM/internal/Entry.mjs +5 -2
  345. package/_mjs/STM/internal/Entry.mjs.map +1 -1
  346. package/_mjs/STM/internal/TryCommit.mjs +6 -2
  347. package/_mjs/STM/internal/TryCommit.mjs.map +1 -1
  348. package/_mjs/STM/internal/Versioned.mjs +3 -1
  349. package/_mjs/STM/internal/Versioned.mjs.map +1 -1
  350. package/_mjs/STM.mjs +1 -0
  351. package/_mjs/STM.mjs.map +1 -1
  352. package/_mjs/Schedule/definition.mjs +1 -0
  353. package/_mjs/Schedule/definition.mjs.map +1 -1
  354. package/_mjs/Scope/api.mjs +1 -2
  355. package/_mjs/Scope/api.mjs.map +1 -1
  356. package/_mjs/Scope/definition.mjs +4 -2
  357. package/_mjs/Scope/definition.mjs.map +1 -1
  358. package/_mjs/ScopedRef/api.mjs +2 -2
  359. package/_mjs/ScopedRef/api.mjs.map +1 -1
  360. package/_mjs/ScopedRef/definition.mjs +3 -1
  361. package/_mjs/ScopedRef/definition.mjs.map +1 -1
  362. package/_mjs/State/api.mjs +1 -1
  363. package/_mjs/State/api.mjs.map +1 -1
  364. package/_mjs/State/definition.mjs +4 -1
  365. package/_mjs/State/definition.mjs.map +1 -1
  366. package/_mjs/State/internal.mjs +5 -2
  367. package/_mjs/State/internal.mjs.map +1 -1
  368. package/_mjs/Stream/api.mjs +1 -1
  369. package/_mjs/Stream/definition.mjs +2 -1
  370. package/_mjs/Stream/definition.mjs.map +1 -1
  371. package/_mjs/Stream/internal/Handoff.mjs +40 -32
  372. package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
  373. package/_mjs/Stream/internal/SinkEndReason.mjs +6 -2
  374. package/_mjs/Stream/internal/SinkEndReason.mjs.map +1 -1
  375. package/_mjs/Subject/Atomic.mjs +4 -2
  376. package/_mjs/Subject/Atomic.mjs.map +1 -1
  377. package/_mjs/SubscriptionRef.mjs +1 -1
  378. package/_mjs/SupervisorPatch.mjs +3 -1
  379. package/_mjs/SupervisorPatch.mjs.map +1 -1
  380. package/_mjs/TExit/definition.mjs +25 -24
  381. package/_mjs/TExit/definition.mjs.map +1 -1
  382. package/_mjs/TFuture/constructors.mjs +1 -1
  383. package/_mjs/TReentrantLock/api.mjs +10 -9
  384. package/_mjs/TReentrantLock/api.mjs.map +1 -1
  385. package/_mjs/TRef/constructors.mjs +1 -1
  386. package/_mjs/TRef/definition.mjs +19 -20
  387. package/_mjs/TRef/definition.mjs.map +1 -1
  388. package/_mjs/TRef.mjs +0 -1
  389. package/_mjs/TRef.mjs.map +1 -1
  390. package/_mjs/TSemaphore/api.mjs +2 -2
  391. package/_mjs/TSemaphore/api.mjs.map +1 -1
  392. package/_mjs/TSemaphore/constructors.mjs +1 -1
  393. package/_mjs/internal/IsFatal.mjs +3 -1
  394. package/_mjs/internal/IsFatal.mjs.map +1 -1
  395. package/_src/Cached/definition.ts +6 -4
  396. package/_src/Cached/internal.ts +4 -4
  397. package/_src/Channel/api.ts +14 -15
  398. package/_src/Channel/definition.ts +37 -14
  399. package/_src/Channel/internal/ChannelExecutor.ts +14 -3
  400. package/_src/Channel/internal/MergeDecision.ts +11 -6
  401. package/_src/CountdownLatch.ts +1 -1
  402. package/_src/Differ/definition.ts +2 -4
  403. package/_src/Fiber/FiberRuntime.ts +54 -50
  404. package/_src/Fiber/definition.ts +15 -8
  405. package/_src/FiberRef/definition.ts +9 -4
  406. package/_src/FiberRefs/api.ts +1 -1
  407. package/_src/FiberRefs/definition.ts +1 -1
  408. package/_src/Future/api.ts +14 -5
  409. package/_src/Hub/api.ts +9 -7
  410. package/_src/Hub/definition.ts +30 -15
  411. package/_src/IO/api/interrupt.ts +72 -55
  412. package/_src/IO/api/onTermination.ts +8 -7
  413. package/_src/IO/api/sequenceT.ts +4 -6
  414. package/_src/IO/api.ts +23 -1
  415. package/_src/IO/definition.ts +36 -27
  416. package/_src/IO.ts +0 -1
  417. package/_src/Layer/MemoMap.ts +1 -1
  418. package/_src/Layer/api.ts +2 -2
  419. package/_src/Layer/definition.ts +18 -13
  420. package/_src/Logger/definition.ts +9 -4
  421. package/_src/MVar/api.ts +185 -0
  422. package/_src/MVar/definition.ts +45 -0
  423. package/_src/MVar.ts +4 -0
  424. package/_src/Push/api.ts +7 -4
  425. package/_src/Push/definition.ts +12 -3
  426. package/_src/Push/internal.ts +2 -2
  427. package/_src/Queue/api/dimapIO.ts +24 -13
  428. package/_src/Queue/api/filterInputIO.ts +9 -7
  429. package/_src/Queue/api/filterOutputIO.ts +9 -7
  430. package/_src/Queue/definition.ts +27 -18
  431. package/_src/Ref/Derived.ts +4 -1
  432. package/_src/Ref/Synchronized/constructors.ts +9 -0
  433. package/_src/Ref/Synchronized/definition.ts +5 -2
  434. package/_src/Ref/definition.ts +36 -25
  435. package/_src/Ref.ts +0 -1
  436. package/_src/RefSubject/definition.ts +19 -12
  437. package/_src/Reloadable/definition.ts +6 -1
  438. package/_src/STM/api/atomically.ts +43 -0
  439. package/_src/STM/api.ts +20 -38
  440. package/_src/STM/definition.ts +33 -20
  441. package/_src/STM/driver.ts +3 -3
  442. package/_src/STM/internal/Entry.ts +2 -2
  443. package/_src/STM/internal/TryCommit.ts +4 -4
  444. package/_src/STM/internal/Versioned.ts +1 -1
  445. package/_src/STM.ts +1 -0
  446. package/_src/Schedule/definition.ts +8 -3
  447. package/_src/Scope/definition.ts +2 -2
  448. package/_src/ScopedRef/definition.ts +1 -1
  449. package/_src/State/api.ts +1 -1
  450. package/_src/State/definition.ts +6 -3
  451. package/_src/State/internal.ts +8 -3
  452. package/_src/Stream/definition.ts +17 -5
  453. package/_src/Stream/internal/Handoff.ts +31 -24
  454. package/_src/Stream/internal/SinkEndReason.ts +2 -2
  455. package/_src/Subject/Atomic.ts +8 -4
  456. package/_src/SupervisorPatch.ts +1 -1
  457. package/_src/TExit/definition.ts +11 -12
  458. package/_src/TRef/definition.ts +18 -14
  459. package/_src/TRef.ts +0 -1
  460. package/_src/global.ts +4 -0
  461. package/_src/internal/IsFatal.ts +1 -1
  462. package/global.d.ts +4 -0
  463. package/internal/IsFatal.d.ts +1 -1
  464. package/package.json +2 -2
  465. package/IO/api/onExit.d.ts +0 -7
  466. package/Ref/symbols.d.ts +0 -30
  467. package/TRef/symbols.d.ts +0 -20
  468. package/_cjs/IO/api/onExit.cjs +0 -19
  469. package/_cjs/IO/api/onExit.cjs.map +0 -1
  470. package/_cjs/Ref/symbols.cjs +0 -37
  471. package/_cjs/Ref/symbols.cjs.map +0 -1
  472. package/_cjs/TRef/symbols.cjs +0 -27
  473. package/_cjs/TRef/symbols.cjs.map +0 -1
  474. package/_mjs/IO/api/onExit.mjs +0 -11
  475. package/_mjs/IO/api/onExit.mjs.map +0 -1
  476. package/_mjs/Ref/symbols.mjs +0 -25
  477. package/_mjs/Ref/symbols.mjs.map +0 -1
  478. package/_mjs/TRef/symbols.mjs +0 -17
  479. package/_mjs/TRef/symbols.mjs.map +0 -1
  480. package/_src/IO/api/onExit.ts +0 -11
  481. package/_src/Ref/symbols.ts +0 -29
  482. 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>,