@fncts/io 0.0.15 → 0.0.18
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.
- package/Cached/internal.d.ts +1 -1
- package/CancellerState.d.ts +1 -1
- package/Channel/ChildExecutorDecision/definition.d.ts +1 -1
- package/Channel/UpstreamPullRequest/definition.d.ts +1 -1
- package/Channel/UpstreamPullStrategy/definition.d.ts +1 -1
- package/Channel/api/mergeAllWith.d.ts +1 -1
- package/Channel/internal/ChannelExecutor.d.ts +1 -1
- package/Channel/internal/ChannelState.d.ts +2 -2
- package/Channel/internal/MergeDecision.d.ts +1 -1
- package/Channel/internal/MergeState.d.ts +1 -1
- package/Channel/internal/SingleProducerAsyncInput.d.ts +1 -1
- package/Fiber/FiberContext.d.ts +18 -18
- package/Fiber/definition.d.ts +2 -2
- package/FiberRef/api.d.ts +2 -2
- package/FiberRef/definition.d.ts +2 -2
- package/FiberRef/unsafe.d.ts +6 -0
- package/FiberRefs/definition.d.ts +1 -1
- package/FiberState/definition.d.ts +2 -2
- package/FiberStatus/definition.d.ts +1 -1
- package/Future/definition.d.ts +1 -1
- package/Hub/definition.d.ts +1 -1
- package/IO/api/core-scope.d.ts +4 -3
- package/IO/api/interrupt.d.ts +2 -2
- package/IO/api/supervised.d.ts +10 -0
- package/IO/api.d.ts +7 -10
- package/IO/definition.d.ts +16 -139
- package/IO.d.ts +1 -0
- package/IOEnv/definition.d.ts +1 -1
- package/Layer/definition.d.ts +2 -2
- package/Ref/definition.d.ts +3 -3
- package/RuntimeConfig.d.ts +1 -1
- package/STM/definition.d.ts +5 -5
- package/STM/internal/CommitState.d.ts +1 -1
- package/STM/internal/Entry.d.ts +2 -2
- package/STM/internal/Journal.d.ts +6 -6
- package/STM/internal/TryCommit.d.ts +2 -2
- package/STM/internal/Versioned.d.ts +1 -1
- package/Schedule/Decision.d.ts +1 -1
- package/Scope/ReleaseMap/definition.d.ts +1 -1
- package/Scope/definition.d.ts +2 -2
- package/ScopedRef/definition.d.ts +1 -1
- package/State/internal.d.ts +1 -1
- package/Stream/api.d.ts +1 -1
- package/Stream/definition.d.ts +1 -1
- package/Stream/internal/DebounceState.d.ts +4 -4
- package/Stream/internal/Handoff.d.ts +5 -5
- package/Stream/internal/Pull.d.ts +1 -1
- package/Stream/internal/SinkEndReason.d.ts +1 -1
- package/TExit/definition.d.ts +3 -3
- package/TReentrantLock/definition.d.ts +1 -1
- package/TRef/definition.d.ts +1 -1
- package/TxnId.d.ts +1 -1
- package/_cjs/Clock/definition.cjs +1 -1
- package/_cjs/Clock/definition.cjs.map +1 -1
- package/_cjs/Console/definition.cjs +1 -1
- package/_cjs/Console/definition.cjs.map +1 -1
- package/_cjs/Fiber/FiberContext.cjs +161 -294
- package/_cjs/Fiber/FiberContext.cjs.map +1 -1
- package/_cjs/FiberRef/api.cjs +19 -10
- package/_cjs/FiberRef/api.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +9 -1
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/IO/api/core-scope.cjs +23 -15
- package/_cjs/IO/api/core-scope.cjs.map +1 -1
- package/_cjs/IO/api/ensuringChildren.cjs +4 -2
- package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +17 -9
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/supervised.cjs +26 -0
- package/_cjs/IO/api/supervised.cjs.map +1 -0
- package/_cjs/IO/api/withChildren.cjs +4 -2
- package/_cjs/IO/api/withChildren.cjs.map +1 -1
- package/_cjs/IO/api.cjs +69 -63
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs +8 -226
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO.cjs +13 -0
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/Layer/api.cjs +1 -1
- package/_cjs/Layer/api.cjs.map +1 -1
- package/_cjs/Random/definition.cjs +1 -1
- package/_cjs/Random/definition.cjs.map +1 -1
- package/_cjs/Scope/definition.cjs +1 -1
- package/_cjs/Scope/definition.cjs.map +1 -1
- package/_mjs/Clock/definition.mjs +1 -1
- package/_mjs/Clock/definition.mjs.map +1 -1
- package/_mjs/Console/definition.mjs +1 -1
- package/_mjs/Console/definition.mjs.map +1 -1
- package/_mjs/Fiber/FiberContext.mjs +161 -293
- package/_mjs/Fiber/FiberContext.mjs.map +1 -1
- package/_mjs/FiberRef/api.mjs +18 -9
- package/_mjs/FiberRef/api.mjs.map +1 -1
- package/_mjs/FiberRef/unsafe.mjs +6 -0
- package/_mjs/FiberRef/unsafe.mjs.map +1 -1
- package/_mjs/IO/api/core-scope.mjs +21 -16
- package/_mjs/IO/api/core-scope.mjs.map +1 -1
- package/_mjs/IO/api/ensuringChildren.mjs +3 -2
- package/_mjs/IO/api/ensuringChildren.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +14 -6
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/supervised.mjs +14 -0
- package/_mjs/IO/api/supervised.mjs.map +1 -0
- package/_mjs/IO/api/withChildren.mjs +3 -2
- package/_mjs/IO/api/withChildren.mjs.map +1 -1
- package/_mjs/IO/api.mjs +67 -60
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs +5 -184
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO.mjs +1 -0
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/Layer/api.mjs +1 -1
- package/_mjs/Layer/api.mjs.map +1 -1
- package/_mjs/Random/definition.mjs +1 -1
- package/_mjs/Random/definition.mjs.map +1 -1
- package/_mjs/Scope/definition.mjs +1 -1
- package/_mjs/Scope/definition.mjs.map +1 -1
- package/_src/Clock/definition.ts +1 -1
- package/_src/Console/definition.ts +1 -1
- package/_src/Fiber/FiberContext.ts +21 -111
- package/_src/FiberRef/api.ts +15 -7
- package/_src/FiberRef/unsafe.ts +5 -0
- package/_src/IO/api/core-scope.ts +12 -10
- package/_src/IO/api/interrupt.ts +8 -3
- package/_src/IO/api/supervised.ts +14 -0
- package/_src/IO/api.ts +25 -26
- package/_src/IO/definition.ts +8 -158
- package/_src/IO.ts +1 -0
- package/_src/Layer/api.ts +1 -1
- package/_src/Random/definition.ts +1 -1
- package/_src/Scope/definition.ts +1 -1
- package/package.json +4 -3
@@ -24,75 +24,73 @@ var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
|
|
24
24
|
|
25
25
|
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/internal/Stack"));
|
26
26
|
|
27
|
-
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
27
|
+
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberRef/unsafe"));
|
28
28
|
|
29
|
-
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
29
|
+
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
|
30
30
|
|
31
|
-
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
31
|
+
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/HashMap/api"));
|
32
32
|
|
33
|
-
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberRefs/
|
33
|
+
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberRefs/api"));
|
34
34
|
|
35
|
-
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
35
|
+
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberRefs/join"));
|
36
36
|
|
37
|
-
var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
37
|
+
var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/api"));
|
38
38
|
|
39
|
-
var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc
|
39
|
+
var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc"));
|
40
40
|
|
41
|
-
var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
41
|
+
var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/empty"));
|
42
42
|
|
43
|
-
var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
43
|
+
var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/api"));
|
44
44
|
|
45
|
-
var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/
|
45
|
+
var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/environment"));
|
46
46
|
|
47
|
-
var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
47
|
+
var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/fulfill"));
|
48
48
|
|
49
|
-
var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
49
|
+
var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Future/constructors"));
|
50
50
|
|
51
|
-
var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
51
|
+
var tsplus_module_22 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
|
52
52
|
|
53
|
-
var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
53
|
+
var tsplus_module_23 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberScope/constructors"));
|
54
54
|
|
55
|
-
var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
55
|
+
var tsplus_module_24 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/List/constructors"));
|
56
56
|
|
57
|
-
var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
57
|
+
var tsplus_module_25 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/RuntimeConfig"));
|
58
58
|
|
59
|
-
var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
59
|
+
var tsplus_module_26 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Supervisor/constructors"));
|
60
60
|
|
61
|
-
var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/
|
61
|
+
var tsplus_module_27 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
|
62
62
|
|
63
|
-
var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
63
|
+
var tsplus_module_28 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/constructors"));
|
64
64
|
|
65
|
-
var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
65
|
+
var tsplus_module_29 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/exceptions"));
|
66
66
|
|
67
|
-
var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
67
|
+
var tsplus_module_30 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/FiberId/constructors"));
|
68
68
|
|
69
|
-
var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
69
|
+
var tsplus_module_31 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/interrupt"));
|
70
70
|
|
71
|
-
var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
71
|
+
var tsplus_module_32 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberRef/api"));
|
72
72
|
|
73
|
-
var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/
|
73
|
+
var tsplus_module_33 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/api"));
|
74
74
|
|
75
|
-
var tsplus_module_34 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
75
|
+
var tsplus_module_34 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/List/definition"));
|
76
76
|
|
77
|
-
var tsplus_module_35 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
77
|
+
var tsplus_module_35 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api/isEmpty"));
|
78
78
|
|
79
|
-
var tsplus_module_36 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
79
|
+
var tsplus_module_36 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberStatus/constructors"));
|
80
80
|
|
81
|
-
var tsplus_module_37 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
81
|
+
var tsplus_module_37 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/CancellerState"));
|
82
82
|
|
83
|
-
var tsplus_module_38 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
83
|
+
var tsplus_module_38 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberState/api"));
|
84
84
|
|
85
|
-
var tsplus_module_39 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
85
|
+
var tsplus_module_39 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/TraceElement/definition"));
|
86
86
|
|
87
|
-
var tsplus_module_40 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/
|
87
|
+
var tsplus_module_40 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/FiberDescriptor"));
|
88
88
|
|
89
|
-
var tsplus_module_41 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
89
|
+
var tsplus_module_41 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/InterruptStatus/constructors"));
|
90
90
|
|
91
|
-
var tsplus_module_42 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
91
|
+
var tsplus_module_42 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/List/api"));
|
92
92
|
|
93
|
-
var tsplus_module_43 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
94
|
-
|
95
|
-
var tsplus_module_44 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Trace/definition"));
|
93
|
+
var tsplus_module_43 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Trace/definition"));
|
96
94
|
|
97
95
|
var _AtomicReference = /*#__PURE__*/require("@fncts/base/internal/AtomicReference");
|
98
96
|
|
@@ -181,15 +179,15 @@ class FiberContext {
|
|
181
179
|
this.interruptExit = new InterruptExit(v => {
|
182
180
|
if (this.unsafeIsInterruptible) {
|
183
181
|
this.interruptStatus.pop();
|
184
|
-
return
|
182
|
+
return tsplus_module_11.succeedNow(v, fileName_1 + ":492:27");
|
185
183
|
} else {
|
186
|
-
return
|
184
|
+
return tsplus_module_11.succeed(() => {
|
187
185
|
this.interruptStatus.pop();
|
188
186
|
return v;
|
189
|
-
}, fileName_1 + ":
|
187
|
+
}, fileName_1 + ":494:24");
|
190
188
|
}
|
191
189
|
});
|
192
|
-
this.currentSupervisor
|
190
|
+
this.unsafeSetRef(tsplus_module_10.currentSupervisor, this.runtimeConfig.supervisor);
|
193
191
|
}
|
194
192
|
|
195
193
|
get [tsplus_module_2.hashSymbol]() {
|
@@ -197,23 +195,23 @@ class FiberContext {
|
|
197
195
|
}
|
198
196
|
|
199
197
|
[tsplus_module_5.equalsSymbol](that) {
|
200
|
-
return (0, _definition6.isFiber)(that) && tsplus_module_7.strictEquals(this.id, tsplus_module_6.id(that, fileName_1 + ":
|
198
|
+
return (0, _definition6.isFiber)(that) && tsplus_module_7.strictEquals(this.id, tsplus_module_6.id(that, fileName_1 + ":68:44"));
|
201
199
|
}
|
202
200
|
|
203
201
|
get poll() {
|
204
|
-
return
|
202
|
+
return tsplus_module_11.succeed(() => this.unsafePoll(), fileName_1 + ":87:22");
|
205
203
|
}
|
206
204
|
|
207
205
|
get inheritRefs() {
|
208
|
-
return
|
206
|
+
return tsplus_module_11.defer(() => {
|
209
207
|
const childFiberRefLocals = this.fiberRefLocals.get;
|
210
208
|
|
211
|
-
if (
|
212
|
-
return
|
209
|
+
if (tsplus_module_12.isEmpty(childFiberRefLocals)) {
|
210
|
+
return tsplus_module_11.unit;
|
213
211
|
} else {
|
214
|
-
return
|
212
|
+
return tsplus_module_11.updateFiberRefs((parentFiberId, parentFiberRefs) => tsplus_module_14.join(parentFiberRefs, parentFiberId, tsplus_module_13.make(childFiberRefLocals)), fileName_1 + ":96:34");
|
215
213
|
}
|
216
|
-
}, fileName_1 + ":
|
214
|
+
}, fileName_1 + ":91:20");
|
217
215
|
}
|
218
216
|
|
219
217
|
get id() {
|
@@ -221,7 +219,7 @@ class FiberContext {
|
|
221
219
|
}
|
222
220
|
|
223
221
|
awaitAsync(k) {
|
224
|
-
const exit = this.unsafeAddObserver(exit => k(
|
222
|
+
const exit = this.unsafeAddObserver(exit => k(tsplus_module_15.flatten(exit)));
|
225
223
|
|
226
224
|
if (exit != null) {
|
227
225
|
k(exit);
|
@@ -229,33 +227,33 @@ class FiberContext {
|
|
229
227
|
}
|
230
228
|
|
231
229
|
get children() {
|
232
|
-
return this.evalOnIO(
|
233
|
-
const concBuilder = new
|
230
|
+
return this.evalOnIO(tsplus_module_11.succeed(() => {
|
231
|
+
const concBuilder = new tsplus_module_16.ConcBuilder(tsplus_module_17.empty());
|
234
232
|
|
235
233
|
for (const child of this._children) {
|
236
234
|
concBuilder.append(child);
|
237
235
|
}
|
238
236
|
|
239
237
|
return concBuilder.result();
|
240
|
-
}, fileName_1 + ":
|
238
|
+
}, fileName_1 + ":117:17"), tsplus_module_11.succeed(() => tsplus_module_17.empty(), fileName_1 + ":126:17"), fileName_1 + ":116:25");
|
241
239
|
}
|
242
240
|
|
243
241
|
evalOnIO(effect, orElse, __tsplusTrace) {
|
244
|
-
return
|
242
|
+
return tsplus_module_11.flatMap_(tsplus_module_19.environment(fileName_1 + ":136:33"), r => tsplus_module_11.flatMap_(tsplus_module_21.make(fileName_1 + ":137:30"), p => tsplus_module_11.flatMap_(this.evalOn(tsplus_module_20.fulfill_(tsplus_module_19.provideEnvironment_(effect, r, fileName_1 + ":138:46"), p, fileName_1 + ":138:57"), tsplus_module_20.fulfill_(tsplus_module_19.provideEnvironment_(orElse, r, fileName_1 + ":138:87"), p, fileName_1 + ":138:98")), () => tsplus_module_18.wait(p, fileName_1 + ":139:17"), fileName_1 + ":138:8"), fileName_1 + ":137:18"), fileName_1 + ":136:18");
|
245
243
|
}
|
246
244
|
|
247
245
|
get await() {
|
248
|
-
return
|
249
|
-
const cb = x => k(
|
246
|
+
return tsplus_module_11.asyncInterrupt(k => {
|
247
|
+
const cb = x => k(tsplus_module_11.fromExit(() => x, fileName_1 + ":145:78"));
|
250
248
|
|
251
249
|
const result = this.unsafeAddObserver(cb);
|
252
250
|
|
253
251
|
if (result == null) {
|
254
|
-
return
|
252
|
+
return tsplus_module_22.left(tsplus_module_11.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":148:38"));
|
255
253
|
} else {
|
256
|
-
return
|
254
|
+
return tsplus_module_22.right(tsplus_module_11.succeedNow(result, fileName_1 + ":150:42"));
|
257
255
|
}
|
258
|
-
}, this.fiberId, fileName_1 + ":
|
256
|
+
}, this.fiberId, fileName_1 + ":144:29");
|
259
257
|
}
|
260
258
|
|
261
259
|
run() {
|
@@ -263,15 +261,15 @@ class FiberContext {
|
|
263
261
|
}
|
264
262
|
|
265
263
|
get scope() {
|
266
|
-
return
|
264
|
+
return tsplus_module_23.unsafeMake(this);
|
267
265
|
}
|
268
266
|
|
269
267
|
get status() {
|
270
|
-
return
|
268
|
+
return tsplus_module_11.succeedNow(this.state.status, fileName_1 + ":164:25");
|
271
269
|
}
|
272
270
|
|
273
271
|
get trace() {
|
274
|
-
return
|
272
|
+
return tsplus_module_11.succeed(() => this.unsafeCaptureTrace(tsplus_module_24.empty()), fileName_1 + ":168:22");
|
275
273
|
}
|
276
274
|
|
277
275
|
interruptAs(fiberId) {
|
@@ -279,7 +277,7 @@ class FiberContext {
|
|
279
277
|
}
|
280
278
|
|
281
279
|
evalOn(effect, orElse) {
|
282
|
-
return
|
280
|
+
return tsplus_module_11.defer(() => this.unsafeEvalOn(effect, orElse), fileName_1 + ":176:20");
|
283
281
|
}
|
284
282
|
|
285
283
|
get location() {
|
@@ -298,9 +296,9 @@ class FiberContext {
|
|
298
296
|
this.nextIO = null;
|
299
297
|
let extraTrace = undefined;
|
300
298
|
const flags = this.runtimeConfig.flags;
|
301
|
-
const superviseOps = flags.isEnabled(
|
302
|
-
this.runtimeConfig.flags.isEnabled(
|
303
|
-
this.currentSupervisor !==
|
299
|
+
const superviseOps = flags.isEnabled(tsplus_module_25.RuntimeConfigFlag.SuperviseOperations) && this.currentSupervisor !== tsplus_module_26.none;
|
300
|
+
this.runtimeConfig.flags.isEnabled(tsplus_module_25.RuntimeConfigFlag.EnableCurrentFiber) && currentFiber.set(this);
|
301
|
+
this.currentSupervisor !== tsplus_module_26.none && this.currentSupervisor.unsafeOnResume(this);
|
304
302
|
|
305
303
|
while (current !== null) {
|
306
304
|
try {
|
@@ -312,7 +310,7 @@ class FiberContext {
|
|
312
310
|
|
313
311
|
if (message !== null) {
|
314
312
|
const oldIO = current;
|
315
|
-
current =
|
313
|
+
current = tsplus_module_11.flatMap_(message, () => oldIO, fileName_1 + ":213:55");
|
316
314
|
} else if (opCount === maxOpCount) {
|
317
315
|
this.unsafeRunLater(current);
|
318
316
|
current = null;
|
@@ -363,7 +361,7 @@ class FiberContext {
|
|
363
361
|
:
|
364
362
|
{
|
365
363
|
extraTrace = current.trace;
|
366
|
-
this.unsafeRunLater(
|
364
|
+
this.unsafeRunLater(tsplus_module_11.unit);
|
367
365
|
extraTrace = undefined;
|
368
366
|
current = null;
|
369
367
|
break;
|
@@ -384,7 +382,7 @@ class FiberContext {
|
|
384
382
|
/* IOTag.Trace */
|
385
383
|
:
|
386
384
|
{
|
387
|
-
current = this.unsafeNextEffect(this.unsafeCaptureTrace(
|
385
|
+
current = this.unsafeNextEffect(this.unsafeCaptureTrace(tsplus_module_24.cons(current.trace, tsplus_module_24.nil())));
|
388
386
|
break;
|
389
387
|
}
|
390
388
|
|
@@ -416,25 +414,25 @@ class FiberContext {
|
|
416
414
|
/* IOTag.Fail */
|
417
415
|
:
|
418
416
|
{
|
419
|
-
const fastPathTrace = extraTrace === undefined ?
|
417
|
+
const fastPathTrace = extraTrace === undefined ? tsplus_module_24.nil() : tsplus_module_24.cons(extraTrace, tsplus_module_24.nil());
|
420
418
|
extraTrace = undefined;
|
421
419
|
const cause = current.cause();
|
422
|
-
const tracedCause =
|
420
|
+
const tracedCause = tsplus_module_27.isTraced(cause) ? cause : tsplus_module_27.traced(cause, this.unsafeCaptureTrace(tsplus_module_24.cons(current.trace, fastPathTrace)));
|
423
421
|
const discardedFolds = this.unsafeUnwindStack();
|
424
422
|
const strippedCause = discardedFolds ? // We threw away some error handlers while unwinding the stack because
|
425
|
-
|
423
|
+
tsplus_module_27.stripFailures( // We threw away some error handlers while unwinding the stack because
|
426
424
|
// we got interrupted during this instruction. So it's not safe to return
|
427
425
|
// typed failures from cause0, because they might not be typed correctly.
|
428
426
|
// Instead, we strip the typed failures, and return the remainders and
|
429
427
|
// the interruption
|
430
428
|
tracedCause) : tracedCause;
|
431
429
|
const suppressed = this.unsafeClearSuppressedCause();
|
432
|
-
const fullCause =
|
430
|
+
const fullCause = tsplus_module_27.contains_(strippedCause, suppressed) ? strippedCause : tsplus_module_27.then(strippedCause, suppressed);
|
433
431
|
|
434
432
|
if (!this.stack.hasNext) {
|
435
433
|
// Error not caught, stack is empty:
|
436
434
|
this.unsafeSetInterrupting(true);
|
437
|
-
current = this.unsafeTryDone(
|
435
|
+
current = this.unsafeTryDone(tsplus_module_28.failCause(fullCause), current.trace);
|
438
436
|
} else {
|
439
437
|
this.unsafeSetInterrupting(false); // Error caught, next continuation on the stack will deal
|
440
438
|
// with it, so we just have to compute it here
|
@@ -454,29 +452,6 @@ class FiberContext {
|
|
454
452
|
break;
|
455
453
|
}
|
456
454
|
|
457
|
-
case "SetInterrupt"
|
458
|
-
/* IOTag.SetInterrupt */
|
459
|
-
:
|
460
|
-
{
|
461
|
-
const boolFlag = current.flag.toBoolean;
|
462
|
-
|
463
|
-
if (this.unsafeIsInterruptible !== boolFlag) {
|
464
|
-
this.interruptStatus.push(current.flag.toBoolean);
|
465
|
-
this.unsafeRestoreInterruptStatus();
|
466
|
-
}
|
467
|
-
|
468
|
-
current = current.io;
|
469
|
-
break;
|
470
|
-
}
|
471
|
-
|
472
|
-
case "GetInterrupt"
|
473
|
-
/* IOTag.GetInterrupt */
|
474
|
-
:
|
475
|
-
{
|
476
|
-
current = current.f(tsplus_module_28.fromBoolean(this.unsafeIsInterruptible));
|
477
|
-
break;
|
478
|
-
}
|
479
|
-
|
480
455
|
case "Async"
|
481
456
|
/* IOTag.Async */
|
482
457
|
:
|
@@ -496,7 +471,7 @@ class FiberContext {
|
|
496
471
|
if (this.unsafeShouldInterrupt) {
|
497
472
|
if (this.unsafeExitAsync(epoch)) {
|
498
473
|
this.unsafeSetInterrupting(true);
|
499
|
-
current =
|
474
|
+
current = tsplus_module_11.flatMap_(r.left, () => tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), fileName_1 + ":336:67"), fileName_1 + ":336:45");
|
500
475
|
} else {
|
501
476
|
current = null;
|
502
477
|
}
|
@@ -528,20 +503,12 @@ class FiberContext {
|
|
528
503
|
break;
|
529
504
|
}
|
530
505
|
|
531
|
-
case "GetDescriptor"
|
532
|
-
/* IOTag.GetDescriptor */
|
533
|
-
:
|
534
|
-
{
|
535
|
-
current = current.f(this.unsafeGetDescriptor());
|
536
|
-
break;
|
537
|
-
}
|
538
|
-
|
539
506
|
case "Yield"
|
540
507
|
/* IOTag.Yield */
|
541
508
|
:
|
542
509
|
{
|
543
510
|
current = null;
|
544
|
-
this.unsafeRunLater(
|
511
|
+
this.unsafeRunLater(tsplus_module_11.unit);
|
545
512
|
break;
|
546
513
|
}
|
547
514
|
|
@@ -561,63 +528,11 @@ class FiberContext {
|
|
561
528
|
break;
|
562
529
|
}
|
563
530
|
|
564
|
-
case "
|
565
|
-
/* IOTag.
|
531
|
+
case "Stateful"
|
532
|
+
/* IOTag.Stateful */
|
566
533
|
:
|
567
534
|
{
|
568
|
-
|
569
|
-
this.fiberRefLocals.set(newValue.fiberRefLocals);
|
570
|
-
current = this.unsafeNextEffect(result);
|
571
|
-
break;
|
572
|
-
}
|
573
|
-
|
574
|
-
case "FiberRefModify"
|
575
|
-
/* IOTag.FiberRefModify */
|
576
|
-
:
|
577
|
-
{
|
578
|
-
const c = current;
|
579
|
-
const [result, newValue] = current.f(this.unsafeGetRef(current.fiberRef));
|
580
|
-
this.unsafeSetRef(c.fiberRef, newValue);
|
581
|
-
current = this.unsafeNextEffect(result);
|
582
|
-
break;
|
583
|
-
}
|
584
|
-
|
585
|
-
case "FiberRefLocally"
|
586
|
-
/* IOTag.FiberRefLocally */
|
587
|
-
:
|
588
|
-
{
|
589
|
-
const oldValue = this.unsafeGetRef(current.fiberRef);
|
590
|
-
const fiberRef = current.fiberRef;
|
591
|
-
this.unsafeSetRef(fiberRef, current.localValue);
|
592
|
-
this.unsafeAddFinalizer(tsplus_module_10.succeed(() => {
|
593
|
-
this.unsafeSetRef(fiberRef, oldValue);
|
594
|
-
}, fileName_1 + ":413:33"));
|
595
|
-
current = current.io;
|
596
|
-
break;
|
597
|
-
}
|
598
|
-
|
599
|
-
case "FiberRefDelete"
|
600
|
-
/* IOTag.FiberRefDelete */
|
601
|
-
:
|
602
|
-
{
|
603
|
-
this.unsafeDeleteRef(current.fiberRef);
|
604
|
-
current = this.unsafeNextEffect(undefined);
|
605
|
-
break;
|
606
|
-
}
|
607
|
-
|
608
|
-
case "FiberRefWith"
|
609
|
-
/* IOTag.FiberRefWith */
|
610
|
-
:
|
611
|
-
{
|
612
|
-
current = current.f(this.unsafeGetRef(current.fiberRef));
|
613
|
-
break;
|
614
|
-
}
|
615
|
-
|
616
|
-
case "GetRuntimeConfig"
|
617
|
-
/* IOTag.GetRuntimeConfig */
|
618
|
-
:
|
619
|
-
{
|
620
|
-
current = current.f(this.runtimeConfig);
|
535
|
+
current = current.onState(this, this.state.status);
|
621
536
|
break;
|
622
537
|
}
|
623
538
|
|
@@ -629,49 +544,6 @@ class FiberContext {
|
|
629
544
|
break;
|
630
545
|
}
|
631
546
|
|
632
|
-
case "Supervise"
|
633
|
-
/* IOTag.Supervise */
|
634
|
-
:
|
635
|
-
{
|
636
|
-
const oldSupervisor = this.currentSupervisor;
|
637
|
-
this.currentSupervisor = tsplus_module_29.zip_(current.supervisor, oldSupervisor);
|
638
|
-
this.unsafeAddFinalizer(tsplus_module_10.succeed(() => {
|
639
|
-
this.currentSupervisor = oldSupervisor;
|
640
|
-
}, fileName_1 + ":446:33"));
|
641
|
-
current = current.io;
|
642
|
-
break;
|
643
|
-
}
|
644
|
-
|
645
|
-
case "GetForkScope"
|
646
|
-
/* IOTag.GetForkScope */
|
647
|
-
:
|
648
|
-
{
|
649
|
-
current = current.f(tsplus_module_31.getOrElse_(this.unsafeGetRef(tsplus_module_30.forkScopeOverride), () => this.scope));
|
650
|
-
break;
|
651
|
-
}
|
652
|
-
|
653
|
-
case "OverrideForkScope"
|
654
|
-
/* IOTag.OverrideForkScope */
|
655
|
-
:
|
656
|
-
{
|
657
|
-
const oldForkScopeOverride = this.unsafeGetRef(tsplus_module_30.forkScopeOverride);
|
658
|
-
this.unsafeSetRef(tsplus_module_30.forkScopeOverride, current.forkScope);
|
659
|
-
this.unsafeAddFinalizer(tsplus_module_10.succeed(() => {
|
660
|
-
this.unsafeSetRef(tsplus_module_30.forkScopeOverride, oldForkScopeOverride);
|
661
|
-
}, fileName_1 + ":463:33"));
|
662
|
-
current = current.io;
|
663
|
-
break;
|
664
|
-
}
|
665
|
-
|
666
|
-
case "Ensuring"
|
667
|
-
/* IOTag.Ensuring */
|
668
|
-
:
|
669
|
-
{
|
670
|
-
this.unsafeAddFinalizer(current.finalizer);
|
671
|
-
current = current.io;
|
672
|
-
break;
|
673
|
-
}
|
674
|
-
|
675
547
|
case "Logged"
|
676
548
|
/* IOTag.Logged */
|
677
549
|
:
|
@@ -681,15 +553,6 @@ class FiberContext {
|
|
681
553
|
break;
|
682
554
|
}
|
683
555
|
|
684
|
-
case "SetRuntimeConfig"
|
685
|
-
/* IOTag.SetRuntimeConfig */
|
686
|
-
:
|
687
|
-
{
|
688
|
-
this.runtimeConfig = current.runtimeConfig;
|
689
|
-
current = tsplus_module_10.unit;
|
690
|
-
break;
|
691
|
-
}
|
692
|
-
|
693
556
|
default:
|
694
557
|
{
|
695
558
|
console.log("Unrecognized Instruction", current);
|
@@ -699,16 +562,16 @@ class FiberContext {
|
|
699
562
|
}
|
700
563
|
} else {
|
701
564
|
const trace = current.trace;
|
702
|
-
current =
|
565
|
+
current = tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), trace);
|
703
566
|
this.unsafeSetInterrupting(true);
|
704
567
|
}
|
705
568
|
|
706
569
|
opCount++;
|
707
570
|
}
|
708
571
|
} catch (e) {
|
709
|
-
if (
|
572
|
+
if (tsplus_module_29.isInterruptedException(e)) {
|
710
573
|
const trace = current ? current.trace : undefined;
|
711
|
-
current =
|
574
|
+
current = tsplus_module_31.interruptAs(tsplus_module_30.none, trace);
|
712
575
|
this.unsafeSetInterrupting(true);
|
713
576
|
} else if ((0, _definition7.isIOError)(e)) {
|
714
577
|
switch (e.exit._tag) {
|
@@ -721,55 +584,55 @@ class FiberContext {
|
|
721
584
|
case "Failure":
|
722
585
|
{
|
723
586
|
const trace = current ? current.trace : undefined;
|
724
|
-
current =
|
587
|
+
current = tsplus_module_11.failCauseNow(e.exit.cause, trace);
|
725
588
|
}
|
726
589
|
}
|
727
590
|
} else {
|
728
591
|
this.unsafeSetInterrupting(true);
|
729
|
-
current =
|
592
|
+
current = tsplus_module_11.haltNow(e, fileName_1 + ":431:42");
|
730
593
|
}
|
731
594
|
}
|
732
595
|
}
|
733
596
|
} finally {
|
734
597
|
currentFiber.set(null);
|
735
|
-
this.currentSupervisor
|
598
|
+
this.currentSupervisor.unsafeOnSuspend(this);
|
736
599
|
}
|
737
600
|
}
|
738
601
|
|
739
602
|
unsafeRunLater(i0) {
|
740
|
-
this.unsafeGetRef(
|
603
|
+
this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => {
|
741
604
|
this.nextIO = i0;
|
742
605
|
this.runUntil(this.runtimeConfig.yieldOpCount);
|
743
606
|
});
|
744
607
|
}
|
745
608
|
|
746
609
|
unsafeGetRef(ref) {
|
747
|
-
return
|
610
|
+
return tsplus_module_33.getOrElse_(tsplus_module_33.map_(tsplus_module_12.get_(this.fiberRefLocals.get, ref), _ => _.head[1]), () => tsplus_module_32.initial(ref));
|
748
611
|
}
|
749
612
|
|
750
613
|
unsafeGetRefs(fiberRefLocals) {
|
751
|
-
return
|
614
|
+
return tsplus_module_12.map_(fiberRefLocals.get, stack => stack.head[1]);
|
752
615
|
}
|
753
616
|
|
754
617
|
unsafeSetRef(ref, value) {
|
755
618
|
const oldState = this.fiberRefLocals.get;
|
756
|
-
const oldStack =
|
619
|
+
const oldStack = tsplus_module_33.getOrElse_(tsplus_module_12.get_(oldState, ref), () => tsplus_module_24.empty());
|
757
620
|
let newStack;
|
758
621
|
|
759
|
-
if (
|
760
|
-
newStack =
|
622
|
+
if (tsplus_module_34.isEmpty(oldStack)) {
|
623
|
+
newStack = tsplus_module_24.cons([this.fiberId, value]);
|
761
624
|
} else if (tsplus_module_7.strictEquals(oldStack.head[0], this.fiberId)) {
|
762
|
-
newStack =
|
625
|
+
newStack = tsplus_module_24.cons([this.fiberId, value], oldStack.tail);
|
763
626
|
} else {
|
764
|
-
newStack =
|
627
|
+
newStack = tsplus_module_24.cons([this.fiberId, value], oldStack);
|
765
628
|
}
|
766
629
|
|
767
|
-
const newState =
|
630
|
+
const newState = tsplus_module_12.set_(oldState, ref, newStack);
|
768
631
|
this.fiberRefLocals.set(newState);
|
769
632
|
}
|
770
633
|
|
771
634
|
unsafeDeleteRef(ref) {
|
772
|
-
this.fiberRefLocals.set(
|
635
|
+
this.fiberRefLocals.set(tsplus_module_12.remove_(this.fiberRefLocals.get, ref));
|
773
636
|
}
|
774
637
|
|
775
638
|
unsafePoll() {
|
@@ -790,7 +653,7 @@ class FiberContext {
|
|
790
653
|
this.stack.push(new Finalizer(finalizer, v => {
|
791
654
|
this.unsafeDisableInterruption();
|
792
655
|
this.unsafeRestoreInterruptStatus();
|
793
|
-
return
|
656
|
+
return tsplus_module_11.map_(finalizer, () => v, fileName_1 + ":506:29");
|
794
657
|
}));
|
795
658
|
}
|
796
659
|
|
@@ -819,9 +682,9 @@ class FiberContext {
|
|
819
682
|
}
|
820
683
|
|
821
684
|
unsafeAddSuppressedCause(cause) {
|
822
|
-
if (!
|
685
|
+
if (!tsplus_module_35.isEmpty(cause)) {
|
823
686
|
if (this.state._tag === "Executing") {
|
824
|
-
this.state.suppressed =
|
687
|
+
this.state.suppressed = tsplus_module_27.then(this.state.suppressed, cause);
|
825
688
|
}
|
826
689
|
}
|
827
690
|
}
|
@@ -849,14 +712,14 @@ class FiberContext {
|
|
849
712
|
case "Finalizer":
|
850
713
|
{
|
851
714
|
this.unsafeDisableInterruption();
|
852
|
-
this.stack.push(new TracedCont(cause =>
|
715
|
+
this.stack.push(new TracedCont(cause => tsplus_module_11.matchCauseIO_(frame.finalizer, finalizerCause => {
|
853
716
|
this.interruptStatus.pop();
|
854
717
|
this.unsafeAddSuppressedCause(finalizerCause);
|
855
|
-
return
|
718
|
+
return tsplus_module_11.failCauseNow(cause, fileName_1 + ":570:43");
|
856
719
|
}, () => {
|
857
720
|
this.interruptStatus.pop();
|
858
|
-
return
|
859
|
-
}, fileName_1 + ":
|
721
|
+
return tsplus_module_11.failCauseNow(cause, fileName_1 + ":574:43");
|
722
|
+
}, fileName_1 + ":566:45"), frame.trace));
|
860
723
|
unwinding = false;
|
861
724
|
break;
|
862
725
|
}
|
@@ -901,13 +764,13 @@ class FiberContext {
|
|
901
764
|
const k = this.stack.pop();
|
902
765
|
return k.apply(value);
|
903
766
|
} else {
|
904
|
-
return this.unsafeTryDone(
|
767
|
+
return this.unsafeTryDone(tsplus_module_28.succeed(value));
|
905
768
|
}
|
906
769
|
}
|
907
770
|
|
908
771
|
unsafeNotifyObservers(v, observers) {
|
909
772
|
if (observers.size > 0) {
|
910
|
-
const result =
|
773
|
+
const result = tsplus_module_28.succeed(v);
|
911
774
|
observers.forEach(k => k(result));
|
912
775
|
}
|
913
776
|
}
|
@@ -919,25 +782,25 @@ class FiberContext {
|
|
919
782
|
}
|
920
783
|
|
921
784
|
unsafeInterruptAs(fiberId) {
|
922
|
-
const interruptedCause =
|
923
|
-
return
|
785
|
+
const interruptedCause = tsplus_module_27.interrupt(fiberId);
|
786
|
+
return tsplus_module_11.defer(() => {
|
924
787
|
const oldState = this.state;
|
925
788
|
|
926
789
|
if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.interruptible && this.state.asyncCanceller._tag === "Registered") {
|
927
790
|
const asyncCanceller = this.state.asyncCanceller.asyncCanceller;
|
928
|
-
const interrupt =
|
929
|
-
this.state.status =
|
791
|
+
const interrupt = tsplus_module_11.failCauseNow(interruptedCause, fileName_1 + ":644:52");
|
792
|
+
this.state.status = tsplus_module_36.running(true);
|
930
793
|
this.state.interruptors = new Set(oldState.interruptors).add(fiberId);
|
931
|
-
this.state.asyncCanceller =
|
932
|
-
this.unsafeRunLater(
|
794
|
+
this.state.asyncCanceller = tsplus_module_37.empty;
|
795
|
+
this.unsafeRunLater(tsplus_module_11.flatMap_(asyncCanceller, () => interrupt, fileName_1 + ":648:60"));
|
933
796
|
} else if (this.state._tag === "Executing") {
|
934
|
-
const newCause =
|
797
|
+
const newCause = tsplus_module_27.then(this.state.suppressed, interruptedCause);
|
935
798
|
this.state.interruptors.add(fiberId);
|
936
799
|
this.state.suppressed = newCause;
|
937
800
|
}
|
938
801
|
|
939
802
|
return this.await;
|
940
|
-
}, fileName_1 + ":
|
803
|
+
}, fileName_1 + ":635:20");
|
941
804
|
}
|
942
805
|
|
943
806
|
unsafeTryDone(exit, trace) {
|
@@ -955,16 +818,16 @@ class FiberContext {
|
|
955
818
|
const mailbox = this.state.mailbox;
|
956
819
|
this.state.mailbox = null;
|
957
820
|
this.unsafeSetInterrupting(true);
|
958
|
-
return
|
821
|
+
return tsplus_module_11.flatMap_(mailbox, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":670:60"), fileName_1 + ":670:42");
|
959
822
|
} else if (this._children.size === 0) {
|
960
823
|
// We are truly "done" because all the children of this fiber have terminated,
|
961
824
|
// and there are no more pending effects that we have to execute on the fiber.
|
962
|
-
const interruptorsCause =
|
963
|
-
const newExit =
|
964
|
-
if (
|
825
|
+
const interruptorsCause = tsplus_module_38.interruptorsCause(this.state);
|
826
|
+
const newExit = tsplus_module_35.isEmpty(interruptorsCause) ? exit : tsplus_module_15.mapErrorCause_(exit, cause => {
|
827
|
+
if (tsplus_module_27.contains_(cause, interruptorsCause)) {
|
965
828
|
return cause;
|
966
829
|
} else {
|
967
|
-
return
|
830
|
+
return tsplus_module_27.then(cause, interruptorsCause);
|
968
831
|
}
|
969
832
|
});
|
970
833
|
const observers = this.state.observers;
|
@@ -975,26 +838,26 @@ class FiberContext {
|
|
975
838
|
} else {
|
976
839
|
// not done because there are children left to close
|
977
840
|
this.unsafeSetInterrupting(true);
|
978
|
-
let interruptChildren =
|
841
|
+
let interruptChildren = tsplus_module_11.unit;
|
979
842
|
|
980
843
|
this._children.forEach(child => {
|
981
|
-
interruptChildren =
|
844
|
+
interruptChildren = tsplus_module_11.flatMap_(interruptChildren, () => child.interruptAs(this.fiberId), fileName_1 + ":702:58");
|
982
845
|
});
|
983
846
|
|
984
847
|
this._children.clear();
|
985
848
|
|
986
|
-
return
|
849
|
+
return tsplus_module_11.flatMap_(interruptChildren, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":706:70"), fileName_1 + ":706:52");
|
987
850
|
}
|
988
851
|
}
|
989
852
|
}
|
990
853
|
}
|
991
854
|
|
992
855
|
unsafeSetAsyncCanceller(epoch, asyncCanceller0) {
|
993
|
-
const asyncCanceller = !asyncCanceller0 ?
|
856
|
+
const asyncCanceller = !asyncCanceller0 ? tsplus_module_11.unit : asyncCanceller0;
|
994
857
|
|
995
858
|
if (this.state._tag === "Executing") {
|
996
859
|
if (this.state.status._tag === "Suspended" && this.state.asyncCanceller._tag === "Pending" && this.state.status.epoch === epoch) {
|
997
|
-
this.state.asyncCanceller =
|
860
|
+
this.state.asyncCanceller = tsplus_module_37.registered(asyncCanceller);
|
998
861
|
} else if (this.state.status._tag === "Suspended" && this.state.asyncCanceller._tag === "Registered" && this.state.status.epoch === epoch) {
|
999
862
|
throw new Error("inconsistent state in setAsyncCanceller");
|
1000
863
|
}
|
@@ -1030,18 +893,18 @@ class FiberContext {
|
|
1030
893
|
if (this.state._tag === "Executing" && this.state.status._tag === "Running"
|
1031
894
|
/* FiberStatusTag.Running */
|
1032
895
|
&& this.state.asyncCanceller._tag === "Empty") {
|
1033
|
-
const newStatus =
|
896
|
+
const newStatus = tsplus_module_36.suspended(this.state.status.interrupting, this.unsafeIsInterruptible && !this.unsafeIsInterrupting, epoch, blockingOn, trace);
|
1034
897
|
this.state.status = newStatus;
|
1035
|
-
this.state.asyncCanceller =
|
898
|
+
this.state.asyncCanceller = tsplus_module_37.pending;
|
1036
899
|
} else {
|
1037
|
-
throw new
|
900
|
+
throw new tsplus_module_29.IllegalStateError(`Fiber ${tsplus_module_3.threadName(this.fiberId)} is not running`);
|
1038
901
|
}
|
1039
902
|
}
|
1040
903
|
|
1041
904
|
unsafeExitAsync(epoch) {
|
1042
905
|
if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.epoch === epoch) {
|
1043
|
-
this.state.status =
|
1044
|
-
this.state.asyncCanceller =
|
906
|
+
this.state.status = tsplus_module_36.running(this.state.status.interrupting);
|
907
|
+
this.state.asyncCanceller = tsplus_module_37.empty;
|
1045
908
|
return true;
|
1046
909
|
}
|
1047
910
|
|
@@ -1057,31 +920,31 @@ class FiberContext {
|
|
1057
920
|
}
|
1058
921
|
|
1059
922
|
unsafeFork(io, forkScope = tsplus_module_1.nothing(), trace) {
|
1060
|
-
const childId =
|
1061
|
-
const childFiberRefLocals =
|
923
|
+
const childId = tsplus_module_30.unsafeMake(tsplus_module_39.parse(trace));
|
924
|
+
const childFiberRefLocals = tsplus_module_12.mapWithIndex_(this.fiberRefLocals.get, (fiberRef, stack) => {
|
1062
925
|
const oldValue = stack.head[1];
|
1063
|
-
const newValue =
|
926
|
+
const newValue = tsplus_module_32.patch(fiberRef)(tsplus_module_32.fork(fiberRef))(oldValue);
|
1064
927
|
|
1065
928
|
if (oldValue === newValue) {
|
1066
929
|
return stack;
|
1067
930
|
} else {
|
1068
|
-
return
|
931
|
+
return tsplus_module_24.cons([childId, newValue], stack);
|
1069
932
|
}
|
1070
933
|
});
|
1071
|
-
const parentScope =
|
934
|
+
const parentScope = tsplus_module_33.getOrElse_(tsplus_module_33.orElse_(forkScope, () => this.unsafeGetRef(tsplus_module_10.forkScopeOverride)), () => this.scope);
|
1072
935
|
const grandChildren = new Set();
|
1073
936
|
const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible), new _AtomicReference.AtomicReference(childFiberRefLocals), grandChildren);
|
1074
937
|
|
1075
|
-
if (this.currentSupervisor !==
|
1076
|
-
this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(
|
938
|
+
if (this.currentSupervisor !== tsplus_module_26.none) {
|
939
|
+
this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(tsplus_module_10.currentEnvironment), io, tsplus_module_1.just(this), childContext);
|
1077
940
|
childContext.unsafeOnDone(exit => {
|
1078
|
-
this.currentSupervisor.unsafeOnEnd(
|
941
|
+
this.currentSupervisor.unsafeOnEnd(tsplus_module_15.flatten(exit), childContext);
|
1079
942
|
});
|
1080
943
|
}
|
1081
944
|
|
1082
|
-
const childIO = !parentScope.unsafeAdd(childContext) ?
|
945
|
+
const childIO = !parentScope.unsafeAdd(childContext) ? tsplus_module_31.interruptAs(parentScope.fiberId, fileName_1 + ":835:74") : io;
|
1083
946
|
childContext.nextIO = childIO;
|
1084
|
-
this.unsafeGetRef(
|
947
|
+
this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => childContext.runUntil(this.runtimeConfig.yieldOpCount));
|
1085
948
|
return childContext;
|
1086
949
|
}
|
1087
950
|
|
@@ -1091,7 +954,7 @@ class FiberContext {
|
|
1091
954
|
if (exit == null) {
|
1092
955
|
return;
|
1093
956
|
} else {
|
1094
|
-
k(
|
957
|
+
k(tsplus_module_28.succeed(exit));
|
1095
958
|
}
|
1096
959
|
}
|
1097
960
|
|
@@ -1100,26 +963,26 @@ class FiberContext {
|
|
1100
963
|
case "Executing":
|
1101
964
|
{
|
1102
965
|
const suppressed = this.state.suppressed;
|
1103
|
-
this.state.suppressed =
|
966
|
+
this.state.suppressed = tsplus_module_27.empty();
|
1104
967
|
return suppressed;
|
1105
968
|
}
|
1106
969
|
|
1107
970
|
case "Done":
|
1108
971
|
{
|
1109
|
-
return
|
972
|
+
return tsplus_module_27.empty();
|
1110
973
|
}
|
1111
974
|
}
|
1112
975
|
}
|
1113
976
|
|
1114
977
|
unsafeGetDescriptor() {
|
1115
|
-
return new
|
978
|
+
return new tsplus_module_40.FiberDescriptor(this.fiberId, this.state.status, this.state.interruptors, tsplus_module_41.fromBoolean(this.unsafeIsInterruptible), this.scope);
|
1116
979
|
}
|
1117
980
|
|
1118
981
|
unsafeRace(race) {
|
1119
982
|
const raceIndicator = new _AtomicReference.AtomicReference(true);
|
1120
983
|
const left = this.unsafeFork(race.left, tsplus_module_1.nothing(), race.trace);
|
1121
984
|
const right = this.unsafeFork(race.right, tsplus_module_1.nothing(), race.trace);
|
1122
|
-
return
|
985
|
+
return tsplus_module_11.async(cb => {
|
1123
986
|
const leftRegister = left.unsafeAddObserver(() => {
|
1124
987
|
this.unsafeCompleteRace(left, right, race.leftWins, raceIndicator, cb);
|
1125
988
|
});
|
@@ -1135,7 +998,7 @@ class FiberContext {
|
|
1135
998
|
this.unsafeCompleteRace(right, left, race.rightWins, raceIndicator, cb);
|
1136
999
|
}
|
1137
1000
|
}
|
1138
|
-
}, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":
|
1001
|
+
}, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":884:20");
|
1139
1002
|
}
|
1140
1003
|
|
1141
1004
|
unsafeCompleteRace(winner, loser, cont, ab, cb) {
|
@@ -1146,23 +1009,23 @@ class FiberContext {
|
|
1146
1009
|
|
1147
1010
|
unsafeCaptureTrace(prefix) {
|
1148
1011
|
const builder = new _StackTraceBuilder.StackTraceBuilder();
|
1149
|
-
|
1012
|
+
tsplus_module_42.forEach_(prefix, element => builder.append(tsplus_module_39.parse(element)));
|
1150
1013
|
const stack = this.stack.clone();
|
1151
1014
|
|
1152
1015
|
while (stack.hasNext) {
|
1153
|
-
builder.append(
|
1016
|
+
builder.append(tsplus_module_39.parse(stack.pop().trace));
|
1154
1017
|
}
|
1155
1018
|
|
1156
|
-
return new
|
1019
|
+
return new tsplus_module_43.Trace(this.fiberId, builder.result());
|
1157
1020
|
}
|
1158
1021
|
|
1159
1022
|
unsafeEvalOn(effect, orElse) {
|
1160
1023
|
if (this.state._tag === "Executing") {
|
1161
|
-
const newMailbox = this.state.mailbox == null ? effect :
|
1024
|
+
const newMailbox = this.state.mailbox == null ? effect : tsplus_module_11.flatMap_(this.state.mailbox, () => effect, fileName_1 + ":928:92");
|
1162
1025
|
this.state.mailbox = newMailbox;
|
1163
|
-
return
|
1026
|
+
return tsplus_module_11.unit;
|
1164
1027
|
} else {
|
1165
|
-
return
|
1028
|
+
return tsplus_module_11.asUnit(orElse, fileName_1 + ":932:20");
|
1166
1029
|
}
|
1167
1030
|
}
|
1168
1031
|
|
@@ -1177,31 +1040,31 @@ class FiberContext {
|
|
1177
1040
|
}
|
1178
1041
|
|
1179
1042
|
unsafeAddChild(child) {
|
1180
|
-
this.unsafeEvalOn(
|
1043
|
+
this.unsafeEvalOn(tsplus_module_11.succeed(() => {
|
1181
1044
|
this._children.add(child);
|
1182
|
-
}, fileName_1 + ":
|
1045
|
+
}, fileName_1 + ":948:17"), tsplus_module_11.unit);
|
1183
1046
|
}
|
1184
1047
|
|
1185
1048
|
unsafeLog(message, trace) {
|
1186
|
-
const logLevel = this.unsafeGetRef(
|
1187
|
-
const spans = this.unsafeGetRef(
|
1188
|
-
const annotations = this.unsafeGetRef(
|
1189
|
-
this.runtimeConfig.logger.log(
|
1049
|
+
const logLevel = this.unsafeGetRef(tsplus_module_10.currentLogLevel);
|
1050
|
+
const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
|
1051
|
+
const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
|
1052
|
+
this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, tsplus_module_27.empty(), this.fiberRefLocals.get, spans, annotations);
|
1190
1053
|
}
|
1191
1054
|
|
1192
1055
|
unsafeLogWith(message, cause, overrideLogLevel, overrideRef1 = null, overrideValue1 = null, trace) {
|
1193
|
-
const logLevel =
|
1194
|
-
const spans = this.unsafeGetRef(
|
1195
|
-
const annotations = this.unsafeGetRef(
|
1056
|
+
const logLevel = tsplus_module_33.getOrElse_(overrideLogLevel, () => this.unsafeGetRef(tsplus_module_10.currentLogLevel));
|
1057
|
+
const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
|
1058
|
+
const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
|
1196
1059
|
let contextMap;
|
1197
1060
|
|
1198
1061
|
if (overrideRef1 !== null) {
|
1199
1062
|
const map = this.unsafeGetRefs(this.fiberRefLocals);
|
1200
1063
|
|
1201
1064
|
if (overrideValue1 === null) {
|
1202
|
-
|
1065
|
+
tsplus_module_12.remove_(map, overrideRef1);
|
1203
1066
|
} else {
|
1204
|
-
|
1067
|
+
tsplus_module_12.set_(map, overrideRef1, overrideValue1);
|
1205
1068
|
}
|
1206
1069
|
|
1207
1070
|
contextMap = map;
|
@@ -1209,7 +1072,11 @@ class FiberContext {
|
|
1209
1072
|
contextMap = this.fiberRefLocals.get;
|
1210
1073
|
}
|
1211
1074
|
|
1212
|
-
this.runtimeConfig.logger.log(
|
1075
|
+
this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
get currentSupervisor() {
|
1079
|
+
return this.unsafeGetRef(tsplus_module_10.currentSupervisor);
|
1213
1080
|
}
|
1214
1081
|
|
1215
1082
|
}
|