@fncts/io 0.0.17 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- 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/Clock/definition.d.ts +1 -0
- package/Fiber/FiberContext.d.ts +22 -19
- package/Fiber/api/interruptAll.d.ts +1 -1
- package/Fiber/api/interruptAsFork.d.ts +8 -0
- package/Fiber/definition.d.ts +6 -8
- package/FiberRef/api.d.ts +7 -2
- package/FiberRef/definition.d.ts +4 -3
- package/FiberRef/unsafe.d.ts +18 -1
- package/FiberRefs/api.d.ts +5 -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/Reloadable/api.d.ts +21 -0
- package/Reloadable/constructors.d.ts +23 -0
- package/Reloadable/definition.d.ts +20 -0
- package/Reloadable.d.ts +3 -0
- 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 +2 -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 +180 -310
- package/_cjs/Fiber/FiberContext.cjs.map +1 -1
- package/_cjs/Fiber/api/collectAll.cjs +2 -2
- package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
- package/_cjs/Fiber/api/interrupt.cjs +4 -2
- package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAll.cjs +8 -8
- package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAs.cjs +7 -1
- package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
- package/_cjs/Fiber/api/interruptAsFork.cjs +15 -0
- package/_cjs/Fiber/api/interruptAsFork.cjs.map +1 -0
- package/_cjs/Fiber/api/interruptFork.cjs +5 -5
- package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
- package/_cjs/Fiber/definition.cjs +2 -2
- package/_cjs/Fiber/definition.cjs.map +1 -1
- package/_cjs/FiberRef/api.cjs +29 -10
- package/_cjs/FiberRef/api.cjs.map +1 -1
- package/_cjs/FiberRef/definition.cjs +2 -1
- package/_cjs/FiberRef/definition.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +29 -5
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/FiberRefs/api.cjs +28 -2
- package/_cjs/FiberRefs/api.cjs.map +1 -1
- package/_cjs/FiberRefs/join.cjs +1 -1
- package/_cjs/FiberRefs/join.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 +21 -11
- 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/zipC.cjs +10 -8
- package/_cjs/IO/api/zipC.cjs.map +1 -1
- package/_cjs/IO/api.cjs +67 -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/runtime.cjs +7 -9
- package/_cjs/IO/runtime.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/Reloadable/api.cjs +46 -0
- package/_cjs/Reloadable/api.cjs.map +1 -0
- package/_cjs/Reloadable/constructors.cjs +82 -0
- package/_cjs/Reloadable/constructors.cjs.map +1 -0
- package/_cjs/Reloadable/definition.cjs +58 -0
- package/_cjs/Reloadable/definition.cjs.map +1 -0
- package/_cjs/Reloadable.cjs +45 -0
- package/_cjs/Reloadable.cjs.map +1 -0
- package/_cjs/Scope/definition.cjs +1 -1
- package/_cjs/Scope/definition.cjs.map +1 -1
- package/_cjs/internal/IsFatal.cjs +129 -0
- package/_cjs/internal/IsFatal.cjs.map +1 -0
- package/_mjs/Clock/definition.mjs +2 -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 +180 -309
- package/_mjs/Fiber/FiberContext.mjs.map +1 -1
- package/_mjs/Fiber/api/collectAll.mjs +2 -2
- package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interrupt.mjs +3 -2
- package/_mjs/Fiber/api/interrupt.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAll.mjs +6 -6
- package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAs.mjs +3 -1
- package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
- package/_mjs/Fiber/api/interruptAsFork.mjs +8 -0
- package/_mjs/Fiber/api/interruptAsFork.mjs.map +1 -0
- package/_mjs/Fiber/api/interruptFork.mjs +5 -4
- package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
- package/_mjs/Fiber/definition.mjs +2 -2
- package/_mjs/Fiber/definition.mjs.map +1 -1
- package/_mjs/FiberRef/api.mjs +26 -9
- package/_mjs/FiberRef/api.mjs.map +1 -1
- package/_mjs/FiberRef/definition.mjs +2 -1
- package/_mjs/FiberRef/definition.mjs.map +1 -1
- package/_mjs/FiberRef/unsafe.mjs +23 -4
- package/_mjs/FiberRef/unsafe.mjs.map +1 -1
- package/_mjs/FiberRefs/api.mjs +22 -1
- package/_mjs/FiberRefs/api.mjs.map +1 -1
- package/_mjs/FiberRefs/join.mjs +1 -1
- package/_mjs/FiberRefs/join.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 +18 -9
- 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/zipC.mjs +9 -8
- package/_mjs/IO/api/zipC.mjs.map +1 -1
- package/_mjs/IO/api.mjs +66 -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/runtime.mjs +7 -8
- package/_mjs/IO/runtime.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/Reloadable/api.mjs +30 -0
- package/_mjs/Reloadable/api.mjs.map +1 -0
- package/_mjs/Reloadable/constructors.mjs +55 -0
- package/_mjs/Reloadable/constructors.mjs.map +1 -0
- package/_mjs/Reloadable/definition.mjs +40 -0
- package/_mjs/Reloadable/definition.mjs.map +1 -0
- package/_mjs/Reloadable.mjs +5 -0
- package/_mjs/Reloadable.mjs.map +1 -0
- package/_mjs/Scope/definition.mjs +1 -1
- package/_mjs/Scope/definition.mjs.map +1 -1
- package/_mjs/internal/IsFatal.mjs +104 -0
- package/_mjs/internal/IsFatal.mjs.map +1 -0
- package/_src/Clock/definition.ts +1 -0
- package/_src/Fiber/FiberContext.ts +50 -135
- package/_src/Fiber/api/collectAll.ts +1 -4
- package/_src/Fiber/api/interruptAll.ts +2 -2
- package/_src/Fiber/api/interruptAs.ts +1 -1
- package/_src/Fiber/api/interruptAsFork.ts +7 -0
- package/_src/Fiber/api/interruptFork.ts +1 -1
- package/_src/Fiber/definition.ts +3 -5
- package/_src/FiberRef/api.ts +30 -7
- package/_src/FiberRef/definition.ts +1 -0
- package/_src/FiberRef/unsafe.ts +27 -3
- package/_src/FiberRefs/api.ts +16 -0
- package/_src/FiberRefs/join.ts +1 -1
- 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/runtime.ts +7 -11
- package/_src/IO.ts +1 -0
- package/_src/Reloadable/api.ts +28 -0
- package/_src/Reloadable/constructors.ts +60 -0
- package/_src/Reloadable/definition.ts +34 -0
- package/_src/Reloadable.ts +5 -0
- package/_src/internal/IsFatal.ts +79 -0
- package/internal/IsFatal.d.ts +47 -0
- package/package.json +4 -4
@@ -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 + ":498: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 + ":500: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
|
135
|
-
const childFiberRefLocals = this.fiberRefLocals
|
133
|
+
return tsplus_module_11.defer(() => {
|
134
|
+
const childFiberRefLocals = this.fiberRefLocals;
|
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,37 @@ 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");
|
170
|
+
}
|
171
|
+
|
172
|
+
get fiberRefs() {
|
173
|
+
return tsplus_module_13.make(this.fiberRefLocals);
|
171
174
|
}
|
172
175
|
|
173
176
|
get await() {
|
174
|
-
return
|
175
|
-
const cb = x => k(
|
177
|
+
return tsplus_module_11.asyncInterrupt(k => {
|
178
|
+
const cb = x => k(tsplus_module_11.fromExit(() => x, fileName_1 + ":149:78"));
|
176
179
|
|
177
180
|
const result = this.unsafeAddObserver(cb);
|
178
181
|
|
179
182
|
if (result == null) {
|
180
|
-
return
|
183
|
+
return tsplus_module_22.left(tsplus_module_11.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":152:38"));
|
181
184
|
} else {
|
182
|
-
return
|
185
|
+
return tsplus_module_22.right(tsplus_module_11.succeedNow(result, fileName_1 + ":154:42"));
|
183
186
|
}
|
184
|
-
}, this.fiberId, fileName_1 + ":
|
187
|
+
}, this.fiberId, fileName_1 + ":148:29");
|
185
188
|
}
|
186
189
|
|
187
190
|
run() {
|
@@ -189,23 +192,23 @@ export class FiberContext {
|
|
189
192
|
}
|
190
193
|
|
191
194
|
get scope() {
|
192
|
-
return
|
195
|
+
return tsplus_module_23.unsafeMake(this);
|
193
196
|
}
|
194
197
|
|
195
198
|
get status() {
|
196
|
-
return
|
199
|
+
return tsplus_module_11.succeedNow(this.state.status, fileName_1 + ":168:25");
|
197
200
|
}
|
198
201
|
|
199
202
|
get trace() {
|
200
|
-
return
|
203
|
+
return tsplus_module_11.succeed(() => this.unsafeCaptureTrace(tsplus_module_24.empty()), fileName_1 + ":172:22");
|
201
204
|
}
|
202
205
|
|
203
206
|
interruptAs(fiberId) {
|
204
|
-
return this.
|
207
|
+
return tsplus_module_11.apSecond_(this.interruptAsFork(fiberId), this.await, fileName_1 + ":176:50");
|
205
208
|
}
|
206
209
|
|
207
210
|
evalOn(effect, orElse) {
|
208
|
-
return
|
211
|
+
return tsplus_module_11.defer(() => this.unsafeEvalOn(effect, orElse), fileName_1 + ":180:20");
|
209
212
|
}
|
210
213
|
|
211
214
|
get location() {
|
@@ -224,9 +227,9 @@ export class FiberContext {
|
|
224
227
|
this.nextIO = null;
|
225
228
|
let extraTrace = undefined;
|
226
229
|
const flags = this.runtimeConfig.flags;
|
227
|
-
const superviseOps = flags.isEnabled(
|
228
|
-
this.runtimeConfig.flags.isEnabled(
|
229
|
-
this.currentSupervisor !==
|
230
|
+
const superviseOps = flags.isEnabled(tsplus_module_25.RuntimeConfigFlag.SuperviseOperations) && this.currentSupervisor !== tsplus_module_26.none;
|
231
|
+
this.runtimeConfig.flags.isEnabled(tsplus_module_25.RuntimeConfigFlag.EnableCurrentFiber) && currentFiber.set(this);
|
232
|
+
this.currentSupervisor !== tsplus_module_26.none && this.currentSupervisor.unsafeOnResume(this);
|
230
233
|
|
231
234
|
while (current !== null) {
|
232
235
|
try {
|
@@ -238,7 +241,7 @@ export class FiberContext {
|
|
238
241
|
|
239
242
|
if (message !== null) {
|
240
243
|
const oldIO = current;
|
241
|
-
current =
|
244
|
+
current = tsplus_module_11.flatMap_(message, () => oldIO, fileName_1 + ":217:55");
|
242
245
|
} else if (opCount === maxOpCount) {
|
243
246
|
this.unsafeRunLater(current);
|
244
247
|
current = null;
|
@@ -289,7 +292,7 @@ export class FiberContext {
|
|
289
292
|
:
|
290
293
|
{
|
291
294
|
extraTrace = current.trace;
|
292
|
-
this.unsafeRunLater(
|
295
|
+
this.unsafeRunLater(tsplus_module_11.unit);
|
293
296
|
extraTrace = undefined;
|
294
297
|
current = null;
|
295
298
|
break;
|
@@ -310,7 +313,7 @@ export class FiberContext {
|
|
310
313
|
/* IOTag.Trace */
|
311
314
|
:
|
312
315
|
{
|
313
|
-
current = this.unsafeNextEffect(this.unsafeCaptureTrace(
|
316
|
+
current = this.unsafeNextEffect(this.unsafeCaptureTrace(tsplus_module_24.cons(current.trace, tsplus_module_24.nil())));
|
314
317
|
break;
|
315
318
|
}
|
316
319
|
|
@@ -342,25 +345,25 @@ export class FiberContext {
|
|
342
345
|
/* IOTag.Fail */
|
343
346
|
:
|
344
347
|
{
|
345
|
-
const fastPathTrace = extraTrace === undefined ?
|
348
|
+
const fastPathTrace = extraTrace === undefined ? tsplus_module_24.nil() : tsplus_module_24.cons(extraTrace, tsplus_module_24.nil());
|
346
349
|
extraTrace = undefined;
|
347
350
|
const cause = current.cause();
|
348
|
-
const tracedCause =
|
351
|
+
const tracedCause = tsplus_module_27.isTraced(cause) ? cause : tsplus_module_27.traced(cause, this.unsafeCaptureTrace(tsplus_module_24.cons(current.trace, fastPathTrace)));
|
349
352
|
const discardedFolds = this.unsafeUnwindStack();
|
350
353
|
const strippedCause = discardedFolds ? // We threw away some error handlers while unwinding the stack because
|
351
|
-
|
354
|
+
tsplus_module_27.stripFailures( // We threw away some error handlers while unwinding the stack because
|
352
355
|
// we got interrupted during this instruction. So it's not safe to return
|
353
356
|
// typed failures from cause0, because they might not be typed correctly.
|
354
357
|
// Instead, we strip the typed failures, and return the remainders and
|
355
358
|
// the interruption
|
356
359
|
tracedCause) : tracedCause;
|
357
360
|
const suppressed = this.unsafeClearSuppressedCause();
|
358
|
-
const fullCause =
|
361
|
+
const fullCause = tsplus_module_27.contains_(strippedCause, suppressed) ? strippedCause : tsplus_module_27.then(strippedCause, suppressed);
|
359
362
|
|
360
363
|
if (!this.stack.hasNext) {
|
361
364
|
// Error not caught, stack is empty:
|
362
365
|
this.unsafeSetInterrupting(true);
|
363
|
-
current = this.unsafeTryDone(
|
366
|
+
current = this.unsafeTryDone(tsplus_module_28.failCause(fullCause), current.trace);
|
364
367
|
} else {
|
365
368
|
this.unsafeSetInterrupting(false); // Error caught, next continuation on the stack will deal
|
366
369
|
// with it, so we just have to compute it here
|
@@ -380,29 +383,6 @@ export class FiberContext {
|
|
380
383
|
break;
|
381
384
|
}
|
382
385
|
|
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
386
|
case "Async"
|
407
387
|
/* IOTag.Async */
|
408
388
|
:
|
@@ -422,7 +402,7 @@ export class FiberContext {
|
|
422
402
|
if (this.unsafeShouldInterrupt) {
|
423
403
|
if (this.unsafeExitAsync(epoch)) {
|
424
404
|
this.unsafeSetInterrupting(true);
|
425
|
-
current =
|
405
|
+
current = tsplus_module_11.flatMap_(r.left, () => tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), fileName_1 + ":340:67"), fileName_1 + ":340:45");
|
426
406
|
} else {
|
427
407
|
current = null;
|
428
408
|
}
|
@@ -454,20 +434,12 @@ export class FiberContext {
|
|
454
434
|
break;
|
455
435
|
}
|
456
436
|
|
457
|
-
case "GetDescriptor"
|
458
|
-
/* IOTag.GetDescriptor */
|
459
|
-
:
|
460
|
-
{
|
461
|
-
current = current.f(this.unsafeGetDescriptor());
|
462
|
-
break;
|
463
|
-
}
|
464
|
-
|
465
437
|
case "Yield"
|
466
438
|
/* IOTag.Yield */
|
467
439
|
:
|
468
440
|
{
|
469
441
|
current = null;
|
470
|
-
this.unsafeRunLater(
|
442
|
+
this.unsafeRunLater(tsplus_module_11.unit);
|
471
443
|
break;
|
472
444
|
}
|
473
445
|
|
@@ -487,63 +459,11 @@ export class FiberContext {
|
|
487
459
|
break;
|
488
460
|
}
|
489
461
|
|
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 */
|
462
|
+
case "Stateful"
|
463
|
+
/* IOTag.Stateful */
|
527
464
|
:
|
528
465
|
{
|
529
|
-
|
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 */
|
544
|
-
:
|
545
|
-
{
|
546
|
-
current = current.f(this.runtimeConfig);
|
466
|
+
current = current.onState(this, this.state.status);
|
547
467
|
break;
|
548
468
|
}
|
549
469
|
|
@@ -555,49 +475,6 @@ export class FiberContext {
|
|
555
475
|
break;
|
556
476
|
}
|
557
477
|
|
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
478
|
case "Logged"
|
602
479
|
/* IOTag.Logged */
|
603
480
|
:
|
@@ -607,15 +484,6 @@ export class FiberContext {
|
|
607
484
|
break;
|
608
485
|
}
|
609
486
|
|
610
|
-
case "SetRuntimeConfig"
|
611
|
-
/* IOTag.SetRuntimeConfig */
|
612
|
-
:
|
613
|
-
{
|
614
|
-
this.runtimeConfig = current.runtimeConfig;
|
615
|
-
current = tsplus_module_10.unit;
|
616
|
-
break;
|
617
|
-
}
|
618
|
-
|
619
487
|
default:
|
620
488
|
{
|
621
489
|
console.log("Unrecognized Instruction", current);
|
@@ -625,16 +493,16 @@ export class FiberContext {
|
|
625
493
|
}
|
626
494
|
} else {
|
627
495
|
const trace = current.trace;
|
628
|
-
current =
|
496
|
+
current = tsplus_module_11.failCauseNow(this.unsafeClearSuppressedCause(), trace);
|
629
497
|
this.unsafeSetInterrupting(true);
|
630
498
|
}
|
631
499
|
|
632
500
|
opCount++;
|
633
501
|
}
|
634
502
|
} catch (e) {
|
635
|
-
if (
|
503
|
+
if (tsplus_module_29.isInterruptedException(e)) {
|
636
504
|
const trace = current ? current.trace : undefined;
|
637
|
-
current =
|
505
|
+
current = tsplus_module_31.interruptAs(tsplus_module_30.none, trace);
|
638
506
|
this.unsafeSetInterrupting(true);
|
639
507
|
} else if (isIOError(e)) {
|
640
508
|
switch (e.exit._tag) {
|
@@ -647,55 +515,57 @@ export class FiberContext {
|
|
647
515
|
case "Failure":
|
648
516
|
{
|
649
517
|
const trace = current ? current.trace : undefined;
|
650
|
-
current =
|
518
|
+
current = tsplus_module_11.failCauseNow(e.exit.cause, trace);
|
651
519
|
}
|
652
520
|
}
|
521
|
+
} else if (this.unsafeIsFatal(e)) {
|
522
|
+
this.unsafeHandleFatalError(e);
|
653
523
|
} else {
|
654
524
|
this.unsafeSetInterrupting(true);
|
655
|
-
current =
|
525
|
+
current = tsplus_module_11.haltNow(e, fileName_1 + ":437:42");
|
656
526
|
}
|
657
527
|
}
|
658
528
|
}
|
659
529
|
} finally {
|
660
530
|
currentFiber.set(null);
|
661
|
-
this.currentSupervisor
|
531
|
+
this.currentSupervisor.unsafeOnSuspend(this);
|
662
532
|
}
|
663
533
|
}
|
664
534
|
|
665
535
|
unsafeRunLater(i0) {
|
666
|
-
this.unsafeGetRef(
|
536
|
+
this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => {
|
667
537
|
this.nextIO = i0;
|
668
538
|
this.runUntil(this.runtimeConfig.yieldOpCount);
|
669
539
|
});
|
670
540
|
}
|
671
541
|
|
672
542
|
unsafeGetRef(ref) {
|
673
|
-
return
|
543
|
+
return tsplus_module_33.getOrElse_(tsplus_module_33.map_(tsplus_module_12.get_(this.fiberRefLocals, ref), _ => _.head[1]), () => tsplus_module_32.initial(ref));
|
674
544
|
}
|
675
545
|
|
676
546
|
unsafeGetRefs(fiberRefLocals) {
|
677
|
-
return
|
547
|
+
return tsplus_module_12.map_(fiberRefLocals, stack => stack.head[1]);
|
678
548
|
}
|
679
549
|
|
680
550
|
unsafeSetRef(ref, value) {
|
681
|
-
const oldState = this.fiberRefLocals
|
682
|
-
const oldStack =
|
551
|
+
const oldState = this.fiberRefLocals;
|
552
|
+
const oldStack = tsplus_module_33.getOrElse_(tsplus_module_12.get_(oldState, ref), () => tsplus_module_24.empty());
|
683
553
|
let newStack;
|
684
554
|
|
685
|
-
if (
|
686
|
-
newStack =
|
555
|
+
if (tsplus_module_34.isEmpty(oldStack)) {
|
556
|
+
newStack = tsplus_module_24.cons([this.fiberId, value]);
|
687
557
|
} else if (tsplus_module_7.strictEquals(oldStack.head[0], this.fiberId)) {
|
688
|
-
newStack =
|
558
|
+
newStack = tsplus_module_24.cons([this.fiberId, value], oldStack.tail);
|
689
559
|
} else {
|
690
|
-
newStack =
|
560
|
+
newStack = tsplus_module_24.cons([this.fiberId, value], oldStack);
|
691
561
|
}
|
692
562
|
|
693
|
-
const newState =
|
694
|
-
this.fiberRefLocals
|
563
|
+
const newState = tsplus_module_12.set_(oldState, ref, newStack);
|
564
|
+
this.fiberRefLocals = newState;
|
695
565
|
}
|
696
566
|
|
697
567
|
unsafeDeleteRef(ref) {
|
698
|
-
this.fiberRefLocals.
|
568
|
+
this.fiberRefLocals = tsplus_module_12.remove_(this.fiberRefLocals, ref);
|
699
569
|
}
|
700
570
|
|
701
571
|
unsafePoll() {
|
@@ -716,7 +586,7 @@ export class FiberContext {
|
|
716
586
|
this.stack.push(new Finalizer(finalizer, v => {
|
717
587
|
this.unsafeDisableInterruption();
|
718
588
|
this.unsafeRestoreInterruptStatus();
|
719
|
-
return
|
589
|
+
return tsplus_module_11.map_(finalizer, () => v, fileName_1 + ":512:29");
|
720
590
|
}));
|
721
591
|
}
|
722
592
|
|
@@ -745,9 +615,9 @@ export class FiberContext {
|
|
745
615
|
}
|
746
616
|
|
747
617
|
unsafeAddSuppressedCause(cause) {
|
748
|
-
if (!
|
618
|
+
if (!tsplus_module_35.isEmpty(cause)) {
|
749
619
|
if (this.state._tag === "Executing") {
|
750
|
-
this.state.suppressed =
|
620
|
+
this.state.suppressed = tsplus_module_27.then(this.state.suppressed, cause);
|
751
621
|
}
|
752
622
|
}
|
753
623
|
}
|
@@ -775,14 +645,14 @@ export class FiberContext {
|
|
775
645
|
case "Finalizer":
|
776
646
|
{
|
777
647
|
this.unsafeDisableInterruption();
|
778
|
-
this.stack.push(new TracedCont(cause =>
|
648
|
+
this.stack.push(new TracedCont(cause => tsplus_module_11.matchCauseIO_(frame.finalizer, finalizerCause => {
|
779
649
|
this.interruptStatus.pop();
|
780
650
|
this.unsafeAddSuppressedCause(finalizerCause);
|
781
|
-
return
|
651
|
+
return tsplus_module_11.failCauseNow(cause, fileName_1 + ":576:43");
|
782
652
|
}, () => {
|
783
653
|
this.interruptStatus.pop();
|
784
|
-
return
|
785
|
-
}, fileName_1 + ":
|
654
|
+
return tsplus_module_11.failCauseNow(cause, fileName_1 + ":580:43");
|
655
|
+
}, fileName_1 + ":572:45"), frame.trace));
|
786
656
|
unwinding = false;
|
787
657
|
break;
|
788
658
|
}
|
@@ -827,13 +697,13 @@ export class FiberContext {
|
|
827
697
|
const k = this.stack.pop();
|
828
698
|
return k.apply(value);
|
829
699
|
} else {
|
830
|
-
return this.unsafeTryDone(
|
700
|
+
return this.unsafeTryDone(tsplus_module_28.succeed(value));
|
831
701
|
}
|
832
702
|
}
|
833
703
|
|
834
704
|
unsafeNotifyObservers(v, observers) {
|
835
705
|
if (observers.size > 0) {
|
836
|
-
const result =
|
706
|
+
const result = tsplus_module_28.succeed(v);
|
837
707
|
observers.forEach(k => k(result));
|
838
708
|
}
|
839
709
|
}
|
@@ -844,26 +714,24 @@ export class FiberContext {
|
|
844
714
|
}
|
845
715
|
}
|
846
716
|
|
847
|
-
|
848
|
-
const interruptedCause =
|
849
|
-
return
|
717
|
+
interruptAsFork(fiberId) {
|
718
|
+
const interruptedCause = tsplus_module_27.interrupt(fiberId);
|
719
|
+
return tsplus_module_11.succeed(() => {
|
850
720
|
const oldState = this.state;
|
851
721
|
|
852
722
|
if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.interruptible && this.state.asyncCanceller._tag === "Registered") {
|
853
723
|
const asyncCanceller = this.state.asyncCanceller.asyncCanceller;
|
854
|
-
const interrupt =
|
855
|
-
this.state.status =
|
724
|
+
const interrupt = tsplus_module_11.failCauseNow(interruptedCause, fileName_1 + ":650:52");
|
725
|
+
this.state.status = tsplus_module_36.running(true);
|
856
726
|
this.state.interruptors = new Set(oldState.interruptors).add(fiberId);
|
857
|
-
this.state.asyncCanceller =
|
858
|
-
this.unsafeRunLater(
|
727
|
+
this.state.asyncCanceller = tsplus_module_37.empty;
|
728
|
+
this.unsafeRunLater(tsplus_module_11.flatMap_(asyncCanceller, () => interrupt, fileName_1 + ":654:60"));
|
859
729
|
} else if (this.state._tag === "Executing") {
|
860
|
-
const newCause =
|
730
|
+
const newCause = tsplus_module_27.then(this.state.suppressed, interruptedCause);
|
861
731
|
this.state.interruptors.add(fiberId);
|
862
732
|
this.state.suppressed = newCause;
|
863
733
|
}
|
864
|
-
|
865
|
-
return this.await;
|
866
|
-
}, fileName_1 + ":729:20");
|
734
|
+
}, fileName_1 + ":641:14");
|
867
735
|
}
|
868
736
|
|
869
737
|
unsafeTryDone(exit, trace) {
|
@@ -881,16 +749,16 @@ export class FiberContext {
|
|
881
749
|
const mailbox = this.state.mailbox;
|
882
750
|
this.state.mailbox = null;
|
883
751
|
this.unsafeSetInterrupting(true);
|
884
|
-
return
|
752
|
+
return tsplus_module_11.flatMap_(mailbox, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":675:60"), fileName_1 + ":675:42");
|
885
753
|
} else if (this._children.size === 0) {
|
886
754
|
// We are truly "done" because all the children of this fiber have terminated,
|
887
755
|
// and there are no more pending effects that we have to execute on the fiber.
|
888
|
-
const interruptorsCause =
|
889
|
-
const newExit =
|
890
|
-
if (
|
756
|
+
const interruptorsCause = tsplus_module_38.interruptorsCause(this.state);
|
757
|
+
const newExit = tsplus_module_35.isEmpty(interruptorsCause) ? exit : tsplus_module_15.mapErrorCause_(exit, cause => {
|
758
|
+
if (tsplus_module_27.contains_(cause, interruptorsCause)) {
|
891
759
|
return cause;
|
892
760
|
} else {
|
893
|
-
return
|
761
|
+
return tsplus_module_27.then(cause, interruptorsCause);
|
894
762
|
}
|
895
763
|
});
|
896
764
|
const observers = this.state.observers;
|
@@ -901,26 +769,26 @@ export class FiberContext {
|
|
901
769
|
} else {
|
902
770
|
// not done because there are children left to close
|
903
771
|
this.unsafeSetInterrupting(true);
|
904
|
-
let interruptChildren =
|
772
|
+
let interruptChildren = tsplus_module_11.unit;
|
905
773
|
|
906
774
|
this._children.forEach(child => {
|
907
|
-
interruptChildren =
|
775
|
+
interruptChildren = tsplus_module_11.flatMap_(interruptChildren, () => child.interruptAs(this.fiberId), fileName_1 + ":707:58");
|
908
776
|
});
|
909
777
|
|
910
778
|
this._children.clear();
|
911
779
|
|
912
|
-
return
|
780
|
+
return tsplus_module_11.flatMap_(interruptChildren, () => tsplus_module_11.fromExit(() => exit, fileName_1 + ":711:70"), fileName_1 + ":711:52");
|
913
781
|
}
|
914
782
|
}
|
915
783
|
}
|
916
784
|
}
|
917
785
|
|
918
786
|
unsafeSetAsyncCanceller(epoch, asyncCanceller0) {
|
919
|
-
const asyncCanceller = !asyncCanceller0 ?
|
787
|
+
const asyncCanceller = !asyncCanceller0 ? tsplus_module_11.unit : asyncCanceller0;
|
920
788
|
|
921
789
|
if (this.state._tag === "Executing") {
|
922
790
|
if (this.state.status._tag === "Suspended" && this.state.asyncCanceller._tag === "Pending" && this.state.status.epoch === epoch) {
|
923
|
-
this.state.asyncCanceller =
|
791
|
+
this.state.asyncCanceller = tsplus_module_37.registered(asyncCanceller);
|
924
792
|
} else if (this.state.status._tag === "Suspended" && this.state.asyncCanceller._tag === "Registered" && this.state.status.epoch === epoch) {
|
925
793
|
throw new Error("inconsistent state in setAsyncCanceller");
|
926
794
|
}
|
@@ -956,18 +824,18 @@ export class FiberContext {
|
|
956
824
|
if (this.state._tag === "Executing" && this.state.status._tag === "Running"
|
957
825
|
/* FiberStatusTag.Running */
|
958
826
|
&& this.state.asyncCanceller._tag === "Empty") {
|
959
|
-
const newStatus =
|
827
|
+
const newStatus = tsplus_module_36.suspended(this.state.status.interrupting, this.unsafeIsInterruptible && !this.unsafeIsInterrupting, epoch, blockingOn, trace);
|
960
828
|
this.state.status = newStatus;
|
961
|
-
this.state.asyncCanceller =
|
829
|
+
this.state.asyncCanceller = tsplus_module_37.pending;
|
962
830
|
} else {
|
963
|
-
throw new
|
831
|
+
throw new tsplus_module_29.IllegalStateError(`Fiber ${tsplus_module_3.threadName(this.fiberId)} is not running`);
|
964
832
|
}
|
965
833
|
}
|
966
834
|
|
967
835
|
unsafeExitAsync(epoch) {
|
968
836
|
if (this.state._tag === "Executing" && this.state.status._tag === "Suspended" && this.state.status.epoch === epoch) {
|
969
|
-
this.state.status =
|
970
|
-
this.state.asyncCanceller =
|
837
|
+
this.state.status = tsplus_module_36.running(this.state.status.interrupting);
|
838
|
+
this.state.asyncCanceller = tsplus_module_37.empty;
|
971
839
|
return true;
|
972
840
|
}
|
973
841
|
|
@@ -983,31 +851,22 @@ export class FiberContext {
|
|
983
851
|
}
|
984
852
|
|
985
853
|
unsafeFork(io, forkScope = tsplus_module_1.nothing(), trace) {
|
986
|
-
const childId =
|
987
|
-
const childFiberRefLocals =
|
988
|
-
|
989
|
-
const newValue = tsplus_module_35.patch(fiberRef)(tsplus_module_35.fork(fiberRef))(oldValue);
|
990
|
-
|
991
|
-
if (oldValue === newValue) {
|
992
|
-
return stack;
|
993
|
-
} else {
|
994
|
-
return tsplus_module_23.cons([childId, newValue], stack);
|
995
|
-
}
|
996
|
-
});
|
997
|
-
const parentScope = tsplus_module_31.getOrElse_(tsplus_module_31.orElse_(forkScope, () => this.unsafeGetRef(tsplus_module_30.forkScopeOverride)), () => this.scope);
|
854
|
+
const childId = tsplus_module_30.unsafeMake(tsplus_module_39.parse(trace));
|
855
|
+
const childFiberRefLocals = tsplus_module_13.forkAs(this.fiberRefs, childId).fiberRefLocals;
|
856
|
+
const parentScope = tsplus_module_33.getOrElse_(tsplus_module_33.orElse_(forkScope, () => this.unsafeGetRef(tsplus_module_10.forkScopeOverride)), () => this.scope);
|
998
857
|
const grandChildren = new Set();
|
999
|
-
const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible),
|
858
|
+
const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible), childFiberRefLocals, grandChildren);
|
1000
859
|
|
1001
|
-
if (this.currentSupervisor !==
|
1002
|
-
this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(
|
860
|
+
if (this.currentSupervisor !== tsplus_module_26.none) {
|
861
|
+
this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(tsplus_module_10.currentEnvironment), io, tsplus_module_1.just(this), childContext);
|
1003
862
|
childContext.unsafeOnDone(exit => {
|
1004
|
-
this.currentSupervisor.unsafeOnEnd(
|
863
|
+
this.currentSupervisor.unsafeOnEnd(tsplus_module_15.flatten(exit), childContext);
|
1005
864
|
});
|
1006
865
|
}
|
1007
866
|
|
1008
|
-
const childIO = !parentScope.unsafeAdd(childContext) ?
|
867
|
+
const childIO = !parentScope.unsafeAdd(childContext) ? tsplus_module_31.interruptAs(parentScope.fiberId, fileName_1 + ":832:74") : io;
|
1009
868
|
childContext.nextIO = childIO;
|
1010
|
-
this.unsafeGetRef(
|
869
|
+
this.unsafeGetRef(tsplus_module_10.currentScheduler).scheduleTask(() => childContext.runUntil(this.runtimeConfig.yieldOpCount));
|
1011
870
|
return childContext;
|
1012
871
|
}
|
1013
872
|
|
@@ -1017,7 +876,7 @@ export class FiberContext {
|
|
1017
876
|
if (exit == null) {
|
1018
877
|
return;
|
1019
878
|
} else {
|
1020
|
-
k(
|
879
|
+
k(tsplus_module_28.succeed(exit));
|
1021
880
|
}
|
1022
881
|
}
|
1023
882
|
|
@@ -1026,26 +885,26 @@ export class FiberContext {
|
|
1026
885
|
case "Executing":
|
1027
886
|
{
|
1028
887
|
const suppressed = this.state.suppressed;
|
1029
|
-
this.state.suppressed =
|
888
|
+
this.state.suppressed = tsplus_module_27.empty();
|
1030
889
|
return suppressed;
|
1031
890
|
}
|
1032
891
|
|
1033
892
|
case "Done":
|
1034
893
|
{
|
1035
|
-
return
|
894
|
+
return tsplus_module_27.empty();
|
1036
895
|
}
|
1037
896
|
}
|
1038
897
|
}
|
1039
898
|
|
1040
899
|
unsafeGetDescriptor() {
|
1041
|
-
return new
|
900
|
+
return new tsplus_module_40.FiberDescriptor(this.fiberId, this.state.status, this.state.interruptors, tsplus_module_41.fromBoolean(this.unsafeIsInterruptible), this.scope);
|
1042
901
|
}
|
1043
902
|
|
1044
903
|
unsafeRace(race) {
|
1045
904
|
const raceIndicator = new AtomicReference(true);
|
1046
905
|
const left = this.unsafeFork(race.left, tsplus_module_1.nothing(), race.trace);
|
1047
906
|
const right = this.unsafeFork(race.right, tsplus_module_1.nothing(), race.trace);
|
1048
|
-
return
|
907
|
+
return tsplus_module_11.async(cb => {
|
1049
908
|
const leftRegister = left.unsafeAddObserver(() => {
|
1050
909
|
this.unsafeCompleteRace(left, right, race.leftWins, raceIndicator, cb);
|
1051
910
|
});
|
@@ -1061,7 +920,7 @@ export class FiberContext {
|
|
1061
920
|
this.unsafeCompleteRace(right, left, race.rightWins, raceIndicator, cb);
|
1062
921
|
}
|
1063
922
|
}
|
1064
|
-
}, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":
|
923
|
+
}, tsplus_module_3.combine_(left.fiberId, right.fiberId), fileName_1 + ":881:20");
|
1065
924
|
}
|
1066
925
|
|
1067
926
|
unsafeCompleteRace(winner, loser, cont, ab, cb) {
|
@@ -1072,23 +931,23 @@ export class FiberContext {
|
|
1072
931
|
|
1073
932
|
unsafeCaptureTrace(prefix) {
|
1074
933
|
const builder = new StackTraceBuilder();
|
1075
|
-
|
934
|
+
tsplus_module_42.forEach_(prefix, element => builder.append(tsplus_module_39.parse(element)));
|
1076
935
|
const stack = this.stack.clone();
|
1077
936
|
|
1078
937
|
while (stack.hasNext) {
|
1079
|
-
builder.append(
|
938
|
+
builder.append(tsplus_module_39.parse(stack.pop().trace));
|
1080
939
|
}
|
1081
940
|
|
1082
|
-
return new
|
941
|
+
return new tsplus_module_43.Trace(this.fiberId, builder.result());
|
1083
942
|
}
|
1084
943
|
|
1085
944
|
unsafeEvalOn(effect, orElse) {
|
1086
945
|
if (this.state._tag === "Executing") {
|
1087
|
-
const newMailbox = this.state.mailbox == null ? effect :
|
946
|
+
const newMailbox = this.state.mailbox == null ? effect : tsplus_module_11.flatMap_(this.state.mailbox, () => effect, fileName_1 + ":925:92");
|
1088
947
|
this.state.mailbox = newMailbox;
|
1089
|
-
return
|
948
|
+
return tsplus_module_11.unit;
|
1090
949
|
} else {
|
1091
|
-
return
|
950
|
+
return tsplus_module_11.asUnit(orElse, fileName_1 + ":929:20");
|
1092
951
|
}
|
1093
952
|
}
|
1094
953
|
|
@@ -1103,39 +962,51 @@ export class FiberContext {
|
|
1103
962
|
}
|
1104
963
|
|
1105
964
|
unsafeAddChild(child) {
|
1106
|
-
this.unsafeEvalOn(
|
965
|
+
this.unsafeEvalOn(tsplus_module_11.succeed(() => {
|
1107
966
|
this._children.add(child);
|
1108
|
-
}, fileName_1 + ":
|
967
|
+
}, fileName_1 + ":945:17"), tsplus_module_11.unit);
|
1109
968
|
}
|
1110
969
|
|
1111
970
|
unsafeLog(message, trace) {
|
1112
|
-
const logLevel = this.unsafeGetRef(
|
1113
|
-
const spans = this.unsafeGetRef(
|
1114
|
-
const annotations = this.unsafeGetRef(
|
1115
|
-
this.runtimeConfig.logger.log(
|
971
|
+
const logLevel = this.unsafeGetRef(tsplus_module_10.currentLogLevel);
|
972
|
+
const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
|
973
|
+
const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
|
974
|
+
this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, tsplus_module_27.empty(), this.fiberRefLocals, spans, annotations);
|
1116
975
|
}
|
1117
976
|
|
1118
977
|
unsafeLogWith(message, cause, overrideLogLevel, overrideRef1 = null, overrideValue1 = null, trace) {
|
1119
|
-
const logLevel =
|
1120
|
-
const spans = this.unsafeGetRef(
|
1121
|
-
const annotations = this.unsafeGetRef(
|
978
|
+
const logLevel = tsplus_module_33.getOrElse_(overrideLogLevel, () => this.unsafeGetRef(tsplus_module_10.currentLogLevel));
|
979
|
+
const spans = this.unsafeGetRef(tsplus_module_10.currentLogSpan);
|
980
|
+
const annotations = this.unsafeGetRef(tsplus_module_10.currentLogAnnotations);
|
1122
981
|
let contextMap;
|
1123
982
|
|
1124
983
|
if (overrideRef1 !== null) {
|
1125
984
|
const map = this.unsafeGetRefs(this.fiberRefLocals);
|
1126
985
|
|
1127
986
|
if (overrideValue1 === null) {
|
1128
|
-
|
987
|
+
tsplus_module_12.remove_(map, overrideRef1);
|
1129
988
|
} else {
|
1130
|
-
|
989
|
+
tsplus_module_12.set_(map, overrideRef1, overrideValue1);
|
1131
990
|
}
|
1132
991
|
|
1133
992
|
contextMap = map;
|
1134
993
|
} else {
|
1135
|
-
contextMap = this.fiberRefLocals
|
994
|
+
contextMap = this.fiberRefLocals;
|
1136
995
|
}
|
1137
996
|
|
1138
|
-
this.runtimeConfig.logger.log(
|
997
|
+
this.runtimeConfig.logger.log(tsplus_module_39.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
|
998
|
+
}
|
999
|
+
|
1000
|
+
unsafeIsFatal(t) {
|
1001
|
+
return this.unsafeGetRef(tsplus_module_10.currentIsFatal).apply(t);
|
1002
|
+
}
|
1003
|
+
|
1004
|
+
unsafeHandleFatalError(t) {
|
1005
|
+
return this.unsafeGetRef(tsplus_module_10.currentReportFatal)(t);
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
get currentSupervisor() {
|
1009
|
+
return this.unsafeGetRef(tsplus_module_10.currentSupervisor);
|
1139
1010
|
}
|
1140
1011
|
|
1141
1012
|
}
|