@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.
Files changed (219) hide show
  1. package/Cached/internal.d.ts +1 -1
  2. package/CancellerState.d.ts +1 -1
  3. package/Channel/ChildExecutorDecision/definition.d.ts +1 -1
  4. package/Channel/UpstreamPullRequest/definition.d.ts +1 -1
  5. package/Channel/UpstreamPullStrategy/definition.d.ts +1 -1
  6. package/Channel/api/mergeAllWith.d.ts +1 -1
  7. package/Channel/internal/ChannelExecutor.d.ts +1 -1
  8. package/Channel/internal/ChannelState.d.ts +2 -2
  9. package/Channel/internal/MergeDecision.d.ts +1 -1
  10. package/Channel/internal/MergeState.d.ts +1 -1
  11. package/Channel/internal/SingleProducerAsyncInput.d.ts +1 -1
  12. package/Clock/definition.d.ts +1 -0
  13. package/Fiber/FiberContext.d.ts +22 -19
  14. package/Fiber/api/interruptAll.d.ts +1 -1
  15. package/Fiber/api/interruptAsFork.d.ts +8 -0
  16. package/Fiber/definition.d.ts +6 -8
  17. package/FiberRef/api.d.ts +7 -2
  18. package/FiberRef/definition.d.ts +4 -3
  19. package/FiberRef/unsafe.d.ts +18 -1
  20. package/FiberRefs/api.d.ts +5 -0
  21. package/FiberRefs/definition.d.ts +1 -1
  22. package/FiberState/definition.d.ts +2 -2
  23. package/FiberStatus/definition.d.ts +1 -1
  24. package/Future/definition.d.ts +1 -1
  25. package/Hub/definition.d.ts +1 -1
  26. package/IO/api/core-scope.d.ts +4 -3
  27. package/IO/api/interrupt.d.ts +2 -2
  28. package/IO/api/supervised.d.ts +10 -0
  29. package/IO/api.d.ts +7 -10
  30. package/IO/definition.d.ts +16 -139
  31. package/IO.d.ts +1 -0
  32. package/IOEnv/definition.d.ts +1 -1
  33. package/Layer/definition.d.ts +2 -2
  34. package/Ref/definition.d.ts +3 -3
  35. package/Reloadable/api.d.ts +21 -0
  36. package/Reloadable/constructors.d.ts +23 -0
  37. package/Reloadable/definition.d.ts +20 -0
  38. package/Reloadable.d.ts +3 -0
  39. package/RuntimeConfig.d.ts +1 -1
  40. package/STM/definition.d.ts +5 -5
  41. package/STM/internal/CommitState.d.ts +1 -1
  42. package/STM/internal/Entry.d.ts +2 -2
  43. package/STM/internal/Journal.d.ts +6 -6
  44. package/STM/internal/TryCommit.d.ts +2 -2
  45. package/STM/internal/Versioned.d.ts +1 -1
  46. package/Schedule/Decision.d.ts +1 -1
  47. package/Scope/ReleaseMap/definition.d.ts +1 -1
  48. package/Scope/definition.d.ts +2 -2
  49. package/ScopedRef/definition.d.ts +1 -1
  50. package/State/internal.d.ts +1 -1
  51. package/Stream/api.d.ts +1 -1
  52. package/Stream/definition.d.ts +1 -1
  53. package/Stream/internal/DebounceState.d.ts +4 -4
  54. package/Stream/internal/Handoff.d.ts +5 -5
  55. package/Stream/internal/Pull.d.ts +1 -1
  56. package/Stream/internal/SinkEndReason.d.ts +1 -1
  57. package/TExit/definition.d.ts +3 -3
  58. package/TReentrantLock/definition.d.ts +1 -1
  59. package/TRef/definition.d.ts +1 -1
  60. package/TxnId.d.ts +1 -1
  61. package/_cjs/Clock/definition.cjs +2 -1
  62. package/_cjs/Clock/definition.cjs.map +1 -1
  63. package/_cjs/Console/definition.cjs +1 -1
  64. package/_cjs/Console/definition.cjs.map +1 -1
  65. package/_cjs/Fiber/FiberContext.cjs +180 -310
  66. package/_cjs/Fiber/FiberContext.cjs.map +1 -1
  67. package/_cjs/Fiber/api/collectAll.cjs +2 -2
  68. package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
  69. package/_cjs/Fiber/api/interrupt.cjs +4 -2
  70. package/_cjs/Fiber/api/interrupt.cjs.map +1 -1
  71. package/_cjs/Fiber/api/interruptAll.cjs +8 -8
  72. package/_cjs/Fiber/api/interruptAll.cjs.map +1 -1
  73. package/_cjs/Fiber/api/interruptAs.cjs +7 -1
  74. package/_cjs/Fiber/api/interruptAs.cjs.map +1 -1
  75. package/_cjs/Fiber/api/interruptAsFork.cjs +15 -0
  76. package/_cjs/Fiber/api/interruptAsFork.cjs.map +1 -0
  77. package/_cjs/Fiber/api/interruptFork.cjs +5 -5
  78. package/_cjs/Fiber/api/interruptFork.cjs.map +1 -1
  79. package/_cjs/Fiber/definition.cjs +2 -2
  80. package/_cjs/Fiber/definition.cjs.map +1 -1
  81. package/_cjs/FiberRef/api.cjs +29 -10
  82. package/_cjs/FiberRef/api.cjs.map +1 -1
  83. package/_cjs/FiberRef/definition.cjs +2 -1
  84. package/_cjs/FiberRef/definition.cjs.map +1 -1
  85. package/_cjs/FiberRef/unsafe.cjs +29 -5
  86. package/_cjs/FiberRef/unsafe.cjs.map +1 -1
  87. package/_cjs/FiberRefs/api.cjs +28 -2
  88. package/_cjs/FiberRefs/api.cjs.map +1 -1
  89. package/_cjs/FiberRefs/join.cjs +1 -1
  90. package/_cjs/FiberRefs/join.cjs.map +1 -1
  91. package/_cjs/IO/api/core-scope.cjs +23 -15
  92. package/_cjs/IO/api/core-scope.cjs.map +1 -1
  93. package/_cjs/IO/api/ensuringChildren.cjs +4 -2
  94. package/_cjs/IO/api/ensuringChildren.cjs.map +1 -1
  95. package/_cjs/IO/api/interrupt.cjs +21 -11
  96. package/_cjs/IO/api/interrupt.cjs.map +1 -1
  97. package/_cjs/IO/api/supervised.cjs +26 -0
  98. package/_cjs/IO/api/supervised.cjs.map +1 -0
  99. package/_cjs/IO/api/withChildren.cjs +4 -2
  100. package/_cjs/IO/api/withChildren.cjs.map +1 -1
  101. package/_cjs/IO/api/zipC.cjs +10 -8
  102. package/_cjs/IO/api/zipC.cjs.map +1 -1
  103. package/_cjs/IO/api.cjs +67 -63
  104. package/_cjs/IO/api.cjs.map +1 -1
  105. package/_cjs/IO/definition.cjs +8 -226
  106. package/_cjs/IO/definition.cjs.map +1 -1
  107. package/_cjs/IO/runtime.cjs +7 -9
  108. package/_cjs/IO/runtime.cjs.map +1 -1
  109. package/_cjs/IO.cjs +13 -0
  110. package/_cjs/IO.cjs.map +1 -1
  111. package/_cjs/Layer/api.cjs +1 -1
  112. package/_cjs/Layer/api.cjs.map +1 -1
  113. package/_cjs/Random/definition.cjs +1 -1
  114. package/_cjs/Random/definition.cjs.map +1 -1
  115. package/_cjs/Reloadable/api.cjs +46 -0
  116. package/_cjs/Reloadable/api.cjs.map +1 -0
  117. package/_cjs/Reloadable/constructors.cjs +82 -0
  118. package/_cjs/Reloadable/constructors.cjs.map +1 -0
  119. package/_cjs/Reloadable/definition.cjs +58 -0
  120. package/_cjs/Reloadable/definition.cjs.map +1 -0
  121. package/_cjs/Reloadable.cjs +45 -0
  122. package/_cjs/Reloadable.cjs.map +1 -0
  123. package/_cjs/Scope/definition.cjs +1 -1
  124. package/_cjs/Scope/definition.cjs.map +1 -1
  125. package/_cjs/internal/IsFatal.cjs +129 -0
  126. package/_cjs/internal/IsFatal.cjs.map +1 -0
  127. package/_mjs/Clock/definition.mjs +2 -1
  128. package/_mjs/Clock/definition.mjs.map +1 -1
  129. package/_mjs/Console/definition.mjs +1 -1
  130. package/_mjs/Console/definition.mjs.map +1 -1
  131. package/_mjs/Fiber/FiberContext.mjs +180 -309
  132. package/_mjs/Fiber/FiberContext.mjs.map +1 -1
  133. package/_mjs/Fiber/api/collectAll.mjs +2 -2
  134. package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
  135. package/_mjs/Fiber/api/interrupt.mjs +3 -2
  136. package/_mjs/Fiber/api/interrupt.mjs.map +1 -1
  137. package/_mjs/Fiber/api/interruptAll.mjs +6 -6
  138. package/_mjs/Fiber/api/interruptAll.mjs.map +1 -1
  139. package/_mjs/Fiber/api/interruptAs.mjs +3 -1
  140. package/_mjs/Fiber/api/interruptAs.mjs.map +1 -1
  141. package/_mjs/Fiber/api/interruptAsFork.mjs +8 -0
  142. package/_mjs/Fiber/api/interruptAsFork.mjs.map +1 -0
  143. package/_mjs/Fiber/api/interruptFork.mjs +5 -4
  144. package/_mjs/Fiber/api/interruptFork.mjs.map +1 -1
  145. package/_mjs/Fiber/definition.mjs +2 -2
  146. package/_mjs/Fiber/definition.mjs.map +1 -1
  147. package/_mjs/FiberRef/api.mjs +26 -9
  148. package/_mjs/FiberRef/api.mjs.map +1 -1
  149. package/_mjs/FiberRef/definition.mjs +2 -1
  150. package/_mjs/FiberRef/definition.mjs.map +1 -1
  151. package/_mjs/FiberRef/unsafe.mjs +23 -4
  152. package/_mjs/FiberRef/unsafe.mjs.map +1 -1
  153. package/_mjs/FiberRefs/api.mjs +22 -1
  154. package/_mjs/FiberRefs/api.mjs.map +1 -1
  155. package/_mjs/FiberRefs/join.mjs +1 -1
  156. package/_mjs/FiberRefs/join.mjs.map +1 -1
  157. package/_mjs/IO/api/core-scope.mjs +21 -16
  158. package/_mjs/IO/api/core-scope.mjs.map +1 -1
  159. package/_mjs/IO/api/ensuringChildren.mjs +3 -2
  160. package/_mjs/IO/api/ensuringChildren.mjs.map +1 -1
  161. package/_mjs/IO/api/interrupt.mjs +18 -9
  162. package/_mjs/IO/api/interrupt.mjs.map +1 -1
  163. package/_mjs/IO/api/supervised.mjs +14 -0
  164. package/_mjs/IO/api/supervised.mjs.map +1 -0
  165. package/_mjs/IO/api/withChildren.mjs +3 -2
  166. package/_mjs/IO/api/withChildren.mjs.map +1 -1
  167. package/_mjs/IO/api/zipC.mjs +9 -8
  168. package/_mjs/IO/api/zipC.mjs.map +1 -1
  169. package/_mjs/IO/api.mjs +66 -60
  170. package/_mjs/IO/api.mjs.map +1 -1
  171. package/_mjs/IO/definition.mjs +5 -184
  172. package/_mjs/IO/definition.mjs.map +1 -1
  173. package/_mjs/IO/runtime.mjs +7 -8
  174. package/_mjs/IO/runtime.mjs.map +1 -1
  175. package/_mjs/IO.mjs +1 -0
  176. package/_mjs/IO.mjs.map +1 -1
  177. package/_mjs/Layer/api.mjs +1 -1
  178. package/_mjs/Layer/api.mjs.map +1 -1
  179. package/_mjs/Random/definition.mjs +1 -1
  180. package/_mjs/Random/definition.mjs.map +1 -1
  181. package/_mjs/Reloadable/api.mjs +30 -0
  182. package/_mjs/Reloadable/api.mjs.map +1 -0
  183. package/_mjs/Reloadable/constructors.mjs +55 -0
  184. package/_mjs/Reloadable/constructors.mjs.map +1 -0
  185. package/_mjs/Reloadable/definition.mjs +40 -0
  186. package/_mjs/Reloadable/definition.mjs.map +1 -0
  187. package/_mjs/Reloadable.mjs +5 -0
  188. package/_mjs/Reloadable.mjs.map +1 -0
  189. package/_mjs/Scope/definition.mjs +1 -1
  190. package/_mjs/Scope/definition.mjs.map +1 -1
  191. package/_mjs/internal/IsFatal.mjs +104 -0
  192. package/_mjs/internal/IsFatal.mjs.map +1 -0
  193. package/_src/Clock/definition.ts +1 -0
  194. package/_src/Fiber/FiberContext.ts +50 -135
  195. package/_src/Fiber/api/collectAll.ts +1 -4
  196. package/_src/Fiber/api/interruptAll.ts +2 -2
  197. package/_src/Fiber/api/interruptAs.ts +1 -1
  198. package/_src/Fiber/api/interruptAsFork.ts +7 -0
  199. package/_src/Fiber/api/interruptFork.ts +1 -1
  200. package/_src/Fiber/definition.ts +3 -5
  201. package/_src/FiberRef/api.ts +30 -7
  202. package/_src/FiberRef/definition.ts +1 -0
  203. package/_src/FiberRef/unsafe.ts +27 -3
  204. package/_src/FiberRefs/api.ts +16 -0
  205. package/_src/FiberRefs/join.ts +1 -1
  206. package/_src/IO/api/core-scope.ts +12 -10
  207. package/_src/IO/api/interrupt.ts +8 -3
  208. package/_src/IO/api/supervised.ts +14 -0
  209. package/_src/IO/api.ts +25 -26
  210. package/_src/IO/definition.ts +8 -158
  211. package/_src/IO/runtime.ts +7 -11
  212. package/_src/IO.ts +1 -0
  213. package/_src/Reloadable/api.ts +28 -0
  214. package/_src/Reloadable/constructors.ts +60 -0
  215. package/_src/Reloadable/definition.ts +34 -0
  216. package/_src/Reloadable.ts +5 -0
  217. package/_src/internal/IsFatal.ts +79 -0
  218. package/internal/IsFatal.d.ts +47 -0
  219. 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/IO/api";
