@fncts/io 0.0.49 → 0.0.50

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 (226) hide show
  1. package/IO/api/foreachExec.d.ts +18 -0
  2. package/Push/Bounds.d.ts +4 -0
  3. package/Push/FlattenStrategy.d.ts +47 -0
  4. package/Push/IndexedBuffer.d.ts +19 -0
  5. package/Push/MergeStrategy.d.ts +19 -0
  6. package/Push/Operator/IOLoopOperator.d.ts +61 -0
  7. package/Push/Operator/IOOperator.d.ts +63 -0
  8. package/Push/Operator/LoopOperator.d.ts +50 -0
  9. package/Push/Operator/SyncOperator.d.ts +41 -0
  10. package/Push/Operator.d.ts +4 -0
  11. package/Push/Producer/IOProducer.d.ts +41 -0
  12. package/Push/Producer/SyncProducer.d.ts +61 -0
  13. package/Push/Producer.d.ts +1 -0
  14. package/Push/Sink.d.ts +65 -0
  15. package/Push/api.d.ts +78 -161
  16. package/Push/definition.d.ts +92 -19
  17. package/Push/internal.d.ts +3 -0
  18. package/Push.d.ts +6 -0
  19. package/Ref/Synchronized/definition.d.ts +32 -9
  20. package/Ref/definition.d.ts +12 -0
  21. package/Scope/api.d.ts +16 -1
  22. package/Sink/definition.d.ts +5 -6
  23. package/Subject/Atomic.d.ts +19 -9
  24. package/Subject/DeferredRef.d.ts +17 -0
  25. package/Subject/Hold.d.ts +19 -0
  26. package/Subject/RefSubject/Atomic.d.ts +41 -0
  27. package/Subject/RefSubject/Derived.d.ts +43 -0
  28. package/Subject/RefSubject/RefSubject.d.ts +27 -0
  29. package/Subject/definition.d.ts +14 -2
  30. package/Subject.d.ts +2 -0
  31. package/SubscriptionRef.d.ts +0 -1
  32. package/_cjs/IO/api/foreachExec.cjs +29 -4
  33. package/_cjs/IO/api/foreachExec.cjs.map +1 -1
  34. package/_cjs/Push/Bounds.cjs +2 -0
  35. package/_cjs/Push/Bounds.cjs.map +1 -0
  36. package/_cjs/Push/FlattenStrategy.cjs +95 -0
  37. package/_cjs/Push/FlattenStrategy.cjs.map +1 -0
  38. package/_cjs/Push/IndexedBuffer.cjs +70 -0
  39. package/_cjs/Push/IndexedBuffer.cjs.map +1 -0
  40. package/_cjs/Push/MergeStrategy.cjs +45 -0
  41. package/_cjs/Push/MergeStrategy.cjs.map +1 -0
  42. package/_cjs/Push/Operator/IOLoopOperator.cjs +225 -0
  43. package/_cjs/Push/Operator/IOLoopOperator.cjs.map +1 -0
  44. package/_cjs/Push/Operator/IOOperator.cjs +104 -0
  45. package/_cjs/Push/Operator/IOOperator.cjs.map +1 -0
  46. package/_cjs/Push/Operator/LoopOperator.cjs +165 -0
  47. package/_cjs/Push/Operator/LoopOperator.cjs.map +1 -0
  48. package/_cjs/Push/Operator/SyncOperator.cjs +78 -0
  49. package/_cjs/Push/Operator/SyncOperator.cjs.map +1 -0
  50. package/_cjs/Push/Operator.cjs +2 -0
  51. package/_cjs/Push/Operator.cjs.map +1 -0
  52. package/_cjs/Push/Producer/IOProducer.cjs +67 -0
  53. package/_cjs/Push/Producer/IOProducer.cjs.map +1 -0
  54. package/_cjs/Push/Producer/SyncProducer.cjs +107 -0
  55. package/_cjs/Push/Producer/SyncProducer.cjs.map +1 -0
  56. package/_cjs/Push/Producer.cjs +2 -0
  57. package/_cjs/Push/Producer.cjs.map +1 -0
  58. package/_cjs/Push/Sink.cjs +219 -0
  59. package/_cjs/Push/Sink.cjs.map +1 -0
  60. package/_cjs/Push/api.cjs +339 -383
  61. package/_cjs/Push/api.cjs.map +1 -1
  62. package/_cjs/Push/definition.cjs +79 -22
  63. package/_cjs/Push/definition.cjs.map +1 -1
  64. package/_cjs/Push/internal.cjs +31 -26
  65. package/_cjs/Push/internal.cjs.map +1 -1
  66. package/_cjs/Push.cjs +66 -0
  67. package/_cjs/Push.cjs.map +1 -1
  68. package/_cjs/Ref/Synchronized/definition.cjs +12 -12
  69. package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
  70. package/_cjs/Ref/definition.cjs.map +1 -1
  71. package/_cjs/Scope/api.cjs +28 -7
  72. package/_cjs/Scope/api.cjs.map +1 -1
  73. package/_cjs/Sink/definition.cjs +2 -3
  74. package/_cjs/Sink/definition.cjs.map +1 -1
  75. package/_cjs/Stream/definition.cjs.map +1 -1
  76. package/_cjs/Subject/Atomic.cjs +45 -10
  77. package/_cjs/Subject/Atomic.cjs.map +1 -1
  78. package/_cjs/Subject/DeferredRef.cjs +53 -0
  79. package/_cjs/Subject/DeferredRef.cjs.map +1 -0
  80. package/_cjs/Subject/Hold.cjs +41 -0
  81. package/_cjs/Subject/Hold.cjs.map +1 -0
  82. package/_cjs/Subject/RefSubject/Atomic.cjs +130 -0
  83. package/_cjs/Subject/RefSubject/Atomic.cjs.map +1 -0
  84. package/_cjs/Subject/RefSubject/Derived.cjs +98 -0
  85. package/_cjs/Subject/RefSubject/Derived.cjs.map +1 -0
  86. package/_cjs/Subject/RefSubject/RefSubject.cjs +19 -0
  87. package/_cjs/Subject/RefSubject/RefSubject.cjs.map +1 -0
  88. package/_cjs/Subject/definition.cjs +16 -1
  89. package/_cjs/Subject/definition.cjs.map +1 -1
  90. package/_cjs/Subject.cjs +22 -0
  91. package/_cjs/Subject.cjs.map +1 -1
  92. package/_cjs/SubscriptionRef.cjs +0 -1
  93. package/_cjs/SubscriptionRef.cjs.map +1 -1
  94. package/_mjs/IO/api/foreachExec.mjs +27 -4
  95. package/_mjs/IO/api/foreachExec.mjs.map +1 -1
  96. package/_mjs/Push/Bounds.mjs +2 -0
  97. package/_mjs/Push/Bounds.mjs.map +1 -0
  98. package/_mjs/Push/FlattenStrategy.mjs +86 -0
  99. package/_mjs/Push/FlattenStrategy.mjs.map +1 -0
  100. package/_mjs/Push/IndexedBuffer.mjs +61 -0
  101. package/_mjs/Push/IndexedBuffer.mjs.map +1 -0
  102. package/_mjs/Push/MergeStrategy.mjs +34 -0
  103. package/_mjs/Push/MergeStrategy.mjs.map +1 -0
  104. package/_mjs/Push/Operator/IOLoopOperator.mjs +208 -0
  105. package/_mjs/Push/Operator/IOLoopOperator.mjs.map +1 -0
  106. package/_mjs/Push/Operator/IOOperator.mjs +91 -0
  107. package/_mjs/Push/Operator/IOOperator.mjs.map +1 -0
  108. package/_mjs/Push/Operator/LoopOperator.mjs +151 -0
  109. package/_mjs/Push/Operator/LoopOperator.mjs.map +1 -0
  110. package/_mjs/Push/Operator/SyncOperator.mjs +67 -0
  111. package/_mjs/Push/Operator/SyncOperator.mjs.map +1 -0
  112. package/_mjs/Push/Operator.mjs +2 -0
  113. package/_mjs/Push/Operator.mjs.map +1 -0
  114. package/_mjs/Push/Producer/IOProducer.mjs +55 -0
  115. package/_mjs/Push/Producer/IOProducer.mjs.map +1 -0
  116. package/_mjs/Push/Producer/SyncProducer.mjs +90 -0
  117. package/_mjs/Push/Producer/SyncProducer.mjs.map +1 -0
  118. package/_mjs/Push/Producer.mjs +2 -0
  119. package/_mjs/Push/Producer.mjs.map +1 -0
  120. package/_mjs/Push/Sink.mjs +206 -0
  121. package/_mjs/Push/Sink.mjs.map +1 -0
  122. package/_mjs/Push/api.mjs +311 -344
  123. package/_mjs/Push/api.mjs.map +1 -1
  124. package/_mjs/Push/definition.mjs +73 -18
  125. package/_mjs/Push/definition.mjs.map +1 -1
  126. package/_mjs/Push/internal.mjs +30 -26
  127. package/_mjs/Push/internal.mjs.map +1 -1
  128. package/_mjs/Push.mjs +7 -1
  129. package/_mjs/Push.mjs.map +1 -1
  130. package/_mjs/Ref/Synchronized/definition.mjs +12 -12
  131. package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
  132. package/_mjs/Ref/definition.mjs.map +1 -1
  133. package/_mjs/Scope/api.mjs +22 -4
  134. package/_mjs/Scope/api.mjs.map +1 -1
  135. package/_mjs/Sink/definition.mjs +2 -3
  136. package/_mjs/Sink/definition.mjs.map +1 -1
  137. package/_mjs/Stream/definition.mjs.map +1 -1
  138. package/_mjs/Subject/Atomic.mjs +46 -10
  139. package/_mjs/Subject/Atomic.mjs.map +1 -1
  140. package/_mjs/Subject/DeferredRef.mjs +45 -0
  141. package/_mjs/Subject/DeferredRef.mjs.map +1 -0
  142. package/_mjs/Subject/Hold.mjs +33 -0
  143. package/_mjs/Subject/Hold.mjs.map +1 -0
  144. package/_mjs/Subject/RefSubject/Atomic.mjs +122 -0
  145. package/_mjs/Subject/RefSubject/Atomic.mjs.map +1 -0
  146. package/_mjs/Subject/RefSubject/Derived.mjs +90 -0
  147. package/_mjs/Subject/RefSubject/Derived.mjs.map +1 -0
  148. package/_mjs/Subject/RefSubject/RefSubject.mjs +12 -0
  149. package/_mjs/Subject/RefSubject/RefSubject.mjs.map +1 -0
  150. package/_mjs/Subject/definition.mjs +14 -0
  151. package/_mjs/Subject/definition.mjs.map +1 -1
  152. package/_mjs/Subject.mjs +2 -0
  153. package/_mjs/Subject.mjs.map +1 -1
  154. package/_mjs/SubscriptionRef.mjs +0 -1
  155. package/_mjs/SubscriptionRef.mjs.map +1 -1
  156. package/_src/IO/api/foreachExec.ts +47 -0
  157. package/_src/Push/Bounds.ts +4 -0
  158. package/_src/Push/FlattenStrategy.ts +137 -0
  159. package/_src/Push/IndexedBuffer.ts +79 -0
  160. package/_src/Push/MergeStrategy.ts +59 -0
  161. package/_src/Push/Operator/IOLoopOperator.ts +413 -0
  162. package/_src/Push/Operator/IOOperator.ts +173 -0
  163. package/_src/Push/Operator/LoopOperator.ts +242 -0
  164. package/_src/Push/Operator/SyncOperator.ts +107 -0
  165. package/_src/Push/Operator.ts +7 -0
  166. package/_src/Push/Producer/IOProducer.ts +83 -0
  167. package/_src/Push/Producer/SyncProducer.ts +105 -0
  168. package/_src/Push/Producer.ts +0 -0
  169. package/_src/Push/Sink.ts +302 -0
  170. package/_src/Push/api.ts +387 -513
  171. package/_src/Push/definition.ts +216 -23
  172. package/_src/Push/internal.ts +11 -0
  173. package/_src/Push.ts +7 -1
  174. package/_src/Ref/Synchronized/definition.ts +81 -37
  175. package/_src/Ref/definition.ts +26 -0
  176. package/_src/Scope/api.ts +22 -0
  177. package/_src/Sink/definition.ts +4 -5
  178. package/_src/Stream/definition.ts +0 -1
  179. package/_src/Subject/Atomic.ts +68 -11
  180. package/_src/Subject/DeferredRef.ts +44 -0
  181. package/_src/Subject/Hold.ts +48 -0
  182. package/_src/Subject/RefSubject/Atomic.ts +193 -0
  183. package/_src/Subject/RefSubject/Derived.ts +179 -0
  184. package/_src/Subject/RefSubject/RefSubject.ts +90 -0
  185. package/_src/Subject/definition.ts +21 -3
  186. package/_src/Subject.ts +5 -3
  187. package/_src/SubscriptionRef.ts +1 -1
  188. package/_src/index.ts +49 -50
  189. package/index.d.ts +0 -1
  190. package/package.json +4 -4
  191. package/RefSubject/Atomic.d.ts +0 -34
  192. package/RefSubject/Synchronized/api.d.ts +0 -9
  193. package/RefSubject/Synchronized/definition.d.ts +0 -39
  194. package/RefSubject/api.d.ts +0 -120
  195. package/RefSubject/definition.d.ts +0 -52
  196. package/RefSubject.d.ts +0 -3
  197. package/_cjs/RefSubject/Atomic.cjs +0 -107
  198. package/_cjs/RefSubject/Atomic.cjs.map +0 -1
  199. package/_cjs/RefSubject/Synchronized/api.cjs +0 -22
  200. package/_cjs/RefSubject/Synchronized/api.cjs.map +0 -1
  201. package/_cjs/RefSubject/Synchronized/definition.cjs +0 -55
  202. package/_cjs/RefSubject/Synchronized/definition.cjs.map +0 -1
  203. package/_cjs/RefSubject/api.cjs +0 -251
  204. package/_cjs/RefSubject/api.cjs.map +0 -1
  205. package/_cjs/RefSubject/definition.cjs +0 -26
  206. package/_cjs/RefSubject/definition.cjs.map +0 -1
  207. package/_cjs/RefSubject.cjs +0 -39
  208. package/_cjs/RefSubject.cjs.map +0 -1
  209. package/_mjs/RefSubject/Atomic.mjs +0 -99
  210. package/_mjs/RefSubject/Atomic.mjs.map +0 -1
  211. package/_mjs/RefSubject/Synchronized/api.mjs +0 -15
  212. package/_mjs/RefSubject/Synchronized/api.mjs.map +0 -1
  213. package/_mjs/RefSubject/Synchronized/definition.mjs +0 -47
  214. package/_mjs/RefSubject/Synchronized/definition.mjs.map +0 -1
  215. package/_mjs/RefSubject/api.mjs +0 -229
  216. package/_mjs/RefSubject/api.mjs.map +0 -1
  217. package/_mjs/RefSubject/definition.mjs +0 -19
  218. package/_mjs/RefSubject/definition.mjs.map +0 -1
  219. package/_mjs/RefSubject.mjs +0 -5
  220. package/_mjs/RefSubject.mjs.map +0 -1
  221. package/_src/RefSubject/Atomic.ts +0 -129
  222. package/_src/RefSubject/Synchronized/api.ts +0 -14
  223. package/_src/RefSubject/Synchronized/definition.ts +0 -76
  224. package/_src/RefSubject/api.ts +0 -253
  225. package/_src/RefSubject/definition.ts +0 -70
  226. package/_src/RefSubject.ts +0 -5
