@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
@@ -8,41 +8,40 @@ import * as tsplus_module_6 from "@fncts/io/Fiber/api/id";
|
|
8
8
|
import * as tsplus_module_7 from "@fncts/base/typeclass/Equatable/api";
|
9
9
|
import * as tsplus_module_8 from "@fncts/io/FiberState/constructors";
|
10
10
|
import * as tsplus_module_9 from "@fncts/base/internal/Stack";
|
11
|
-
import * as tsplus_module_10 from "@fncts/io/
|
12
|
-
import * as tsplus_module_11 from "@fncts/
|
13
|
-
import * as tsplus_module_12 from "@fncts/
|
14
|
-
import * as tsplus_module_13 from "@fncts/io/FiberRefs/
|
15
|
-
import * as tsplus_module_14 from "@fncts/
|
16
|
-
import * as tsplus_module_15 from "@fncts/base/
|
17
|
-
import * as tsplus_module_16 from "@fncts/base/collection/immutable/Conc
|
18
|
-
import * as tsplus_module_17 from "@fncts/
|
19
|
-
import * as tsplus_module_18 from "@fncts/io/
|
20
|
-
import * as tsplus_module_19 from "@fncts/io/IO/api/
|
21
|
-
import * as tsplus_module_20 from "@fncts/io/
|
22
|
-
import * as tsplus_module_21 from "@fncts/
|
23
|
-
import * as tsplus_module_22 from "@fncts/
|
24
|
-
import * as tsplus_module_23 from "@fncts/
|
25
|
-
import * as tsplus_module_24 from "@fncts/
|
26
|
-
import * as tsplus_module_25 from "@fncts/io/
|
27
|
-
import * as tsplus_module_26 from "@fncts/
|
28
|
-
import * as tsplus_module_27 from "@fncts/base/data/
|
29
|
-
import * as tsplus_module_28 from "@fncts/
|
30
|
-
import * as tsplus_module_29 from "@fncts/
|
31
|
-
import * as tsplus_module_30 from "@fncts/
|
32
|
-
import * as tsplus_module_31 from "@fncts/
|
33
|
-
import * as tsplus_module_32 from "@fncts/
|
34
|
-
import * as tsplus_module_33 from "@fncts/base/data/
|
35
|
-
import * as tsplus_module_34 from "@fncts/
|
36
|
-
import * as tsplus_module_35 from "@fncts/
|
37
|
-
import * as tsplus_module_36 from "@fncts/
|
38
|
-
import * as tsplus_module_37 from "@fncts/
|
39
|
-
import * as tsplus_module_38 from "@fncts/io/
|
40
|
-
import * as tsplus_module_39 from "@fncts/
|
41
|
-
import * as tsplus_module_40 from "@fncts/io/
|
42
|
-
import * as tsplus_module_41 from "@fncts/
|
43
|
-
import * as tsplus_module_42 from "@fncts/
|
44
|
-
import * as tsplus_module_43 from "@fncts/base/
|
45
|
-
import * as tsplus_module_44 from "@fncts/base/data/Trace/definition";
|
11
|
+
import * as tsplus_module_10 from "@fncts/io/FiberRef/unsafe";
|
12
|
+
import * as tsplus_module_11 from "@fncts/io/IO/api";
|
13
|
+
import * as tsplus_module_12 from "@fncts/base/collection/immutable/HashMap/api";
|
14
|
+
import * as tsplus_module_13 from "@fncts/io/FiberRefs/api";
|
15
|
+
import * as tsplus_module_14 from "@fncts/io/FiberRefs/join";
|
16
|
+
import * as tsplus_module_15 from "@fncts/base/data/Exit/api";
|
17
|
+
import * as tsplus_module_16 from "@fncts/base/collection/immutable/Conc";
|
18
|
+
import * as tsplus_module_17 from "@fncts/base/collection/immutable/Conc/api/empty";
|
19
|
+
import * as tsplus_module_18 from "@fncts/io/Future/api";
|
20
|
+
import * as tsplus_module_19 from "@fncts/io/IO/api/environment";
|
21
|
+
import * as tsplus_module_20 from "@fncts/io/IO/api/fulfill";
|
22
|
+
import * as tsplus_module_21 from "@fncts/io/Future/constructors";
|
23
|
+
import * as tsplus_module_22 from "@fncts/base/data/Either/constructors";
|
24
|
+
import * as tsplus_module_23 from "@fncts/io/FiberScope/constructors";
|
25
|
+
import * as tsplus_module_24 from "@fncts/base/collection/immutable/List/constructors";
|
26
|
+
import * as tsplus_module_25 from "@fncts/io/RuntimeConfig";
|
27
|
+
import * as tsplus_module_26 from "@fncts/io/Supervisor/constructors";
|
28
|
+
import * as tsplus_module_27 from "@fncts/base/data/Cause/api";
|
29
|
+
import * as tsplus_module_28 from "@fncts/base/data/Exit/constructors";
|
30
|
+
import * as tsplus_module_29 from "@fncts/base/data/exceptions";
|
31
|
+
import * as tsplus_module_30 from "@fncts/base/data/FiberId/constructors";
|
32
|
+
import * as tsplus_module_31 from "@fncts/io/IO/api/interrupt";
|
33
|
+
import * as tsplus_module_32 from "@fncts/io/FiberRef/api";
|
34
|
+
import * as tsplus_module_33 from "@fncts/base/data/Maybe/api";
|
35
|
+
import * as tsplus_module_34 from "@fncts/base/collection/immutable/List/definition";
|
36
|
+
import * as tsplus_module_35 from "@fncts/base/data/Cause/api/isEmpty";
|
37
|
+
import * as tsplus_module_36 from "@fncts/io/FiberStatus/constructors";
|
38
|
+
import * as tsplus_module_37 from "@fncts/io/CancellerState";
|
39
|
+
import * as tsplus_module_38 from "@fncts/io/FiberState/api";
|
40
|
+
import * as tsplus_module_39 from "@fncts/base/data/TraceElement/definition";
|
41
|
+
import * as tsplus_module_40 from "@fncts/io/FiberDescriptor";
|
42
|
+
import * as tsplus_module_41 from "@fncts/io/InterruptStatus/constructors";
|
43
|
+
import * as tsplus_module_42 from "@fncts/base/collection/immutable/List/api";
|
44
|
+
import * as tsplus_module_43 from "@fncts/base/data/Trace/definition";
|
46
45
|
import { AtomicReference } from "@fncts/base/internal/AtomicReference";
|
47
46
|
import { Stack } from "@fncts/base/internal/Stack";
|
48
47
|
import { FiberTypeId, isFiber } from "@fncts/io/Fiber/definition";
|
@@ -107,15 +106,15 @@ export class FiberContext {
|
|
107
106
|
this.interruptExit = new InterruptExit(v => {
|
108
107
|
if (this.unsafeIsInterruptible) {
|
109
108
|
this.interruptStatus.pop();
|
110
|
-
return
|
109
|
+
return tsplus_module_11.succeedNow(v, fileName_1 + ":492:27");
|
111
110
|
} else {
|
112
|
-
return
|
111
|
+
return tsplus_module_11.succeed(() => {
|
113
112
|
this.interruptStatus.pop();
|
114
113
|
return v;
|
115
|
-
}, fileName_1 + ":
|
114
|
+
}, fileName_1 + ":494:24");
|
116
115
|
}
|
117
116
|
});
|
118
|
-
this.currentSupervisor
|
117
|
+
this.unsafeSetRef(tsplus_module_10.currentSupervisor, this.runtimeConfig.supervisor);
|
119
118
|
}
|
120
119
|
|
121
120
|
get [tsplus_module_2.hashSymbol]() {
|
@@ -123,23 +122,23 @@ export class FiberContext {
|
|
123
122
|
}
|
124
123
|
|
125
124
|
[tsplus_module_5.equalsSymbol](that) {
|
126
|
-
return isFiber(that) && tsplus_module_7.strictEquals(this.id, tsplus_module_6.id(that, fileName_1 + ":
|
125
|
+
return isFiber(that) && tsplus_module_7.strictEquals(this.id, tsplus_module_6.id(that, fileName_1 + ":68:44"));
|
127
126
|
}
|
128
127
|
|
129
128
|
get poll() {
|
130
|
-
return
|
129
|
+
return tsplus_module_11.succeed(() => this.unsafePoll(), fileName_1 + ":87:22");
|
131
130
|
}
|
132
131
|
|
133
132
|
get inheritRefs() {
|
134
|
-
return
|
133
|
+
return tsplus_module_11.defer(() => {
|
135
134
|
const childFiberRefLocals = this.fiberRefLocals.get;
|
136
135
|
|
137
|
-
if (
|
138
|
-
return
|
136
|
+
if (tsplus_module_12.isEmpty(childFiberRefLocals)) {
|
137
|
+
return tsplus_module_11.unit;
|
139
138
|
} else {
|
140
|
-
return
|
139
|
+
return tsplus_module_11.updateFiberRefs((parentFiberId, parentFiberRefs) => tsplus_module_14.join(parentFiberRefs, parentFiberId, tsplus_module_13.make(childFiberRefLocals)), fileName_1 + ":96:34");
|
141
140
|
}
|
142
|
-
}, fileName_1 + ":
|
141
|
+
}, fileName_1 + ":91:20");
|
143
142
|
}
|
144
143
|
|
145
144
|
get id() {
|
@@ -147,7 +146,7 @@ export class FiberContext {
|
|
147
146
|
}
|
148
147
|
|
149
148
|
awaitAsync(k) {
|
150
|
-
const exit = this.unsafeAddObserver(exit => k(
|
149
|
+
const exit = this.unsafeAddObserver(exit => k(tsplus_module_15.flatten(exit)));
|
151
150
|
|
152
151
|
if (exit != null) {
|
153
152
|
k(exit);
|
@@ -155,33 +154,33 @@ export class FiberContext {
|
|
155
154
|
}
|
156
155
|
|
157
156
|
get children() {
|
158
|
-
return this.evalOnIO(
|
159
|
-
const concBuilder = new
|
157
|
+
return this.evalOnIO(tsplus_module_11.succeed(() => {
|
158
|
+
const concBuilder = new tsplus_module_16.ConcBuilder(tsplus_module_17.empty());
|
160
159
|
|
161
160
|
for (const child of this._children) {
|
162
161
|
concBuilder.append(child);
|
163
162
|
}
|
164
163
|
|
165
164
|
return concBuilder.result();
|
166
|
-
}, fileName_1 + ":
|
165
|
+
}, fileName_1 + ":117:17"), tsplus_module_11.succeed(() => tsplus_module_17.empty(), fileName_1 + ":126:17"), fileName_1 + ":116:25");
|
167
166
|
}
|
168
167
|
|
169
168
|
evalOnIO(effect, orElse, __tsplusTrace) {
|
170
|
-
return
|
169
|
+
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");
|
171
170
|
}
|
172
171
|
|
173
172
|
get await() {
|
174
|
-
return
|
175
|
-
const cb = x => k(
|
173
|
+
return tsplus_module_11.asyncInterrupt(k => {
|
174
|
+
const cb = x => k(tsplus_module_11.fromExit(() => x, fileName_1 + ":145:78"));
|
176
175
|
|
177
176
|
const result = this.unsafeAddObserver(cb);
|
178
177
|
|
179
178
|
if (result == null) {
|
180
|
-
return
|
179
|
+
return tsplus_module_22.left(tsplus_module_11.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":148:38"));
|
181
180
|
} else {
|
182
|
-
return
|
181
|
+
return tsplus_module_22.right(tsplus_module_11.succeedNow(result, fileName_1 + ":150:42"));
|
183
182
|
}
|
184
|
-
}, this.fiberId, fileName_1 + ":
|
183
|
+
}, this.fiberId, fileName_1 + ":144:29");
|
185
184
|
}
|
186
185
|
|
187
186
|
run() {
|
@@ -189,15 +188,15 @@ export class FiberContext {
|
|
189
188
|
}
|
190
189
|
|
191
190
|
get scope() {
|
192
|
-
return
|
191
|
+
return tsplus_module_23.unsafeMake(this);
|
193
192
|
}
|
194
193
|
|
195
194
|
get status() {
|
196
|
-
return
|
195
|
+
return tsplus_module_11.succeedNow(this.state.status, fileName_1 + ":164:25");
|
197
196
|
}
|
198
197
|
|
199
198
|
get trace() {
|
200
|
-
return
|
199
|
+
return tsplus_module_11.succeed(() => this.unsafeCaptureTrace(tsplus_module_24.empty()), fileName_1 + ":168:22");
|
201
200
|
}
|
202
201
|
|
203
202
|
interruptAs(fiberId) {
|
@@ -205,7 +204,7 @@ export class FiberContext {
|
|
205
204
|
}
|
206
205
|
|
207
206
|
evalOn(effect, orElse) {
|
208
|
-
return
|
207
|
+
return tsplus_module_11.defer(() => this.unsafeEvalOn(effect, orElse), fileName_1 + ":176:20");
|
209
208
|
}
|
210
209
|
|
211
210
|
get location() {
|
@@ -224,9 +223,9 @@ export class FiberContext {
|
|
224
223
|
this.nextIO = null;
|
225
224
|
let extraTrace = undefined;
|
226
225
|
const flags = this.runtimeConfig.flags;
|
227
|
-
const superviseOps = flags.isEnabled(
|
228
|
-
this.runtimeConfig.flags.isEnabled(
|
229
|
-
this.currentSupervisor !==
|
226
|
+
const superviseOps = flags.isEnabled(tsplus_module_25.RuntimeConfigFlag.SuperviseOperations) && this.currentSupervisor !== tsplus_module_26.none;
|
227
|
+
this.runtimeConfig.flags.isEnabled(tsplus_module_25.RuntimeConfigFlag.EnableCurrentFiber) && currentFiber.set(this);
|
228
|
+
this.currentSupervisor !== tsplus_module_26.none && this.currentSupervisor.unsafeOnResume(this);
|
230
229
|
|
231
230
|
while (current !== null) {
|
232
231
|
try {
|
@@ -238,7 +237,7 @@ export class FiberContext {
|
|
238
237
|
|
239
238
|
if (message !== null) {
|
240
239
|
const oldIO = current;
|
241
|
-
current =
|
240
|
+
current = tsplus_module_11.flatMap_(message, () => oldIO, fileName_1 + ":213:55");
|
242
241
|
} else if (opCount === maxOpCount) {
|
243
242
|
this.unsafeRunLater(current);
|
244
243
|
current = null;
|
@@ -289,7 +288,7 @@ export class FiberContext {
|
|
289
288
|
:
|
290
289
|
{
|
291
290
|
extraTrace = current.trace;
|
292
|
-
this.unsafeRunLater(
|
291
|
+
this.unsafeRunLater(tsplus_module_11.unit);
|
293
292
|
extraTrace = undefined;
|
294
293
|
current = null;
|
295
294
|
break;
|
@@ -310,7 +309,7 @@ export class FiberContext {
|
|
310
309
|
/* IOTag.Trace */
|
311
310
|
:
|
312
311
|
{
|
313
|
-
current = this.unsafeNextEffect(this.unsafeCaptureTrace(
|
312
|
+
current = this.unsafeNextEffect(this.unsafeCaptureTrace(tsplus_module_24.cons(current.trace, tsplus_module_24.nil())));
|
314
313
|
break;
|
315
314
|
}
|
316
315
|
|
@@ -342,25 +341,25 @@ export class FiberContext {
|
|
342
341
|
/* IOTag.Fail */
|
343
342
|
:
|
344
343
|
{
|
345
|
-
const fastPathTrace = extraTrace === undefined ?
|
344
|
+
const fastPathTrace = extraTrace === undefined ? tsplus_module_24.nil() : tsplus_module_24.cons(extraTrace, tsplus_module_24.nil());
|
346
345
|
extraTrace = undefined;
|
347
346
|
const cause = current.cause();
|
348
|
-
const tracedCause =
|
347
|
+
const tracedCause = tsplus_module_27.isTraced(cause) ? cause : tsplus_module_27.traced(cause, this.unsafeCaptureTrace(tsplus_module_24.cons(current.trace, fastPathTrace)));
|
349
348
|
const discardedFolds = this.unsafeUnwindStack();
|
350
349
|
const strippedCause = discardedFolds ? // We threw away some error handlers while unwinding the stack because
|
351
|
-
|
350
|
+
tsplus_module_27.stripFailures( // We threw away some error handlers while unwinding the stack because
|
352
351
|
// we got interrupted during this instruction. So it's not safe to return
|
353
352
|
// typed failures from cause0, because they might not be typed correctly.
|
354
353
|
// Instead, we strip the typed failures, and return the remainders and
|
355
354
|
// the interruption
|
356
355
|
tracedCause) : tracedCause;
|
357
356
|
const suppressed = this.unsafeClearSuppressedCause();
|
358
|
-
const fullCause =
|
357
|
+
const fullCause = tsplus_module_27.contains_(strippedCause, suppressed) ? strippedCause : tsplus_module_27.then(strippedCause, suppressed);
|
359
358
|
|
360
359
|
if (!this.stack.hasNext) {
|
361
360
|
// Error not caught, stack is empty:
|
362
361
|
this.unsafeSetInterrupting(true);
|
363
|
-
current = this.unsafeTryDone(
|
362
|
+
current = this.unsafeTryDone(tsplus_module_28.failCause(fullCause), current.trace);
|
364
363
|
} else {
|
365
364
|
this.unsafeSetInterrupting(false); // Error caught, next continuation on the stack will deal
|
366
365
|
// with it, so we just have to compute it here
|
@@ -380,29 +379,6 @@ export class FiberContext {
|
|
380
379
|
break;
|
381
380
|
}
|
382
381
|
|
383
|
-
case "SetInterrupt"
|
384
|
-
/* IOTag.SetInterrupt */
|
385
|
-
:
|
386
|
-
{
|
387
|
-
const boolFlag = current.flag.toBoolean;
|
388
|
-
|
389
|
-
if (this.unsafeIsInterruptible !== boolFlag) {
|
390
|
-
this.interruptStatus.push(current.flag.toBoolean);
|
391
|
-
this.unsafeRestoreInterruptStatus();
|
392
|
-
}
|
393
|
-
|
394
|
-
current = current.io;
|
395
|
-
break;
|
396
|
-
}
|
397
|
-
|
398
|
-
case "GetInterrupt"
|
399
|
-
/* IOTag.GetInterrupt */
|
400
|
-
:
|
401
|
-
{
|
402
|
-
current = current.f(tsplus_module_28.fromBoolean(this.unsafeIsInterruptible));
|
403
|
-
break;
|
404
|
-
}
|
405
|
-
|
406
382
|
case "Async"
|
407
383
|
/* IOTag.Async */
|
408
384
|
:
|
@@ -422,7 +398,7 @@ export class FiberContext {
|
|
422
398
|
if (this.unsafeShouldInterrupt) {
|
423
399
|
if (this.unsafeExitAsync(epoch)) {
|
424
400
|
this.unsafeSetInterrupting(true);
|
425
|
-
current =
|
401
|
+
current = tsplus_module_11.flatMap_(r.left, () => tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), fileName_1 + ":336:67"), fileName_1 + ":336:45");
|
426
402
|
} else {
|
427
403
|
current = null;
|
428
404
|
}
|
@@ -454,20 +430,12 @@ export class FiberContext {
|
|
454
430
|
break;
|
455
431
|
}
|
456
432
|
|
457
|
-
case "GetDescriptor"
|
458
|
-
/* IOTag.GetDescriptor */
|
459
|
-
:
|
460
|
-
{
|
461
|
-
current = current.f(this.unsafeGetDescriptor());
|
462
|
-
break;
|
463
|
-
}
|
464
|
-
|
465
433
|
case "Yield"
|
466
434
|
/* IOTag.Yield */
|
467
435
|
:
|
468
436
|
{
|
469
437
|
current = null;
|
470
|
-
this.unsafeRunLater(
|
438
|
+
this.unsafeRunLater(tsplus_module_11.unit);
|
471
439
|
break;
|
472
440
|
}
|
473
441
|
|
@@ -487,63 +455,11 @@ export class FiberContext {
|
|
487
455
|
break;
|
488
456
|
}
|
489
457
|
|
490
|
-
case "
|
491
|
-
/* IOTag.
|
492
|
-
:
|
493
|
-
{
|
494
|
-
const [result, newValue] = current.f(this.fiberId, tsplus_module_12.make(this.fiberRefLocals.get));
|
495
|
-
this.fiberRefLocals.set(newValue.fiberRefLocals);
|
496
|
-
current = this.unsafeNextEffect(result);
|
497
|
-
break;
|
498
|
-
}
|
499
|
-
|
500
|
-
case "FiberRefModify"
|
501
|
-
/* IOTag.FiberRefModify */
|
502
|
-
:
|
503
|
-
{
|
504
|
-
const c = current;
|
505
|
-
const [result, newValue] = current.f(this.unsafeGetRef(current.fiberRef));
|
506
|
-
this.unsafeSetRef(c.fiberRef, newValue);
|
507
|
-
current = this.unsafeNextEffect(result);
|
508
|
-
break;
|
509
|
-
}
|
510
|
-
|
511
|
-
case "FiberRefLocally"
|
512
|
-
/* IOTag.FiberRefLocally */
|
513
|
-
:
|
514
|
-
{
|
515
|
-
const oldValue = this.unsafeGetRef(current.fiberRef);
|
516
|
-
const fiberRef = current.fiberRef;
|
517
|
-
this.unsafeSetRef(fiberRef, current.localValue);
|
518
|
-
this.unsafeAddFinalizer(tsplus_module_10.succeed(() => {
|
519
|
-
this.unsafeSetRef(fiberRef, oldValue);
|
520
|
-
}, fileName_1 + ":413:33"));
|
521
|
-
current = current.io;
|
522
|
-
break;
|
523
|
-
}
|
524
|
-
|
525
|
-
case "FiberRefDelete"
|
526
|
-
/* IOTag.FiberRefDelete */
|
527
|
-
:
|
528
|
-
{
|
529
|
-
this.unsafeDeleteRef(current.fiberRef);
|
530
|
-
current = this.unsafeNextEffect(undefined);
|
531
|
-
break;
|
532
|
-
}
|
533
|
-
|
534
|
-
case "FiberRefWith"
|
535
|
-
/* IOTag.FiberRefWith */
|
536
|
-
:
|
537
|
-
{
|
538
|
-
current = current.f(this.unsafeGetRef(current.fiberRef));
|
539
|
-
break;
|
540
|
-
}
|
541
|
-
|
542
|
-
case "GetRuntimeConfig"
|
543
|
-
/* IOTag.GetRuntimeConfig */
|
458
|
+
case "Stateful"
|
459
|
+
/* IOTag.Stateful */
|
544
460
|
:
|
545
461
|
{
|
546
|
-
current = current.
|
462
|
+
current = current.onState(this, this.state.status);
|
547
463
|
break;
|
548
464
|
}
|
549
465
|
|
@@ -555,49 +471,6 @@ export class FiberContext {
|
|
555
471
|
break;
|
556
472
|
}
|
557
473
|
|
558
|
-
case "Supervise"
|
559
|
-
/* IOTag.Supervise */
|
560
|
-
:
|
561
|
-
{
|
562
|
-
const oldSupervisor = this.currentSupervisor;
|
563
|
-
this.currentSupervisor = tsplus_module_29.zip_(current.supervisor, oldSupervisor);
|
564
|
-
this.unsafeAddFinalizer(tsplus_module_10.succeed(() => {
|
565
|
-
this.currentSupervisor = oldSupervisor;
|
566
|
-
}, fileName_1 + ":446:33"));
|
567
|
-
current = current.io;
|
568
|
-
break;
|
569
|
-
}
|
570
|
-
|
571
|
-
case "GetForkScope"
|
572
|
-
/* IOTag.GetForkScope */
|
573
|
-
:
|
574
|
-
{
|
575
|
-
current = current.f(tsplus_module_31.getOrElse_(this.unsafeGetRef(tsplus_module_30.forkScopeOverride), () => this.scope));
|
576
|
-
break;
|
577
|
-
}
|
578
|
-
|
579
|
-
case "OverrideForkScope"
|
580
|
-
/* IOTag.OverrideForkScope */
|
581
|
-
:
|
582
|
-
{
|
583
|
-
const oldForkScopeOverride = this.unsafeGetRef(tsplus_module_30.forkScopeOverride);
|
584
|
-
this.unsafeSetRef(tsplus_module_30.forkScopeOverride, current.forkScope);
|
585
|
-
this.unsafeAddFinalizer(tsplus_module_10.succeed(() => {
|
586
|
-
this.unsafeSetRef(tsplus_module_30.forkScopeOverride, oldForkScopeOverride);
|
587
|
-
}, fileName_1 + ":463:33"));
|
588
|
-
current = current.io;
|
589
|
-
break;
|
590
|
-
}
|
591
|
-
|
592
|
-
case "Ensuring"
|
593
|
-
/* IOTag.Ensuring */
|
594
|
-
:
|
595
|
-
{
|
596
|
-
this.unsafeAddFinalizer(current.finalizer);
|
597
|
-
current = current.io;
|
598
|
-
break;
|
599
|
-
}
|
600
|
-
|
601
474
|
case "Logged"
|
602
475
|
/* IOTag.Logged */
|
603
476
|
:
|
@@ -607,15 +480,6 @@ export class FiberContext {
|
|
607
480
|
break;
|
608
481
|
}
|
609
482
|
|
610
|
-
case "SetRuntimeConfig"
|
611
|
-
/* IOTag.SetRuntimeConfig */
|
612
|
-
:
|
613
|
-
{
|
614
|
-
this.runtimeConfig = current.runtimeConfig;
|
615
|
-
current = tsplus_module_10.unit;
|
616
|
-
break;
|
617
|
-
}
|
618
|
-
|
619
483
|
default:
|
620
484
|
{
|
621
485
|
console.log("Unrecognized Instruction", current);
|
@@ -625,16 +489,16 @@ export class FiberContext {
|
|
625
489
|
}
|
626
490
|
} else {
|
627
491
|
const trace = current.trace;
|
628
|
-
current =
|
492
|
+
current = tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), trace);
|
629
493
|
this.unsafeSetInterrupting(true);
|
630
494
|
}
|
631
495
|
|
632
496
|
opCount++;
|
633
497
|
}
|
634
498
|
} catch (e) {
|
635
|
-
if (
|
499
|
+
if (tsplus_module_29.isInterruptedException(e)) {
|
636
500
|
const trace = current ? current.trace : undefined;
|
637
|
-
current =
|
501
|
+
current = tsplus_module_31.interruptAs(tsplus_module_30.none, trace);
|
638
502
|
this.unsafeSetInterrupting(true);
|
639
503
|
} else if (isIOError(e)) {
|
640
504
|
switch (e.exit._tag) {
|
@@ -647,55 +511,55 @@ export class FiberContext {
|
|
647
511
|
case "Failure":
|
648
512
|
{
|
649
513
|
const trace = current ? current.trace : undefined;
|
650
|
-
current =
|
514
|
+
current = tsplus_module_11.failCauseNow(e.exit.cause, trace);
|
651
515
|
}
|
652
516
|
}
|
653
517
|
} else {
|
654
518
|
this.unsafeSetInterrupting(true);
|
655
|
-
current =
|
519
|
+
current = tsplus_module_11.haltNow(e, fileName_1 + ":431:42");
|
656
520
|
}
|
657
521
|
}
|
658
522
|
}
|
659
523
|
} finally {
|
660
524
|
currentFiber.set(null);
|
661
|
-
this.currentSupervisor
|
525
|
+
this.currentSupervisor.unsafeOnSuspend(this);
|
662
526
|
}
|
663
527
|
}
|
664
528
|
|
665
529
|
unsafeRunLater(i0) {
|
666
|
-
this.unsafeGetRef(
|
530
|
+
this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => {
|
667
531
|
this.nextIO = i0;
|
668
532
|
this.runUntil(this.runtimeConfig.yieldOpCount);
|
669
533
|
});
|
670
534
|
}
|
671
535
|
|
672
536
|
unsafeGetRef(ref) {
|
673
|
-
return
|
537
|
+
return tsplus_module_33.getOrElse_(tsplus_module_33.map_(tsplus_module_12.get_(this.fiberRefLocals.get, ref), _ => _.head[1]), () => tsplus_module_32.initial(ref));
|
674
538
|
}
|
675
539
|
|
676
540
|
unsafeGetRefs(fiberRefLocals) {
|
677
|
-
return
|
541
|
+
return tsplus_module_12.map_(fiberRefLocals.get, stack => stack.head[1]);
|
678
542
|
}
|
679
543
|
|
680
544
|
unsafeSetRef(ref, value) {
|
681
545
|
const oldState = this.fiberRefLocals.get;
|
682
|
-
const oldStack =
|
546
|
+
const oldStack = tsplus_module_33.getOrElse_(tsplus_module_12.get_(oldState, ref), () => tsplus_module_24.empty());
|
683
547
|
let newStack;
|
684
548
|
|
685
|
-
if (
|
686
|
-
newStack =
|
549
|
+
if (tsplus_module_34.isEmpty(oldStack)) {
|
550
|
+
newStack = tsplus_module_24.cons([this.fiberId, value]);
|
687
551
|
} else if (tsplus_module_7.strictEquals(oldStack.head[0], this.fiberId)) {
|
688
|
-
newStack =
|
552
|
+
newStack = tsplus_module_24.cons([this.fiberId, value], oldStack.tail);
|
689
553
|
} else {
|
690
|
-
newStack =
|
554
|
+
newStack = tsplus_module_24.cons([this.fiberId, value], oldStack);
|
691
555
|
}
|
692
556
|
|
693
|
-
const newState =
|
557
|
+
const newState = tsplus_module_12.set_(oldState, ref, newStack);
|
694
558
|
this.fiberRefLocals.set(newState);
|
695
559
|
}
|
696
560
|
|
697
561
|
unsafeDeleteRef(ref) {
|
698
|
-
this.fiberRefLocals.set(
|
562
|
+
this.fiberRefLocals.set(tsplus_module_12.remove_(this.fiberRefLocals.get, ref));
|
699
563
|
}
|
700
564
|
|
701
565
|
unsafePoll() {
|
@@ -716,7 +580,7 @@ export class FiberContext {
|
|
716
580
|
this.stack.push(new Finalizer(finalizer, v => {
|
717
581
|
this.unsafeDisableInterruption();
|
718
582
|
this.unsafeRestoreInterruptStatus();
|
719
|
-
return
|
583
|
+
return tsplus_module_11.map_(finalizer, () => v, fileName_1 + ":506:29");
|
720
584
|
}));
|
721
585
|
}
|
722
586
|
|
@@ -745,9 +609,9 @@ export class FiberContext {
|
|
745
609
|
}
|
746
610
|
|
747
611
|
unsafeAddSuppressedCause(cause) {
|
748
|
-
if (!
|
612
|
+
if (!tsplus_module_35.isEmpty(cause)) {
|
749
613
|
if (this.state._tag === "Executing") {
|
750
|
-
this.state.suppressed =
|
614
|
+
this.state.suppressed = tsplus_module_27.then(this.state.suppressed, cause);
|
751
615
|
}
|
752
616
|
}
|
753
617
|
}
|
@@ -775,14 +639,14 @@ export class FiberContext {
|
|
775
639
|
case "Finalizer":
|
776
640
|
{
|
777
641
|
this.unsafeDisableInterruption();
|
778
|
-
this.stack.push(new TracedCont(cause =>
|
642
|
+
this.stack.push(new TracedCont(cause => tsplus_module_11.matchCauseIO_(frame.finalizer, finalizerCause => {
|
779
643
|
this.interruptStatus.pop();
|
780
644
|
this.unsafeAddSuppressedCause(finalizerCause);
|
781
|
-
return
|
645
|
+
return tsplus_module_11.failCauseNow(cause, fileName_1 + ":570:43");
|
782
646
|
}, () => {
|
783
647
|
this.interruptStatus.pop();
|
784
|
-
return
|
785
|
-
}, fileName_1 + ":
|
648
|
+
return tsplus_module_11.failCauseNow(cause, fileName_1 + ":574:43");
|
649
|
+
}, fileName_1 + ":566:45"), frame.trace));
|
786
650
|
unwinding = false;
|
787
651
|
break;
|
788
652
|
}
|
@@ -827,13 +691,13 @@ export class FiberContext {
|
|
827
691
|
const k = this.stack.pop();
|
828
692
|
return k.apply(value);
|
829
693
|
} else {
|
830
|
-
return this.unsafeTryDone(
|
694
|
+
return this.unsafeTryDone(tsplus_module_28.succeed(value));
|
831
695
|
}
|
832
696
|
}
|
833
697
|
|
834
698
|
unsafeNotifyObservers(v, observers) {
|
835
699
|
if (observers.size > 0) {
|
836
|
-
const result =
|
700
|
+
const result = tsplus_module_28.succeed(v);
|
837
701
|
observers.forEach(k => k(result));
|
838
702
|
}
|
839
703
|
}
|
@@ -845,25 +709,25 @@ export class FiberContext {
|
|
845
709
|
}
|
846
710
|
|
847
711
|
unsafeInterruptAs(fiberId) {
|
848
|
-
const interruptedCause =
|
849
|
-
return
|
712
|
+
const interruptedCause = tsplus_module_27.interrupt(fiberId);
|
713
|
+
return tsplus_module_11.defer(() => {
|
850
714
|
const oldState = this.state;
|
851
715
|
|
852
716
|
if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.interruptible && this.state.asyncCanceller._tag === "Registered") {
|
853
717
|
const asyncCanceller = this.state.asyncCanceller.asyncCanceller;
|
854
|
-
const interrupt =
|
855
|
-
this.state.status =
|
718
|
+
const interrupt = tsplus_module_11.failCauseNow(interruptedCause, fileName_1 + ":644:52");
|
719
|
+
this.state.status = tsplus_module_36.running(true);
|
856
720
|
this.state.interruptors = new Set(oldState.interruptors).add(fiberId);
|
857
|
-
this.state.asyncCanceller =
|
858
|
-
this.unsafeRunLater(
|
721
|
+
this.state.asyncCanceller = tsplus_module_37.empty;
|
722
|
+
this.unsafeRunLater(tsplus_module_11.flatMap_(asyncCanceller, () => interrupt, fileName_1 + ":648:60"));
|
859
723
|
} else if (this.state._tag === "Executing") {
|
860
|
-
const newCause =
|
724
|
+
const newCause = tsplus_module_27.then(this.state.suppressed, interruptedCause);
|
861
725
|
this.state.interruptors.add(fiberId);
|
862
726
|
this.state.suppressed = newCause;
|
863
727
|
}
|
864
728
|
|
865
729
|
return this.await;
|
866
|
-
}, fileName_1 + ":
|
730
|
+
}, fileName_1 + ":635:20");
|
867
731
|
}
|
868
732
|
|
869
733
|
unsafeTryDone(exit, trace) {
|
@@ -881,16 +745,16 @@ export class FiberContext {
|
|
881
745
|
const mailbox = this.state.mailbox;
|
882
746
|
this.state.mailbox = null;
|
883
747
|
this.unsafeSetInterrupting(true);
|
884
|
-
return
|
748
|
+
return tsplus_module_11.flatMap_(mailbox, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":670:60"), fileName_1 + ":670:42");
|
885
749
|
} else if (this._children.size === 0) {
|
886
750
|
// We are truly "done" because all the children of this fiber have terminated,
|
887
751
|
// and there are no more pending effects that we have to execute on the fiber.
|
888
|
-
const interruptorsCause =
|
889
|
-
const newExit =
|
890
|
-
if (
|
752
|
+
const interruptorsCause = tsplus_module_38.interruptorsCause(this.state);
|
753
|
+
const newExit = tsplus_module_35.isEmpty(interruptorsCause) ? exit : tsplus_module_15.mapErrorCause_(exit, cause => {
|
754
|
+
if (tsplus_module_27.contains_(cause, interruptorsCause)) {
|
891
755
|
return cause;
|
892
756
|
} else {
|
893
|
-
return
|
757
|
+
return tsplus_module_27.then(cause, interruptorsCause);
|
894
758
|
}
|
895
759
|
});
|
896
760
|
const observers = this.state.observers;
|
@@ -901,26 +765,26 @@ export class FiberContext {
|
|
901
765
|
} else {
|
902
766
|
// not done because there are children left to close
|
903
767
|
this.unsafeSetInterrupting(true);
|
904
|
-
let interruptChildren =
|
768
|
+
let interruptChildren = tsplus_module_11.unit;
|
905
769
|
|
906
770
|
this._children.forEach(child => {
|
907
|
-
interruptChildren =
|
771
|
+
interruptChildren = tsplus_module_11.flatMap_(interruptChildren, () => child.interruptAs(this.fiberId), fileName_1 + ":702:58");
|
908
772
|
});
|
909
773
|
|
910
774
|
this._children.clear();
|
911
775
|
|
912
|
-
return
|
776
|
+
return tsplus_module_11.flatMap_(interruptChildren, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":706:70"), fileName_1 + ":706:52");
|
913
777
|
}
|
914
778
|
}
|
915
779
|
}
|
916
780
|
}
|
917
781
|
|
918
782
|
unsafeSetAsyncCanceller(epoch, asyncCanceller0) {
|
919
|
-
const asyncCanceller = !asyncCanceller0 ?
|
783
|
+
const asyncCanceller = !asyncCanceller0 ? tsplus_module_11.unit : asyncCanceller0;
|
920
784
|
|
921
785
|
if (this.state._tag === "Executing") {
|
922
786
|
if (this.state.status._tag === "Suspended" && this.state.asyncCanceller._tag === "Pending" && this.state.status.epoch === epoch) {
|
923
|
-
this.state.asyncCanceller =
|
787
|
+
this.state.asyncCanceller = tsplus_module_37.registered(asyncCanceller);
|
924
788
|
} else if (this.state.status._tag === "Suspended" && this.state.asyncCanceller._tag === "Registered" && this.state.status.epoch === epoch) {
|
925
789
|
throw new Error("inconsistent state in setAsyncCanceller");
|
926
790
|
}
|
@@ -956,18 +820,18 @@ export class FiberContext {
|
|
956
820
|
if (this.state._tag === "Executing" && this.state.status._tag === "Running"
|
957
821
|
/* FiberStatusTag.Running */
|
958
822
|
&& this.state.asyncCanceller._tag === "Empty") {
|
959
|
-
const newStatus =
|
823
|
+
const newStatus = tsplus_module_36.suspended(this.state.status.interrupting, this.unsafeIsInterruptible && !this.unsafeIsInterrupting, epoch, blockingOn, trace);
|
960
824
|
this.state.status = newStatus;
|
961
|
-
this.state.asyncCanceller =
|
825
|
+
this.state.asyncCanceller = tsplus_module_37.pending;
|
962
826
|
} else {
|
963
|
-
throw new
|
827
|
+
throw new tsplus_module_29.IllegalStateError(`Fiber ${tsplus_module_3.threadName(this.fiberId)} is not running`);
|
964
828
|
}
|
965
829
|
}
|
966
830
|
|
967
831
|
unsafeExitAsync(epoch) {
|
968
832
|
if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.epoch === epoch) {
|
969
|
-
this.state.status =
|
970
|
-
this.state.asyncCanceller =
|
833
|
+
this.state.status = tsplus_module_36.running(this.state.status.interrupting);
|
834
|
+
this.state.asyncCanceller = tsplus_module_37.empty;
|
971
835
|
return true;
|
972
836
|
}
|
973
837
|
|
@@ -983,31 +847,31 @@ export class FiberContext {
|
|
983
847
|
}
|
984
848
|
|
985
849
|
unsafeFork(io, forkScope = tsplus_module_1.nothing(), trace) {
|
986
|
-
const childId =
|
987
|
-
const childFiberRefLocals =
|
850
|
+
const childId = tsplus_module_30.unsafeMake(tsplus_module_39.parse(trace));
|
851
|
+
const childFiberRefLocals = tsplus_module_12.mapWithIndex_(this.fiberRefLocals.get, (fiberRef, stack) => {
|
988
852
|
const oldValue = stack.head[1];
|
989
|
-
const newValue =
|
853
|
+
const newValue = tsplus_module_32.patch(fiberRef)(tsplus_module_32.fork(fiberRef))(oldValue);
|
990
854
|
|
991
855
|
if (oldValue === newValue) {
|
992
856
|
return stack;
|
993
857
|
} else {
|
994
|
-
return
|
858
|
+
return tsplus_module_24.cons([childId, newValue], stack);
|
995
859
|
}
|
996
860
|
});
|
997
|
-
const parentScope =
|
861
|
+
const parentScope = tsplus_module_33.getOrElse_(tsplus_module_33.orElse_(forkScope, () => this.unsafeGetRef(tsplus_module_10.forkScopeOverride)), () => this.scope);
|
998
862
|
const grandChildren = new Set();
|
999
863
|
const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible), new AtomicReference(childFiberRefLocals), grandChildren);
|
1000
864
|
|
1001
|
-
if (this.currentSupervisor !==
|
1002
|
-
this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(
|
865
|
+
if (this.currentSupervisor !== tsplus_module_26.none) {
|
866
|
+
this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(tsplus_module_10.currentEnvironment), io, tsplus_module_1.just(this), childContext);
|
1003
867
|
childContext.unsafeOnDone(exit => {
|
1004
|
-
this.currentSupervisor.unsafeOnEnd(
|
868
|
+
this.currentSupervisor.unsafeOnEnd(tsplus_module_15.flatten(exit), childContext);
|
1005
869
|
});
|
1006
870
|
}
|
1007
871
|
|
1008
|
-
const childIO = !parentScope.unsafeAdd(childContext) ?
|
872
|
+
const childIO = !parentScope.unsafeAdd(childContext) ? tsplus_module_31.interruptAs(parentScope.fiberId, fileName_1 + ":835:74") : io;
|
1009
873
|
childContext.nextIO = childIO;
|
1010
|
-
this.unsafeGetRef(
|
874
|
+
this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => childContext.runUntil(this.runtimeConfig.yieldOpCount));
|
1011
875
|
return childContext;
|
1012
876
|
}
|
1013
877
|
|
@@ -1017,7 +881,7 @@ export class FiberContext {
|
|
1017
881
|
if (exit == null) {
|
1018
882
|
return;
|
1019
883
|
} else {
|
1020
|
-
k(
|
884
|
+
k(tsplus_module_28.succeed(exit));
|
1021
885
|
}
|
1022
886
|
}
|
1023
887
|
|
@@ -1026,26 +890,26 @@ export class FiberContext {
|
|
1026
890
|
case "Executing":
|
1027
891
|
{
|
1028
892
|
const suppressed = this.state.suppressed;
|
1029
|
-
this.state.suppressed =
|
893
|
+
this.state.suppressed = tsplus_module_27.empty();
|
1030
894
|
return suppressed;
|
1031
895
|
}
|
1032
896
|
|
1033
897
|
case "Done":
|
1034
898
|
{
|
1035
|
-
return
|
899
|
+
return tsplus_module_27.empty();
|
1036
900
|
}
|
1037
901
|
}
|
1038
902
|
}
|
1039
903
|
|
1040
904
|
unsafeGetDescriptor() {
|
1041
|
-
return new
|
905
|
+
return new tsplus_module_40.FiberDescriptor(this.fiberId, this.state.status, this.state.interruptors, tsplus_module_41.fromBoolean(this.unsafeIsInterruptible), this.scope);
|
1042
906
|
}
|
1043
907
|
|
1044
908
|
unsafeRace(race) {
|
1045
909
|
const raceIndicator = new AtomicReference(true);
|
1046
910
|
const left = this.unsafeFork(race.left, tsplus_module_1.nothing(), race.trace);
|
1047
911
|
const right = this.unsafeFork(race.right, tsplus_module_1.nothing(), race.trace);
|
1048
|
-
return
|
912
|
+
return tsplus_module_11.async(cb => {
|
1049
913
|
const leftRegister = left.unsafeAddObserver(() => {
|
1050
914
|
this.unsafeCompleteRace(left, right, race.leftWins, raceIndicator, cb);
|
1051
915
|
});
|
@@ -1061,7 +925,7 @@ export class FiberContext {
|
|
1061
925
|
this.unsafeCompleteRace(right, left, race.rightWins, raceIndicator, cb);
|
1062
926
|
}
|
1063
927
|
}
|
1064
|
-
}, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":
|
928
|
+
}, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":884:20");
|
1065
929
|
}
|
1066
930
|
|
1067
931
|
unsafeCompleteRace(winner, loser, cont, ab, cb) {
|
@@ -1072,23 +936,23 @@ export class FiberContext {
|
|
1072
936
|
|
1073
937
|
unsafeCaptureTrace(prefix) {
|
1074
938
|
const builder = new StackTraceBuilder();
|
1075
|
-
|
939
|
+
tsplus_module_42.forEach_(prefix, element => builder.append(tsplus_module_39.parse(element)));
|
1076
940
|
const stack = this.stack.clone();
|
1077
941
|
|
1078
942
|
while (stack.hasNext) {
|
1079
|
-
builder.append(
|
943
|
+
builder.append(tsplus_module_39.parse(stack.pop().trace));
|
1080
944
|
}
|
1081
945
|
|
1082
|
-
return new
|
946
|
+
return new tsplus_module_43.Trace(this.fiberId, builder.result());
|
1083
947
|
}
|
1084
948
|
|
1085
949
|
unsafeEvalOn(effect, orElse) {
|
1086
950
|
if (this.state._tag === "Executing") {
|
1087
|
-
const newMailbox = this.state.mailbox == null ? effect :
|
951
|
+
const newMailbox = this.state.mailbox == null ? effect : tsplus_module_11.flatMap_(this.state.mailbox, () => effect, fileName_1 + ":928:92");
|
1088
952
|
this.state.mailbox = newMailbox;
|
1089
|
-
return
|
953
|
+
return tsplus_module_11.unit;
|
1090
954
|
} else {
|
1091
|
-
return
|
955
|
+
return tsplus_module_11.asUnit(orElse, fileName_1 + ":932:20");
|
1092
956
|
}
|
1093
957
|
}
|
1094
958
|
|
@@ -1103,31 +967,31 @@ export class FiberContext {
|
|
1103
967
|
}
|
1104
968
|
|
1105
969
|
unsafeAddChild(child) {
|
1106
|
-
this.unsafeEvalOn(
|
970
|
+
this.unsafeEvalOn(tsplus_module_11.succeed(() => {
|
1107
971
|
this._children.add(child);
|
1108
|
-
}, fileName_1 + ":
|
972
|
+
}, fileName_1 + ":948:17"), tsplus_module_11.unit);
|
1109
973
|
}
|
1110
974
|
|
1111
975
|
unsafeLog(message, trace) {
|
1112
|
-
const logLevel = this.unsafeGetRef(
|
1113
|
-
const spans = this.unsafeGetRef(
|
1114
|
-
const annotations = this.unsafeGetRef(
|
1115
|
-
this.runtimeConfig.logger.log(
|
976
|
+
const logLevel = this.unsafeGetRef(tsplus_module_10.currentLogLevel);
|
977
|
+
const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
|
978
|
+
const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
|
979
|
+
this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, tsplus_module_27.empty(), this.fiberRefLocals.get, spans, annotations);
|
1116
980
|
}
|
1117
981
|
|
1118
982
|
unsafeLogWith(message, cause, overrideLogLevel, overrideRef1 = null, overrideValue1 = null, trace) {
|
1119
|
-
const logLevel =
|
1120
|
-
const spans = this.unsafeGetRef(
|
1121
|
-
const annotations = this.unsafeGetRef(
|
983
|
+
const logLevel = tsplus_module_33.getOrElse_(overrideLogLevel, () => this.unsafeGetRef(tsplus_module_10.currentLogLevel));
|
984
|
+
const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
|
985
|
+
const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
|
1122
986
|
let contextMap;
|
1123
987
|
|
1124
988
|
if (overrideRef1 !== null) {
|
1125
989
|
const map = this.unsafeGetRefs(this.fiberRefLocals);
|
1126
990
|
|
1127
991
|
if (overrideValue1 === null) {
|
1128
|
-
|
992
|
+
tsplus_module_12.remove_(map, overrideRef1);
|
1129
993
|
} else {
|
1130
|
-
|
994
|
+
tsplus_module_12.set_(map, overrideRef1, overrideValue1);
|
1131
995
|
}
|
1132
996
|
|
1133
997
|
contextMap = map;
|
@@ -1135,7 +999,11 @@ export class FiberContext {
|
|
1135
999
|
contextMap = this.fiberRefLocals.get;
|
1136
1000
|
}
|
1137
1001
|
|
1138
|
-
this.runtimeConfig.logger.log(
|
1002
|
+
this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
get currentSupervisor() {
|
1006
|
+
return this.unsafeGetRef(tsplus_module_10.currentSupervisor);
|
1139
1007
|
}
|
1140
1008
|
|
1141
1009
|
}
|