12
- import * as tsplus_module_11 from "@fncts/base/collection/immutable/HashMap/api";
13
- import * as tsplus_module_12 from "@fncts/io/FiberRefs/api";
14
- import * as tsplus_module_13 from "@fncts/io/FiberRefs/join";
15
- import * as tsplus_module_14 from "@fncts/base/data/Exit/api";
16
- import * as tsplus_module_15 from "@fncts/base/collection/immutable/Conc";
17
- import * as tsplus_module_16 from "@fncts/base/collection/immutable/Conc/api/empty";
18
- import * as tsplus_module_17 from "@fncts/io/Future/api";
19
- import * as tsplus_module_18 from "@fncts/io/IO/api/environment";
20
- import * as tsplus_module_19 from "@fncts/io/IO/api/fulfill";
21
- import * as tsplus_module_20 from "@fncts/io/Future/constructors";
22
- import * as tsplus_module_21 from "@fncts/base/data/Either/constructors";
23
- import * as tsplus_module_22 from "@fncts/io/FiberScope/constructors";
24
- import * as tsplus_module_23 from "@fncts/base/collection/immutable/List/constructors";
25
- import * as tsplus_module_24 from "@fncts/io/RuntimeConfig";
26
- import * as tsplus_module_25 from "@fncts/io/Supervisor/constructors";
27
- import * as tsplus_module_26 from "@fncts/base/data/Cause/api";
28
- import * as tsplus_module_27 from "@fncts/base/data/Exit/constructors";
29
- import * as tsplus_module_28 from "@fncts/io/InterruptStatus/constructors";
30
- import * as tsplus_module_29 from "@fncts/io/Supervisor/api";
31
- import * as tsplus_module_30 from "@fncts/io/FiberRef/unsafe";
32
- import * as tsplus_module_31 from "@fncts/base/data/Maybe/api";
33
- import * as tsplus_module_32 from "@fncts/base/data/exceptions";
34
- import * as tsplus_module_33 from "@fncts/base/data/FiberId/constructors";
35
- import * as tsplus_module_34 from "@fncts/io/IO/api/interrupt";
36
- import * as tsplus_module_35 from "@fncts/io/FiberRef/api";
37
- import * as tsplus_module_36 from "@fncts/base/collection/immutable/List/definition";
38
- import * as tsplus_module_37 from "@fncts/base/data/Cause/api/isEmpty";
39
- import * as tsplus_module_38 from "@fncts/io/FiberStatus/constructors";
40
- import * as tsplus_module_39 from "@fncts/io/CancellerState";
41
- import * as tsplus_module_40 from "@fncts/io/FiberState/api";
42
- import * as tsplus_module_41 from "@fncts/base/data/TraceElement/definition";
43
- import * as tsplus_module_42 from "@fncts/io/FiberDescriptor";
44
- import * as tsplus_module_43 from "@fncts/base/collection/immutable/List/api";
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 tsplus_module_10.succeedNow(v, fileName_1 + ":586:27");
109
+ return tsplus_module_11.succeedNow(v, fileName_1 + ":498:27");
111
110
  } else {
112
- return tsplus_module_10.succeed(() => {
111
+ return tsplus_module_11.succeed(() => {
113
112
  this.interruptStatus.pop();
114
113
  return v;
115
- }, fileName_1 + ":588:24");
114
+ }, fileName_1 + ":500:24");
116
115
  }