package/_mjs/Push/api.mjs CHANGED
@@ -1,477 +1,444 @@
1
- var _a;
2
1
  const fileName_1 = "(@fncts/io) src/Push/api.ts";
3
- import * as tsplus_module_1 from "@fncts/io/Future/api";
4
- import * as tsplus_module_2 from "@fncts/io/IO/api/interrupt";
5
- import * as tsplus_module_3 from "@fncts/base/data/Either/destructors";
6
- import * as tsplus_module_4 from "@fncts/io/IO/api";
7
- import * as tsplus_module_5 from "@fncts/io/IO/api/forkIn";
8
- import * as tsplus_module_6 from "@fncts/io/IO/api/fulfill";
9
- import * as tsplus_module_7 from "@fncts/io/IO/runtime";
10
- import * as tsplus_module_8 from "@fncts/io/IO/api/scope";
11
- import * as tsplus_module_9 from "@fncts/io/Future/constructors";
12
- import * as tsplus_module_10 from "@fncts/io/IO/api/scoped";
13
- import * as tsplus_module_11 from "@fncts/io/Push/definition";
14
- import * as tsplus_module_12 from "@fncts/base/data/Either/constructors";
15
- import * as tsplus_module_13 from "@fncts/base/collection/Iterable/api";
16
- import * as tsplus_module_14 from "@fncts/io/IO/api/foreachConcurrent";
17
- import * as tsplus_module_15 from "@fncts/io/IO/api/delay";
18
- import * as tsplus_module_16 from "@fncts/base/data/Maybe/destructors";
19
- import * as tsplus_module_17 from "@fncts/io/Semaphore/constructors";
20
- import * as tsplus_module_18 from "@fncts/io/IO/api/concurrency";
21
- import * as tsplus_module_19 from "@fncts/base/data/function/api";
22
- import * as tsplus_module_20 from "@fncts/io/IO/api/asyncIO";
23
- import * as tsplus_module_21 from "@fncts/io/IO/api/forkDaemon";
24
- import * as tsplus_module_22 from "@fncts/io/Fiber/api/await";
25
- import * as tsplus_module_23 from "@fncts/io/IO/api/environment";
26
- import * as tsplus_module_24 from "@fncts/io/Fiber/api/interrupt";
27
- import * as tsplus_module_25 from "@fncts/base/data/Maybe/constructors";
28
- import * as tsplus_module_26 from "@fncts/base/data/Maybe/definition";
29
- import * as tsplus_module_27 from "@fncts/base/data/Cause/api";
30
- import * as tsplus_module_28 from "@fncts/io/Fiber/api/interruptFork";
31
- import * as tsplus_module_29 from "@fncts/io/IO/api/forkScoped";
32
- import * as tsplus_module_30 from "@fncts/base/collection/immutable/Conc/definition";
33
- import * as tsplus_module_31 from "@fncts/io/Fiber/api/joinAll";
34
- import * as tsplus_module_32 from "@fncts/io/IO/api/fork";
35
- import * as tsplus_module_33 from "@fncts/io/IO/api/asyncInterrupt";
36
- export const asyncInterrupt = asyncInterrupt_1;
37
- export const combineLatest = combineLatest_1;
38
- export const exhaustMap = exhaustMap_1;
39
- export const flatMapConcurrentBounded = flatMapConcurrentBounded_1;
40
- export const flatMapConcurrentUnbounded = flatMapConcurrentUnbounded_1;
41
- export const flatMap = flatMap_1;
42
- export const flatten = flatten_1;
2
+ import * as tsplus_module_1 from "@fncts/io/IO/api";
3
+ import * as tsplus_module_2 from "@fncts/io/IO/api/bracketExit";
4
+ import * as tsplus_module_3 from "@fncts/base/collection/Iterable/api";
5
+ import * as tsplus_module_4 from "@fncts/io/Push/Sink";
6
+ import * as tsplus_module_5 from "@fncts/io/CountdownLatch";
7
+ import * as tsplus_module_6 from "@fncts/io/IO/api/environment";
8
+ import * as tsplus_module_7 from "@fncts/base/data/Cause/api";
9
+ import * as tsplus_module_8 from "@fncts/base/data/Maybe/destructors";
10
+ import * as tsplus_module_9 from "@fncts/io/Push/FlattenStrategy";
11
+ import * as tsplus_module_10 from "@fncts/base/data/ExecutionStrategy";
12
+ import * as tsplus_module_11 from "@fncts/io/Push/Producer/SyncProducer";
13
+ import * as tsplus_module_12 from "@fncts/io/IO/definition";
14
+ import * as tsplus_module_13 from "@fncts/io/Scope/api";
15
+ import * as tsplus_module_14 from "@fncts/io/Layer/MemoMap";
16
+ import * as tsplus_module_15 from "@fncts/base/data/Environment/api";
17
+ export const contramapEnvironment = contramapEnvironment_1;
18
+ export const failCause = failCause_1;
19
+ export const failCauseNow = failCauseNow_1;
20
+ export const flatMapWithStrategy = flatMapWithStrategy_1;
43
21
  export const fromIO = fromIO_1;
