@fncts/io 0.0.34 → 0.0.36

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 (230) hide show
  1. package/Fiber/FiberRuntime.d.ts +7 -7
  2. package/Fiber/constructors.d.ts +5 -0
  3. package/IO/api/all.d.ts +41 -0
  4. package/IO/api/concurrency.d.ts +11 -0
  5. package/IO/api/interrupt.d.ts +1 -1
  6. package/IO/api/raceWith.d.ts +2 -1
  7. package/IO/api.d.ts +7 -2
  8. package/IO/definition.d.ts +103 -127
  9. package/IO.d.ts +1 -0
  10. package/Push/api.d.ts +86 -36
  11. package/Push/definition.d.ts +28 -13
  12. package/Push/internal.d.ts +7 -11
  13. package/RefSubject/Atomic.d.ts +8 -11
  14. package/RefSubject/Synchronized/definition.d.ts +4 -6
  15. package/RefSubject/api.d.ts +0 -1
  16. package/RefSubject/definition.d.ts +6 -8
  17. package/STM/definition.d.ts +19 -2
  18. package/Sink/api.d.ts +24 -24
  19. package/Subject/Atomic.d.ts +4 -6
  20. package/Subject/definition.d.ts +2 -2
  21. package/_cjs/Channel/api/runScoped.cjs +1 -1
  22. package/_cjs/Channel/api/runScoped.cjs.map +1 -1
  23. package/_cjs/Channel/api.cjs +2 -2
  24. package/_cjs/Channel/api.cjs.map +1 -1
  25. package/_cjs/Fiber/FiberRuntime.cjs +110 -98
  26. package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
  27. package/_cjs/Fiber/constructors.cjs +10 -2
  28. package/_cjs/Fiber/constructors.cjs.map +1 -1
  29. package/_cjs/Future/api.cjs +1 -1
  30. package/_cjs/Future/api.cjs.map +1 -1
  31. package/_cjs/IO/api/all.cjs +33 -0
  32. package/_cjs/IO/api/all.cjs.map +1 -0
  33. package/_cjs/IO/api/asyncIO.cjs +1 -1
  34. package/_cjs/IO/api/asyncIO.cjs.map +1 -1
  35. package/_cjs/IO/api/bracketExit.cjs +1 -1
  36. package/_cjs/IO/api/bracketExit.cjs.map +1 -1
  37. package/_cjs/IO/api/concurrency.cjs +25 -4
  38. package/_cjs/IO/api/concurrency.cjs.map +1 -1
  39. package/_cjs/IO/api/disconnect.cjs +1 -1
  40. package/_cjs/IO/api/disconnect.cjs.map +1 -1
  41. package/_cjs/IO/api/foreachConcurrent.cjs +1 -1
  42. package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
  43. package/_cjs/IO/api/foreachExec.cjs +1 -1
  44. package/_cjs/IO/api/foreachExec.cjs.map +1 -1
  45. package/_cjs/IO/api/forkIn.cjs +1 -1
  46. package/_cjs/IO/api/forkIn.cjs.map +1 -1
  47. package/_cjs/IO/api/forkScoped.cjs +1 -1
  48. package/_cjs/IO/api/forkScoped.cjs.map +1 -1
  49. package/_cjs/IO/api/fulfill.cjs +1 -1
  50. package/_cjs/IO/api/fulfill.cjs.map +1 -1
  51. package/_cjs/IO/api/interrupt.cjs +18 -6
  52. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  53. package/_cjs/IO/api/raceWith.cjs +4 -4
  54. package/_cjs/IO/api/raceWith.cjs.map +1 -1
  55. package/_cjs/IO/api/timeout.cjs +8 -5
  56. package/_cjs/IO/api/timeout.cjs.map +1 -1
  57. package/_cjs/IO/api/zipConcurrent.cjs +1 -1
  58. package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
  59. package/_cjs/IO/api.cjs +78 -20
  60. package/_cjs/IO/api.cjs.map +1 -1
  61. package/_cjs/IO/definition.cjs +14 -191
  62. package/_cjs/IO/definition.cjs.map +1 -1
  63. package/_cjs/IO.cjs +11 -0
  64. package/_cjs/IO.cjs.map +1 -1
  65. package/_cjs/Layer/MemoMap.cjs +1 -1
  66. package/_cjs/Layer/MemoMap.cjs.map +1 -1
  67. package/_cjs/Layer/api.cjs.map +1 -1
  68. package/_cjs/Push/api.cjs +238 -168
  69. package/_cjs/Push/api.cjs.map +1 -1
  70. package/_cjs/Push/definition.cjs +12 -13
  71. package/_cjs/Push/definition.cjs.map +1 -1
  72. package/_cjs/Push/internal.cjs +37 -29
  73. package/_cjs/Push/internal.cjs.map +1 -1
  74. package/_cjs/RefSubject/Atomic.cjs +15 -19
  75. package/_cjs/RefSubject/Atomic.cjs.map +1 -1
  76. package/_cjs/RefSubject/Synchronized/definition.cjs +9 -10
  77. package/_cjs/RefSubject/Synchronized/definition.cjs.map +1 -1
  78. package/_cjs/RefSubject/api.cjs +5 -6
  79. package/_cjs/RefSubject/api.cjs.map +1 -1
  80. package/_cjs/RefSubject/definition.cjs.map +1 -1
  81. package/_cjs/STM/api/atomically.cjs +1 -1
  82. package/_cjs/STM/api/atomically.cjs.map +1 -1
  83. package/_cjs/STM/api.cjs +2 -2
  84. package/_cjs/STM/api.cjs.map +1 -1
  85. package/_cjs/STM/definition.cjs +1 -1
  86. package/_cjs/STM/definition.cjs.map +1 -1
  87. package/_cjs/ScopedRef/api.cjs +2 -2
  88. package/_cjs/ScopedRef/api.cjs.map +1 -1
  89. package/_cjs/Semaphore.cjs +1 -1
  90. package/_cjs/Semaphore.cjs.map +1 -1
  91. package/_cjs/Sink/api.cjs +13 -13
  92. package/_cjs/Sink/api.cjs.map +1 -1
  93. package/_cjs/Subject/Atomic.cjs +4 -5
  94. package/_cjs/Subject/Atomic.cjs.map +1 -1
  95. package/_cjs/TReentrantLock/api.cjs +2 -2
  96. package/_cjs/TReentrantLock/api.cjs.map +1 -1
  97. package/_cjs/TSemaphore/api.cjs +1 -1
  98. package/_cjs/TSemaphore/api.cjs.map +1 -1
  99. package/_cjs/collection/immutable/Conc/dropUntilIO.cjs +12 -17
  100. package/_cjs/collection/immutable/Conc/dropUntilIO.cjs.map +1 -1
  101. package/_cjs/collection/immutable/Conc/dropWhileIO.cjs +12 -17
  102. package/_cjs/collection/immutable/Conc/dropWhileIO.cjs.map +1 -1
  103. package/_cjs/collection/immutable/Conc/filterIO.cjs +2 -12
  104. package/_cjs/collection/immutable/Conc/filterIO.cjs.map +1 -1
  105. package/_cjs/collection/immutable/Conc/mapIO.cjs +3 -9
  106. package/_cjs/collection/immutable/Conc/mapIO.cjs.map +1 -1
  107. package/_cjs/collection/immutable/Conc/takeWhileIO.cjs +11 -27
  108. package/_cjs/collection/immutable/Conc/takeWhileIO.cjs.map +1 -1
  109. package/_mjs/Channel/api/runScoped.mjs +1 -1
  110. package/_mjs/Channel/api/runScoped.mjs.map +1 -1
  111. package/_mjs/Channel/api.mjs +2 -2
  112. package/_mjs/Channel/api.mjs.map +1 -1
  113. package/_mjs/Fiber/FiberRuntime.mjs +111 -100
  114. package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
  115. package/_mjs/Fiber/constructors.mjs +7 -1
  116. package/_mjs/Fiber/constructors.mjs.map +1 -1
  117. package/_mjs/Future/api.mjs +1 -1
  118. package/_mjs/Future/api.mjs.map +1 -1
  119. package/_mjs/IO/api/all.mjs +24 -0
  120. package/_mjs/IO/api/all.mjs.map +1 -0
  121. package/_mjs/IO/api/asyncIO.mjs +1 -1
  122. package/_mjs/IO/api/asyncIO.mjs.map +1 -1
  123. package/_mjs/IO/api/bracketExit.mjs +1 -1
  124. package/_mjs/IO/api/bracketExit.mjs.map +1 -1
  125. package/_mjs/IO/api/concurrency.mjs +19 -2
  126. package/_mjs/IO/api/concurrency.mjs.map +1 -1
  127. package/_mjs/IO/api/disconnect.mjs +1 -1
  128. package/_mjs/IO/api/disconnect.mjs.map +1 -1
  129. package/_mjs/IO/api/foreachConcurrent.mjs +1 -1
  130. package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
  131. package/_mjs/IO/api/foreachExec.mjs +1 -1
  132. package/_mjs/IO/api/foreachExec.mjs.map +1 -1
  133. package/_mjs/IO/api/forkIn.mjs +1 -1
  134. package/_mjs/IO/api/forkIn.mjs.map +1 -1
  135. package/_mjs/IO/api/forkScoped.mjs +1 -1
  136. package/_mjs/IO/api/forkScoped.mjs.map +1 -1
  137. package/_mjs/IO/api/fulfill.mjs +1 -1
  138. package/_mjs/IO/api/fulfill.mjs.map +1 -1
  139. package/_mjs/IO/api/interrupt.mjs +19 -7
  140. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  141. package/_mjs/IO/api/raceWith.mjs +4 -4
  142. package/_mjs/IO/api/raceWith.mjs.map +1 -1
  143. package/_mjs/IO/api/timeout.mjs +8 -5
  144. package/_mjs/IO/api/timeout.mjs.map +1 -1
  145. package/_mjs/IO/api/zipConcurrent.mjs +1 -1
  146. package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
  147. package/_mjs/IO/api.mjs +78 -23
  148. package/_mjs/IO/api.mjs.map +1 -1
  149. package/_mjs/IO/definition.mjs +12 -181
  150. package/_mjs/IO/definition.mjs.map +1 -1
  151. package/_mjs/IO.mjs +1 -0
  152. package/_mjs/IO.mjs.map +1 -1
  153. package/_mjs/Layer/MemoMap.mjs +1 -1
  154. package/_mjs/Layer/MemoMap.mjs.map +1 -1
  155. package/_mjs/Layer/api.mjs.map +1 -1
  156. package/_mjs/Push/api.mjs +223 -166
  157. package/_mjs/Push/api.mjs.map +1 -1
  158. package/_mjs/Push/definition.mjs +9 -10
  159. package/_mjs/Push/definition.mjs.map +1 -1
  160. package/_mjs/Push/internal.mjs +33 -22
  161. package/_mjs/Push/internal.mjs.map +1 -1
  162. package/_mjs/RefSubject/Atomic.mjs +15 -19
  163. package/_mjs/RefSubject/Atomic.mjs.map +1 -1
  164. package/_mjs/RefSubject/Synchronized/definition.mjs +9 -10
  165. package/_mjs/RefSubject/Synchronized/definition.mjs.map +1 -1
  166. package/_mjs/RefSubject/api.mjs +6 -7
  167. package/_mjs/RefSubject/api.mjs.map +1 -1
  168. package/_mjs/RefSubject/definition.mjs.map +1 -1
  169. package/_mjs/STM/api/atomically.mjs +1 -1
  170. package/_mjs/STM/api/atomically.mjs.map +1 -1
  171. package/_mjs/STM/api.mjs +2 -2
  172. package/_mjs/STM/api.mjs.map +1 -1
  173. package/_mjs/STM/definition.mjs +1 -1
  174. package/_mjs/STM/definition.mjs.map +1 -1
  175. package/_mjs/ScopedRef/api.mjs +2 -2
  176. package/_mjs/ScopedRef/api.mjs.map +1 -1
  177. package/_mjs/Semaphore.mjs +1 -1
  178. package/_mjs/Semaphore.mjs.map +1 -1
  179. package/_mjs/Sink/api.mjs +10 -10
  180. package/_mjs/Sink/api.mjs.map +1 -1
  181. package/_mjs/Subject/Atomic.mjs +4 -5
  182. package/_mjs/Subject/Atomic.mjs.map +1 -1
  183. package/_mjs/TReentrantLock/api.mjs +2 -2
  184. package/_mjs/TReentrantLock/api.mjs.map +1 -1
  185. package/_mjs/TSemaphore/api.mjs +1 -1
  186. package/_mjs/TSemaphore/api.mjs.map +1 -1
  187. package/_mjs/collection/immutable/Conc/dropUntilIO.mjs +12 -17
  188. package/_mjs/collection/immutable/Conc/dropUntilIO.mjs.map +1 -1
  189. package/_mjs/collection/immutable/Conc/dropWhileIO.mjs +12 -17
  190. package/_mjs/collection/immutable/Conc/dropWhileIO.mjs.map +1 -1
  191. package/_mjs/collection/immutable/Conc/filterIO.mjs +2 -12
  192. package/_mjs/collection/immutable/Conc/filterIO.mjs.map +1 -1
  193. package/_mjs/collection/immutable/Conc/mapIO.mjs +3 -9
  194. package/_mjs/collection/immutable/Conc/mapIO.mjs.map +1 -1
  195. package/_mjs/collection/immutable/Conc/takeWhileIO.mjs +11 -27
  196. package/_mjs/collection/immutable/Conc/takeWhileIO.mjs.map +1 -1
  197. package/_src/Channel/api.ts +3 -3
  198. package/_src/Fiber/FiberRuntime.ts +76 -75
  199. package/_src/Fiber/constructors.ts +5 -0
  200. package/_src/IO/api/all.ts +64 -0
  201. package/_src/IO/api/concurrency.ts +33 -0
  202. package/_src/IO/api/foreachExec.ts +2 -2
  203. package/_src/IO/api/interrupt.ts +20 -7
  204. package/_src/IO/api/raceWith.ts +4 -2
  205. package/_src/IO/api/timeout.ts +21 -1
  206. package/_src/IO/api.ts +79 -27
  207. package/_src/IO/definition.ts +155 -200
  208. package/_src/IO.ts +1 -0
  209. package/_src/Layer/api.ts +0 -1
  210. package/_src/Push/api.ts +305 -304
  211. package/_src/Push/definition.ts +19 -17
  212. package/_src/Push/internal.ts +63 -31
  213. package/_src/RefSubject/Atomic.ts +16 -22
  214. package/_src/RefSubject/Synchronized/definition.ts +6 -9
  215. package/_src/RefSubject/api.ts +9 -12
  216. package/_src/RefSubject/definition.ts +6 -8
  217. package/_src/STM/api.ts +0 -5
  218. package/_src/STM/definition.ts +8 -2
  219. package/_src/Sink/api.ts +9 -9
  220. package/_src/Subject/Atomic.ts +6 -8
  221. package/_src/Subject/definition.ts +2 -2
  222. package/_src/collection/immutable/Conc/dropUntilIO.ts +18 -15
  223. package/_src/collection/immutable/Conc/dropWhileIO.ts +18 -17
  224. package/_src/collection/immutable/Conc/filterIO.ts +1 -11
  225. package/_src/collection/immutable/Conc/mapIO.ts +2 -9
  226. package/_src/collection/immutable/Conc/takeWhileIO.ts +19 -28
  227. package/collection/immutable/Conc/filterIO.d.ts +1 -1
  228. package/collection/immutable/Conc/mapIO.d.ts +1 -1
  229. package/collection/immutable/Conc/takeWhileIO.d.ts +1 -1
  230. package/package.json +2 -2
