effect 2.4.5 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/cjs/Channel.js +10 -2
  2. package/dist/cjs/Channel.js.map +1 -1
  3. package/dist/cjs/Effect.js +26 -4
  4. package/dist/cjs/Effect.js.map +1 -1
  5. package/dist/cjs/internal/cause.js +2 -2
  6. package/dist/cjs/internal/cause.js.map +1 -1
  7. package/dist/cjs/internal/channel.js +75 -1
  8. package/dist/cjs/internal/channel.js.map +1 -1
  9. package/dist/cjs/internal/core-effect.js +0 -2
  10. package/dist/cjs/internal/core-effect.js.map +1 -1
  11. package/dist/cjs/internal/core.js +148 -126
  12. package/dist/cjs/internal/core.js.map +1 -1
  13. package/dist/cjs/internal/fiberRuntime.js +29 -29
  14. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  15. package/dist/cjs/internal/layer.js +2 -2
  16. package/dist/cjs/internal/layer.js.map +1 -1
  17. package/dist/cjs/internal/runtime.js +4 -6
  18. package/dist/cjs/internal/runtime.js.map +1 -1
  19. package/dist/cjs/internal/stm/core.js +36 -36
  20. package/dist/cjs/internal/stm/core.js.map +1 -1
  21. package/dist/cjs/internal/stream.js +2 -73
  22. package/dist/cjs/internal/stream.js.map +1 -1
  23. package/dist/cjs/internal/version.js +1 -1
  24. package/dist/dts/Channel.d.ts +8 -0
  25. package/dist/dts/Channel.d.ts.map +1 -1
  26. package/dist/dts/Effect.d.ts +38 -2
  27. package/dist/dts/Effect.d.ts.map +1 -1
  28. package/dist/esm/Channel.js +8 -0
  29. package/dist/esm/Channel.js.map +1 -1
  30. package/dist/esm/Effect.js +22 -0
  31. package/dist/esm/Effect.js.map +1 -1
  32. package/dist/esm/internal/cause.js +2 -2
  33. package/dist/esm/internal/cause.js.map +1 -1
  34. package/dist/esm/internal/channel.js +73 -0
  35. package/dist/esm/internal/channel.js.map +1 -1
  36. package/dist/esm/internal/core-effect.js +0 -2
  37. package/dist/esm/internal/core-effect.js.map +1 -1
  38. package/dist/esm/internal/core.js +144 -123
  39. package/dist/esm/internal/core.js.map +1 -1
  40. package/dist/esm/internal/fiberRuntime.js +29 -29
  41. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  42. package/dist/esm/internal/layer.js +2 -2
  43. package/dist/esm/internal/layer.js.map +1 -1
  44. package/dist/esm/internal/runtime.js +4 -6
  45. package/dist/esm/internal/runtime.js.map +1 -1
  46. package/dist/esm/internal/stm/core.js +36 -36
  47. package/dist/esm/internal/stm/core.js.map +1 -1
  48. package/dist/esm/internal/stream.js +2 -73
  49. package/dist/esm/internal/stream.js.map +1 -1
  50. package/dist/esm/internal/version.js +1 -1
  51. package/package.json +1 -1
  52. package/src/Channel.ts +17 -0
  53. package/src/Effect.ts +45 -2
  54. package/src/Exit.ts +2 -2
  55. package/src/internal/cause.ts +2 -2
  56. package/src/internal/channel.ts +92 -0
  57. package/src/internal/core-effect.ts +0 -2
  58. package/src/internal/core.ts +167 -134
  59. package/src/internal/fiberRuntime.ts +30 -30
  60. package/src/internal/layer.ts +4 -4
  61. package/src/internal/runtime.ts +4 -6
  62. package/src/internal/stm/core.ts +49 -49
  63. package/src/internal/stream.ts +2 -82
  64. package/src/internal/version.ts +1 -1
  65. package/dist/cjs/internal/internalize.js +0 -15
  66. package/dist/cjs/internal/internalize.js.map +0 -1
  67. package/dist/dts/internal/internalize.d.ts +0 -2
  68. package/dist/dts/internal/internalize.d.ts.map +0 -1
  69. package/dist/esm/internal/internalize.js +0 -8
  70. package/dist/esm/internal/internalize.js.map +0 -1
  71. package/src/internal/internalize.ts +0 -5