117
116
  });
118
- this.currentSupervisor = this.runtimeConfig.supervisor;
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 + ":69:44"));
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 tsplus_module_10.succeed(() => this.unsafePoll(), fileName_1 + ":89:22");
129
+ return tsplus_module_11.succeed(() => this.unsafePoll(), fileName_1 + ":87:22");
131
130
  }
132
131
 
133
132
  get inheritRefs() {
134
- return tsplus_module_10.defer(() => {
135
- const childFiberRefLocals = this.fiberRefLocals.get;
133
+ return tsplus_module_11.defer(() => {
134
+ const childFiberRefLocals = this.fiberRefLocals;
136
135
 
137
- if (tsplus_module_11.isEmpty(childFiberRefLocals)) {
138
- return tsplus_module_10.unit;
136
+ if (tsplus_module_12.isEmpty(childFiberRefLocals)) {
137
+ return tsplus_module_11.unit;
139
138
  } else {
140
- return tsplus_module_10.updateFiberRefs((parentFiberId, parentFiberRefs) => tsplus_module_13.join(parentFiberRefs, parentFiberId, tsplus_module_12.make(childFiberRefLocals)), fileName_1 + ":98:34");
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 + ":93:20");
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(tsplus_module_14.flatten(exit)));
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(tsplus_module_10.succeed(() => {
159
- const concBuilder = new tsplus_module_15.ConcBuilder(tsplus_module_16.empty());
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 + ":119:17"), tsplus_module_10.succeed(() => tsplus_module_16.empty(), fileName_1 + ":128:17"), fileName_1 + ":118:25");
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 tsplus_module_10.flatMap_(tsplus_module_18.environment(fileName_1 + ":138:33"), r => tsplus_module_10.flatMap_(tsplus_module_20.make(fileName_1 + ":139:30"), p => tsplus_module_10.flatMap_(this.evalOn(tsplus_module_19.fulfill_(tsplus_module_18.provideEnvironment_(effect, r, fileName_1 + ":140:46"), p, fileName_1 + ":140:57"), tsplus_module_19.fulfill_(tsplus_module_18.provideEnvironment_(orElse, r, fileName_1 + ":140:87"), p, fileName_1 + ":140:98")), () => tsplus_module_17.wait(p, fileName_1 + ":141:17"), fileName_1 + ":140:8"), fileName_1 + ":139:18"), fileName_1 + ":138:18");
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 tsplus_module_10.asyncInterrupt(k => {
175
- const cb = x => k(tsplus_module_10.fromExit(() => x, fileName_1 + ":147:78"));
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 tsplus_module_21.left(tsplus_module_10.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":150:38"));
183
+ return tsplus_module_22.left(tsplus_module_11.succeed(() => this.unsafeRemoveObserver(cb), fileName_1 + ":152:38"));
181
184
  } else {
182
- return tsplus_module_21.right(tsplus_module_10.succeedNow(result, fileName_1 + ":152:42"));
185
+ return tsplus_module_22.right(tsplus_module_11.succeedNow(result, fileName_1 + ":154:42"));
183
186
  }
184
- }, this.fiberId, fileName_1 + ":146:29");
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 tsplus_module_22.unsafeMake(this);
195
+ return tsplus_module_23.unsafeMake(this);
193
196
  }
194
197
 
195
198
  get status() {
196
- return tsplus_module_10.succeedNow(this.state.status, fileName_1 + ":166:25");
199
+ return tsplus_module_11.succeedNow(this.state.status, fileName_1 + ":168:25");
197
200
  }
198
201
 
199
202
  get trace() {
200
- return tsplus_module_10.succeed(() => this.unsafeCaptureTrace(tsplus_module_23.empty()), fileName_1 + ":170:22");
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.unsafeInterruptAs(fiberId);
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 tsplus_module_10.defer(() => this.unsafeEvalOn(effect, orElse), fileName_1 + ":178:20");
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(tsplus_module_24.RuntimeConfigFlag.SuperviseOperations) && this.currentSupervisor !== tsplus_module_25.none;
228
- this.runtimeConfig.flags.isEnabled(tsplus_module_24.RuntimeConfigFlag.EnableCurrentFiber) && currentFiber.set(this);
229
- this.currentSupervisor !== tsplus_module_25.none && this.currentSupervisor.unsafeOnResume(this);
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 = tsplus_module_10.flatMap_(message, () => oldIO, fileName_1 + ":215:55");
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(tsplus_module_10.unit);
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(tsplus_module_23.cons(current.trace, tsplus_module_23.nil())));
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 ? tsplus_module_23.nil() : tsplus_module_23.cons(extraTrace, tsplus_module_23.nil());
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 = tsplus_module_26.isTraced(cause) ? cause : tsplus_module_26.traced(cause, this.unsafeCaptureTrace(tsplus_module_23.cons(current.trace, fastPathTrace)));
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
- tsplus_module_26.stripFailures( // We threw away some error handlers while unwinding the stack because
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 = tsplus_module_26.contains_(strippedCause, suppressed) ? strippedCause : tsplus_module_26.then(strippedCause, suppressed);
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(tsplus_module_27.failCause(fullCause), current.trace);
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 = tsplus_module_10.flatMap_(r.left, () => tsplus_module_10.failCauseNow(this.unsafeClearSuppressedCause(), fileName_1 + ":349:67"), fileName_1 + ":349:45");
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(tsplus_module_10.unit);
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 "FiberRefModifyAll"
491
- /* IOTag.FiberRefModifyAll */
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
- 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 */
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 = tsplus_module_10.failCauseNow(this.unsafeClearSuppressedCause(), trace);
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 (tsplus_module_32.isInterruptedException(e)) {
503
+ if (tsplus_module_29.isInterruptedException(e)) {
636
504
  const trace = current ? current.trace : undefined;
637
- current = tsplus_module_34.interruptAs(tsplus_module_33.none, trace);
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 = tsplus_module_10.failCauseNow(e.exit.cause, trace);
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 = tsplus_module_10.haltNow(e, fileName_1 + ":525:42");
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 !== tsplus_module_25.none && this.currentSupervisor.unsafeOnSuspend(this);
531
+ this.currentSupervisor.unsafeOnSuspend(this);
662
532
  }
663
533
  }
664
534
 
665
535
  unsafeRunLater(i0) {
666
- this.unsafeGetRef(tsplus_module_30.currentScheduler).scheduleTask(() => {
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 tsplus_module_31.getOrElse_(tsplus_module_31.map_(tsplus_module_11.get_(this.fiberRefLocals.get, ref), _ => _.head[1]), () => tsplus_module_35.initial(ref));
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 tsplus_module_11.map_(fiberRefLocals.get, stack => stack.head[1]);
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.get;
682
- const oldStack = tsplus_module_31.getOrElse_(tsplus_module_11.get_(oldState, ref), () => tsplus_module_23.empty());
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 (tsplus_module_36.isEmpty(oldStack)) {
686
- newStack = tsplus_module_23.cons([this.fiberId, value]);
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 = tsplus_module_23.cons([this.fiberId, value], oldStack.tail);
558
+ newStack = tsplus_module_24.cons([this.fiberId, value], oldStack.tail);
689
559
  } else {
690
- newStack = tsplus_module_23.cons([this.fiberId, value], oldStack);
560
+ newStack = tsplus_module_24.cons([this.fiberId, value], oldStack);
691
561
  }
692
562
 
693
- const newState = tsplus_module_11.set_(oldState, ref, newStack);
694
- this.fiberRefLocals.set(newState);
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.set(tsplus_module_11.remove_(this.fiberRefLocals.get, ref));
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 tsplus_module_10.map_(finalizer, () => v, fileName_1 + ":600:29");
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 (!tsplus_module_37.isEmpty(cause)) {
618
+ if (!tsplus_module_35.isEmpty(cause)) {
749
619
  if (this.state._tag === "Executing") {
750
- this.state.suppressed = tsplus_module_26.then(this.state.suppressed, cause);
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 => tsplus_module_10.matchCauseIO_(frame.finalizer, finalizerCause => {
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 tsplus_module_10.failCauseNow(cause, fileName_1 + ":664:43");
651
+ return tsplus_module_11.failCauseNow(cause, fileName_1 + ":576:43");
782
652
  }, () => {
783
653
  this.interruptStatus.pop();
784
- return tsplus_module_10.failCauseNow(cause, fileName_1 + ":668:43");
785
- }, fileName_1 + ":660:45"), frame.trace));
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(tsplus_module_27.succeed(value));
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 = tsplus_module_27.succeed(v);
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
- unsafeInterruptAs(fiberId) {
848
- const interruptedCause = tsplus_module_26.interrupt(fiberId);
849
- return tsplus_module_10.defer(() => {
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 = tsplus_module_10.failCauseNow(interruptedCause, fileName_1 + ":738:52");
855
- this.state.status = tsplus_module_38.running(true);
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 = tsplus_module_39.empty;
858
- this.unsafeRunLater(tsplus_module_10.flatMap_(asyncCanceller, () => interrupt, fileName_1 + ":742:60"));
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 = tsplus_module_26.then(this.state.suppressed, interruptedCause);
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 tsplus_module_10.flatMap_(mailbox, () => tsplus_module_10.fromExit(() => exit, fileName_1 + ":764:60"), fileName_1 + ":764:42");
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 = tsplus_module_40.interruptorsCause(this.state);
889
- const newExit = tsplus_module_37.isEmpty(interruptorsCause) ? exit : tsplus_module_14.mapErrorCause_(exit, cause => {
890
- if (tsplus_module_26.contains_(cause, interruptorsCause)) {
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 tsplus_module_26.then(cause, interruptorsCause);
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 = tsplus_module_10.unit;
772
+ let interruptChildren = tsplus_module_11.unit;
905
773
 
906
774
  this._children.forEach(child => {
907
- interruptChildren = tsplus_module_10.flatMap_(interruptChildren, () => child.interruptAs(this.fiberId), fileName_1 + ":796:58");
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 tsplus_module_10.flatMap_(interruptChildren, () => tsplus_module_10.fromExit(() => exit, fileName_1 + ":800:70"), fileName_1 + ":800:52");
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 ? tsplus_module_10.unit : 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 = tsplus_module_39.registered(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 = tsplus_module_38.suspended(this.state.status.interrupting, this.unsafeIsInterruptible && !this.unsafeIsInterrupting, epoch, blockingOn, trace);
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 = tsplus_module_39.pending;
829
+ this.state.asyncCanceller = tsplus_module_37.pending;
962
830
  } else {
963
- throw new tsplus_module_32.IllegalStateError(`Fiber ${tsplus_module_3.threadName(this.fiberId)} is not running`);
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 = tsplus_module_38.running(this.state.status.interrupting);
970
- this.state.asyncCanceller = tsplus_module_39.empty;
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 = tsplus_module_33.unsafeMake(tsplus_module_41.parse(trace));
987
- const childFiberRefLocals = tsplus_module_11.mapWithIndex_(this.fiberRefLocals.get, (fiberRef, stack) => {
988
- const oldValue = stack.head[1];
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), new AtomicReference(childFiberRefLocals), grandChildren);
858
+ const childContext = new FiberContext(childId, this.runtimeConfig, tsplus_module_9.single(this.unsafeIsInterruptible), childFiberRefLocals, grandChildren);
1000
859
 
1001
- if (this.currentSupervisor !== tsplus_module_25.none) {
1002
- this.currentSupervisor.unsafeOnStart(this.unsafeGetRef(tsplus_module_30.currentEnvironment), io, tsplus_module_1.just(this), childContext);
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(tsplus_module_14.flatten(exit), childContext);
863
+ this.currentSupervisor.unsafeOnEnd(tsplus_module_15.flatten(exit), childContext);
1005
864
  });
1006
865
  }
1007
866
 
1008
- const childIO = !parentScope.unsafeAdd(childContext) ? tsplus_module_34.interruptAs(parentScope.fiberId, fileName_1 + ":929:74") : io;
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(tsplus_module_30.currentScheduler).scheduleTask(() => childContext.runUntil(this.runtimeConfig.yieldOpCount));
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(tsplus_module_27.succeed(exit));
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 = tsplus_module_26.empty();
888
+ this.state.suppressed = tsplus_module_27.empty();
1030
889
  return suppressed;
1031
890
  }
1032
891
 
1033
892
  case "Done":
1034
893
  {
1035
- return tsplus_module_26.empty();
894
+ return tsplus_module_27.empty();
1036
895
  }
1037
896
  }
1038
897
  }
1039
898
 
1040
899
  unsafeGetDescriptor() {
1041
- return new tsplus_module_42.FiberDescriptor(this.fiberId, this.state.status, this.state.interruptors, tsplus_module_28.fromBoolean(this.unsafeIsInterruptible), this.scope);
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 tsplus_module_10.async(cb => {
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 + ":978:20");
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
- tsplus_module_43.forEach_(prefix, element => builder.append(tsplus_module_41.parse(element)));
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(tsplus_module_41.parse(stack.pop().trace));
938
+ builder.append(tsplus_module_39.parse(stack.pop().trace));
1080
939
  }
1081
940
 
1082
- return new tsplus_module_44.Trace(this.fiberId, builder.result());
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 : tsplus_module_10.flatMap_(this.state.mailbox, () => effect, fileName_1 + ":1022:92");
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 tsplus_module_10.unit;
948
+ return tsplus_module_11.unit;
1090
949
  } else {
1091
- return tsplus_module_10.asUnit(orElse, fileName_1 + ":1026:20");
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(tsplus_module_10.succeed(() => {
965
+ this.unsafeEvalOn(tsplus_module_11.succeed(() => {
1107
966
  this._children.add(child);
1108
- }, fileName_1 + ":1042:17"), tsplus_module_10.unit);
967
+ }, fileName_1 + ":945:17"), tsplus_module_11.unit);
1109
968
  }
1110
969
 
1111
970
  unsafeLog(message, trace) {
1112
- const logLevel = this.unsafeGetRef(tsplus_module_30.currentLogLevel);
1113
- const spans = this.unsafeGetRef(tsplus_module_30.currentLogSpan);
1114
- const annotations = this.unsafeGetRef(tsplus_module_30.currentLogAnnotations);
1115
- this.runtimeConfig.logger.log(tsplus_module_41.parse(trace), this.fiberId, logLevel, message, tsplus_module_26.empty(), this.fiberRefLocals.get, spans, annotations);
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 = tsplus_module_31.getOrElse_(overrideLogLevel, () => this.unsafeGetRef(tsplus_module_30.currentLogLevel));
1120
- const spans = this.unsafeGetRef(tsplus_module_30.currentLogSpan);
1121
- const annotations = this.unsafeGetRef(tsplus_module_30.currentLogAnnotations);
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
- tsplus_module_11.remove_(map, overrideRef1);
987
+ tsplus_module_12.remove_(map, overrideRef1);
1129
988
  } else {
1130
- tsplus_module_11.set_(map, overrideRef1, overrideValue1);
989
+ tsplus_module_12.set_(map, overrideRef1, overrideValue1);
1131
990
  }
1132
991
 
1133
992
  contextMap = map;
1134
993
  } else {
1135
- contextMap = this.fiberRefLocals.get;
994
+ contextMap = this.fiberRefLocals;
1136
995
  }
1137
996
 
1138
- this.runtimeConfig.logger.log(tsplus_module_41.parse(trace), this.fiberId, logLevel, message, cause, contextMap, spans, annotations);
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
  }