@@ -18,24 +18,24 @@ import { LogLevel } from "@fncts/io/LogLevel";
18
18
  import { Logger } from "@fncts/io/Logger/definition";
19
19
  import type { FiberStatus } from "../FiberStatus.js";
20
20
  import type { OnFailure, OnSuccess, OnSuccessAndFailure, UIO } from "../IO/definition.js";
21
+ import type { WhileLoop } from "../IO/definition.js";
21
22
  import type { RuntimeFlags } from "../RuntimeFlags.js";
22
23
  import { Trace } from "@fncts/base/data/Trace";
23
24
  import { FiberTypeId, FiberVariance } from "@fncts/io/Fiber/definition";
24
- import { WhileLoop } from "../IO/definition.js";
25
- import { IOOpCode } from "../IO/definition.js";
25
+ import { IOTag } from "../IO/definition.js";
26
26
  import { FiberMessage } from "./FiberMessage.js";
27
27
  export declare class RevertFlags {
28
28
  readonly patch: RuntimeFlags.Patch;
29
29
  readonly trace?: string | undefined;
30
- readonly _tag = IOOpCode.RevertFlags;
30
+ readonly _tag = IOTag.RevertFlags;
31
31
  constructor(patch: RuntimeFlags.Patch, trace?: string | undefined);
32
32
  }