@@ -20,7 +20,6 @@ import * as internalCause from "./cause.js";
20
20
  import * as deferred from "./deferred.js";
21
21
  import * as internalDiffer from "./differ.js";
22
22
  import { effectVariance, StructuralCommitPrototype } from "./effectable.js";
23
- import { internalize } from "./internalize.js";
24
23
  import * as DeferredOpCodes from "./opCodes/deferred.js";
25
24
  import * as OpCodes from "./opCodes/effect.js";
26
25
  import * as _runtimeFlags from "./runtimeFlags.js";
@@ -45,8 +44,8 @@ export const makeEffectError = cause => ({
45
44
  */
46
45
  export const blocked = (blockedRequests, _continue) => {
47
46
  const effect = new EffectPrimitive("Blocked");
48
- effect.i0 = blockedRequests;
49
- effect.i1 = _continue;
47
+ effect.effect_instruction_i0 = blockedRequests;
48
+ effect.effect_instruction_i1 = _continue;
50
49
  return effect;
51
50
  };
52
51
  /**
@@ -54,7 +53,7 @@ export const blocked = (blockedRequests, _continue) => {
54
53
  */
55
54
  export const runRequestBlock = blockedRequests => {
56
55
  const effect = new EffectPrimitive("RunBlocked");
57
- effect.i0 = blockedRequests;
56
+ effect.effect_instruction_i0 = blockedRequests;
58
57
  return effect;
59
58
  };
60
59
  /** @internal */
@@ -72,9 +71,9 @@ export class RevertFlags {
72
71
  /** @internal */
73
72
  class EffectPrimitive {
74
73
  _op;
75
- i0 = undefined;
76
- i1 = undefined;
77
- i2 = undefined;
74
+ effect_instruction_i0 = undefined;
75
+ effect_instruction_i1 = undefined;
76
+ effect_instruction_i2 = undefined;
78
77
  trace = undefined;
79
78
  [EffectTypeId] = effectVariance;
80
79
  constructor(_op) {
@@ -93,9 +92,9 @@ class EffectPrimitive {
93
92
  return {
94
93
  _id: "Effect",
95
94
  _op: this._op,
96
- i0: toJSON(this.i0),
97
- i1: toJSON(this.i1),
98
- i2: toJSON(this.i2)
95
+ effect_instruction_i0: toJSON(this.effect_instruction_i0),
96
+ effect_instruction_i1: toJSON(this.effect_instruction_i1),
97
+ effect_instruction_i2: toJSON(this.effect_instruction_i2)
99
98
  };
100
99
  }
101
100
  toString() {
@@ -108,9 +107,9 @@ class EffectPrimitive {
108
107
  /** @internal */
109
108
  class EffectPrimitiveFailure {
110
109
  _op;
111
- i0 = undefined;
112
- i1 = undefined;
113
- i2 = undefined;
110
+ effect_instruction_i0 = undefined;
111
+ effect_instruction_i1 = undefined;
112
+ effect_instruction_i2 = undefined;
114
113
  trace = undefined;
115
114
  [EffectTypeId] = effectVariance;
116
115
  constructor(_op) {
@@ -125,7 +124,7 @@ class EffectPrimitiveFailure {
125
124
  return Hash.cached(this, Hash.random(this));
126
125
  }
127
126
  get cause() {
128
- return this.i0;
127
+ return this.effect_instruction_i0;
129
128
  }
130
129
  pipe() {
131
130
  return pipeArguments(this, arguments);
@@ -147,9 +146,9 @@ class EffectPrimitiveFailure {
147
146
  /** @internal */
148
147
  class EffectPrimitiveSuccess {
149
148
  _op;
150
- i0 = undefined;
151
- i1 = undefined;
152
- i2 = undefined;
149
+ effect_instruction_i0 = undefined;
150
+ effect_instruction_i1 = undefined;
151
+ effect_instruction_i2 = undefined;
153
152
  trace = undefined;
154
153
  [EffectTypeId] = effectVariance;
155
154
  constructor(_op) {
@@ -164,7 +163,7 @@ class EffectPrimitiveSuccess {
164
163
  return Hash.cached(this, Hash.random(this));
165
164
  }
166
165
  get value() {
167
- return this.i0;
166
+ return this.effect_instruction_i0;
168
167
  }
169
168
  pipe() {
170
169
  return pipeArguments(this, arguments);
@@ -187,9 +186,8 @@ class EffectPrimitiveSuccess {
187
186
  export const isEffect = u => hasProperty(u, EffectTypeId);
188
187
  /* @internal */
189
188
  export const withFiberRuntime = withRuntime => {
190
- internalize(withRuntime);
191
189
  const effect = new EffectPrimitive(OpCodes.OP_WITH_RUNTIME);
192
- effect.i0 = withRuntime;
190
+ effect.effect_instruction_i0 = withRuntime;
193
191
  return effect;
194
192
  };
195
193
  /* @internal */
@@ -198,7 +196,7 @@ export const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) =>
198
196
  onFailure: cause => {
199
197
  switch (exit._tag) {
200
198
  case OpCodes.OP_FAILURE:
201
- return failCause(internalCause.parallel(exit.i0, cause));
199
+ return failCause(internalCause.parallel(exit.effect_instruction_i0, cause));
202
200
  case OpCodes.OP_SUCCESS:
203
201
  return failCause(cause);
204
202
  }
@@ -211,46 +209,78 @@ export const as = /*#__PURE__*/dual(2, (self, value) => flatMap(self, () => succ
211
209
  /* @internal */
212
210
  export const asUnit = self => as(self, void 0);
213
211
  /* @internal */
214
- export const async = (register, blockingOn = FiberId.none) => suspend(() => {
215
- internalize(register);
216
- let backingResume = undefined;
217
- let pendingEffect = undefined;
218
- function proxyResume(effect) {
219
- if (backingResume) {
220
- backingResume(effect);
221
- } else if (pendingEffect === undefined) {
222
- pendingEffect = effect;
223
- }
212
+ export const custom = function () {
213
+ const wrapper = new EffectPrimitive(OpCodes.OP_COMMIT);
214
+ switch (arguments.length) {
215
+ case 2:
216
+ {
217
+ wrapper.effect_instruction_i0 = arguments[0];
218
+ wrapper.commit = arguments[1];
219
+ break;
220
+ }
221
+ case 3:
222
+ {
223
+ wrapper.effect_instruction_i0 = arguments[0];
224
+ wrapper.effect_instruction_i1 = arguments[1];
225
+ wrapper.commit = arguments[2];
226
+ break;
227
+ }
228
+ case 4:
229
+ {
230
+ wrapper.effect_instruction_i0 = arguments[0];
231
+ wrapper.effect_instruction_i1 = arguments[1];
232
+ wrapper.effect_instruction_i2 = arguments[2];
233
+ wrapper.commit = arguments[3];
234
+ break;
235
+ }
236
+ default:
237
+ {
238
+ throw new Error("Bug, you're not supposed to end up here");
239
+ }
224
240
  }
225
- const effect = new EffectPrimitive(OpCodes.OP_ASYNC);
226
- effect.i0 = resume => {
227
- backingResume = resume;
228
- if (pendingEffect) {
229
- resume(pendingEffect);
241
+ return wrapper;
242
+ };
243
+ /* @internal */
244
+ export const async = (register, blockingOn = FiberId.none) => {
245
+ return custom(register, function () {
246
+ let backingResume = undefined;
247
+ let pendingEffect = undefined;
248
+ function proxyResume(effect) {
249
+ if (backingResume) {
250
+ backingResume(effect);
251
+ } else if (pendingEffect === undefined) {
252
+ pendingEffect = effect;
253
+ }
230
254
  }
231
- };
232
- effect.i1 = blockingOn;
233
- let cancelerRef = undefined;
234
- let controllerRef = undefined;
235
- if (register.length !== 1) {
236
- controllerRef = new AbortController();
237
- cancelerRef = register(proxyResume, controllerRef.signal);
238
- } else {
239
- cancelerRef = register(proxyResume);
240
- }
241
- return cancelerRef || controllerRef ? onInterrupt(effect, _ => {
242
- if (controllerRef) {
243
- controllerRef.abort();
255
+ const effect = new EffectPrimitive(OpCodes.OP_ASYNC);
256
+ effect.effect_instruction_i0 = resume => {
257
+ backingResume = resume;
258
+ if (pendingEffect) {
259
+ resume(pendingEffect);
260
+ }
261
+ };
262
+ effect.effect_instruction_i1 = blockingOn;
263
+ let cancelerRef = undefined;
264
+ let controllerRef = undefined;
265
+ if (this.effect_instruction_i0.length !== 1) {
266
+ controllerRef = new AbortController();
267
+ cancelerRef = this.effect_instruction_i0(proxyResume, controllerRef.signal);
268
+ } else {
269
+ cancelerRef = this.effect_instruction_i0(proxyResume);
244
270
  }
245
- return cancelerRef ?? unit;
246
- }) : effect;
247
- });
271
+ return cancelerRef || controllerRef ? onInterrupt(effect, _ => {
272
+ if (controllerRef) {
273
+ controllerRef.abort();
274
+ }
275
+ return cancelerRef ?? unit;
276
+ }) : effect;
277
+ });
278
+ };
248
279
  /* @internal */
249
280
  export const catchAllCause = /*#__PURE__*/dual(2, (self, f) => {
250
281
  const effect = new EffectPrimitive(OpCodes.OP_ON_FAILURE);
251
- effect.i0 = self;
252
- effect.i1 = f;
253
- internalize(f);
282
+ effect.effect_instruction_i0 = self;
283
+ effect.effect_instruction_i1 = f;
254
284
  return effect;
255
285
  });
256
286
  /* @internal */
@@ -334,7 +364,7 @@ export const failSync = evaluate => flatMap(sync(evaluate), fail);
334
364
  /* @internal */
335
365
  export const failCause = cause => {
336
366
  const effect = new EffectPrimitiveFailure(OpCodes.OP_FAILURE);
337
- effect.i0 = cause;
367
+ effect.effect_instruction_i0 = cause;
338
368
  return effect;
339
369
  };
340
370
  /* @internal */
@@ -345,10 +375,9 @@ export const fiberId = /*#__PURE__*/withFiberRuntime(state => succeed(state.id()
345
375
  export const fiberIdWith = f => withFiberRuntime(state => f(state.id()));
346
376
  /* @internal */
347
377
  export const flatMap = /*#__PURE__*/dual(2, (self, f) => {
348
- internalize(f);
349
378
  const effect = new EffectPrimitive(OpCodes.OP_ON_SUCCESS);
350
- effect.i0 = self;
351
- effect.i1 = f;
379
+ effect.effect_instruction_i0 = self;
380
+ effect.effect_instruction_i1 = f;
352
381
  return effect;
353
382
  });
354
383
  /* @internal */
@@ -366,7 +395,7 @@ export const andThen = /*#__PURE__*/dual(2, (self, f) => flatMap(self, a => {
366
395
  /* @internal */
367
396
  export const step = self => {
368
397
  const effect = new EffectPrimitive("OnStep");
369
- effect.i0 = self;
398
+ effect.effect_instruction_i0 = self;
370
399
  return effect;
371
400
  };
372
401
  /* @internal */
@@ -384,11 +413,9 @@ export const matchCause = /*#__PURE__*/dual(2, (self, options) => matchCauseEffe
384
413
  /* @internal */
385
414
  export const matchCauseEffect = /*#__PURE__*/dual(2, (self, options) => {
386
415
  const effect = new EffectPrimitive(OpCodes.OP_ON_SUCCESS_AND_FAILURE);
387
- effect.i0 = self;
388
- effect.i1 = options.onFailure;
389
- effect.i2 = options.onSuccess;
390
- internalize(options.onFailure);
391
- internalize(options.onSuccess);
416
+ effect.effect_instruction_i0 = self;
417
+ effect.effect_instruction_i1 = options.onFailure;
418
+ effect.effect_instruction_i2 = options.onSuccess;
392
419
  return effect;
393
420
  });
394
421
  /* @internal */
@@ -443,18 +470,17 @@ export const interruptWith = fiberId => failCause(internalCause.interrupt(fiberI
443
470
  /* @internal */
444
471
  export const interruptible = self => {
445
472
  const effect = new EffectPrimitive(OpCodes.OP_UPDATE_RUNTIME_FLAGS);
446
- effect.i0 = RuntimeFlagsPatch.enable(_runtimeFlags.Interruption);
447
- effect.i1 = () => self;
473
+ effect.effect_instruction_i0 = RuntimeFlagsPatch.enable(_runtimeFlags.Interruption);
474
+ effect.effect_instruction_i1 = () => self;
448
475
  return effect;
449
476
  };
450
477
  /* @internal */
451
- export const interruptibleMask = f => {
452
- internalize(f);
478
+ export const interruptibleMask = f => custom(f, function () {
453
479
  const effect = new EffectPrimitive(OpCodes.OP_UPDATE_RUNTIME_FLAGS);
454
- effect.i0 = RuntimeFlagsPatch.enable(_runtimeFlags.Interruption);
455
- effect.i1 = oldFlags => _runtimeFlags.interruption(oldFlags) ? f(interruptible) : f(uninterruptible);
480
+ effect.effect_instruction_i0 = RuntimeFlagsPatch.enable(_runtimeFlags.Interruption);
481
+ effect.effect_instruction_i1 = oldFlags => _runtimeFlags.interruption(oldFlags) ? this.effect_instruction_i0(interruptible) : this.effect_instruction_i0(uninterruptible);
456
482
  return effect;
457
- };
483
+ });
458
484
  /* @internal */
459
485
  export const intoDeferred = /*#__PURE__*/dual(2, (self, deferred) => uninterruptibleMask(restore => flatMap(exit(restore(self)), exit => deferredDone(deferred, exit))));
460
486
  /* @internal */
@@ -482,7 +508,7 @@ export const mapError = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect(self,
482
508
  onSuccess: succeed
483
509
  }));
484
510
  /* @internal */
485
- export const onError = /*#__PURE__*/dual(2, (self, cleanup) => onExit(self, exit => exitIsSuccess(exit) ? unit : cleanup(exit.i0)));
511
+ export const onError = /*#__PURE__*/dual(2, (self, cleanup) => onExit(self, exit => exitIsSuccess(exit) ? unit : cleanup(exit.effect_instruction_i0)));
486
512
  /* @internal */
487
513
  export const onExit = /*#__PURE__*/dual(2, (self, cleanup) => uninterruptibleMask(restore => matchCauseEffect(restore(self), {
488
514
  onFailure: cause1 => {
@@ -530,16 +556,15 @@ export const runtimeFlags = /*#__PURE__*/withFiberRuntime((_, status) => succeed
530
556
  /* @internal */
531
557
  export const succeed = value => {
532
558
  const effect = new EffectPrimitiveSuccess(OpCodes.OP_SUCCESS);
533
- effect.i0 = value;
559
+ effect.effect_instruction_i0 = value;
534
560
  return effect;
535
561
  };
536
562
  /* @internal */
537
563
  export const suspend = effect => flatMap(sync(effect), identity);
538
564
  /* @internal */
539
565
  export const sync = evaluate => {
540
- internalize(evaluate);
541
566
  const effect = new EffectPrimitive(OpCodes.OP_SYNC);
542
- effect.i0 = evaluate;
567
+ effect.effect_instruction_i0 = evaluate;
543
568
  return effect;
544
569
  };
545
570
  /* @internal */
@@ -574,25 +599,24 @@ export const attemptOrElse = /*#__PURE__*/dual(3, (self, that, onSuccess) => mat
574
599
  /* @internal */
575
600
  export const uninterruptible = self => {
576
601
  const effect = new EffectPrimitive(OpCodes.OP_UPDATE_RUNTIME_FLAGS);
577
- effect.i0 = RuntimeFlagsPatch.disable(_runtimeFlags.Interruption);
578
- effect.i1 = () => self;
602
+ effect.effect_instruction_i0 = RuntimeFlagsPatch.disable(_runtimeFlags.Interruption);
603
+ effect.effect_instruction_i1 = () => self;
579
604
  return effect;
580
605
  };
581
606
  /* @internal */
582
- export const uninterruptibleMask = f => {
583
- internalize(f);
607
+ export const uninterruptibleMask = f => custom(f, function () {
584
608
  const effect = new EffectPrimitive(OpCodes.OP_UPDATE_RUNTIME_FLAGS);
585
- effect.i0 = RuntimeFlagsPatch.disable(_runtimeFlags.Interruption);
586
- effect.i1 = oldFlags => _runtimeFlags.interruption(oldFlags) ? f(interruptible) : f(uninterruptible);
609
+ effect.effect_instruction_i0 = RuntimeFlagsPatch.disable(_runtimeFlags.Interruption);
610
+ effect.effect_instruction_i1 = oldFlags => _runtimeFlags.interruption(oldFlags) ? this.effect_instruction_i0(interruptible) : this.effect_instruction_i0(uninterruptible);
587
611
  return effect;
588
- };
612
+ });
589
613
  /* @internal */
590
614
  export const unit = /*#__PURE__*/succeed(void 0);
591
615
  /* @internal */
592
616
  export const updateRuntimeFlags = patch => {
593
617
  const effect = new EffectPrimitive(OpCodes.OP_UPDATE_RUNTIME_FLAGS);
594
- effect.i0 = patch;
595
- effect.i1 = void 0;
618
+ effect.effect_instruction_i0 = patch;
619
+ effect.effect_instruction_i1 = void 0;
596
620
  return effect;
597
621
  };
598
622
  /* @internal */
@@ -605,12 +629,9 @@ export const whenEffect = /*#__PURE__*/dual(2, (self, condition) => flatMap(cond
605
629
  /* @internal */
606
630
  export const whileLoop = options => {
607
631
  const effect = new EffectPrimitive(OpCodes.OP_WHILE);
608
- effect.i0 = options.while;
609
- effect.i1 = options.body;
610
- effect.i2 = options.step;
611
- internalize(options.body);
612
- internalize(options.step);
613
- internalize(options.while);
632
+ effect.effect_instruction_i0 = options.while;
633
+ effect.effect_instruction_i1 = options.body;
634
+ effect.effect_instruction_i2 = options.step;
614
635
  return effect;
615
636
  };
616
637
  /* @internal */
@@ -620,8 +641,8 @@ export const withRequestBatching = /*#__PURE__*/dual(2, (self, requestBatching)
620
641
  /* @internal */
621
642
  export const withRuntimeFlags = /*#__PURE__*/dual(2, (self, update) => {
622
643
  const effect = new EffectPrimitive(OpCodes.OP_UPDATE_RUNTIME_FLAGS);
623
- effect.i0 = update;
624
- effect.i1 = () => self;
644
+ effect.effect_instruction_i0 = update;
645
+ effect.effect_instruction_i1 = () => self;
625
646
  return effect;
626
647
  });
627
648
  /** @internal */
@@ -1171,7 +1192,7 @@ export const exitIsSuccess = self => self._tag === "Success";
1171
1192
  export const exitIsInterrupted = self => {
1172
1193
  switch (self._tag) {
1173
1194
  case OpCodes.OP_FAILURE:
1174
- return internalCause.isInterrupted(self.i0);
1195
+ return internalCause.isInterrupted(self.effect_instruction_i0);
1175
1196
  case OpCodes.OP_SUCCESS:
1176
1197
  return false;
1177
1198
  }
@@ -1181,7 +1202,7 @@ export const exitAs = /*#__PURE__*/dual(2, (self, value) => {
1181
1202
  switch (self._tag) {
1182
1203
  case OpCodes.OP_FAILURE:
1183
1204
  {
1184
- return exitFailCause(self.i0);
1205
+ return exitFailCause(self.effect_instruction_i0);
1185
1206
  }
1186
1207
  case OpCodes.OP_SUCCESS:
1187
1208
  {
@@ -1195,7 +1216,7 @@ export const exitAsUnit = self => exitAs(self, void 0);
1195
1216
  export const exitCauseOption = self => {
1196
1217
  switch (self._tag) {
1197
1218
  case OpCodes.OP_FAILURE:
1198
- return Option.some(self.i0);
1219
+ return Option.some(self.effect_instruction_i0);
1199
1220
  case OpCodes.OP_SUCCESS:
1200
1221
  return Option.none();
1201
1222
  }
@@ -1210,7 +1231,7 @@ export const exitExists = /*#__PURE__*/dual(2, (self, refinement) => {
1210
1231
  case OpCodes.OP_FAILURE:
1211
1232
  return false;
1212
1233
  case OpCodes.OP_SUCCESS:
1213
- return refinement(self.i0);
1234
+ return refinement(self.effect_instruction_i0);
1214
1235
  }
1215
1236
  });
1216
1237
  /** @internal */
@@ -1218,7 +1239,7 @@ export const exitFail = error => exitFailCause(internalCause.fail(error));
1218
1239
  /** @internal */
1219
1240
  export const exitFailCause = cause => {
1220
1241
  const effect = new EffectPrimitiveFailure(OpCodes.OP_FAILURE);
1221
- effect.i0 = cause;
1242
+ effect.effect_instruction_i0 = cause;
1222
1243
  return effect;
1223
1244
  };
1224
1245
  /** @internal */
@@ -1226,11 +1247,11 @@ export const exitFlatMap = /*#__PURE__*/dual(2, (self, f) => {
1226
1247
  switch (self._tag) {
1227
1248
  case OpCodes.OP_FAILURE:
1228
1249
  {
1229
- return exitFailCause(self.i0);
1250
+ return exitFailCause(self.effect_instruction_i0);
1230
1251
  }
1231
1252
  case OpCodes.OP_SUCCESS:
1232
1253
  {
1233
- return f(self.i0);
1254
+ return f(self.effect_instruction_i0);
1234
1255
  }
1235
1256
  }
1236
1257
  });
@@ -1239,11 +1260,11 @@ export const exitFlatMapEffect = /*#__PURE__*/dual(2, (self, f) => {
1239
1260
  switch (self._tag) {
1240
1261
  case OpCodes.OP_FAILURE:
1241
1262
  {
1242
- return succeed(exitFailCause(self.i0));
1263
+ return succeed(exitFailCause(self.effect_instruction_i0));
1243
1264
  }
1244
1265
  case OpCodes.OP_SUCCESS:
1245
1266
  {
1246
- return f(self.i0);
1267
+ return f(self.effect_instruction_i0);
1247
1268
  }
1248
1269
  }
1249
1270
  });
@@ -1254,11 +1275,11 @@ export const exitForEachEffect = /*#__PURE__*/dual(2, (self, f) => {
1254
1275
  switch (self._tag) {
1255
1276
  case OpCodes.OP_FAILURE:
1256
1277
  {
1257
- return succeed(exitFailCause(self.i0));
1278
+ return succeed(exitFailCause(self.effect_instruction_i0));
1258
1279
  }
1259
1280
  case OpCodes.OP_SUCCESS:
1260
1281
  {
1261
- return exit(f(self.i0));
1282
+ return exit(f(self.effect_instruction_i0));
1262
1283
  }
1263
1284
  }
1264
1285
  });
@@ -1284,9 +1305,9 @@ export const exitFromOption = option => {
1284
1305
  export const exitGetOrElse = /*#__PURE__*/dual(2, (self, orElse) => {
1285
1306
  switch (self._tag) {
1286
1307
  case OpCodes.OP_FAILURE:
1287
- return orElse(self.i0);
1308
+ return orElse(self.effect_instruction_i0);
1288
1309
  case OpCodes.OP_SUCCESS:
1289
- return self.i0;
1310
+ return self.effect_instruction_i0;
1290
1311
  }
1291
1312
  });
1292
1313
  /** @internal */
@@ -1295,9 +1316,9 @@ export const exitInterrupt = fiberId => exitFailCause(internalCause.interrupt(fi
1295
1316
  export const exitMap = /*#__PURE__*/dual(2, (self, f) => {
1296
1317
  switch (self._tag) {
1297
1318
  case OpCodes.OP_FAILURE:
1298
- return exitFailCause(self.i0);
1319
+ return exitFailCause(self.effect_instruction_i0);
1299
1320
  case OpCodes.OP_SUCCESS:
1300
- return exitSucceed(f(self.i0));
1321
+ return exitSucceed(f(self.effect_instruction_i0));
1301
1322
  }
1302
1323
  });
1303
1324
  /** @internal */
@@ -1307,27 +1328,27 @@ export const exitMapBoth = /*#__PURE__*/dual(2, (self, {
1307
1328
  }) => {
1308
1329
  switch (self._tag) {
1309
1330
  case OpCodes.OP_FAILURE:
1310
- return exitFailCause(pipe(self.i0, internalCause.map(onFailure)));
1331
+ return exitFailCause(pipe(self.effect_instruction_i0, internalCause.map(onFailure)));
1311
1332
  case OpCodes.OP_SUCCESS:
1312
- return exitSucceed(onSuccess(self.i0));
1333
+ return exitSucceed(onSuccess(self.effect_instruction_i0));
1313
1334
  }
1314
1335
  });
1315
1336
  /** @internal */
1316
1337
  export const exitMapError = /*#__PURE__*/dual(2, (self, f) => {
1317
1338
  switch (self._tag) {
1318
1339
  case OpCodes.OP_FAILURE:
1319
- return exitFailCause(pipe(self.i0, internalCause.map(f)));
1340
+ return exitFailCause(pipe(self.effect_instruction_i0, internalCause.map(f)));
1320
1341
  case OpCodes.OP_SUCCESS:
1321
- return exitSucceed(self.i0);
1342
+ return exitSucceed(self.effect_instruction_i0);
1322
1343
  }
1323
1344
  });
1324
1345
  /** @internal */
1325
1346
  export const exitMapErrorCause = /*#__PURE__*/dual(2, (self, f) => {
1326
1347
  switch (self._tag) {
1327
1348
  case OpCodes.OP_FAILURE:
1328
- return exitFailCause(f(self.i0));
1349
+ return exitFailCause(f(self.effect_instruction_i0));
1329
1350
  case OpCodes.OP_SUCCESS:
1330
- return exitSucceed(self.i0);
1351
+ return exitSucceed(self.effect_instruction_i0);
1331
1352
  }
1332
1353
  });
1333
1354
  /** @internal */
@@ -1337,9 +1358,9 @@ export const exitMatch = /*#__PURE__*/dual(2, (self, {
1337
1358
  }) => {
1338
1359
  switch (self._tag) {
1339
1360
  case OpCodes.OP_FAILURE:
1340
- return onFailure(self.i0);
1361
+ return onFailure(self.effect_instruction_i0);
1341
1362
  case OpCodes.OP_SUCCESS:
1342
- return onSuccess(self.i0);
1363
+ return onSuccess(self.effect_instruction_i0);
1343
1364
  }
1344
1365
  });
1345
1366
  /** @internal */
@@ -1349,15 +1370,15 @@ export const exitMatchEffect = /*#__PURE__*/dual(2, (self, {
1349
1370
  }) => {
1350
1371
  switch (self._tag) {
1351
1372
  case OpCodes.OP_FAILURE:
1352
- return onFailure(self.i0);
1373
+ return onFailure(self.effect_instruction_i0);
1353
1374
  case OpCodes.OP_SUCCESS:
1354
- return onSuccess(self.i0);
1375
+ return onSuccess(self.effect_instruction_i0);
1355
1376
  }
1356
1377
  });
1357
1378
  /** @internal */
1358
1379
  export const exitSucceed = value => {
1359
1380
  const effect = new EffectPrimitiveSuccess(OpCodes.OP_SUCCESS);
1360
- effect.i0 = value;
1381
+ effect.effect_instruction_i0 = value;
1361
1382
  return effect;
1362
1383
  };
1363
1384
  /** @internal */
@@ -1402,10 +1423,10 @@ export const exitZipWith = /*#__PURE__*/dual(3, (self, that, {
1402
1423
  {
1403
1424
  switch (that._tag) {
1404
1425
  case OpCodes.OP_SUCCESS:
1405
- return exitFailCause(self.i0);
1426
+ return exitFailCause(self.effect_instruction_i0);
1406
1427
  case OpCodes.OP_FAILURE:
1407
1428
  {
1408
- return exitFailCause(onFailure(self.i0, that.i0));
1429
+ return exitFailCause(onFailure(self.effect_instruction_i0, that.effect_instruction_i0));
1409
1430
  }
1410
1431
  }
1411
1432
  }
@@ -1413,9 +1434,9 @@ export const exitZipWith = /*#__PURE__*/dual(3, (self, that, {
1413
1434
  {
1414
1435
  switch (that._tag) {
1415
1436
  case OpCodes.OP_SUCCESS:
1416
- return exitSucceed(onSuccess(self.i0, that.i0));
1437
+ return exitSucceed(onSuccess(self.effect_instruction_i0, that.effect_instruction_i0));
1417
1438
  case OpCodes.OP_FAILURE:
1418
- return exitFailCause(that.i0);
1439
+ return exitFailCause(that.effect_instruction_i0);
1419
1440
  }
1420
1441
  }
1421
1442
  }