@effect/stm
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -9,3 +9,5 @@ "use strict"; | ||
var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either")); | ||
var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Equal")); | ||
var _Function = /*#__PURE__*/require("@effect/data/Function"); | ||
var Hash = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Hash")); | ||
var MRef = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/MutableRef")); | ||
@@ -30,2 +32,3 @@ var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Cause")); | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _a; | ||
/** @internal */ | ||
@@ -43,20 +46,33 @@ const STMSymbolKey = "@effect/stm/STM"; | ||
/** @internal */ | ||
const proto = /*#__PURE__*/Object.assign({}, { | ||
..._core.proto, | ||
[STMTypeId]: stmVariance, | ||
_tag: _effect.OP_COMMIT, | ||
class STMPrimitive { | ||
get [(_a = Effect.EffectTypeId, STMTypeId)]() { | ||
return stmVariance; | ||
} | ||
constructor(i0) { | ||
this.i0 = i0; | ||
this._tag = _effect.OP_COMMIT; | ||
this.i1 = undefined; | ||
this.i2 = undefined; | ||
this.trace = undefined; | ||
this[_a] = stmVariance; | ||
} | ||
[Equal.symbol](that) { | ||
return this === that; | ||
} | ||
[Hash.symbol]() { | ||
return Hash.random(this); | ||
} | ||
commit() { | ||
return Debug.untraced(() => commit(this)); | ||
}, | ||
} | ||
traced(trace) { | ||
if (!trace) { | ||
return this; | ||
if (trace) { | ||
const effect = new STMPrimitive(OpCodes.OP_TRACED); | ||
effect.i1 = this; | ||
effect.trace = trace; | ||
return effect; | ||
} | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_TRACED; | ||
stm.stm = this; | ||
stm.trace = trace; | ||
return stm; | ||
return this; | ||
} | ||
}); | ||
} | ||
/** @internal */ | ||
@@ -254,3 +270,3 @@ const isSTM = u => typeof u === "object" && u != null && STMTypeId in u; | ||
let current = this.popStack(); | ||
while (current !== undefined && current._stmTag !== OpCodes.OP_ON_SUCCESS) { | ||
while (current !== undefined && current.i0 !== OpCodes.OP_ON_SUCCESS) { | ||
current = this.popStack(); | ||
@@ -262,3 +278,3 @@ } | ||
let current = this.popStack(); | ||
while (current !== undefined && current._stmTag !== OpCodes.OP_ON_FAILURE) { | ||
while (current !== undefined && current.i0 !== OpCodes.OP_ON_FAILURE) { | ||
current = this.popStack(); | ||
@@ -270,3 +286,3 @@ } | ||
let current = this.popStack(); | ||
while (current !== undefined && current._stmTag !== OpCodes.OP_ON_RETRY) { | ||
while (current !== undefined && current.i0 !== OpCodes.OP_ON_RETRY) { | ||
current = this.popStack(); | ||
@@ -282,7 +298,7 @@ } | ||
const current = curr; | ||
switch (current._stmTag) { | ||
switch (current.i0) { | ||
case OpCodes.OP_TRACED: | ||
{ | ||
this.pushStack(current); | ||
curr = current.stm; | ||
curr = current.i1; | ||
break; | ||
@@ -293,3 +309,3 @@ } | ||
const annotation = new Cause.StackAnnotation(this.stackToLines(), MRef.incrementAndGet(Cause.globalErrorSeq)); | ||
exit = TExit.die(current.defect(), annotation); | ||
exit = TExit.die(current.i1(), annotation); | ||
break; | ||
@@ -302,5 +318,5 @@ } | ||
if (cont === undefined) { | ||
exit = TExit.fail(current.error(), annotation); | ||
exit = TExit.fail(current.i1(), annotation); | ||
} else { | ||
curr = cont.failK(current.error()); | ||
curr = cont.i2(current.i1()); | ||
} | ||
@@ -315,3 +331,3 @@ break; | ||
} else { | ||
curr = cont.retryK(); | ||
curr = cont.i2(); | ||
} | ||
@@ -328,3 +344,3 @@ break; | ||
{ | ||
curr = current.evaluate(this); | ||
curr = current.i1(this); | ||
break; | ||
@@ -337,3 +353,3 @@ } | ||
this.pushStack(current); | ||
curr = current.first; | ||
curr = current.i1; | ||
break; | ||
@@ -344,4 +360,4 @@ } | ||
const env = this.env; | ||
this.env = current.provide(env); | ||
curr = ensuring(sync(() => this.env = env))(current.stm); | ||
this.env = current.i2(env); | ||
curr = ensuring(sync(() => this.env = env))(current.i1); | ||
break; | ||
@@ -351,3 +367,3 @@ } | ||
{ | ||
const value = current.value; | ||
const value = current.i1; | ||
const cont = this.nextSuccess(); | ||
@@ -357,3 +373,3 @@ if (cont === undefined) { | ||
} else { | ||
curr = cont.successK(value); | ||
curr = cont.i2(value); | ||
} | ||
@@ -364,3 +380,3 @@ break; | ||
{ | ||
const value = current.evaluate(); | ||
const value = current.i1(); | ||
const cont = this.nextSuccess(); | ||
@@ -370,3 +386,3 @@ if (cont === undefined) { | ||
} else { | ||
curr = cont.successK(value); | ||
curr = cont.i2(value); | ||
} | ||
@@ -386,7 +402,5 @@ break; | ||
const catchAll = /*#__PURE__*/Debug.dualWithTrace(2, (trace, restore) => (self, f) => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_ON_FAILURE; | ||
stm.first = self; | ||
stm.failK = restore(f); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_ON_FAILURE); | ||
stm.i1 = self; | ||
stm.i2 = restore(f); | ||
if (trace) { | ||
@@ -400,7 +414,5 @@ return stm.traced(trace); | ||
const contramapContext = /*#__PURE__*/Debug.dualWithTrace(2, (trace, restore) => (self, f) => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_PROVIDE; | ||
stm.stm = self; | ||
stm.provide = restore(f); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_PROVIDE); | ||
stm.i1 = self; | ||
stm.i2 = restore(f); | ||
if (trace) { | ||
@@ -420,6 +432,4 @@ return stm.traced(trace); | ||
const dieSync = /*#__PURE__*/Debug.methodWithTrace((trace, restore) => evaluate => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_DIE; | ||
stm.defect = restore(evaluate); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_DIE); | ||
stm.i1 = restore(evaluate); | ||
if (trace) { | ||
@@ -442,6 +452,4 @@ return stm.traced(trace); | ||
const failSync = /*#__PURE__*/Debug.methodWithTrace((trace, restore) => evaluate => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_FAIL; | ||
stm.error = restore(evaluate); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_FAIL); | ||
stm.i1 = restore(evaluate); | ||
if (trace) { | ||
@@ -455,7 +463,5 @@ return stm.traced(trace); | ||
const flatMap = /*#__PURE__*/Debug.dualWithTrace(2, (trace, restore) => (self, f) => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_ON_SUCCESS; | ||
stm.first = self; | ||
stm.successK = restore(f); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_ON_SUCCESS); | ||
stm.i1 = self; | ||
stm.i2 = restore(f); | ||
if (trace) { | ||
@@ -483,6 +489,4 @@ return stm.traced(trace); | ||
const interrupt = /*#__PURE__*/Debug.methodWithTrace(trace => () => withSTMRuntime(_ => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_INTERRUPT; | ||
stm.fiberId = _.fiberId; | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_INTERRUPT); | ||
stm.i1 = _.fiberId; | ||
if (trace) { | ||
@@ -496,5 +500,4 @@ return stm.traced(trace); | ||
const interruptAs = /*#__PURE__*/Debug.methodWithTrace(trace => fiberId => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_INTERRUPT; | ||
stm.fiberId = fiberId; | ||
const stm = new STMPrimitive(OpCodes.OP_INTERRUPT); | ||
stm.i1 = fiberId; | ||
stm.trace = void 0; | ||
@@ -512,7 +515,5 @@ if (trace) { | ||
const orTry = /*#__PURE__*/Debug.dualWithTrace(2, (trace, restore) => (self, that) => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_ON_RETRY; | ||
stm.first = self; | ||
stm.retryK = restore(that); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_ON_RETRY); | ||
stm.i1 = self; | ||
stm.i2 = restore(that); | ||
if (trace) { | ||
@@ -526,5 +527,3 @@ return stm.traced(trace); | ||
const retry = /*#__PURE__*/Debug.methodWithTrace(trace => () => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_RETRY; | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_RETRY); | ||
if (trace) { | ||
@@ -538,6 +537,4 @@ return stm.traced(trace); | ||
const succeed = /*#__PURE__*/Debug.methodWithTrace(trace => value => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_SUCCEED; | ||
stm.value = value; | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_SUCCEED); | ||
stm.i1 = value; | ||
if (trace) { | ||
@@ -551,6 +548,4 @@ return stm.traced(trace); | ||
const sync = /*#__PURE__*/Debug.methodWithTrace((trace, restore) => evaluate => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_SYNC; | ||
stm.evaluate = restore(evaluate); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_SYNC); | ||
stm.i1 = restore(evaluate); | ||
if (trace) { | ||
@@ -564,6 +559,4 @@ return stm.traced(trace); | ||
const withSTMRuntime = /*#__PURE__*/Debug.methodWithTrace((trace, restore) => f => { | ||
const stm = Object.create(proto); | ||
stm._stmTag = OpCodes.OP_WITH_STM_RUNTIME; | ||
stm.evaluate = restore(f); | ||
stm.trace = void 0; | ||
const stm = new STMPrimitive(OpCodes.OP_WITH_STM_RUNTIME); | ||
stm.i1 = restore(f); | ||
if (trace) { | ||
@@ -570,0 +563,0 @@ return stm.traced(trace); |
@@ -438,2 +438,3 @@ "use strict"; | ||
for (const [k, v] of values) { | ||
; | ||
res[k] = v; | ||
@@ -440,0 +441,0 @@ } |
{ | ||
"name": "@effect/stm", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -10,4 +10,4 @@ "repository": { | ||
"dependencies": { | ||
"@effect/data": "~0.3.3", | ||
"@effect/io": "~0.7.0" | ||
"@effect/data": "~0.4.1", | ||
"@effect/io": "~0.9.1" | ||
}, | ||
@@ -14,0 +14,0 @@ "publishConfig": { |
import * as Chunk from "@effect/data/Chunk" | ||
import type * as Context from "@effect/data/Context" | ||
import * as Either from "@effect/data/Either" | ||
import * as Equal from "@effect/data/Equal" | ||
import type { LazyArg } from "@effect/data/Function" | ||
import { constVoid, pipe } from "@effect/data/Function" | ||
import * as Hash from "@effect/data/Hash" | ||
import * as MRef from "@effect/data/MutableRef" | ||
@@ -14,3 +16,3 @@ import * as Cause from "@effect/io/Cause" | ||
import * as internalCause from "@effect/io/internal_effect_untraced/cause" | ||
import { proto as effectProto, withFiberRuntime } from "@effect/io/internal_effect_untraced/core" | ||
import { withFiberRuntime } from "@effect/io/internal_effect_untraced/core" | ||
import { OP_COMMIT } from "@effect/io/internal_effect_untraced/opCodes/effect" | ||
@@ -54,3 +56,3 @@ import type * as Scheduler from "@effect/io/Scheduler" | ||
readonly _tag: OP_COMMIT | ||
readonly _stmTag: Tag | ||
readonly i0: Tag | ||
} | ||
@@ -61,3 +63,3 @@ | ||
Op<OpCodes.OP_WITH_STM_RUNTIME, { | ||
readonly evaluate: ( | ||
readonly i1: ( | ||
runtime: STMDriver<unknown, unknown, unknown> | ||
@@ -71,4 +73,4 @@ ) => STM.STM<unknown, unknown, unknown> | ||
Op<OpCodes.OP_ON_FAILURE, { | ||
readonly first: STM.STM<unknown, unknown, unknown> | ||
readonly failK: (error: unknown) => STM.STM<unknown, unknown, unknown> | ||
readonly i1: STM.STM<unknown, unknown, unknown> | ||
readonly i2: (error: unknown) => STM.STM<unknown, unknown, unknown> | ||
}> | ||
@@ -80,4 +82,4 @@ {} | ||
Op<OpCodes.OP_ON_RETRY, { | ||
readonly first: STM.STM<unknown, unknown, unknown> | ||
readonly retryK: () => STM.STM<unknown, unknown, unknown> | ||
readonly i1: STM.STM<unknown, unknown, unknown> | ||
readonly i2: () => STM.STM<unknown, unknown, unknown> | ||
}> | ||
@@ -89,4 +91,4 @@ {} | ||
Op<OpCodes.OP_ON_SUCCESS, { | ||
readonly first: STM.STM<unknown, unknown, unknown> | ||
readonly successK: (a: unknown) => STM.STM<unknown, unknown, unknown> | ||
readonly i1: STM.STM<unknown, unknown, unknown> | ||
readonly i2: (a: unknown) => STM.STM<unknown, unknown, unknown> | ||
}> | ||
@@ -98,4 +100,4 @@ {} | ||
Op<OpCodes.OP_PROVIDE, { | ||
readonly stm: STM.STM<unknown, unknown, unknown> | ||
readonly provide: (context: Context.Context<unknown>) => Context.Context<unknown> | ||
readonly i1: STM.STM<unknown, unknown, unknown> | ||
readonly i2: (context: Context.Context<unknown>) => Context.Context<unknown> | ||
}> | ||
@@ -107,3 +109,3 @@ {} | ||
Op<OpCodes.OP_SYNC, { | ||
readonly evaluate: () => unknown | ||
readonly i1: () => unknown | ||
}> | ||
@@ -115,3 +117,3 @@ {} | ||
Op<OpCodes.OP_SUCCEED, { | ||
readonly value: unknown | ||
readonly i1: unknown | ||
}> | ||
@@ -126,3 +128,3 @@ {} | ||
Op<OpCodes.OP_FAIL, { | ||
readonly error: LazyArg<unknown> | ||
readonly i1: LazyArg<unknown> | ||
}> | ||
@@ -134,3 +136,3 @@ {} | ||
Op<OpCodes.OP_DIE, { | ||
readonly defect: LazyArg<unknown> | ||
readonly i1: LazyArg<unknown> | ||
}> | ||
@@ -142,3 +144,3 @@ {} | ||
Op<OpCodes.OP_TRACED, { | ||
readonly stm: STM.STM<unknown, unknown, unknown> | ||
readonly i1: STM.STM<unknown, unknown, unknown> | ||
readonly trace: Debug.Trace | ||
@@ -149,3 +151,7 @@ }> | ||
/** @internal */ | ||
interface STMInterrupt extends Op<OpCodes.OP_INTERRUPT, {}> {} | ||
interface STMInterrupt extends | ||
Op<OpCodes.OP_INTERRUPT, { | ||
readonly i1: FiberId.Runtime | ||
}> | ||
{} | ||
@@ -160,20 +166,31 @@ /** @internal */ | ||
/** @internal */ | ||
const proto = Object.assign({}, { | ||
...effectProto, | ||
[STMTypeId]: stmVariance, | ||
_tag: OP_COMMIT, | ||
class STMPrimitive implements STM.STM<any, any, any> { | ||
public _tag = OP_COMMIT | ||
public i1: any = undefined | ||
public i2: any = undefined | ||
public trace = undefined; | ||
[Effect.EffectTypeId] = stmVariance | ||
get [STMTypeId]() { | ||
return stmVariance | ||
} | ||
constructor(readonly i0: Primitive["i0"]) {} | ||
[Equal.symbol](this: {}, that: unknown) { | ||
return this === that | ||
} | ||
[Hash.symbol](this: {}) { | ||
return Hash.random(this) | ||
} | ||
commit(this: STM.STM<any, any, any>): Effect.Effect<any, any, any> { | ||
return Debug.untraced(() => commit(this)) | ||
}, | ||
traced(this: STM.STM<any, any, any>, trace: string | undefined): STM.STM<any, any, any> { | ||
if (!trace) { | ||
return this | ||
} | ||
traced(this: STM.STM<any, any, any>, trace: Debug.Trace): STM.STM<any, any, any> { | ||
if (trace) { | ||
const effect = new STMPrimitive(OpCodes.OP_TRACED) as any | ||
effect.i1 = this | ||
effect.trace = trace | ||
return effect | ||
} | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_TRACED | ||
stm.stm = this | ||
stm.trace = trace | ||
return stm | ||
return this | ||
} | ||
}) | ||
} | ||
@@ -476,3 +493,3 @@ /** @internal */ | ||
let current = this.popStack() | ||
while (current !== undefined && current._stmTag !== OpCodes.OP_ON_SUCCESS) { | ||
while (current !== undefined && current.i0 !== OpCodes.OP_ON_SUCCESS) { | ||
current = this.popStack() | ||
@@ -485,3 +502,3 @@ } | ||
let current = this.popStack() | ||
while (current !== undefined && current._stmTag !== OpCodes.OP_ON_FAILURE) { | ||
while (current !== undefined && current.i0 !== OpCodes.OP_ON_FAILURE) { | ||
current = this.popStack() | ||
@@ -494,3 +511,3 @@ } | ||
let current = this.popStack() | ||
while (current !== undefined && current._stmTag !== OpCodes.OP_ON_RETRY) { | ||
while (current !== undefined && current.i0 !== OpCodes.OP_ON_RETRY) { | ||
current = this.popStack() | ||
@@ -507,6 +524,6 @@ } | ||
const current = curr | ||
switch (current._stmTag) { | ||
switch (current.i0) { | ||
case OpCodes.OP_TRACED: { | ||
this.pushStack(current) | ||
curr = current.stm as Primitive | ||
curr = current.i1 as Primitive | ||
break | ||
@@ -519,3 +536,3 @@ } | ||
) | ||
exit = TExit.die(current.defect(), annotation) | ||
exit = TExit.die(current.i1(), annotation) | ||
break | ||
@@ -530,5 +547,5 @@ } | ||
if (cont === undefined) { | ||
exit = TExit.fail(current.error(), annotation) | ||
exit = TExit.fail(current.i1(), annotation) | ||
} else { | ||
curr = cont.failK(current.error()) as Primitive | ||
curr = cont.i2(current.i1()) as Primitive | ||
} | ||
@@ -542,3 +559,3 @@ break | ||
} else { | ||
curr = cont.retryK() as Primitive | ||
curr = cont.i2() as Primitive | ||
} | ||
@@ -556,3 +573,3 @@ break | ||
case OpCodes.OP_WITH_STM_RUNTIME: { | ||
curr = current.evaluate(this as STMDriver<unknown, unknown, unknown>) as Primitive | ||
curr = current.i1(this as STMDriver<unknown, unknown, unknown>) as Primitive | ||
break | ||
@@ -564,3 +581,3 @@ } | ||
this.pushStack(current) | ||
curr = current.first as Primitive | ||
curr = current.i1 as Primitive | ||
break | ||
@@ -570,5 +587,5 @@ } | ||
const env = this.env | ||
this.env = current.provide(env) | ||
this.env = current.i2(env) | ||
curr = pipe( | ||
current.stm, | ||
current.i1, | ||
ensuring(sync(() => (this.env = env))) | ||
@@ -579,3 +596,3 @@ ) as Primitive | ||
case OpCodes.OP_SUCCEED: { | ||
const value = current.value | ||
const value = current.i1 | ||
const cont = this.nextSuccess() | ||
@@ -585,3 +602,3 @@ if (cont === undefined) { | ||
} else { | ||
curr = cont.successK(value) as Primitive | ||
curr = cont.i2(value) as Primitive | ||
} | ||
@@ -591,3 +608,3 @@ break | ||
case OpCodes.OP_SYNC: { | ||
const value = current.evaluate() | ||
const value = current.i1() | ||
const cont = this.nextSuccess() | ||
@@ -597,3 +614,3 @@ if (cont === undefined) { | ||
} else { | ||
curr = cont.successK(value) as Primitive | ||
curr = cont.i2(value) as Primitive | ||
} | ||
@@ -624,7 +641,5 @@ break | ||
(self, f) => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_ON_FAILURE | ||
stm.first = self | ||
stm.failK = restore(f) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_ON_FAILURE) | ||
stm.i1 = self | ||
stm.i2 = restore(f) | ||
if (trace) { | ||
@@ -649,7 +664,5 @@ return stm.traced(trace) | ||
(self, f) => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_PROVIDE | ||
stm.stm = self | ||
stm.provide = restore(f) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_PROVIDE) | ||
stm.i1 = self | ||
stm.i2 = restore(f) | ||
if (trace) { | ||
@@ -674,10 +687,8 @@ return stm.traced(trace) | ||
(evaluate: LazyArg<unknown>): STM.STM<never, never, never> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_DIE | ||
stm.defect = restore(evaluate) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_DIE) | ||
stm.i1 = restore(evaluate) | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
} | ||
@@ -713,10 +724,8 @@ ) | ||
<E>(evaluate: LazyArg<E>): STM.STM<never, E, never> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_FAIL | ||
stm.error = restore(evaluate) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_FAIL) | ||
stm.i1 = restore(evaluate) | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
} | ||
@@ -731,7 +740,5 @@ ) | ||
(self, f) => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_ON_SUCCESS | ||
stm.first = self | ||
stm.successK = restore(f) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_ON_SUCCESS) | ||
stm.i1 = self | ||
stm.i2 = restore(f) | ||
if (trace) { | ||
@@ -780,10 +787,8 @@ return stm.traced(trace) | ||
withSTMRuntime((_) => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_INTERRUPT | ||
stm.fiberId = _.fiberId | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_INTERRUPT) | ||
stm.i1 = _.fiberId | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
}) | ||
@@ -795,10 +800,9 @@ ) | ||
(fiberId: FiberId.FiberId): STM.STM<never, never, never> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_INTERRUPT | ||
stm.fiberId = fiberId | ||
const stm = new STMPrimitive(OpCodes.OP_INTERRUPT) | ||
stm.i1 = fiberId | ||
stm.trace = void 0 | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
} | ||
@@ -826,7 +830,5 @@ ) | ||
(self, that) => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_ON_RETRY | ||
stm.first = self | ||
stm.retryK = restore(that) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_ON_RETRY) | ||
stm.i1 = self | ||
stm.i2 = restore(that) | ||
if (trace) { | ||
@@ -841,9 +843,7 @@ return stm.traced(trace) | ||
(): STM.STM<never, never, never> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_RETRY | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_RETRY) | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
} | ||
@@ -855,10 +855,8 @@ ) | ||
<A>(value: A): STM.STM<never, never, A> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_SUCCEED | ||
stm.value = value | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_SUCCEED) | ||
stm.i1 = value | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
} | ||
@@ -870,10 +868,8 @@ ) | ||
<A>(evaluate: () => A): STM.STM<never, never, A> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_SYNC | ||
stm.evaluate = restore(evaluate) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_SYNC) | ||
stm.i1 = restore(evaluate) | ||
if (trace) { | ||
return stm.traced(trace) | ||
return stm.traced(trace) as any | ||
} | ||
return stm | ||
return stm as any | ||
} | ||
@@ -887,6 +883,4 @@ ) | ||
): STM.STM<R, E, A> => { | ||
const stm = Object.create(proto) | ||
stm._stmTag = OpCodes.OP_WITH_STM_RUNTIME | ||
stm.evaluate = restore(f) | ||
stm.trace = void 0 | ||
const stm = new STMPrimitive(OpCodes.OP_WITH_STM_RUNTIME) | ||
stm.i1 = restore(f) | ||
if (trace) { | ||
@@ -893,0 +887,0 @@ return stm.traced(trace) |
@@ -1254,3 +1254,3 @@ import * as Chunk from "@effect/data/Chunk" | ||
export const all = Debug.methodWithTrace((trace): { | ||
<R, E, A, T extends ReadonlyArray<Effect.Effect<any, any, any>>>( | ||
<R, E, A, T extends ReadonlyArray<STM.STM<any, any, any>>>( | ||
self: STM.STM<R, E, A>, | ||
@@ -1286,7 +1286,7 @@ ...args: T | ||
): STM.STM< | ||
T["length"] extends 0 ? never | ||
: [T[number]] extends [{ [STM.STMTypeId]: { _R: (_: never) => infer R } }] ? R | ||
keyof T extends never ? never | ||
: [T[keyof T]] extends [{ [STM.STMTypeId]: { _R: (_: never) => infer R } }] ? R | ||
: never, | ||
T["length"] extends 0 ? never | ||
: [T[number]] extends [{ [STM.STMTypeId]: { _E: (_: never) => infer E } }] ? E | ||
keyof T extends never ? never | ||
: [T[keyof T]] extends [{ [STM.STMTypeId]: { _E: (_: never) => infer E } }] ? E | ||
: never, | ||
@@ -1311,3 +1311,3 @@ Readonly<{ [K in keyof T]: [T[K]] extends [STM.STM<any, any, infer A>] ? A : never }> | ||
for (const [k, v] of values) { | ||
res[k] = v | ||
;(res as any)[k] = v | ||
} | ||
@@ -1314,0 +1314,0 @@ return res |
@@ -191,7 +191,7 @@ /** | ||
): STM< | ||
T["length"] extends 0 ? never | ||
: [T[number]] extends [{ [STMTypeId]: { _R: (_: never) => infer R } }] ? R | ||
keyof T extends never ? never | ||
: [T[keyof T]] extends [{ [STMTypeId]: { _R: (_: never) => infer R } }] ? R | ||
: never, | ||
T["length"] extends 0 ? never | ||
: [T[number]] extends [{ [STMTypeId]: { _E: (_: never) => infer E } }] ? E | ||
keyof T extends never ? never | ||
: [T[keyof T]] extends [{ [STMTypeId]: { _E: (_: never) => infer E } }] ? E | ||
: never, | ||
@@ -198,0 +198,0 @@ Readonly<{ [K in keyof T]: [T[K]] extends [STM<any, any, infer A>] ? A : never }> |
@@ -5,8 +5,8 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
import type * as Order from "@effect/data/typeclass/Order" | ||
import * as internal from "@effect/stm/internal_effect_untraced/tArray" | ||
import type * as STM from "@effect/stm/STM" | ||
import type * as TRef from "@effect/stm/TRef" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
import type * as Order from "@effect/data/typeclass/Order" | ||
@@ -13,0 +13,0 @@ /** |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type * as Either from "@effect/data/Either" | ||
import type * as Option from "@effect/data/Option" | ||
import * as internal from "@effect/stm/internal_effect_untraced/tDeferred" | ||
import type * as STM from "@effect/stm/STM" | ||
import type * as TRef from "@effect/stm/TRef" | ||
import type * as Either from "@effect/data/Either" | ||
import type * as Option from "@effect/data/Option" | ||
@@ -10,0 +10,0 @@ /** |
@@ -5,3 +5,5 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk" | ||
import type { LazyArg } from "@effect/data/Function" | ||
import type * as HashMap from "@effect/data/HashMap" | ||
import type * as Option from "@effect/data/Option" | ||
import * as internal from "@effect/stm/internal_effect_untraced/tMap" | ||
@@ -11,4 +13,2 @@ import type * as STM from "@effect/stm/STM" | ||
import type * as TRef from "@effect/stm/TRef" | ||
import type { LazyArg } from "@effect/data/Function" | ||
import type * as Option from "@effect/data/Option" | ||
@@ -15,0 +15,0 @@ /** |
@@ -5,9 +5,9 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
import type * as SortedMap from "@effect/data/SortedMap" | ||
import type * as Order from "@effect/data/typeclass/Order" | ||
import * as internal from "@effect/stm/internal_effect_untraced/tPriorityQueue" | ||
import type * as STM from "@effect/stm/STM" | ||
import type * as TRef from "@effect/stm/TRef" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
import type * as Order from "@effect/data/typeclass/Order" | ||
@@ -14,0 +14,0 @@ /** |
@@ -5,6 +5,6 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
import * as internal from "@effect/stm/internal_effect_untraced/tQueue" | ||
import type * as STM from "@effect/stm/STM" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
@@ -11,0 +11,0 @@ /** |
@@ -5,2 +5,3 @@ /** | ||
import type * as Option from "@effect/data/Option" | ||
import type * as Journal from "@effect/stm/internal_effect_untraced/stm/journal" | ||
@@ -11,3 +12,2 @@ import type * as TxnId from "@effect/stm/internal_effect_untraced/stm/txnId" | ||
import type * as STM from "@effect/stm/STM" | ||
import type * as Option from "@effect/data/Option" | ||
@@ -14,0 +14,0 @@ /** |
@@ -6,7 +6,7 @@ /** | ||
import type * as HashSet from "@effect/data/HashSet" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
import * as internal from "@effect/stm/internal_effect_untraced/tSet" | ||
import type * as STM from "@effect/stm/STM" | ||
import type * as TMap from "@effect/stm/TMap" | ||
import type * as Option from "@effect/data/Option" | ||
import type { Predicate } from "@effect/data/Predicate" | ||
@@ -13,0 +13,0 @@ /** |
@@ -155,7 +155,7 @@ /** | ||
[K: string]: STM<any, any, any>; | ||
}>>(args: T): STM<T["length"] extends 0 ? never : [T[number]] extends [{ | ||
}>>(args: T): STM<keyof T extends never ? never : [T[keyof T]] extends [{ | ||
[STMTypeId]: { | ||
_R: (_: never) => infer R; | ||
}; | ||
}] ? R : never, T["length"] extends 0 ? never : [T[number]] extends [{ | ||
}] ? R : never, keyof T extends never ? never : [T[keyof T]] extends [{ | ||
[STMTypeId]: { | ||
@@ -162,0 +162,0 @@ _E: (_: never) => infer E; |
@@ -5,6 +5,6 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk"; | ||
import type * as STM from "@effect/stm/STM"; | ||
import type * as Option from "@effect/data/Option"; | ||
import type { Predicate } from "@effect/data/Predicate"; | ||
import type * as Order from "@effect/data/typeclass/Order"; | ||
import type * as STM from "@effect/stm/STM"; | ||
/** | ||
@@ -11,0 +11,0 @@ * @since 1.0.0 |
@@ -1,4 +0,7 @@ | ||
import type * as STM from "@effect/stm/STM"; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type * as Either from "@effect/data/Either"; | ||
import type * as Option from "@effect/data/Option"; | ||
import type * as STM from "@effect/stm/STM"; | ||
/** | ||
@@ -5,0 +8,0 @@ * @since 1.0.0 |
@@ -12,6 +12,2 @@ "use strict"; | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* @since 1.0.0 | ||
* @category symbols | ||
@@ -18,0 +14,0 @@ */ |
@@ -5,6 +5,6 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk"; | ||
import type { LazyArg } from "@effect/data/Function"; | ||
import type * as HashMap from "@effect/data/HashMap"; | ||
import type * as Option from "@effect/data/Option"; | ||
import type * as STM from "@effect/stm/STM"; | ||
import type { LazyArg } from "@effect/data/Function"; | ||
import type * as Option from "@effect/data/Option"; | ||
/** | ||
@@ -11,0 +11,0 @@ * @since 1.0.0 |
@@ -5,6 +5,6 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk"; | ||
import type * as STM from "@effect/stm/STM"; | ||
import type * as Option from "@effect/data/Option"; | ||
import type { Predicate } from "@effect/data/Predicate"; | ||
import type * as Order from "@effect/data/typeclass/Order"; | ||
import type * as STM from "@effect/stm/STM"; | ||
/** | ||
@@ -11,0 +11,0 @@ * @since 1.0.0 |
@@ -5,5 +5,5 @@ /** | ||
import type * as Chunk from "@effect/data/Chunk"; | ||
import type * as STM from "@effect/stm/STM"; | ||
import type * as Option from "@effect/data/Option"; | ||
import type { Predicate } from "@effect/data/Predicate"; | ||
import type * as STM from "@effect/stm/STM"; | ||
/** | ||
@@ -10,0 +10,0 @@ * @since 1.0.0 |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type * as Option from "@effect/data/Option"; | ||
import type * as STM from "@effect/stm/STM"; | ||
import type * as Option from "@effect/data/Option"; | ||
/** | ||
@@ -7,0 +7,0 @@ * @since 1.0.0 |
@@ -15,3 +15,5 @@ { | ||
"noEmit": false, | ||
"lib": ["ES2021"], | ||
"lib": [ | ||
"ES2021" | ||
], | ||
"sourceMap": true, | ||
@@ -29,3 +31,2 @@ "declarationMap": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"stripInternal": true, | ||
@@ -42,7 +43,17 @@ "noImplicitAny": true, | ||
"paths": { | ||
"@effect/io/*": ["./node_modules/@effect/io/src/*"], | ||
"@effect/stm": ["./src/index.ts"], | ||
"@effect/stm/test/*": ["./test/*"], | ||
"@effect/stm/examples/*": ["./examples/*"], | ||
"@effect/stm/*": ["./src/*"] | ||
"@effect/io/*": [ | ||
"./node_modules/@effect/io/src/*" | ||
], | ||
"@effect/stm": [ | ||
"./src/index.ts" | ||
], | ||
"@effect/stm/test/*": [ | ||
"./test/*" | ||
], | ||
"@effect/stm/examples/*": [ | ||
"./examples/*" | ||
], | ||
"@effect/stm/*": [ | ||
"./src/*" | ||
] | ||
}, | ||
@@ -59,3 +70,7 @@ "plugins": [ | ||
"include": [], | ||
"exclude": ["node_modules", "build", "lib"] | ||
"exclude": [ | ||
"node_modules", | ||
"build", | ||
"lib" | ||
] | ||
} |
@@ -6,5 +6,5 @@ /** | ||
import type * as HashSet from "@effect/data/HashSet"; | ||
import type * as STM from "@effect/stm/STM"; | ||
import type * as Option from "@effect/data/Option"; | ||
import type { Predicate } from "@effect/data/Predicate"; | ||
import type * as STM from "@effect/stm/STM"; | ||
/** | ||
@@ -11,0 +11,0 @@ * @since 1.0.0 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1715601
28435
+ Added@effect/data@0.4.1(transitive)
+ Added@effect/io@0.9.3(transitive)
- Removed@effect/data@0.3.3(transitive)
- Removed@effect/io@0.7.0(transitive)
Updated@effect/data@~0.4.1
Updated@effect/io@~0.9.1