33
33
  export declare class UpdateTrace {
34
34
  readonly trace?: string | undefined;
35
- readonly _tag = IOOpCode.UpdateTrace;
35
+ readonly _tag = IOTag.UpdateTrace;
36
36
  constructor(trace?: string | undefined);
37
37
  }
38
- export type Continuation = OnSuccess<any, any, any, any, any, any> | OnSuccessAndFailure<any, any, any, any, any, any, any, any, any> | OnFailure<any, any, any, any, any, any> | WhileLoop<any, any, any> | UpdateTrace | RevertFlags;
38
+ export type Continuation = OnSuccess | OnSuccessAndFailure | OnFailure | WhileLoop | UpdateTrace | RevertFlags;
39
39
  /**
40
40
  * @tsplus type fncts.io.Fiber
41
41
  */
@@ -108,7 +108,7 @@ export declare class FiberRuntime<E, A> implements Fiber.Runtime<E, A> {
108
108
  location: string | undefined;
109
109
  get status(): UIO<FiberStatus>;
110
110
  get trace(): UIO<Trace>;
111
- getNextSuccessCont(): OnSuccessAndFailure<any, any, any, any, any, any, any, any, any> | OnSuccess<any, any, any, any, any, any> | WhileLoop<any, any, any> | RevertFlags | UpdateTrace | undefined;
112
- getNextFailCont(): OnSuccessAndFailure<any, any, any, any, any, any, any, any, any> | OnFailure<any, any, any, any, any, any> | RevertFlags | UpdateTrace | undefined;
111
+ getNextSuccessCont(): OnSuccessAndFailure | OnSuccess | WhileLoop | RevertFlags | UpdateTrace | undefined;
112
+ getNextFailCont(): OnSuccessAndFailure | OnFailure | RevertFlags | UpdateTrace | undefined;
113
113
  isFatal(t: unknown): boolean;
114
114
  }
@@ -27,3 +27,8 @@ export declare function interrupted(id: FiberId, __tsplusTrace?: string): Fiber<
27
27
  * @tsplus location "@fncts/io/Fiber/constructors"
28
28
  */
29
29
  export declare function succeed<A>(a: A, __tsplusTrace?: string): Fiber<never, A>;
30
+ /**
31
+ * @tsplus static fncts.io.FiberOps unit
32
+ * @tsplus location "@fncts/io/Fiber/constructors"
33
+ */
34
+ export declare const unit: Fiber<never, void>;
@@ -0,0 +1,41 @@
1
+ import { IO } from "@fncts/io/IO/definition";
2
+ import { Conc } from "@fncts/base/collection/immutable/Conc";
3
+ import type { EnvironmentOf, ErrorOf, ValueOf } from "@fncts/io/IO";
4
+ /**
5
+ * @tsplus static fncts.io.IOOps all
6
+ * @tsplus location "@fncts/io/IO/api/all"
7
+ */
8
+ export declare function all<T extends ReadonlyArray<IO<any, any, any>>>(ios: [...T]): IO<{
9
+ [K in number]: EnvironmentOf<T[K]>;
10
+ }[number], {
11
+ [K in number]: ErrorOf<T[K]>;
12
+ }[number], {
13
+ [K in keyof T]: ValueOf<T[K]>;
14
+ }>;
15
+ export declare function all<T extends Iterable<IO<any, any, any>>>(ios: T): [T] extends [Iterable<infer A>] ? IO<EnvironmentOf<A>, ErrorOf<A>, Conc<ValueOf<A>>> : never;
16
+ export declare function all<T extends Record<string, IO<any, any, any>>>(ios: T): IO<{
17
+ [K in keyof T]: EnvironmentOf<T[K]>;
18
+ }[keyof T], {
19
+ [K in keyof T]: ErrorOf<T[K]>;
20
+ }[keyof T], {
21
+ [K in keyof T]: ValueOf<T[K]>;
22
+ }>;
23
+ /**
24
+ * @tsplus static fncts.io.IOOps allConcurrent
25
+ * @tsplus location "@fncts/io/IO/api/all"
26
+ */
27
+ export declare function allConcurrent<T extends ReadonlyArray<IO<any, any, any>>>(ios: [...T]): IO<{
28
+ [K in number]: EnvironmentOf<T[K]>;
29
+ }[number], {
30
+ [K in number]: ErrorOf<T[K]>;
31
+ }[number], {
32
+ [K in keyof T]: ValueOf<T[K]>;
33
+ }>;
34
+ export declare function allConcurrent<T extends Iterable<IO<any, any, any>>>(ios: T): [T] extends [Iterable<infer A>] ? IO<EnvironmentOf<A>, ErrorOf<A>, Conc<ValueOf<A>>> : never;
35
+ export declare function allConcurrent<T extends Record<string, IO<any, any, any>>>(ios: T): IO<{
36
+ [K in keyof T]: EnvironmentOf<T[K]>;
37
+ }[keyof T], {
38
+ [K in keyof T]: ErrorOf<T[K]>;
39
+ }[keyof T], {
40
+ [K in keyof T]: ValueOf<T[K]>;
41
+ }>;
@@ -33,3 +33,14 @@ export declare function withConcurrency(n: number, __tsplusTrace?: string): <R,
33
33
  * @tsplus location "@fncts/io/IO/api/concurrency"
