@fncts/io 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- package/Fiber/constructors.d.ts +5 -0
- package/Push/api.d.ts +70 -41
- package/Push/definition.d.ts +11 -13
- package/Push/internal.d.ts +7 -11
- package/RefSubject/Atomic.d.ts +8 -11
- package/RefSubject/Synchronized/definition.d.ts +4 -6
- package/RefSubject/api.d.ts +0 -1
- package/RefSubject/definition.d.ts +6 -8
- package/STM/definition.d.ts +17 -0
- package/Sink/api.d.ts +6 -6
- package/Subject/Atomic.d.ts +4 -6
- package/Subject/definition.d.ts +2 -2
- package/_cjs/Fiber/constructors.cjs +10 -2
- package/_cjs/Fiber/constructors.cjs.map +1 -1
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Push/api.cjs +206 -175
- package/_cjs/Push/api.cjs.map +1 -1
- package/_cjs/Push/definition.cjs +12 -13
- package/_cjs/Push/definition.cjs.map +1 -1
- package/_cjs/Push/internal.cjs +37 -29
- package/_cjs/Push/internal.cjs.map +1 -1
- package/_cjs/RefSubject/Atomic.cjs +15 -19
- package/_cjs/RefSubject/Atomic.cjs.map +1 -1
- package/_cjs/RefSubject/Synchronized/definition.cjs +9 -10
- package/_cjs/RefSubject/Synchronized/definition.cjs.map +1 -1
- package/_cjs/RefSubject/api.cjs +5 -6
- package/_cjs/RefSubject/api.cjs.map +1 -1
- package/_cjs/RefSubject/definition.cjs.map +1 -1
- package/_cjs/STM/api.cjs +2 -2
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/STM/definition.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +13 -13
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/Subject/Atomic.cjs +4 -5
- package/_cjs/Subject/Atomic.cjs.map +1 -1
- package/_mjs/Fiber/constructors.mjs +7 -1
- package/_mjs/Fiber/constructors.mjs.map +1 -1
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Push/api.mjs +194 -173
- package/_mjs/Push/api.mjs.map +1 -1
- package/_mjs/Push/definition.mjs +9 -10
- package/_mjs/Push/definition.mjs.map +1 -1
- package/_mjs/Push/internal.mjs +33 -22
- package/_mjs/Push/internal.mjs.map +1 -1
- package/_mjs/RefSubject/Atomic.mjs +15 -19
- package/_mjs/RefSubject/Atomic.mjs.map +1 -1
- package/_mjs/RefSubject/Synchronized/definition.mjs +9 -10
- package/_mjs/RefSubject/Synchronized/definition.mjs.map +1 -1
- package/_mjs/RefSubject/api.mjs +6 -7
- package/_mjs/RefSubject/api.mjs.map +1 -1
- package/_mjs/RefSubject/definition.mjs.map +1 -1
- package/_mjs/STM/api.mjs +2 -2
- package/_mjs/STM/api.mjs.map +1 -1
- package/_mjs/STM/definition.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +10 -10
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/Subject/Atomic.mjs +4 -5
- package/_mjs/Subject/Atomic.mjs.map +1 -1
- package/_src/Fiber/constructors.ts +5 -0
- package/_src/IO/definition.ts +0 -1
- package/_src/Layer/api.ts +0 -1
- package/_src/Push/api.ts +270 -335
- package/_src/Push/definition.ts +13 -17
- package/_src/Push/internal.ts +63 -31
- package/_src/RefSubject/Atomic.ts +16 -22
- package/_src/RefSubject/Synchronized/definition.ts +6 -9
- package/_src/RefSubject/api.ts +9 -12
- package/_src/RefSubject/definition.ts +6 -8
- package/_src/STM/api.ts +0 -5
- package/_src/STM/definition.ts +6 -0
- package/_src/Sink/api.ts +9 -9
- package/_src/Subject/Atomic.ts +6 -8
- package/_src/Subject/definition.ts +2 -2
- package/package.json +1 -1
package/_cjs/Push/api.cjs
CHANGED
@@ -10,6 +10,12 @@ exports.combineLatest = exports.asyncInterrupt = void 0;
|
|
10
10
|
exports.combineLatestWith = combineLatestWith;
|
11
11
|
exports.debounce = debounce;
|
12
12
|
exports.defer = defer;
|
13
|
+
exports.exhaustMap = void 0;
|
14
|
+
exports.exhaustMapIO = exhaustMapIO;
|
15
|
+
exports.filter = filter;
|
16
|
+
exports.filterIO = filterIO;
|
17
|
+
exports.filterMap = filterMap;
|
18
|
+
exports.filterMapIO = filterMapIO;
|
13
19
|
exports.flatMap = void 0;
|
14
20
|
exports.flatMapConcurrent = flatMapConcurrent;
|
15
21
|
exports.flatten = exports.flatMapConcurrentUnbounded = exports.flatMapConcurrentBounded = void 0;
|
@@ -24,14 +30,14 @@ exports.mapIO = void 0;
|
|
24
30
|
exports.merge = merge;
|
25
31
|
exports.mergeAll = void 0;
|
26
32
|
exports.multicast = multicast;
|
27
|
-
exports.never = void 0;
|
28
|
-
exports.observe = observe;
|
33
|
+
exports.observe = exports.never = void 0;
|
29
34
|
exports.repeatIOMaybe = repeatIOMaybe;
|
30
35
|
exports.runCollect = runCollect;
|
31
36
|
exports.runDrain = runDrain;
|
32
37
|
exports.scoped = void 0;
|
33
38
|
exports.succeed = succeed;
|
34
|
-
exports.switchMap =
|
39
|
+
exports.switchMapIO = exports.switchMap = void 0;
|
40
|
+
exports.tap = tap;
|
35
41
|
exports.transform = void 0;
|
36
42
|
exports.unfold = unfold;
|
37
43
|
exports.unfoldIO = void 0;
|
@@ -48,38 +54,34 @@ var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
|
|
48
54
|
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/runtime"));
|
49
55
|
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scope"));
|
50
56
|
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
|
51
|
-
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
52
|
-
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
53
|
-
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
54
|
-
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
55
|
-
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
57
|
+
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scoped"));
|
58
|
+
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Push/definition"));
|
59
|
+
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
|
60
|
+
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/Iterable/api"));
|
61
|
+
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/foreachConcurrent"));
|
56
62
|
var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/delay"));
|
57
|
-
var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
58
|
-
var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
59
|
-
var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
60
|
-
var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
61
|
-
var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
62
|
-
var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
63
|
-
var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
64
|
-
var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
65
|
-
var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
66
|
-
var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
67
|
-
var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
68
|
-
var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/
|
69
|
-
var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
70
|
-
var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
71
|
-
var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
72
|
-
var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
73
|
-
var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/
|
74
|
-
var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
75
|
-
var tsplus_module_34 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/definition"));
|
76
|
-
var tsplus_module_35 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scoped"));
|
77
|
-
var tsplus_module_36 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Ref/api/set"));
|
78
|
-
var tsplus_module_37 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/joinAll"));
|
79
|
-
var tsplus_module_38 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/asyncInterrupt"));
|
63
|
+
var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
|
64
|
+
var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Semaphore"));
|
65
|
+
var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/concurrency"));
|
66
|
+
var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/function/api"));
|
67
|
+
var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/asyncIO"));
|
68
|
+
var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/forkDaemon"));
|
69
|
+
var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/await"));
|
70
|
+
var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/environment"));
|
71
|
+
var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
|
72
|
+
var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
|
73
|
+
var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
|
74
|
+
var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
|
75
|
+
var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interruptFork"));
|
76
|
+
var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/forkScoped"));
|
77
|
+
var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/definition"));
|
78
|
+
var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/joinAll"));
|
79
|
+
var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fork"));
|
80
|
+
var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/asyncInterrupt"));
|
80
81
|
var _AtomicReference = /*#__PURE__*/require("@fncts/base/internal/AtomicReference");
|
82
|
+
var _IO = /*#__PURE__*/require("@fncts/io/IO");
|
83
|
+
var _internal = /*#__PURE__*/require("@fncts/io/Push/internal");
|
81
84
|
var _definition4 = /*#__PURE__*/require("./definition.cjs");
|
82
|
-
var _internal = /*#__PURE__*/require("./internal.cjs");
|
83
85
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
84
86
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
85
87
|
var _a;
|
@@ -88,6 +90,8 @@ const asyncInterrupt = asyncInterrupt_1;
|
|
88
90
|
exports.asyncInterrupt = asyncInterrupt;
|
89
91
|
const combineLatest = combineLatest_1;
|
90
92
|
exports.combineLatest = combineLatest;
|
93
|
+
const exhaustMap = exhaustMap_1;
|
94
|
+
exports.exhaustMap = exhaustMap;
|
91
95
|
const flatMapConcurrentBounded = flatMapConcurrentBounded_1;
|
92
96
|
exports.flatMapConcurrentBounded = flatMapConcurrentBounded;
|
93
97
|
const flatMapConcurrentUnbounded = flatMapConcurrentUnbounded_1;
|
@@ -104,8 +108,14 @@ const mapIO = mapIO_1;
|
|
104
108
|
exports.mapIO = mapIO;
|
105
109
|
const mergeAll = mergeAll_1;
|
106
110
|
exports.mergeAll = mergeAll;
|
111
|
+
const observe = observe_1;
|
112
|
+
exports.observe = observe;
|
107
113
|
const scoped = scoped_1;
|
108
114
|
exports.scoped = scoped;
|
115
|
+
const switchMap = switchMap_1;
|
116
|
+
exports.switchMap = switchMap;
|
117
|
+
const switchMapIO = switchMapIO_1;
|
118
|
+
exports.switchMapIO = switchMapIO;
|
109
119
|
const transform = transform_1;
|
110
120
|
exports.transform = transform;
|
111
121
|
const unfoldIO = unfoldIO_1;
|
@@ -124,31 +134,30 @@ function as(b) {
|
|
124
134
|
* @tsplus static fncts.io.PushOps asyncInterrupt
|
125
135
|
*/
|
126
136
|
function asyncInterrupt_1(make) {
|
127
|
-
return
|
128
|
-
const
|
129
|
-
|
130
|
-
|
131
|
-
end: () => runtime.unsafeRunOrFork(tsplus_module_4.zipRight(tsplus_module_1.succeed_(undefined, fileName_1 + ":37:72")(future), fileName_1 + ":37:57")(emitter.end), fileName_1 + ":37:43")
|
137
|
+
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 => {
|
138
|
+
const unsafeSink = {
|
139
|
+
event: value => runtime.unsafeRunOrFork(tsplus_module_5.forkIn(scope, fileName_1 + ":34:77")(sink.event(value)), fileName_1 + ":34:52"),
|
140
|
+
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")
|
132
141
|
};
|
133
|
-
return tsplus_module_4.flatMap(eitherPush => tsplus_module_4.map(() => void 0, fileName_1 + ":
|
134
|
-
}, fileName_1 + ":
|
142
|
+
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"));
|
143
|
+
}, 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"));
|
135
144
|
}
|
136
145
|
/**
|
137
146
|
* @tsplus static fncts.io.PushOps async
|
138
147
|
*/
|
139
148
|
function async(make) {
|
140
|
-
return asyncInterrupt_1(
|
141
|
-
make(
|
142
|
-
return
|
149
|
+
return asyncInterrupt_1(sink => {
|
150
|
+
make(sink);
|
151
|
+
return tsplus_module_12.left(tsplus_module_4.unit, fileName_1 + ":54:23");
|
143
152
|
});
|
144
153
|
}
|
145
154
|
function combineLatest_1(streams) {
|
146
|
-
return
|
147
|
-
const size =
|
148
|
-
return tsplus_module_4.flatMap(ref =>
|
149
|
-
const emitIfReady = tsplus_module_4.flatMap(as => as.length === size ? emitter.
|
150
|
-
return tsplus_module_4.
|
151
|
-
}, fileName_1 + ":
|
155
|
+
return tsplus_module_11.makePush(emitter => (() => {
|
156
|
+
const size = tsplus_module_13.size(streams);
|
157
|
+
return tsplus_module_4.flatMap(ref => {
|
158
|
+
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"));
|
159
|
+
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"));
|
160
|
+
}, fileName_1 + ":69:30")(tsplus_module_4.succeed(() => Array(size), fileName_1 + ":69:33"));
|
152
161
|
})());
|
153
162
|
}
|
154
163
|
/**
|
@@ -164,21 +173,66 @@ function combineLatestWith(that, f) {
|
|
164
173
|
*/
|
165
174
|
function debounce(duration) {
|
166
175
|
return self => {
|
167
|
-
return
|
176
|
+
return switchMapIO_1(a => tsplus_module_15.delay(duration)(tsplus_module_4.succeedNow(a, fileName_1 + ":101:49")))(self);
|
168
177
|
};
|
169
178
|
}
|
170
179
|
/**
|
171
180
|
* @tsplus static fncts.io.PushOps defer
|
172
181
|
*/
|
173
182
|
function defer(self) {
|
174
|
-
return
|
183
|
+
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")));
|
184
|
+
}
|
185
|
+
/**
|
186
|
+
* @tsplus pipeable fncts.io.Push exhaustMap
|
187
|
+
*/
|
188
|
+
function exhaustMap_1(f) {
|
189
|
+
return self => {
|
190
|
+
return tsplus_module_11.makePush(sink => (0, _internal.withExhaust)(fork => self.run(tsplus_module_11.makeSink(a => fork(f(a).run(sink)), sink.error))));
|
191
|
+
};
|
192
|
+
}
|
193
|
+
/**
|
194
|
+
* @tsplus pipeable fncts.io.Push exhaustMapIO
|
195
|
+
*/
|
196
|
+
function exhaustMapIO(f) {
|
197
|
+
return self => {
|
198
|
+
return exhaustMap_1(a => fromIO_1(() => f(a)))(self);
|
199
|
+
};
|
200
|
+
}
|
201
|
+
/**
|
202
|
+
* @tsplus pipeable fncts.io.Push filterIO
|
203
|
+
*/
|
204
|
+
function filterIO(predicate) {
|
205
|
+
return self => {
|
206
|
+
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)));
|
207
|
+
};
|
208
|
+
}
|
209
|
+
/**
|
210
|
+
* @tsplus pipeable fncts.io.Push filterMapIO
|
211
|
+
*/
|
212
|
+
function filterMapIO(f) {
|
213
|
+
return self => {
|
214
|
+
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)));
|
215
|
+
};
|
216
|
+
}
|
217
|
+
function filter(predicate) {
|
218
|
+
return self => {
|
219
|
+
return tsplus_module_11.makePush(sink => self.run(tsplus_module_11.makeSink(a => predicate(a) ? sink.event(a) : tsplus_module_4.unit, sink.error)));
|
220
|
+
};
|
221
|
+
}
|
222
|
+
/**
|
223
|
+
* @tsplus pipeable fncts.io.Push filterMap
|
224
|
+
*/
|
225
|
+
function filterMap(f) {
|
226
|
+
return self => {
|
227
|
+
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)));
|
228
|
+
};
|
175
229
|
}
|
176
230
|
/**
|
177
231
|
* @tsplus pipeable fncts.io.Push flatMapConcurrentBounded
|
178
232
|
*/
|
179
233
|
function flatMapConcurrentBounded_1(f, concurrency) {
|
180
234
|
return self => {
|
181
|
-
return
|
235
|
+
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")));
|
182
236
|
};
|
183
237
|
}
|
184
238
|
/**
|
@@ -186,7 +240,7 @@ function flatMapConcurrentBounded_1(f, concurrency) {
|
|
186
240
|
*/
|
187
241
|
function flatMapConcurrentUnbounded_1(f) {
|
188
242
|
return self => {
|
189
|
-
return
|
243
|
+
return tsplus_module_11.makePush(sink => (0, _internal.withUnboundedConcurrency)(fork => self.run(tsplus_module_11.makeSink(a => fork(f(a).run(sink)), sink.error))));
|
190
244
|
};
|
191
245
|
}
|
192
246
|
/**
|
@@ -194,7 +248,7 @@ function flatMapConcurrentUnbounded_1(f) {
|
|
194
248
|
*/
|
195
249
|
function flatMapConcurrent(f) {
|
196
250
|
return self => {
|
197
|
-
return unwrap_1(tsplus_module_4.map(concurrency =>
|
251
|
+
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));
|
198
252
|
};
|
199
253
|
}
|
200
254
|
/**
|
@@ -209,34 +263,34 @@ function flatMap_1(f) {
|
|
209
263
|
* @tsplus getter fncts.io.Push flatten
|
210
264
|
*/
|
211
265
|
function flatten_1(self) {
|
212
|
-
return flatMap_1(
|
266
|
+
return flatMap_1(tsplus_module_19.identity)(self);
|
213
267
|
}
|
214
268
|
/**
|
215
269
|
* @tsplus static fncts.io.PushOps fromIO
|
216
270
|
*/
|
217
271
|
function fromIO_1(io) {
|
218
|
-
return
|
272
|
+
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")));
|
219
273
|
}
|
220
274
|
/**
|
221
275
|
* @tsplus static fncts.io.PushOps fromAsyncIterable
|
222
276
|
*/
|
223
277
|
function fromAsyncIterable(iterable) {
|
224
|
-
return
|
278
|
+
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"));
|
225
279
|
}
|
226
|
-
function fromAsyncIterableLoop(iterator,
|
227
|
-
return tsplus_module_4.matchCauseIO(cause =>
|
280
|
+
function fromAsyncIterableLoop(iterator, sink, cb, __tsplusTrace) {
|
281
|
+
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));
|
228
282
|
}
|
229
283
|
/**
|
230
284
|
* @tsplus static fncts.io.PushOps fromIterable
|
231
285
|
*/
|
232
286
|
function fromIterable(iterable) {
|
233
|
-
return
|
287
|
+
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
288
|
}
|
235
|
-
function fromIterableLoop(iterator,
|
289
|
+
function fromIterableLoop(iterator, sink, cb) {
|
236
290
|
return tsplus_module_4.defer(() => {
|
237
291
|
const value = iterator.next();
|
238
|
-
return value.done ?
|
239
|
-
}, fileName_1 + ":
|
292
|
+
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));
|
293
|
+
}, fileName_1 + ":290:18");
|
240
294
|
}
|
241
295
|
/**
|
242
296
|
* @tsplus getter fncts.io.Push multicast
|
@@ -250,45 +304,46 @@ class Multicast {
|
|
250
304
|
this[_a] = _definition4.PushTypeId;
|
251
305
|
this.observers = [];
|
252
306
|
}
|
253
|
-
run(
|
254
|
-
return tsplus_module_4.flatMap(environment => tsplus_module_4.
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
})
|
260
|
-
|
261
|
-
return tsplus_module_4.unit;
|
262
|
-
} else {
|
263
|
-
return tsplus_module_4.tap(fiber => tsplus_module_4.succeed(() => this.fiber = fiber, fileName_1 + ":292:44"), fileName_1 + ":292:30")(tsplus_module_12.forkScoped(tsplus_module_25.schedule(() => tsplus_module_24.asap, fileName_1 + ":291:24")(this.push.run(this)), fileName_1 + ":291:39"));
|
307
|
+
run(sink) {
|
308
|
+
return tsplus_module_4.flatMap(environment => tsplus_module_4.map(() => void 0, fileName_1 + ":322:8")(tsplus_module_4.defer(() => {
|
309
|
+
let io = tsplus_module_4.unit;
|
310
|
+
if (this.observers.push({
|
311
|
+
sink: sink,
|
312
|
+
environment
|
313
|
+
}) === 1) {
|
314
|
+
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"));
|
264
315
|
}
|
265
|
-
|
266
|
-
|
267
|
-
emit(value) {
|
268
|
-
return tsplus_module_4.defer(() => tsplus_module_4.foreachDiscard(this.observers.slice(), observer => this.runEvent(value, observer), fileName_1 + ":301:38"), fileName_1 + ":301:20");
|
269
|
-
}
|
270
|
-
failCause(cause) {
|
271
|
-
return tsplus_module_4.zipRight(tsplus_module_4.defer(() => this.cleanup(), fileName_1 + ":307:15"), fileName_1 + ":306:110")(tsplus_module_4.defer(() => tsplus_module_4.foreachDiscard(this.observers.slice(), observer => this.runFailCause(cause, observer), fileName_1 + ":306:33"), fileName_1 + ":306:15"));
|
316
|
+
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);
|
317
|
+
}, fileName_1 + ":323:17")), fileName_1 + ":321:28")(tsplus_module_23.environment(fileName_1 + ":321:43"));
|
272
318
|
}
|
273
|
-
|
274
|
-
return tsplus_module_4.
|
319
|
+
event(value) {
|
320
|
+
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");
|
275
321
|
}
|
276
|
-
|
277
|
-
return
|
322
|
+
error(cause) {
|
323
|
+
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");
|
278
324
|
}
|
279
|
-
|
280
|
-
|
281
|
-
return tsplus_module_26.provideEnvironment(observer.environment, fileName_1 + ":327:89")(tsplus_module_6.fulfill(observer.future, fileName_1 + ":327:53")(observer.emitter.failCause(cause)));
|
325
|
+
runValue(value, observer) {
|
326
|
+
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)));
|
282
327
|
}
|
283
|
-
|
284
|
-
|
285
|
-
return tsplus_module_26.provideEnvironment(observer.environment, fileName_1 + ":332:76")(tsplus_module_6.fulfill(observer.future, fileName_1 + ":332:40")(observer.emitter.end));
|
328
|
+
runError(cause, observer) {
|
329
|
+
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)));
|
286
330
|
}
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
331
|
+
removeSink(sink) {
|
332
|
+
return tsplus_module_4.defer(() => {
|
333
|
+
if (this.observers.length === 0) {
|
334
|
+
return tsplus_module_4.unit;
|
335
|
+
}
|
336
|
+
const index = this.observers.findIndex(observer => observer.sink === sink);
|
337
|
+
if (index > -1) {
|
338
|
+
this.observers.splice(index, 1);
|
339
|
+
if (this.observers.length === 0) {
|
340
|
+
const interrupt = tsplus_module_24.interrupt(this.fiber);
|
341
|
+
this.fiber = undefined;
|
342
|
+
return interrupt;
|
343
|
+
}
|
344
|
+
}
|
345
|
+
return tsplus_module_4.unit;
|
346
|
+
}, fileName_1 + ":357:20");
|
292
347
|
}
|
293
348
|
}
|
294
349
|
exports.Multicast = Multicast;
|
@@ -303,63 +358,20 @@ class Hold extends Multicast {
|
|
303
358
|
constructor(push) {
|
304
359
|
super(push);
|
305
360
|
this.push = push;
|
306
|
-
this.
|
307
|
-
this.pendingEmitters = [];
|
308
|
-
this.scheduledFiber = null;
|
361
|
+
this.current = new _AtomicReference.AtomicReference(tsplus_module_25.nothing(fileName_1 + ":383:49"));
|
309
362
|
}
|
310
|
-
run(
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
const value = this.value.get;
|
315
|
-
if (tsplus_module_28.isJust(value) && this.observers.length === 0) {
|
316
|
-
return tsplus_module_4.flatMap(() => super.run(emitter), fileName_1 + ":366:47")(emitter.emit(value.value));
|
363
|
+
run(sink) {
|
364
|
+
const current = this.current.get;
|
365
|
+
if (tsplus_module_26.isJust(current)) {
|
366
|
+
return tsplus_module_4.zipRight(super.run(sink), fileName_1 + ":393:41")(sink.event(current.value));
|
317
367
|
}
|
318
|
-
return super.run(
|
368
|
+
return super.run(sink);
|
319
369
|
}
|
320
|
-
|
370
|
+
event(value) {
|
321
371
|
return tsplus_module_4.defer(() => {
|
322
|
-
this.
|
323
|
-
return
|
324
|
-
}, fileName_1 + ":
|
325
|
-
}
|
326
|
-
failCause(cause) {
|
327
|
-
return tsplus_module_4.defer(() => tsplus_module_4.flatMap(() => super.failCause(cause), fileName_1 + ":380:48")(this.flushPending()), fileName_1 + ":380:20");
|
328
|
-
}
|
329
|
-
get end() {
|
330
|
-
return tsplus_module_4.defer(() => tsplus_module_4.flatMap(() => super.end, fileName_1 + ":384:48")(this.flushPending()), fileName_1 + ":384:20");
|
331
|
-
}
|
332
|
-
shouldScheduleFlush() {
|
333
|
-
return tsplus_module_28.isJust(this.value.get) && this.observers.length > 0;
|
334
|
-
}
|
335
|
-
scheduleFlush(observer) {
|
336
|
-
this.pendingEmitters.push([observer, tsplus_module_21.match(() => [], a => [a])(this.value.get)]);
|
337
|
-
const interrupt = this.scheduledFiber ? tsplus_module_30.interruptAsFork(this.scheduledFiber, tsplus_module_29.none) : tsplus_module_4.unit;
|
338
|
-
this.scheduledFiber = null;
|
339
|
-
return tsplus_module_4.tap(fiber => tsplus_module_4.succeed(() => this.scheduledFiber = fiber, fileName_1 + ":404:9"), fileName_1 + ":403:87")(tsplus_module_12.forkScoped(tsplus_module_4.zipRight(tsplus_module_4.flatMap(() => this.flushPending(), fileName_1 + ":403:44")(interrupt), fileName_1 + ":403:26")(tsplus_module_4.yieldNow), fileName_1 + ":403:72"));
|
340
|
-
}
|
341
|
-
flushPending() {
|
342
|
-
if (this.pendingEmitters.length === 0) {
|
343
|
-
return tsplus_module_4.unit;
|
344
|
-
}
|
345
|
-
const emitters = this.pendingEmitters;
|
346
|
-
this.pendingEmitters = [];
|
347
|
-
return tsplus_module_4.foreachDiscard(emitters, pendingEmitter => {
|
348
|
-
return tsplus_module_4.defer(() => {
|
349
|
-
const [emitter, values] = pendingEmitter;
|
350
|
-
const observer = this.observers.find(observer => observer.emitter === emitter);
|
351
|
-
if (!observer) {
|
352
|
-
return tsplus_module_4.unit;
|
353
|
-
}
|
354
|
-
return tsplus_module_4.foreachDiscard(values, value => this.runEvent(value, observer), fileName_1 + ":423:33");
|
355
|
-
}, fileName_1 + ":417:22");
|
356
|
-
}, fileName_1 + ":416:29");
|
357
|
-
}
|
358
|
-
addValue(value) {
|
359
|
-
this.value.set(tsplus_module_27.just(value, fileName_1 + ":429:24"));
|
360
|
-
this.pendingEmitters.forEach(([, values]) => {
|
361
|
-
values.push(value);
|
362
|
-
});
|
372
|
+
this.current.set(tsplus_module_25.just(value, fileName_1 + ":401:28"));
|
373
|
+
return super.event(value);
|
374
|
+
}, fileName_1 + ":400:20");
|
363
375
|
}
|
364
376
|
}
|
365
377
|
/**
|
@@ -368,7 +380,7 @@ class Hold extends Multicast {
|
|
368
380
|
exports.Hold = Hold;
|
369
381
|
function map_1(f) {
|
370
382
|
return self => {
|
371
|
-
return mapIO_1(a => tsplus_module_4.succeedNow(f(a), fileName_1 + ":
|
383
|
+
return mapIO_1(a => tsplus_module_4.succeedNow(f(a), fileName_1 + ":412:43"))(self);
|
372
384
|
};
|
373
385
|
}
|
374
386
|
/**
|
@@ -376,7 +388,7 @@ function map_1(f) {
|
|
376
388
|
*/
|
377
389
|
function mapError(f) {
|
378
390
|
return self => {
|
379
|
-
return
|
391
|
+
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)))));
|
380
392
|
};
|
381
393
|
}
|
382
394
|
/**
|
@@ -384,14 +396,14 @@ function mapError(f) {
|
|
384
396
|
*/
|
385
397
|
function mapErrorCause(f) {
|
386
398
|
return self => {
|
387
|
-
return
|
399
|
+
return tsplus_module_11.makePush(emitter => self.run(tsplus_module_11.makeSink(value => emitter.event(value), cause => emitter.error(f(cause)))));
|
388
400
|
};
|
389
401
|
}
|
390
402
|
/**
|
391
403
|
* @tsplus pipeable fncts.io.Push mapIO
|
392
404
|
*/
|
393
405
|
function mapIO_1(f) {
|
394
|
-
return self =>
|
406
|
+
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))));
|
395
407
|
}
|
396
408
|
/**
|
397
409
|
* @tsplus pipeable fncts.io.Push merge
|
@@ -402,21 +414,21 @@ function merge(that) {
|
|
402
414
|
};
|
403
415
|
}
|
404
416
|
function mergeAll_1(streams) {
|
405
|
-
return
|
417
|
+
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"));
|
406
418
|
}
|
407
419
|
/**
|
408
420
|
* @tsplus pipeable fncts.io.Push observe
|
409
421
|
*/
|
410
|
-
function
|
422
|
+
function observe_1(f, __tsplusTrace) {
|
411
423
|
return self => {
|
412
|
-
return tsplus_module_4.flatMap(future => tsplus_module_4.flatMap(fiber => tsplus_module_4.flatMap(() => tsplus_module_4.map(() => void 0, __tsplusTrace)(
|
424
|
+
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));
|
413
425
|
};
|
414
426
|
}
|
415
427
|
/**
|
416
428
|
* @tsplus static fncts.io.PushOps repeatIOMaybe
|
417
429
|
*/
|
418
430
|
function repeatIOMaybe(io, __tsplusTrace) {
|
419
|
-
return unfoldIO_1(undefined, () => tsplus_module_4.catchAll(maybeError =>
|
431
|
+
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)));
|
420
432
|
}
|
421
433
|
/**
|
422
434
|
* @tsplus getter fncts.io.Push runCollect
|
@@ -424,68 +436,84 @@ function repeatIOMaybe(io, __tsplusTrace) {
|
|
424
436
|
function runCollect(self) {
|
425
437
|
return tsplus_module_4.defer(() => {
|
426
438
|
const out = [];
|
427
|
-
return tsplus_module_4.
|
428
|
-
}, fileName_1 + ":
|
439
|
+
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));
|
440
|
+
}, fileName_1 + ":530:18");
|
429
441
|
}
|
430
442
|
/**
|
431
443
|
* @tsplus getter fncts.io.Push runDrain
|
432
444
|
*/
|
433
445
|
function runDrain(self) {
|
434
|
-
return
|
446
|
+
return observe_1(() => tsplus_module_4.unit, fileName_1 + ":540:22")(self);
|
435
447
|
}
|
436
448
|
/**
|
437
449
|
* @tsplus static fncts.io.PushOps scoped
|
438
450
|
*/
|
439
451
|
function scoped_1(io, __tsplusTrace) {
|
440
|
-
return
|
452
|
+
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)));
|
441
453
|
}
|
442
454
|
/**
|
443
455
|
* @tsplus static fncts.io.PushOps succeed
|
444
456
|
*/
|
445
457
|
function succeed(value) {
|
446
|
-
return fromIO_1(() => tsplus_module_4.succeed(value, fileName_1 + ":
|
458
|
+
return fromIO_1(() => tsplus_module_4.succeed(value, fileName_1 + ":559:32"));
|
459
|
+
}
|
460
|
+
/**
|
461
|
+
* @tsplus pipeable fncts.io.Push switchMap
|
462
|
+
*/
|
463
|
+
function switchMap_1(f) {
|
464
|
+
return self => {
|
465
|
+
return tsplus_module_11.makePush(sink => (0, _internal.withSwitch)(fork => self.run(tsplus_module_11.makeSink(a => fork(f(a).run(sink)), sink.error))));
|
466
|
+
};
|
467
|
+
}
|
468
|
+
/**
|
469
|
+
* @tsplus pipeable fncts.io.Push switchMapIO
|
470
|
+
*/
|
471
|
+
function switchMapIO_1(f) {
|
472
|
+
return self => {
|
473
|
+
return switchMap_1(a => fromIO_1(() => f(a)))(self);
|
474
|
+
};
|
447
475
|
}
|
448
476
|
/**
|
449
|
-
* @tsplus pipeable fncts.io.
|
477
|
+
* @tsplus pipeable fncts.io.Push tap
|
450
478
|
*/
|
451
|
-
function
|
479
|
+
function tap(f) {
|
452
480
|
return self => {
|
453
|
-
return
|
454
|
-
const innerEmitter = tsplus_module_10.makeEmitter(value => emitter.emit(value), cause => tsplus_module_4.zipRight(emitter.failCause(cause), fileName_1 + ":638:41")(tsplus_module_36.set(null, fileName_1 + ":638:33")(current)), latch.countDown);
|
455
|
-
return tsplus_module_4.flatMap(() => tsplus_module_4.map(() => void 0, fileName_1 + ":653:10")(tsplus_module_4.zipRight(emitter.end, fileName_1 + ":653:24")(latch.await)), fileName_1 + ":641:10")(self.run(tsplus_module_10.makeEmitter(value => tsplus_module_18.updateIO(fiber => tsplus_module_4.zipRight(tsplus_module_12.forkScoped(f(value).run(innerEmitter), fileName_1 + ":646:98"), fileName_1 + ":646:71")(fiber ? tsplus_module_17.interrupt(fiber) : latch.increment), fileName_1 + ":645:33")(current), cause => emitter.failCause(cause), latch.countDown)));
|
456
|
-
}, fileName_1 + ":635:31")(tsplus_module_13.make(1)), fileName_1 + ":634:31")(tsplus_module_19.makeSynchronized(() => null, fileName_1 + ":634:53")));
|
481
|
+
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)));
|
457
482
|
};
|
458
483
|
}
|
459
484
|
/**
|
460
485
|
* @tsplus pipeable fncts.io.Push transform
|
461
486
|
*/
|
462
487
|
function transform_1(f) {
|
463
|
-
return self =>
|
488
|
+
return self => tsplus_module_11.makePush(emitter => f(self.run(emitter)));
|
464
489
|
}
|
465
490
|
function unfoldLoop(s, f, emitter) {
|
466
|
-
return
|
491
|
+
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));
|
467
492
|
}
|
468
493
|
/**
|
469
494
|
* @tsplus static fncts.io.PushOps unfold
|
470
495
|
*/
|
471
496
|
function unfold(s, f) {
|
472
|
-
return
|
497
|
+
return tsplus_module_11.makePush(emitter => unfoldLoop(s, f, emitter));
|
473
498
|
}
|
474
499
|
function unfoldIOLoop(s, f, emitter) {
|
475
|
-
return tsplus_module_4.catchAllCause(cause => emitter.
|
500
|
+
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)));
|
476
501
|
}
|
477
502
|
/**
|
478
503
|
* @tsplus static fncts.io.PushOps unfoldIO
|
479
504
|
*/
|
480
505
|
function unfoldIO_1(s, f) {
|
481
|
-
return
|
506
|
+
return tsplus_module_11.makePush(emitter => unfoldIOLoop(s, f, emitter));
|
482
507
|
}
|
483
508
|
/**
|
484
509
|
* @tsplus pipeable fncts.io.Push untilFuture
|
485
510
|
*/
|
486
511
|
function untilFuture(future) {
|
487
512
|
return self => {
|
488
|
-
return
|
513
|
+
return tsplus_module_11.makePush(sink => tsplus_module_20.asyncIO(cb => {
|
514
|
+
const exit = tsplus_module_4.succeed(() => cb(tsplus_module_4.unit), fileName_1 + ":643:24");
|
515
|
+
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"));
|
516
|
+
}, fileName_1 + ":642:17"));
|
489
517
|
};
|
490
518
|
}
|
491
519
|
/**
|
@@ -493,7 +521,10 @@ function untilFuture(future) {
|
|
493
521
|
*/
|
494
522
|
function untilPush(signal) {
|
495
523
|
return self => {
|
496
|
-
return
|
524
|
+
return tsplus_module_11.makePush(sink => tsplus_module_20.asyncIO(cb => {
|
525
|
+
const exit = tsplus_module_4.succeed(() => cb(tsplus_module_4.unit), fileName_1 + ":668:24");
|
526
|
+
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"));
|
527
|
+
}, fileName_1 + ":667:17"));
|
497
528
|
};
|
498
529
|
}
|
499
530
|
/**
|
@@ -511,6 +542,6 @@ function unwrapScoped(self, __tsplusTrace) {
|
|
511
542
|
/**
|
512
543
|
* @tsplus static fncts.io.PushOps never
|
513
544
|
*/
|
514
|
-
const never = /*#__PURE__*/fromIO_1(() =>
|
545
|
+
const never = /*#__PURE__*/fromIO_1(() => tsplus_module_33.never);
|
515
546
|
exports.never = never;
|
516
547
|
//# sourceMappingURL=api.cjs.map
|