44
- export const map = map_1;
45
- export const mapIO = mapIO_1;
46
- export const mergeAll = mergeAll_1;
47
- export const observe = observe_1;
48
- export const scoped = scoped_1;
49
- export const switchMap = switchMap_1;
50
- export const switchMapIO = switchMapIO_1;
51
- export const transform = transform_1;
52
- export const unfoldIO = unfoldIO_1;
53
- export const unwrap = unwrap_1;
54
- import { AtomicReference } from "@fncts/base/internal/AtomicReference";
55
- import { IO } from "@fncts/io/IO";
56
- import { withExhaust, withSwitch, withUnboundedConcurrency } from "@fncts/io/Push/internal";
57
- import { Push, PushTypeId, PushVariance, Sink } from "./definition.mjs";
58
- /**
59
- * @tsplus pipeable fncts.io.Push as
60
- */
61
- export function as(b) {
62
- return self => {
63
- return map_1(b)(self);
64
- };
22
+ export const fromIOProducer = fromIOProducer_1;
23
+ export const fromSyncProducer = fromSyncProducer_1;
24
+ export const provideSomeEnvironment = provideSomeEnvironment_1;
25
+ export const succeedNow = succeedNow_1;
26
+ import { UnboundedStrategy } from "@fncts/io/Push";
27
+ import { Push, PushPrimitive } from "@fncts/io/Push";
28
+ import { FromIO, FromScheduled, Scheduled } from "./Producer/IOProducer.mjs";
29
+ class BracketExit extends Push {
30
+ constructor(acquire, use, release) {
31
+ super();
32
+ this.acquire = acquire;
33
+ this.use = use;
34
+ this.release = release;
35
+ }
36
+ run(sink) {
37
+ return tsplus_module_1.catchAllCause(sink.onFailure, fileName_1 + ":27:20")(tsplus_module_2.bracketExit(() => this.acquire, a => this.use(a).run(sink), (a, exit) => tsplus_module_1.catchAllCause(sink.onFailure, fileName_1 + ":26:55")(this.release(a, exit)), fileName_1 + ":23:26"));
38
+ }
65
39
  }
66
40
  /**
67
- * @tsplus static fncts.io.PushOps asyncInterrupt
41
+ * @tsplus static fncts.io.PushOps bracketExit
68
42
  */
69
- function asyncInterrupt_1(make) {
70
- return tsplus_module_11.makePush(sink => tsplus_module_10.scoped(tsplus_module_4.flatMap(future => tsplus_module_4.flatMap(scope => tsplus_module_4.flatMap(runtime => {
71
- const unsafeSink = {
72
- event: value => runtime.unsafeRunOrFork(tsplus_module_5.forkIn(scope, fileName_1 + ":34:77")(sink.event(value)), fileName_1 + ":34:52"),
73
- error: cause => runtime.unsafeRunOrFork(tsplus_module_5.forkIn(scope, fileName_1 + ":35:93")(tsplus_module_6.fulfill(future, fileName_1 + ":35:78")(sink.error(cause))), fileName_1 + ":35:52")
74
- };
75
- return tsplus_module_4.flatMap(eitherPush => tsplus_module_4.map(() => void 0, fileName_1 + ":38:10")(tsplus_module_3.match(canceller => tsplus_module_2.onInterrupt(() => canceller, fileName_1 + ":40:52")(tsplus_module_1.wait(future, fileName_1 + ":40:34")), push => push.run(sink))(eitherPush)), fileName_1 + ":37:29")(tsplus_module_4.succeed(() => make(unsafeSink), fileName_1 + ":37:32"));
76
- }, fileName_1 + ":32:26")(tsplus_module_7.runtime(fileName_1 + ":32:37")), fileName_1 + ":31:26")(tsplus_module_8.scope), fileName_1 + ":30:26")(tsplus_module_9.make(fileName_1 + ":30:38")), fileName_1 + ":44:9"));
43
+ export function bracketExit(acquire, use, release) {
44
+ return new BracketExit(acquire, use, release);
77
45
  }
78
- /**
79
- * @tsplus static fncts.io.PushOps async
80
- */
81
- export function async(make) {
82
- return asyncInterrupt_1(sink => {
83
- make(sink);
84
- return tsplus_module_12.left(tsplus_module_4.unit, fileName_1 + ":54:23");
85
- });
46
+ class CombineLatest extends Push {
47
+ constructor(streams) {
48
+ super();
49
+ this.streams = streams;
50
+ }
51
+ run(sink) {
52
+ return UnboundedStrategy.withFork(fork => (() => {
53
+ const size = tsplus_module_3.size(this.streams);
54
+ return tsplus_module_1.flatMap(latch => {
55
+ const ref = Array(size).fill(CombineLatest.UNSET, 0, size);
56
+ const emitIfReady = tsplus_module_1.whenIO(latch.isOpen, fileName_1 + ":55:67")(tsplus_module_1.defer(() => sink.onSuccess(ref), fileName_1 + ":55:39"));
57
+ return tsplus_module_1.map(() => void 0, fileName_1 + ":57:10")(tsplus_module_1.foreach(tsplus_module_3.zipWithIndex(this.streams), ([i, stream]) => fork(stream.run(tsplus_module_4.unsafeMakeSink(value => tsplus_module_1.zipRight(emitIfReady, fileName_1 + ":73:25")(tsplus_module_1.defer(() => {
58
+ const indexEmpty = ref[i] === CombineLatest.UNSET;
59
+ ref[i] = value;
60
+ if (indexEmpty) {
61
+ return latch.countDown;
62
+ } else {
63
+ return tsplus_module_1.unit;
64
+ }
65
+ }, fileName_1 + ":63:29")), cause => sink.onFailure(cause)))), fileName_1 + ":58:21"));
66
+ }, fileName_1 + ":53:32")(tsplus_module_5.make(size));
67
+ })());
68
+ }
86
69
  }
87
- function combineLatest_1(streams) {
88
- return tsplus_module_11.makePush(emitter => (() => {
89
- const size = tsplus_module_13.size(streams);
90
- return tsplus_module_4.flatMap(ref => {
91
- const emitIfReady = tsplus_module_4.flatMap(as => as.length === size ? emitter.event(as) : tsplus_module_4.unit, fileName_1 + ":70:69")(tsplus_module_4.succeed(() => ref.filter(a => a != null), fileName_1 + ":70:31"));
92
- return tsplus_module_4.map(() => void 0, fileName_1 + ":73:8")(tsplus_module_14.foreachConcurrent(tsplus_module_13.zipWithIndex(streams), ([i, stream]) => stream.run(tsplus_module_11.makeSink(value => tsplus_module_4.zipRight(emitIfReady, fileName_1 + ":77:48")(tsplus_module_4.succeed(() => ref[i] = value, fileName_1 + ":77:28")), cause => emitter.error(cause))), fileName_1 + ":74:29"));
93
- }, fileName_1 + ":69:30")(tsplus_module_4.succeed(() => Array(size), fileName_1 + ":69:33"));
94
- })());
70
+ CombineLatest.UNSET = /*#__PURE__*/Symbol();
71
+ export function combineLatest(streams) {
72
+ return new CombineLatest(streams);
95
73
  }
96
- /**
97
- * @tsplus pipeable fncts.io.PushOps combineLatestWith
98
- */
99
- export function combineLatestWith(that, f) {
100
- return self => {
101
- return map_1(([a, b]) => f(a, b))(combineLatest_1([self, that]));
102
- };
74
+ class ContramapEnvironment extends Push {
75
+ constructor(self, f) {
76
+ super();
77
+ this.self = self;
78
+ this.f = f;
79
+ }
80
+ run(sink) {
81
+ return tsplus_module_6.contramapEnvironment(this.f, fileName_1 + ":105:52")(this.self.run(sink));
82
+ }
103
83
  }
104
84
  /**
105
- * @tsplus pipeable fncts.io.Push debounce
85
+ * @tsplus pipeable fncts.io.Push contramapEnvironment
106
86
  */
107
- export function debounce(duration) {
108
- return self => {
109
- return switchMapIO_1(a => tsplus_module_15.delay(duration)(tsplus_module_4.succeedNow(a, fileName_1 + ":101:49")))(self);
110
- };
87
+ function contramapEnvironment_1(f) {
88
+ return self => new ContramapEnvironment(self, f);
89
+ }
90
+ class Defer extends Push {
91
+ constructor(self) {
92
+ super();
93
+ this.self = self;
94
+ }
95
+ run(sink) {
96
+ return tsplus_module_1.defer(() => this.self().run(sink), fileName_1 + ":121:20");
97
+ }
111
98
  }
112
99
  /**
113
100
  * @tsplus static fncts.io.PushOps defer
114
101
  */
115
102
  export function defer(self) {
116
- return tsplus_module_11.makePush(emitter => tsplus_module_4.flatMap(push => push.run(emitter), fileName_1 + ":109:44")(tsplus_module_4.succeed(self, fileName_1 + ":109:30")));
103
+ return new Defer(self);
117
104
  }
118
105
  /**
119
- * @tsplus pipeable fncts.io.Push exhaustMap
106
+ * @tsplus static fncts.io.PushOps failCause
120
107
  */
121
- function exhaustMap_1(f) {
122
- return self => {
123
- return tsplus_module_11.makePush(sink => withExhaust(fork => self.run(tsplus_module_11.makeSink(a => fork(f(a).run(sink)), sink.error))));
124
- };
108
+ function failCause_1(cause) {
109
+ const op = new PushPrimitive(3 /* PushTag.FailCause */);
110
+ op.i0 = cause;
111
+ return op;
125
112
  }
126
113
  /**
127
- * @tsplus pipeable fncts.io.Push exhaustMapIO
114
+ * @tsplus static fncts.io.PushOps failCauseNow
128
115
  */
129
- export function exhaustMapIO(f) {
130
- return self => {
131
- return exhaustMap_1(a => fromIO_1(() => f(a)))(self);
132
- };
116
+ function failCauseNow_1(cause) {
117
+ const op = new PushPrimitive(3 /* PushTag.FailCause */);
118
+ op.i0 = () => cause;
119
+ return op;
133
120
  }
134
121
  /**
135
- * @tsplus pipeable fncts.io.Push filterIO
122
+ * @tsplus static fncts.io.PushOps failNow
136
123
  */
137
- export function filterIO(predicate) {
138
- return self => {
139
- return tsplus_module_11.makePush(sink => self.run(tsplus_module_11.makeSink(a => tsplus_module_4.catchAllCause(sink.error, fileName_1 + ":141:29")(tsplus_module_4.flatMap(b => b ? sink.event(a) : tsplus_module_4.unit, fileName_1 + ":140:23")(predicate(a))), sink.error)));
140
- };
124
+ export function failNow(error) {
125
+ return failCauseNow_1(tsplus_module_7.fail(error));
141
126
  }
142
- /**
143
- * @tsplus pipeable fncts.io.Push filterMapIO
144
- */
145
- export function filterMapIO(f) {
146
- return self => {
147
- return tsplus_module_11.makePush(sink => self.run(tsplus_module_11.makeSink(a => tsplus_module_4.catchAllCause(sink.error, fileName_1 + ":160:29")(tsplus_module_4.flatMap(mb => tsplus_module_16.match(() => tsplus_module_4.unit, sink.event)(mb), fileName_1 + ":159:23")(f(a))), sink.error)));
148
- };
127
+ class Filter extends Push {
128
+ constructor(self, p) {
129
+ super();
130
+ this.self = self;
131
+ this.p = p;
132
+ }
133
+ run(sink) {
134
+ return this.self.run(tsplus_module_4.unsafeMakeSink(value => {
135
+ if (this.p(value)) {
136
+ return sink.onSuccess(value);
137
+ } else {
138
+ return tsplus_module_1.unit;
139
+ }
140
+ }, cause => sink.onFailure(cause)));
141
+ }
149
142
  }
150
- export function filter(predicate) {
151
- return self => {
152
- return tsplus_module_11.makePush(sink => self.run(tsplus_module_11.makeSink(a => predicate(a) ? sink.event(a) : tsplus_module_4.unit, sink.error)));
153
- };
143
+ export function filter(p) {
144
+ return self => new Filter(self, p);
145
+ }
146
+ class FilterMap extends Push {
147
+ constructor(self, f) {
148
+ super();
149
+ this.self = self;
150
+ this.f = f;
151
+ }
152
+ run(sink) {
153
+ return this.self.run(tsplus_module_4.unsafeMakeSink(value => tsplus_module_8.match(() => tsplus_module_1.unit, b => sink.onSuccess(b))(this.f(value)), cause => sink.onFailure(cause)));
154
+ }
154
155
  }
155
156
  /**
156
157
  * @tsplus pipeable fncts.io.Push filterMap
157
158
  */
158
159
  export function filterMap(f) {
159
- return self => {
160
- return tsplus_module_11.makePush(sink => self.run(tsplus_module_11.makeSink(a => tsplus_module_16.match(() => tsplus_module_4.unit, sink.event)(f(a)), sink.error)));
161
- };
162
- }
163
- /**
164
- * @tsplus pipeable fncts.io.Push flatMapConcurrentBounded
165
- */
166
- function flatMapConcurrentBounded_1(f, concurrency) {
167
- return self => {
168
- return tsplus_module_11.makePush(emitter => tsplus_module_4.flatMap(semaphore => tsplus_module_4.map(() => void 0, fileName_1 + ":196:10")(flatMapConcurrentUnbounded_1(a => transform_1(io => semaphore.withPermit(io))(f(a)))(self).run(emitter)), fileName_1 + ":195:28")(tsplus_module_17.makeSemaphore(concurrency, fileName_1 + ":195:38")));
169
- };
160
+ return self => new FilterMap(self, f);
170
161
  }
171
162
  /**
172
- * @tsplus pipeable fncts.io.Push flatMapConcurrentUnbounded
163
+ * @tsplus pipeable fncts.io.Push flatMap
173
164
  */
174
- function flatMapConcurrentUnbounded_1(f) {
165
+ export function flatMap(f) {
175
166
  return self => {
176
- return tsplus_module_11.makePush(sink => withUnboundedConcurrency(fork => self.run(tsplus_module_11.makeSink(a => fork(f(a).run(sink)), sink.error))));
167
+ const op = new PushPrimitive(4 /* PushTag.OnSuccess */);
168
+ op.i0 = self;
169
+ op.i1 = f;
170
+ return op;
177
171
  };
178
172
  }
179
173
  /**
180
- * @tsplus pipeable fncts.io.Push flatMapConcurrent
174
+ * @tsplus pipeable fncts.io.Push flatMapUnbounded
181
175
  */
182
- export function flatMapConcurrent(f) {
183
- return self => {
184
- return unwrap_1(tsplus_module_4.map(concurrency => tsplus_module_16.match(() => flatMapConcurrentUnbounded_1(f)(self), n => flatMapConcurrentBounded_1(f, n)(self))(concurrency), fileName_1 + ":217:25")(tsplus_module_18.concurrency));
185
- };
176
+ export function flatMapUnbounded(f) {
177
+ return self => flatMapWithStrategy_1(f, tsplus_module_9.UnboundedStrategy, tsplus_module_10.concurrent)(self);
186
178
  }
187
179
  /**
188
- * @tsplus pipeable fncts.io.Push flatMap
180
+ * @tsplus pipeable fncts.io.Push flatMapWithStrategy
189
181
  */
190
- function flatMap_1(f) {
182
+ function flatMapWithStrategy_1(f, flattenStrategy, executionStrategy) {
191
183
  return self => {
192
- return flatMapConcurrentBounded_1(f, 1)(self);
184
+ const op = new PushPrimitive(5 /* PushTag.OnSuccessWithStrategy */);
185
+ op.i0 = self;
186
+ op.i1 = f;
187
+ op.i2 = flattenStrategy;
188
+ op.i3 = executionStrategy;
189
+ return op;
193
190
  };
194
191
  }
195
192
  /**
196
- * @tsplus getter fncts.io.Push flatten
193
+ * @tsplus static fncts.io.PushOps fromArray
197
194
  */
198
- function flatten_1(self) {
199
- return flatMap_1(tsplus_module_19.identity)(self);
195
+ export function fromArray(array) {
196
+ return fromSyncProducer_1(tsplus_module_11.fromArray(array));
200
197
  }
201
198
  /**
202
199
  * @tsplus static fncts.io.PushOps fromIO
203
200
  */
204
201
  function fromIO_1(io) {
205
- return tsplus_module_11.makePush(emitter => tsplus_module_4.matchCauseIO(cause => emitter.error(cause), value => emitter.event(value), fileName_1 + ":248:30")(tsplus_module_4.defer(io, fileName_1 + ":248:13")));
202
+ const concrete = io;
203
+ switch (concrete._ioOpCode) {
204
+ case 0 /* IOTag.SucceedNow */:
205
+ {
206
+ return succeedNow_1(concrete.i0);
207
+ }
208
+ case 1 /* IOTag.Fail */:
209
+ {
210
+ return failCause_1(concrete.i0);
211
+ }
212
+ case 2 /* IOTag.Sync */:
213
+ {
214
+ return fromSyncProducer_1(tsplus_module_11.fromSync(concrete.i0));
215
+ }
216
+ default:
217
+ {
218
+ return fromIOProducer_1(new FromIO(io));
219
+ }
220
+ }
206
221
  }
207
222
  /**
208
- * @tsplus static fncts.io.PushOps fromAsyncIterable
223
+ * @tsplus static fncts.io.PushOps fromIOProducer
209
224
  */
210
- export function fromAsyncIterable(iterable) {
211
- return tsplus_module_11.makePush(sink => tsplus_module_20.asyncIO(cb => tsplus_module_4.defer(() => fromAsyncIterableLoop(iterable[Symbol.asyncIterator](), sink, cb, fileName_1 + ":260:70"), fileName_1 + ":260:48"), fileName_1 + ":260:15"));
212
- }
213
- function fromAsyncIterableLoop(iterator, sink, cb, __tsplusTrace) {
214
- return tsplus_module_4.matchCauseIO(cause => sink.error(cause), result => result.done ? tsplus_module_4.succeed(() => cb(tsplus_module_4.unit), __tsplusTrace) : tsplus_module_4.zipRight(fromAsyncIterableLoop(iterator, sink, cb, __tsplusTrace), __tsplusTrace)(sink.event(result.value)), __tsplusTrace)(tsplus_module_4.fromPromiseHalt(iterator.next, __tsplusTrace));
225
+ function fromIOProducer_1(producer) {
226
+ const op = new PushPrimitive(2 /* PushTag.ProducerIO */);
227
+ op.i0 = producer;
228
+ return op;
215
229
  }
216
230
  /**
217
231
  * @tsplus static fncts.io.PushOps fromIterable
218
232
  */
219
233
  export function fromIterable(iterable) {
220
- return tsplus_module_11.makePush(sink => tsplus_module_20.asyncIO(cb => tsplus_module_4.defer(() => fromIterableLoop(iterable[Symbol.iterator](), sink, cb), fileName_1 + ":281:48"), fileName_1 + ":281:15"));
234
+ return fromSyncProducer_1(tsplus_module_11.fromIterable(iterable));
221
235
  }
222
- function fromIterableLoop(iterator, sink, cb) {
223
- return tsplus_module_4.defer(() => {
224
- const value = iterator.next();
225
- return value.done ? tsplus_module_4.succeed(() => cb(tsplus_module_4.unit), fileName_1 + ":292:27") : tsplus_module_4.zipRight(fromIterableLoop(iterator, sink, cb), fileName_1 + ":292:68")(sink.event(value.value));
226
- }, fileName_1 + ":290:18");
236
+ /**
237
+ * @tsplus static fncts.io.PushOps fromScheduled
238
+ */
239
+ export function fromScheduled(io, schedule) {
240
+ return fromIOProducer_1(new FromScheduled(io, schedule));
241
+ }
242
+ /**
243
+ * @tsplus static fncts.io.PushOps fromSyncProducer
244
+ */
245
+ function fromSyncProducer_1(producer) {
246
+ const op = new PushPrimitive(1 /* PushTag.ProducerSync */);
247
+ op.i0 = producer;
248
+ return op;
227
249
  }
228
250
  /**
229
- * @tsplus getter fncts.io.Push multicast
251
+ * @tsplus static fncts.io.PushOps haltNow
230
252
  */
231
- export function multicast(self) {
232
- return new Multicast(self);
253
+ export function haltNow(error) {
254
+ return failCauseNow_1(tsplus_module_7.halt(error));
233
255
  }
234
- export class Multicast {
235
- constructor(push) {
236
- this.push = push;
237
- this[_a] = PushTypeId;
238
- this.observers = [];
256
+ /**
257
+ * @tsplus static fncts.io.PushOps __call
258
+ */
259
+ export function makePush(run) {
260
+ const op = new PushPrimitive(8 /* PushTag.FromPush */);
261
+ op.i0 = run;
262
+ return op;
263
+ }
264
+ class Map extends Push {
265
+ constructor(self, f) {
266
+ super();
267
+ this.self = self;
268
+ this.f = f;
239
269
  }
240
270
  run(sink) {
241
- return tsplus_module_4.flatMap(environment => tsplus_module_4.map(() => void 0, fileName_1 + ":322:8")(tsplus_module_4.defer(() => {
242
- let io = tsplus_module_4.unit;
243
- if (this.observers.push({
244
- sink: sink,
245
- environment
246
- }) === 1) {
247
- io = tsplus_module_4.flatMap(fiber => tsplus_module_4.succeed(() => this.fiber = fiber, fileName_1 + ":326:70"), fileName_1 + ":326:56")(tsplus_module_21.forkDaemon(this.push.run(this), fileName_1 + ":326:37"));
248
- }
249
- return tsplus_module_4.zipRight(tsplus_module_2.ensuring(this.removeSink(sink), fileName_1 + ":328:49")(tsplus_module_22.wait(this.fiber, fileName_1 + ":328:34")), fileName_1 + ":328:22")(io);
250
- }, fileName_1 + ":323:17")), fileName_1 + ":321:28")(tsplus_module_23.environment(fileName_1 + ":321:43"));
251
- }
252
- event(value) {
253
- return tsplus_module_4.defer(() => tsplus_module_4.foreachDiscard(this.observers.slice(), observer => this.runValue(value, observer), fileName_1 + ":335:38"), fileName_1 + ":335:20");
254
- }
255
- error(cause) {
256
- return tsplus_module_4.defer(() => tsplus_module_4.foreachDiscard(this.observers.slice(), observer => this.runError(cause, observer), fileName_1 + ":339:38"), fileName_1 + ":339:20");
257
- }
258
- runValue(value, observer) {
259
- return tsplus_module_4.catchAllCause(() => this.removeSink(observer.sink), fileName_1 + ":346:21")(tsplus_module_23.provideEnvironment(observer.environment, fileName_1 + ":345:26")(observer.sink.event(value)));
260
- }
261
- runError(cause, observer) {
262
- return tsplus_module_4.catchAllCause(() => this.removeSink(observer.sink), fileName_1 + ":353:21")(tsplus_module_23.provideEnvironment(observer.environment, fileName_1 + ":352:26")(observer.sink.error(cause)));
263
- }
264
- removeSink(sink) {
265
- return tsplus_module_4.defer(() => {
266
- if (this.observers.length === 0) {
267
- return tsplus_module_4.unit;
268
- }
269
- const index = this.observers.findIndex(observer => observer.sink === sink);
270
- if (index > -1) {
271
- this.observers.splice(index, 1);
272
- if (this.observers.length === 0) {
273
- const interrupt = tsplus_module_24.interrupt(this.fiber);
274
- this.fiber = undefined;
275
- return interrupt;
276
- }
277
- }
278
- return tsplus_module_4.unit;
279
- }, fileName_1 + ":357:20");
271
+ return this.self.run(tsplus_module_4.unsafeMakeSink(value => sink.onSuccess(this.f(value)), cause => sink.onFailure(cause)));
280
272
  }
281
273
  }
282
- _a = PushTypeId;
283
274
  /**
284
- * @tsplus getter fncts.io.Push hold
275
+ * @tsplus pipeable fncts.io.Push map
285
276
  */
286
- export function hold(self) {
287
- return new Hold(self);
277
+ export function map(f) {
278
+ return self => new Map(self, f);
288
279
  }
289
- export class Hold extends Multicast {
290
- constructor(push) {
291
- super(push);
292
- this.push = push;
293
- this.current = new AtomicReference(tsplus_module_25.nothing(fileName_1 + ":383:49"));
280
+ class MapAccum extends Push {
281
+ constructor(self, seed, f) {
282
+ super();
283
+ this.self = self;
284
+ this.seed = seed;
285
+ this.f = f;
294
286
  }
295
287
  run(sink) {
296
- const current = this.current.get;
297
- if (tsplus_module_26.isJust(current)) {
298
- return tsplus_module_4.zipRight(super.run(sink), fileName_1 + ":393:41")(sink.event(current.value));
299
- }
300
- return super.run(sink);
301
- }
302
- event(value) {
303
- return tsplus_module_4.defer(() => {
304
- this.current.set(tsplus_module_25.just(value, fileName_1 + ":401:28"));
305
- return super.event(value);
306
- }, fileName_1 + ":400:20");
288
+ return tsplus_module_1.defer(() => {
289
+ let acc = this.seed;
290
+ return this.self.run(tsplus_module_4.unsafeMakeSink(value => {
291
+ const [s, b] = this.f(acc, value);
292
+ acc = s;
293
+ return sink.onSuccess(b);
294
+ }, cause => sink.onFailure(cause)));
295
+ }, fileName_1 + ":364:20");
307
296
  }
308
297
  }
309
298
  /**
310
- * @tsplus pipeable fncts.io.Push map 1
299
+ * @tsplus pipeable fncts.io.Push mapAccum
311
300
  */
312
- function map_1(f) {
313
- return self => {
314
- return mapIO_1(a => tsplus_module_4.succeedNow(f(a), fileName_1 + ":412:43"))(self);
315
- };
301
+ export function mapAccum(seed, f) {
302
+ return self => new MapAccum(self, seed, f);
316
303
  }
317
- /**
318
- * @tsplus pipeable fncts.io.Push mapError
319
- */
320
- export function mapError(f) {
321
- return self => {
322
- return tsplus_module_11.makePush(emitter => self.run(tsplus_module_11.makeSink(value => emitter.event(value), cause => emitter.error(tsplus_module_27.map(f)(cause)))));
323
- };
304
+ class MapIO extends Push {
305
+ constructor(self, f) {
306
+ super();
307
+ this.self = self;
308
+ this.f = f;
309
+ }
310
+ run(sink) {
311
+ return this.self.run(tsplus_module_4.unsafeMakeSink(value => tsplus_module_1.matchCauseIO(sink.onFailure, sink.onSuccess, fileName_1 + ":398:46")(this.f(value)), cause => sink.onFailure(cause)));
312
+ }
324
313
  }
325
314
  /**
326
- * @tsplus pipeable fncts.io.Push mapErrorCause
315
+ * @tsplus pipeable fncts.io.Push mapIO
327
316
  */
328
- export function mapErrorCause(f) {
329
- return self => {
330
- return tsplus_module_11.makePush(emitter => self.run(tsplus_module_11.makeSink(value => emitter.event(value), cause => emitter.error(f(cause)))));
331
- };
317
+ export function mapIO(f) {
318
+ return self => new MapIO(self, f);
332
319
  }
333
320
  /**
334
- * @tsplus pipeable fncts.io.Push mapIO
321
+ * @tsplus pipeable fncts.io.Push mapIOWithStrategy
335
322
  */
336
- function mapIO_1(f) {
337
- return self => tsplus_module_11.makePush(emitter => self.run(tsplus_module_11.makeSink(value => tsplus_module_4.matchCauseIO(cause => emitter.error(cause), b => emitter.event(b), fileName_1 + ":457:34")(f(value)), cause => emitter.error(cause))));
323
+ export function mapIOWithStrategy(f, flattenStrategy, executionStrategy) {
324
+ return self => flatMapWithStrategy_1(a => fromIO_1(f(a)), flattenStrategy, executionStrategy)(self);
325
+ }
326
+ class MergeWithStrategy extends Push {
327
+ constructor(ps, mergeStrategy) {
328
+ super();
329
+ this.ps = ps;
330
+ this.mergeStrategy = mergeStrategy;
331
+ }
332
+ run(sink) {
333
+ return this.mergeStrategy.runMerge(this.ps, sink);
334
+ }
338
335
  }
339
336
  /**
340
- * @tsplus pipeable fncts.io.Push merge
337
+ * @tsplus static fncts.io.PushOps mergeWithStrategy
341
338
  */
342
- export function merge(that) {
343
- return self => {
344
- return mergeAll_1([self, that]);
345
- };
346
- }
347
- function mergeAll_1(streams) {
348
- return tsplus_module_11.makePush(sink => tsplus_module_14.foreachConcurrentDiscard(streams, stream => stream.run(tsplus_module_11.makeSink(sink.event, cause => tsplus_module_27.isInterruptedOnly(cause) ? tsplus_module_4.unit : sink.error(cause))), fileName_1 + ":485:32"));
339
+ export function mergeWithStrategy(streams, mergeStrategy) {
340
+ return new MergeWithStrategy(streams, mergeStrategy);
349
341
  }
350
342
  /**
351
343
  * @tsplus pipeable fncts.io.Push observe
352
344
  */
353
- function observe_1(f, __tsplusTrace) {
345
+ export function observe(f) {
354
346
  return self => {
355
- return tsplus_module_4.flatMap(future => tsplus_module_4.flatMap(fiber => tsplus_module_4.flatMap(() => tsplus_module_4.map(() => void 0, __tsplusTrace)(tsplus_module_28.interruptFork(fiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.wait(future, __tsplusTrace)), __tsplusTrace)(tsplus_module_29.forkScoped(tsplus_module_4.flatMap(() => tsplus_module_1.succeed_(undefined, __tsplusTrace)(future), __tsplusTrace)(self.run(tsplus_module_11.makeSink(a => tsplus_module_4.catchAllCause(cause => tsplus_module_1.failCause(cause, __tsplusTrace)(future), __tsplusTrace)(f(a)), cause => tsplus_module_1.failCause(cause, __tsplusTrace)(future)))), __tsplusTrace)), __tsplusTrace)(tsplus_module_9.make(__tsplusTrace));
347
+ return self.run(tsplus_module_4.unsafeMakeSink(f, cause => tsplus_module_1.orHalt(tsplus_module_1.failCause(() => cause, fileName_1 + ":458:63"), fileName_1 + ":458:70")));
356
348
  };
357
349
  }
358
- /**
359
- * @tsplus static fncts.io.PushOps repeatIOMaybe
360
- */
361
- export function repeatIOMaybe(io, __tsplusTrace) {
362
- return unfoldIO_1(undefined, () => tsplus_module_4.catchAll(maybeError => tsplus_module_16.match(() => tsplus_module_4.succeedNow(tsplus_module_25.nothing(__tsplusTrace), __tsplusTrace), tsplus_module_4.failNow)(maybeError), __tsplusTrace)(tsplus_module_4.map(a => tsplus_module_25.just([a, undefined], __tsplusTrace), __tsplusTrace)(io)));
363
- }
364
- /**
365
- * @tsplus getter fncts.io.Push runCollect
366
- */
367
- export function runCollect(self) {
368
- return tsplus_module_4.defer(() => {
369
- const out = [];
370
- return tsplus_module_4.as(() => tsplus_module_30.fromArray(out), fileName_1 + ":532:51")(observe_1(a => tsplus_module_4.succeed(() => out.push(a), fileName_1 + ":532:34"), fileName_1 + ":532:24")(self));
371
- }, fileName_1 + ":530:18");
350
+ class OrElseCause extends Push {
351
+ constructor(self, that) {
352
+ super();
353
+ this.self = self;
354
+ this.that = that;
355
+ }
356
+ run(sink) {
357
+ return this.self.run(tsplus_module_4.unsafeMakeSink(sink.onSuccess, cause => this.that(cause).run(sink)));
358
+ }
372
359
  }
373
360
  /**
374
- * @tsplus getter fncts.io.Push runDrain
361
+ * @tsplus pipeable fncts.io.Push orElseCause
375
362
  */
376
- export function runDrain(self) {
377
- return observe_1(() => tsplus_module_4.unit, fileName_1 + ":540:22")(self);
363
+ export function orElseCause(that) {
364
+ return self => new OrElseCause(self, that);
378
365
  }
379
366
  /**
380
- * @tsplus static fncts.io.PushOps scoped
367
+ * @tsplus pipeable fncts.io.Push provideEnvironment
381
368
  */
382
- function scoped_1(io, __tsplusTrace) {
383
- return tsplus_module_11.makePush(emitter => tsplus_module_4.matchCauseIO(cause => emitter.error(cause), value => emitter.event(value), __tsplusTrace)(tsplus_module_10.scoped(tsplus_module_4.defer(io, __tsplusTrace), __tsplusTrace)));
369
+ export function provideEnvironment(environment) {
370
+ return self => provideSomeEnvironment_1(environment)(self);
384
371
  }
385
- /**
386
- * @tsplus static fncts.io.PushOps succeed
387
- */
388
- export function succeed(value) {
389
- return fromIO_1(() => tsplus_module_4.succeed(value, fileName_1 + ":559:32"));
372
+ class ProvideLayer extends Push {
373
+ constructor(self, layer) {
374
+ super();
375
+ this.self = self;
376
+ this.layer = layer;
377
+ }
378
+ run(sink) {
379
+ return tsplus_module_2.bracketExit(() => tsplus_module_13.make, scope => tsplus_module_1.matchCauseIO(sink.onFailure, environment => tsplus_module_6.provideSomeEnvironment(environment, fileName_1 + ":501:100")(this.self.run(sink)), fileName_1 + ":501:24")(tsplus_module_14.build_(scope, fileName_1 + ":500:17")(this.layer)), (scope, exit) => scope.close(() => exit), fileName_1 + ":496:26");
380
+ }
390
381
  }
391
382
  /**
392
- * @tsplus pipeable fncts.io.Push switchMap
383
+ * @tsplus pipeable fncts.io.Push provideLayer
393
384
  */
394
- function switchMap_1(f) {
395
- return self => {
396
- return tsplus_module_11.makePush(sink => withSwitch(fork => self.run(tsplus_module_11.makeSink(a => fork(f(a).run(sink)), sink.error))));
397
- };
385
+ export function provideLayer(layer) {
386
+ return self => new ProvideLayer(self, layer);
398
387
  }
399
388
  /**
400
- * @tsplus pipeable fncts.io.Push switchMapIO
389
+ * @tsplus pipeable fncts.io.Push provideSomeEnvironment
401
390
  */
402
- function switchMapIO_1(f) {
403
- return self => {
404
- return switchMap_1(a => fromIO_1(() => f(a)))(self);
405
- };
391
+ function provideSomeEnvironment_1(environment) {
392
+ return self => contramapEnvironment_1(r => tsplus_module_15.union(environment)(r))(self);
406
393
  }
407
394
  /**
408
- * @tsplus pipeable fncts.io.Push tap
395
+ * @tsplus static fncts.io.PushOps schedule
409
396
  */
410
- export function tap(f) {
411
- return self => {
412
- return tsplus_module_11.makePush(sink => self.run(tsplus_module_11.makeSink(a => tsplus_module_4.matchCauseIO(sink.error, () => sink.event(a), fileName_1 + ":585:65")(f(a)), sink.error)));
413
- };
397
+ export function schedule(io, schedule) {
398
+ return fromIOProducer_1(new Scheduled(io, schedule));
414
399
  }
415
400
  /**
416
- * @tsplus pipeable fncts.io.Push transform
401
+ * @tsplus static fncts.io.PushOps succeed
417
402
  */
418
- function transform_1(f) {
419
- return self => tsplus_module_11.makePush(emitter => f(self.run(emitter)));
420
- }
421
- function unfoldLoop(s, f, emitter) {
422
- return tsplus_module_16.match(() => tsplus_module_4.unit, ([a, s]) => tsplus_module_4.zipRight(unfoldLoop(s, f, emitter), fileName_1 + ":603:35")(emitter.event(a)))(f(s));
403
+ export function succeed(value) {
404
+ return fromSyncProducer_1(tsplus_module_11.fromSync(value));
423
405
  }
424
406
  /**
425
- * @tsplus static fncts.io.PushOps unfold
407
+ * @tsplus static fncts.io.PushOps succeedNow
426
408
  */
427
- export function unfold(s, f) {
428
- return tsplus_module_11.makePush(emitter => unfoldLoop(s, f, emitter));
429
- }
430
- function unfoldIOLoop(s, f, emitter) {
431
- return tsplus_module_4.catchAllCause(cause => emitter.error(cause), fileName_1 + ":626:19")(tsplus_module_4.flatMap(result => tsplus_module_16.match(() => tsplus_module_4.unit, ([a, s]) => tsplus_module_4.zipRight(unfoldIOLoop(s, f, emitter), fileName_1 + ":623:39")(emitter.event(a)))(result), fileName_1 + ":620:13")(f(s)));
409
+ function succeedNow_1(value) {
410
+ return fromSyncProducer_1(tsplus_module_11.success(value));
432
411
  }
433
412
  /**
434
- * @tsplus static fncts.io.PushOps unfoldIO
413
+ * @tsplus pipeable fncts.io.Push switchMap
435
414
  */
436
- function unfoldIO_1(s, f) {
437
- return tsplus_module_11.makePush(emitter => unfoldIOLoop(s, f, emitter));
415
+ export function switchMap(f, executionStrategy) {
416
+ return self => flatMapWithStrategy_1(f, tsplus_module_9.SwitchStrategy, executionStrategy ?? tsplus_module_10.sequential)(self);
438
417
  }
439
418
  /**
440
- * @tsplus pipeable fncts.io.Push untilFuture
419
+ * @tsplus pipeable fncts.io.Push transform
441
420
  */
442
- export function untilFuture(future) {
421
+ export function transform(f) {
443
422
  return self => {
444
- return tsplus_module_11.makePush(sink => tsplus_module_20.asyncIO(cb => {
445
- const exit = tsplus_module_4.succeed(() => cb(tsplus_module_4.unit), fileName_1 + ":643:24");
446
- return tsplus_module_4.flatMap(streamFiber => tsplus_module_4.flatMap(futureFiber => tsplus_module_4.map(() => void 0, fileName_1 + ":654:12")(tsplus_module_31.joinAll([streamFiber, futureFiber], fileName_1 + ":654:26")), fileName_1 + ":646:32")(tsplus_module_32.fork(tsplus_module_4.zipRight(exit, fileName_1 + ":652:24")(tsplus_module_4.matchCauseIO(cause => sink.error(cause), () => tsplus_module_4.unit, fileName_1 + ":648:28")(tsplus_module_1.wait(future, fileName_1 + ":647:19"))), fileName_1 + ":652:30")), fileName_1 + ":645:32")(tsplus_module_32.fork(self.run(sink), fileName_1 + ":645:47"));
447
- }, fileName_1 + ":642:17"));
423
+ const op = new PushPrimitive(9 /* PushTag.Transform */);
424
+ op.i0 = self;
425
+ op.i1 = f;
426
+ return op;
448
427
  };
449
428
  }
450
- /**
451
- * @tsplus pipeable fncts.io.Push untilPush
452
- */
453
- export function untilPush(signal) {
454
- return self => {
455
- return tsplus_module_11.makePush(sink => tsplus_module_20.asyncIO(cb => {
456
- const exit = tsplus_module_4.succeed(() => cb(tsplus_module_4.unit), fileName_1 + ":668:24");
457
- return tsplus_module_4.flatMap(signalFiber => tsplus_module_4.flatMap(streamFiber => tsplus_module_4.map(() => void 0, fileName_1 + ":679:12")(tsplus_module_31.joinAll([signalFiber, streamFiber], fileName_1 + ":679:26")), fileName_1 + ":678:32")(tsplus_module_32.fork(self.run(sink), fileName_1 + ":678:47")), fileName_1 + ":670:32")(tsplus_module_32.fork(signal.run(tsplus_module_11.makeSink(() => exit, cause => sink.error(cause))), fileName_1 + ":676:14"));
458
- }, fileName_1 + ":667:17"));
459
- };
429
+ class Unwrap extends Push {
430
+ constructor(io) {
431
+ super();
432
+ this.io = io;
433
+ }
434
+ run(sink) {
435
+ return tsplus_module_1.matchCauseIO(cause => sink.onFailure(cause), stream => stream.run(sink), fileName_1 + ":568:32")(this.io);
436
+ }
460
437
  }
461
438
  /**
462
439
  * @tsplus static fncts.io.PushOps unwrap
463
440
  */
464
- function unwrap_1(io) {
465
- return flatten_1(fromIO_1(() => io));
466
- }
467
- /**
468
- * @tsplus static fncts.io.PushOps unwrapScoped
469
- */
470
- export function unwrapScoped(self, __tsplusTrace) {
471
- return flatten_1(scoped_1(() => self, __tsplusTrace));
441
+ export function unwrap(io) {
442
+ return new Unwrap(io);
472
443
  }
473
- /**
474
- * @tsplus static fncts.io.PushOps never
475
- */
476
- export const never = /*#__PURE__*/fromIO_1(() => tsplus_module_33.never);
477
444
  //# sourceMappingURL=api.mjs.map