34
34
  */
35
35
  export declare function withConcurrencyUnbounded<R, E, A>(ma: IO<R, E, A>, __tsplusTrace?: string): IO<R, E, A>;
36
+ export type ConcurrencyRestorer = <R, E, A>(io: IO<R, E, A>) => IO<R, E, A>;
37
+ /**
38
+ * @tsplus static fncts.io.IOOps withConcurrencyMask
39
+ * @tsplus location "@fncts/io/IO/api/concurrency"
40
+ */
41
+ export declare function withConcurrencyMask<R, E, A>(n: number, f: (restore: ConcurrencyRestorer) => IO<R, E, A>): IO<R, E, A>;
42
+ /**
43
+ * @tsplus static fncts.io.IOOps withConcurrencyUnboundedMask
44
+ * @tsplus location "@fncts/io/IO/api/concurrency"
45
+ */
46
+ export declare function withConcurrencyUnboundedMask<R, E, A>(f: (restore: ConcurrencyRestorer) => IO<R, E, A>): IO<R, E, A>;
@@ -51,7 +51,7 @@ export declare function uninterruptible<R, E, A>(self: IO<R, E, A>, __tsplusTrac
51
51
  * @tsplus static fncts.io.IOOps uninterruptibleMask
52
52
  * @tsplus location "@fncts/io/IO/api/interrupt"
53
53
  */
54
- export declare function uninterruptibleMask<R, E, A>(f: (restore: InterruptibilityRestorer) => IO<R, E, A>): IO<R, E, A>;
54
+ export declare function uninterruptibleMask<R, E, A>(f: (restore: InterruptibilityRestorer) => IO<R, E, A>, __tsplusTrace?: string): IO<R, E, A>;
55
55
  /**
56
56
  * @tsplus pipeable fncts.io.IO ensuring
57
57
  * @tsplus location "@fncts/io/IO/api/interrupt"
@@ -1,5 +1,6 @@
1
1
  import { Lazy } from "@fncts/base/data/function/definition";
2
2
  import { IO } from "@fncts/io/IO/definition";
3
+ import { FiberScope } from "@fncts/io/FiberScope";
3
4
  import { Exit } from "@fncts/base/data/Exit/definition";
4
5
  import { Fiber } from "@fncts/io/Fiber/definition";
5
6
  import type { FiberRuntime } from "@fncts/io/Fiber/FiberRuntime";
@@ -7,7 +8,7 @@ import type { FiberRuntime } from "@fncts/io/Fiber/FiberRuntime";
7
8
  * @tsplus pipeable fncts.io.IO raceFibersWith
8
9
  * @tsplus location "@fncts/io/IO/api/raceWith"
9
10
  */
10
- export declare function raceFibersWith<R, E, A, R1, E1, B, R2, E2, C, R3, E3, D>(right: Lazy<IO<R1, E1, B>>, leftWins: (winner: FiberRuntime<E, A>, loser: FiberRuntime<E1, B>) => IO<R2, E2, C>, rightWins: (winner: FiberRuntime<E1, B>, loser: FiberRuntime<E, A>) => IO<R3, E3, D>, __tsplusTrace?: string): (left: IO<R, E, A>) => IO<R | R1 | R2 | R3, E2 | E3, C | D>;
11
+ export declare function raceFibersWith<R, E, A, R1, E1, B, R2, E2, C, R3, E3, D>(right: Lazy<IO<R1, E1, B>>, leftWins: (winner: FiberRuntime<E, A>, loser: FiberRuntime<E1, B>) => IO<R2, E2, C>, rightWins: (winner: FiberRuntime<E1, B>, loser: FiberRuntime<E, A>) => IO<R3, E3, D>, leftScope?: FiberScope | null, rightScope?: FiberScope | null, __tsplusTrace?: string): (left: IO<R, E, A>) => IO<R | R1 | R2 | R3, E2 | E3, C | D>;
11
12
  /**
12
13
  * Returns an effect that races this effect with the specified effect, calling
13
14
  * the specified finisher as soon as one result or the other has been computed.
package/IO/api.d.ts CHANGED
@@ -194,14 +194,14 @@ export declare function condIO<R, R1, E, A>(b: boolean, onTrue: URIO<R, A>, onFa
194
194
  * @tsplus static fncts.io.IOOps defer
195
195
  * @tsplus location "@fncts/io/IO/api"
196
196
  */
197
- export declare function defer<R, E, A>(io: Lazy<IO<R, E, A>>, __tsplusTrace?: string): IO<R, E, A>;
197
+ export declare function defer<R = never, E = never, A = never>(io: Lazy<IO<R, E, A>>, __tsplusTrace?: string): IO<R, E, A>;
198
198
  /**
199
199
  * Returns a lazily constructed effect, whose construction may itself require effects.
200
200
  * When no environment is required (i.e., when R == unknown) it is conceptually equivalent to `flatten(try(io))`.
201
201
  * @tsplus static fncts.io.IOOps deferTry
202
202
  * @tsplus location "@fncts/io/IO/api"
203
203
  */
204
- export declare function deferTry<R, E, A>(io: () => IO<R, E, A>, __tsplusTrace?: string): IO<R, unknown, A>;
204
+ export declare function deferTry<R = never, E = never, A = never>(io: () => IO<R, E, A>, __tsplusTrace?: string): IO<R, unknown, A>;
205
205
  /**
206
206
  * Returns a lazily constructed effect, whose construction may itself require effects,
207
207
  * translating any thrown exceptions into typed failed effects and mapping the error.
@@ -903,6 +903,11 @@ export declare function swapWith<R, E, A, R1, E1, A1>(f: (ma: IO<R, A, E>) => IO
903
903
  * @tsplus location "@fncts/io/IO/api"
904
904
  */
905
905
  export declare function timedWith<R1, E1>(msTime: IO<R1, E1, number>, __tsplusTrace?: string): <R, E, A>(ma: IO<R, E, A>) => IO<R1 | R, E1 | E, readonly [number, A]>;
906
+ /**
907
+ * @tsplus static fncts.io.IOOps attempt
908
+ * @tsplus location "@fncts/io/IO/api"
909
+ */
910
+ export declare function attempt<A>(effect: Lazy<A>, __tsplusTrace?: string): FIO<unknown, A>;
906
911
  /**
907
912
  * Creates a `IO` that has succeeded with a pure value
908
913
  * @tsplus static fncts.io.IOOps tryCatch
@@ -2,16 +2,14 @@ import { HKT } from "@fncts/typelevel/HKT";
2
2
  import { NoSuchElementError } from "@fncts/base/data/exceptions";
3
3
  import { FiberId } from "@fncts/base/data/FiberId/definition";
4
4
  import { Cause } from "@fncts/base/data/Cause/definition";
5
- import { Lazy } from "@fncts/base/data/function/definition";
6
5
  import { STM } from "@fncts/io/STM/definition";
7
6
  import { Nothing, Just } from "@fncts/base/data/Maybe/definition";
8
7
  import type { FiberRuntime } from "../Fiber/FiberRuntime.js";
9
8
  import type { Running } from "../FiberStatus.js";
10
9
  import type { RuntimeFlagsPatch } from "../RuntimeFlags.js";
10
+ import type { RuntimeFlags } from "../RuntimeFlags.js";
11
11
  import type { Left, Right } from "@fncts/base/data/Either";
12
12
  import type { Failure, Success } from "@fncts/base/data/Exit";
13
- import type { Trace } from "@fncts/base/data/Trace";
14
- import { RuntimeFlags } from "../RuntimeFlags.js";
15
13
  export declare const IOVariance: unique symbol;
16
14
  export type IOVariance = typeof IOVariance;
17
15
  export declare const IOTypeId: unique symbol;
@@ -36,6 +34,21 @@ export declare abstract class IO<R, E, A> {
36
34
  _A: () => A;
37
35
  };
38
36
  }
37
+ export type EnvironmentOf<T> = [T] extends [{
38
+ [IOVariance]: {
39
+ _R: () => infer R;
40
+ };
41
+ }] ? R : never;
42
+ export type ErrorOf<T> = [T] extends [{
43
+ [IOVariance]: {
44
+ _E: () => infer E;
45
+ };
46
+ }] ? E : never;
47
+ export type ValueOf<T> = [T] extends [{
48
+ [IOVariance]: {
49
+ _A: () => infer A;
50
+ };
51
+ }] ? A : never;
39
52
  declare module "@fncts/base/data/Either/definition" {
40
53
  interface Either<E, A> extends IO<never, E, A> {
41
54
  }
@@ -85,7 +98,7 @@ export declare function unifyIO<X extends IO<any, any, any>>(self: X): IO<[
85
98
  export type UIO<A> = IO<never, never, A>;
86
99
  export type URIO<R, A> = IO<R, never, A>;
87
100
  export type FIO<E, A> = IO<never, E, A>;
88
- export declare const enum IOOpCode {
101
+ export declare const enum IOTag {
89
102
  SucceedNow = 0,
90
103
  Fail = 1,
91
104
  Sync = 2,
@@ -103,133 +116,96 @@ export declare const enum IOOpCode {
103
116
  RevertFlags = 14,
104
117
  UpdateTrace = 15
105
118
  }
106
- export declare function isIO(u: unknown): u is IO<any, any, any>;
107
- export declare class Sync<A> extends IO<never, never, A> {
108
- readonly evaluate: () => A;
109
- readonly trace?: string | undefined;
110
- readonly _tag = IOOpCode.Sync;
111
- constructor(evaluate: () => A, trace?: string | undefined);
112
- }
113
- export declare class Async<R, E, A> extends IO<R, E, A> {
114
- readonly registerCallback: (f: (_: IO<R, E, A>) => void) => any;
115
- readonly blockingOn: () => FiberId;
116
- readonly trace?: string | undefined;
117
- readonly _tag = IOOpCode.Async;
118
- constructor(registerCallback: (f: (_: IO<R, E, A>) => void) => any, blockingOn: () => FiberId, trace?: string | undefined);
119
+ export type IOOp<Tag extends string | number, Body = {}> = IO<never, never, never> & Body & {
120
+ readonly _tag: Tag;
121
+ };
122
+ export declare class IOPrimitive {
123
+ readonly _tag: Primitive["_tag"];
124
+ i0: any;
125
+ i1: any;
126
+ i2: any;
127
+ trace: string | undefined;
128
+ [IOTypeId]: symbol;
129
+ constructor(_tag: Primitive["_tag"]);
119
130
  }
120
- /**
121
- * @internal
122
- */
123
- export declare class OnSuccessAndFailure<R, E, A, R1, E1, B, R2, E2, C> extends IO<R | R1 | R2, E1 | E2, B | C> {
124
- readonly first: IO<R, E, A>;
125
- readonly failureK: (cause: Cause<E>) => IO<R1, E1, B>;
126
- readonly successK: (a: A) => IO<R2, E2, C>;
127
- readonly trace?: string | undefined;
128
- readonly _tag = IOOpCode.OnSuccessAndFailure;
129
- constructor(first: IO<R, E, A>, failureK: (cause: Cause<E>) => IO<R1, E1, B>, successK: (a: A) => IO<R2, E2, C>, trace?: string | undefined);
130
- onFailure(c: Cause<E>): IO<R | R1 | R2, E1 | E2, B | C>;
131
- onSuccess(a: A): IO<R | R1 | R2, E1 | E2, B | C>;
132
- }
133
- export declare class OnFailure<R, E, A, R1, E1, B> extends IO<R | R1, E1, A | B> {
134
- readonly first: IO<R, E, A>;
135
- readonly failureK: (cause: Cause<E>) => IO<R1, E1, B>;
136
- readonly trace?: string | undefined;
137
- readonly _tag = IOOpCode.OnFailure;
138
- constructor(first: IO<R, E, A>, failureK: (cause: Cause<E>) => IO<R1, E1, B>, trace?: string | undefined);
139
- onFailure(c: Cause<E>): IO<R | R1, E1, A | B>;
140
- onSuccess(a: A): IO<R | R1, E1, A | B>;
141
- }
142
- /**
143
- * @internal
144
- */
145
- export declare class OnSuccess<R, R1, E, E1, A, A1> extends IO<R | R1, E | E1, A1> {
146
- readonly first: IO<R, E, A>;
147
- readonly successK: (a: A) => IO<R1, E1, A1>;
148
- readonly trace?: string | undefined;
149
- readonly _tag = IOOpCode.OnSuccess;
150
- constructor(first: IO<R, E, A>, successK: (a: A) => IO<R1, E1, A1>, trace?: string | undefined);
151
- onFailure(c: Cause<E>): IO<R | R1, E | E1, A1>;
152
- onSuccess(a: A): IO<R | R1, E | E1, A1>;
153
- }
154
- /**
155
- * @internal
156
- */
157
- export declare class SucceedNow<A> extends IO<never, never, A> {
158
- readonly value: A;
159
- readonly trace?: string | undefined;
160
- readonly _tag = IOOpCode.SucceedNow;
161
- constructor(value: A, trace?: string | undefined);
162
- }
163
- export declare class UpdateRuntimeFlags extends IO<never, never, void> {
164
- readonly update: RuntimeFlags.Patch;
165
- readonly trace?: string | undefined;
166
- readonly _tag = IOOpCode.UpdateRuntimeFlags;
167
- constructor(update: RuntimeFlags.Patch, trace?: string | undefined);
168
- }
169
- export declare class Interruptible<R, E, A> extends IO<R, E, A> {
170
- readonly effect: IO<R, E, A>;
171
- readonly trace?: string | undefined;
172
- readonly _tag = IOOpCode.UpdateRuntimeFlagsWithin;
173
- constructor(effect: IO<R, E, A>, trace?: string | undefined);
174
- readonly update: RuntimeFlags.Patch;
175
- scope(oldRuntimeFlags: RuntimeFlags): IO<R, E, A>;
176
- }
177
- export declare class Uninterruptible<R, E, A> extends IO<R, E, A> {
178
- readonly effect: IO<R, E, A>;
179
- readonly trace?: string | undefined;
180
- readonly _tag = IOOpCode.UpdateRuntimeFlagsWithin;
181
- constructor(effect: IO<R, E, A>, trace?: string | undefined);
182
- readonly update: RuntimeFlags.Patch;
183
- scope(oldRuntimeFlags: RuntimeFlags): IO<R, E, A>;
184
- }
185
- export declare class Dynamic<R, E, A> extends IO<R, E, A> {
186
- readonly update: RuntimeFlagsPatch;
187
- readonly f: (oldRuntimeFlags: RuntimeFlags) => IO<R, E, A>;
188
- readonly trace?: string | undefined;
189
- readonly _tag = IOOpCode.UpdateRuntimeFlagsWithin;
190
- constructor(update: RuntimeFlagsPatch, f: (oldRuntimeFlags: RuntimeFlags) => IO<R, E, A>, trace?: string | undefined);
191
- scope(oldRuntimeFlags: RuntimeFlags): IO<R, E, A>;
192
- }
193
- export declare class GenerateStackTrace extends IO<never, never, Trace> {
194
- readonly trace?: string | undefined;
195
- readonly _tag = IOOpCode.GenerateStackTrace;
196
- constructor(trace?: string | undefined);
197
- }
198
- export declare class Stateful<R, E, A> extends IO<R, E, A> {
199
- readonly onState: (fiber: FiberRuntime<E, A>, status: Running) => IO<R, E, A>;
200
- readonly trace?: string | undefined;
201
- readonly _tag = IOOpCode.Stateful;
202
- constructor(onState: (fiber: FiberRuntime<E, A>, status: Running) => IO<R, E, A>, trace?: string | undefined);
203
- }
204
- export declare class WhileLoop<R, E, A> extends IO<R, E, void> {
205
- readonly check: () => boolean;
206
- readonly body: () => IO<R, E, A>;
207
- readonly process: (a: A) => any;
208
- readonly trace?: string | undefined;
209
- readonly _tag = IOOpCode.WhileLoop;
210
- constructor(check: () => boolean, body: () => IO<R, E, A>, process: (a: A) => any, trace?: string | undefined);
211
- }
212
- export declare class YieldNow extends IO<never, never, void> {
213
- readonly trace?: string | undefined;
214
- readonly _tag = IOOpCode.YieldNow;
215
- constructor(trace?: string | undefined);
216
- }
217
- /**
218
- * @internal
219
- */
220
- export declare class Fail<E> extends IO<never, E, never> {
221
- readonly cause: Lazy<Cause<E>>;
222
- readonly trace?: string | undefined;
223
- readonly _tag = IOOpCode.Fail;
224
- constructor(cause: Lazy<Cause<E>>, trace?: string | undefined);
225
- }
226
- export type Concrete = OnSuccessAndFailure<any, any, any, any, any, any, any, any, any> | OnFailure<any, any, any, any, any, any> | OnSuccess<any, any, any, any, any, any> | UpdateRuntimeFlagsWithin | Sync<any> | Async<any, any, any> | SucceedNow<any> | UpdateRuntimeFlags | GenerateStackTrace | Stateful<any, any, any> | WhileLoop<any, any, any> | YieldNow | Fail<any> | STM<any, any, any> | Left<any> | Right<any> | Nothing | Just<any> | Failure<any> | Success<any>;
131
+ export declare function isIO(u: unknown): u is IO<any, any, any>;
132
+ export interface Sync<A = any> extends IOOp<IOTag.Sync, {
133
+ readonly i0: () => A;
134
+ readonly trace: string | undefined;
135
+ }> {
136
+ }
137
+ export interface Async<R = any, E = any, A = any> extends IOOp<IOTag.Async, {
138
+ readonly i0: (resume: (io: Primitive) => void) => void;
139
+ readonly i1: () => FiberId;
140
+ readonly trace: string | undefined;
141
+ }> {
142
+ }
143
+ export interface OnSuccessAndFailure extends IOOp<IOTag.OnSuccessAndFailure, {
144
+ readonly i0: Primitive;
145
+ readonly i1: (cause: Cause<unknown>) => Primitive;
146
+ readonly i2: (a: unknown) => Primitive;
147
+ readonly trace: string | undefined;
148
+ }> {
149
+ }
150
+ export interface OnFailure extends IOOp<IOTag.OnFailure, {
151
+ readonly i0: Primitive;
152
+ readonly i1: (cause: Cause<unknown>) => Primitive;
153
+ readonly trace: string | undefined;
154
+ }> {
155
+ }
156
+ export interface OnSuccess extends IOOp<IOTag.OnSuccess, {
157
+ readonly i0: Primitive;
158
+ readonly i1: (a: unknown) => Primitive;
159
+ readonly trace: string | undefined;
160
+ }> {
161
+ }
162
+ export interface SucceedNow extends IOOp<IOTag.SucceedNow, {
163
+ readonly i0: any;
164
+ readonly trace: string | undefined;
165
+ }> {
166
+ }
167
+ export interface UpdateRuntimeFlags extends IOOp<IOTag.UpdateRuntimeFlags, {
168
+ readonly i0: RuntimeFlags.Patch;
169
+ readonly trace: string | undefined;
170
+ }> {
171
+ }
172
+ export interface UpdateRuntimeFlagsWithin extends IOOp<IOTag.UpdateRuntimeFlagsWithin, {
173
+ readonly i0: RuntimeFlagsPatch;
174
+ readonly i1: (oldRuntimeFlags: RuntimeFlags) => Primitive;
175
+ readonly trace: string | undefined;
176
+ }> {
177
+ }
178
+ export interface GenerateStackTrace extends IOOp<IOTag.GenerateStackTrace, {
179
+ readonly trace: string | undefined;
180
+ }> {
181
+ }
182
+ export interface Stateful extends IOOp<IOTag.Stateful, {
183
+ readonly i0: (fiber: FiberRuntime<any, any>, status: Running) => Primitive;
184
+ readonly trace: string | undefined;
185
+ }> {
186
+ }
187
+ export interface WhileLoop extends IOOp<IOTag.WhileLoop, {
188
+ readonly i0: () => boolean;
189
+ readonly i1: () => Primitive;
190
+ readonly i2: (a: any) => any;
191
+ readonly trace: string | undefined;
192
+ }> {
193
+ }
194
+ export interface YieldNow extends IOOp<IOTag.YieldNow, {
195
+ readonly trace: string | undefined;
196
+ }> {
197
+ }
198
+ export interface Fail extends IOOp<IOTag.Fail, {
199
+ readonly i0: () => Cause<unknown>;
200
+ readonly trace: string | undefined;
201
+ }> {
202
+ }
203
+ export type Primitive = OnSuccessAndFailure | OnFailure | OnSuccess | UpdateRuntimeFlagsWithin | Sync | Async | SucceedNow | UpdateRuntimeFlags | GenerateStackTrace | Stateful | WhileLoop | YieldNow | Fail | STM<any, any, any> | Left<any> | Right<any> | Nothing | Just<any> | Failure<any> | Success<any>;
227
204
  /**
228
205
  * @tsplus static fncts.io.IOOps concrete
229
206
  * @tsplus macro identity
230
207
  * @tsplus location "@fncts/io/IO/definition"
231
208
  */
232
- export declare function concrete(io: IO<any, any, any>): Concrete;
233
- export type EvaluationStep = OnSuccessAndFailure<any, any, any, any, any, any, any, any, any> | OnFailure<any, any, any, any, any, any> | OnSuccess<any, any, any, any, any, any>;
234
- export type UpdateRuntimeFlagsWithin = Interruptible<any, any, any> | Uninterruptible<any, any, any> | Dynamic<any, any, any>;
209
+ export declare function concrete(io: IO<any, any, any>): Primitive;
210
+ export type EvaluationStep = OnSuccessAndFailure | OnFailure | OnSuccess;
235
211
  export type Canceler<R> = URIO<R, void>;
package/IO.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./IO/api/acquireReleaseInterruptible.js";
7
7
  export * from "./IO/api/acquireReleaseInterruptibleExit.js";
8
8
  export * from "./IO/api/addFinalizer.js";
9
9
  export * from "./IO/api/addFinalizerExit.js";
10
+ export * from "./IO/api/all.js";
10
11
  export * from "./IO/api/asyncInterrupt.js";
11
12
  export * from "./IO/api/asyncIO.js";
12
13
  export * from "./IO/api/blocking.js";
package/Push/api.d.ts CHANGED
@@ -1,29 +1,44 @@
1
1
  import { Lazy } from "@fncts/base/data/function/definition";
2
+ import { Cause } from "@fncts/base/data/Cause/definition";
3
+ import { Either } from "@fncts/base/data/Either/definition";
2
4
  import { Duration } from "@fncts/base/data/Duration/definition";
3
- import { Fiber } from "@fncts/io/Fiber/definition";
4
- import { IO } from "@fncts/io/IO/definition";
5
+ import { Maybe, Nothing, Just } from "@fncts/base/data/Maybe/definition";
6
+ import { Refinement } from "@fncts/base/data/Refinement/definition";
7
+ import { Predicate } from "@fncts/base/data/Predicate/definition";
8
+ import { UIO, URIO } from "@fncts/io/IO/definition";
5
9
  import { Environment } from "@fncts/base/data/Environment/definition";
6
- import { Future } from "@fncts/io/Future";
10
+ import { Fiber } from "@fncts/io/Fiber/definition";
7
11
  import { Scope } from "@fncts/io/Scope/definition";
8
- import { Schedule } from "@fncts/io/Schedule/definition";
9
- import { Cause } from "@fncts/base/data/Cause/definition";
10
- import { Nothing, Just, Maybe } from "@fncts/base/data/Maybe/definition";
11
- import { FiberId } from "@fncts/base/data/FiberId/definition";
12
12
  import { Conc } from "@fncts/base/collection/immutable/Conc";
13
- import type { _A, _E, _R } from "@fncts/base/types";
13
+ import { Future } from "@fncts/io/Future";
14
14
  import { AtomicReference } from "@fncts/base/internal/AtomicReference";
15
- import { Emitter, Push, PushTypeId, PushVariance } from "./definition.js";
15
+ import { IO } from "@fncts/io/IO";
16
+ import { Push, PushTypeId, PushVariance, Sink } from "./definition.js";
16
17
  /**
17
18
  * @tsplus pipeable fncts.io.Push as
18
19
  * @tsplus location "@fncts/io/Push/api"
19
20
  */
20
21
  export declare function as<B>(b: Lazy<B>): <R, E, A>(self: Push<R, E, A>) => Push<R, E, B>;
22
+ interface UnsafeSink<E, A> {
23
+ event: (value: A) => void;
24
+ error: (cause: Cause<E>) => void;
25
+ }
26
+ /**
27
+ * @tsplus static fncts.io.PushOps asyncInterrupt
28
+ * @tsplus location "@fncts/io/Push/api"
29
+ */
30
+ export declare function asyncInterrupt<R, E, A>(make: (emitter: UnsafeSink<E, A>) => Either<IO<R, never, void>, Push<R, E, A>>): Push<R, E, A>;
31
+ /**
32
+ * @tsplus static fncts.io.PushOps async
33
+ * @tsplus location "@fncts/io/Push/api"
34
+ */
35
+ export declare function async<E, A>(make: (sink: UnsafeSink<E, A>) => void): Push<never, E, A>;
21
36
  /**
22
37
  * @tsplus static fncts.io.PushOps combineLatest
23
38
  * @tsplus location "@fncts/io/Push/api"
24
39
  */
25
- export declare function combineLatest<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<_R<A[number]>, _E<A[number]>, {
26
- [K in keyof A]: [A[K]] extends [Push<any, any, infer A>] ? A : never;
40
+ export declare function combineLatest<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<Push.EnvironmentOf<A[number]>, Push.ErrorOf<A[number]>, {
41
+ [K in keyof A]: Push.ValueOf<A[K]>;
27
42
  }>;
28
43
  export declare function combineLatest<R, E, A>(streams: Iterable<Push<R, E, A>>): Push<R, E, ReadonlyArray<A>>;
29
44
  /**
@@ -41,6 +56,37 @@ export declare function debounce(duration: Lazy<Duration>): <R, E, A>(self: Push
41
56
  * @tsplus location "@fncts/io/Push/api"
42
57
  */
43
58
  export declare function defer<R, E, A>(self: Lazy<Push<R, E, A>>): Push<R, E, A>;
59
+ /**
60
+ * @tsplus pipeable fncts.io.Push exhaustMap
61
+ * @tsplus location "@fncts/io/Push/api"
62
+ */
63
+ export declare function exhaustMap<A, R1, E1, B>(f: (a: A) => Push<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
64
+ /**
65
+ * @tsplus pipeable fncts.io.Push exhaustMapIO
66
+ * @tsplus location "@fncts/io/Push/api"
67
+ */
68
+ export declare function exhaustMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
69
+ /**
70
+ * @tsplus pipeable fncts.io.Push filterIO
71
+ * @tsplus location "@fncts/io/Push/api"
72
+ */
73
+ export declare function filterIO<A, R1, E1>(predicate: (a: A) => IO<R1, E1, boolean>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, A>;
74
+ /**
75
+ * @tsplus pipeable fncts.io.Push filterMapIO
76
+ * @tsplus location "@fncts/io/Push/api"
77
+ */
78
+ export declare function filterMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, Maybe<B>>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
79
+ /**
80
+ * @tsplus pipeable fncts.io.Push filter
81
+ * @tsplus location "@fncts/io/Push/api"
82
+ */
83
+ export declare function filter<A, B extends A>(refinement: Refinement<A, B>): <R, E>(self: Push<R, E, A>) => Push<R, E, B>;
84
+ export declare function filter<A>(predicate: Predicate<A>): <R, E>(self: Push<R, E, A>) => Push<R, E, A>;
85
+ /**
86
+ * @tsplus pipeable fncts.io.Push filterMap
87
+ * @tsplus location "@fncts/io/Push/api"
88
+ */
89
+ export declare function filterMap<A, B>(f: (a: A) => Maybe<B>): <R, E>(self: Push<R, E, A>) => Push<R, E, B>;
44
90
  /**
45
91
  * @tsplus pipeable fncts.io.Push flatMapConcurrentBounded
46
92
  * @tsplus location "@fncts/io/Push/api"
@@ -87,11 +133,10 @@ export declare function fromIterable<A>(iterable: Iterable<A>): Push<never, neve
87
133
  */
88
134
  export declare function multicast<R, E, A>(self: Push<R, E, A>): Push<R, E, A>;
89
135
  interface MulticastObserver<E, A> {
90
- readonly emitter: Emitter<any, E, A>;
136
+ readonly sink: Sink<any, E, A>;
91
137
  readonly environment: Environment<any>;
92
- readonly future: Future<never, void>;
93
138
  }
94
- export declare class Multicast<R, E, A> implements Push<R, E, A>, Emitter<never, E, A> {
139
+ export declare class Multicast<R, E, A> implements Push<R, E, A>, Sink<never, E, A> {
95
140
  readonly push: Push<R, E, A>;
96
141
  readonly [PushTypeId]: PushTypeId;
97
142
  [PushVariance]: {
@@ -102,14 +147,12 @@ export declare class Multicast<R, E, A> implements Push<R, E, A>, Emitter<never,
102
147
  protected observers: Array<MulticastObserver<E, A>>;
103
148
  protected fiber: Fiber<never, unknown> | undefined;
104
149
  constructor(push: Push<R, E, A>);
105
- run<R1>(emitter: Emitter<R1, E, A>): IO<R | R1 | Scope, never, unknown>;
106
- emit(value: A): import("../IO.js").IO<never, never, void>;
107
- failCause(cause: Cause<E>): import("../IO.js").IO<never, never, void>;
108
- get end(): import("../IO.js").IO<never, never, void>;
109
- protected runEvent(value: A, observer: MulticastObserver<E, A>): import("../IO.js").FIO<never, unknown>;
110
- protected runFailCause(cause: Cause<E>, observer: MulticastObserver<E, A>): import("../IO.js").FIO<never, boolean>;
111
- protected runEnd(observer: MulticastObserver<E, A>): import("../IO.js").FIO<never, boolean>;
112
- protected cleanup(): import("../IO.js").UIO<void>;
150
+ run<R1>(sink: Sink<R1, E, A>): IO<R | R1, never, void>;
151
+ event(value: A): IO<never, never, void>;
152
+ error(cause: Cause<E>): IO<never, never, void>;
153
+ protected runValue(value: A, observer: MulticastObserver<E, A>): IO<never, never, void>;
154
+ protected runError(cause: Cause<E>, observer: MulticastObserver<E, A>): IO<never, never, void>;
155
+ protected removeSink(sink: Sink<any, E, A>): IO<never, never, void>;
113
156
  }
114
157
  /**
115
158
  * @tsplus getter fncts.io.Push hold
@@ -117,19 +160,11 @@ export declare class Multicast<R, E, A> implements Push<R, E, A>, Emitter<never,
117
160
  */
118
161
  export declare function hold<R, E, A>(self: Push<R, E, A>): Push<R, E, A>;
119
162
  export declare class Hold<R, E, A> extends Multicast<R, E, A> {
120
- readonly push: Push<R, E, A>;
121
- readonly value: AtomicReference<import("@fncts/base/data/Maybe.js").Maybe<A>>;
122
- protected pendingEmitters: Array<readonly [Emitter<unknown, E, A>, Array<A>]>;
123
- protected scheduledFiber: Fiber<any, any> | null;
163
+ push: Push<R, E, A>;
164
+ readonly current: AtomicReference<import("@fncts/base/data/Maybe.js").Maybe<A>>;
124
165
  constructor(push: Push<R, E, A>);
125
- run<R1>(emitter: Emitter<R1, E, A>): IO<R | R1 | Scope, never, void>;
126
- emit(value: A): import("../IO.js").IO<never, never, void>;
127
- failCause(cause: Cause<E>): import("../IO.js").IO<never, never, void>;
128
- get end(): import("../IO.js").IO<never, never, void>;
129
- protected shouldScheduleFlush(): boolean;
130
- protected scheduleFlush<R>(observer: Emitter<R, E, A>): import("../IO.js").IO<import("../Scope.js").Scope, never, import("../Fiber.js").Fiber.Runtime<never, void>>;
131
- protected flushPending(): import("../IO.js").UIO<void>;
132
- protected addValue(value: A): void;
166
+ run<R1>(sink: Sink<R1, E, A>): IO<R | R1, never, void>;
167
+ event(value: A): IO<never, never, void>;
133
168
  }
134
169
  /**
135
170
  * @tsplus pipeable fncts.io.Push map 1
@@ -160,8 +195,13 @@ export declare function merge<R1, E1, B>(that: Push<R1, E1, B>): <R, E, A>(self:
160
195
  * @tsplus static fncts.io.PushOps mergeAll
161
196
  * @tsplus location "@fncts/io/Push/api"
162
197
  */
163
- export declare function mergeAll<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<_R<A[number]>, _E<A[number]>, _A<A[number]>>;
198
+ export declare function mergeAll<A extends ReadonlyArray<Push<any, any, any>>>(streams: [...A]): Push<Push.EnvironmentOf<A[number]>, Push.ErrorOf<A[number]>, Push.ValueOf<A[number]>>;
164
199
  export declare function mergeAll<R, E, A>(streams: Iterable<Push<R, E, A>>): Push<R, E, A>;
200
+ /**
201
+ * @tsplus pipeable fncts.io.Push observe
202
+ * @tsplus location "@fncts/io/Push/api"
203
+ */
204
+ export declare function observe<A, R1, E1>(f: (a: A) => IO<R1, E1, void>, __tsplusTrace?: string): <R, E>(self: Push<R, E, A>) => IO<import("../Scope.js").Scope | R1 | R, E1 | E, void>;
165
205
  /**
166
206
  * @tsplus static fncts.io.PushOps repeatIOMaybe
167
207
  * @tsplus location "@fncts/io/Push/api"
@@ -188,10 +228,20 @@ export declare function scoped<R, E, A>(io: Lazy<IO<R, E, A>>, __tsplusTrace?: s
188
228
  */
189
229
  export declare function succeed<A>(value: Lazy<A>): Push<never, never, A>;
190
230
  /**
191
- * @tsplus pipeable fncts.io.PushOps switchMap
231
+ * @tsplus pipeable fncts.io.Push switchMap
192
232
  * @tsplus location "@fncts/io/Push/api"
193
233
  */
194
234
  export declare function switchMap<A, R1, E1, B>(f: (a: A) => Push<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
235
+ /**
236
+ * @tsplus pipeable fncts.io.Push switchMapIO
237
+ * @tsplus location "@fncts/io/Push/api"
238
+ */
239
+ export declare function switchMapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, B>;
240
+ /**
241
+ * @tsplus pipeable fncts.io.Push tap
242
+ * @tsplus location "@fncts/io/Push/api"
243
+ */
244
+ export declare function tap<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: Push<R, E, A>) => Push<R1 | R, E1 | E, A>;
195
245
  /**
196
246
  * @tsplus pipeable fncts.io.Push transform
197
247
  * @tsplus location "@fncts/io/Push/api"