@effect/io
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,3 +5,3 @@ /** | ||
import type * as Effect from "@effect/io/Effect"; | ||
import * as internal from "@effect/io/internal/cached"; | ||
import type * as Schedule from "@effect/io/Schedule"; | ||
import type * as Scope from "@effect/io/Scope"; | ||
@@ -53,3 +53,3 @@ /** | ||
*/ | ||
export declare const auto: typeof internal.auto; | ||
export declare const auto: <R, E, A, R2, In, Out>(acquire: Effect.Effect<R, E, A>, policy: Schedule.Schedule<R2, In, Out>) => Effect.Effect<Scope.Scope | R | R2, never, Cached<E, A>>; | ||
/** | ||
@@ -56,0 +56,0 @@ * Retrieves the current value stored in the cache. |
@@ -30,2 +30,3 @@ /** | ||
import type { Equal } from "@fp-ts/data/Equal"; | ||
import type { Option } from "@fp-ts/data/Option"; | ||
/** | ||
@@ -100,4 +101,14 @@ * @since 1.0.0 | ||
*/ | ||
export declare const SpanAnnotationTypeId: unique symbol; | ||
/** | ||
* @since 1.0.0 | ||
* @category symbols | ||
*/ | ||
export type StackAnnotationTypeId = typeof StackAnnotationTypeId; | ||
/** | ||
* @since 1.0.0 | ||
* @category symbols | ||
*/ | ||
export type SpanAnnotationTypeId = typeof SpanAnnotationTypeId; | ||
/** | ||
* A `Cause` represents the full history of a failure resulting from running an | ||
@@ -137,2 +148,10 @@ * `Effect` workflow. | ||
} | ||
/** | ||
* @since 1.0.0 | ||
* @category models | ||
*/ | ||
interface SpanAnnotation { | ||
readonly [SpanAnnotationTypeId]: SpanAnnotationTypeId; | ||
readonly currentSpanURI: Option<string>; | ||
} | ||
} | ||
@@ -168,3 +187,2 @@ /** | ||
readonly renderStack: boolean; | ||
readonly renderSpanDepth: number; | ||
readonly renderExecutionDepth: number; | ||
@@ -509,3 +527,3 @@ readonly renderStackDepth: number; | ||
*/ | ||
export declare const failureOption: <E>(self: Cause<E>) => import("@fp-ts/data/Option").Option<E>; | ||
export declare const failureOption: <E>(self: Cause<E>) => Option<E>; | ||
/** | ||
@@ -527,3 +545,3 @@ * Returns the first checked error on the `Left` if available, if there are | ||
*/ | ||
export declare const dieOption: <E>(self: Cause<E>) => import("@fp-ts/data/Option").Option<unknown>; | ||
export declare const dieOption: <E>(self: Cause<E>) => Option<unknown>; | ||
/** | ||
@@ -536,3 +554,3 @@ * Returns the `FiberId` associated with the first `Interrupt` in the specified | ||
*/ | ||
export declare const interruptOption: <E>(self: Cause<E>) => import("@fp-ts/data/Option").Option<FiberId>; | ||
export declare const interruptOption: <E>(self: Cause<E>) => Option<FiberId>; | ||
/** | ||
@@ -545,3 +563,3 @@ * Remove all `Fail` and `Interrupt` nodes from the specified cause, and return | ||
*/ | ||
export declare const keepDefects: <E>(self: Cause<E>) => import("@fp-ts/data/Option").Option<Cause<never>>; | ||
export declare const keepDefects: <E>(self: Cause<E>) => Option<Cause<never>>; | ||
/** | ||
@@ -571,3 +589,3 @@ * Linearizes the specified cause into a `HashSet` of parallel causes where each | ||
*/ | ||
export declare const stripSomeDefects: (pf: (defect: unknown) => import("@fp-ts/data/Option").Option<unknown>) => <E>(self: Cause<E>) => import("@fp-ts/data/Option").Option<Cause<E>>; | ||
export declare const stripSomeDefects: (pf: (defect: unknown) => Option<unknown>) => <E>(self: Cause<E>) => Option<Cause<E>>; | ||
/** | ||
@@ -625,3 +643,3 @@ * @since 1.0.0 | ||
*/ | ||
export declare const find: <E, Z>(pf: (cause: Cause<E>) => import("@fp-ts/data/Option").Option<Z>) => (self: Cause<E>) => import("@fp-ts/data/Option").Option<Z>; | ||
export declare const find: <E, Z>(pf: (cause: Cause<E>) => Option<Z>) => (self: Cause<E>) => Option<Z>; | ||
/** | ||
@@ -648,3 +666,3 @@ * Filters causes which match the provided predicate out of the specified cause. | ||
*/ | ||
export declare const reduce: <Z, E>(zero: Z, pf: (accumulator: Z, cause: Cause<E>) => import("@fp-ts/data/Option").Option<Z>) => (self: Cause<E>) => Z; | ||
export declare const reduce: <Z, E>(zero: Z, pf: (accumulator: Z, cause: Cause<E>) => Option<Z>) => (self: Cause<E>) => Z; | ||
/** | ||
@@ -734,2 +752,16 @@ * Reduces the specified cause into a value of type `Z` using a `Cause.Reducer`. | ||
export declare const pretty: <E>(renderer?: CauseRenderer<E>) => (self: Cause<E>) => string; | ||
/** | ||
* Checks if an annotation is a StackAnnotation | ||
* | ||
* @since 1.0.0 | ||
* @category guards | ||
*/ | ||
export declare const isStackAnnotation: (u: unknown) => u is Cause.StackAnnotation; | ||
/** | ||
* Removes any annotation from the cause | ||
* | ||
* @since 1.0.0 | ||
* @category filtering | ||
*/ | ||
export declare const unannotate: <E>(cause: Cause<E>) => Cause<E>; | ||
//# sourceMappingURL=Cause.d.ts.map |
26
Cause.js
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.pretty = exports.parallel = exports.match = exports.map = exports.linearize = exports.keepDefects = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.isAnnotatedType = exports.interruptors = exports.interruptOption = exports.interrupt = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.dieOption = exports.die = exports.defects = exports.defaultRenderer = exports.contains = exports.as = exports.annotated = exports.StackAnnotationTypeId = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0; | ||
exports.unannotate = exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.pretty = exports.parallel = exports.match = exports.map = exports.linearize = exports.keepDefects = exports.isStackAnnotation = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.isAnnotatedType = exports.interruptors = exports.interruptOption = exports.interrupt = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.dieOption = exports.die = exports.defects = exports.defaultRenderer = exports.contains = exports.as = exports.annotated = exports.StackAnnotationTypeId = exports.SpanAnnotationTypeId = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/cause")); | ||
@@ -53,2 +53,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
/** | ||
* @since 1.0.0 | ||
* @category symbols | ||
*/ | ||
exports.StackAnnotationTypeId = StackAnnotationTypeId; | ||
const SpanAnnotationTypeId = internal.SpanAnnotationTypeId; | ||
/** | ||
* Constructs a new `Empty` cause. | ||
@@ -59,3 +65,3 @@ * | ||
*/ | ||
exports.StackAnnotationTypeId = StackAnnotationTypeId; | ||
exports.SpanAnnotationTypeId = SpanAnnotationTypeId; | ||
const empty = internal.empty; | ||
@@ -515,3 +521,19 @@ /** | ||
const pretty = internal.pretty; | ||
/** | ||
* Checks if an annotation is a StackAnnotation | ||
* | ||
* @since 1.0.0 | ||
* @category guards | ||
*/ | ||
exports.pretty = pretty; | ||
const isStackAnnotation = internal.isStackAnnotation; | ||
/** | ||
* Removes any annotation from the cause | ||
* | ||
* @since 1.0.0 | ||
* @category filtering | ||
*/ | ||
exports.isStackAnnotation = isStackAnnotation; | ||
const unannotate = internal.unannotate; | ||
exports.unannotate = unannotate; | ||
//# sourceMappingURL=Cause.js.map |
@@ -51,6 +51,2 @@ /** | ||
/** | ||
* Sets a limit on how many span traces should be rendered. | ||
*/ | ||
traceSpanLimit: number; | ||
/** | ||
* Enables debug logging of execution traces. | ||
@@ -57,0 +53,0 @@ */ |
13
Debug.js
@@ -14,13 +14,12 @@ "use strict"; | ||
logLevelOverride: undefined, | ||
traceExecutionEnabled: false, | ||
traceExecutionLogEnabled: false, | ||
traceExecutionEnabledInCause: false, | ||
traceSpanEnabledInCause: false, | ||
traceStackEnabledInCause: false, | ||
traceExecutionEnabled: true, | ||
traceExecutionLogEnabled: true, | ||
traceExecutionEnabledInCause: true, | ||
traceSpanEnabledInCause: true, | ||
traceStackEnabledInCause: true, | ||
traceExecutionLimit: 5, | ||
traceStackLimit: 5, | ||
traceSpanLimit: 5, | ||
traceExtractor: undefined, | ||
traceFilter: () => true, | ||
traceEnabled: false, | ||
traceEnabled: true, | ||
traceExecutionHook: [] | ||
@@ -27,0 +26,0 @@ }; |
@@ -47,2 +47,3 @@ /** | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -55,2 +56,3 @@ * @category constructors | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -63,2 +65,3 @@ * @category constructors | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -71,2 +74,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -80,2 +84,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -89,2 +94,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -98,2 +104,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -107,2 +114,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -116,2 +124,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -125,2 +134,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -135,2 +145,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -144,6 +155,7 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
export declare const interruptAs: (fiberId: FiberId.FiberId) => <E, A>(self: Deferred<E, A>) => import("./Effect").Effect<never, never, boolean>; | ||
export declare const interruptWith: (fiberId: FiberId.FiberId) => <E, A>(self: Deferred<E, A>) => import("./Effect").Effect<never, never, boolean>; | ||
/** | ||
@@ -153,2 +165,3 @@ * Exits the `Deferred` with the specified `Exit` value, which will be | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -162,2 +175,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -171,2 +185,3 @@ * @category getters | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -182,2 +197,3 @@ * @category getters | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -194,2 +210,3 @@ * @category getters | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -203,2 +220,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -205,0 +223,0 @@ * @category mutations |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.unsafeMake = exports.unsafeDone = exports.sync = exports.succeed = exports.poll = exports.makeAs = exports.make = exports.isDone = exports.interruptAs = exports.interrupt = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.done = exports.dieSync = exports.die = exports.completeWith = exports.complete = exports.await = exports.DeferredTypeId = void 0; | ||
exports.unsafeMake = exports.unsafeDone = exports.sync = exports.succeed = exports.poll = exports.makeAs = exports.make = exports.isDone = exports.interruptWith = exports.interrupt = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.done = exports.dieSync = exports.die = exports.completeWith = exports.complete = exports.await = exports.DeferredTypeId = void 0; | ||
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core")); | ||
@@ -20,2 +20,3 @@ var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/deferred")); | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -25,6 +26,7 @@ * @category constructors | ||
exports.DeferredTypeId = DeferredTypeId; | ||
const make = core.makeDeferred; | ||
const make = core.deferredMake; | ||
/** | ||
* Creates a new `Deferred` from the specified `FiberId`. | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -34,6 +36,7 @@ * @category constructors | ||
exports.make = make; | ||
const makeAs = core.makeAsDeferred; | ||
const makeAs = core.deferredMakeAs; | ||
/** | ||
* Completes the `Deferred` with the specified value. | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -43,6 +46,7 @@ * @category mutations | ||
exports.makeAs = makeAs; | ||
const succeed = core.succeedDeferred; | ||
const succeed = core.deferredSucceed; | ||
/** | ||
* Completes the `Deferred` with the specified value. | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -52,3 +56,3 @@ * @category mutations | ||
exports.succeed = succeed; | ||
const sync = core.syncDeferred; | ||
const sync = core.deferredSync; | ||
/** | ||
@@ -58,2 +62,3 @@ * Fails the `Deferred` with the specified error, which will be propagated to | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -63,3 +68,3 @@ * @category mutations | ||
exports.sync = sync; | ||
const fail = core.failDeferred; | ||
const fail = core.deferredFail; | ||
/** | ||
@@ -69,2 +74,3 @@ * Fails the `Deferred` with the specified error, which will be propagated to | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -74,3 +80,3 @@ * @category mutations | ||
exports.fail = fail; | ||
const failSync = core.failSyncDeferred; | ||
const failSync = core.deferredFailSync; | ||
/** | ||
@@ -80,2 +86,3 @@ * Fails the `Deferred` with the specified `Cause`, which will be propagated to | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -85,3 +92,3 @@ * @category mutations | ||
exports.failSync = failSync; | ||
const failCause = core.failCauseDeferred; | ||
const failCause = core.deferredFailCause; | ||
/** | ||
@@ -91,2 +98,3 @@ * Fails the `Deferred` with the specified `Cause`, which will be propagated to | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -96,3 +104,3 @@ * @category mutations | ||
exports.failCause = failCause; | ||
const failCauseSync = core.failCauseSyncDeferred; | ||
const failCauseSync = core.deferredFailCauseSync; | ||
/** | ||
@@ -102,2 +110,3 @@ * Kills the `Deferred` with the specified defect, which will be propagated to | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -107,3 +116,3 @@ * @category mutations | ||
exports.failCauseSync = failCauseSync; | ||
const die = core.dieDeferred; | ||
const die = core.deferredDie; | ||
/** | ||
@@ -113,2 +122,3 @@ * Kills the `Deferred` with the specified defect, which will be propagated to | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -118,3 +128,3 @@ * @category mutations | ||
exports.die = die; | ||
const dieSync = core.dieSyncDeferred; | ||
const dieSync = core.deferredDieSync; | ||
/** | ||
@@ -125,2 +135,3 @@ * Completes the `Deferred` with interruption. This will interrupt all fibers | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -130,3 +141,3 @@ * @category mutations | ||
exports.dieSync = dieSync; | ||
const interrupt = core.interruptDeferred; | ||
const interrupt = core.deferredInterrupt; | ||
/** | ||
@@ -136,2 +147,3 @@ * Completes the `Deferred` with interruption. This will interrupt all fibers | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -141,3 +153,3 @@ * @category mutations | ||
exports.interrupt = interrupt; | ||
const interruptAs = core.interruptAsDeferred; | ||
const interruptWith = core.deferredInterruptWith; | ||
/** | ||
@@ -147,7 +159,8 @@ * Exits the `Deferred` with the specified `Exit` value, which will be | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
exports.interruptAs = interruptAs; | ||
const done = core.doneDeferred; | ||
exports.interruptWith = interruptWith; | ||
const done = core.deferredDone; | ||
/** | ||
@@ -157,2 +170,3 @@ * Returns `true` if this `Deferred` has already been completed with a value or | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -162,3 +176,3 @@ * @category getters | ||
exports.done = done; | ||
const isDone = core.isDoneDeferred; | ||
const isDone = core.deferredIsDone; | ||
/** | ||
@@ -168,2 +182,3 @@ * Returns a `Some<Effect<R, E, A>>` from the `Deferred` if this `Deferred` has | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -173,5 +188,5 @@ * @category getters | ||
exports.isDone = isDone; | ||
const poll = core.pollDeferred; | ||
const poll = core.deferredPoll; | ||
exports.poll = poll; | ||
const _await = core.awaitDeferred; | ||
const _await = core.deferredAwait; | ||
exports.await = _await; | ||
@@ -185,6 +200,7 @@ /** | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
const complete = core.completeDeferred; | ||
const complete = core.deferredComplete; | ||
/** | ||
@@ -194,2 +210,3 @@ * Completes the deferred with the result of the specified effect. If the | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -199,3 +216,3 @@ * @category mutations | ||
exports.complete = complete; | ||
const completeWith = core.completeWithDeferred; | ||
const completeWith = core.deferredCompleteWith; | ||
/** | ||
@@ -208,3 +225,3 @@ * Unsafely creates a new `Deferred` from the specified `FiberId`. | ||
exports.completeWith = completeWith; | ||
const unsafeMake = core.unsafeMakeDeferred; | ||
const unsafeMake = core.deferredUnsafeMake; | ||
/** | ||
@@ -218,4 +235,4 @@ * Unsafely exits the `Deferred` with the specified `Exit` value, which will be | ||
exports.unsafeMake = unsafeMake; | ||
const unsafeDone = core.unsafeDoneDeferred; | ||
const unsafeDone = core.deferredUnsafeDone; | ||
exports.unsafeDone = unsafeDone; | ||
//# sourceMappingURL=Deferred.js.map |
@@ -302,2 +302,9 @@ /** | ||
export declare const zipWith: <E, E1, A, B, C>(that: Exit<E1, B>, f: (a: A, b: B) => C, g: (c: Cause.Cause<E>, c1: Cause.Cause<E1>) => Cause.Cause<E | E1>) => (self: Exit<E, A>) => Exit<E | E1, C>; | ||
/** | ||
* Removes any annotation from the failure cause | ||
* | ||
* @since 1.0.0 | ||
* @category filtering | ||
*/ | ||
export declare const unannotate: <E, A>(exit: Exit<E, A>) => Exit<E, A>; | ||
//# sourceMappingURL=Exit.d.ts.map |
10
Exit.js
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.zipWith = exports.zipRight = exports.zipParRight = exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zip = exports.unit = exports.succeed = exports.matchEffect = exports.match = exports.mapErrorCause = exports.mapError = exports.mapBoth = exports.map = exports.isSuccess = exports.isInterrupted = exports.isFailure = exports.isExit = exports.interrupt = exports.getOrElse = exports.fromOption = exports.fromEither = exports.forEachEffect = exports.flatten = exports.flatMapEffect = exports.flatMap = exports.failCause = exports.fail = exports.exists = exports.die = exports.collectAllPar = exports.collectAll = exports.causeOption = exports.asUnit = exports.as = void 0; | ||
exports.zipWith = exports.zipRight = exports.zipParRight = exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zip = exports.unit = exports.unannotate = exports.succeed = exports.matchEffect = exports.match = exports.mapErrorCause = exports.mapError = exports.mapBoth = exports.map = exports.isSuccess = exports.isInterrupted = exports.isFailure = exports.isExit = exports.interrupt = exports.getOrElse = exports.fromOption = exports.fromEither = exports.forEachEffect = exports.flatten = exports.flatMapEffect = exports.flatMap = exports.failCause = exports.fail = exports.exists = exports.die = exports.collectAllPar = exports.collectAll = exports.causeOption = exports.asUnit = exports.as = void 0; | ||
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core")); | ||
@@ -311,3 +311,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
const zipWith = core.exitZipWith; | ||
/** | ||
* Removes any annotation from the failure cause | ||
* | ||
* @since 1.0.0 | ||
* @category filtering | ||
*/ | ||
exports.zipWith = zipWith; | ||
const unannotate = core.exitUnannotate; | ||
exports.unannotate = unannotate; | ||
//# sourceMappingURL=Exit.js.map |
@@ -257,3 +257,3 @@ /** | ||
*/ | ||
export declare const collectAll: typeof fiberRuntime.collectAll; | ||
export declare const collectAll: typeof fiberRuntime.fiberCollectAll; | ||
/** | ||
@@ -260,0 +260,0 @@ * A fiber that is done with the specified `Exit` value. |
10
Fiber.js
@@ -65,3 +65,3 @@ "use strict"; | ||
*/ | ||
const awaitAll = fiberRuntime.awaitAll; | ||
const awaitAll = fiberRuntime.fiberAwaitAll; | ||
/** | ||
@@ -85,3 +85,3 @@ * Retrieves the immediate children of the fiber. | ||
exports.children = children; | ||
const collectAll = fiberRuntime.collectAll; | ||
const collectAll = fiberRuntime.fiberCollectAll; | ||
/** | ||
@@ -215,3 +215,3 @@ * A fiber that is done with the specified `Exit` value. | ||
exports.interruptAllWith = interruptAllWith; | ||
const interruptFork = fiberRuntime.interruptFork; | ||
const interruptFork = fiberRuntime.fiberInterruptFork; | ||
/** | ||
@@ -240,3 +240,3 @@ * Joins the fiber, which suspends the joining fiber until the result of the | ||
exports.join = join; | ||
const joinAll = fiberRuntime.joinAll; | ||
const joinAll = fiberRuntime.fiberJoinAll; | ||
/** | ||
@@ -341,3 +341,3 @@ * Maps over the value the Fiber computes. | ||
exports.roots = roots; | ||
const scoped = fiberRuntime.scoped; | ||
const scoped = fiberRuntime.fiberScoped; | ||
/** | ||
@@ -344,0 +344,0 @@ * Returns the `FiberStatus` of a `RuntimeFiber`. |
@@ -1,4 +0,10 @@ | ||
import type { Equal } from "@fp-ts/data/Equal"; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
import * as internal from "@effect/io/internal/fiberId"; | ||
import type * as Equal from "@fp-ts/data/Equal"; | ||
import type * as HashSet from "@fp-ts/data/HashSet"; | ||
import type * as Option from "@fp-ts/data/Option"; | ||
/** | ||
* @since 1.0.0 | ||
* @category symbols | ||
@@ -21,5 +27,5 @@ */ | ||
*/ | ||
export interface None extends Equal { | ||
export interface None extends Equal.Equal { | ||
readonly [FiberIdTypeId]: FiberIdTypeId; | ||
readonly _tag: "None"; | ||
readonly op: internal.OP_NONE; | ||
} | ||
@@ -30,5 +36,5 @@ /** | ||
*/ | ||
export interface Runtime extends Equal { | ||
export interface Runtime extends Equal.Equal { | ||
readonly [FiberIdTypeId]: FiberIdTypeId; | ||
readonly _tag: "Runtime"; | ||
readonly op: internal.OP_RUNTIME; | ||
readonly id: number; | ||
@@ -41,5 +47,5 @@ readonly startTimeMillis: number; | ||
*/ | ||
export interface Composite extends Equal { | ||
export interface Composite extends Equal.Equal { | ||
readonly [FiberIdTypeId]: FiberIdTypeId; | ||
readonly _tag: "Composite"; | ||
readonly op: internal.OP_COMPOSITE; | ||
readonly left: FiberId; | ||
@@ -64,3 +70,4 @@ readonly right: FiberId; | ||
/** | ||
* Determines if the `FiberId` is a `None`. | ||
* Returns `true` if the specified unknown value is a `FiberId`, `false` | ||
* otherwise. | ||
* | ||
@@ -70,6 +77,12 @@ * @since 1.0.0 | ||
*/ | ||
export declare const isFiberId: (self: unknown) => self is FiberId; | ||
/** | ||
* Returns `true` if the `FiberId` is a `None`, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category refinements | ||
*/ | ||
export declare const isNone: (self: FiberId) => self is None; | ||
/** | ||
* Returns `true` if the specified unknown value is a `FiberId`, `false` | ||
* otherwise. | ||
* Returns `true` if the `FiberId` is a `Runtime`, `false` otherwise. | ||
* | ||
@@ -79,4 +92,11 @@ * @since 1.0.0 | ||
*/ | ||
export declare const isFiberId: (self: unknown) => self is FiberId; | ||
export declare const isRuntime: (self: FiberId) => self is Runtime; | ||
/** | ||
* Returns `true` if the `FiberId` is a `Composite`, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category refinements | ||
*/ | ||
export declare const isComposite: (self: FiberId) => self is Composite; | ||
/** | ||
* Combine two `FiberId`s. | ||
@@ -94,3 +114,3 @@ * | ||
*/ | ||
export declare const combineAll: (fiberIds: import("@fp-ts/data/HashSet").HashSet<FiberId>) => FiberId; | ||
export declare const combineAll: (fiberIds: HashSet.HashSet<FiberId>) => FiberId; | ||
/** | ||
@@ -109,3 +129,3 @@ * Returns this `FiberId` if it is not `None`, otherwise returns that `FiberId`. | ||
*/ | ||
export declare const ids: (self: FiberId) => import("@fp-ts/data/HashSet").HashSet<number>; | ||
export declare const ids: (self: FiberId) => HashSet.HashSet<number>; | ||
/** | ||
@@ -119,9 +139,2 @@ * Creates a new `FiberId`. | ||
/** | ||
* Unsafely creates a new `FiberId`. | ||
* | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
export declare const unsafeMake: () => Runtime; | ||
/** | ||
* Creates a string representing the name of the current thread of execution | ||
@@ -140,3 +153,3 @@ * represented by the specified `FiberId`. | ||
*/ | ||
export declare const toOption: (self: FiberId) => import("@fp-ts/data/Option").Option<FiberId>; | ||
export declare const toOption: (self: FiberId) => Option.Option<FiberId>; | ||
/** | ||
@@ -148,3 +161,10 @@ * Convert a `FiberId` into a `HashSet<FiberId>`. | ||
*/ | ||
export declare const toSet: (self: FiberId) => import("@fp-ts/data/HashSet").HashSet<Runtime>; | ||
export declare const toSet: (self: FiberId) => HashSet.HashSet<Runtime>; | ||
/** | ||
* Unsafely creates a new `FiberId`. | ||
* | ||
* @since 1.0.0 | ||
* @category unsafe | ||
*/ | ||
export declare const unsafeMake: () => Runtime; | ||
//# sourceMappingURL=Id.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.unsafeMake = exports.toSet = exports.toOption = exports.threadName = exports.runtime = exports.none = exports.make = exports.isNone = exports.isFiberId = exports.ids = exports.getOrElse = exports.composite = exports.combineAll = exports.combine = exports.FiberIdTypeId = void 0; | ||
exports.unsafeMake = exports.toSet = exports.toOption = exports.threadName = exports.runtime = exports.none = exports.make = exports.isRuntime = exports.isNone = exports.isFiberId = exports.isComposite = exports.ids = exports.getOrElse = exports.composite = exports.combineAll = exports.combine = exports.FiberIdTypeId = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/fiberId")); | ||
@@ -39,3 +39,4 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
/** | ||
* Determines if the `FiberId` is a `None`. | ||
* Returns `true` if the specified unknown value is a `FiberId`, `false` | ||
* otherwise. | ||
* | ||
@@ -46,6 +47,13 @@ * @since 1.0.0 | ||
exports.composite = composite; | ||
const isFiberId = internal.isFiberId; | ||
/** | ||
* Returns `true` if the `FiberId` is a `None`, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category refinements | ||
*/ | ||
exports.isFiberId = isFiberId; | ||
const isNone = internal.isNone; | ||
/** | ||
* Returns `true` if the specified unknown value is a `FiberId`, `false` | ||
* otherwise. | ||
* Returns `true` if the `FiberId` is a `Runtime`, `false` otherwise. | ||
* | ||
@@ -56,4 +64,12 @@ * @since 1.0.0 | ||
exports.isNone = isNone; | ||
const isFiberId = internal.isFiberId; | ||
const isRuntime = internal.isRuntime; | ||
/** | ||
* Returns `true` if the `FiberId` is a `Composite`, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category refinements | ||
*/ | ||
exports.isRuntime = isRuntime; | ||
const isComposite = internal.isComposite; | ||
/** | ||
* Combine two `FiberId`s. | ||
@@ -64,3 +80,3 @@ * | ||
*/ | ||
exports.isFiberId = isFiberId; | ||
exports.isComposite = isComposite; | ||
const combine = internal.combine; | ||
@@ -100,10 +116,2 @@ /** | ||
/** | ||
* Unsafely creates a new `FiberId`. | ||
* | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
exports.make = make; | ||
const unsafeMake = internal.unsafeMake; | ||
/** | ||
* Creates a string representing the name of the current thread of execution | ||
@@ -115,3 +123,3 @@ * represented by the specified `FiberId`. | ||
*/ | ||
exports.unsafeMake = unsafeMake; | ||
exports.make = make; | ||
const threadName = internal.threadName; | ||
@@ -134,3 +142,11 @@ /** | ||
const toSet = internal.toSet; | ||
/** | ||
* Unsafely creates a new `FiberId`. | ||
* | ||
* @since 1.0.0 | ||
* @category unsafe | ||
*/ | ||
exports.toSet = toSet; | ||
const unsafeMake = internal.unsafeMake; | ||
exports.unsafeMake = unsafeMake; | ||
//# sourceMappingURL=Id.js.map |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type * as RuntimeFlagsPatch from "@effect/io/Fiber/Runtime/Flags/Patch"; | ||
import type * as Differ from "@fp-ts/data/Differ"; | ||
/** | ||
@@ -26,7 +28,2 @@ * Represents a set of `RuntimeFlag`s. `RuntimeFlag`s affect the operation of | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
export declare const make: (...flags: ReadonlyArray<RuntimeFlag>) => RuntimeFlags; | ||
/** | ||
* No runtime flags. | ||
@@ -105,20 +102,32 @@ * | ||
/** | ||
* Returns `true` if the `CooperativeYielding` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category constructors | ||
* @category getters | ||
*/ | ||
export declare const none: RuntimeFlags; | ||
export declare const cooperativeYielding: (self: RuntimeFlags) => boolean; | ||
/** | ||
* Enables the specified `RuntimeFlag`. | ||
* Returns `true` if the `CurrentFiber` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category mutations | ||
* @category getters | ||
*/ | ||
export declare const enable: (flag: RuntimeFlag) => (self: RuntimeFlags) => RuntimeFlags; | ||
export declare const currentFiber: (self: RuntimeFlags) => boolean; | ||
/** | ||
* Enables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. | ||
* Creates a `RuntimeFlagsPatch` which describes the difference between `self` | ||
* and `that`. | ||
* | ||
* @since 1.0.0 | ||
* @category diffing | ||
*/ | ||
export declare const diff: (that: RuntimeFlags) => (self: RuntimeFlags) => RuntimeFlagsPatch.RuntimeFlagsPatch; | ||
/** | ||
* Constructs a differ that knows how to diff `RuntimeFlags` values. | ||
* | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
export declare const enableAll: (flags: RuntimeFlags) => (self: RuntimeFlags) => RuntimeFlags; | ||
export declare const differ: () => Differ.Differ<RuntimeFlags, RuntimeFlagsPatch.RuntimeFlagsPatch>; | ||
/** | ||
@@ -139,17 +148,17 @@ * Disables the specified `RuntimeFlag`. | ||
/** | ||
* Returns `true` if the specified `RuntimeFlag` is enabled, `false` otherwise. | ||
* Enables the specified `RuntimeFlag`. | ||
* | ||
* @since 1.0.0 | ||
* @category elements | ||
* @category mutations | ||
*/ | ||
export declare const isEnabled: (flag: RuntimeFlag) => (self: RuntimeFlags) => boolean; | ||
export declare const enable: (flag: RuntimeFlag) => (self: RuntimeFlags) => RuntimeFlags; | ||
/** | ||
* Returns `true` if the specified `RuntimeFlag` is disabled, `false` otherwise. | ||
* Enables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. | ||
* | ||
* @since 1.0.0 | ||
* @category elements | ||
* @category mutations | ||
*/ | ||
export declare const isDisabled: (flag: RuntimeFlag) => (self: RuntimeFlags) => boolean; | ||
export declare const enableAll: (flags: RuntimeFlags) => (self: RuntimeFlags) => RuntimeFlags; | ||
/** | ||
* Returns `true` if the `Interruption` `RuntimeFlag` is enabled, `false` | ||
* Returns `true` if the `FiberRoots` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
@@ -160,13 +169,17 @@ * | ||
*/ | ||
export declare const interruption: (self: RuntimeFlags) => boolean; | ||
export declare const fiberRoots: (self: RuntimeFlags) => boolean; | ||
/** | ||
* Returns `true` if the `CurrentFiber` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* Returns true only if the `Interruption` flag is **enabled** and the | ||
* `WindDown` flag is **disabled**. | ||
* | ||
* A fiber is said to be interruptible if interruption is enabled and the fiber | ||
* is not in its wind-down phase, in which it takes care of cleanup activities | ||
* related to fiber shutdown. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
*/ | ||
export declare const currentFiber: (self: RuntimeFlags) => boolean; | ||
export declare const interruptible: (self: RuntimeFlags) => boolean; | ||
/** | ||
* Returns `true` if the `OpSupervision` `RuntimeFlag` is enabled, `false` | ||
* Returns `true` if the `Interruption` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
@@ -177,70 +190,58 @@ * | ||
*/ | ||
export declare const opSupervision: (self: RuntimeFlags) => boolean; | ||
export declare const interruption: (self: RuntimeFlags) => boolean; | ||
/** | ||
* Returns `true` if the `RuntimeMetrics` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* Returns `true` if the specified `RuntimeFlag` is enabled, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category elements | ||
*/ | ||
export declare const runtimeMetrics: (self: RuntimeFlags) => boolean; | ||
export declare const isEnabled: (flag: RuntimeFlag) => (self: RuntimeFlags) => boolean; | ||
/** | ||
* Returns `true` if the `FiberRoots` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* Returns `true` if the specified `RuntimeFlag` is disabled, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category elements | ||
*/ | ||
export declare const fiberRoots: (self: RuntimeFlags) => boolean; | ||
export declare const isDisabled: (flag: RuntimeFlag) => (self: RuntimeFlags) => boolean; | ||
/** | ||
* Returns `true` if the `WindDown` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category constructors | ||
*/ | ||
export declare const windDown: (self: RuntimeFlags) => boolean; | ||
export declare const make: (...flags: ReadonlyArray<RuntimeFlag>) => RuntimeFlags; | ||
/** | ||
* Returns `true` if the `CooperativeYielding` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category constructors | ||
*/ | ||
export declare const cooperativeYielding: (self: RuntimeFlags) => boolean; | ||
export declare const none: RuntimeFlags; | ||
/** | ||
* Returns true only if the `Interruption` flag is **enabled** and the | ||
* `WindDown` flag is **disabled**. | ||
* Returns `true` if the `OpSupervision` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* A fiber is said to be interruptible if interruption is enabled and the fiber | ||
* is not in its wind-down phase, in which it takes care of cleanup activities | ||
* related to fiber shutdown. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
*/ | ||
export declare const interruptible: (self: RuntimeFlags) => boolean; | ||
export declare const opSupervision: (self: RuntimeFlags) => boolean; | ||
/** | ||
* Creates a `RuntimeFlagsPatch` which describes the difference between `self` | ||
* and `that`. | ||
* Patches a set of `RuntimeFlag`s with a `RuntimeFlagsPatch`, returning the | ||
* patched set of `RuntimeFlag`s. | ||
* | ||
* @since 1.0.0 | ||
* @category diffing | ||
* @category mutations | ||
*/ | ||
export declare const diff: (that: RuntimeFlags) => (self: RuntimeFlags) => import("./Flags/Patch").RuntimeFlagsPatch; | ||
export declare const patch: (patch: RuntimeFlagsPatch.RuntimeFlagsPatch) => (self: RuntimeFlags) => RuntimeFlags; | ||
/** | ||
* Constructs a differ that knows how to diff `RuntimeFlags` values. | ||
* Converts the provided `RuntimeFlags` into a `string`. | ||
* | ||
* @category conversions | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
export declare const differ: () => import("@fp-ts/data/Differ").Differ<RuntimeFlags, import("./Flags/Patch").RuntimeFlagsPatch>; | ||
export declare const render: (self: RuntimeFlags) => string; | ||
/** | ||
* Patches a set of `RuntimeFlag`s with a `RuntimeFlagsPatch`, returning the | ||
* patched set of `RuntimeFlag`s. | ||
* Returns `true` if the `RuntimeMetrics` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category mutations | ||
* @category getters | ||
*/ | ||
export declare const patch: (patch: import("./Flags/Patch").RuntimeFlagsPatch) => (self: RuntimeFlags) => RuntimeFlags; | ||
export declare const runtimeMetrics: (self: RuntimeFlags) => boolean; | ||
/** | ||
@@ -254,8 +255,9 @@ * Converts the provided `RuntimeFlags` into a `ReadonlySet<number>`. | ||
/** | ||
* Converts the provided `RuntimeFlags` into a `string`. | ||
* Returns `true` if the `WindDown` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @category conversions | ||
* @since 1.0.0 | ||
* @category getters | ||
*/ | ||
export declare const render: (self: RuntimeFlags) => string; | ||
export declare const windDown: (self: RuntimeFlags) => boolean; | ||
//# sourceMappingURL=Flags.d.ts.map |
@@ -11,13 +11,2 @@ "use strict"; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
*/ | ||
const make = (...flags) => { | ||
return flags.reduce((a, b) => a | b, 0); | ||
}; | ||
/** | ||
* No runtime flags. | ||
@@ -28,3 +17,2 @@ * | ||
*/ | ||
exports.make = make; | ||
const None = internal.None; | ||
@@ -105,27 +93,36 @@ /** | ||
/** | ||
* Returns `true` if the `CooperativeYielding` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category constructors | ||
* @category getters | ||
*/ | ||
exports.CooperativeYielding = CooperativeYielding; | ||
const none = /*#__PURE__*/make(None); | ||
const cooperativeYielding = internal.cooperativeYielding; | ||
/** | ||
* Enables the specified `RuntimeFlag`. | ||
* Returns `true` if the `CurrentFiber` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category mutations | ||
* @category getters | ||
*/ | ||
exports.none = none; | ||
const enable = flag => { | ||
return self => self | flag; | ||
}; | ||
exports.cooperativeYielding = cooperativeYielding; | ||
const currentFiber = internal.currentFiber; | ||
/** | ||
* Enables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. | ||
* Creates a `RuntimeFlagsPatch` which describes the difference between `self` | ||
* and `that`. | ||
* | ||
* @since 1.0.0 | ||
* @category diffing | ||
*/ | ||
exports.currentFiber = currentFiber; | ||
const diff = internal.diff; | ||
/** | ||
* Constructs a differ that knows how to diff `RuntimeFlags` values. | ||
* | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
exports.enable = enable; | ||
const enableAll = flags => { | ||
return self => self | flags; | ||
}; | ||
exports.diff = diff; | ||
const differ = internal.differ; | ||
/** | ||
@@ -137,6 +134,4 @@ * Disables the specified `RuntimeFlag`. | ||
*/ | ||
exports.enableAll = enableAll; | ||
const disable = flag => { | ||
return self => self & ~flag; | ||
}; | ||
exports.differ = differ; | ||
const disable = internal.disable; | ||
/** | ||
@@ -149,23 +144,21 @@ * Disables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. | ||
exports.disable = disable; | ||
const disableAll = flags => { | ||
return self => self & ~flags; | ||
}; | ||
const disableAll = internal.disableAll; | ||
/** | ||
* Returns `true` if the specified `RuntimeFlag` is enabled, `false` otherwise. | ||
* Enables the specified `RuntimeFlag`. | ||
* | ||
* @since 1.0.0 | ||
* @category elements | ||
* @category mutations | ||
*/ | ||
exports.disableAll = disableAll; | ||
const isEnabled = internal.isEnabled; | ||
const enable = internal.enable; | ||
/** | ||
* Returns `true` if the specified `RuntimeFlag` is disabled, `false` otherwise. | ||
* Enables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. | ||
* | ||
* @since 1.0.0 | ||
* @category elements | ||
* @category mutations | ||
*/ | ||
exports.isEnabled = isEnabled; | ||
const isDisabled = internal.isDisabled; | ||
exports.enable = enable; | ||
const enableAll = internal.enableAll; | ||
/** | ||
* Returns `true` if the `Interruption` `RuntimeFlag` is enabled, `false` | ||
* Returns `true` if the `FiberRoots` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
@@ -176,19 +169,19 @@ * | ||
*/ | ||
exports.isDisabled = isDisabled; | ||
const interruption = self => { | ||
return isEnabled(Interruption)(self); | ||
}; | ||
exports.enableAll = enableAll; | ||
const fiberRoots = internal.fiberRoots; | ||
/** | ||
* Returns `true` if the `CurrentFiber` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* Returns true only if the `Interruption` flag is **enabled** and the | ||
* `WindDown` flag is **disabled**. | ||
* | ||
* A fiber is said to be interruptible if interruption is enabled and the fiber | ||
* is not in its wind-down phase, in which it takes care of cleanup activities | ||
* related to fiber shutdown. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
*/ | ||
exports.interruption = interruption; | ||
const currentFiber = self => { | ||
return isEnabled(CurrentFiber)(self); | ||
}; | ||
exports.fiberRoots = fiberRoots; | ||
const interruptible = internal.interruptible; | ||
/** | ||
* Returns `true` if the `OpSupervision` `RuntimeFlag` is enabled, `false` | ||
* Returns `true` if the `Interruption` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
@@ -199,91 +192,67 @@ * | ||
*/ | ||
exports.currentFiber = currentFiber; | ||
const opSupervision = self => { | ||
return isEnabled(OpSupervision)(self); | ||
}; | ||
exports.interruptible = interruptible; | ||
const interruption = internal.interruption; | ||
/** | ||
* Returns `true` if the `RuntimeMetrics` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* Returns `true` if the specified `RuntimeFlag` is enabled, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category elements | ||
*/ | ||
exports.opSupervision = opSupervision; | ||
const runtimeMetrics = self => { | ||
return isEnabled(RuntimeMetrics)(self); | ||
}; | ||
exports.interruption = interruption; | ||
const isEnabled = internal.isEnabled; | ||
/** | ||
* Returns `true` if the `FiberRoots` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* Returns `true` if the specified `RuntimeFlag` is disabled, `false` otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category elements | ||
*/ | ||
exports.runtimeMetrics = runtimeMetrics; | ||
const fiberRoots = self => { | ||
return isEnabled(FiberRoots)(self); | ||
}; | ||
exports.isEnabled = isEnabled; | ||
const isDisabled = internal.isDisabled; | ||
/** | ||
* Returns `true` if the `WindDown` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category constructors | ||
*/ | ||
exports.fiberRoots = fiberRoots; | ||
const windDown = self => { | ||
return isEnabled(WindDown)(self); | ||
}; | ||
exports.isDisabled = isDisabled; | ||
const make = internal.make; | ||
/** | ||
* Returns `true` if the `CooperativeYielding` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
* @category constructors | ||
*/ | ||
exports.windDown = windDown; | ||
const cooperativeYielding = self => { | ||
return isEnabled(CooperativeYielding)(self); | ||
}; | ||
exports.make = make; | ||
const none = internal.none; | ||
/** | ||
* Returns true only if the `Interruption` flag is **enabled** and the | ||
* `WindDown` flag is **disabled**. | ||
* Returns `true` if the `OpSupervision` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* A fiber is said to be interruptible if interruption is enabled and the fiber | ||
* is not in its wind-down phase, in which it takes care of cleanup activities | ||
* related to fiber shutdown. | ||
* | ||
* @since 1.0.0 | ||
* @category getters | ||
*/ | ||
exports.cooperativeYielding = cooperativeYielding; | ||
const interruptible = self => { | ||
return interruption(self) && !windDown(self); | ||
}; | ||
exports.none = none; | ||
const opSupervision = internal.opSupervision; | ||
/** | ||
* Creates a `RuntimeFlagsPatch` which describes the difference between `self` | ||
* and `that`. | ||
* Patches a set of `RuntimeFlag`s with a `RuntimeFlagsPatch`, returning the | ||
* patched set of `RuntimeFlag`s. | ||
* | ||
* @since 1.0.0 | ||
* @category diffing | ||
* @category mutations | ||
*/ | ||
exports.interruptible = interruptible; | ||
const diff = internal.diff; | ||
exports.opSupervision = opSupervision; | ||
const patch = internal.patch; | ||
/** | ||
* Constructs a differ that knows how to diff `RuntimeFlags` values. | ||
* Converts the provided `RuntimeFlags` into a `string`. | ||
* | ||
* @category conversions | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
exports.diff = diff; | ||
const differ = internal.differ; | ||
exports.patch = patch; | ||
const render = internal.render; | ||
/** | ||
* Patches a set of `RuntimeFlag`s with a `RuntimeFlagsPatch`, returning the | ||
* patched set of `RuntimeFlag`s. | ||
* Returns `true` if the `RuntimeMetrics` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @since 1.0.0 | ||
* @category mutations | ||
* @category getters | ||
*/ | ||
exports.differ = differ; | ||
const patch = internal.patch; | ||
exports.render = render; | ||
const runtimeMetrics = internal.runtimeMetrics; | ||
/** | ||
@@ -295,13 +264,14 @@ * Converts the provided `RuntimeFlags` into a `ReadonlySet<number>`. | ||
*/ | ||
exports.patch = patch; | ||
exports.runtimeMetrics = runtimeMetrics; | ||
const toSet = internal.toSet; | ||
/** | ||
* Converts the provided `RuntimeFlags` into a `string`. | ||
* Returns `true` if the `WindDown` `RuntimeFlag` is enabled, `false` | ||
* otherwise. | ||
* | ||
* @category conversions | ||
* @since 1.0.0 | ||
* @category getters | ||
*/ | ||
exports.toSet = toSet; | ||
const render = internal.render; | ||
exports.render = render; | ||
const windDown = internal.windDown; | ||
exports.windDown = windDown; | ||
//# sourceMappingURL=Flags.js.map |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type * as RuntimeFlags from "@effect/io/Fiber/Runtime/Flags"; | ||
/** | ||
* @since 1.0.0 | ||
* @category models | ||
@@ -26,3 +30,3 @@ */ | ||
*/ | ||
export declare const enable: (flag: import("../Flags").RuntimeFlag) => RuntimeFlagsPatch; | ||
export declare const enable: (flag: RuntimeFlags.RuntimeFlag) => RuntimeFlagsPatch; | ||
/** | ||
@@ -34,3 +38,3 @@ * Creates a `RuntimeFlagsPatch` describing disabling the provided `RuntimeFlag`. | ||
*/ | ||
export declare const disable: (flag: import("../Flags").RuntimeFlag) => RuntimeFlagsPatch; | ||
export declare const disable: (flag: RuntimeFlags.RuntimeFlag) => RuntimeFlagsPatch; | ||
/** | ||
@@ -58,3 +62,3 @@ * Returns `true` if the specified `RuntimeFlagsPatch` is empty. | ||
*/ | ||
export declare const isEnabled: (flag: import("../Flags").RuntimeFlag) => (self: RuntimeFlagsPatch) => boolean; | ||
export declare const isEnabled: (flag: RuntimeFlags.RuntimeFlag) => (self: RuntimeFlagsPatch) => boolean; | ||
/** | ||
@@ -67,3 +71,3 @@ * Returns `true` if the `RuntimeFlagsPatch` describes the specified | ||
*/ | ||
export declare const isDisabled: (flag: import("../Flags").RuntimeFlag) => (self: RuntimeFlagsPatch) => boolean; | ||
export declare const isDisabled: (flag: RuntimeFlags.RuntimeFlag) => (self: RuntimeFlagsPatch) => boolean; | ||
/** | ||
@@ -108,3 +112,3 @@ * Returns `true` if the `RuntimeFlagsPatch` includes the specified | ||
*/ | ||
export declare const exclude: (flag: import("../Flags").RuntimeFlag) => (self: RuntimeFlagsPatch) => RuntimeFlagsPatch; | ||
export declare const exclude: (flag: RuntimeFlags.RuntimeFlag) => (self: RuntimeFlagsPatch) => RuntimeFlagsPatch; | ||
/** | ||
@@ -125,3 +129,3 @@ * Creates a `RuntimeFlagsPatch` which describes the inverse of the patch | ||
*/ | ||
export declare const enabledSet: (self: RuntimeFlagsPatch) => ReadonlySet<import("../Flags").RuntimeFlag>; | ||
export declare const enabledSet: (self: RuntimeFlagsPatch) => ReadonlySet<RuntimeFlags.RuntimeFlag>; | ||
/** | ||
@@ -134,3 +138,3 @@ * Returns a `ReadonlySet<number>` containing the `RuntimeFlags` described as | ||
*/ | ||
export declare const disabledSet: (self: RuntimeFlagsPatch) => ReadonlySet<import("../Flags").RuntimeFlag>; | ||
export declare const disabledSet: (self: RuntimeFlagsPatch) => ReadonlySet<RuntimeFlags.RuntimeFlag>; | ||
/** | ||
@@ -137,0 +141,0 @@ * Renders the provided `RuntimeFlagsPatch` to a string. |
@@ -12,6 +12,2 @@ "use strict"; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* The empty `RuntimeFlagsPatch`. | ||
@@ -18,0 +14,0 @@ * |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type { FiberId } from "@effect/io/Fiber/Id"; | ||
import type { RuntimeFlags } from "@effect/io/Fiber/Runtime/Flags"; | ||
import type { Equal } from "@fp-ts/data/Equal"; | ||
import type * as FiberId from "@effect/io/Fiber/Id"; | ||
import type * as RuntimeFlags from "@effect/io/Fiber/Runtime/Flags"; | ||
import * as internal from "@effect/io/internal/fiberStatus"; | ||
import type * as Equal from "@fp-ts/data/Equal"; | ||
/** | ||
@@ -26,4 +27,4 @@ * @since 1.0.0 | ||
*/ | ||
export interface Done extends Equal { | ||
readonly _tag: "Done"; | ||
export interface Done extends Equal.Equal { | ||
readonly op: internal.OP_DONE; | ||
readonly [FiberStatusTypeId]: FiberStatusTypeId; | ||
@@ -35,6 +36,6 @@ } | ||
*/ | ||
export interface Running extends Equal { | ||
readonly _tag: "Running"; | ||
export interface Running extends Equal.Equal { | ||
readonly op: internal.OP_RUNNING; | ||
readonly [FiberStatusTypeId]: FiberStatusTypeId; | ||
readonly runtimeFlags: RuntimeFlags; | ||
readonly runtimeFlags: RuntimeFlags.RuntimeFlags; | ||
} | ||
@@ -45,7 +46,7 @@ /** | ||
*/ | ||
export interface Suspended extends Equal { | ||
readonly _tag: "Suspended"; | ||
export interface Suspended extends Equal.Equal { | ||
readonly op: internal.OP_SUSPENDED; | ||
readonly [FiberStatusTypeId]: FiberStatusTypeId; | ||
readonly runtimeFlags: RuntimeFlags; | ||
readonly blockingOn: FiberId; | ||
readonly runtimeFlags: RuntimeFlags.RuntimeFlags; | ||
readonly blockingOn: FiberId.FiberId; | ||
} | ||
@@ -61,3 +62,3 @@ /** | ||
*/ | ||
export declare const running: (runtimeFlags: RuntimeFlags) => FiberStatus; | ||
export declare const running: (runtimeFlags: RuntimeFlags.RuntimeFlags) => FiberStatus; | ||
/** | ||
@@ -67,3 +68,3 @@ * @since 1.0.0 | ||
*/ | ||
export declare const suspended: (runtimeFlags: RuntimeFlags, blockingOn: FiberId) => FiberStatus; | ||
export declare const suspended: (runtimeFlags: RuntimeFlags.RuntimeFlags, blockingOn: FiberId.FiberId) => FiberStatus; | ||
/** | ||
@@ -70,0 +71,0 @@ * Returns `true` if the specified value is a `FiberStatus`, `false` otherwise. |
@@ -76,2 +76,3 @@ /** | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -82,2 +83,3 @@ * @category getters | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -88,2 +90,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -94,2 +97,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -100,2 +104,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -106,2 +111,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -114,2 +120,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -120,2 +127,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -126,2 +134,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -132,2 +141,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -138,2 +148,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -144,2 +155,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -150,2 +162,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -156,2 +169,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -162,2 +176,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -168,2 +183,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -174,2 +190,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -180,2 +197,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -186,2 +204,3 @@ * @category mutations | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -192,2 +211,3 @@ * @category fiberRefs | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -236,3 +256,3 @@ * @category fiberRefs | ||
*/ | ||
export declare const forkScopeOverride: FiberRef<import("@fp-ts/data/Option").Option<import("./Fiber/Scope").FiberScope>>; | ||
export declare const forkScopeOverride: FiberRef<import("@fp-ts/data/Option").Option<import("./internal/fiberScope").FiberScope>>; | ||
/** | ||
@@ -239,0 +259,0 @@ * @since 1.0.0 |
@@ -27,3 +27,3 @@ "use strict"; | ||
exports.FiberRefTypeId = FiberRefTypeId; | ||
const make = fiberRuntime.makeFiberRef; | ||
const make = fiberRuntime.fiberRefMake; | ||
/** | ||
@@ -35,3 +35,3 @@ * @macro traced | ||
exports.make = make; | ||
const makeWith = fiberRuntime.makeWithFiberRef; | ||
const makeWith = fiberRuntime.fiberRefMakeWith; | ||
/** | ||
@@ -43,3 +43,3 @@ * @macro traced | ||
exports.makeWith = makeWith; | ||
const makeEnvironment = fiberRuntime.makeEnvironmentFiberRef; | ||
const makeEnvironment = fiberRuntime.fiberRefMakeEnvironment; | ||
/** | ||
@@ -51,3 +51,3 @@ * @macro traced | ||
exports.makeEnvironment = makeEnvironment; | ||
const makeRuntimeFlags = fiberRuntime.makeRuntimeFlagsFiberRef; | ||
const makeRuntimeFlags = fiberRuntime.fiberRefMakeRuntimeFlags; | ||
/** | ||
@@ -58,3 +58,3 @@ * @since 1.0.0 | ||
exports.makeRuntimeFlags = makeRuntimeFlags; | ||
const unsafeMake = core.unsafeMakeFiberRef; | ||
const unsafeMake = core.fiberRefUnsafeMake; | ||
/** | ||
@@ -65,3 +65,3 @@ * @since 1.0.0 | ||
exports.unsafeMake = unsafeMake; | ||
const unsafeMakeHashSet = core.unsafeMakeHashSetFiberRef; | ||
const unsafeMakeHashSet = core.fiberRefUnsafeMakeHashSet; | ||
/** | ||
@@ -72,3 +72,3 @@ * @since 1.0.0 | ||
exports.unsafeMakeHashSet = unsafeMakeHashSet; | ||
const unsafeMakeEnvironment = core.unsafeMakeEnvironmentFiberRef; | ||
const unsafeMakeEnvironment = core.fiberRefUnsafeMakeEnvironment; | ||
/** | ||
@@ -79,3 +79,3 @@ * @since 1.0.0 | ||
exports.unsafeMakeEnvironment = unsafeMakeEnvironment; | ||
const unsafeMakeSupervisor = fiberRuntime.unsafeMakeSupervisorFiberRef; | ||
const unsafeMakeSupervisor = fiberRuntime.fiberRefUnsafeMakeSupervisor; | ||
/** | ||
@@ -86,4 +86,5 @@ * @since 1.0.0 | ||
exports.unsafeMakeSupervisor = unsafeMakeSupervisor; | ||
const unsafeMakePatch = core.unsafeMakePatchFiberRef; | ||
const unsafeMakePatch = core.fiberRefUnsafeMakePatch; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -93,4 +94,5 @@ * @category getters | ||
exports.unsafeMakePatch = unsafeMakePatch; | ||
const get = core.getFiberRef; | ||
const get = core.fiberRefGet; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -100,4 +102,5 @@ * @category mutations | ||
exports.get = get; | ||
const getAndSet = core.getAndSetFiberRef; | ||
const getAndSet = core.fiberRefGetAndSet; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -107,4 +110,5 @@ * @category mutations | ||
exports.getAndSet = getAndSet; | ||
const getAndUpdate = core.getAndUpdateFiberRef; | ||
const getAndUpdate = core.fiberRefgetAndUpdate; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -114,4 +118,5 @@ * @category mutations | ||
exports.getAndUpdate = getAndUpdate; | ||
const getAndUpdateSome = core.getAndUpdateSomeFiberRef; | ||
const getAndUpdateSome = core.fiberRefGetAndUpdateSome; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -121,4 +126,5 @@ * @category mutations | ||
exports.getAndUpdateSome = getAndUpdateSome; | ||
const getWith = core.getWithFiberRef; | ||
const getWith = core.fiberRefGetWith; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -128,12 +134,14 @@ * @category mutations | ||
exports.getWith = getWith; | ||
const set = core.setFiberRef; | ||
const set = core.fiberRefSet; | ||
exports.set = set; | ||
const _delete = core.deleteFiberRef; | ||
const _delete = core.fiberRefDelete; | ||
exports.delete = _delete; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
* @category mutations | ||
*/ | ||
const reset = core.resetFiberRef; | ||
const reset = core.fiberRefReset; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -143,4 +151,5 @@ * @category mutations | ||
exports.reset = reset; | ||
const modify = core.modifyFiberRef; | ||
const modify = core.fiberRefModify; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -150,4 +159,5 @@ * @category mutations | ||
exports.modify = modify; | ||
const modifySome = core.modifySomeFiberRef; | ||
const modifySome = core.fiberRefModifySome; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -157,4 +167,5 @@ * @category mutations | ||
exports.modifySome = modifySome; | ||
const update = core.updateFiberRef; | ||
const update = core.fiberRefUpdate; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -164,4 +175,5 @@ * @category mutations | ||
exports.update = update; | ||
const updateSome = core.updateSomeFiberRef; | ||
const updateSome = core.fiberRefUpdateSome; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -171,4 +183,5 @@ * @category mutations | ||
exports.updateSome = updateSome; | ||
const updateAndGet = core.updateAndGetFiberRef; | ||
const updateAndGet = core.fiberRefUpdateAndGet; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -178,4 +191,5 @@ * @category mutations | ||
exports.updateAndGet = updateAndGet; | ||
const updateSomeAndGet = core.updateSomeAndGetFiberRef; | ||
const updateSomeAndGet = core.fiberRefUpdateSomeAndGet; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -185,4 +199,5 @@ * @category mutations | ||
exports.updateSomeAndGet = updateSomeAndGet; | ||
const locally = core.locallyFiberRef; | ||
const locally = core.fiberRefLocally; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -192,4 +207,5 @@ * @category mutations | ||
exports.locally = locally; | ||
const locallyWith = core.locallyWithFiberRef; | ||
const locallyWith = core.fiberRefLocallyWith; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -199,4 +215,5 @@ * @category mutations | ||
exports.locallyWith = locallyWith; | ||
const locallyScoped = fiberRuntime.locallyScopedFiberRef; | ||
const locallyScoped = fiberRuntime.fiberRefLocallyScoped; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -206,4 +223,5 @@ * @category mutations | ||
exports.locallyScoped = locallyScoped; | ||
const locallyScopedWith = fiberRuntime.locallyScopedFiberRef; | ||
const locallyScopedWith = fiberRuntime.fiberRefLocallyScoped; | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -215,2 +233,3 @@ * @category fiberRefs | ||
/** | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -217,0 +236,0 @@ * @category fiberRefs |
@@ -30,3 +30,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(manual(acquire), core.tap(manual => fiberRuntime.acquireRelease((0, _Function.pipe)(refresh(manual), _schedule.schedule_Effect(policy), core.interruptible, fiberRuntime.forkDaemon), core.interruptFiber))).traced(trace); | ||
return core.tap(manual => fiberRuntime.acquireRelease(fiberRuntime.forkDaemon(core.interruptible(_schedule.schedule_Effect(policy)(refresh(manual)))), core.interruptFiber))(manual(acquire)).traced(trace); | ||
} | ||
@@ -36,3 +36,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.environment(), core.flatMap(env => (0, _Function.pipe)(scopedRef.fromAcquire(core.exit(acquire)), core.map(ref => ({ | ||
return core.flatMap(env => core.map(ref => ({ | ||
[CachedTypeId]: cachedVariance, | ||
@@ -42,5 +42,5 @@ scopedRef: ref, | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(acquire, core.provideEnvironment(env)).traced(trace); | ||
return core.provideEnvironment(env)(acquire).traced(trace); | ||
} | ||
}))))).traced(trace); | ||
}))(scopedRef.fromAcquire(core.exit(acquire))))(core.environment()).traced(trace); | ||
}; | ||
@@ -51,3 +51,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(scopedRef.get(self.scopedRef), core.flatMap(core.done)).traced(trace); | ||
return core.flatMap(core.done)(scopedRef.get(self.scopedRef)).traced(trace); | ||
}; | ||
@@ -57,5 +57,5 @@ exports.get = get; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.scopedRef, scopedRef.set((0, _Function.pipe)(self.acquire(), core.map(core.exitSucceed)))).traced(trace); | ||
return scopedRef.set(core.map(core.exitSucceed)(self.acquire()))(self.scopedRef).traced(trace); | ||
}; | ||
exports.refresh = refresh; | ||
//# sourceMappingURL=cached.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.pretty = exports.parallel = exports.match = exports.map = exports.linearize = exports.keepDefects = exports.isStackAnnotation = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInvalidCapacityError = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.isAnnotatedType = exports.interruptors = exports.interruptOption = exports.interrupt = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.dieOption = exports.die = exports.defects = exports.defaultRenderer = exports.contains = exports.as = exports.annotated = exports.StackAnnotationTypeId = exports.StackAnnotation = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InvalidHubCapacityException = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0; | ||
exports.unannotate = exports.stripSomeDefects = exports.stripFailures = exports.squashWith = exports.squash = exports.size = exports.sequential = exports.reduceWithContext = exports.reduce = exports.pretty = exports.parallel = exports.match = exports.map = exports.linearize = exports.keepDefects = exports.isStackAnnotation = exports.isSpanAnnotation = exports.isSequentialType = exports.isRuntimeException = exports.isParallelType = exports.isNoSuchElementException = exports.isInvalidCapacityError = exports.isInterruptedOnly = exports.isInterruptedException = exports.isInterrupted = exports.isInterruptType = exports.isIllegalArgumentException = exports.isFailure = exports.isFailType = exports.isEmptyType = exports.isEmpty = exports.isDieType = exports.isDie = exports.isCause = exports.isAnnotatedType = exports.interruptors = exports.interruptOption = exports.interrupt = exports.flatten = exports.flatMap = exports.find = exports.filter = exports.failures = exports.failureOrCause = exports.failureOption = exports.fail = exports.empty = exports.dieOption = exports.die = exports.defects = exports.defaultRenderer = exports.contains = exports.as = exports.annotated = exports.StackAnnotationTypeId = exports.StackAnnotation = exports.SpanAnnotationTypeId = exports.SpanAnnotation = exports.RuntimeExceptionTypeId = exports.RuntimeException = exports.NoSuchElementExceptionTypeId = exports.NoSuchElementException = exports.InvalidHubCapacityExceptionTypeId = exports.InvalidHubCapacityException = exports.InterruptedExceptionTypeId = exports.InterruptedException = exports.IllegalArgumentExceptionTypeId = exports.IllegalArgumentException = exports.CauseTypeId = void 0; | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Debug")); | ||
@@ -12,3 +12,2 @@ var FiberId = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Fiber/Id")); | ||
var _stack = /*#__PURE__*/require("@effect/io/internal/stack"); | ||
var Tracer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Tracer")); | ||
var Doc = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/Doc")); | ||
@@ -28,3 +27,3 @@ var Optimize = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/Optimize")); | ||
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, _b, _c, _d, _e, _f; | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
// ----------------------------------------------------------------------------- | ||
@@ -46,3 +45,3 @@ // Models | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(CauseSymbolKey), Equal.hashCombine(Equal.hash(flattenCause(this)))); | ||
return Equal.hashCombine(Equal.hash(flattenCause(this)))(Equal.hash(CauseSymbolKey)); | ||
}, | ||
@@ -212,3 +211,3 @@ [Equal.symbolEqual](that) { | ||
const failures = self => { | ||
return List.reverse(reduce(List.empty(), (list, cause) => cause._tag === "Fail" ? Option.some((0, _Function.pipe)(list, List.prepend(cause.error))) : Option.none)(self)); | ||
return List.reverse(reduce(List.empty(), (list, cause) => cause._tag === "Fail" ? Option.some(List.prepend(cause.error)(list)) : Option.none)(self)); | ||
}; | ||
@@ -218,3 +217,3 @@ /** @internal */ | ||
const defects = self => { | ||
return List.reverse(reduce(List.empty(), (list, cause) => cause._tag === "Die" ? Option.some((0, _Function.pipe)(list, List.prepend(cause.defect))) : Option.none)(self)); | ||
return List.reverse(reduce(List.empty(), (list, cause) => cause._tag === "Die" ? Option.some(List.prepend(cause.defect)(list)) : Option.none)(self)); | ||
}; | ||
@@ -224,3 +223,3 @@ /** @internal */ | ||
const interruptors = self => { | ||
return reduce(HashSet.empty(), (set, cause) => cause._tag === "Interrupt" ? Option.some((0, _Function.pipe)(set, HashSet.add(cause.fiberId))) : Option.none)(self); | ||
return reduce(HashSet.empty(), (set, cause) => cause._tag === "Interrupt" ? Option.some(HashSet.add(cause.fiberId)(set)) : Option.none)(self); | ||
}; | ||
@@ -261,3 +260,3 @@ /** @internal */ | ||
const keepDefects = self => { | ||
return match(Option.none, () => Option.none, defect => Option.some(die(defect)), () => Option.none, (option, annotation) => (0, _Function.pipe)(option, Option.map(cause => annotated(cause, annotation))), (left, right) => { | ||
return match(Option.none, () => Option.none, defect => Option.some(die(defect)), () => Option.none, (option, annotation) => Option.map(cause => annotated(cause, annotation))(option), (left, right) => { | ||
if (Option.isSome(left) && Option.isSome(right)) { | ||
@@ -289,3 +288,3 @@ return Option.some(sequential(left.value, right.value)); | ||
const linearize = self => { | ||
return match(HashSet.empty(), error => HashSet.make(fail(error)), defect => HashSet.make(die(defect)), fiberId => HashSet.make(interrupt(fiberId)), (set, annotation) => (0, _Function.pipe)(set, HashSet.map(cause => annotated(cause, annotation))), (leftSet, rightSet) => (0, _Function.pipe)(leftSet, HashSet.flatMap(leftCause => (0, _Function.pipe)(rightSet, HashSet.map(rightCause => sequential(leftCause, rightCause))))), (leftSet, rightSet) => (0, _Function.pipe)(leftSet, HashSet.flatMap(leftCause => (0, _Function.pipe)(rightSet, HashSet.map(rightCause => parallel(leftCause, rightCause))))))(self); | ||
return match(HashSet.empty(), error => HashSet.make(fail(error)), defect => HashSet.make(die(defect)), fiberId => HashSet.make(interrupt(fiberId)), (set, annotation) => HashSet.map(cause => annotated(cause, annotation))(set), (leftSet, rightSet) => HashSet.flatMap(leftCause => HashSet.map(rightCause => sequential(leftCause, rightCause))(rightSet))(leftSet), (leftSet, rightSet) => HashSet.flatMap(leftCause => HashSet.map(rightCause => parallel(leftCause, rightCause))(rightSet))(leftSet))(self); | ||
}; | ||
@@ -304,3 +303,3 @@ /** @internal */ | ||
return Option.isSome(option) ? Option.none : Option.some(die(defect)); | ||
}, fiberId => Option.some(interrupt(fiberId)), (option, annotation) => (0, _Function.pipe)(option, Option.map(cause => annotated(cause, annotation))), (left, right) => { | ||
}, fiberId => Option.some(interrupt(fiberId)), (option, annotation) => Option.map(cause => annotated(cause, annotation))(option), (left, right) => { | ||
if (Option.isSome(left) && Option.isSome(right)) { | ||
@@ -392,10 +391,10 @@ return Option.some(sequential(left.value, right.value)); | ||
while (List.isCons(leftStack) && List.isCons(rightStack)) { | ||
const [leftParallel, leftSequential] = (0, _Function.pipe)(leftStack.head, reduce([HashSet.empty(), List.empty()], ([parallel, sequential], cause) => { | ||
const [leftParallel, leftSequential] = reduce([HashSet.empty(), List.empty()], ([parallel, sequential], cause) => { | ||
const [par, seq] = evaluateCause(cause); | ||
return Option.some([(0, _Function.pipe)(parallel, HashSet.union(par)), (0, _Function.pipe)(sequential, List.concat(seq))]); | ||
})); | ||
const [rightParallel, rightSequential] = (0, _Function.pipe)(rightStack.head, reduce([HashSet.empty(), List.empty()], ([parallel, sequential], cause) => { | ||
return Option.some([HashSet.union(par)(parallel), List.concat(seq)(sequential)]); | ||
})(leftStack.head); | ||
const [rightParallel, rightSequential] = reduce([HashSet.empty(), List.empty()], ([parallel, sequential], cause) => { | ||
const [par, seq] = evaluateCause(cause); | ||
return Option.some([(0, _Function.pipe)(parallel, HashSet.union(par)), (0, _Function.pipe)(sequential, List.concat(seq))]); | ||
})); | ||
return Option.some([HashSet.union(par)(parallel), List.concat(seq)(sequential)]); | ||
})(rightStack.head); | ||
if (!Equal.equals(leftParallel, rightParallel)) { | ||
@@ -426,7 +425,7 @@ return false; | ||
while (1) { | ||
const [parallel, sequential] = (0, _Function.pipe)(causes, List.reduce([HashSet.empty(), List.empty()], ([parallel, sequential], cause) => { | ||
const [parallel, sequential] = List.reduce([HashSet.empty(), List.empty()], ([parallel, sequential], cause) => { | ||
const [par, seq] = evaluateCause(cause); | ||
return [(0, _Function.pipe)(parallel, HashSet.union(par)), (0, _Function.pipe)(sequential, List.concat(seq))]; | ||
})); | ||
const updated = HashSet.size(parallel) > 0 ? (0, _Function.pipe)(flattened, List.prepend(parallel)) : flattened; | ||
return [HashSet.union(par)(parallel), List.concat(seq)(sequential)]; | ||
})(causes); | ||
const updated = HashSet.size(parallel) > 0 ? List.prepend(parallel)(flattened) : flattened; | ||
if (List.isNil(sequential)) { | ||
@@ -451,3 +450,3 @@ return List.reverse(updated); | ||
return self => { | ||
const option = (0, _Function.pipe)(self, failureOption, Option.map(f)); | ||
const option = Option.map(f)(failureOption(self)); | ||
switch (option._tag) { | ||
@@ -457,6 +456,6 @@ case "None": | ||
if (isInterrupted(self)) { | ||
const fibers = (0, _Function.pipe)(interruptors(self), HashSet.flatMap(fiberId => (0, _Function.pipe)(FiberId.ids(fiberId), HashSet.map(n => `#${n}`))), HashSet.reduce("", (acc, id) => `${acc}, ${id}`)); | ||
const fibers = HashSet.reduce("", (acc, id) => `${acc}, ${id}`)(HashSet.flatMap(fiberId => HashSet.map(n => `#${n}`)(FiberId.ids(fiberId)))(interruptors(self))); | ||
return new InterruptedException(`Interrupted by fibers: ${fibers}`); | ||
} | ||
return (0, _Function.pipe)(defects(self), List.head, Option.match(() => new InterruptedException(), _Function.identity)); | ||
return Option.match(() => new InterruptedException(), _Function.identity)(List.head(defects(self))); | ||
} | ||
@@ -492,3 +491,3 @@ case "Some": | ||
{ | ||
stack = new _stack.Stack(stack.value.cause, stack); | ||
stack = new _stack.Stack(stack.value.cause, stack.previous); | ||
break; | ||
@@ -552,5 +551,5 @@ } | ||
if (stack === undefined) { | ||
return [(0, _Function.pipe)(_parallel, HashSet.add(cause.error)), _sequential]; | ||
return [HashSet.add(cause.error)(_parallel), _sequential]; | ||
} | ||
_parallel = (0, _Function.pipe)(_parallel, HashSet.add(cause.error)); | ||
_parallel = HashSet.add(cause.error)(_parallel); | ||
cause = stack.value; | ||
@@ -563,5 +562,5 @@ stack = stack.previous; | ||
if (stack === undefined) { | ||
return [(0, _Function.pipe)(_parallel, HashSet.add(cause.defect)), _sequential]; | ||
return [HashSet.add(cause.defect)(_parallel), _sequential]; | ||
} | ||
_parallel = (0, _Function.pipe)(_parallel, HashSet.add(cause.defect)); | ||
_parallel = HashSet.add(cause.defect)(_parallel); | ||
cause = stack.value; | ||
@@ -574,5 +573,5 @@ stack = stack.previous; | ||
if (stack === undefined) { | ||
return [(0, _Function.pipe)(_parallel, HashSet.add(cause.fiberId)), _sequential]; | ||
return [HashSet.add(cause.fiberId)(_parallel), _sequential]; | ||
} | ||
_parallel = (0, _Function.pipe)(_parallel, HashSet.add(cause.fiberId)); | ||
_parallel = HashSet.add(cause.fiberId)(_parallel); | ||
cause = stack.value; | ||
@@ -612,3 +611,3 @@ stack = stack.previous; | ||
{ | ||
_sequential = (0, _Function.pipe)(_sequential, List.prepend(cause.right)); | ||
_sequential = List.prepend(cause.right)(_sequential); | ||
cause = cause.left; | ||
@@ -957,4 +956,24 @@ break; | ||
}; | ||
// ----------------------------------------------------------------------------- | ||
// Span Annotations | ||
// ----------------------------------------------------------------------------- | ||
/** @internal */ | ||
exports.isStackAnnotation = isStackAnnotation; | ||
const SpanAnnotationTypeId = /*#__PURE__*/Symbol.for("@effect/io/Cause/SpanAnnotation"); | ||
/** @internal */ | ||
exports.SpanAnnotationTypeId = SpanAnnotationTypeId; | ||
class SpanAnnotation { | ||
constructor(currentSpanURI) { | ||
this.currentSpanURI = currentSpanURI; | ||
this[_g] = SpanAnnotationTypeId; | ||
} | ||
} | ||
exports.SpanAnnotation = SpanAnnotation; | ||
_g = SpanAnnotationTypeId; | ||
/** @internal */ | ||
const isSpanAnnotation = u => { | ||
return typeof u === "object" && u != null && SpanAnnotationTypeId in u; | ||
}; | ||
/** @internal */ | ||
exports.isSpanAnnotation = isSpanAnnotation; | ||
const FailureSegment = lines => { | ||
@@ -1027,14 +1046,4 @@ return { | ||
/** @internal */ | ||
const spanToLines = (span, renderer) => { | ||
const lines = []; | ||
let current = Option.some(span); | ||
while (Option.isSome(current) && lines.length < renderer.renderSpanDepth) { | ||
if (current.value.trace) { | ||
lines.push(Doc.text(`${current.value.name} @ ${current.value.trace}`)); | ||
} else { | ||
lines.push(Doc.text(`${current.value.name}`)); | ||
} | ||
current = current.value.parent; | ||
} | ||
return lines; | ||
const spanToLines = span => { | ||
return span.currentSpanURI._tag === "Some" ? [Doc.text(span.currentSpanURI.value)] : []; | ||
}; | ||
@@ -1045,2 +1054,3 @@ /** @internal */ | ||
let current = stack.stack; | ||
let last = undefined; | ||
while (current !== undefined && lines.length < renderer.renderStackDepth) { | ||
@@ -1052,3 +1062,4 @@ switch (current.value.op) { | ||
{ | ||
if (current.value.trace) { | ||
if (current.value.trace && current.value.trace !== last) { | ||
last = current.value.trace; | ||
lines.push(Doc.text(current.value.trace)); | ||
@@ -1068,3 +1079,3 @@ } | ||
} | ||
const lines = spanToLines(span.value, renderer); | ||
const lines = spanToLines(span.value); | ||
return lines.length === 0 ? [] : [Doc.text("Span:"), Doc.empty, ...lines, Doc.empty]; | ||
@@ -1086,3 +1097,3 @@ }; | ||
if (span.value.execution && Chunk.isNonEmpty(span.value.execution)) { | ||
return [Doc.text("Execution:"), Doc.empty, ...(0, _Function.pipe)(span.value.execution, Chunk.take(renderer.renderExecutionDepth), Chunk.map(line => Doc.text(line))), Doc.empty]; | ||
return [Doc.text("Execution:"), Doc.empty, ...Chunk.map(line => Doc.text(line))(Chunk.take(renderer.renderExecutionDepth)(span.value.execution)), Doc.empty]; | ||
} | ||
@@ -1148,7 +1159,7 @@ return []; | ||
{ | ||
return (0, _Function.pipe)(linearSegments(cause.left, renderer, span, stack), SafeEval.zipWith(linearSegments(cause.right, renderer, span, stack), (left, right) => [...left, ...right])); | ||
return SafeEval.zipWith(linearSegments(cause.right, renderer, span, stack), (left, right) => [...left, ...right])(linearSegments(cause.left, renderer, span, stack)); | ||
} | ||
default: | ||
{ | ||
return (0, _Function.pipe)(causeToSequential(cause, renderer, span, stack), SafeEval.map(sequential => sequential.all)); | ||
return SafeEval.map(sequential => sequential.all)(causeToSequential(cause, renderer, span, stack)); | ||
} | ||
@@ -1162,7 +1173,7 @@ } | ||
{ | ||
return (0, _Function.pipe)(parallelSegments(cause.left, renderer, span, stack), SafeEval.zipWith(parallelSegments(cause.right, renderer, span, stack), (left, right) => [...left, ...right])); | ||
return SafeEval.zipWith(parallelSegments(cause.right, renderer, span, stack), (left, right) => [...left, ...right])(parallelSegments(cause.left, renderer, span, stack)); | ||
} | ||
default: | ||
{ | ||
return (0, _Function.pipe)(causeToSequential(cause, renderer, span, stack), SafeEval.map(sequential => [sequential])); | ||
return SafeEval.map(sequential => [sequential])(causeToSequential(cause, renderer, span, stack)); | ||
} | ||
@@ -1192,7 +1203,7 @@ } | ||
{ | ||
return (0, _Function.pipe)(linearSegments(cause, renderer, span, stack), SafeEval.map(segments => SequentialSegment(segments))); | ||
return SafeEval.map(segments => SequentialSegment(segments))(linearSegments(cause, renderer, span, stack)); | ||
} | ||
case "Parallel": | ||
{ | ||
return (0, _Function.pipe)(parallelSegments(cause, renderer, span, stack), SafeEval.map(segments => SequentialSegment([ParallelSegment(segments)]))); | ||
return SafeEval.map(segments => SequentialSegment([ParallelSegment(segments)]))(parallelSegments(cause, renderer, span, stack)); | ||
} | ||
@@ -1202,3 +1213,3 @@ case "Annotated": | ||
const annotation = cause.annotation; | ||
if (Tracer.isSpan(annotation)) { | ||
if (isSpanAnnotation(annotation)) { | ||
return SafeEval.suspend(() => causeToSequential(cause.cause, renderer, Option.some(annotation), stack)); | ||
@@ -1224,3 +1235,2 @@ } | ||
renderExecution: Debug.runtimeDebug.traceExecutionEnabledInCause, | ||
renderSpanDepth: Debug.runtimeDebug.traceSpanLimit, | ||
renderStackDepth: Debug.runtimeDebug.traceStackLimit, | ||
@@ -1234,3 +1244,3 @@ renderExecutionDepth: Debug.runtimeDebug.traceExecutionLimit, | ||
const prettyDocuments = (cause, renderer) => { | ||
return (0, _Function.pipe)(causeToSequential(cause, renderer, Option.none, Option.none), SafeEval.map(sequential => { | ||
return SafeEval.map(sequential => { | ||
if (sequential.all.length === 1 && sequential.all[0] && sequential.all[0]._tag === "FailureSegment") { | ||
@@ -1241,7 +1251,7 @@ return sequential.all[0].lines; | ||
return documents.length > 0 ? [box.branch.down.light, ...documents] : documents; | ||
})); | ||
})(causeToSequential(cause, renderer, Option.none, Option.none)); | ||
}; | ||
/** @internal */ | ||
const prettySafe = (cause, renderer) => { | ||
return (0, _Function.pipe)(prettyDocuments(cause, renderer), SafeEval.map(docs => (0, _Function.pipe)(Doc.lineBreak, Doc.cat((0, _Function.pipe)(docs, Doc.concatWith((left, right) => (0, _Function.pipe)(left, Doc.catWithLineBreak(right))))), Optimize.optimize(Optimize.Deep), Render.pretty(renderer.lineWidth, renderer.ribbonFraction)))); | ||
return SafeEval.map(docs => Render.pretty(renderer.lineWidth, renderer.ribbonFraction)(Optimize.optimize(Optimize.Deep)(Doc.cat(Doc.concatWith((left, right) => Doc.catWithLineBreak(right)(left))(docs))(Doc.lineBreak))))(prettyDocuments(cause, renderer)); | ||
}; | ||
@@ -1252,3 +1262,16 @@ /** @internal */ | ||
}; | ||
/** @internal */ | ||
exports.pretty = pretty; | ||
const UnAnnotateCauseReducer = () => ({ | ||
emptyCase: () => empty, | ||
failCase: (_, error) => fail(error), | ||
dieCase: (_, defect) => die(defect), | ||
interruptCase: (_, fiberId) => interrupt(fiberId), | ||
annotatedCase: (_, cause, __) => cause, | ||
sequentialCase: (_, left, right) => sequential(left, right), | ||
parallelCase: (_, left, right) => parallel(left, right) | ||
}); | ||
/** @internal */ | ||
const unannotate = cause => reduceWithContext(undefined, UnAnnotateCauseReducer())(cause); | ||
exports.unannotate = unannotate; | ||
//# sourceMappingURL=cause.js.map |
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.interruptWithFiber = exports.interruptFiber = exports.interruptDeferred = exports.interruptAsDeferred = exports.interruptAs = exports.interrupt = exports.ifEffect = exports.getWithFiberRef = exports.getFiberRef = exports.getAndUpdateSomeFiberRef = exports.getAndUpdateFiberRef = exports.getAndSetFiberRef = exports.forkScopeOverride = exports.forEachDiscard = exports.forEach = exports.foldEffect = exports.foldCauseEffect = exports.foldCause = exports.flip = exports.flatten = exports.flatMap = exports.fiberIdWith = exports.fiberId = exports.failSyncDeferred = exports.failSync = exports.failDeferred = exports.failCauseSyncDeferred = exports.failCauseSync = exports.failCauseDeferred = exports.failCause = exports.fail = exports.exitZipWith = exports.exitZipRight = exports.exitZipParRight = exports.exitZipParLeft = exports.exitZipPar = exports.exitZipLeft = exports.exitZip = exports.exitUnit = exports.exitSucceed = exports.exitMatchEffect = exports.exitMatch = exports.exitMapErrorCause = exports.exitMapError = exports.exitMapBoth = exports.exitMap = exports.exitIsSuccess = exports.exitIsInterrupted = exports.exitIsFailure = exports.exitIsExit = exports.exitInterrupt = exports.exitGetOrElse = exports.exitFromOption = exports.exitFromEither = exports.exitForEachEffect = exports.exitFlatten = exports.exitFlatMapEffect = exports.exitFlatMap = exports.exitFailCause = exports.exitFail = exports.exitExists = exports.exitDie = exports.exitCollectAllPar = exports.exitCollectAll = exports.exitCauseOption = exports.exitAsUnit = exports.exitAs = exports.exit = exports.environmentWithEffect = exports.environment = exports.either = exports.doneDeferred = exports.done = exports.dieSyncDeferred = exports.dieSync = exports.dieDeferred = exports.die = exports.deleteFiberRef = exports.currentScheduler = exports.currentParallelism = exports.currentLogSpan = exports.currentLogLevel = exports.currentLogAnnotations = exports.currentEnvironment = exports.completeWithDeferred = exports.completeDeferred = exports.checkInterruptible = exports.catchAllCause = exports.awaitDeferred = exports.asyncInterrupt = exports.async = exports.asUnit = exports.as = exports.acquireUseRelease = exports.ScopeTypeId = exports.RevertFlags = exports.FiberRefTypeId = exports.EffectTypeId = exports.EffectErrorTypeId = exports.CloseableScopeTypeId = void 0; | ||
exports.zipWith = exports.zipRight = exports.zipLeft = exports.zip = exports.yieldNow = exports.withRuntimeFlags = exports.withParallelismUnbounded = exports.withParallelism = exports.withFiberRuntime = exports.whileLoop = exports.whenEffect = exports.updateSomeFiberRef = exports.updateSomeAndGetFiberRef = exports.updateRuntimeFlags = exports.updateFiberRef = exports.updateAndGetFiberRef = exports.unsafeMakeRuntimeFlagsFiberRef = exports.unsafeMakePatchFiberRef = exports.unsafeMakeHashSetFiberRef = exports.unsafeMakeFiberRef = exports.unsafeMakeEnvironmentFiberRef = exports.unsafeMakeDeferred = exports.unsafeDoneDeferred = exports.unit = exports.uninterruptibleMask = exports.uninterruptible = exports.transplant = exports.traced = exports.tap = exports.syncDeferred = exports.sync = exports.suspendSucceed = exports.succeedDeferred = exports.succeed = exports.setFiberRef = exports.serviceWithEffect = exports.serviceWith = exports.service = exports.scopeFork = exports.scopeClose = exports.scopeAddFinalizerExit = exports.scopeAddFinalizer = exports.resetFiberRef = exports.releaseMapReplace = exports.releaseMapRemove = exports.releaseMapRelease = exports.releaseMapMake = exports.releaseMapGet = exports.releaseMapAddIfOpen = exports.releaseMapAdd = exports.provideSomeEnvironment = exports.provideEnvironment = exports.proto = exports.pollDeferred = exports.partitionMap = exports.onInterrupt = exports.onExit = exports.onError = exports.never = exports.modifySomeFiberRef = exports.modifyFiberRef = exports.map = exports.makeEffectError = exports.makeDeferred = exports.makeAsDeferred = exports.locallyWithFiberRef = exports.locallyFiberRef = exports.isEffectError = exports.isEffect = exports.isDoneDeferred = exports.intoDeferred = exports.interruptibleMask = exports.interruptible = exports.interruptedCause = void 0; | ||
exports.fiberRefSet = exports.fiberRefReset = exports.fiberRefModifySome = exports.fiberRefModify = exports.fiberRefLocallyWith = exports.fiberRefLocally = exports.fiberRefGetWith = exports.fiberRefGetAndUpdateSome = exports.fiberRefGetAndSet = exports.fiberRefGet = exports.fiberRefDelete = exports.fiberIdWith = exports.fiberId = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.exitZipWith = exports.exitZipRight = exports.exitZipParRight = exports.exitZipParLeft = exports.exitZipPar = exports.exitZipLeft = exports.exitZip = exports.exitUnit = exports.exitUnannotate = exports.exitSucceed = exports.exitMatchEffect = exports.exitMatch = exports.exitMapErrorCause = exports.exitMapError = exports.exitMapBoth = exports.exitMap = exports.exitIsSuccess = exports.exitIsInterrupted = exports.exitIsFailure = exports.exitIsExit = exports.exitInterrupt = exports.exitGetOrElse = exports.exitFromOption = exports.exitFromEither = exports.exitForEachEffect = exports.exitFlatten = exports.exitFlatMapEffect = exports.exitFlatMap = exports.exitFailCause = exports.exitFail = exports.exitExists = exports.exitDie = exports.exitCollectAllPar = exports.exitCollectAll = exports.exitCauseOption = exports.exitAsUnit = exports.exitAs = exports.exit = exports.environmentWithEffect = exports.environment = exports.either = exports.done = exports.dieSync = exports.die = exports.deferredUnsafeMake = exports.deferredUnsafeDone = exports.deferredSync = exports.deferredSucceed = exports.deferredPoll = exports.deferredMakeAs = exports.deferredMake = exports.deferredIsDone = exports.deferredInterruptWith = exports.deferredInterrupt = exports.deferredFailSync = exports.deferredFailCauseSync = exports.deferredFailCause = exports.deferredFail = exports.deferredDone = exports.deferredDieSync = exports.deferredDie = exports.deferredCompleteWith = exports.deferredComplete = exports.deferredAwait = exports.currentScheduler = exports.currentParallelism = exports.currentLogSpan = exports.currentLogLevel = exports.currentLogAnnotations = exports.currentEnvironment = exports.checkInterruptible = exports.catchAllCause = exports.asyncInterrupt = exports.async = exports.asUnit = exports.as = exports.acquireUseRelease = exports.ScopeTypeId = exports.RevertFlags = exports.FiberRefTypeId = exports.EffectTypeId = exports.EffectErrorTypeId = exports.CloseableScopeTypeId = void 0; | ||
exports.zipWith = exports.zipRight = exports.zipLeft = exports.zip = exports.yieldNow = exports.withRuntimeFlags = exports.withParallelismUnbounded = exports.withParallelism = exports.withFiberRuntime = exports.whileLoop = exports.whenEffect = exports.updateRuntimeFlags = exports.unit = exports.uninterruptibleMask = exports.uninterruptible = exports.transplant = exports.traced = exports.tap = exports.sync = exports.suspendSucceed = exports.succeed = exports.serviceWithEffect = exports.serviceWith = exports.service = exports.scopeFork = exports.scopeClose = exports.scopeAddFinalizerExit = exports.scopeAddFinalizer = exports.releaseMapReplace = exports.releaseMapRemove = exports.releaseMapRelease = exports.releaseMapMake = exports.releaseMapGet = exports.releaseMapAddIfOpen = exports.releaseMapAdd = exports.provideSomeEnvironment = exports.provideEnvironment = exports.proto = exports.partitionMap = exports.onInterrupt = exports.onExit = exports.onError = exports.never = exports.map = exports.makeEffectError = exports.isEffectError = exports.isEffect = exports.intoDeferred = exports.interruptibleMask = exports.interruptible = exports.interruptedCause = exports.interruptWithFiber = exports.interruptFiber = exports.interruptAs = exports.interrupt = exports.ifEffect = exports.forkScopeOverride = exports.forEachDiscard = exports.forEach = exports.foldEffect = exports.foldCauseEffect = exports.foldCause = exports.flip = exports.flatten = exports.flatMap = exports.fiberRefgetAndUpdate = exports.fiberRefUpdateSomeAndGet = exports.fiberRefUpdateSome = exports.fiberRefUpdateAndGet = exports.fiberRefUpdate = exports.fiberRefUnsafeMakeRuntimeFlags = exports.fiberRefUnsafeMakePatch = exports.fiberRefUnsafeMakeHashSet = exports.fiberRefUnsafeMakeEnvironment = exports.fiberRefUnsafeMake = void 0; | ||
var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Cause")); | ||
@@ -98,3 +98,3 @@ var _Debug = /*#__PURE__*/require("@effect/io/Debug"); | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return uninterruptibleMask(restore => (0, _Function.pipe)(acquire, flatMap(a => (0, _Function.pipe)(suspendSucceed(() => restore(use(a))), exit, flatMap(exit => (0, _Function.pipe)(suspendSucceed(() => release(a, exit)), foldCauseEffect(cause => { | ||
return uninterruptibleMask(restore => flatMap(a => flatMap(exit => foldCauseEffect(cause => { | ||
switch (exit.op) { | ||
@@ -110,3 +110,3 @@ case OpCodes.OP_FAILURE: | ||
} | ||
}, () => exit))))))).traced(trace); | ||
}, () => exit)(suspendSucceed(() => release(a, exit))))(exit(suspendSucceed(() => restore(use(a))))))(acquire)).traced(trace); | ||
}; | ||
@@ -118,3 +118,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(() => succeed(value))).traced(trace); | ||
return flatMap(() => succeed(value))(self).traced(trace); | ||
}; | ||
@@ -126,3 +126,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, as(void 0)).traced(trace); | ||
return as(void 0)(self).traced(trace); | ||
}; | ||
@@ -146,3 +146,3 @@ /** @internal */ | ||
let cancelerRef = unit(); | ||
return (0, _Function.pipe)(async(resume => { | ||
return onInterrupt(() => cancelerRef)(async(resume => { | ||
const result = register(resume); | ||
@@ -154,3 +154,3 @@ if (Either.isRight(result)) { | ||
} | ||
}, blockingOn), onInterrupt(() => cancelerRef)); | ||
}, blockingOn)); | ||
}).traced(trace); | ||
@@ -174,3 +174,4 @@ }; | ||
const checkInterruptible = f => { | ||
return withFiberRuntime((_, status) => f(RuntimeFlags.interruption(status.runtimeFlags))); | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return withFiberRuntime((_, status) => f(RuntimeFlags.interruption(status.runtimeFlags))).traced(trace); | ||
}; | ||
@@ -199,3 +200,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, foldEffect(e => succeed(Either.left(e)), a => succeed(Either.right(a)))).traced(trace); | ||
return foldEffect(e => succeed(Either.left(e)), a => succeed(Either.right(a)))(self).traced(trace); | ||
}; | ||
@@ -206,3 +207,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return suspendSucceed(() => getFiberRef(currentEnvironment)).traced(trace); | ||
return suspendSucceed(() => fiberRefGet(currentEnvironment)).traced(trace); | ||
}; | ||
@@ -213,3 +214,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(environment(), flatMap(f)).traced(trace); | ||
return flatMap(f)(environment()).traced(trace); | ||
}; | ||
@@ -220,3 +221,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, foldCause(failCause, succeed)).traced(trace); | ||
return foldCause(failCause, succeed)(self).traced(trace); | ||
}; | ||
@@ -249,3 +250,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(sync(evaluate), flatMap(failCause)).traced(trace); | ||
return flatMap(failCause)(sync(evaluate)).traced(trace); | ||
}; | ||
@@ -281,3 +282,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, flatMap(_Function.identity)).traced(trace); | ||
return flatMap(_Function.identity)(self).traced(trace); | ||
}; | ||
@@ -288,3 +289,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, foldEffect(succeed, fail)).traced(trace); | ||
return foldEffect(succeed, fail)(self).traced(trace); | ||
}; | ||
@@ -295,3 +296,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => (0, _Function.pipe)(self, foldCauseEffect(cause => succeed(onFailure(cause)), a => succeed(onSuccess(a)))).traced(trace); | ||
return self => foldCauseEffect(cause => succeed(onFailure(cause)), a => succeed(onSuccess(a)))(self).traced(trace); | ||
}; | ||
@@ -317,3 +318,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, foldCauseEffect(cause => { | ||
return foldCauseEffect(cause => { | ||
const either = Cause.failureOrCause(cause); | ||
@@ -330,3 +331,3 @@ switch (either._tag) { | ||
} | ||
}, onSuccess)).traced(trace); | ||
}, onSuccess)(self).traced(trace); | ||
}; | ||
@@ -342,5 +343,5 @@ }; | ||
let i = 0; | ||
return (0, _Function.pipe)(whileLoop(() => i < arr.length, () => f(arr[i]), b => { | ||
return as(Chunk.unsafeFromArray(ret))(whileLoop(() => i < arr.length, () => f(arr[i]), b => { | ||
ret[i++] = b; | ||
}), as(Chunk.unsafeFromArray(ret))); | ||
})); | ||
}).traced(trace); | ||
@@ -365,3 +366,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(b => b ? onTrue : onFalse)).traced(trace); | ||
return flatMap(b => b ? onTrue : onFalse)(self).traced(trace); | ||
}; | ||
@@ -373,3 +374,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(fiberId(), flatMap(fiberId => interruptAs(fiberId))).traced(trace); | ||
return flatMap(fiberId => interruptAs(fiberId))(fiberId()).traced(trace); | ||
}; | ||
@@ -409,3 +410,3 @@ /** @internal */ | ||
return self => uninterruptibleMask(restore => { | ||
return (0, _Function.pipe)(restore(self), exit, flatMap(exit => (0, _Function.pipe)(deferred, doneDeferred(exit)))); | ||
return flatMap(exit => deferredDone(exit)(deferred))(exit(restore(self))); | ||
}).traced(trace); | ||
@@ -418,3 +419,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => sync(() => f(a)))).traced(trace); | ||
return flatMap(a => sync(() => f(a)))(self).traced(trace); | ||
}; | ||
@@ -438,3 +439,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, onExit(exit => exitIsSuccess(exit) ? unit() : cleanup(exit.cause))).traced(trace); | ||
return onExit(exit => exitIsSuccess(exit) ? unit() : cleanup(exit.cause))(self).traced(trace); | ||
}; | ||
@@ -447,9 +448,9 @@ }; | ||
return self => { | ||
return uninterruptibleMask(restore => (0, _Function.pipe)(restore(self), foldCauseEffect(cause1 => { | ||
return uninterruptibleMask(restore => foldCauseEffect(cause1 => { | ||
const result = exitFailCause(cause1); | ||
return (0, _Function.pipe)(cleanup(result), foldCauseEffect(cause2 => exitFailCause(Cause.sequential(cause1, cause2)), () => result)); | ||
return foldCauseEffect(cause2 => exitFailCause(Cause.sequential(cause1, cause2)), () => result)(cleanup(result)); | ||
}, success => { | ||
const result = exitSucceed(success); | ||
return (0, _Function.pipe)(cleanup(result), zipRight(result)); | ||
}))).traced(trace); | ||
return zipRight(result)(cleanup(result)); | ||
})(restore(self))).traced(trace); | ||
}; | ||
@@ -462,3 +463,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, onExit(exitMatch(cause => Cause.isInterruptedOnly(cause) ? asUnit(cleanup(Cause.interruptors(cause))) : unit(), () => unit()))).traced(trace); | ||
return onExit(exitMatch(cause => Cause.isInterruptedOnly(cause) ? asUnit(cleanup(Cause.interruptors(cause))) : unit(), () => unit()))(self).traced(trace); | ||
}; | ||
@@ -474,7 +475,7 @@ }; | ||
{ | ||
return [(0, _Function.pipe)(lefts, List.prepend(either.left)), rights]; | ||
return [List.prepend(either.left)(lefts), rights]; | ||
} | ||
case "Right": | ||
{ | ||
return [lefts, (0, _Function.pipe)(rights, List.prepend(either.right))]; | ||
return [lefts, List.prepend(either.right)(rights)]; | ||
} | ||
@@ -489,3 +490,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, (0, _Function.pipe)(currentEnvironment, locallyFiberRef(environment))).traced(trace); | ||
return fiberRefLocally(environment)(currentEnvironment)(self).traced(trace); | ||
}; | ||
@@ -497,3 +498,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => environmentWithEffect(context => (0, _Function.pipe)(self, provideEnvironment(f(context)))).traced(trace); | ||
return self => environmentWithEffect(context => provideEnvironment(f(context))(self)).traced(trace); | ||
}; | ||
@@ -509,4 +510,5 @@ /** @internal */ | ||
const serviceWith = tag => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return f => { | ||
return serviceWithEffect(tag)(a => sync(() => f(a))); | ||
return serviceWithEffect(tag)(a => sync(() => f(a))).traced(trace); | ||
}; | ||
@@ -519,3 +521,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return suspendSucceed(() => (0, _Function.pipe)(getFiberRef(currentEnvironment), flatMap(env => f((0, _Function.pipe)(env, Context.unsafeGet(tag)))))).traced(trace); | ||
return suspendSucceed(() => flatMap(env => f(Context.unsafeGet(tag)(env)))(fiberRefGet(currentEnvironment))).traced(trace); | ||
}; | ||
@@ -537,3 +539,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(sync(effect), flatMap(_Function.identity)).traced(trace); | ||
return flatMap(_Function.identity)(sync(effect)).traced(trace); | ||
}; | ||
@@ -555,3 +557,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(f(a), as(a)))).traced(trace); | ||
return flatMap(a => as(a)(f(a)))(self).traced(trace); | ||
}; | ||
@@ -568,4 +570,4 @@ }; | ||
const scopeOverride = state.getFiberRef(forkScopeOverride); | ||
const scope = (0, _Function.pipe)(scopeOverride, Option.getOrElse(() => state.scope())); | ||
return f((0, _Function.pipe)(forkScopeOverride, locallyFiberRef(Option.some(scope)))); | ||
const scope = Option.getOrElse(() => state.scope())(scopeOverride); | ||
return f(fiberRefLocally(Option.some(scope))(forkScopeOverride)); | ||
}).traced(trace); | ||
@@ -619,8 +621,8 @@ }; | ||
return effect => { | ||
return (0, _Function.pipe)(predicate, flatMap(b => { | ||
return flatMap(b => { | ||
if (b) { | ||
return (0, _Function.pipe)(effect, map(Option.some)); | ||
return map(Option.some)(effect); | ||
} | ||
return succeed(Option.none); | ||
})).traced(trace); | ||
})(predicate).traced(trace); | ||
}; | ||
@@ -658,3 +660,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return suspendSucceed(() => (0, _Function.pipe)(self, locallyFiberRef(Option.some(parallelism))(currentParallelism))).traced(trace); | ||
return suspendSucceed(() => fiberRefLocally(Option.some(parallelism))(currentParallelism)(self)).traced(trace); | ||
}; | ||
@@ -666,3 +668,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return suspendSucceed(() => (0, _Function.pipe)(self, locallyFiberRef(Option.none)(currentParallelism))).traced(trace); | ||
return suspendSucceed(() => fiberRefLocally(Option.none)(currentParallelism)(self)).traced(trace); | ||
}; | ||
@@ -696,3 +698,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, map(b => [a, b])))).traced(trace); | ||
return flatMap(a => map(b => [a, b])(that))(self).traced(trace); | ||
}; | ||
@@ -705,3 +707,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, as(a)))).traced(trace); | ||
return flatMap(a => as(a)(that))(self).traced(trace); | ||
}; | ||
@@ -714,3 +716,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(() => that)).traced(trace); | ||
return flatMap(() => that)(self).traced(trace); | ||
}; | ||
@@ -723,3 +725,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, map(b => f(a, b))))).traced(trace); | ||
return flatMap(a => map(b => f(a, b))(that))(self).traced(trace); | ||
}; | ||
@@ -734,3 +736,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(fiberId(), flatMap(fiberId => (0, _Function.pipe)(self, interruptWithFiber(fiberId)))).traced(trace); | ||
return flatMap(fiberId => interruptWithFiber(fiberId)(self))(fiberId()).traced(trace); | ||
}; | ||
@@ -742,3 +744,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self.interruptWithFork(fiberId), flatMap(() => self.await())).traced(trace); | ||
return flatMap(() => self.await())(self.interruptWithFork(fiberId)).traced(trace); | ||
}; | ||
@@ -760,56 +762,65 @@ }; | ||
/** @internal */ | ||
const getFiberRef = self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(a => [a, a])); | ||
const fiberRefGet = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return fiberRefModify(a => [a, a])(self).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.getFiberRef = getFiberRef; | ||
const getAndSetFiberRef = value => { | ||
exports.fiberRefGet = fiberRefGet; | ||
const fiberRefGetAndSet = value => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(v => [v, value])); | ||
return fiberRefModify(v => [v, value])(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.getAndSetFiberRef = getAndSetFiberRef; | ||
const getAndUpdateFiberRef = f => { | ||
exports.fiberRefGetAndSet = fiberRefGetAndSet; | ||
const fiberRefgetAndUpdate = f => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(v => [v, f(v)])); | ||
return fiberRefModify(v => [v, f(v)])(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.getAndUpdateFiberRef = getAndUpdateFiberRef; | ||
const getAndUpdateSomeFiberRef = pf => { | ||
exports.fiberRefgetAndUpdate = fiberRefgetAndUpdate; | ||
const fiberRefGetAndUpdateSome = pf => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(v => [v, (0, _Function.pipe)(pf(v), Option.getOrElse(() => v))])); | ||
return fiberRefModify(v => [v, Option.getOrElse(() => v)(pf(v))])(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.getAndUpdateSomeFiberRef = getAndUpdateSomeFiberRef; | ||
const getWithFiberRef = f => { | ||
exports.fiberRefGetAndUpdateSome = fiberRefGetAndUpdateSome; | ||
const fiberRefGetWith = f => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(getFiberRef(self), flatMap(f)); | ||
return flatMap(f)(fiberRefGet(self)).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.getWithFiberRef = getWithFiberRef; | ||
const setFiberRef = value => { | ||
exports.fiberRefGetWith = fiberRefGetWith; | ||
const fiberRefSet = value => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(() => [undefined, value])); | ||
return fiberRefModify(() => [undefined, value])(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.setFiberRef = setFiberRef; | ||
const deleteFiberRef = self => { | ||
exports.fiberRefSet = fiberRefSet; | ||
const fiberRefDelete = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return withFiberRuntime(state => { | ||
state.unsafeDeleteFiberRef(self); | ||
return unit(); | ||
}); | ||
}).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.deleteFiberRef = deleteFiberRef; | ||
const resetFiberRef = self => { | ||
return (0, _Function.pipe)(self, setFiberRef(self.initial)); | ||
exports.fiberRefDelete = fiberRefDelete; | ||
const fiberRefReset = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return fiberRefSet(self.initial)(self).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.resetFiberRef = resetFiberRef; | ||
const modifyFiberRef = f => { | ||
exports.fiberRefReset = fiberRefReset; | ||
const fiberRefModify = f => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
@@ -820,46 +831,58 @@ return withFiberRuntime(state => { | ||
return succeed(b); | ||
}); | ||
}).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.modifyFiberRef = modifyFiberRef; | ||
const modifySomeFiberRef = (def, f) => { | ||
exports.fiberRefModify = fiberRefModify; | ||
const fiberRefModifySome = (def, f) => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(v => (0, _Function.pipe)(f(v), Option.getOrElse(() => [def, v])))); | ||
return fiberRefModify(v => Option.getOrElse(() => [def, v])(f(v)))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.modifySomeFiberRef = modifySomeFiberRef; | ||
const updateFiberRef = f => { | ||
exports.fiberRefModifySome = fiberRefModifySome; | ||
const fiberRefUpdate = f => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyFiberRef(v => [undefined, f(v)])); | ||
return fiberRefModify(v => [void 0, f(v)])(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.updateFiberRef = updateFiberRef; | ||
const updateSomeFiberRef = pf => { | ||
return modifyFiberRef(v => [undefined, (0, _Function.pipe)(pf(v), Option.getOrElse(() => v))]); | ||
exports.fiberRefUpdate = fiberRefUpdate; | ||
const fiberRefUpdateSome = pf => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return fiberRefModify(v => [void 0, Option.getOrElse(() => v)(pf(v))])(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.updateSomeFiberRef = updateSomeFiberRef; | ||
const updateAndGetFiberRef = f => { | ||
return modifyFiberRef(v => { | ||
const result = f(v); | ||
return [result, result]; | ||
}); | ||
exports.fiberRefUpdateSome = fiberRefUpdateSome; | ||
const fiberRefUpdateAndGet = f => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return fiberRefModify(v => { | ||
const result = f(v); | ||
return [result, result]; | ||
})(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.updateAndGetFiberRef = updateAndGetFiberRef; | ||
const updateSomeAndGetFiberRef = pf => { | ||
return modifyFiberRef(v => { | ||
const result = (0, _Function.pipe)(pf(v), Option.getOrElse(() => v)); | ||
return [result, result]; | ||
}); | ||
exports.fiberRefUpdateAndGet = fiberRefUpdateAndGet; | ||
const fiberRefUpdateSomeAndGet = pf => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return fiberRefModify(v => { | ||
const result = Option.getOrElse(() => v)(pf(v)); | ||
return [result, result]; | ||
})(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.updateSomeAndGetFiberRef = updateSomeAndGetFiberRef; | ||
const locallyFiberRef = value => { | ||
exports.fiberRefUpdateSomeAndGet = fiberRefUpdateSomeAndGet; | ||
const fiberRefLocally = value => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return use => { | ||
return acquireUseRelease((0, _Function.pipe)(getFiberRef(self), zipLeft((0, _Function.pipe)(self, setFiberRef(value)))), () => use, oldValue => (0, _Function.pipe)(self, setFiberRef(oldValue))); | ||
return acquireUseRelease(zipLeft(fiberRefSet(value)(self))(fiberRefGet(self)), () => use, oldValue => fiberRefSet(oldValue)(self)).traced(trace); | ||
}; | ||
@@ -869,7 +892,8 @@ }; | ||
/** @internal */ | ||
exports.locallyFiberRef = locallyFiberRef; | ||
const locallyWithFiberRef = f => { | ||
exports.fiberRefLocally = fiberRefLocally; | ||
const fiberRefLocallyWith = f => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return use => { | ||
return (0, _Function.pipe)(self, getWithFiberRef(a => (0, _Function.pipe)(use, (0, _Function.pipe)(self, locallyFiberRef(f(a)))))); | ||
return fiberRefGetWith(a => fiberRefLocally(f(a))(self)(use))(self).traced(trace); | ||
}; | ||
@@ -879,24 +903,24 @@ }; | ||
/** @internal */ | ||
exports.locallyWithFiberRef = locallyWithFiberRef; | ||
const unsafeMakeFiberRef = (initial, fork = _Function.identity, join = (_, a) => a) => { | ||
return unsafeMakePatchFiberRef(initial, Differ.update(), fork, join); | ||
exports.fiberRefLocallyWith = fiberRefLocallyWith; | ||
const fiberRefUnsafeMake = (initial, fork = _Function.identity, join = (_, a) => a) => { | ||
return fiberRefUnsafeMakePatch(initial, Differ.update(), fork, join); | ||
}; | ||
/** @internal */ | ||
exports.unsafeMakeFiberRef = unsafeMakeFiberRef; | ||
const unsafeMakeHashSetFiberRef = initial => { | ||
return unsafeMakePatchFiberRef(initial, Differ.hashSet(), HashSetPatch.empty()); | ||
exports.fiberRefUnsafeMake = fiberRefUnsafeMake; | ||
const fiberRefUnsafeMakeHashSet = initial => { | ||
return fiberRefUnsafeMakePatch(initial, Differ.hashSet(), HashSetPatch.empty()); | ||
}; | ||
/** @internal */ | ||
exports.unsafeMakeHashSetFiberRef = unsafeMakeHashSetFiberRef; | ||
const unsafeMakeEnvironmentFiberRef = initial => { | ||
return unsafeMakePatchFiberRef(initial, Differ.environment(), ContextPatch.empty()); | ||
exports.fiberRefUnsafeMakeHashSet = fiberRefUnsafeMakeHashSet; | ||
const fiberRefUnsafeMakeEnvironment = initial => { | ||
return fiberRefUnsafeMakePatch(initial, Differ.environment(), ContextPatch.empty()); | ||
}; | ||
/** @internal */ | ||
exports.unsafeMakeEnvironmentFiberRef = unsafeMakeEnvironmentFiberRef; | ||
const unsafeMakePatchFiberRef = (initial, differ, fork, join = (_, n) => n) => ({ | ||
exports.fiberRefUnsafeMakeEnvironment = fiberRefUnsafeMakeEnvironment; | ||
const fiberRefUnsafeMakePatch = (initial, differ, fork, join = (_, n) => n) => ({ | ||
[FiberRefTypeId]: fiberRefVariance, | ||
initial, | ||
diff: (oldValue, newValue) => (0, _Function.pipe)(differ, Differ.diff(oldValue, newValue)), | ||
combine: (first, second) => (0, _Function.pipe)(differ, Differ.combine(first, second)), | ||
patch: patch => oldValue => (0, _Function.pipe)(differ, Differ.patch(patch, oldValue)), | ||
diff: (oldValue, newValue) => Differ.diff(oldValue, newValue)(differ), | ||
combine: (first, second) => Differ.combine(first, second)(differ), | ||
patch: patch => oldValue => Differ.patch(patch, oldValue)(differ), | ||
fork, | ||
@@ -906,15 +930,15 @@ join | ||
/** @internal */ | ||
exports.unsafeMakePatchFiberRef = unsafeMakePatchFiberRef; | ||
const unsafeMakeRuntimeFlagsFiberRef = initial => { | ||
return unsafeMakePatchFiberRef(initial, RuntimeFlags.differ(), RuntimeFlagsPatch.empty); | ||
exports.fiberRefUnsafeMakePatch = fiberRefUnsafeMakePatch; | ||
const fiberRefUnsafeMakeRuntimeFlags = initial => { | ||
return fiberRefUnsafeMakePatch(initial, RuntimeFlags.differ(), RuntimeFlagsPatch.empty); | ||
}; | ||
/** @internal */ | ||
exports.unsafeMakeRuntimeFlagsFiberRef = unsafeMakeRuntimeFlagsFiberRef; | ||
const currentEnvironment = /*#__PURE__*/unsafeMakeEnvironmentFiberRef( /*#__PURE__*/Context.empty()); | ||
exports.fiberRefUnsafeMakeRuntimeFlags = fiberRefUnsafeMakeRuntimeFlags; | ||
const currentEnvironment = /*#__PURE__*/fiberRefUnsafeMakeEnvironment( /*#__PURE__*/Context.empty()); | ||
/** @internal */ | ||
exports.currentEnvironment = currentEnvironment; | ||
const currentLogAnnotations = /*#__PURE__*/unsafeMakeFiberRef( /*#__PURE__*/new Map()); | ||
const currentLogAnnotations = /*#__PURE__*/fiberRefUnsafeMake( /*#__PURE__*/new Map()); | ||
/** @internal */ | ||
exports.currentLogAnnotations = currentLogAnnotations; | ||
const currentLogLevel = /*#__PURE__*/unsafeMakeFiberRef({ | ||
const currentLogLevel = /*#__PURE__*/fiberRefUnsafeMake({ | ||
_tag: "Info", | ||
@@ -927,15 +951,15 @@ syslog: 6, | ||
exports.currentLogLevel = currentLogLevel; | ||
const currentLogSpan = /*#__PURE__*/unsafeMakeFiberRef( /*#__PURE__*/List.empty()); | ||
const currentLogSpan = /*#__PURE__*/fiberRefUnsafeMake( /*#__PURE__*/List.empty()); | ||
/** @internal */ | ||
exports.currentLogSpan = currentLogSpan; | ||
const currentScheduler = /*#__PURE__*/unsafeMakeFiberRef(Scheduler.defaultScheduler); | ||
const currentScheduler = /*#__PURE__*/fiberRefUnsafeMake(Scheduler.defaultScheduler); | ||
/** @internal */ | ||
exports.currentScheduler = currentScheduler; | ||
const currentParallelism = /*#__PURE__*/unsafeMakeFiberRef(Option.none); | ||
const currentParallelism = /*#__PURE__*/fiberRefUnsafeMake(Option.none); | ||
/** @internal */ | ||
exports.currentParallelism = currentParallelism; | ||
const forkScopeOverride = /*#__PURE__*/unsafeMakeFiberRef(Option.none, () => Option.none, (parent, _) => parent); | ||
const forkScopeOverride = /*#__PURE__*/fiberRefUnsafeMake(Option.none, () => Option.none, (parent, _) => parent); | ||
/** @internal */ | ||
exports.forkScopeOverride = forkScopeOverride; | ||
const interruptedCause = /*#__PURE__*/unsafeMakeFiberRef(Cause.empty, () => Cause.empty, (parent, _) => parent); | ||
const interruptedCause = /*#__PURE__*/fiberRefUnsafeMake(Cause.empty, () => Cause.empty, (parent, _) => parent); | ||
// ----------------------------------------------------------------------------- | ||
@@ -952,91 +976,144 @@ // Scope | ||
exports.CloseableScopeTypeId = CloseableScopeTypeId; | ||
const scopeAddFinalizer = finalizer => self => self.addFinalizer(() => asUnit(finalizer)); | ||
const scopeAddFinalizer = finalizer => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return self.addFinalizer(() => asUnit(finalizer)).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.scopeAddFinalizer = scopeAddFinalizer; | ||
const scopeAddFinalizerExit = finalizer => self => self.addFinalizer(finalizer); | ||
const scopeAddFinalizerExit = finalizer => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return self.addFinalizer(finalizer).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.scopeAddFinalizerExit = scopeAddFinalizerExit; | ||
const scopeClose = exit => self => self.close(exit); | ||
const scopeClose = exit => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return self.close(exit).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.scopeClose = scopeClose; | ||
const scopeFork = strategy => self => self.fork(strategy); | ||
const scopeFork = strategy => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return self.fork(strategy).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.scopeFork = scopeFork; | ||
const releaseMapAdd = finalizer => self => (0, _Function.pipe)(self, releaseMapAddIfOpen(finalizer), map(Option.match(() => () => unit(), key => exit => releaseMapRelease(key, exit)(self)))); | ||
const releaseMapAdd = finalizer => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return map(Option.match(() => () => unit(), key => exit => releaseMapRelease(key, exit)(self)))(releaseMapAddIfOpen(finalizer)(self)).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.releaseMapAdd = releaseMapAdd; | ||
const releaseMapRelease = (key, exit) => self => suspendSucceed(() => { | ||
switch (self.state._tag) { | ||
case "Exited": | ||
{ | ||
return unit(); | ||
const releaseMapRelease = (key, exit) => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return suspendSucceed(() => { | ||
switch (self.state._tag) { | ||
case "Exited": | ||
{ | ||
return unit(); | ||
} | ||
case "Running": | ||
{ | ||
const finalizer = self.state.finalizers.get(key); | ||
self.state.finalizers.delete(key); | ||
if (finalizer !== undefined) { | ||
return self.state.update(finalizer)(exit); | ||
} | ||
return unit(); | ||
} | ||
} | ||
case "Running": | ||
{ | ||
const finalizer = self.state.finalizers.get(key); | ||
self.state.finalizers.delete(key); | ||
if (finalizer !== undefined) { | ||
return self.state.update(finalizer)(exit); | ||
} | ||
return unit(); | ||
} | ||
} | ||
}); | ||
}).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.releaseMapRelease = releaseMapRelease; | ||
const releaseMapAddIfOpen = finalizer => self => suspendSucceed(() => { | ||
switch (self.state._tag) { | ||
case "Exited": | ||
{ | ||
self.state.nextKey += 1; | ||
return (0, _Function.pipe)(finalizer(self.state.exit), as(Option.none)); | ||
const releaseMapAddIfOpen = finalizer => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return suspendSucceed(() => { | ||
switch (self.state._tag) { | ||
case "Exited": | ||
{ | ||
self.state.nextKey += 1; | ||
return as(Option.none)(finalizer(self.state.exit)); | ||
} | ||
case "Running": | ||
{ | ||
const key = self.state.nextKey; | ||
self.state.finalizers.set(key, finalizer); | ||
self.state.nextKey += 1; | ||
return succeed(Option.some(key)); | ||
} | ||
} | ||
case "Running": | ||
{ | ||
const key = self.state.nextKey; | ||
self.state.finalizers.set(key, finalizer); | ||
self.state.nextKey += 1; | ||
return succeed(Option.some(key)); | ||
} | ||
} | ||
}); | ||
}).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.releaseMapAddIfOpen = releaseMapAddIfOpen; | ||
const releaseMapGet = key => self => sync(() => self.state._tag === "Running" ? Option.fromNullable(self.state.finalizers.get(key)) : Option.none); | ||
const releaseMapGet = key => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return sync(() => self.state._tag === "Running" ? Option.fromNullable(self.state.finalizers.get(key)) : Option.none).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.releaseMapGet = releaseMapGet; | ||
const releaseMapReplace = (key, finalizer) => self => suspendSucceed(() => { | ||
switch (self.state._tag) { | ||
case "Exited": | ||
{ | ||
return as(Option.none)(finalizer(self.state.exit)); | ||
const releaseMapReplace = (key, finalizer) => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return suspendSucceed(() => { | ||
switch (self.state._tag) { | ||
case "Exited": | ||
{ | ||
return as(Option.none)(finalizer(self.state.exit)); | ||
} | ||
case "Running": | ||
{ | ||
const fin = Option.fromNullable(self.state.finalizers.get(key)); | ||
self.state.finalizers.set(key, finalizer); | ||
return succeed(fin); | ||
} | ||
} | ||
case "Running": | ||
{ | ||
const fin = Option.fromNullable(self.state.finalizers.get(key)); | ||
self.state.finalizers.set(key, finalizer); | ||
return succeed(fin); | ||
} | ||
} | ||
}); | ||
}).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.releaseMapReplace = releaseMapReplace; | ||
const releaseMapRemove = key => self => sync(() => { | ||
if (self.state._tag === "Exited") { | ||
return Option.none; | ||
} | ||
const fin = Option.fromNullable(self.state.finalizers.get(key)); | ||
self.state.finalizers.delete(key); | ||
return fin; | ||
}); | ||
const releaseMapRemove = key => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return sync(() => { | ||
if (self.state._tag === "Exited") { | ||
return Option.none; | ||
} | ||
const fin = Option.fromNullable(self.state.finalizers.get(key)); | ||
self.state.finalizers.delete(key); | ||
return fin; | ||
}).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.releaseMapRemove = releaseMapRemove; | ||
const releaseMapMake = () => sync(() => ({ | ||
state: { | ||
_tag: "Running", | ||
nextKey: 0, | ||
finalizers: new Map(), | ||
update: _Function.identity | ||
} | ||
})); | ||
const releaseMapMake = () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return sync(() => ({ | ||
state: { | ||
_tag: "Running", | ||
nextKey: 0, | ||
finalizers: new Map(), | ||
update: _Function.identity | ||
} | ||
})).traced(trace); | ||
}; | ||
// ----------------------------------------------------------------------------- | ||
@@ -1048,3 +1125,3 @@ // Exit | ||
const exitIsExit = u => { | ||
return isEffect(u) && "_tag" in u && (u["_tag"] === "Success" || u["_tag"] === "Failure"); | ||
return isEffect(u) && "op" in u && (u["op"] === OpCodes.OP_SUCCESS || u["op"] === OpCodes.OP_FAILURE); | ||
}; | ||
@@ -1064,6 +1141,7 @@ /** @internal */ | ||
const exitSucceed = value => { | ||
const effect = Object.create(proto); | ||
effect.op = OpCodes.OP_SUCCESS; | ||
effect.value = value; | ||
return effect; | ||
const exit = Object.create(proto); | ||
exit.op = OpCodes.OP_SUCCESS; | ||
exit.value = value; | ||
exit.trace = undefined; | ||
return exit; | ||
}; | ||
@@ -1078,6 +1156,7 @@ /** @internal */ | ||
const exitFailCause = cause => { | ||
const effect = Object.create(proto); | ||
effect.op = OpCodes.OP_FAILURE; | ||
effect.cause = cause; | ||
return effect; | ||
const exit = Object.create(proto); | ||
exit.op = OpCodes.OP_FAILURE; | ||
exit.cause = cause; | ||
exit.trace = undefined; | ||
return exit; | ||
}; | ||
@@ -1114,3 +1193,3 @@ /** @internal */ | ||
{ | ||
return exitFail(undefined); | ||
return exitFail(void 0); | ||
} | ||
@@ -1185,17 +1264,21 @@ case "Some": | ||
exports.exitExists = exitExists; | ||
const exitAs = value => self => { | ||
switch (self.op) { | ||
case OpCodes.OP_FAILURE: | ||
{ | ||
return self; | ||
} | ||
case OpCodes.OP_SUCCESS: | ||
{ | ||
return exitSucceed(value); | ||
} | ||
} | ||
const exitAs = value => { | ||
return self => { | ||
switch (self.op) { | ||
case OpCodes.OP_FAILURE: | ||
{ | ||
return self; | ||
} | ||
case OpCodes.OP_SUCCESS: | ||
{ | ||
return exitSucceed(value); | ||
} | ||
} | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.exitAs = exitAs; | ||
const exitAsUnit = self => exitAs(void 0)(self); | ||
const exitAsUnit = self => { | ||
return exitAs(void 0)(self); | ||
}; | ||
/** @internal */ | ||
@@ -1224,3 +1307,3 @@ exports.exitAsUnit = exitAsUnit; | ||
{ | ||
return exitFailCause((0, _Function.pipe)(self.cause, Cause.map(onFailure))); | ||
return exitFailCause(Cause.map(onFailure)(self.cause)); | ||
} | ||
@@ -1236,2 +1319,5 @@ case OpCodes.OP_SUCCESS: | ||
exports.exitMapBoth = exitMapBoth; | ||
const exitUnannotate = exit => exitIsSuccess(exit) ? exit : exitFailCause(Cause.unannotate(exit.cause)); | ||
/** @internal */ | ||
exports.exitUnannotate = exitUnannotate; | ||
const exitMapError = f => { | ||
@@ -1242,3 +1328,3 @@ return self => { | ||
{ | ||
return exitFailCause((0, _Function.pipe)(self.cause, Cause.map(f))); | ||
return exitFailCause(Cause.map(f)(self.cause)); | ||
} | ||
@@ -1303,3 +1389,3 @@ case OpCodes.OP_SUCCESS: | ||
const exitFlatten = self => { | ||
return (0, _Function.pipe)(self, exitFlatMap(_Function.identity)); | ||
return exitFlatMap(_Function.identity)(self); | ||
}; | ||
@@ -1357,3 +1443,5 @@ /** @internal */ | ||
const exitZip = that => { | ||
return exitZipWith(that, (a, a2) => [a, a2], Cause.sequential); | ||
return self => { | ||
return exitZipWith(that, (a, a2) => [a, a2], Cause.sequential)(self); | ||
}; | ||
}; | ||
@@ -1363,3 +1451,5 @@ /** @internal */ | ||
const exitZipLeft = that => { | ||
return exitZipWith(that, (a, _) => a, Cause.sequential); | ||
return self => { | ||
return exitZipWith(that, (a, _) => a, Cause.sequential)(self); | ||
}; | ||
}; | ||
@@ -1369,3 +1459,5 @@ /** @internal */ | ||
const exitZipRight = that => { | ||
return exitZipWith(that, (_, a2) => a2, Cause.sequential); | ||
return self => { | ||
return exitZipWith(that, (_, a2) => a2, Cause.sequential)(self); | ||
}; | ||
}; | ||
@@ -1375,3 +1467,5 @@ /** @internal */ | ||
const exitZipPar = that => { | ||
return exitZipWith(that, (a, a2) => [a, a2], Cause.parallel); | ||
return self => { | ||
return exitZipWith(that, (a, a2) => [a, a2], Cause.parallel)(self); | ||
}; | ||
}; | ||
@@ -1381,3 +1475,5 @@ /** @internal */ | ||
const exitZipParLeft = that => { | ||
return exitZipWith(that, (a, _) => a, Cause.parallel); | ||
return self => { | ||
return exitZipWith(that, (a, _) => a, Cause.parallel)(self); | ||
}; | ||
}; | ||
@@ -1387,3 +1483,5 @@ /** @internal */ | ||
const exitZipParRight = that => { | ||
return exitZipWith(that, (_, a2) => a2, Cause.parallel); | ||
return self => { | ||
return exitZipWith(that, (_, a2) => a2, Cause.parallel)(self); | ||
}; | ||
}; | ||
@@ -1436,3 +1534,3 @@ /** @internal */ | ||
exports.exitCollectAllPar = exitCollectAllPar; | ||
const exitUnit = unit; | ||
const exitUnit = () => exitSucceed(void 0); | ||
/** @internal */ | ||
@@ -1445,3 +1543,3 @@ exports.exitUnit = exitUnit; | ||
} | ||
return (0, _Function.pipe)(list.tail, List.reduce((0, _Function.pipe)(list.head, exitMap(List.of)), (accumulator, current) => (0, _Function.pipe)(accumulator, exitZipWith(current, (list, value) => (0, _Function.pipe)(list, List.prepend(value)), combineCauses))), exitMap(List.reverse), Option.some); | ||
return Option.some(exitMap(List.reverse)(List.reduce(exitMap(List.of)(list.head), (accumulator, current) => exitZipWith(current, (list, value) => List.prepend(value)(list), combineCauses)(accumulator))(list.tail))); | ||
}; | ||
@@ -1452,3 +1550,3 @@ // ----------------------------------------------------------------------------- | ||
/** @internal */ | ||
const unsafeMakeDeferred = fiberId => { | ||
const deferredUnsafeMake = fiberId => { | ||
return { | ||
@@ -1461,81 +1559,92 @@ [deferred.DeferredTypeId]: deferred.deferredVariance, | ||
/** @internal */ | ||
exports.unsafeMakeDeferred = unsafeMakeDeferred; | ||
const makeDeferred = () => { | ||
return (0, _Function.pipe)(fiberId(), flatMap(id => makeAsDeferred(id))); | ||
exports.deferredUnsafeMake = deferredUnsafeMake; | ||
const deferredMake = () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return flatMap(id => deferredMakeAs(id))(fiberId()).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.makeDeferred = makeDeferred; | ||
const makeAsDeferred = fiberId => { | ||
return sync(() => unsafeMakeDeferred(fiberId)); | ||
exports.deferredMake = deferredMake; | ||
const deferredMakeAs = fiberId => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return sync(() => deferredUnsafeMake(fiberId)).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.makeAsDeferred = makeAsDeferred; | ||
const succeedDeferred = value => { | ||
exports.deferredMakeAs = deferredMakeAs; | ||
const deferredSucceed = value => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(succeed(value))); | ||
return deferredCompleteWith(succeed(value))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.succeedDeferred = succeedDeferred; | ||
const syncDeferred = evaluate => { | ||
exports.deferredSucceed = deferredSucceed; | ||
const deferredSync = evaluate => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(sync(evaluate))); | ||
return deferredCompleteWith(sync(evaluate))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.syncDeferred = syncDeferred; | ||
const failDeferred = error => { | ||
exports.deferredSync = deferredSync; | ||
const deferredFail = error => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(fail(error))); | ||
return deferredCompleteWith(fail(error))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.failDeferred = failDeferred; | ||
const failSyncDeferred = evaluate => { | ||
exports.deferredFail = deferredFail; | ||
const deferredFailSync = evaluate => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(failSync(evaluate))); | ||
return deferredCompleteWith(failSync(evaluate))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.failSyncDeferred = failSyncDeferred; | ||
const failCauseDeferred = cause => { | ||
exports.deferredFailSync = deferredFailSync; | ||
const deferredFailCause = cause => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(failCause(cause))); | ||
return deferredCompleteWith(failCause(cause))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.failCauseDeferred = failCauseDeferred; | ||
const failCauseSyncDeferred = evaluate => { | ||
exports.deferredFailCause = deferredFailCause; | ||
const deferredFailCauseSync = evaluate => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(failCauseSync(evaluate))); | ||
return deferredCompleteWith(failCauseSync(evaluate))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.failCauseSyncDeferred = failCauseSyncDeferred; | ||
const dieDeferred = defect => { | ||
exports.deferredFailCauseSync = deferredFailCauseSync; | ||
const deferredDie = defect => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(die(defect))); | ||
return deferredCompleteWith(die(defect))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.dieDeferred = dieDeferred; | ||
const dieSyncDeferred = evaluate => { | ||
exports.deferredDie = deferredDie; | ||
const deferredDieSync = evaluate => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(dieSync(evaluate))); | ||
return deferredCompleteWith(dieSync(evaluate))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.dieSyncDeferred = dieSyncDeferred; | ||
const doneDeferred = exit => { | ||
exports.deferredDieSync = deferredDieSync; | ||
const deferredDone = exit => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(done(exit))); | ||
return deferredCompleteWith(done(exit))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.doneDeferred = doneDeferred; | ||
const unsafeDoneDeferred = effect => { | ||
exports.deferredDone = deferredDone; | ||
const deferredUnsafeDone = effect => { | ||
return self => { | ||
const state = MutableRef.get(self.state); | ||
if (state.op === deferred.OP_STATE_PENDING) { | ||
(0, _Function.pipe)(self.state, MutableRef.set(deferred.done(effect))); | ||
MutableRef.set(deferred.done(effect))(self.state); | ||
for (let i = state.joiners.length - 1; i >= 0; i--) { | ||
@@ -1548,16 +1657,19 @@ state.joiners[i](effect); | ||
/** @internal */ | ||
exports.unsafeDoneDeferred = unsafeDoneDeferred; | ||
const interruptDeferred = self => { | ||
return (0, _Function.pipe)(fiberId(), flatMap(fiberId => (0, _Function.pipe)(self, completeWithDeferred(interruptAs(fiberId))))); | ||
exports.deferredUnsafeDone = deferredUnsafeDone; | ||
const deferredInterrupt = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return flatMap(fiberId => deferredCompleteWith(interruptAs(fiberId))(self))(fiberId()).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.interruptDeferred = interruptDeferred; | ||
const interruptAsDeferred = fiberId => { | ||
exports.deferredInterrupt = deferredInterrupt; | ||
const deferredInterruptWith = fiberId => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(self, completeWithDeferred(interruptAs(fiberId))); | ||
return deferredCompleteWith(interruptAs(fiberId))(self).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.interruptAsDeferred = interruptAsDeferred; | ||
const awaitDeferred = self => { | ||
exports.deferredInterruptWith = deferredInterruptWith; | ||
const deferredAwait = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return asyncInterrupt(k => { | ||
@@ -1572,18 +1684,20 @@ const state = MutableRef.get(self.state); | ||
{ | ||
(0, _Function.pipe)(self.state, MutableRef.set(deferred.pending([k, ...state.joiners]))); | ||
return Either.left(interruptDeferredJoiner(self, k)); | ||
MutableRef.set(deferred.pending([k, ...state.joiners]))(self.state); | ||
return Either.left(deferredInterruptJoiner(self, k)); | ||
} | ||
} | ||
}, self.blockingOn); | ||
}, self.blockingOn).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.awaitDeferred = awaitDeferred; | ||
const completeDeferred = effect => { | ||
exports.deferredAwait = deferredAwait; | ||
const deferredComplete = effect => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
return (0, _Function.pipe)(effect, intoDeferred(self)); | ||
return intoDeferred(self)(effect).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.completeDeferred = completeDeferred; | ||
const completeWithDeferred = effect => { | ||
exports.deferredComplete = deferredComplete; | ||
const deferredCompleteWith = effect => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => { | ||
@@ -1599,3 +1713,3 @@ return sync(() => { | ||
{ | ||
(0, _Function.pipe)(self.state, MutableRef.set(deferred.done(effect))); | ||
MutableRef.set(deferred.done(effect))(self.state); | ||
for (let i = 0; i < state.joiners.length; i++) { | ||
@@ -1607,13 +1721,15 @@ state.joiners[i](effect); | ||
} | ||
}); | ||
}).traced(trace); | ||
}; | ||
}; | ||
/** @internal */ | ||
exports.completeWithDeferred = completeWithDeferred; | ||
const isDoneDeferred = self => { | ||
return sync(() => MutableRef.get(self.state).op === deferred.OP_STATE_DONE); | ||
exports.deferredCompleteWith = deferredCompleteWith; | ||
const deferredIsDone = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return sync(() => MutableRef.get(self.state).op === deferred.OP_STATE_DONE).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.isDoneDeferred = isDoneDeferred; | ||
const pollDeferred = self => { | ||
exports.deferredIsDone = deferredIsDone; | ||
const deferredPoll = self => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return sync(() => { | ||
@@ -1631,14 +1747,18 @@ const state = MutableRef.get(self.state); | ||
} | ||
}); | ||
}).traced(trace); | ||
}; | ||
/** @internal */ | ||
exports.pollDeferred = pollDeferred; | ||
const interruptDeferredJoiner = (self, joiner) => { | ||
/** | ||
* @macro traced | ||
* @internal | ||
*/ | ||
exports.deferredPoll = deferredPoll; | ||
const deferredInterruptJoiner = (self, joiner) => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return sync(() => { | ||
const state = MutableRef.get(self.state); | ||
if (state.op === deferred.OP_STATE_PENDING) { | ||
(0, _Function.pipe)(self.state, MutableRef.set(deferred.pending(state.joiners.filter(j => j !== joiner)))); | ||
MutableRef.set(deferred.pending(state.joiners.filter(j => j !== joiner)))(self.state); | ||
} | ||
}); | ||
}).traced(trace); | ||
}; | ||
//# sourceMappingURL=core.js.map |
@@ -16,3 +16,3 @@ "use strict"; | ||
/** @internal */ | ||
const liveServices = /*#__PURE__*/(0, _Function.pipe)( /*#__PURE__*/Context.empty(), /*#__PURE__*/Context.add(clock.clockTag)( /*#__PURE__*/clock.make()), /*#__PURE__*/Context.add(random.randomTag)( /*#__PURE__*/random.make( /*#__PURE__*/Math.random() * 4294967296 >>> 0))); | ||
const liveServices = /*#__PURE__*/Context.add(random.randomTag)(random.make(Math.random() * 4294967296 >>> 0))( /*#__PURE__*/Context.add(clock.clockTag)(clock.make())( /*#__PURE__*/Context.empty())); | ||
/** | ||
@@ -25,3 +25,3 @@ * The `FiberRef` holding the default `Effect` services. | ||
exports.liveServices = liveServices; | ||
const currentServices = /*#__PURE__*/core.unsafeMakeEnvironmentFiberRef(liveServices); | ||
const currentServices = /*#__PURE__*/core.fiberRefUnsafeMakeEnvironment(liveServices); | ||
// circular with Clock | ||
@@ -44,3 +44,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(currentServices, core.getWithFiberRef(services => f((0, _Function.pipe)(services, Context.get(clock.clockTag))))).traced(trace); | ||
return core.fiberRefGetWith(services => f(Context.get(clock.clockTag)(services)))(currentServices).traced(trace); | ||
}; | ||
@@ -52,3 +52,3 @@ /** @internal */ | ||
return effect => { | ||
return (0, _Function.pipe)(currentServices, core.locallyWithFiberRef(Context.add(clock.clockTag)(value)))(effect).traced(trace); | ||
return core.fiberRefLocallyWith(Context.add(clock.clockTag)(value))(currentServices)(effect).traced(trace); | ||
}; | ||
@@ -61,3 +61,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(currentServices, core.getWithFiberRef(services => f((0, _Function.pipe)(services, Context.get(random.randomTag))))).traced(trace); | ||
return core.fiberRefGetWith(services => f(Context.get(random.randomTag)(services)))(currentServices).traced(trace); | ||
}; | ||
@@ -64,0 +64,0 @@ /** @internal */ |
@@ -36,3 +36,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(acquire, ensuring(fiberRuntime.addFinalizer(release))).traced(trace); | ||
return ensuring(fiberRuntime.addFinalizer(release))(acquire).traced(trace); | ||
}; | ||
@@ -42,3 +42,3 @@ /** @internal */ | ||
const awaitAllChildren = self => { | ||
return (0, _Function.pipe)(self, ensuringChildren(fiberRuntime.awaitAll)); | ||
return ensuringChildren(fiberRuntime.fiberAwaitAll)(self); | ||
}; | ||
@@ -50,3 +50,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, cachedInvalidate(timeToLive), core.map(tuple => tuple[0])).traced(trace); | ||
return core.map(tuple => tuple[0])(cachedInvalidate(timeToLive)(self)).traced(trace); | ||
}; | ||
@@ -58,3 +58,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(core.environment(), core.flatMap(env => (0, _Function.pipe)(makeSynchronized(Option.none), core.map(cache => [(0, _Function.pipe)(getCachedValue(self, timeToLive, cache), core.provideEnvironment(env)), invalidateCache(cache)])))).traced(trace); | ||
return core.flatMap(env => core.map(cache => [core.provideEnvironment(env)(getCachedValue(self, timeToLive, cache)), invalidateCache(cache)])(makeSynchronized(Option.none)))(core.environment()).traced(trace); | ||
}; | ||
@@ -65,7 +65,7 @@ }; | ||
const computeCachedValue = (self, timeToLive, start) => { | ||
return (0, _Function.pipe)(core.makeDeferred(), core.tap(deferred => (0, _Function.pipe)(self, core.intoDeferred(deferred))), core.map(deferred => Option.some([start + timeToLive.millis, deferred]))); | ||
return core.map(deferred => Option.some([start + timeToLive.millis, deferred]))(core.tap(deferred => core.intoDeferred(deferred)(self))(core.deferredMake())); | ||
}; | ||
/** @internal */ | ||
const getCachedValue = (self, timeToLive, cache) => { | ||
return core.uninterruptibleMask(restore => (0, _Function.pipe)(effect.clockWith(clock => clock.currentTimeMillis()), core.flatMap(time => (0, _Function.pipe)(cache, updateSomeAndGetEffectSynchronized(option => { | ||
return core.uninterruptibleMask(restore => core.flatMap(option => Option.isNone(option) ? effect.dieMessage("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/io/issues") : restore(core.deferredAwait(option.value[1])))(core.flatMap(time => updateSomeAndGetEffectSynchronized(option => { | ||
switch (option._tag) { | ||
@@ -82,7 +82,7 @@ case "None": | ||
} | ||
}))), core.flatMap(option => Option.isNone(option) ? effect.dieMessage("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/io/issues") : restore(core.awaitDeferred(option.value[1]))))); | ||
})(cache))(effect.clockWith(clock => clock.currentTimeMillis())))); | ||
}; | ||
/** @internal */ | ||
const invalidateCache = cache => { | ||
return (0, _Function.pipe)(cache, internalRef.set(Option.none)); | ||
return internalRef.set(Option.none)(cache); | ||
}; | ||
@@ -92,3 +92,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.uninterruptibleMask(restore => core.fiberIdWith(fiberId => (0, _Function.pipe)(restore(self), fiberRuntime.forkDaemon, core.flatMap(fiber => (0, _Function.pipe)(restore(internalFiber.join(fiber)), core.onInterrupt(() => (0, _Function.pipe)(fiber, internalFiber.interruptWithFork(fiberId)))))))).traced(trace); | ||
return core.uninterruptibleMask(restore => core.fiberIdWith(fiberId => core.flatMap(fiber => core.onInterrupt(() => internalFiber.interruptWithFork(fiberId)(fiber))(restore(internalFiber.join(fiber))))(fiberRuntime.forkDaemon(restore(self))))).traced(trace); | ||
}; | ||
@@ -99,3 +99,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return self => core.uninterruptibleMask(restore => (0, _Function.pipe)(restore(self), core.foldCauseEffect(cause1 => (0, _Function.pipe)(finalizer, core.foldCauseEffect(cause2 => core.failCause(Cause.sequential(cause1, cause2)), () => core.failCause(cause1))), a => (0, _Function.pipe)(finalizer, core.as(a))))).traced(trace); | ||
return self => core.uninterruptibleMask(restore => core.foldCauseEffect(cause1 => core.foldCauseEffect(cause2 => core.failCause(Cause.sequential(cause1, cause2)), () => core.failCause(cause1))(finalizer), a => core.as(a)(finalizer))(restore(self))).traced(trace); | ||
}; | ||
@@ -107,3 +107,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, ensuringChildren(children => f(fiberRuntime.collectAll(children)))).traced(trace); | ||
return ensuringChildren(children => f(fiberRuntime.fiberCollectAll(children)))(self).traced(trace); | ||
}; | ||
@@ -116,3 +116,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(Supervisor.track(), core.flatMap(supervisor => (0, _Function.pipe)(self, supervised(supervisor), ensuring((0, _Function.pipe)(supervisor.value(), core.flatMap(children)))))).traced(trace); | ||
return core.flatMap(supervisor => ensuring(core.flatMap(children)(supervisor.value()))(supervised(supervisor)(self)))(Supervisor.track()).traced(trace); | ||
}; | ||
@@ -124,3 +124,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(effects, core.forEach(fiberRuntime.fork), core.map(fiberRuntime.collectAll)).traced(trace); | ||
return core.map(fiberRuntime.fiberCollectAll)(core.forEach(fiberRuntime.fork)(effects)).traced(trace); | ||
}; | ||
@@ -132,3 +132,3 @@ /** @internal */ | ||
return self => { | ||
return core.uninterruptibleMask(restore => (0, _Function.pipe)(scope.fork(ExecutionStrategy.sequential), core.flatMap(child => (0, _Function.pipe)(restore(self), core.onExit(exit => child.close(exit)), fiberRuntime.forkDaemon, core.tap(fiber => child.addFinalizer(() => core.fiberIdWith(fiberId => Equal.equals(fiberId, fiber.id()) ? core.unit() : core.asUnit(core.interruptFiber(fiber))))))))).traced(trace); | ||
return core.uninterruptibleMask(restore => core.flatMap(child => core.tap(fiber => child.addFinalizer(() => core.fiberIdWith(fiberId => Equal.equals(fiberId, fiber.id()) ? core.unit() : core.asUnit(core.interruptFiber(fiber)))))(fiberRuntime.forkDaemon(core.onExit(exit => child.close(exit))(restore(self)))))(scope.fork(ExecutionStrategy.sequential))).traced(trace); | ||
}; | ||
@@ -140,3 +140,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return fiberRuntime.scopeWith(scope => (0, _Function.pipe)(self, forkIn(scope))).traced(trace); | ||
return fiberRuntime.scopeWith(scope => forkIn(scope)(self)).traced(trace); | ||
}; | ||
@@ -153,3 +153,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.suspendSucceed(() => (0, _Function.pipe)(fiber, core.flatMap(internalFiber.join))).traced(trace); | ||
return core.suspendSucceed(() => core.flatMap(internalFiber.join)(fiber)).traced(trace); | ||
}; | ||
@@ -160,11 +160,11 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => { | ||
return MutableHashMap.empty(); | ||
}), core.flatMap(makeSynchronized), core.map(ref => a => (0, _Function.pipe)(ref.modifyEffect(map => { | ||
const result = (0, _Function.pipe)(map, MutableHashMap.get(a)); | ||
return core.map(ref => a => core.flatMap(([patch, b]) => core.as(b)(effect.patchFiberRefs(patch)))(core.flatMap(core.deferredAwait)(ref.modifyEffect(map => { | ||
const result = MutableHashMap.get(a)(map); | ||
if (Option.isNone(result)) { | ||
return (0, _Function.pipe)(core.makeDeferred(), core.tap(deferred => (0, _Function.pipe)(effect.diffFiberRefs(f(a)), core.intoDeferred(deferred), fiberRuntime.fork)), core.map(deferred => [deferred, (0, _Function.pipe)(map, MutableHashMap.set(a, deferred))])); | ||
return core.map(deferred => [deferred, MutableHashMap.set(a, deferred)(map)])(core.tap(deferred => fiberRuntime.fork(core.intoDeferred(deferred)(effect.diffFiberRefs(f(a)))))(core.deferredMake())); | ||
} | ||
return core.succeed([result.value, map]); | ||
}), core.flatMap(core.awaitDeferred), core.flatMap(([patch, b]) => (0, _Function.pipe)(effect.patchFiberRefs(patch), core.as(b)))))).traced(trace); | ||
}))))(core.flatMap(makeSynchronized)(core.sync(() => { | ||
return MutableHashMap.empty(); | ||
}))).traced(trace); | ||
}; | ||
@@ -176,3 +176,3 @@ /** @internal */ | ||
return self => { | ||
return core.checkInterruptible(isInterruptible => (0, _Function.pipe)(raceDisconnect(self, isInterruptible), raceAwait(raceDisconnect(that, isInterruptible)))).traced(trace); | ||
return core.checkInterruptible(isInterruptible => raceAwait(raceDisconnect(that, isInterruptible))(raceDisconnect(self, isInterruptible))).traced(trace); | ||
}; | ||
@@ -189,3 +189,3 @@ }; | ||
return self => { | ||
return core.fiberIdWith(parentFiberId => (0, _Function.pipe)(self, raceWith(that, (exit, right) => (0, _Function.pipe)(exit, core.exitMatchEffect(cause => (0, _Function.pipe)(internalFiber.join(right), effect.mapErrorCause(cause2 => Cause.parallel(cause, cause2))), value => (0, _Function.pipe)(right, core.interruptWithFiber(parentFiberId), core.as(value)))), (exit, left) => (0, _Function.pipe)(exit, core.exitMatchEffect(cause => (0, _Function.pipe)(internalFiber.join(left), effect.mapErrorCause(cause2 => Cause.parallel(cause2, cause))), value => (0, _Function.pipe)(left, core.interruptWithFiber(parentFiberId), core.as(value))))))).traced(trace); | ||
return core.fiberIdWith(parentFiberId => raceWith(that, (exit, right) => core.exitMatchEffect(cause => effect.mapErrorCause(cause2 => Cause.parallel(cause, cause2))(internalFiber.join(right)), value => core.as(value)(core.interruptWithFiber(parentFiberId)(right)))(exit), (exit, left) => core.exitMatchEffect(cause => effect.mapErrorCause(cause2 => Cause.parallel(cause2, cause))(internalFiber.join(left)), value => core.as(value)(core.interruptWithFiber(parentFiberId)(left)))(exit))(self)).traced(trace); | ||
}; | ||
@@ -198,3 +198,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, core.map(Either.left), race((0, _Function.pipe)(that, core.map(Either.right)))).traced(trace); | ||
return race(core.map(Either.right)(that))(core.map(Either.left)(self)).traced(trace); | ||
}; | ||
@@ -207,3 +207,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(core.exit(self), race(core.exit(that)), effect => core.flatten(effect)).traced(trace); | ||
return (effect => core.flatten(effect))(race(core.exit(that))(core.exit(self))).traced(trace); | ||
}; | ||
@@ -219,4 +219,4 @@ }; | ||
const raceIndicator = MutableRef.make(true); | ||
const leftFiber = fiberRuntime.unsafeForkUnstarted(self, parentFiber, parentRuntimeFlags); | ||
const rightFiber = fiberRuntime.unsafeForkUnstarted(that, parentFiber, parentRuntimeFlags); | ||
const leftFiber = fiberRuntime.unsafeMakeChildFiber(self, parentFiber, parentRuntimeFlags); | ||
const rightFiber = fiberRuntime.unsafeMakeChildFiber(that, parentFiber, parentRuntimeFlags); | ||
leftFiber.startFork(self); | ||
@@ -226,6 +226,6 @@ rightFiber.startFork(that); | ||
rightFiber.setFiberRef(core.forkScopeOverride, Option.some(parentFiber.scope())); | ||
return (0, _Function.pipe)(core.async(cb => { | ||
return core.onInterrupt(() => core.zipRight(rightFiber.await())(core.zipRight(leftFiber.await())(core.zipRight(rightFiber.interruptWithFork(parentFiber.id()))(leftFiber.interruptWithFork(parentFiber.id())))))(core.async(cb => { | ||
leftFiber.unsafeAddObserver(() => completeRace(leftFiber, rightFiber, selfWins, raceIndicator, cb)); | ||
rightFiber.unsafeAddObserver(() => completeRace(rightFiber, leftFiber, thatWins, raceIndicator, cb)); | ||
}, (0, _Function.pipe)(leftFiber.id(), FiberId.combine(rightFiber.id()))), core.onInterrupt(() => (0, _Function.pipe)(leftFiber.interruptWithFork(parentFiber.id()), core.zipRight(rightFiber.interruptWithFork(parentFiber.id())), core.zipRight(leftFiber.await()), core.zipRight(rightFiber.await())))); | ||
}, FiberId.combine(rightFiber.id())(leftFiber.id()))); | ||
}).traced(trace); | ||
@@ -237,3 +237,3 @@ }; | ||
const completeRace = (winner, loser, cont, ab, cb) => { | ||
if ((0, _Function.pipe)(ab, MutableRef.compareAndSet(true, false))) { | ||
if (MutableRef.compareAndSet(true, false)(ab)) { | ||
cb(cont(winner, loser)); | ||
@@ -246,7 +246,7 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, raceFibersWith(that, (winner, loser) => (0, _Function.pipe)(winner.await(), core.flatMap(exit => { | ||
return raceFibersWith(that, (winner, loser) => core.flatMap(exit => { | ||
switch (exit.op) { | ||
case OpCodes.OP_SUCCESS: | ||
{ | ||
return (0, _Function.pipe)(winner.inheritAll(), core.flatMap(() => leftDone(exit, loser))); | ||
return core.flatMap(() => leftDone(exit, loser))(winner.inheritAll()); | ||
} | ||
@@ -258,7 +258,7 @@ case OpCodes.OP_FAILURE: | ||
} | ||
})), (winner, loser) => (0, _Function.pipe)(winner.await(), core.flatMap(exit => { | ||
})(winner.await()), (winner, loser) => core.flatMap(exit => { | ||
switch (exit.op) { | ||
case OpCodes.OP_SUCCESS: | ||
{ | ||
return (0, _Function.pipe)(winner.inheritAll(), core.flatMap(() => rightDone(exit, loser))); | ||
return core.flatMap(() => rightDone(exit, loser))(winner.inheritAll()); | ||
} | ||
@@ -270,3 +270,3 @@ case OpCodes.OP_FAILURE: | ||
} | ||
})))).traced(trace); | ||
})(winner.await()))(self).traced(trace); | ||
}; | ||
@@ -279,3 +279,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, _schedule.schedule_Effect(schedule), forkScoped).traced(trace); | ||
return forkScoped(_schedule.schedule_Effect(schedule)(self)).traced(trace); | ||
}; | ||
@@ -288,3 +288,3 @@ }; | ||
return self => { | ||
const supervise = (0, _Function.pipe)(fiberRuntime.currentSupervisor, core.locallyWithFiberRef(s => s.zip(supervisor))); | ||
const supervise = core.fiberRefLocallyWith(s => s.zip(supervisor))(fiberRuntime.currentSupervisor); | ||
return supervise(self).traced(trace); | ||
@@ -298,3 +298,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, timeoutTo(Option.none, Option.some, duration)).traced(trace); | ||
return timeoutTo(Option.none, Option.some, duration)(self).traced(trace); | ||
}; | ||
@@ -307,3 +307,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, timeoutTo(core.failSync(evaluate), core.succeed, duration), core.flatten).traced(trace); | ||
return core.flatten(timeoutTo(core.failSync(evaluate), core.succeed, duration)(self)).traced(trace); | ||
}; | ||
@@ -315,3 +315,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, timeoutTo(core.failCauseSync(evaluate), core.succeed, duration), core.flatten); | ||
return core.flatten(timeoutTo(core.failCauseSync(evaluate), core.succeed, duration)(self)); | ||
}; | ||
@@ -324,3 +324,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, core.map(f), raceFirst((0, _Function.pipe)(effect.sleep(duration), core.as(def), core.interruptible))).traced(trace); | ||
return raceFirst(core.interruptible(core.as(def)(effect.sleep(duration))))(core.map(f)(self)).traced(trace); | ||
}; | ||
@@ -332,3 +332,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, validateWithPar(that, (a, b) => [a, b])); | ||
return validateWithPar(that, (a, b) => [a, b])(self); | ||
}; | ||
@@ -341,3 +341,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(core.exit(self), zipWithPar(core.exit(that), (ea, eb) => (0, _Function.pipe)(ea, core.exitZipWith(eb, f, (ca, cb) => Cause.parallel(ca, cb)))), core.flatten).traced(trace); | ||
return core.flatten(zipWithPar(core.exit(that), (ea, eb) => core.exitZipWith(eb, f, (ca, cb) => Cause.parallel(ca, cb))(ea))(core.exit(self))).traced(trace); | ||
}; | ||
@@ -350,3 +350,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithPar(that, (a, b) => [a, b])).traced(trace); | ||
return zipWithPar(that, (a, b) => [a, b])(self).traced(trace); | ||
}; | ||
@@ -359,3 +359,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithPar(that, (a, _) => a)).traced(trace); | ||
return zipWithPar(that, (a, _) => a)(self).traced(trace); | ||
}; | ||
@@ -368,3 +368,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithPar(that, (_, b) => b)).traced(trace); | ||
return zipWithPar(that, (_, b) => b)(self).traced(trace); | ||
}; | ||
@@ -378,5 +378,5 @@ }; | ||
return core.uninterruptibleMask(restore => core.transplant(graft => { | ||
const deferred = core.unsafeMakeDeferred(FiberId.none); | ||
const deferred = core.deferredUnsafeMake(FiberId.none); | ||
const ref = MutableRef.make(false); | ||
return (0, _Function.pipe)(forkZipWithPar(self, graft, restore, deferred, ref), core.zip(forkZipWithPar(that, graft, restore, deferred, ref)), core.flatMap(([left, right]) => (0, _Function.pipe)(restore(core.awaitDeferred(deferred)), core.foldCauseEffect(cause => (0, _Function.pipe)(fiberRuntime.interruptFork(left), core.zipRight(fiberRuntime.interruptFork(right)), core.zipRight((0, _Function.pipe)(internalFiber._await(left), core.zip(internalFiber._await(right)), core.flatMap(([left, right]) => (0, _Function.pipe)(left, core.exitZipWith(right, f, Cause.parallel), core.exitMatch(causes => core.failCause(Cause.parallel(Cause.stripFailures(cause), causes)), () => core.failCause(Cause.stripFailures(cause)))))))), () => (0, _Function.pipe)(internalFiber.join(left), core.zipWith(internalFiber.join(right), f)))))); | ||
return core.flatMap(([left, right]) => core.foldCauseEffect(cause => core.zipRight(core.flatMap(([left, right]) => core.exitMatch(causes => core.failCause(Cause.parallel(Cause.stripFailures(cause), causes)), () => core.failCause(Cause.stripFailures(cause)))(core.exitZipWith(right, f, Cause.parallel)(left)))(core.zip(internalFiber._await(right))(internalFiber._await(left))))(core.zipRight(fiberRuntime.fiberInterruptFork(right))(fiberRuntime.fiberInterruptFork(left))), () => core.zipWith(internalFiber.join(right), f)(internalFiber.join(left)))(restore(core.deferredAwait(deferred))))(core.zip(forkZipWithPar(that, graft, restore, deferred, ref))(forkZipWithPar(self, graft, restore, deferred, ref))); | ||
})).traced(trace); | ||
@@ -388,11 +388,11 @@ }; | ||
const forkZipWithPar = (self, graft, restore, deferred, ref) => { | ||
return (0, _Function.pipe)(graft(restore(self)), core.foldCauseEffect(cause => (0, _Function.pipe)(deferred, core.failDeferred(void 0), core.zipRight(core.failCause(cause))), value => { | ||
return fiberRuntime.forkDaemon(core.foldCauseEffect(cause => core.zipRight(core.failCause(cause))(core.deferredFail(void 0)(deferred)), value => { | ||
const flag = MutableRef.get(ref); | ||
if (flag) { | ||
(0, _Function.pipe)(deferred, core.unsafeDoneDeferred(core.unit())); | ||
core.deferredUnsafeDone(core.unit())(deferred); | ||
return core.succeed(value); | ||
} | ||
(0, _Function.pipe)(ref, MutableRef.set(true)); | ||
MutableRef.set(true)(ref); | ||
return core.succeed(value); | ||
}), fiberRuntime.forkDaemon); | ||
})(graft(restore(self)))); | ||
}; | ||
@@ -428,3 +428,3 @@ // circular with Synchronized | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(internalRef.get(ref), core.flatMap(f), core.flatMap(([b, a]) => (0, _Function.pipe)(ref, internalRef.set(a), core.as(b))), withPermits(1)(semaphore)).traced(trace); | ||
return withPermits(1)(semaphore)(core.flatMap(([b, a]) => core.as(b)(internalRef.set(a)(ref)))(core.flatMap(f)(internalRef.get(ref)))).traced(trace); | ||
} | ||
@@ -447,3 +447,3 @@ }; | ||
{ | ||
return (0, _Function.pipe)(result.value, core.map(a => [a, a])); | ||
return core.map(a => [a, a])(result.value); | ||
} | ||
@@ -477,7 +477,7 @@ } | ||
} | ||
const value = (0, _Function.pipe)(self.permits, TRef.unsafeGet(journal)); | ||
const value = TRef.unsafeGet(journal)(self.permits); | ||
if (value < n) { | ||
throw new STM.STMRetryException(); | ||
} else { | ||
return (0, _Function.pipe)(self.permits, TRef.unsafeSet(value - n, journal)); | ||
return TRef.unsafeSet(value - n, journal)(self.permits); | ||
} | ||
@@ -494,4 +494,4 @@ }); | ||
} | ||
const current = (0, _Function.pipe)(self.permits, TRef.unsafeGet(journal)); | ||
return (0, _Function.pipe)(self.permits, TRef.unsafeSet(current + n, journal)); | ||
const current = TRef.unsafeGet(journal)(self.permits); | ||
return TRef.unsafeSet(current + n, journal)(self.permits); | ||
}); | ||
@@ -504,3 +504,3 @@ }; | ||
return self => { | ||
return core.uninterruptibleMask(restore => (0, _Function.pipe)(restore(STM.commit(acquireN(permits)(semaphore))), core.zipRight((0, _Function.pipe)(restore(self), ensuring(STM.commit(releaseN(permits)(semaphore))))))); | ||
return core.uninterruptibleMask(restore => core.zipRight(ensuring(STM.commit(releaseN(permits)(semaphore)))(restore(self)))(restore(STM.commit(acquireN(permits)(semaphore))))); | ||
}; | ||
@@ -511,3 +511,3 @@ }; | ||
const withPermitsScoped = permits => { | ||
return self => acquireReleaseInterruptible((0, _Function.pipe)(self, acquireN(permits), STM.commit), () => (0, _Function.pipe)(self, releaseN(permits), STM.commit)); | ||
return self => acquireReleaseInterruptible(STM.commit(acquireN(permits)(self)), () => STM.commit(releaseN(permits)(self))); | ||
}; | ||
@@ -519,3 +519,3 @@ // circular with Fiber | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithFiber(that, (a, b) => [a, b])); | ||
return zipWithFiber(that, (a, b) => [a, b])(self); | ||
}; | ||
@@ -527,3 +527,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithFiber(that, (a, _) => a)); | ||
return zipWithFiber(that, (a, _) => a)(self); | ||
}; | ||
@@ -535,3 +535,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithFiber(that, (_, b) => b)); | ||
return zipWithFiber(that, (_, b) => b)(self); | ||
}; | ||
@@ -544,6 +544,6 @@ }; | ||
[internalFiber.FiberTypeId]: internalFiber.fiberVariance, | ||
id: () => (0, _Function.pipe)(self.id(), FiberId.getOrElse(that.id())), | ||
id: () => FiberId.getOrElse(that.id())(self.id()), | ||
await: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.await(), core.flatten, zipWithPar(core.flatten(that.await()), f), core.exit).traced(trace); | ||
return core.exit(zipWithPar(core.flatten(that.await()), f)(core.flatten(self.await()))).traced(trace); | ||
}, | ||
@@ -556,11 +556,11 @@ children: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(that.inheritAll(), core.zipRight(self.inheritAll())).traced(trace); | ||
return core.zipRight(self.inheritAll())(that.inheritAll()).traced(trace); | ||
}, | ||
poll: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.poll(), core.zipWith(that.poll(), (optionA, optionB) => (0, _Function.pipe)(optionA, Option.flatMap(exitA => (0, _Function.pipe)(optionB, Option.map(exitB => (0, _Function.pipe)(exitA, Exit.zipWith(exitB, f, Cause.parallel)))))))).traced(trace); | ||
return core.zipWith(that.poll(), (optionA, optionB) => Option.flatMap(exitA => Option.map(exitB => Exit.zipWith(exitB, f, Cause.parallel)(exitA))(optionB))(optionA))(self.poll()).traced(trace); | ||
}, | ||
interruptWithFork: id => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.interruptWithFork(id), core.zipRight(that.interruptWithFork(id))).traced(trace); | ||
return core.zipRight(that.interruptWithFork(id))(self.interruptWithFork(id)).traced(trace); | ||
} | ||
@@ -567,0 +567,0 @@ }); |
@@ -14,2 +14,3 @@ "use strict"; | ||
var RuntimeFlags = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Fiber/Runtime/Flags")); | ||
var FiberStatus = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Fiber/Status")); | ||
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core")); | ||
@@ -43,3 +44,3 @@ var fiberScope = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/fiberScope")); | ||
exports.RuntimeFiberTypeId = RuntimeFiberTypeId; | ||
const Order = /*#__PURE__*/(0, _Function.pipe)( /*#__PURE__*/order.tuple(number.Order, number.Order), /*#__PURE__*/order.contramap(fiber => [fiber.id().startTimeMillis, fiber.id().id])); | ||
const Order = /*#__PURE__*/order.contramap(fiber => [fiber.id().startTimeMillis, fiber.id().id])( /*#__PURE__*/order.tuple(number.Order, number.Order)); | ||
/** @internal */ | ||
@@ -99,6 +100,6 @@ exports.Order = Order; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.status(), core.map(status => ({ | ||
return core.map(status => ({ | ||
id: self.id(), | ||
status | ||
}))).traced(trace); | ||
}))(self.status()).traced(trace); | ||
}; | ||
@@ -109,3 +110,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(fibers, core.forEach(dump)).traced(trace); | ||
return core.forEach(dump)(fibers).traced(trace); | ||
}; | ||
@@ -126,3 +127,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.exit(effect), core.map(done)).traced(trace); | ||
return core.map(done)(core.exit(effect)).traced(trace); | ||
}; | ||
@@ -149,3 +150,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.fiberId(), core.flatMap(fiberId => (0, _Function.pipe)(fibers, interruptAllWith(fiberId)))).traced(trace); | ||
return core.flatMap(fiberId => interruptAllWith(fiberId)(fibers))(core.fiberId()).traced(trace); | ||
}; | ||
@@ -157,3 +158,3 @@ /** @internal */ | ||
return fibers => { | ||
return (0, _Function.pipe)(fibers, core.forEachDiscard(interruptWithFork(fiberId)), core.zipRight((0, _Function.pipe)(fibers, core.forEachDiscard(_await)))).traced(trace); | ||
return core.zipRight(core.forEachDiscard(_await)(fibers))(core.forEachDiscard(interruptWithFork(fiberId))(fibers)).traced(trace); | ||
}; | ||
@@ -173,3 +174,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.await(), core.flatten, core.zipLeft(self.inheritAll())).traced(trace); | ||
return core.zipLeft(self.inheritAll())(core.flatten(self.await())).traced(trace); | ||
}; | ||
@@ -180,3 +181,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, mapEffect(a => core.sync(() => f(a)))); | ||
return mapEffect(a => core.sync(() => f(a)))(self); | ||
}; | ||
@@ -193,3 +194,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.await(), core.flatMap(Exit.forEachEffect(f))).traced(trace); | ||
return core.flatMap(Exit.forEachEffect(f))(self.await()).traced(trace); | ||
}, | ||
@@ -206,3 +207,3 @@ children: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.poll(), core.flatMap(result => { | ||
return core.flatMap(result => { | ||
switch (result._tag) { | ||
@@ -215,6 +216,6 @@ case "None": | ||
{ | ||
return (0, _Function.pipe)(result.value, Exit.forEachEffect(f), core.map(Option.some)); | ||
return core.map(Option.some)(Exit.forEachEffect(f)(result.value)); | ||
} | ||
} | ||
})).traced(trace); | ||
})(self.poll()).traced(trace); | ||
}, | ||
@@ -233,3 +234,3 @@ interruptWithFork: id => { | ||
return self => { | ||
return (0, _Function.pipe)(self.await(), core.map(Exit.match(cause => failCause(cause), a => f(a)))).traced(trace); | ||
return core.map(Exit.match(cause => failCause(cause), a => f(a)))(self.await()).traced(trace); | ||
}; | ||
@@ -277,6 +278,6 @@ }; | ||
[FiberTypeId]: fiberVariance, | ||
id: () => (0, _Function.pipe)(self.id(), FiberId.getOrElse(that.id())), | ||
id: () => FiberId.getOrElse(that.id())(self.id()), | ||
await: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.await(), core.zipWith(that.await(), (exit1, exit2) => Exit.isSuccess(exit1) ? exit1 : exit2)).traced(trace); | ||
return core.zipWith(that.await(), (exit1, exit2) => Exit.isSuccess(exit1) ? exit1 : exit2)(self.await()).traced(trace); | ||
}, | ||
@@ -289,7 +290,7 @@ children: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(that.inheritAll(), core.zipRight(self.inheritAll())).traced(trace); | ||
return core.zipRight(self.inheritAll())(that.inheritAll()).traced(trace); | ||
}, | ||
poll: () => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.poll(), core.zipWith(that.poll(), (option1, option2) => { | ||
return core.zipWith(that.poll(), (option1, option2) => { | ||
switch (option1._tag) { | ||
@@ -305,7 +306,7 @@ case "None": | ||
} | ||
})).traced(trace); | ||
})(self.poll()).traced(trace); | ||
}, | ||
interruptWithFork: id => { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, core.interruptWithFiber(id), core.zipRight((0, _Function.pipe)(that, core.interruptWithFiber(id))), core.asUnit).traced(trace); | ||
return core.asUnit(core.zipRight(core.interruptWithFiber(id)(that))(core.interruptWithFiber(id)(self))).traced(trace); | ||
} | ||
@@ -318,3 +319,3 @@ }); | ||
return self => { | ||
return (0, _Function.pipe)(self, map(Either.left), orElse((0, _Function.pipe)(that, map(Either.right)))); | ||
return orElse(map(Either.right)(that))(map(Either.left)(self)); | ||
}; | ||
@@ -347,13 +348,10 @@ }; | ||
const renderStatus = status => { | ||
switch (status._tag) { | ||
case "Done": | ||
return "Done"; | ||
case "Running": | ||
return "Running"; | ||
case "Suspended": | ||
{ | ||
const isInterruptible = RuntimeFlags.interruptible(status.runtimeFlags) ? "interruptible" : "uninterruptible"; | ||
return `Suspended(${isInterruptible})`; | ||
} | ||
if (FiberStatus.isDone(status)) { | ||
return "Done"; | ||
} | ||
if (FiberStatus.isRunning(status)) { | ||
return "Running"; | ||
} | ||
const isInterruptible = RuntimeFlags.interruptible(status.runtimeFlags) ? "interruptible" : "uninterruptible"; | ||
return `Suspended(${isInterruptible})`; | ||
}; | ||
@@ -363,3 +361,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(Clock.currentTimeMillis(), core.flatMap(now => (0, _Function.pipe)(dump(self), core.map(dump => { | ||
return core.flatMap(now => core.map(dump => { | ||
const time = now - dump.id.startTimeMillis; | ||
@@ -374,18 +372,9 @@ const { | ||
const lifeMsg = (days === 0 ? "" : `${days}d`) + (days === 0 && hours === 0 ? "" : `${hours}h`) + (days === 0 && hours === 0 && minutes === 0 ? "" : `${minutes}m`) + (days === 0 && hours === 0 && minutes === 0 && seconds === 0 ? "" : `${seconds}s`) + `${milliseconds}ms`; | ||
const waitMsg = (status => { | ||
switch (status._tag) { | ||
case "Suspended": | ||
{ | ||
const ids = FiberId.ids(status.blockingOn); | ||
return HashSet.size(ids) > 0 ? `waiting on ` + Array.from(ids).map(id => `${id}`).join(", ") : ""; | ||
} | ||
default: | ||
{ | ||
return ""; | ||
} | ||
} | ||
})(dump.status); | ||
const waitMsg = FiberStatus.isSuspended(dump.status) ? (() => { | ||
const ids = FiberId.ids(dump.status.blockingOn); | ||
return HashSet.size(ids) > 0 ? `waiting on ` + Array.from(ids).map(id => `${id}`).join(", ") : ""; | ||
})() : ""; | ||
const statusMsg = renderStatus(dump.status); | ||
return `[Fiber](#${dump.id.id}) (${lifeMsg}) ${waitMsg}\n Status: ${statusMsg}`; | ||
})))).traced(trace); | ||
})(dump(self)))(Clock.currentTimeMillis()).traced(trace); | ||
}; | ||
@@ -392,0 +381,0 @@ /** @internal */ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.unsafeMake = exports.toSet = exports.toOption = exports.threadName = exports.runtime = exports.none = exports.make = exports.isNone = exports.isFiberId = exports.ids = exports.getOrElse = exports.composite = exports.combineAll = exports.combine = exports.FiberIdTypeId = void 0; | ||
exports.unsafeMake = exports.toSet = exports.toOption = exports.threadName = exports.runtime = exports.none = exports.make = exports.isRuntime = exports.isNone = exports.isFiberId = exports.isComposite = exports.ids = exports.getOrElse = exports.composite = exports.combineAll = exports.combine = exports.FiberIdTypeId = void 0; | ||
var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Equal")); | ||
@@ -16,2 +16,3 @@ var _Function = /*#__PURE__*/require("@fp-ts/data/Function"); | ||
var _a, _b, _c; | ||
/** @internal */ | ||
const FiberIdSymbolKey = "@effect/io/Fiber/Id"; | ||
@@ -22,12 +23,18 @@ /** @internal */ | ||
exports.FiberIdTypeId = FiberIdTypeId; | ||
const OP_NONE = 0; | ||
/** @internal */ | ||
const OP_RUNTIME = 1; | ||
/** @internal */ | ||
const OP_COMPOSITE = 2; | ||
/** @internal */ | ||
class None { | ||
constructor() { | ||
this[_a] = FiberIdTypeId; | ||
this._tag = "None"; | ||
this.op = OP_NONE; | ||
} | ||
[(_a = FiberIdTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FiberIdSymbolKey), Equal.hashCombine(Equal.hash(this._tag))); | ||
return Equal.hashCombine(Equal.hash(this.op))(Equal.hash(FiberIdSymbolKey)); | ||
} | ||
[Equal.symbolEqual](that) { | ||
return isFiberId(that) && that._tag === "None"; | ||
return isFiberId(that) && that.op === OP_NONE; | ||
} | ||
@@ -41,9 +48,9 @@ } | ||
this[_b] = FiberIdTypeId; | ||
this._tag = "Runtime"; | ||
this.op = OP_RUNTIME; | ||
} | ||
[(_b = FiberIdTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FiberIdSymbolKey), Equal.hashCombine(Equal.hash(this._tag)), Equal.hashCombine(Equal.hash(this.id)), Equal.hashCombine(Equal.hash(this.startTimeMillis))); | ||
return Equal.hashCombine(Equal.hash(this.startTimeMillis))(Equal.hashCombine(Equal.hash(this.id))(Equal.hashCombine(Equal.hash(this.op))(Equal.hash(FiberIdSymbolKey)))); | ||
} | ||
[Equal.symbolEqual](that) { | ||
return isFiberId(that) && that._tag === "Runtime" && this.id === that.id && this.startTimeMillis === that.startTimeMillis; | ||
return isFiberId(that) && that.op === OP_RUNTIME && this.id === that.id && this.startTimeMillis === that.startTimeMillis; | ||
} | ||
@@ -57,9 +64,9 @@ } | ||
this[_c] = FiberIdTypeId; | ||
this._tag = "Composite"; | ||
this.op = OP_COMPOSITE; | ||
} | ||
[(_c = FiberIdTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FiberIdSymbolKey), Equal.hashCombine(Equal.hash(this._tag)), Equal.hashCombine(Equal.hash(this.left)), Equal.hashCombine(Equal.hash(this.right))); | ||
return Equal.hashCombine(Equal.hash(this.right))(Equal.hashCombine(Equal.hash(this.left))(Equal.hashCombine(Equal.hash(this.op))(Equal.hash(FiberIdSymbolKey)))); | ||
} | ||
[Equal.symbolEqual](that) { | ||
return isFiberId(that) && that._tag === "Composite" && Equal.equals(this.left, that.left) && Equal.equals(this.right, that.right); | ||
return isFiberId(that) && that.op === OP_COMPOSITE && Equal.equals(this.left, that.left) && Equal.equals(this.right, that.right); | ||
} | ||
@@ -87,12 +94,22 @@ } | ||
const isNone = self => { | ||
return (0, _Function.pipe)(toSet(self), HashSet.every(id => isNone(id))); | ||
return self.op === OP_NONE || HashSet.every(id => isNone(id))(toSet(self)); | ||
}; | ||
/** @internal */ | ||
exports.isNone = isNone; | ||
const isRuntime = self => { | ||
return self.op === OP_RUNTIME; | ||
}; | ||
/** @internal */ | ||
exports.isRuntime = isRuntime; | ||
const isComposite = self => { | ||
return self.op === OP_COMPOSITE; | ||
}; | ||
/** @internal */ | ||
exports.isComposite = isComposite; | ||
const combine = that => { | ||
return self => { | ||
if (self._tag === "None") { | ||
if (self.op === OP_NONE) { | ||
return that; | ||
} | ||
if (that._tag === "None") { | ||
if (that.op === OP_NONE) { | ||
return self; | ||
@@ -106,3 +123,3 @@ } | ||
const combineAll = fiberIds => { | ||
return (0, _Function.pipe)(fiberIds, HashSet.reduce(none, (a, b) => combine(b)(a))); | ||
return HashSet.reduce(none, (a, b) => combine(b)(a))(fiberIds); | ||
}; | ||
@@ -117,14 +134,14 @@ /** @internal */ | ||
const ids = self => { | ||
switch (self._tag) { | ||
case "None": | ||
switch (self.op) { | ||
case OP_NONE: | ||
{ | ||
return HashSet.empty(); | ||
} | ||
case "Runtime": | ||
case OP_RUNTIME: | ||
{ | ||
return HashSet.make(self.id); | ||
} | ||
case "Composite": | ||
case OP_COMPOSITE: | ||
{ | ||
return (0, _Function.pipe)(ids(self.left), HashSet.union(ids(self.right))); | ||
return HashSet.union(ids(self.right))(ids(self.left)); | ||
} | ||
@@ -141,9 +158,2 @@ } | ||
exports.make = make; | ||
const unsafeMake = () => { | ||
const id = MutableRef.get(_fiberCounter); | ||
(0, _Function.pipe)(_fiberCounter, MutableRef.set(id + 1)); | ||
return new Runtime(id, new Date().getTime()); | ||
}; | ||
/** @internal */ | ||
exports.unsafeMake = unsafeMake; | ||
const threadName = self => { | ||
@@ -169,3 +179,3 @@ const identifiers = Array.from(ids(self)).map(n => `${n}`).join(","); | ||
// @ts-expect-error | ||
acc = (0, _Function.pipe)(acc, combine(fiberId)); | ||
acc = combine(fiberId)(acc); | ||
} | ||
@@ -179,18 +189,25 @@ } | ||
const toSet = self => { | ||
switch (self._tag) { | ||
case "None": | ||
switch (self.op) { | ||
case OP_NONE: | ||
{ | ||
return HashSet.empty(); | ||
} | ||
case "Composite": | ||
case OP_RUNTIME: | ||
{ | ||
return (0, _Function.pipe)(toSet(self.left), HashSet.union(toSet(self.right))); | ||
return HashSet.make(self); | ||
} | ||
case "Runtime": | ||
case OP_COMPOSITE: | ||
{ | ||
return HashSet.make(self); | ||
return HashSet.union(toSet(self.right))(toSet(self.left)); | ||
} | ||
} | ||
}; | ||
/** @internal */ | ||
exports.toSet = toSet; | ||
const unsafeMake = () => { | ||
const id = MutableRef.get(_fiberCounter); | ||
MutableRef.set(id + 1)(_fiberCounter); | ||
return new Runtime(id, new Date().getTime()); | ||
}; | ||
exports.unsafeMake = unsafeMake; | ||
//# sourceMappingURL=fiberId.js.map |
@@ -123,3 +123,3 @@ "use strict"; | ||
exports.fiberRefs = fiberRefs; | ||
const setAll = self => (0, _Function.pipe)(self, fiberRefs, core.forEachDiscard(fiberRef => (0, _Function.pipe)(fiberRef, core.setFiberRef(getOrDefault(fiberRef)(self))))); | ||
const setAll = self => core.forEachDiscard(fiberRef => core.fiberRefSet(getOrDefault(fiberRef)(self))(fiberRef))(fiberRefs(self)); | ||
exports.setAll = setAll; | ||
@@ -141,3 +141,3 @@ const delete_ = fiberRef => self => { | ||
exports.get = get; | ||
const getOrDefault = fiberRef => self => (0, _Function.pipe)(self, get(fiberRef), Option.getOrElse(() => fiberRef.initial)); | ||
const getOrDefault = fiberRef => self => Option.getOrElse(() => fiberRef.initial)(get(fiberRef)(self)); | ||
/** @internal */ | ||
@@ -144,0 +144,0 @@ exports.getOrDefault = getOrDefault; |
@@ -91,3 +91,3 @@ "use strict"; | ||
{ | ||
fiberRefs = (0, _Function.pipe)(fiberRefs, _fiberRefs.updatedAs(fiberId, head.fiberRef, head.value)); | ||
fiberRefs = _fiberRefs.updatedAs(fiberId, head.fiberRef, head.value)(fiberRefs); | ||
patches = tail; | ||
@@ -98,3 +98,3 @@ break; | ||
{ | ||
fiberRefs = (0, _Function.pipe)(fiberRefs, _fiberRefs.delete(head.fiberRef)); | ||
fiberRefs = _fiberRefs.delete(head.fiberRef)(fiberRefs); | ||
patches = tail; | ||
@@ -105,4 +105,4 @@ break; | ||
{ | ||
const value = (0, _Function.pipe)(fiberRefs, _fiberRefs.getOrDefault(head.fiberRef)); | ||
fiberRefs = (0, _Function.pipe)(fiberRefs, _fiberRefs.updatedAs(fiberId, head.fiberRef, head.fiberRef.patch(head.patch)(value))); | ||
const value = _fiberRefs.getOrDefault(head.fiberRef)(fiberRefs); | ||
fiberRefs = _fiberRefs.updatedAs(fiberId, head.fiberRef, head.fiberRef.patch(head.patch)(value))(fiberRefs); | ||
patches = tail; | ||
@@ -109,0 +109,0 @@ break; |
@@ -11,3 +11,3 @@ import type * as Effect from "@effect/io/Effect"; | ||
export declare const currentFiber: MutableRef.MutableRef<FiberRuntime<any, any> | null>; | ||
export declare const makeRuntimeFlagsFiberRef: (initial: RuntimeFlags.RuntimeFlags) => Effect.Effect<Scope.Scope, never, FiberRef.FiberRef<RuntimeFlags.RuntimeFlags>>; | ||
export declare const fiberRefMakeRuntimeFlags: (initial: RuntimeFlags.RuntimeFlags) => Effect.Effect<Scope.Scope, never, FiberRef.FiberRef<RuntimeFlags.RuntimeFlags>>; | ||
//# sourceMappingURL=fiberRuntime.d.ts.map |
@@ -1,2 +0,18 @@ | ||
export {}; | ||
import * as FiberId from "@effect/io/Fiber/Id"; | ||
import * as RuntimeFlags from "@effect/io/Fiber/Runtime/Flags"; | ||
import type * as FiberRuntime from "@effect/io/internal/fiberRuntime"; | ||
export type FiberScopeTypeId = typeof FiberScopeTypeId; | ||
/** | ||
* A `FiberScope` represents the scope of a fiber lifetime. The scope of a | ||
* fiber can be retrieved using `Effect.descriptor`, and when forking fibers, | ||
* you can specify a custom scope to fork them on by using the `forkIn`. | ||
* | ||
* @since 1.0.0 | ||
* @category models | ||
*/ | ||
export interface FiberScope { | ||
readonly [FiberScopeTypeId]: FiberScopeTypeId; | ||
get fiberId(): FiberId.FiberId; | ||
add(runtimeFlags: RuntimeFlags.RuntimeFlags, child: FiberRuntime.FiberRuntime<any, any>): void; | ||
} | ||
//# sourceMappingURL=fiberScope.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.suspended = exports.running = exports.isSuspended = exports.isRunning = exports.isFiberStatus = exports.isDone = exports.done = exports.FiberStatusTypeId = void 0; | ||
exports.suspended = exports.running = exports.isSuspended = exports.isRunning = exports.isFiberStatus = exports.isDone = exports.done = exports.OP_SUSPENDED = exports.OP_RUNNING = exports.OP_DONE = exports.FiberStatusTypeId = void 0; | ||
var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Equal")); | ||
@@ -18,12 +18,21 @@ var _Function = /*#__PURE__*/require("@fp-ts/data/Function"); | ||
exports.FiberStatusTypeId = FiberStatusTypeId; | ||
const OP_DONE = 0; | ||
/** @internal */ | ||
exports.OP_DONE = OP_DONE; | ||
const OP_RUNNING = 1; | ||
/** @internal */ | ||
exports.OP_RUNNING = OP_RUNNING; | ||
const OP_SUSPENDED = 2; | ||
/** @internal */ | ||
exports.OP_SUSPENDED = OP_SUSPENDED; | ||
class Done { | ||
constructor() { | ||
this[_a] = FiberStatusTypeId; | ||
this._tag = "Done"; | ||
this.op = OP_DONE; | ||
} | ||
[(_a = FiberStatusTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FiberStatusSymbolKey), Equal.hashCombine(Equal.hash(this._tag))); | ||
return Equal.hashCombine(Equal.hash(this.op))(Equal.hash(FiberStatusSymbolKey)); | ||
} | ||
[Equal.symbolEqual](that) { | ||
return isFiberStatus(that) && that._tag === "Done"; | ||
return isFiberStatus(that) && that.op === OP_DONE; | ||
} | ||
@@ -36,9 +45,9 @@ } | ||
this[_b] = FiberStatusTypeId; | ||
this._tag = "Running"; | ||
this.op = OP_RUNNING; | ||
} | ||
[(_b = FiberStatusTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FiberStatusSymbolKey), Equal.hashCombine(Equal.hash(this._tag)), Equal.hashCombine(Equal.hash(this.runtimeFlags))); | ||
return Equal.hashCombine(Equal.hash(this.runtimeFlags))(Equal.hashCombine(Equal.hash(this.op))(Equal.hash(FiberStatusSymbolKey))); | ||
} | ||
[Equal.symbolEqual](that) { | ||
return isFiberStatus(that) && that._tag === "Running" && this.runtimeFlags === that.runtimeFlags; | ||
return isFiberStatus(that) && that.op === OP_RUNNING && this.runtimeFlags === that.runtimeFlags; | ||
} | ||
@@ -52,9 +61,9 @@ } | ||
this[_c] = FiberStatusTypeId; | ||
this._tag = "Suspended"; | ||
this.op = OP_SUSPENDED; | ||
} | ||
[(_c = FiberStatusTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FiberStatusSymbolKey), Equal.hashCombine(Equal.hash(this._tag)), Equal.hashCombine(Equal.hash(this.runtimeFlags)), Equal.hashCombine(Equal.hash(this.blockingOn))); | ||
return Equal.hashCombine(Equal.hash(this.blockingOn))(Equal.hashCombine(Equal.hash(this.runtimeFlags))(Equal.hashCombine(Equal.hash(this.op))(Equal.hash(FiberStatusSymbolKey)))); | ||
} | ||
[Equal.symbolEqual](that) { | ||
return isFiberStatus(that) && that._tag === "Suspended" && this.runtimeFlags === that.runtimeFlags && Equal.equals(this.blockingOn, that.blockingOn); | ||
return isFiberStatus(that) && that.op === OP_SUSPENDED && this.runtimeFlags === that.runtimeFlags && Equal.equals(this.blockingOn, that.blockingOn); | ||
} | ||
@@ -82,3 +91,3 @@ } | ||
const isDone = self => { | ||
return self._tag === "Done"; | ||
return self.op === OP_DONE; | ||
}; | ||
@@ -88,3 +97,3 @@ /** @internal */ | ||
const isRunning = self => { | ||
return self._tag === "Running"; | ||
return self.op === OP_RUNNING; | ||
}; | ||
@@ -94,5 +103,5 @@ /** @internal */ | ||
const isSuspended = self => { | ||
return self._tag === "Suspended"; | ||
return self.op === OP_SUSPENDED; | ||
}; | ||
exports.isSuspended = isSuspended; | ||
//# sourceMappingURL=fiberStatus.js.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => makeBoundedHub(requestedCapacity)), core.flatMap(atomicHub => makeHub(atomicHub, new BackPressureStrategy()))).traced(trace); | ||
return core.flatMap(atomicHub => makeHub(atomicHub, new BackPressureStrategy()))(core.sync(() => makeBoundedHub(requestedCapacity))).traced(trace); | ||
}; | ||
@@ -31,3 +31,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => makeBoundedHub(requestedCapacity)), core.flatMap(atomicHub => makeHub(atomicHub, new DroppingStrategy()))).traced(trace); | ||
return core.flatMap(atomicHub => makeHub(atomicHub, new DroppingStrategy()))(core.sync(() => makeBoundedHub(requestedCapacity))).traced(trace); | ||
}; | ||
@@ -37,3 +37,3 @@ /** @internal */ | ||
const sliding = requestedCapacity => { | ||
return (0, _Function.pipe)(core.sync(() => makeBoundedHub(requestedCapacity)), core.flatMap(atomicHub => makeHub(atomicHub, new SlidingStrategy()))); | ||
return core.flatMap(atomicHub => makeHub(atomicHub, new SlidingStrategy()))(core.sync(() => makeBoundedHub(requestedCapacity))); | ||
}; | ||
@@ -43,3 +43,3 @@ /** @internal */ | ||
const unbounded = () => { | ||
return (0, _Function.pipe)(core.sync(() => makeUnboundedHub()), core.flatMap(atomicHub => makeHub(atomicHub, new DroppingStrategy()))); | ||
return core.flatMap(atomicHub => makeHub(atomicHub, new DroppingStrategy()))(core.sync(() => makeUnboundedHub())); | ||
}; | ||
@@ -128,3 +128,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.makeDeferred(), core.map(deferred => unsafeMakeSubscription(hub, subscribers, hub.subscribe(), MutableQueue.unbounded(), deferred, MutableRef.make(false), strategy))).traced(trace); | ||
return core.map(deferred => unsafeMakeSubscription(hub, subscribers, hub.subscribe(), MutableQueue.unbounded(), deferred, MutableRef.make(false), strategy))(core.deferredMake()).traced(trace); | ||
}; | ||
@@ -183,3 +183,3 @@ /** @internal */ | ||
while (this.publisherIndex !== publishAllIndex) { | ||
const a = (0, _Function.pipe)(chunk, Chunk.unsafeGet(iteratorIndex++)); | ||
const a = Chunk.unsafeGet(iteratorIndex++)(chunk); | ||
const index = this.publisherIndex % this.capacity; | ||
@@ -190,3 +190,3 @@ this.array[index] = a; | ||
} | ||
return (0, _Function.pipe)(chunk, Chunk.drop(iteratorIndex - 1)); | ||
return Chunk.drop(iteratorIndex - 1)(chunk); | ||
} | ||
@@ -329,3 +329,3 @@ slide() { | ||
while (this.publisherIndex !== publishAllIndex) { | ||
const elem = (0, _Function.pipe)(chunk, Chunk.unsafeGet(iteratorIndex++)); | ||
const elem = Chunk.unsafeGet(iteratorIndex++)(chunk); | ||
const index = this.publisherIndex & this.mask; | ||
@@ -336,3 +336,3 @@ this.array[index] = elem; | ||
} | ||
return (0, _Function.pipe)(chunk, Chunk.drop(iteratorIndex - 1)); | ||
return Chunk.drop(iteratorIndex - 1)(chunk); | ||
} | ||
@@ -463,3 +463,3 @@ slide() { | ||
if (this.publish(Chunk.unsafeHead(chunk))) { | ||
return (0, _Function.pipe)(chunk, Chunk.drop(1)); | ||
return Chunk.drop(1)(chunk); | ||
} else { | ||
@@ -699,14 +699,14 @@ return chunk; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.size(), core.map(size => size === this.capacity())).traced(trace); | ||
return core.map(size => size === this.capacity())(this.size()).traced(trace); | ||
} | ||
isEmpty() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.size(), core.map(size => size === 0)).traced(trace); | ||
return core.map(size => size === 0)(this.size()).traced(trace); | ||
} | ||
shutdown() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.withFiberRuntime(state => { | ||
(0, _Function.pipe)(this.shutdownFlag, MutableRef.set(true)); | ||
return (0, _Function.pipe)(unsafePollAllQueue(this.pollers), fiberRuntime.forEachPar(core.interruptAsDeferred(state.id())), core.zipRight(core.sync(() => this.subscription.unsubscribe())), core.zipRight(core.sync(() => this.strategy.unsafeOnHubEmptySpace(this.hub, this.subscribers))), core.whenEffect((0, _Function.pipe)(this.shutdownHook, core.succeedDeferred(void 0))), core.asUnit); | ||
}), core.uninterruptible).traced(trace); | ||
return core.uninterruptible(core.withFiberRuntime(state => { | ||
MutableRef.set(true)(this.shutdownFlag); | ||
return core.asUnit(core.whenEffect(core.deferredSucceed(void 0)(this.shutdownHook))(core.zipRight(core.sync(() => this.strategy.unsafeOnHubEmptySpace(this.hub, this.subscribers)))(core.zipRight(core.sync(() => this.subscription.unsubscribe()))(fiberRuntime.forEachPar(core.deferredInterruptWith(state.id()))(unsafePollAllQueue(this.pollers)))))); | ||
})).traced(trace); | ||
} | ||
@@ -719,3 +719,3 @@ isShutdown() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.awaitDeferred(this.shutdownHook).traced(trace); | ||
return core.deferredAwait(this.shutdownHook).traced(trace); | ||
} | ||
@@ -730,9 +730,9 @@ take() { | ||
if (message === MutableQueue.EmptyMutableQueue) { | ||
const deferred = core.unsafeMakeDeferred(state.id()); | ||
return (0, _Function.pipe)(core.suspendSucceed(() => { | ||
(0, _Function.pipe)(this.pollers, MutableQueue.offer(deferred)); | ||
(0, _Function.pipe)(this.subscribers, MutableHashSet.add([this.subscription, this.pollers])); | ||
const deferred = core.deferredUnsafeMake(state.id()); | ||
return core.onInterrupt(() => core.sync(() => unsafeRemove(this.pollers, deferred)))(core.suspendSucceed(() => { | ||
MutableQueue.offer(deferred)(this.pollers); | ||
MutableHashSet.add([this.subscription, this.pollers])(this.subscribers); | ||
this.strategy.unsafeCompletePollers(this.hub, this.subscribers, this.subscription, this.pollers); | ||
return MutableRef.get(this.shutdownFlag) ? core.interrupt() : core.awaitDeferred(deferred); | ||
}), core.onInterrupt(() => core.sync(() => unsafeRemove(this.pollers, deferred)))); | ||
return MutableRef.get(this.shutdownFlag) ? core.interrupt() : core.deferredAwait(deferred); | ||
})); | ||
} else { | ||
@@ -777,12 +777,12 @@ this.strategy.unsafeOnHubEmptySpace(this.hub, this.subscribers); | ||
} | ||
return (0, _Function.pipe)(self.takeUpTo(max), core.flatMap(bs => { | ||
return core.flatMap(bs => { | ||
const remaining = min - bs.length; | ||
if (remaining === 1) { | ||
return (0, _Function.pipe)(self.take(), core.map(b => (0, _Function.pipe)(acc, Chunk.concat(bs), Chunk.append(b)))); | ||
return core.map(b => Chunk.append(b)(Chunk.concat(bs)(acc)))(self.take()); | ||
} | ||
if (remaining > 1) { | ||
return (0, _Function.pipe)(self.take(), core.flatMap(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, (0, _Function.pipe)(acc, Chunk.concat(bs), Chunk.append(b))))); | ||
return core.flatMap(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, Chunk.append(b)(Chunk.concat(bs)(acc))))(self.take()); | ||
} | ||
return core.succeed((0, _Function.pipe)(acc, Chunk.concat(bs))); | ||
})); | ||
return core.succeed(Chunk.concat(bs)(acc)); | ||
})(self.takeUpTo(max)); | ||
}; | ||
@@ -809,11 +809,11 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.size(), core.map(size => size === this.capacity())).traced(trace); | ||
return core.map(size => size === this.capacity())(this.size()).traced(trace); | ||
} | ||
isEmpty() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.size(), core.map(size => size === 0)).traced(trace); | ||
return core.map(size => size === 0)(this.size()).traced(trace); | ||
} | ||
awaitShutdown() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.awaitDeferred(this.shutdownHook).traced(trace); | ||
return core.deferredAwait(this.shutdownHook).traced(trace); | ||
} | ||
@@ -826,6 +826,6 @@ isShutdown() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.withFiberRuntime(state => { | ||
(0, _Function.pipe)(this.shutdownFlag, MutableRef.set(true)); | ||
return (0, _Function.pipe)(this.scope.close(core.exitInterrupt(state.id())), core.zipRight(this.strategy.shutdown()), core.whenEffect((0, _Function.pipe)(this.shutdownHook, core.succeedDeferred(void 0))), core.asUnit); | ||
}), core.uninterruptible).traced(trace); | ||
return core.uninterruptible(core.withFiberRuntime(state => { | ||
MutableRef.set(true)(this.shutdownFlag); | ||
return core.asUnit(core.whenEffect(core.deferredSucceed(void 0)(this.shutdownHook))(core.zipRight(this.strategy.shutdown())(this.scope.close(core.exitInterrupt(state.id()))))); | ||
})).traced(trace); | ||
} | ||
@@ -861,3 +861,3 @@ publish(value) { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return fiberRuntime.acquireRelease((0, _Function.pipe)(makeSubscription(this.hub, this.subscribers, this.strategy), core.tap(dequeue => this.scope.addFinalizer(() => dequeue.shutdown()))), dequeue => dequeue.shutdown()).traced(trace); | ||
return fiberRuntime.acquireRelease(core.tap(dequeue => this.scope.addFinalizer(() => dequeue.shutdown()))(makeSubscription(this.hub, this.subscribers, this.strategy)), dequeue => dequeue.shutdown()).traced(trace); | ||
} | ||
@@ -877,3 +877,3 @@ offer(value) { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(fiberRuntime.scopeMake(), core.flatMap(scope => (0, _Function.pipe)(core.makeDeferred(), core.map(deferred => unsafeMakeHub(hub, MutableHashSet.empty(), scope, deferred, MutableRef.make(false), strategy))))).traced(trace); | ||
return core.flatMap(scope => core.map(deferred => unsafeMakeHub(hub, MutableHashSet.empty(), scope, deferred, MutableRef.make(false), strategy))(core.deferredMake()))(fiberRuntime.scopeMake()).traced(trace); | ||
}; | ||
@@ -899,11 +899,11 @@ /** @internal */ | ||
const unsafeCompleteDeferred = (deferred, a) => { | ||
(0, _Function.pipe)(deferred, core.unsafeDoneDeferred(core.succeed(a))); | ||
core.deferredUnsafeDone(core.succeed(a))(deferred); | ||
}; | ||
/** @internal */ | ||
const unsafeOfferAll = (queue, as) => { | ||
return (0, _Function.pipe)(queue, MutableQueue.offerAll(as)); | ||
return MutableQueue.offerAll(as)(queue); | ||
}; | ||
/** @internal */ | ||
const unsafePollAllQueue = queue => { | ||
return (0, _Function.pipe)(queue, MutableQueue.pollUpTo(Number.POSITIVE_INFINITY)); | ||
return MutableQueue.pollUpTo(Number.POSITIVE_INFINITY)(queue); | ||
}; | ||
@@ -924,3 +924,3 @@ /** @internal */ | ||
const unsafeRemove = (queue, value) => { | ||
unsafeOfferAll(queue, (0, _Function.pipe)(unsafePollAllQueue(queue), List.filter(elem => elem !== value))); | ||
unsafeOfferAll(queue, List.filter(elem => elem !== value)(unsafePollAllQueue(queue))); | ||
}; | ||
@@ -942,3 +942,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.fiberId(), core.flatMap(fiberId => (0, _Function.pipe)(core.sync(() => unsafePollAllQueue(this.publishers)), core.flatMap(publishers => (0, _Function.pipe)(publishers, fiberRuntime.forEachParDiscard(([_, deferred, last]) => last ? (0, _Function.pipe)(deferred, core.interruptAsDeferred(fiberId), core.asUnit) : core.unit())))))).traced(trace); | ||
return core.flatMap(fiberId => core.flatMap(publishers => fiberRuntime.forEachParDiscard(([_, deferred, last]) => last ? core.asUnit(core.deferredInterruptWith(fiberId)(deferred)) : core.unit())(publishers))(core.sync(() => unsafePollAllQueue(this.publishers))))(core.fiberId()).traced(trace); | ||
} | ||
@@ -948,9 +948,9 @@ handleSurplus(hub, subscribers, elements, isShutdown) { | ||
return core.withFiberRuntime(state => { | ||
const deferred = core.unsafeMakeDeferred(state.id()); | ||
return (0, _Function.pipe)(core.suspendSucceed(() => { | ||
const deferred = core.deferredUnsafeMake(state.id()); | ||
return core.onInterrupt(() => core.sync(() => this.unsafeRemove(deferred)))(core.suspendSucceed(() => { | ||
this.unsafeOffer(elements, deferred); | ||
this.unsafeOnHubEmptySpace(hub, subscribers); | ||
this.unsafeCompleteSubscribers(hub, subscribers); | ||
return MutableRef.get(isShutdown) ? core.interrupt() : core.awaitDeferred(deferred); | ||
}), core.onInterrupt(() => core.sync(() => this.unsafeRemove(deferred)))); | ||
return MutableRef.get(isShutdown) ? core.interrupt() : core.deferredAwait(deferred); | ||
})); | ||
}).traced(trace); | ||
@@ -961,3 +961,3 @@ } | ||
while (keepPolling && !hub.isFull()) { | ||
const publisher = (0, _Function.pipe)(this.publishers, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const publisher = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(this.publishers); | ||
if (publisher === MutableQueue.EmptyMutableQueue) { | ||
@@ -970,3 +970,3 @@ keepPolling = false; | ||
} else if (!published) { | ||
unsafeOfferAll(this.publishers, (0, _Function.pipe)(unsafePollAllQueue(this.publishers), List.prepend(publisher))); | ||
unsafeOfferAll(this.publishers, List.prepend(publisher)(unsafePollAllQueue(this.publishers))); | ||
} | ||
@@ -992,6 +992,6 @@ this.unsafeCompleteSubscribers(hub, subscribers); | ||
if (next.done) { | ||
(0, _Function.pipe)(this.publishers, MutableQueue.offer([value, deferred, true])); | ||
MutableQueue.offer([value, deferred, true])(this.publishers); | ||
break; | ||
} | ||
(0, _Function.pipe)(this.publishers, MutableQueue.offer([value, deferred, false])); | ||
MutableQueue.offer([value, deferred, false])(this.publishers); | ||
} | ||
@@ -1001,3 +1001,3 @@ } | ||
unsafeRemove(deferred) { | ||
unsafeOfferAll(this.publishers, (0, _Function.pipe)(unsafePollAllQueue(this.publishers), List.filter(([_, a]) => a !== deferred))); | ||
unsafeOfferAll(this.publishers, List.filter(([_, a]) => a !== deferred)(unsafePollAllQueue(this.publishers))); | ||
} | ||
@@ -1089,10 +1089,10 @@ } | ||
while (keepPolling && !subscription.isEmpty()) { | ||
const poller = (0, _Function.pipe)(pollers, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const poller = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(pollers); | ||
if (poller === MutableQueue.EmptyMutableQueue) { | ||
const subPollerPair = [subscription, pollers]; | ||
(0, _Function.pipe)(subscribers, MutableHashSet.remove(subPollerPair)); | ||
MutableHashSet.remove(subPollerPair)(subscribers); | ||
if (MutableQueue.isEmpty(pollers)) { | ||
keepPolling = false; | ||
} else { | ||
(0, _Function.pipe)(subscribers, MutableHashSet.add(subPollerPair)); | ||
MutableHashSet.add(subPollerPair)(subscribers); | ||
} | ||
@@ -1102,3 +1102,3 @@ } else { | ||
if (pollResult === MutableQueue.EmptyMutableQueue) { | ||
unsafeOfferAll(pollers, (0, _Function.pipe)(unsafePollAllQueue(pollers), List.prepend(poller))); | ||
unsafeOfferAll(pollers, List.prepend(poller)(unsafePollAllQueue(pollers))); | ||
} else { | ||
@@ -1105,0 +1105,0 @@ unsafeCompleteDeferred(poller, pollResult); |
@@ -72,26 +72,26 @@ "use strict"; | ||
getOrElseMemoize(layer, scope) { | ||
return (0, _Function.pipe)(this.ref, synchronized.modifyEffect(map => { | ||
return core.flatten(synchronized.modifyEffect(map => { | ||
const inMap = map.get(layer); | ||
if (inMap !== undefined) { | ||
const [acquire, release] = inMap; | ||
const cached = (0, _Function.pipe)(acquire, core.flatMap(([patch, b]) => (0, _Function.pipe)(effect.patchFiberRefs(patch), core.as(b))), core.onExit(core.exitMatch(() => core.unit(), () => (0, _Function.pipe)(scope, core.scopeAddFinalizerExit(release))))); | ||
const cached = core.onExit(core.exitMatch(() => core.unit(), () => core.scopeAddFinalizerExit(release)(scope)))(core.flatMap(([patch, b]) => core.as(b)(effect.patchFiberRefs(patch)))(acquire)); | ||
return core.succeed([cached, map]); | ||
} | ||
return (0, _Function.pipe)(ref.make(0), core.flatMap(observers => (0, _Function.pipe)(core.makeDeferred(), core.flatMap(deferred => (0, _Function.pipe)(ref.make(() => core.unit()), core.map(finalizerRef => { | ||
const resource = core.uninterruptibleMask(restore => (0, _Function.pipe)(fiberRuntime.scopeMake(), core.flatMap(innerScope => (0, _Function.pipe)(restore((0, _Function.pipe)(layer, withScope(innerScope), core.flatMap(f => effect.diffFiberRefs(f(this))))), core.exit, core.flatMap(exit => { | ||
return core.flatMap(observers => core.flatMap(deferred => core.map(finalizerRef => { | ||
const resource = core.uninterruptibleMask(restore => core.flatMap(innerScope => core.flatMap(exit => { | ||
switch (exit.op) { | ||
case EffectOpCodes.OP_FAILURE: | ||
{ | ||
return (0, _Function.pipe)(deferred, core.failCauseDeferred(exit.cause), core.zipRight((0, _Function.pipe)(innerScope, core.scopeClose(exit))), core.zipRight(core.failCause(exit.cause))); | ||
return core.zipRight(core.failCause(exit.cause))(core.zipRight(core.scopeClose(exit)(innerScope))(core.deferredFailCause(exit.cause)(deferred))); | ||
} | ||
case EffectOpCodes.OP_SUCCESS: | ||
{ | ||
return (0, _Function.pipe)(finalizerRef, ref.set(exit => (0, _Function.pipe)(innerScope, core.scopeClose(exit), core.whenEffect((0, _Function.pipe)(observers, ref.modify(n => [n === 1, n - 1]))), core.asUnit)), core.zipRight((0, _Function.pipe)(observers, ref.update(n => n + 1))), core.zipRight((0, _Function.pipe)(scope, core.scopeAddFinalizerExit(exit => (0, _Function.pipe)(ref.get(finalizerRef), core.flatMap(finalizer => finalizer(exit)))))), core.zipRight((0, _Function.pipe)(deferred, core.succeedDeferred(exit.value))), core.as(exit.value[1])); | ||
return core.as(exit.value[1])(core.zipRight(core.deferredSucceed(exit.value)(deferred))(core.zipRight(core.scopeAddFinalizerExit(exit => core.flatMap(finalizer => finalizer(exit))(ref.get(finalizerRef)))(scope))(core.zipRight(ref.update(n => n + 1)(observers))(ref.set(exit => core.asUnit(core.whenEffect(ref.modify(n => [n === 1, n - 1])(observers))(core.scopeClose(exit)(innerScope))))(finalizerRef))))); | ||
} | ||
} | ||
}))))); | ||
const memoized = [(0, _Function.pipe)(core.awaitDeferred(deferred), core.onExit(core.exitMatchEffect(() => core.unit(), () => (0, _Function.pipe)(observers, ref.update(n => n + 1))))), exit => (0, _Function.pipe)(ref.get(finalizerRef), core.flatMap(finalizer => finalizer(exit)))]; | ||
})(core.exit(restore(core.flatMap(f => effect.diffFiberRefs(f(this)))(withScope(innerScope)(layer))))))(fiberRuntime.scopeMake())); | ||
const memoized = [core.onExit(core.exitMatchEffect(() => core.unit(), () => ref.update(n => n + 1)(observers)))(core.deferredAwait(deferred)), exit => core.flatMap(finalizer => finalizer(exit))(ref.get(finalizerRef))]; | ||
return [resource, isFresh(layer) ? map : map.set(layer, memoized)]; | ||
})))))); | ||
}), core.flatten); | ||
})(ref.make(() => core.unit())))(core.deferredMake()))(ref.make(0)); | ||
})(this.ref)); | ||
} | ||
@@ -101,3 +101,3 @@ } | ||
const makeMemoMap = () => { | ||
return (0, _Function.pipe)(circular.makeSynchronized(new Map()), core.map(ref => new MemoMap(ref))); | ||
return core.map(ref => new MemoMap(ref))(circular.makeSynchronized(new Map())); | ||
}; | ||
@@ -107,3 +107,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return fiberRuntime.scopeWith(scope => (0, _Function.pipe)(self, buildWithScope(scope))).traced(trace); | ||
return fiberRuntime.scopeWith(scope => buildWithScope(scope)(self)).traced(trace); | ||
}; | ||
@@ -114,3 +114,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(makeMemoMap(), core.flatMap(memoMap => (0, _Function.pipe)(self, withScope(scope), core.flatMap(run => run(memoMap))))); | ||
return core.flatMap(memoMap => core.flatMap(run => run(memoMap))(withScope(scope)(self)))(makeMemoMap()); | ||
}; | ||
@@ -131,7 +131,7 @@ }; | ||
{ | ||
return core.sync(() => memoMap => (0, _Function.pipe)(memoMap.getOrElseMemoize(op.layer, scope), core.foldCauseEffect(cause => memoMap.getOrElseMemoize(op.failureK(cause), scope), value => memoMap.getOrElseMemoize(op.successK(value), scope)))).traced(trace); | ||
return core.sync(() => memoMap => core.foldCauseEffect(cause => memoMap.getOrElseMemoize(op.failureK(cause), scope), value => memoMap.getOrElseMemoize(op.successK(value), scope))(memoMap.getOrElseMemoize(op.layer, scope))).traced(trace); | ||
} | ||
case OpCodes.OP_FRESH: | ||
{ | ||
return core.sync(() => _ => (0, _Function.pipe)(op.layer, buildWithScope(scope))).traced(trace); | ||
return core.sync(() => _ => buildWithScope(scope)(op.layer)).traced(trace); | ||
} | ||
@@ -144,7 +144,7 @@ case OpCodes.OP_FROM_EFFECT: | ||
{ | ||
return core.sync(() => memoMap => (0, _Function.pipe)(memoMap.getOrElseMemoize(op.first, scope), core.flatMap(env => (0, _Function.pipe)(memoMap.getOrElseMemoize(op.second, scope), core.provideEnvironment(env))))).traced(trace); | ||
return core.sync(() => memoMap => core.flatMap(env => core.provideEnvironment(env)(memoMap.getOrElseMemoize(op.second, scope)))(memoMap.getOrElseMemoize(op.first, scope))).traced(trace); | ||
} | ||
case OpCodes.OP_SCOPED: | ||
{ | ||
return core.sync(() => _ => (0, _Function.pipe)(scope, fiberRuntime.scopeExtend(op.effect))).traced(trace); | ||
return core.sync(() => _ => fiberRuntime.scopeExtend(op.effect)(scope)).traced(trace); | ||
} | ||
@@ -157,7 +157,7 @@ case OpCodes.OP_SUSPEND: | ||
{ | ||
return core.sync(() => memoMap => (0, _Function.pipe)(memoMap.getOrElseMemoize(op.first, scope), core.zipWith(memoMap.getOrElseMemoize(op.second, scope), op.zipK))).traced(trace); | ||
return core.sync(() => memoMap => core.zipWith(memoMap.getOrElseMemoize(op.second, scope), op.zipK)(memoMap.getOrElseMemoize(op.first, scope))).traced(trace); | ||
} | ||
case OpCodes.OP_ZIP_WITH_PAR: | ||
{ | ||
return core.sync(() => memoMap => (0, _Function.pipe)(memoMap.getOrElseMemoize(op.first, scope), circular.zipWithPar(memoMap.getOrElseMemoize(op.second, scope), op.zipK))).traced(trace); | ||
return core.sync(() => memoMap => circular.zipWithPar(memoMap.getOrElseMemoize(op.second, scope), op.zipK)(memoMap.getOrElseMemoize(op.first, scope))).traced(trace); | ||
} | ||
@@ -174,3 +174,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, foldLayer(onError, succeedEnvironment)); | ||
return foldLayer(onError, succeedEnvironment)(self); | ||
}; | ||
@@ -225,3 +225,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, foldLayer(fail, f)); | ||
return foldLayer(fail, f)(self); | ||
}; | ||
@@ -233,3 +233,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(Context.get(tag))); | ||
return flatMap(Context.get(tag))(self); | ||
}; | ||
@@ -253,3 +253,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, foldCauseLayer(cause => { | ||
return foldCauseLayer(cause => { | ||
const failureOrCause = Cause.failureOrCause(cause); | ||
@@ -266,3 +266,3 @@ switch (failureOrCause._tag) { | ||
} | ||
}, onSuccess)); | ||
}, onSuccess)(self); | ||
}; | ||
@@ -282,3 +282,3 @@ }; | ||
return effect => { | ||
return fromEffectEnvironment((0, _Function.pipe)(effect, core.map(service => (0, _Function.pipe)(Context.empty(), Context.add(tag)(service))))); | ||
return fromEffectEnvironment(core.map(service => Context.add(tag)(service)(Context.empty()))(effect)); | ||
}; | ||
@@ -296,3 +296,3 @@ } | ||
return f => { | ||
return fromEffectEnvironment(core.serviceWith(tagA)(a => (0, _Function.pipe)(Context.empty(), Context.add(tagB)(f(a))))); | ||
return fromEffectEnvironment(core.serviceWith(tagA)(a => Context.add(tagB)(f(a))(Context.empty()))); | ||
}; | ||
@@ -303,3 +303,3 @@ }; | ||
const launch = self => { | ||
return fiberRuntime.scopedEffect((0, _Function.pipe)(fiberRuntime.scopeWith(scope => (0, _Function.pipe)(self, buildWithScope(scope))), core.zipRight(core.never()))); | ||
return fiberRuntime.scopedEffect(core.zipRight(core.never())(fiberRuntime.scopeWith(scope => buildWithScope(scope)(self)))); | ||
}; | ||
@@ -310,3 +310,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(context => succeedEnvironment(f(context)))); | ||
return flatMap(context => succeedEnvironment(f(context)))(self); | ||
}; | ||
@@ -318,3 +318,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, catchAll(error => failSync(() => f(error)))); | ||
return catchAll(error => failSync(() => f(error)))(self); | ||
}; | ||
@@ -326,3 +326,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return fiberRuntime.scopeWith(scope => (0, _Function.pipe)(self, buildWithScope(scope), effect.memoize, core.map(fromEffectEnvironment))).traced(trace); | ||
return fiberRuntime.scopeWith(scope => core.map(fromEffectEnvironment)(effect.memoize(buildWithScope(scope)(self)))).traced(trace); | ||
}; | ||
@@ -333,3 +333,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWithPar(that, (a, b) => (0, _Function.pipe)(a, Context.merge(b)))); | ||
return zipWithPar(that, (a, b) => Context.merge(b)(a))(self); | ||
}; | ||
@@ -340,3 +340,3 @@ }; | ||
const orDie = self => { | ||
return (0, _Function.pipe)(self, catchAll(defect => die(defect))); | ||
return catchAll(defect => die(defect))(self); | ||
}; | ||
@@ -347,3 +347,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, catchAll(() => that())); | ||
return catchAll(() => that())(self); | ||
}; | ||
@@ -354,3 +354,3 @@ }; | ||
const passthrough = self => { | ||
return (0, _Function.pipe)(environment(), merge(self)); | ||
return merge(self)(environment()); | ||
}; | ||
@@ -362,3 +362,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, map(environment => (0, _Function.pipe)(Context.empty(), Context.add(tagB)(f((0, _Function.pipe)(environment, Context.unsafeGet(tagA))))))); | ||
return map(environment => Context.add(tagB)(f(Context.unsafeGet(tagA)(environment)))(Context.empty()))(self); | ||
}; | ||
@@ -374,3 +374,3 @@ }; | ||
provideTo.op = OpCodes.OP_PROVIDE_TO; | ||
provideTo.first = (0, _Function.pipe)(environment(), merge(self)); | ||
provideTo.first = merge(self)(environment()); | ||
provideTo.second = that; | ||
@@ -388,5 +388,5 @@ return provideTo; | ||
zipWith.first = self; | ||
zipWith.second = (0, _Function.pipe)(self, provideTo(that)); | ||
zipWith.second = provideTo(that)(self); | ||
zipWith.zipK = (a, b) => { | ||
return (0, _Function.pipe)(a, Context.merge(b)); | ||
return Context.merge(b)(a); | ||
}; | ||
@@ -401,5 +401,5 @@ return zipWith; | ||
const stateTag = Context.Tag(); | ||
return (0, _Function.pipe)(succeed(stateTag)({ | ||
return flatMap(env => retryLoop(self, schedule, stateTag, Context.get(stateTag)(env).state))(succeed(stateTag)({ | ||
state: schedule.initial | ||
}), flatMap(env => retryLoop(self, schedule, stateTag, (0, _Function.pipe)(env, Context.get(stateTag)).state))); | ||
})); | ||
}); | ||
@@ -411,13 +411,13 @@ }; | ||
const retryLoop = (self, schedule, stateTag, state) => { | ||
return (0, _Function.pipe)(self, catchAll(error => (0, _Function.pipe)(retryUpdate(schedule, stateTag, error, state), flatMap(env => fresh(retryLoop(self, schedule, stateTag, (0, _Function.pipe)(env, Context.get(stateTag)).state)))))); | ||
return catchAll(error => flatMap(env => fresh(retryLoop(self, schedule, stateTag, Context.get(stateTag)(env).state)))(retryUpdate(schedule, stateTag, error, state)))(self); | ||
}; | ||
/** @internal */ | ||
const retryUpdate = (schedule, stateTag, error, state) => { | ||
return fromEffect(stateTag)((0, _Function.pipe)(Clock.currentTimeMillis(), core.flatMap(now => (0, _Function.pipe)(schedule.step(now, error, state), core.flatMap(([state, _, decision]) => ScheduleDecision.isDone(decision) ? core.fail(error) : (0, _Function.pipe)(Clock.sleep(Duration.millis(Intervals.start(decision.intervals) - now)), core.as({ | ||
return fromEffect(stateTag)(core.flatMap(now => core.flatMap(([state, _, decision]) => ScheduleDecision.isDone(decision) ? core.fail(error) : core.as({ | ||
state | ||
}))))))); | ||
})(Clock.sleep(Duration.millis(Intervals.start(decision.intervals) - now))))(schedule.step(now, error, state)))(Clock.currentTimeMillis())); | ||
}; | ||
/** @internal */ | ||
const scope = () => { | ||
return scopedEnvironment((0, _Function.pipe)(fiberRuntime.acquireRelease(fiberRuntime.scopeMake(), (scope, exit) => scope.close(exit)), core.map(scope => (0, _Function.pipe)(Context.empty(), Context.add(Scope.Tag)(scope))))); | ||
return scopedEnvironment(core.map(scope => Context.add(Scope.Tag)(scope)(Context.empty()))(fiberRuntime.acquireRelease(fiberRuntime.scopeMake(), (scope, exit) => scope.close(exit)))); | ||
}; | ||
@@ -428,3 +428,3 @@ /** @internal */ | ||
return effect => { | ||
return scopedEnvironment((0, _Function.pipe)(effect, core.map(service => (0, _Function.pipe)(Context.empty(), Context.add(tag)(service))))); | ||
return scopedEnvironment(core.map(service => Context.add(tag)(service)(Context.empty()))(effect)); | ||
}; | ||
@@ -435,3 +435,3 @@ }; | ||
const scopedDiscard = effect => { | ||
return scopedEnvironment((0, _Function.pipe)(effect, core.as(Context.empty()))); | ||
return scopedEnvironment(core.as(Context.empty())(effect)); | ||
}; | ||
@@ -455,3 +455,3 @@ /** @internal */ | ||
return resource => { | ||
return fromEffectEnvironment(core.succeed((0, _Function.pipe)(Context.empty(), Context.add(tag)(resource)))); | ||
return fromEffectEnvironment(core.succeed(Context.add(tag)(resource)(Context.empty()))); | ||
}; | ||
@@ -476,3 +476,3 @@ }; | ||
return evaluate => { | ||
return fromEffectEnvironment(core.sync(() => (0, _Function.pipe)(Context.empty(), Context.add(tag)(evaluate())))); | ||
return fromEffectEnvironment(core.sync(() => Context.add(tag)(evaluate())(Context.empty()))); | ||
}; | ||
@@ -489,3 +489,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(environment => fromEffectEnvironment((0, _Function.pipe)(f(environment), core.as(environment))))); | ||
return flatMap(environment => fromEffectEnvironment(core.as(environment)(f(environment))))(self); | ||
}; | ||
@@ -497,3 +497,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, catchAll(e => fromEffectEnvironment((0, _Function.pipe)(f(e), core.flatMap(() => core.fail(e)))))); | ||
return catchAll(e => fromEffectEnvironment(core.flatMap(() => core.fail(e))(f(e))))(self); | ||
}; | ||
@@ -504,3 +504,3 @@ }; | ||
const toRuntime = self => { | ||
return (0, _Function.pipe)(fiberRuntime.scopeWith(scope => (0, _Function.pipe)(self, buildWithScope(scope))), core.flatMap(environment => (0, _Function.pipe)(runtime.runtime(), core.provideEnvironment(environment)))); | ||
return core.flatMap(environment => core.provideEnvironment(environment)(runtime.runtime()))(fiberRuntime.scopeWith(scope => buildWithScope(scope)(self))); | ||
}; | ||
@@ -526,3 +526,3 @@ /** @internal */ | ||
return self => { | ||
return core.acquireUseRelease(fiberRuntime.scopeMake(), scope => (0, _Function.pipe)(layer, buildWithScope(scope), core.flatMap(context => (0, _Function.pipe)(self, core.provideEnvironment(context)))), (scope, exit) => (0, _Function.pipe)(scope, core.scopeClose(exit))).traced(trace); | ||
return core.acquireUseRelease(fiberRuntime.scopeMake(), scope => core.flatMap(context => core.provideEnvironment(context)(self))(buildWithScope(scope)(layer)), (scope, exit) => core.scopeClose(exit)(scope)).traced(trace); | ||
}; | ||
@@ -536,3 +536,3 @@ }; | ||
// @ts-expect-error | ||
return (0, _Function.pipe)(self, provideLayer((0, _Function.pipe)(environment(), merge(layer)))).traced(trace); | ||
return provideLayer(merge(layer)(environment()))(self).traced(trace); | ||
}; | ||
@@ -539,0 +539,0 @@ }; |
@@ -20,3 +20,3 @@ "use strict"; | ||
const newMin = _Debug.runtimeDebug.logLevelOverride ? _Debug.runtimeDebug.logLevelOverride : minLevel; | ||
return loggerLayer((0, _Function.pipe)(_logger.consoleLogger(), _logger.filterLogLevel(LogLevel.greaterThanEqual(newMin)), _logger.map(_Function.constVoid))); | ||
return loggerLayer(_logger.map(_Function.constVoid)(_logger.filterLogLevel(LogLevel.greaterThanEqual(newMin))(_logger.consoleLogger()))); | ||
}; | ||
@@ -26,5 +26,5 @@ /** @internal */ | ||
const loggerLayer = logger => { | ||
return layer.scopedDiscard((0, _Function.pipe)(_logger.currentLoggers, fiberRuntime.locallyScopedWithFiberRef(HashSet.add(logger)))); | ||
return layer.scopedDiscard(fiberRuntime.fiberRefLocallyScopedWith(HashSet.add(logger))(_logger.currentLoggers)); | ||
}; | ||
exports.loggerLayer = loggerLayer; | ||
//# sourceMappingURL=circular.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
/** @internal */ | ||
const currentLoggers = /*#__PURE__*/core.unsafeMakeHashSetFiberRef( /*#__PURE__*/HashSet.empty()); | ||
const currentLoggers = /*#__PURE__*/core.fiberRefUnsafeMakeHashSet( /*#__PURE__*/HashSet.empty()); | ||
/** @internal */ | ||
@@ -46,3 +46,3 @@ exports.currentLoggers = currentLoggers; | ||
if (cause != null && cause != Cause.empty) { | ||
outputArray.push(`cause="${(0, _Function.pipe)(cause, Cause.pretty())}"`); | ||
outputArray.push(`cause="${Cause.pretty()(cause)}"`); | ||
} | ||
@@ -59,3 +59,3 @@ let output = outputArray.join(" "); | ||
} | ||
output = output + (0, _Function.pipe)(span, LogSpan.render(nowMillis)); | ||
output = output + LogSpan.render(nowMillis)(span); | ||
} | ||
@@ -91,3 +91,3 @@ } | ||
const consoleLogger = () => { | ||
return (0, _Function.pipe)(defaultLogger, map(message => globalThis.console.log(message))); | ||
return map(message => globalThis.console.log(message))(defaultLogger); | ||
}; | ||
@@ -166,3 +166,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, zip(that), map(tuple => tuple[0])); | ||
return map(tuple => tuple[0])(zip(that)(self)); | ||
}; | ||
@@ -174,3 +174,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zip(that), map(tuple => tuple[1])); | ||
return map(tuple => tuple[1])(zip(that)(self)); | ||
}; | ||
@@ -177,0 +177,0 @@ }; |
@@ -41,3 +41,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(effect, core.tap(a => core.sync(() => unsafeUpdate(a, HashSet.empty())))).traced(trace); | ||
return core.tap(a => core.sync(() => unsafeUpdate(a, HashSet.empty())))(effect).traced(trace); | ||
}, { | ||
@@ -72,3 +72,3 @@ [MetricTypeId]: metricVariance, | ||
return self => { | ||
return (0, _Function.pipe)(self, contramap(input)); | ||
return contramap(input)(self); | ||
}; | ||
@@ -80,3 +80,3 @@ }; | ||
const hook = extraTags => { | ||
const fullKey = (0, _Function.pipe)(key, metricKey.taggedWithLabelSet(extraTags)); | ||
const fullKey = metricKey.taggedWithLabelSet(extraTags)(key); | ||
return globalMetricRegistry.get(fullKey); | ||
@@ -100,3 +100,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self, update(1)).traced(trace); | ||
return update(1)(self).traced(trace); | ||
}; | ||
@@ -108,3 +108,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, update(amount)).traced(trace); | ||
return update(amount)(self).traced(trace); | ||
}; | ||
@@ -131,3 +131,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, update(value)).traced(trace); | ||
return update(value)(self).traced(trace); | ||
}; | ||
@@ -159,3 +159,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, taggedWithLabelSet(HashSet.make(metricLabel.make(key, value)))); | ||
return taggedWithLabelSet(HashSet.make(metricLabel.make(key, value)))(self); | ||
}; | ||
@@ -167,3 +167,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(make(self.keyType, (input, extraTags) => self.unsafeUpdate(input, (0, _Function.pipe)(f(input), HashSet.union(extraTags))), self.unsafeValue), map(_Function.constVoid)); | ||
return map(_Function.constVoid)(make(self.keyType, (input, extraTags) => self.unsafeUpdate(input, HashSet.union(extraTags)(f(input))), self.unsafeValue)); | ||
}; | ||
@@ -175,3 +175,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, taggedWithLabelSet(HashSet.from(extraTags))); | ||
return taggedWithLabelSet(HashSet.from(extraTags))(self); | ||
}; | ||
@@ -183,3 +183,3 @@ }; | ||
return self => { | ||
return make(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, (0, _Function.pipe)(extraTags, HashSet.union(extraTags1))), extraTags1 => self.unsafeValue((0, _Function.pipe)(extraTags, HashSet.union(extraTags1)))); | ||
return make(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, HashSet.union(extraTags1)(extraTags)), extraTags1 => self.unsafeValue(HashSet.union(extraTags1)(extraTags))); | ||
}; | ||
@@ -191,4 +191,4 @@ }; | ||
const boundaries = metricBoundaries.exponential(1, 2, 100); | ||
const base = (0, _Function.pipe)(histogram(name, boundaries), tagged("time_unit", "milliseconds")); | ||
return (0, _Function.pipe)(base, contramap(duration => duration.millis)); | ||
const base = tagged("time_unit", "milliseconds")(histogram(name, boundaries)); | ||
return contramap(duration => duration.millis)(base); | ||
}; | ||
@@ -201,3 +201,3 @@ /** @internal */ | ||
return effect => { | ||
return (0, _Function.pipe)(effect, core.foldCauseEffect(cause => { | ||
return core.foldCauseEffect(cause => { | ||
self.unsafeUpdate(input, HashSet.empty()); | ||
@@ -208,3 +208,3 @@ return core.failCause(cause); | ||
return core.succeed(value); | ||
})).traced(trace); | ||
})(effect).traced(trace); | ||
}; | ||
@@ -218,3 +218,3 @@ }; | ||
return effect => { | ||
return (0, _Function.pipe)(effect, (0, _Function.pipe)(self, trackDefectWith(_Function.identity))).traced(trace); | ||
return trackDefectWith(_Function.identity)(self)(effect).traced(trace); | ||
}; | ||
@@ -229,3 +229,3 @@ }; | ||
const updater = defect => self.unsafeUpdate(f(defect), HashSet.empty()); | ||
return (0, _Function.pipe)(effect, _effect.tapDefect(cause => core.sync(() => (0, _Function.pipe)(Cause.defects(cause), List.forEach(updater))))).traced(trace); | ||
return _effect.tapDefect(cause => core.sync(() => List.forEach(updater)(Cause.defects(cause))))(effect).traced(trace); | ||
}; | ||
@@ -239,3 +239,3 @@ }; | ||
return effect => { | ||
return (0, _Function.pipe)(effect, (0, _Function.pipe)(self, trackDurationWith(_Function.identity))).traced(trace); | ||
return trackDurationWith(_Function.identity)(self)(effect).traced(trace); | ||
}; | ||
@@ -251,3 +251,3 @@ }; | ||
const startTime = Date.now(); | ||
return (0, _Function.pipe)(effect, core.map(a => { | ||
return core.map(a => { | ||
const endTime = Date.now(); | ||
@@ -257,3 +257,3 @@ const duration = Duration.millis(endTime - startTime); | ||
return a; | ||
})); | ||
})(effect); | ||
}).traced(trace); | ||
@@ -268,3 +268,3 @@ }; | ||
return effect => { | ||
return (0, _Function.pipe)(effect, (0, _Function.pipe)(self, trackErrorWith(a => a))).traced(trace); | ||
return trackErrorWith(a => a)(self)(effect).traced(trace); | ||
}; | ||
@@ -278,4 +278,4 @@ }; | ||
return effect => { | ||
const updater = error => (0, _Function.pipe)(self, update(f(error))); | ||
return (0, _Function.pipe)(effect, _effect.tapError(updater)).traced(trace); | ||
const updater = error => update(f(error))(self); | ||
return _effect.tapError(updater)(effect).traced(trace); | ||
}; | ||
@@ -289,3 +289,3 @@ }; | ||
return effect => { | ||
return (0, _Function.pipe)(effect, (0, _Function.pipe)(self, trackSuccessWith(a => a))).traced(trace); | ||
return trackSuccessWith(a => a)(self)(effect).traced(trace); | ||
}; | ||
@@ -299,4 +299,4 @@ }; | ||
return effect => { | ||
const updater = value => (0, _Function.pipe)(self, update(f(value))); | ||
return (0, _Function.pipe)(effect, core.tap(updater)).traced(trace); | ||
const updater = value => update(f(value))(self); | ||
return core.tap(updater)(effect).traced(trace); | ||
}; | ||
@@ -322,3 +322,3 @@ }; | ||
const withNow = self => { | ||
return (0, _Function.pipe)(self, contramap(input => [input, Date.now()])); | ||
return contramap(input => [input, Date.now()])(self); | ||
}; | ||
@@ -325,0 +325,0 @@ /** @internal */ |
@@ -25,3 +25,3 @@ "use strict"; | ||
[(_a = MetricBoundariesTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(MetricBoundariesSymbolKey), Equal.hashCombine(Equal.hash(this.values))); | ||
return Equal.hashCombine(Equal.hash(this.values))(Equal.hash(MetricBoundariesSymbolKey)); | ||
} | ||
@@ -39,3 +39,3 @@ [Equal.symbolEqual](u) { | ||
const fromChunk = chunk => { | ||
const values = (0, _Function.pipe)(chunk, Chunk.concat(Chunk.singleton(Number.POSITIVE_INFINITY)), Chunk.dedupe); | ||
const values = Chunk.dedupe(Chunk.concat(Chunk.singleton(Number.POSITIVE_INFINITY))(chunk)); | ||
return new MetricBoundariesImpl(values); | ||
@@ -46,3 +46,3 @@ }; | ||
const linear = (start, width, count) => { | ||
return (0, _Function.pipe)(Chunk.range(0, count - 1), Chunk.map(i => start + i * width), fromChunk); | ||
return fromChunk(Chunk.map(i => start + i * width)(Chunk.range(0, count - 1))); | ||
}; | ||
@@ -52,5 +52,5 @@ /** @internal */ | ||
const exponential = (start, factor, count) => { | ||
return (0, _Function.pipe)(Chunk.range(0, count - 1), Chunk.map(i => start * Math.pow(factor, i)), fromChunk); | ||
return fromChunk(Chunk.map(i => start * Math.pow(factor, i))(Chunk.range(0, count - 1))); | ||
}; | ||
exports.exponential = exponential; | ||
//# sourceMappingURL=boundaries.js.map |
@@ -86,5 +86,5 @@ "use strict"; | ||
let max = Number.MIN_VALUE; | ||
(0, _Function.pipe)(bounds, Chunk.sort(number.Order), Chunk.mapWithIndex((i, n) => { | ||
Chunk.mapWithIndex((i, n) => { | ||
boundaries[i] = n; | ||
})); | ||
})(Chunk.sort(number.Order)(bounds)); | ||
// Insert the value into the right bucket with a binary search | ||
@@ -145,3 +145,3 @@ const update = value => { | ||
} = key.keyType; | ||
const sortedQuantiles = (0, _Function.pipe)(quantiles, Chunk.sort(number.Order)); | ||
const sortedQuantiles = Chunk.sort(number.Order)(quantiles); | ||
const values = Array(maxSize); | ||
@@ -180,3 +180,3 @@ let head = 0; | ||
} | ||
return calculateQuantiles(error, sortedQuantiles, (0, _Function.pipe)(Chunk.fromIterable(builder), Chunk.sort(number.Order))); | ||
return calculateQuantiles(error, sortedQuantiles, Chunk.sort(number.Order)(Chunk.fromIterable(builder))); | ||
}; | ||
@@ -209,8 +209,8 @@ const observe = (value, timestamp) => { | ||
const head = Chunk.unsafeHead(sortedQuantiles); | ||
const tail = (0, _Function.pipe)(sortedQuantiles, Chunk.drop(1)); | ||
const resolved = (0, _Function.pipe)(tail, Chunk.reduce(Chunk.singleton(resolveQuantile(error, sampleCount, Option.none, 0, head, sortedSamples)), (accumulator, quantile) => { | ||
const tail = Chunk.drop(1)(sortedQuantiles); | ||
const resolved = Chunk.reduce(Chunk.singleton(resolveQuantile(error, sampleCount, Option.none, 0, head, sortedSamples)), (accumulator, quantile) => { | ||
const h = Chunk.unsafeHead(accumulator); | ||
return (0, _Function.pipe)(accumulator, Chunk.append(resolveQuantile(error, sampleCount, h.value, h.consumed, quantile, h.rest))); | ||
})); | ||
return (0, _Function.pipe)(resolved, Chunk.map(rq => [rq.quantile, rq.value])); | ||
return Chunk.append(resolveQuantile(error, sampleCount, h.value, h.consumed, quantile, h.rest))(accumulator); | ||
})(tail); | ||
return Chunk.map(rq => [rq.quantile, rq.value])(resolved); | ||
}; | ||
@@ -254,3 +254,3 @@ /** @internal */ | ||
// value as the chunk head | ||
const sameHead = (0, _Function.pipe)(rest_1, Chunk.splitWhere(n => n > Chunk.unsafeHead(rest_1))); | ||
const sameHead = Chunk.splitWhere(n => n > Chunk.unsafeHead(rest_1))(rest_1); | ||
// How many elements do we want to accept for this quantile | ||
@@ -257,0 +257,0 @@ const desired = quantile_1 * sampleCount_1; |
@@ -33,3 +33,3 @@ "use strict"; | ||
[(_a = MetricKeyTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(this.name), Equal.hashCombine(Equal.hash(this.keyType)), Equal.hashCombine(Equal.hash(this.tags))); | ||
return Equal.hashCombine(Equal.hash(this.tags))(Equal.hashCombine(Equal.hash(this.keyType))(Equal.hash(this.name))); | ||
} | ||
@@ -73,3 +73,3 @@ [Equal.symbolEqual](u) { | ||
return self => { | ||
return (0, _Function.pipe)(self, taggedWithLabelSet(HashSet.make(metricLabel.make(key, value)))); | ||
return taggedWithLabelSet(HashSet.make(metricLabel.make(key, value)))(self); | ||
}; | ||
@@ -81,3 +81,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, taggedWithLabelSet(HashSet.from(extraTags))); | ||
return taggedWithLabelSet(HashSet.from(extraTags))(self); | ||
}; | ||
@@ -92,3 +92,3 @@ }; | ||
} | ||
return new MetricKeyImpl(self.name, self.keyType, (0, _Function.pipe)(self.tags, HashSet.union(extraTags))); | ||
return new MetricKeyImpl(self.name, self.keyType, HashSet.union(extraTags)(self.tags)); | ||
}; | ||
@@ -95,0 +95,0 @@ }; |
@@ -97,3 +97,3 @@ "use strict"; | ||
[(_g = MetricKeyTypeTypeId, _h = HistogramKeyTypeTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(HistogramKeyTypeSymbolKey), Equal.hashCombine(Equal.hash(this.boundaries))); | ||
return Equal.hashCombine(Equal.hash(this.boundaries))(Equal.hash(HistogramKeyTypeSymbolKey)); | ||
} | ||
@@ -116,3 +116,3 @@ [Equal.symbolEqual](that) { | ||
[(_j = MetricKeyTypeTypeId, _k = SummaryKeyTypeTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(SummaryKeyTypeSymbolKey), Equal.hashCombine(Equal.hash(this.maxAge)), Equal.hashCombine(Equal.hash(this.maxSize)), Equal.hashCombine(Equal.hash(this.error)), Equal.hashCombine(Equal.hash(this.quantiles))); | ||
return Equal.hashCombine(Equal.hash(this.quantiles))(Equal.hashCombine(Equal.hash(this.error))(Equal.hashCombine(Equal.hash(this.maxSize))(Equal.hashCombine(Equal.hash(this.maxAge))(Equal.hash(SummaryKeyTypeSymbolKey))))); | ||
} | ||
@@ -119,0 +119,0 @@ [Equal.symbolEqual](that) { |
@@ -25,3 +25,3 @@ "use strict"; | ||
[(_a = MetricLabelTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(MetricLabelSymbolKey), Equal.hashCombine(Equal.hash(this.key)), Equal.hashCombine(Equal.hash(this.value))); | ||
return Equal.hashCombine(Equal.hash(this.value))(Equal.hashCombine(Equal.hash(this.key))(Equal.hash(MetricLabelSymbolKey))); | ||
} | ||
@@ -28,0 +28,0 @@ [Equal.symbolEqual](that) { |
@@ -36,3 +36,3 @@ "use strict"; | ||
get(key) { | ||
const hook = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined); | ||
const hook = Option.getOrUndefined(MutableHashMap.get(key)(this.map)); | ||
if (hook == null) { | ||
@@ -60,7 +60,7 @@ if (metricKeyType.isCounterKey(key.keyType)) { | ||
getCounter(key) { | ||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined); | ||
let value = Option.getOrUndefined(MutableHashMap.get(key)(this.map)); | ||
if (value == null) { | ||
const counter = metricHook.counter(key); | ||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) { | ||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, counter)); | ||
if (!MutableHashMap.has(key)(this.map)) { | ||
MutableHashMap.set(key, counter)(this.map); | ||
} | ||
@@ -72,7 +72,7 @@ value = counter; | ||
getFrequency(key) { | ||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined); | ||
let value = Option.getOrUndefined(MutableHashMap.get(key)(this.map)); | ||
if (value == null) { | ||
const frequency = metricHook.frequency(key); | ||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) { | ||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, frequency)); | ||
if (!MutableHashMap.has(key)(this.map)) { | ||
MutableHashMap.set(key, frequency)(this.map); | ||
} | ||
@@ -84,7 +84,7 @@ value = frequency; | ||
getGauge(key) { | ||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined); | ||
let value = Option.getOrUndefined(MutableHashMap.get(key)(this.map)); | ||
if (value == null) { | ||
const gauge = metricHook.gauge(key, 0); | ||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) { | ||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, gauge)); | ||
if (!MutableHashMap.has(key)(this.map)) { | ||
MutableHashMap.set(key, gauge)(this.map); | ||
} | ||
@@ -96,7 +96,7 @@ value = gauge; | ||
getHistogram(key) { | ||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined); | ||
let value = Option.getOrUndefined(MutableHashMap.get(key)(this.map)); | ||
if (value == null) { | ||
const histogram = metricHook.histogram(key); | ||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) { | ||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, histogram)); | ||
if (!MutableHashMap.has(key)(this.map)) { | ||
MutableHashMap.set(key, histogram)(this.map); | ||
} | ||
@@ -108,7 +108,7 @@ value = histogram; | ||
getSummary(key) { | ||
let value = (0, _Function.pipe)(this.map, MutableHashMap.get(key), Option.getOrUndefined); | ||
let value = Option.getOrUndefined(MutableHashMap.get(key)(this.map)); | ||
if (value == null) { | ||
const summary = metricHook.summary(key); | ||
if (!(0, _Function.pipe)(this.map, MutableHashMap.has(key))) { | ||
(0, _Function.pipe)(this.map, MutableHashMap.set(key, summary)); | ||
if (!MutableHashMap.has(key)(this.map)) { | ||
MutableHashMap.set(key, summary)(this.map); | ||
} | ||
@@ -115,0 +115,0 @@ value = summary; |
@@ -54,3 +54,3 @@ "use strict"; | ||
[(_a = MetricStateTypeId, _b = CounterStateTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(CounterStateSymbolKey), Equal.hashCombine(Equal.hash(this.count))); | ||
return Equal.hashCombine(Equal.hash(this.count))(Equal.hash(CounterStateSymbolKey)); | ||
} | ||
@@ -69,3 +69,3 @@ [Equal.symbolEqual](that) { | ||
[(_c = MetricStateTypeId, _d = FrequencyStateTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(FrequencyStateSymbolKey), Equal.hashCombine(Equal.hash(this.occurrences))); | ||
return Equal.hashCombine(Equal.hash(this.occurrences))(Equal.hash(FrequencyStateSymbolKey)); | ||
} | ||
@@ -84,3 +84,3 @@ [Equal.symbolEqual](that) { | ||
[(_e = MetricStateTypeId, _f = GaugeStateTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(GaugeStateSymbolKey), Equal.hashCombine(Equal.hash(this.value))); | ||
return Equal.hashCombine(Equal.hash(this.value))(Equal.hash(GaugeStateSymbolKey)); | ||
} | ||
@@ -103,3 +103,3 @@ [Equal.symbolEqual](u) { | ||
[(_g = MetricStateTypeId, _h = HistogramStateTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(HistogramStateSymbolKey), Equal.hashCombine(Equal.hash(this.buckets)), Equal.hashCombine(Equal.hash(this.count)), Equal.hashCombine(Equal.hash(this.min)), Equal.hashCombine(Equal.hash(this.max)), Equal.hashCombine(Equal.hash(this.sum))); | ||
return Equal.hashCombine(Equal.hash(this.sum))(Equal.hashCombine(Equal.hash(this.max))(Equal.hashCombine(Equal.hash(this.min))(Equal.hashCombine(Equal.hash(this.count))(Equal.hashCombine(Equal.hash(this.buckets))(Equal.hash(HistogramStateSymbolKey)))))); | ||
} | ||
@@ -124,3 +124,3 @@ [Equal.symbolEqual](that) { | ||
[(_j = MetricStateTypeId, _k = SummaryStateTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(SummaryStateSymbolKey), Equal.hashCombine(Equal.hash(this.error)), Equal.hashCombine(Equal.hash(this.quantiles)), Equal.hashCombine(Equal.hash(this.count)), Equal.hashCombine(Equal.hash(this.min)), Equal.hashCombine(Equal.hash(this.max)), Equal.hashCombine(Equal.hash(this.sum))); | ||
return Equal.hashCombine(Equal.hash(this.sum))(Equal.hashCombine(Equal.hash(this.max))(Equal.hashCombine(Equal.hash(this.min))(Equal.hashCombine(Equal.hash(this.count))(Equal.hashCombine(Equal.hash(this.quantiles))(Equal.hashCombine(Equal.hash(this.error))(Equal.hash(SummaryStateSymbolKey))))))); | ||
} | ||
@@ -127,0 +127,0 @@ [Equal.symbolEqual](that) { |
@@ -73,14 +73,14 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.size(), core.map(size => size <= 0)).traced(trace); | ||
return core.map(size => size <= 0)(this.size()).traced(trace); | ||
} | ||
isFull() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.size(), core.map(size => size >= this.capacity())).traced(trace); | ||
return core.map(size => size >= this.capacity())(this.size()).traced(trace); | ||
} | ||
shutdown() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.withFiberRuntime(state => { | ||
(0, _Function.pipe)(this.shutdownFlag, MutableRef.set(true)); | ||
return (0, _Function.pipe)(unsafePollAll(this.takers), fiberRuntime.forEachParDiscard(core.interruptAsDeferred(state.id())), core.zipRight(this.strategy.shutdown()), core.whenEffect((0, _Function.pipe)(this.shutdownHook, core.succeedDeferred(void 0))), core.asUnit); | ||
}), core.uninterruptible).traced(trace); | ||
return core.uninterruptible(core.withFiberRuntime(state => { | ||
MutableRef.set(true)(this.shutdownFlag); | ||
return core.asUnit(core.whenEffect(core.deferredSucceed(void 0)(this.shutdownHook))(core.zipRight(this.strategy.shutdown())(fiberRuntime.forEachParDiscard(core.deferredInterruptWith(state.id()))(unsafePollAll(this.takers))))); | ||
})).traced(trace); | ||
} | ||
@@ -93,3 +93,3 @@ isShutdown() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.awaitDeferred(this.shutdownHook).traced(trace); | ||
return core.deferredAwait(this.shutdownHook).traced(trace); | ||
} | ||
@@ -104,3 +104,3 @@ offer(value) { | ||
if (MutableQueue.isEmpty(this.queue)) { | ||
const taker = (0, _Function.pipe)(this.takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const taker = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(this.takers); | ||
if (taker !== MutableQueue.EmptyMutableQueue) { | ||
@@ -119,3 +119,3 @@ unsafeCompleteDeferred(taker, value); | ||
// Not enough takers, offer to the queue | ||
const succeeded = (0, _Function.pipe)(this.queue, MutableQueue.offer(value)); | ||
const succeeded = MutableQueue.offer(value)(this.queue); | ||
unsafeCompleteTakers(this.strategy, this.queue, this.takers); | ||
@@ -133,3 +133,3 @@ return succeeded ? core.succeed(true) : this.strategy.handleSurplus([value], this.queue, this.takers, this.shutdownFlag); | ||
const pTakers = MutableQueue.isEmpty(this.queue) ? ReadonlyArray.fromIterable(unsafePollN(this.takers, values.length)) : ReadonlyArray.empty; | ||
const [forTakers, remaining] = (0, _Function.pipe)(values, ReadonlyArray.splitAt(pTakers.length)); | ||
const [forTakers, remaining] = ReadonlyArray.splitAt(pTakers.length)(values); | ||
for (let i = 0; i < pTakers.length; i++) { | ||
@@ -155,3 +155,3 @@ const taker = pTakers[i]; | ||
} | ||
const item = (0, _Function.pipe)(this.queue, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const item = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(this.queue); | ||
if (item !== MutableQueue.EmptyMutableQueue) { | ||
@@ -165,9 +165,9 @@ this.strategy.unsafeOnQueueEmptySpace(this.queue, this.takers); | ||
// - Clean up resources in case of interruption | ||
const deferred = core.unsafeMakeDeferred(state.id()); | ||
return (0, _Function.pipe)(core.suspendSucceed(() => { | ||
(0, _Function.pipe)(this.takers, MutableQueue.offer(deferred)); | ||
const deferred = core.deferredUnsafeMake(state.id()); | ||
return core.onInterrupt(() => { | ||
return core.sync(() => unsafeRemove(this.takers, deferred)); | ||
})(core.suspendSucceed(() => { | ||
MutableQueue.offer(deferred)(this.takers); | ||
unsafeCompleteTakers(this.strategy, this.queue, this.takers); | ||
return MutableRef.get(this.shutdownFlag) ? core.interrupt() : core.awaitDeferred(deferred); | ||
}), core.onInterrupt(() => { | ||
return core.sync(() => unsafeRemove(this.takers, deferred)); | ||
return MutableRef.get(this.shutdownFlag) ? core.interrupt() : core.deferredAwait(deferred); | ||
})); | ||
@@ -206,12 +206,12 @@ } | ||
} | ||
return (0, _Function.pipe)(self, takeUpTo(max), core.flatMap(bs => { | ||
return core.flatMap(bs => { | ||
const remaining = min - bs.length; | ||
if (remaining === 1) { | ||
return (0, _Function.pipe)(take(self), core.map(b => (0, _Function.pipe)(acc, Chunk.concat(bs), Chunk.append(b)))); | ||
return core.map(b => Chunk.append(b)(Chunk.concat(bs)(acc)))(take(self)); | ||
} | ||
if (remaining > 1) { | ||
return (0, _Function.pipe)(take(self), core.flatMap(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, (0, _Function.pipe)(acc, Chunk.concat(bs), Chunk.append(b))))); | ||
return core.flatMap(b => takeRemainderLoop(self, remaining - 1, max - bs.length - 1, Chunk.append(b)(Chunk.concat(bs)(acc))))(take(self)); | ||
} | ||
return core.succeed((0, _Function.pipe)(acc, Chunk.concat(bs))); | ||
})); | ||
return core.succeed(Chunk.concat(bs)(acc)); | ||
})(takeUpTo(max)(self)); | ||
}; | ||
@@ -236,3 +236,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => MutableQueue.bounded(requestedCapacity)), core.flatMap(queue => make(queue, backPressureStrategy()))).traced(trace); | ||
return core.flatMap(queue => make(queue, backPressureStrategy()))(core.sync(() => MutableQueue.bounded(requestedCapacity))).traced(trace); | ||
}; | ||
@@ -243,3 +243,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => MutableQueue.bounded(requestedCapacity)), core.flatMap(queue => make(queue, droppingStrategy()))).traced(trace); | ||
return core.flatMap(queue => make(queue, droppingStrategy()))(core.sync(() => MutableQueue.bounded(requestedCapacity))).traced(trace); | ||
}; | ||
@@ -250,3 +250,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => MutableQueue.bounded(requestedCapacity)), core.flatMap(queue => make(queue, slidingStrategy()))).traced(trace); | ||
return core.flatMap(queue => make(queue, slidingStrategy()))(core.sync(() => MutableQueue.bounded(requestedCapacity))).traced(trace); | ||
}; | ||
@@ -257,3 +257,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.sync(() => MutableQueue.unbounded()), core.flatMap(queue => make(queue, droppingStrategy()))).traced(trace); | ||
return core.flatMap(queue => make(queue, droppingStrategy()))(core.sync(() => MutableQueue.unbounded())).traced(trace); | ||
}; | ||
@@ -268,3 +268,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.makeDeferred(), core.map(deferred => unsafeMake(queue, MutableQueue.unbounded(), deferred, MutableRef.make(false), strategy))).traced(trace); | ||
return core.map(deferred => unsafeMake(queue, MutableQueue.unbounded(), deferred, MutableRef.make(false), strategy))(core.deferredMake()).traced(trace); | ||
}; | ||
@@ -331,3 +331,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.takeUpTo(1), core.map(Chunk.head)).traced(trace); | ||
return core.map(Chunk.head)(self.takeUpTo(1)).traced(trace); | ||
}; | ||
@@ -400,3 +400,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.fiberId(), core.flatMap(fiberId => (0, _Function.pipe)(core.sync(() => unsafePollAll(this.putters)), core.flatMap(fiberRuntime.forEachParDiscard(([_, deferred, isLastItem]) => isLastItem ? (0, _Function.pipe)(deferred, core.interruptAsDeferred(fiberId), core.asUnit) : core.unit()))))).traced(trace); | ||
return core.flatMap(fiberId => core.flatMap(fiberRuntime.forEachParDiscard(([_, deferred, isLastItem]) => isLastItem ? core.asUnit(core.deferredInterruptWith(fiberId)(deferred)) : core.unit()))(core.sync(() => unsafePollAll(this.putters))))(core.fiberId()).traced(trace); | ||
} | ||
@@ -406,9 +406,9 @@ handleSurplus(iterable, queue, takers, isShutdown) { | ||
return core.withFiberRuntime(state => { | ||
const deferred = core.unsafeMakeDeferred(state.id()); | ||
return (0, _Function.pipe)(core.suspendSucceed(() => { | ||
const deferred = core.deferredUnsafeMake(state.id()); | ||
return core.onInterrupt(() => core.sync(() => this.unsafeRemove(deferred)))(core.suspendSucceed(() => { | ||
this.unsafeOffer(iterable, deferred); | ||
this.unsafeOnQueueEmptySpace(queue, takers); | ||
unsafeCompleteTakers(this, queue, takers); | ||
return MutableRef.get(isShutdown) ? core.interrupt() : core.awaitDeferred(deferred); | ||
}), core.onInterrupt(() => core.sync(() => this.unsafeRemove(deferred)))); | ||
return MutableRef.get(isShutdown) ? core.interrupt() : core.deferredAwait(deferred); | ||
})); | ||
}).traced(trace); | ||
@@ -419,11 +419,11 @@ } | ||
while (keepPolling && !MutableQueue.isFull(queue)) { | ||
const putter = (0, _Function.pipe)(this.putters, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const putter = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(this.putters); | ||
if (putter === MutableQueue.EmptyMutableQueue) { | ||
keepPolling = false; | ||
} else { | ||
const offered = (0, _Function.pipe)(queue, MutableQueue.offer(putter[0])); | ||
const offered = MutableQueue.offer(putter[0])(queue); | ||
if (offered && putter[2]) { | ||
unsafeCompleteDeferred(putter[1], true); | ||
} else if (!offered) { | ||
unsafeOfferAll(this.putters, (0, _Function.pipe)(unsafePollAll(this.putters), List.prepend(putter))); | ||
unsafeOfferAll(this.putters, List.prepend(putter)(unsafePollAll(this.putters))); | ||
} | ||
@@ -443,6 +443,6 @@ unsafeCompleteTakers(this, queue, takers); | ||
if (next.done) { | ||
(0, _Function.pipe)(this.putters, MutableQueue.offer([value, deferred, true])); | ||
MutableQueue.offer([value, deferred, true])(this.putters); | ||
break; | ||
} | ||
(0, _Function.pipe)(this.putters, MutableQueue.offer([value, deferred, false])); | ||
MutableQueue.offer([value, deferred, false])(this.putters); | ||
} | ||
@@ -452,3 +452,3 @@ } | ||
unsafeRemove(deferred) { | ||
unsafeOfferAll(this.putters, (0, _Function.pipe)(unsafePollAll(this.putters), List.filter(([, _]) => _ !== deferred))); | ||
unsafeOfferAll(this.putters, List.filter(([, _]) => _ !== deferred)(unsafePollAll(this.putters))); | ||
} | ||
@@ -510,4 +510,4 @@ } | ||
// Poll 1 and retry | ||
(0, _Function.pipe)(queue, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
offering = (0, _Function.pipe)(queue, MutableQueue.offer(next.value)); | ||
MutableQueue.poll(MutableQueue.EmptyMutableQueue)(queue); | ||
offering = MutableQueue.offer(next.value)(queue); | ||
} | ||
@@ -519,19 +519,19 @@ } | ||
const unsafeCompleteDeferred = (deferred, a) => { | ||
return (0, _Function.pipe)(deferred, core.unsafeDoneDeferred(core.succeed(a))); | ||
return core.deferredUnsafeDone(core.succeed(a))(deferred); | ||
}; | ||
/** @internal */ | ||
const unsafeOfferAll = (queue, as) => { | ||
return (0, _Function.pipe)(queue, MutableQueue.offerAll(as)); | ||
return MutableQueue.offerAll(as)(queue); | ||
}; | ||
/** @internal */ | ||
const unsafePollAll = queue => { | ||
return (0, _Function.pipe)(queue, MutableQueue.pollUpTo(Number.POSITIVE_INFINITY)); | ||
return MutableQueue.pollUpTo(Number.POSITIVE_INFINITY)(queue); | ||
}; | ||
/** @internal */ | ||
const unsafePollN = (queue, max) => { | ||
return (0, _Function.pipe)(queue, MutableQueue.pollUpTo(max)); | ||
return MutableQueue.pollUpTo(max)(queue); | ||
}; | ||
/** @internal */ | ||
const unsafeRemove = (queue, a) => { | ||
unsafeOfferAll(queue, (0, _Function.pipe)(unsafePollAll(queue), List.filter(b => a !== b))); | ||
unsafeOfferAll(queue, List.filter(b => a !== b)(unsafePollAll(queue))); | ||
}; | ||
@@ -544,5 +544,5 @@ /** @internal */ | ||
while (keepPolling && !MutableQueue.isEmpty(queue)) { | ||
const taker = (0, _Function.pipe)(takers, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const taker = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(takers); | ||
if (taker !== MutableQueue.EmptyMutableQueue) { | ||
const element = (0, _Function.pipe)(queue, MutableQueue.poll(MutableQueue.EmptyMutableQueue)); | ||
const element = MutableQueue.poll(MutableQueue.EmptyMutableQueue)(queue); | ||
if (element !== MutableQueue.EmptyMutableQueue) { | ||
@@ -552,3 +552,3 @@ unsafeCompleteDeferred(taker, element); | ||
} else { | ||
unsafeOfferAll(takers, (0, _Function.pipe)(unsafePollAll(takers), List.prepend(taker))); | ||
unsafeOfferAll(takers, List.prepend(taker)(unsafePollAll(takers))); | ||
} | ||
@@ -555,0 +555,0 @@ keepPolling = true; |
@@ -37,3 +37,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.next(), core.map(n => n > 0.5)).traced(trace); | ||
return core.map(n => n > 0.5)(this.next()).traced(trace); | ||
} | ||
@@ -46,3 +46,3 @@ nextInt() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.next(), core.map(n => (max - min) * n + min)).traced(trace); | ||
return core.map(n => (max - min) * n + min)(this.next()).traced(trace); | ||
} | ||
@@ -61,3 +61,3 @@ nextIntBetween(min, max) { | ||
const shuffleWith = (elements, nextIntBounded) => { | ||
return core.suspendSucceed(() => (0, _Function.pipe)(core.sync(() => Array.from(elements)), core.flatMap(buffer => { | ||
return core.suspendSucceed(() => core.flatMap(buffer => { | ||
const numbers = []; | ||
@@ -67,4 +67,4 @@ for (let i = buffer.length; i >= 2; i = i - 1) { | ||
} | ||
return (0, _Function.pipe)(numbers, core.forEachDiscard(n => (0, _Function.pipe)(nextIntBounded(n), core.map(k => swap(buffer, n - 1, k)))), core.as(Chunk.fromIterable(buffer))); | ||
}))); | ||
return core.as(Chunk.fromIterable(buffer))(core.forEachDiscard(n => core.map(k => swap(buffer, n - 1, k))(nextIntBounded(n)))(numbers)); | ||
})(core.sync(() => Array.from(elements)))); | ||
}; | ||
@@ -71,0 +71,0 @@ /** @internal */ |
@@ -156,3 +156,3 @@ "use strict"; | ||
return self => { | ||
return self.modify(a => [void 0, (0, _Function.pipe)(f(a), Option.match(() => a, b => b))]).traced(trace); | ||
return self.modify(a => [void 0, Option.match(() => a, b => b)(f(a))]).traced(trace); | ||
}; | ||
@@ -159,0 +159,0 @@ }; |
@@ -32,3 +32,3 @@ "use strict"; | ||
return (layer, policy) => { | ||
return _layer.scoped(reloadableTag(tag))((0, _Function.pipe)(_layer.build(manual(tag)(layer)), core.map(Context.unsafeGet(reloadableTag(tag))), core.tap(reloadable => fiberRuntime.acquireRelease((0, _Function.pipe)(reloadable.reload(), effect.ignoreLogged, _schedule.schedule_Effect(policy), fiberRuntime.forkDaemon), core.interruptFiber)))); | ||
return _layer.scoped(reloadableTag(tag))(core.tap(reloadable => fiberRuntime.acquireRelease(fiberRuntime.forkDaemon(_schedule.schedule_Effect(policy)(effect.ignoreLogged(reloadable.reload()))), core.interruptFiber))(core.map(Context.unsafeGet(reloadableTag(tag)))(_layer.build(manual(tag)(layer))))); | ||
}; | ||
@@ -40,3 +40,3 @@ }; | ||
return (layer, scheduleFromConfig) => { | ||
return _layer.scoped(reloadableTag(tag))((0, _Function.pipe)(core.environment(), core.flatMap(env => (0, _Function.pipe)(_layer.build(auto(tag)(layer, scheduleFromConfig(env))), core.map(Context.unsafeGet(reloadableTag(tag))))))); | ||
return _layer.scoped(reloadableTag(tag))(core.flatMap(env => core.map(Context.unsafeGet(reloadableTag(tag)))(_layer.build(auto(tag)(layer, scheduleFromConfig(env)))))(core.environment())); | ||
}; | ||
@@ -54,3 +54,3 @@ }; | ||
return layer => { | ||
return _layer.scoped(reloadableTag(tag))((0, _Function.pipe)(core.environment(), core.flatMap(env => (0, _Function.pipe)(scopedRef.fromAcquire((0, _Function.pipe)(_layer.build(layer), core.map(Context.unsafeGet(tag)))), core.map(ref => ({ | ||
return _layer.scoped(reloadableTag(tag))(core.flatMap(env => core.map(ref => ({ | ||
[ReloadableTypeId]: reloadableVariance, | ||
@@ -60,5 +60,5 @@ scopedRef: ref, | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(ref, scopedRef.set((0, _Function.pipe)(_layer.build(layer), core.map(Context.unsafeGet(tag)))), core.provideEnvironment(env)).traced(trace); | ||
return core.provideEnvironment(env)(scopedRef.set(core.map(Context.unsafeGet(tag))(_layer.build(layer)))(ref)).traced(trace); | ||
} | ||
})))))); | ||
}))(scopedRef.fromAcquire(core.map(Context.unsafeGet(tag))(_layer.build(layer)))))(core.environment())); | ||
}; | ||
@@ -71,3 +71,3 @@ }; | ||
const reloadableTag = tag => { | ||
const already = (0, _Function.pipe)(tagMap, WeakIterableMap.get(tag)); | ||
const already = WeakIterableMap.get(tag)(tagMap); | ||
if (Option.isSome(already)) { | ||
@@ -77,3 +77,3 @@ return already.value; | ||
const newTag = Context.Tag(); | ||
(0, _Function.pipe)(tagMap, WeakIterableMap.set(tag, newTag)); | ||
WeakIterableMap.set(tag, newTag)(tagMap); | ||
return newTag; | ||
@@ -91,5 +91,5 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.serviceWithEffect(reloadableTag(tag))(reloadable => (0, _Function.pipe)(reloadable.reload(), effect.ignoreLogged, fiberRuntime.forkDaemon, core.asUnit).traced(trace)); | ||
return core.serviceWithEffect(reloadableTag(tag))(reloadable => core.asUnit(fiberRuntime.forkDaemon(effect.ignoreLogged(reloadable.reload()))).traced(trace)); | ||
}; | ||
exports.reloadFork = reloadFork; | ||
//# sourceMappingURL=reloadable.js.map |
@@ -13,6 +13,6 @@ "use strict"; | ||
var RuntimeFlags = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Fiber/Runtime/Flags")); | ||
var FiberScope = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Fiber/Scope")); | ||
var FiberRefs = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/FiberRefs")); | ||
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core")); | ||
var FiberRuntime = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/fiberRuntime")); | ||
var fiberScope = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/fiberScope")); | ||
var OpCodes = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/opCodes/effect")); | ||
@@ -42,4 +42,4 @@ var Scheduler = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/scheduler")); | ||
const fiberId = FiberId.unsafeMake(); | ||
const fiberRefs = (0, _Function.pipe)(this.fiberRefs, FiberRefs.updatedAs(fiberId, core.currentEnvironment, this.context)); | ||
const fiberRuntime = new FiberRuntime.FiberRuntime(fiberId, (0, _Function.pipe)(fiberRefs, FiberRefs.forkAs(fiberId)), this.runtimeFlags); | ||
const fiberRefs = FiberRefs.updatedAs(fiberId, core.currentEnvironment, this.context)(this.fiberRefs); | ||
const fiberRuntime = new FiberRuntime.FiberRuntime(fiberId, FiberRefs.forkAs(fiberId)(fiberRefs), this.runtimeFlags); | ||
const supervisor = fiberRuntime.getSupervisor(); | ||
@@ -51,3 +51,3 @@ if (supervisor !== Supervisor.none) { | ||
fiberRuntime.start(effect); | ||
FiberScope.globalScope.add(this.runtimeFlags, fiberRuntime); | ||
fiberScope.globalScope.add(this.runtimeFlags, fiberRuntime); | ||
return fiberRuntime; | ||
@@ -57,4 +57,4 @@ }; | ||
const fiberId = FiberId.unsafeMake(); | ||
const fiberRefs = (0, _Function.pipe)(this.fiberRefs, FiberRefs.updatedAs(fiberId, core.currentEnvironment, this.context)); | ||
const fiberRuntime = new FiberRuntime.FiberRuntime(fiberId, (0, _Function.pipe)(fiberRefs, FiberRefs.forkAs(fiberId)), this.runtimeFlags); | ||
const fiberRefs = FiberRefs.updatedAs(fiberId, core.currentEnvironment, this.context)(this.fiberRefs); | ||
const fiberRuntime = new FiberRuntime.FiberRuntime(fiberId, FiberRefs.forkAs(fiberId)(fiberRefs), this.runtimeFlags); | ||
const supervisor = fiberRuntime.getSupervisor(); | ||
@@ -66,7 +66,7 @@ if (supervisor !== Supervisor.none) { | ||
fiberRuntime.start(effect); | ||
FiberScope.globalScope.add(this.runtimeFlags, fiberRuntime); | ||
fiberScope.globalScope.add(this.runtimeFlags, fiberRuntime); | ||
fiberRuntime.unsafeAddObserver(exit => { | ||
k(exit); | ||
}); | ||
return id => k => this.unsafeRunAsyncWith((0, _Function.pipe)(fiberRuntime, Fiber.interruptWith(id)), exit => k(Exit.flatten(exit))); | ||
return id => k => this.unsafeRunAsyncWith(Fiber.interruptWith(id)(fiberRuntime), exit => k(Exit.flatten(exit))); | ||
}; | ||
@@ -76,3 +76,3 @@ this.unsafeRunSync = effect => { | ||
if (exit.op === OpCodes.OP_FAILURE) { | ||
throw (0, _Function.pipe)(exit.cause, Cause.squashWith(_Function.identity)); | ||
throw Cause.squashWith(_Function.identity)(exit.cause); | ||
} | ||
@@ -84,4 +84,4 @@ return exit.value; | ||
const scheduler = new Scheduler.StagedScheduler(); | ||
const fiberRefs = (0, _Function.pipe)(this.fiberRefs, FiberRefs.updatedAs(fiberId, core.currentEnvironment, this.context), FiberRefs.updatedAs(fiberId, core.currentScheduler, scheduler)); | ||
const fiberRuntime = new FiberRuntime.FiberRuntime(fiberId, (0, _Function.pipe)(fiberRefs, FiberRefs.forkAs(fiberId)), this.runtimeFlags); | ||
const fiberRefs = FiberRefs.updatedAs(fiberId, core.currentScheduler, scheduler)(FiberRefs.updatedAs(fiberId, core.currentEnvironment, this.context)(this.fiberRefs)); | ||
const fiberRuntime = new FiberRuntime.FiberRuntime(fiberId, FiberRefs.forkAs(fiberId)(fiberRefs), this.runtimeFlags); | ||
const supervisor = fiberRuntime.getSupervisor(); | ||
@@ -93,3 +93,3 @@ if (supervisor !== Supervisor.none) { | ||
fiberRuntime.start(effect); | ||
FiberScope.globalScope.add(this.runtimeFlags, fiberRuntime); | ||
fiberScope.globalScope.add(this.runtimeFlags, fiberRuntime); | ||
scheduler.flush(); | ||
@@ -119,3 +119,3 @@ const result = fiberRuntime.unsafePoll(); | ||
{ | ||
reject((0, _Function.pipe)(exit.cause, Cause.squashWith(_Function.identity))); | ||
reject(Cause.squashWith(_Function.identity)(exit.cause)); | ||
break; | ||
@@ -179,5 +179,5 @@ } | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.makeDeferred(), core.flatMap(deferred => (0, _Function.pipe)(runtime(), core.flatMap(runtime => core.uninterruptibleMask(restore => (0, _Function.pipe)(restore((0, _Function.pipe)(register(cb => runtime.unsafeRunAsync((0, _Function.pipe)(cb, core.intoDeferred(deferred)))), core.catchAllCause(cause => (0, _Function.pipe)(deferred, core.failCauseDeferred(cause))))), FiberRuntime.fork, core.zipRight(restore(core.awaitDeferred(deferred))))))))).traced(trace); | ||
return core.flatMap(deferred => core.flatMap(runtime => core.uninterruptibleMask(restore => core.zipRight(restore(core.deferredAwait(deferred)))(FiberRuntime.fork(restore(core.catchAllCause(cause => core.deferredFailCause(cause)(deferred))(register(cb => runtime.unsafeRunAsync(core.intoDeferred(deferred)(cb)))))))))(runtime()))(core.deferredMake()).traced(trace); | ||
}; | ||
exports.asyncEffect = asyncEffect; | ||
//# sourceMappingURL=runtime.js.map |
@@ -1,2 +0,3 @@ | ||
export {}; | ||
import type * as RuntimeFlags from "@effect/io/Fiber/Runtime/Flags"; | ||
export declare const windDown: (self: RuntimeFlags.RuntimeFlags) => boolean; | ||
//# sourceMappingURL=runtimeFlags.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.toSet = exports.renderPatch = exports.render = exports.patch = exports.isEnabled = exports.isDisabled = exports.enabledSet = exports.disabledSet = exports.differ = exports.diff = exports.allFlags = exports.WindDown = exports.RuntimeMetrics = exports.OpSupervision = exports.None = exports.Interruption = exports.FiberRoots = exports.CurrentFiber = exports.CooperativeYielding = void 0; | ||
exports.windDown = exports.toSet = exports.runtimeMetrics = exports.renderPatch = exports.render = exports.patch = exports.opSupervision = exports.none = exports.make = exports.isEnabled = exports.isDisabled = exports.interruption = exports.interruptible = exports.fiberRoots = exports.enabledSet = exports.enableAll = exports.enable = exports.disabledSet = exports.disableAll = exports.disable = exports.differ = exports.diff = exports.currentFiber = exports.cooperativeYielding = exports.allFlags = exports.WindDown = exports.RuntimeMetrics = exports.OpSupervision = exports.None = exports.Interruption = exports.FiberRoots = exports.CurrentFiber = exports.CooperativeYielding = void 0; | ||
var runtimeFlagsPatch = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/runtimeFlagsPatch")); | ||
@@ -40,7 +40,47 @@ var Differ = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Differ")); | ||
exports.allFlags = allFlags; | ||
const isEnabled = flag => { | ||
return self => (self & flag) !== 0; | ||
const cooperativeYielding = self => { | ||
return isEnabled(CooperativeYielding)(self); | ||
}; | ||
/** @internal */ | ||
exports.isEnabled = isEnabled; | ||
exports.cooperativeYielding = cooperativeYielding; | ||
const disable = flag => { | ||
return self => self & ~flag; | ||
}; | ||
/** @internal */ | ||
exports.disable = disable; | ||
const disableAll = flags => { | ||
return self => self & ~flags; | ||
}; | ||
/** @internal */ | ||
exports.disableAll = disableAll; | ||
const enable = flag => { | ||
return self => self | flag; | ||
}; | ||
/** @internal */ | ||
exports.enable = enable; | ||
const enableAll = flags => { | ||
return self => self | flags; | ||
}; | ||
/** @internal */ | ||
exports.enableAll = enableAll; | ||
const currentFiber = self => { | ||
return isEnabled(CurrentFiber)(self); | ||
}; | ||
/** @internal */ | ||
exports.currentFiber = currentFiber; | ||
const fiberRoots = self => { | ||
return isEnabled(FiberRoots)(self); | ||
}; | ||
/** @internal */ | ||
exports.fiberRoots = fiberRoots; | ||
const interruptible = self => { | ||
return interruption(self) && !windDown(self); | ||
}; | ||
/** @internal */ | ||
exports.interruptible = interruptible; | ||
const interruption = self => { | ||
return isEnabled(Interruption)(self); | ||
}; | ||
/** @internal */ | ||
exports.interruption = interruption; | ||
const isDisabled = flag => { | ||
@@ -51,7 +91,20 @@ return self => !isEnabled(flag)(self); | ||
exports.isDisabled = isDisabled; | ||
const toSet = self => { | ||
return new Set(allFlags.filter(flag => isEnabled(flag)(self))); | ||
const isEnabled = flag => { | ||
return self => (self & flag) !== 0; | ||
}; | ||
/** @internal */ | ||
exports.toSet = toSet; | ||
exports.isEnabled = isEnabled; | ||
const make = (...flags) => { | ||
return flags.reduce((a, b) => a | b, 0); | ||
}; | ||
/** @internal */ | ||
exports.make = make; | ||
const none = /*#__PURE__*/make(None); | ||
/** @internal */ | ||
exports.none = none; | ||
const opSupervision = self => { | ||
return isEnabled(OpSupervision)(self); | ||
}; | ||
/** @internal */ | ||
exports.opSupervision = opSupervision; | ||
const render = self => { | ||
@@ -66,5 +119,19 @@ const active = []; | ||
}; | ||
/** @internal */ | ||
exports.render = render; | ||
const runtimeMetrics = self => { | ||
return isEnabled(RuntimeMetrics)(self); | ||
}; | ||
/** @internal */ | ||
exports.runtimeMetrics = runtimeMetrics; | ||
const toSet = self => { | ||
return new Set(allFlags.filter(flag => isEnabled(flag)(self))); | ||
}; | ||
exports.toSet = toSet; | ||
const windDown = self => { | ||
return isEnabled(WindDown)(self); | ||
}; | ||
// circular with RuntimeFlagsPatch | ||
/** @internal */ | ||
exports.render = render; | ||
exports.windDown = windDown; | ||
const enabledSet = self => { | ||
@@ -71,0 +138,0 @@ return toSet(runtimeFlagsPatch.active(self) & runtimeFlagsPatch.enabled(self)); |
@@ -71,7 +71,7 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(Ref.get(this.ref), core.map(tuple => tuple[1])).traced(trace); | ||
return core.map(tuple => tuple[1])(Ref.get(this.ref)).traced(trace); | ||
} | ||
last() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(Ref.get(this.ref), core.flatMap(([element, _]) => { | ||
return core.flatMap(([element, _]) => { | ||
switch (element._tag) { | ||
@@ -87,11 +87,11 @@ case "None": | ||
} | ||
})).traced(trace); | ||
})(Ref.get(this.ref)).traced(trace); | ||
} | ||
reset() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.ref, Ref.set([Option.none, this.schedule.initial])).traced(trace); | ||
return Ref.set([Option.none, this.schedule.initial])(this.ref).traced(trace); | ||
} | ||
next(input) { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(Ref.get(this.ref), core.map(tuple => tuple[1]), core.flatMap(state => (0, _Function.pipe)(Clock.currentTimeMillis(), core.flatMap(now => (0, _Function.pipe)(this.schedule.step(now, input, state), core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? (0, _Function.pipe)(this.ref, Ref.set([Option.some(out), state]), core.zipRight(core.fail(Option.none))) : (0, _Function.pipe)(this.ref, Ref.set([Option.some(out), state]), core.zipRight(effect.sleep(Duration.millis(Intervals.start(decision.intervals) - now))), core.as(out)))))))).traced(trace); | ||
return core.flatMap(state => core.flatMap(now => core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? core.zipRight(core.fail(Option.none))(Ref.set([Option.some(out), state])(this.ref)) : core.as(out)(core.zipRight(effect.sleep(Duration.millis(Intervals.start(decision.intervals) - now)))(Ref.set([Option.some(out), state])(this.ref))))(this.schedule.step(now, input, state)))(Clock.currentTimeMillis()))(core.map(tuple => tuple[1])(Ref.get(this.ref))).traced(trace); | ||
} | ||
@@ -108,3 +108,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, addDelayEffect(out => core.sync(() => f(out)))); | ||
return addDelayEffect(out => core.sync(() => f(out)))(self); | ||
}; | ||
@@ -116,3 +116,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyDelayEffect((out, duration) => (0, _Function.pipe)(f(out), core.map(delay => Duration.millis(duration.millis + delay.millis))))); | ||
return modifyDelayEffect((out, duration) => core.map(delay => Duration.millis(duration.millis + delay.millis))(f(out)))(self); | ||
}; | ||
@@ -124,3 +124,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, andThenEither(that), map(Either.merge)); | ||
return map(Either.merge)(andThenEither(that)(self)); | ||
}; | ||
@@ -134,8 +134,8 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return state[2] ? (0, _Function.pipe)(self.step(now, input, state[0]), core.flatMap(([lState, out, decision]) => { | ||
return state[2] ? core.flatMap(([lState, out, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
return (0, _Function.pipe)(that.step(now, input, state[1]), core.map(([rState, out, decision]) => [[lState, rState, false], Either.right(out), decision])); | ||
return core.map(([rState, out, decision]) => [[lState, rState, false], Either.right(out), decision])(that.step(now, input, state[1])); | ||
} | ||
return core.succeed([[lState, state[1], true], Either.left(out), decision]); | ||
})).traced(trace) : (0, _Function.pipe)(that.step(now, input, state[1]), core.map(([rState, out, decision]) => [[state[0], rState, false], Either.right(out), decision])).traced(trace); | ||
})(self.step(now, input, state[0])).traced(trace) : core.map(([rState, out, decision]) => [[state[0], rState, false], Either.right(out), decision])(that.step(now, input, state[1])).traced(trace); | ||
}); | ||
@@ -148,3 +148,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, map(() => out2)); | ||
return map(() => out2)(self); | ||
}; | ||
@@ -155,3 +155,3 @@ }; | ||
const asUnit = self => { | ||
return (0, _Function.pipe)(self, map(_Function.constVoid)); | ||
return map(_Function.constVoid)(self); | ||
}; | ||
@@ -164,9 +164,9 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, in1, state[0]), core.zipWith(that.step(now, in2, state[1]), ([lState, out, lDecision], [rState, out2, rDecision]) => { | ||
return core.zipWith(that.step(now, in2, state[1]), ([lState, out, lDecision], [rState, out2, rDecision]) => { | ||
if (ScheduleDecision.isContinue(lDecision) && ScheduleDecision.isContinue(rDecision)) { | ||
const interval = (0, _Function.pipe)(lDecision.intervals, Intervals.union(rDecision.intervals)); | ||
const interval = Intervals.union(rDecision.intervals)(lDecision.intervals); | ||
return [[lState, rState], [out, out2], ScheduleDecision.continue(interval)]; | ||
} | ||
return [[lState, rState], [out, out2], ScheduleDecision.done]; | ||
})).traced(trace); | ||
})(self.step(now, in1, state[0])).traced(trace); | ||
}); | ||
@@ -179,3 +179,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, checkEffect((input, out) => core.sync(() => test(input, out)))); | ||
return checkEffect((input, out) => core.sync(() => test(input, out)))(self); | ||
}; | ||
@@ -189,8 +189,8 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => { | ||
return core.flatMap(([state, out, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
return core.succeed([state, out, ScheduleDecision.done]); | ||
} | ||
return (0, _Function.pipe)(test(input, out), core.map(cont => cont ? [state, out, decision] : [state, out, ScheduleDecision.done])); | ||
})).traced(trace); | ||
return core.map(cont => cont ? [state, out, decision] : [state, out, ScheduleDecision.done])(test(input, out)); | ||
})(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -207,7 +207,7 @@ }; | ||
{ | ||
return (0, _Function.pipe)(self.step(now, either.left, state[0]), core.map(([lState, out, decision]) => [[lState, state[1]], Either.left(out), decision])).traced(trace); | ||
return core.map(([lState, out, decision]) => [[lState, state[1]], Either.left(out), decision])(self.step(now, either.left, state[0])).traced(trace); | ||
} | ||
case "Right": | ||
{ | ||
return (0, _Function.pipe)(that.step(now, either.right, state[1]), core.map(([rState, out2, decision]) => [[state[0], rState], Either.right(out2), decision])).traced(trace); | ||
return core.map(([rState, out2, decision]) => [[state[0], rState], Either.right(out2), decision])(that.step(now, either.right, state[1])).traced(trace); | ||
} | ||
@@ -221,3 +221,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, choose(that), map(Either.merge)); | ||
return map(Either.merge)(choose(that)(self)); | ||
}; | ||
@@ -233,3 +233,3 @@ }; | ||
const collectAllOutputs = self => { | ||
return (0, _Function.pipe)(self, fold(Chunk.empty, (outs, out) => (0, _Function.pipe)(outs, Chunk.append(out)))); | ||
return fold(Chunk.empty, (outs, out) => Chunk.append(out)(outs))(self); | ||
}; | ||
@@ -262,3 +262,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state[0]), core.flatMap(([lState, out, lDecision]) => (0, _Function.pipe)(that.step(now, out, state[1]), core.map(([rState, out2, rDecision]) => ScheduleDecision.isDone(lDecision) ? [[lState, rState], out2, ScheduleDecision.done] : ScheduleDecision.isDone(rDecision) ? [[lState, rState], out2, ScheduleDecision.done] : [[lState, rState], out2, ScheduleDecision.continue((0, _Function.pipe)(lDecision.intervals, Intervals.max(rDecision.intervals)))])))).traced(trace); | ||
return core.flatMap(([lState, out, lDecision]) => core.map(([rState, out2, rDecision]) => ScheduleDecision.isDone(lDecision) ? [[lState, rState], out2, ScheduleDecision.done] : ScheduleDecision.isDone(rDecision) ? [[lState, rState], out2, ScheduleDecision.done] : [[lState, rState], out2, ScheduleDecision.continue(Intervals.max(rDecision.intervals)(lDecision.intervals))])(that.step(now, out, state[1])))(self.step(now, input, state[0])).traced(trace); | ||
}); | ||
@@ -271,3 +271,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, contramapEffect(input2 => core.sync(() => f(input2)))); | ||
return contramapEffect(input2 => core.sync(() => f(input2)))(self); | ||
}; | ||
@@ -281,3 +281,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(f(input2), core.flatMap(input => self.step(now, input, state))).traced(trace); | ||
return core.flatMap(input => self.step(now, input, state))(f(input2)).traced(trace); | ||
}); | ||
@@ -299,6 +299,6 @@ }; | ||
} | ||
const [end0, n] = state; | ||
const now0 = Math.max(end0, now); | ||
const day0 = nextDayOfMonth(now0, day); | ||
const start = Math.max(beginningOfDay(day0), now0); | ||
const n = state[1]; | ||
const initial = n === 0; | ||
const day0 = nextDayOfMonth(now, day, initial); | ||
const start = beginningOfDay(day0); | ||
const end = endOfDay(day0); | ||
@@ -317,6 +317,6 @@ const interval = Interval.make(start, end); | ||
} | ||
const [end0, n] = state; | ||
const now0 = Math.max(end0, now); | ||
const day0 = nextDay(now0, day); | ||
const start = Math.max(beginningOfDay(day0), now0); | ||
const n = state[1]; | ||
const initial = n === 0; | ||
const day0 = nextDay(now, day, initial); | ||
const start = beginningOfDay(day0); | ||
const end = endOfDay(day0); | ||
@@ -331,3 +331,3 @@ const interval = Interval.make(start, end); | ||
return self => { | ||
return (0, _Function.pipe)(self, delayedEffect(duration => core.sync(() => f(duration)))); | ||
return delayedEffect(duration => core.sync(() => f(duration)))(self); | ||
}; | ||
@@ -339,3 +339,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyDelayEffect((_, delay) => f(delay))); | ||
return modifyDelayEffect((_, delay) => f(delay))(self); | ||
}; | ||
@@ -346,3 +346,3 @@ }; | ||
const delayedSchedule = schedule => { | ||
return (0, _Function.pipe)(schedule, addDelay(x => x)); | ||
return addDelay(x => x)(schedule); | ||
}; | ||
@@ -353,3 +353,3 @@ /** @internal */ | ||
return makeWithState(self.initial, (now, input, state) => { | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, _, decision]) => { | ||
return core.flatMap(([state, _, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
@@ -359,3 +359,3 @@ return core.succeed([state, Duration.zero, decision]); | ||
return core.succeed([state, Duration.millis(Intervals.start(decision.intervals) - now), decision]); | ||
})); | ||
})(self.step(now, input, state)); | ||
}); | ||
@@ -367,3 +367,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, contramap(f), map(g)); | ||
return map(g)(contramap(f)(self)); | ||
}; | ||
@@ -374,3 +374,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, contramapEffect(f), mapEffect(g)); | ||
return mapEffect(g)(contramapEffect(f)(self)); | ||
}; | ||
@@ -382,3 +382,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(Ref.make([Option.none, self.initial]), core.map(ref => new ScheduleDriverImpl(self, ref))).traced(trace); | ||
return core.map(ref => new ScheduleDriverImpl(self, ref))(Ref.make([Option.none, self.initial])).traced(trace); | ||
}; | ||
@@ -397,3 +397,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, union(that)); | ||
return union(that)(self); | ||
}; | ||
@@ -405,3 +405,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, union(that), map(([out, out2]) => f(out, out2))); | ||
return map(([out, out2]) => f(out, out2))(union(that)(self)); | ||
}; | ||
@@ -432,3 +432,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? (0, _Function.pipe)(finalizer, core.as([state, out, decision])) : core.succeed([state, out, decision]))).traced(trace); | ||
return core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? core.as([state, out, decision])(finalizer) : core.succeed([state, out, decision]))(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -440,3 +440,3 @@ }; | ||
const exponential = (base, factor = 2.0) => { | ||
return delayedSchedule((0, _Function.pipe)(forever(), map(i => Duration.millis(base.millis * Math.pow(factor, i))))); | ||
return delayedSchedule(map(i => Duration.millis(base.millis * Math.pow(factor, i)))(forever())); | ||
}; | ||
@@ -446,3 +446,3 @@ /** @internal */ | ||
const fibonacci = one => { | ||
return delayedSchedule((0, _Function.pipe)(unfold([one, one], ([a, b]) => [b, (0, _Function.pipe)(a, Duration.add(b))]), map(out => out[0]))); | ||
return delayedSchedule(map(out => out[0])(unfold([one, one], ([a, b]) => [b, Duration.add(b)(a)]))); | ||
}; | ||
@@ -478,3 +478,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, foldEffect(zero, (z, out) => core.sync(() => f(z, out)))); | ||
return foldEffect(zero, (z, out) => core.sync(() => f(z, out)))(self); | ||
}; | ||
@@ -488,3 +488,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, s), core.flatMap(([s, out, decision]) => ScheduleDecision.isDone(decision) ? core.succeed([[s, z], z, decision]) : (0, _Function.pipe)(f(z, out), core.map(z2 => [[s, z2], z, decision])))).traced(trace); | ||
return core.flatMap(([s, out, decision]) => ScheduleDecision.isDone(decision) ? core.succeed([[s, z], z, decision]) : core.map(z2 => [[s, z2], z, decision])(f(z, out)))(self.step(now, input, s)).traced(trace); | ||
}); | ||
@@ -525,3 +525,3 @@ }; | ||
const fromFunction = f => { | ||
return (0, _Function.pipe)(identity(), map(f)); | ||
return map(f)(identity()); | ||
}; | ||
@@ -536,6 +536,6 @@ /** @internal */ | ||
} | ||
const [end0, n] = state; | ||
const now0 = Math.max(end0, now); | ||
const hour0 = nextHour(now0, hour); | ||
const start = Math.max(beginningOfHour(hour0), now0); | ||
const n = state[1]; | ||
const initial = n === 0; | ||
const hour0 = nextHour(now, hour, initial); | ||
const start = beginningOfHour(hour0); | ||
const end = endOfHour(hour0); | ||
@@ -558,3 +558,3 @@ const interval = Interval.make(start, end); | ||
return self => { | ||
return (0, _Function.pipe)(self, intersectWith(that, (selfIntervals, thatIntervals) => (0, _Function.pipe)(selfIntervals, Intervals.intersect(thatIntervals)))); | ||
return intersectWith(that, (selfIntervals, thatIntervals) => Intervals.intersect(thatIntervals)(selfIntervals))(self); | ||
}; | ||
@@ -567,3 +567,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state[0]), core.zipWith(that.step(now, input, state[1]), (a, b) => [a, b]), core.flatMap(([[lState, out, lDecision], [rState, out2, rDecision]]) => { | ||
return core.flatMap(([[lState, out, lDecision], [rState, out2, rDecision]]) => { | ||
if (ScheduleDecision.isContinue(lDecision) && ScheduleDecision.isContinue(rDecision)) { | ||
@@ -573,3 +573,3 @@ return intersectWithLoop(self, that, input, lState, out, lDecision.intervals, rState, out2, rDecision.intervals, f); | ||
return core.succeed([[lState, rState], [out, out2], ScheduleDecision.done]); | ||
})).traced(trace); | ||
})(core.zipWith(that.step(now, input, state[1]), (a, b) => [a, b])(self.step(now, input, state[0]))).traced(trace); | ||
}); | ||
@@ -584,4 +584,4 @@ }; | ||
} | ||
if ((0, _Function.pipe)(lInterval, Intervals.lessThan(rInterval))) { | ||
return (0, _Function.pipe)(self.step(Intervals.end(lInterval), input, lState), core.flatMap(([lState, out, decision]) => { | ||
if (Intervals.lessThan(rInterval)(lInterval)) { | ||
return core.flatMap(([lState, out, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
@@ -591,5 +591,5 @@ return core.succeed([[lState, rState], [out, out2], ScheduleDecision.done]); | ||
return intersectWithLoop(self, that, input, lState, out, decision.intervals, rState, out2, rInterval, f); | ||
})); | ||
})(self.step(Intervals.end(lInterval), input, lState)); | ||
} | ||
return (0, _Function.pipe)(that.step(Intervals.end(rInterval), input, rState), core.flatMap(([rState, out2, decision]) => { | ||
return core.flatMap(([rState, out2, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
@@ -599,3 +599,3 @@ return core.succeed([[lState, rState], [out, out2], ScheduleDecision.done]); | ||
return intersectWithLoop(self, that, input, lState, out, lInterval, rState, out2, decision.intervals, f); | ||
})); | ||
})(that.step(Intervals.end(rInterval), input, rState)); | ||
}; | ||
@@ -605,7 +605,7 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, delayedEffect(duration => (0, _Function.pipe)(Random.next(), core.map(random => { | ||
return delayedEffect(duration => core.map(random => { | ||
const d = duration.millis; | ||
const jittered = d * min * (1 - random) + d * max * random; | ||
return Duration.millis(jittered); | ||
})))); | ||
})(Random.next()))(self); | ||
}; | ||
@@ -616,3 +616,3 @@ }; | ||
const left = self => { | ||
return (0, _Function.pipe)(self, choose(identity())); | ||
return choose(identity())(self); | ||
}; | ||
@@ -622,3 +622,3 @@ /** @internal */ | ||
const linear = base => { | ||
return delayedSchedule((0, _Function.pipe)(forever(), map(i => Duration.millis(base.millis * (i + 1))))); | ||
return delayedSchedule(map(i => Duration.millis(base.millis * (i + 1)))(forever())); | ||
}; | ||
@@ -629,3 +629,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, mapEffect(out => core.sync(() => f(out)))); | ||
return mapEffect(out => core.sync(() => f(out)))(self); | ||
}; | ||
@@ -639,3 +639,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => (0, _Function.pipe)(f(out), core.map(out2 => [state, out2, decision])))).traced(trace); | ||
return core.flatMap(([state, out, decision]) => core.map(out2 => [state, out2, decision])(f(out)))(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -652,6 +652,6 @@ }; | ||
} | ||
const [end0, n] = state; | ||
const now0 = Math.max(end0, now); | ||
const minute0 = nextMinute(Math.max(end0, now0), minute); | ||
const start = Math.max(beginningOfMinute(minute0), now0); | ||
const n = state[1]; | ||
const initial = n === 0; | ||
const minute0 = nextMinute(now, minute, initial); | ||
const start = beginningOfMinute(minute0); | ||
const end = endOfMinute(minute0); | ||
@@ -666,3 +666,3 @@ const interval = Interval.make(start, end); | ||
return self => { | ||
return (0, _Function.pipe)(self, modifyDelayEffect((out, duration) => core.sync(() => f(out, duration)))); | ||
return modifyDelayEffect((out, duration) => core.sync(() => f(out, duration)))(self); | ||
}; | ||
@@ -676,3 +676,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => { | ||
return core.flatMap(([state, out, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
@@ -683,3 +683,3 @@ return core.succeed([state, out, decision]); | ||
const delay = Interval.size(Interval.make(now, Intervals.start(intervals))); | ||
return (0, _Function.pipe)(f(out, delay), core.map(duration => { | ||
return core.map(duration => { | ||
const oldStart = Intervals.start(intervals); | ||
@@ -691,4 +691,4 @@ const newStart = now + duration.millis; | ||
return [state, out, ScheduleDecision.continueWith(newInterval)]; | ||
})); | ||
})).traced(trace); | ||
})(f(out, delay)); | ||
})(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -703,3 +703,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => (0, _Function.pipe)(f(out, decision), core.as([state, out, decision])))).traced(trace); | ||
return core.flatMap(([state, out, decision]) => core.as([state, out, decision])(f(out, decision)))(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -718,3 +718,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.map(([state, _, decision]) => [state, input, decision])).traced(trace); | ||
return core.map(([state, _, decision]) => [state, input, decision])(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -728,3 +728,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.provideEnvironment(context)).traced(trace); | ||
return core.provideEnvironment(context)(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -739,5 +739,5 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.environmentWithEffect(env => (0, _Function.pipe)(self.step(now, input, state), | ||
return core.environmentWithEffect(env => | ||
// @ts-expect-error | ||
core.provideEnvironment((0, _Function.pipe)(env, Context.add(tag)(service))))).traced(trace); | ||
core.provideEnvironment(Context.add(tag)(service)(env))(self.step(now, input, state))).traced(trace); | ||
}); | ||
@@ -752,3 +752,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.provideSomeEnvironment(f)).traced(trace); | ||
return core.provideSomeEnvironment(f)(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -761,3 +761,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, reconsiderEffect((out, decision) => core.sync(() => f(out, decision)))); | ||
return reconsiderEffect((out, decision) => core.sync(() => f(out, decision)))(self); | ||
}; | ||
@@ -771,3 +771,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? (0, _Function.pipe)(f(out, decision), core.map(either => { | ||
return core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? core.map(either => { | ||
switch (either._tag) { | ||
@@ -784,3 +784,3 @@ case "Left": | ||
} | ||
})) : (0, _Function.pipe)(f(out, decision), core.map(either => { | ||
})(f(out, decision)) : core.map(either => { | ||
switch (either._tag) { | ||
@@ -797,3 +797,3 @@ case "Left": | ||
} | ||
})))).traced(trace); | ||
})(f(out, decision)))(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -805,3 +805,3 @@ }; | ||
const recurUntil = f => { | ||
return (0, _Function.pipe)(identity(), untilInput(f)); | ||
return untilInput(f)(identity()); | ||
}; | ||
@@ -811,3 +811,3 @@ /** @internal */ | ||
const recurUntilEffect = f => { | ||
return (0, _Function.pipe)(identity(), untilInputEffect(f)); | ||
return untilInputEffect(f)(identity()); | ||
}; | ||
@@ -817,3 +817,3 @@ /** @internal */ | ||
const recurUntilEquals = value => { | ||
return (0, _Function.pipe)(identity(), untilInput(input => Equal.equals(input, value))); | ||
return untilInput(input => Equal.equals(input, value))(identity()); | ||
}; | ||
@@ -823,3 +823,3 @@ /** @internal */ | ||
const recurUntilOption = pf => { | ||
return (0, _Function.pipe)(identity(), map(pf), untilOutput(Option.isSome)); | ||
return untilOutput(Option.isSome)(map(pf)(identity())); | ||
}; | ||
@@ -829,3 +829,3 @@ /** @internal */ | ||
const recurUpTo = duration => { | ||
return (0, _Function.pipe)(elapsed(), whileOutput(elapsed => (0, _Function.pipe)(elapsed, Duration.lessThan(duration)))); | ||
return whileOutput(elapsed => Duration.lessThan(duration)(elapsed))(elapsed()); | ||
}; | ||
@@ -835,3 +835,3 @@ /** @internal */ | ||
const recurWhile = f => { | ||
return (0, _Function.pipe)(identity(), whileInput(f)); | ||
return whileInput(f)(identity()); | ||
}; | ||
@@ -841,3 +841,3 @@ /** @internal */ | ||
const recurWhileEffect = f => { | ||
return (0, _Function.pipe)(identity(), whileInputEffect(f)); | ||
return whileInputEffect(f)(identity()); | ||
}; | ||
@@ -847,3 +847,3 @@ /** @internal */ | ||
const recurWhileEquals = value => { | ||
return (0, _Function.pipe)(identity(), whileInput(input => Equal.equals(input, value))); | ||
return whileInput(input => Equal.equals(input, value))(identity()); | ||
}; | ||
@@ -853,3 +853,3 @@ /** @internal */ | ||
const recurs = n => { | ||
return (0, _Function.pipe)(forever(), whileOutput(out => out < n)); | ||
return whileOutput(out => out < n)(forever()); | ||
}; | ||
@@ -861,3 +861,3 @@ /** @internal */ | ||
const step = (now, input, state) => { | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? step(now, input, self.initial) : core.succeed([state, out, decision]))); | ||
return core.flatMap(([state, out, decision]) => ScheduleDecision.isDone(decision) ? step(now, input, self.initial) : core.succeed([state, out, decision]))(self.step(now, input, state)); | ||
}; | ||
@@ -870,3 +870,3 @@ return step(now, input, state); | ||
const repetitions = self => { | ||
return (0, _Function.pipe)(self, fold(0, (n, _) => n + 1)); | ||
return fold(0, (n, _) => n + 1)(self); | ||
}; | ||
@@ -877,3 +877,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, intersect(elapsed()), resetWhen(([, time]) => (0, _Function.pipe)(time, Duration.greaterThanOrEqualTo(duration))), map(out => out[0])); | ||
return map(out => out[0])(resetWhen(([, time]) => Duration.greaterThanOrEqualTo(duration)(time))(intersect(elapsed())(self))); | ||
}; | ||
@@ -887,3 +887,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => f(out) ? self.step(now, input, self.initial) : core.succeed([state, out, decision]))).traced(trace); | ||
return core.flatMap(([state, out, decision]) => f(out) ? self.step(now, input, self.initial) : core.succeed([state, out, decision]))(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -895,3 +895,3 @@ }; | ||
const right = self => { | ||
return (0, _Function.pipe)(identity(), choose(self)); | ||
return choose(self)(identity()); | ||
}; | ||
@@ -903,3 +903,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(runLoop(self, now, List.fromIterable(input), self.initial, List.nil()), core.map(list => Chunk.fromIterable(List.reverse(list)))).traced(trace); | ||
return core.map(list => Chunk.fromIterable(List.reverse(list)))(runLoop(self, now, List.fromIterable(input), self.initial, List.nil())).traced(trace); | ||
}; | ||
@@ -915,8 +915,8 @@ }; | ||
const nextInputs = inputs.tail; | ||
return (0, _Function.pipe)(self.step(now, input, state), core.flatMap(([state, out, decision]) => { | ||
return core.flatMap(([state, out, decision]) => { | ||
if (ScheduleDecision.isDone(decision)) { | ||
return core.sync(() => (0, _Function.pipe)(acc, List.prepend(out))); | ||
return core.sync(() => List.prepend(out)(acc)); | ||
} | ||
return runLoop(self, Intervals.start(decision.intervals), nextInputs, state, (0, _Function.pipe)(acc, List.prepend(out))); | ||
})); | ||
return runLoop(self, Intervals.start(decision.intervals), nextInputs, state, List.prepend(out)(acc)); | ||
})(self.step(now, input, state)); | ||
}; | ||
@@ -930,6 +930,6 @@ /** @internal */ | ||
} | ||
const [end0, n] = state; | ||
const now0 = Math.max(end0, now); | ||
const second0 = nextSecond(now0, second); | ||
const start = Math.max(beginningOfSecond(second0), now0); | ||
const n = state[1]; | ||
const initial = n === 0; | ||
const second0 = nextSecond(now, second, initial); | ||
const start = beginningOfSecond(second0); | ||
const end = endOfSecond(second0); | ||
@@ -943,3 +943,3 @@ const interval = Interval.make(start, end); | ||
const spaced = duration => { | ||
return (0, _Function.pipe)(forever(), addDelay(() => duration)); | ||
return addDelay(() => duration)(forever()); | ||
}; | ||
@@ -954,3 +954,3 @@ /** @internal */ | ||
const succeed = value => { | ||
return (0, _Function.pipe)(forever(), map(() => value)); | ||
return map(() => value)(forever()); | ||
}; | ||
@@ -960,3 +960,3 @@ /** @internal */ | ||
const sync = evaluate => { | ||
return (0, _Function.pipe)(forever(), map(evaluate)); | ||
return map(evaluate)(forever()); | ||
}; | ||
@@ -969,3 +969,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(f(input), core.zipRight(self.step(now, input, state))).traced(trace); | ||
return core.zipRight(self.step(now, input, state))(f(input)).traced(trace); | ||
}); | ||
@@ -980,3 +980,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state), core.tap(([, out]) => f(out))).traced(trace); | ||
return core.tap(([, out]) => f(out))(self.step(now, input, state)).traced(trace); | ||
}); | ||
@@ -997,3 +997,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, unionWith(that, (selfIntervals, thatIntervals) => (0, _Function.pipe)(selfIntervals, Intervals.union(thatIntervals)))); | ||
return unionWith(that, (selfIntervals, thatIntervals) => Intervals.union(thatIntervals)(selfIntervals))(self); | ||
}; | ||
@@ -1006,3 +1006,3 @@ }; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(self.step(now, input, state[0]), core.zipWith(that.step(now, input, state[1]), ([lState, l, lDecision], [rState, r, rDecision]) => { | ||
return core.zipWith(that.step(now, input, state[1]), ([lState, l, lDecision], [rState, r, rDecision]) => { | ||
if (ScheduleDecision.isDone(lDecision) && ScheduleDecision.isDone(rDecision)) { | ||
@@ -1022,3 +1022,3 @@ return [[lState, rState], [l, r], ScheduleDecision.done]; | ||
throw new Error("BUG: Schedule.unionWith - please report an issue at https://github.com/Effect-TS/io/issues"); | ||
})).traced(trace); | ||
})(self.step(now, input, state[0])).traced(trace); | ||
}); | ||
@@ -1030,3 +1030,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, check((input, _) => !f(input))); | ||
return check((input, _) => !f(input))(self); | ||
}; | ||
@@ -1038,3 +1038,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, checkEffect((input, _) => effect.negate(f(input)))); | ||
return checkEffect((input, _) => effect.negate(f(input)))(self); | ||
}; | ||
@@ -1046,3 +1046,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, check((_, out) => !f(out))); | ||
return check((_, out) => !f(out))(self); | ||
}; | ||
@@ -1054,3 +1054,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, checkEffect((_, out) => effect.negate(f(out)))); | ||
return checkEffect((_, out) => effect.negate(f(out)))(self); | ||
}; | ||
@@ -1062,3 +1062,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipLeft(recurUpTo(duration))); | ||
return zipLeft(recurUpTo(duration))(self); | ||
}; | ||
@@ -1070,3 +1070,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, check((input, _) => f(input))); | ||
return check((input, _) => f(input))(self); | ||
}; | ||
@@ -1078,3 +1078,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, checkEffect((input, _) => f(input))); | ||
return checkEffect((input, _) => f(input))(self); | ||
}; | ||
@@ -1086,3 +1086,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, check((_, out) => f(out))); | ||
return check((_, out) => f(out))(self); | ||
}; | ||
@@ -1094,3 +1094,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, checkEffect((_, out) => f(out))); | ||
return checkEffect((_, out) => f(out))(self); | ||
}; | ||
@@ -1120,3 +1120,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, intersect(that), map(out => out[0])); | ||
return map(out => out[0])(intersect(that)(self)); | ||
}; | ||
@@ -1128,3 +1128,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, intersect(that), map(out => out[1])); | ||
return map(out => out[1])(intersect(that)(self)); | ||
}; | ||
@@ -1136,3 +1136,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, intersect(that), map(([out, out2]) => f(out, out2))); | ||
return map(([out, out2]) => f(out, out2))(intersect(that)(self)); | ||
}; | ||
@@ -1156,5 +1156,5 @@ } | ||
exports.endOfSecond = endOfSecond; | ||
const nextSecond = (now, second) => { | ||
const nextSecond = (now, second, initial) => { | ||
const date = new Date(now); | ||
if (date.getSeconds() === second) { | ||
if (date.getSeconds() === second && initial) { | ||
return now; | ||
@@ -1186,5 +1186,5 @@ } | ||
exports.endOfMinute = endOfMinute; | ||
const nextMinute = (now, minute) => { | ||
const nextMinute = (now, minute, initial) => { | ||
const date = new Date(now); | ||
if (date.getMinutes() === minute) { | ||
if (date.getMinutes() === minute && initial) { | ||
return now; | ||
@@ -1216,5 +1216,5 @@ } | ||
exports.endOfHour = endOfHour; | ||
const nextHour = (now, hour) => { | ||
const nextHour = (now, hour, initial) => { | ||
const date = new Date(now); | ||
if (date.getHours() === hour) { | ||
if (date.getHours() === hour && initial) { | ||
return now; | ||
@@ -1246,14 +1246,15 @@ } | ||
exports.endOfDay = endOfDay; | ||
const nextDay = (now, dayOfWeek) => { | ||
const nextDay = (now, dayOfWeek, initial) => { | ||
const date = new Date(now); | ||
if (date.getDay() === dayOfWeek) { | ||
if (date.getDay() === dayOfWeek && initial) { | ||
return now; | ||
} | ||
return date.setDate(date.getDate() + (7 + dayOfWeek - date.getDay()) % 7); | ||
const nextDayOfWeek = (7 + dayOfWeek - date.getDay()) % 7; | ||
return date.setDate(date.getDate() + (nextDayOfWeek === 0 ? 7 : nextDayOfWeek)); | ||
}; | ||
/** @internal */ | ||
exports.nextDay = nextDay; | ||
const nextDayOfMonth = (now, day) => { | ||
const nextDayOfMonth = (now, day, initial) => { | ||
const date = new Date(now); | ||
if (date.getDate() === day) { | ||
if (date.getDate() === day && initial) { | ||
return now; | ||
@@ -1285,3 +1286,3 @@ } | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatOrElse_Effect(schedule, (e, _) => core.fail(e))).traced(trace); | ||
return repeatOrElse_Effect(schedule, (e, _) => core.fail(e))(self).traced(trace); | ||
}; | ||
@@ -1294,3 +1295,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatOrElseEither_Effect(schedule, orElse), core.map(Either.merge)).traced(trace); | ||
return core.map(Either.merge)(repeatOrElseEither_Effect(schedule, orElse)(self)).traced(trace); | ||
}; | ||
@@ -1303,3 +1304,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(driver(schedule), core.flatMap(driver => (0, _Function.pipe)(self, core.foldEffect(error => (0, _Function.pipe)(orElse(error, Option.none), core.map(Either.left)), value => repeatOrElseEitherEffectLoop(self, driver, orElse, value))))).traced(trace); | ||
return core.flatMap(driver => core.foldEffect(error => core.map(Either.left)(orElse(error, Option.none)), value => repeatOrElseEitherEffectLoop(self, driver, orElse, value))(self))(driver(schedule)).traced(trace); | ||
}; | ||
@@ -1310,3 +1311,3 @@ }; | ||
const repeatOrElseEitherEffectLoop = (self, driver, orElse, value) => { | ||
return (0, _Function.pipe)(driver.next(value), core.foldEffect(() => (0, _Function.pipe)(effect.orDie(driver.last()), core.map(Either.right)), b => (0, _Function.pipe)(self, core.foldEffect(error => (0, _Function.pipe)(orElse(error, Option.some(b)), core.map(Either.left)), value => repeatOrElseEitherEffectLoop(self, driver, orElse, value))))); | ||
return core.foldEffect(() => core.map(Either.right)(effect.orDie(driver.last())), b => core.foldEffect(error => core.map(Either.left)(orElse(error, Option.some(b))), value => repeatOrElseEitherEffectLoop(self, driver, orElse, value))(self))(driver.next(value)); | ||
}; | ||
@@ -1317,3 +1318,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatUntilEffect_Effect(a => core.sync(() => f(a)))).traced(trace); | ||
return repeatUntilEffect_Effect(a => core.sync(() => f(a)))(self).traced(trace); | ||
}; | ||
@@ -1326,3 +1327,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, core.flatMap(a => (0, _Function.pipe)(f(a), core.flatMap(result => result ? core.succeed(a) : (0, _Function.pipe)(core.yieldNow(), core.zipRight((0, _Function.pipe)(self, repeatUntilEffect_Effect(f)))))))).traced(trace); | ||
return core.flatMap(a => core.flatMap(result => result ? core.succeed(a) : core.zipRight(repeatUntilEffect_Effect(f)(self))(core.yieldNow()))(f(a)))(self).traced(trace); | ||
}; | ||
@@ -1335,3 +1336,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatUntil_Effect(a => Equal.equals(a, value))).traced(trace); | ||
return repeatUntil_Effect(a => Equal.equals(a, value))(self).traced(trace); | ||
}; | ||
@@ -1344,3 +1345,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatWhileEffect_Effect(a => core.sync(() => f(a)))).traced(trace); | ||
return repeatWhileEffect_Effect(a => core.sync(() => f(a)))(self).traced(trace); | ||
}; | ||
@@ -1353,3 +1354,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatUntilEffect_Effect(a => effect.negate(f(a)))).traced(trace); | ||
return repeatUntilEffect_Effect(a => effect.negate(f(a)))(self).traced(trace); | ||
}; | ||
@@ -1362,3 +1363,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, repeatWhile_Effect(a => Equal.equals(a, value))).traced(trace); | ||
return repeatWhile_Effect(a => Equal.equals(a, value))(self).traced(trace); | ||
}; | ||
@@ -1371,3 +1372,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, retryOrElse_Effect(policy, (e, _) => core.fail(e))).traced(trace); | ||
return retryOrElse_Effect(policy, (e, _) => core.fail(e))(self).traced(trace); | ||
}; | ||
@@ -1386,3 +1387,3 @@ }; | ||
const retryN_EffectLoop = (self, n) => { | ||
return (0, _Function.pipe)(self, effect.catchAll(e => n < 0 ? core.fail(e) : (0, _Function.pipe)(core.yieldNow(), core.flatMap(() => retryN_EffectLoop(self, n - 1))))); | ||
return effect.catchAll(e => n < 0 ? core.fail(e) : core.flatMap(() => retryN_EffectLoop(self, n - 1))(core.yieldNow()))(self); | ||
}; | ||
@@ -1393,3 +1394,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, retryOrElseEither_Effect(policy, orElse), core.map(Either.merge)).traced(trace); | ||
return core.map(Either.merge)(retryOrElseEither_Effect(policy, orElse)(self)).traced(trace); | ||
}; | ||
@@ -1402,3 +1403,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(driver(policy), core.flatMap(driver => retryOrElseEither_EffectLoop(self, driver, orElse))).traced(trace); | ||
return core.flatMap(driver => retryOrElseEither_EffectLoop(self, driver, orElse))(driver(policy)).traced(trace); | ||
}; | ||
@@ -1409,3 +1410,3 @@ }; | ||
const retryOrElseEither_EffectLoop = (self, driver, orElse) => { | ||
return (0, _Function.pipe)(self, core.map(Either.right), effect.catchAll(e => (0, _Function.pipe)(driver.next(e), core.foldEffect(() => (0, _Function.pipe)(driver.last(), effect.orDie, core.flatMap(out => (0, _Function.pipe)(orElse(e, out), core.map(Either.left)))), () => retryOrElseEither_EffectLoop(self, driver, orElse))))); | ||
return effect.catchAll(e => core.foldEffect(() => core.flatMap(out => core.map(Either.left)(orElse(e, out)))(effect.orDie(driver.last())), () => retryOrElseEither_EffectLoop(self, driver, orElse))(driver.next(e)))(core.map(Either.right)(self)); | ||
}; | ||
@@ -1416,3 +1417,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self, retryUntilEffect_Effect(e => core.sync(() => f(e)))).traced(trace); | ||
return retryUntilEffect_Effect(e => core.sync(() => f(e)))(self).traced(trace); | ||
}; | ||
@@ -1425,3 +1426,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, effect.catchAll(e => (0, _Function.pipe)(f(e), core.flatMap(b => b ? core.fail(e) : (0, _Function.pipe)(core.yieldNow(), core.flatMap(() => (0, _Function.pipe)(self, retryUntilEffect_Effect(f)))))))).traced(trace); | ||
return effect.catchAll(e => core.flatMap(b => b ? core.fail(e) : core.flatMap(() => retryUntilEffect_Effect(f)(self))(core.yieldNow()))(f(e)))(self).traced(trace); | ||
}; | ||
@@ -1434,3 +1435,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, retryUntil_Effect(_ => Equal.equals(_, e))).traced(trace); | ||
return retryUntil_Effect(_ => Equal.equals(_, e))(self).traced(trace); | ||
}; | ||
@@ -1443,3 +1444,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, retryWhileEffect_Effect(e => core.sync(() => f(e)))).traced(trace); | ||
return retryWhileEffect_Effect(e => core.sync(() => f(e)))(self).traced(trace); | ||
}; | ||
@@ -1452,3 +1453,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, retryUntilEffect_Effect(e => effect.negate(f(e)))).traced(trace); | ||
return retryUntilEffect_Effect(e => effect.negate(f(e)))(self).traced(trace); | ||
}; | ||
@@ -1461,3 +1462,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, retryWhile_Effect(err => Equal.equals(e, err))).traced(trace); | ||
return retryWhile_Effect(err => Equal.equals(e, err))(self).traced(trace); | ||
}; | ||
@@ -1469,3 +1470,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, scheduleFrom_Effect(void 0, schedule)); | ||
return scheduleFrom_Effect(void 0, schedule)(self); | ||
}; | ||
@@ -1478,3 +1479,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(driver(schedule), core.flatMap(driver => scheduleFrom_EffectLoop(self, initial, driver))).traced(trace); | ||
return core.flatMap(driver => scheduleFrom_EffectLoop(self, initial, driver))(driver(schedule)).traced(trace); | ||
}; | ||
@@ -1485,4 +1486,4 @@ }; | ||
const scheduleFrom_EffectLoop = (self, initial, driver) => { | ||
return (0, _Function.pipe)(driver.next(initial), core.foldEffect(() => effect.orDie(driver.last()), () => (0, _Function.pipe)(self, core.flatMap(a => scheduleFrom_EffectLoop(self, a, driver))))); | ||
return core.foldEffect(() => effect.orDie(driver.last()), () => core.flatMap(a => scheduleFrom_EffectLoop(self, a, driver))(self))(driver.next(initial)); | ||
}; | ||
//# sourceMappingURL=schedule.js.map |
@@ -31,3 +31,3 @@ "use strict"; | ||
const fromIterable = intervals => { | ||
return Array.from(intervals).reduce((intervals, interval) => (0, _Function.pipe)(intervals, union(make(List.of(interval)))), empty); | ||
return Array.from(intervals).reduce((intervals, interval) => union(make(List.of(interval)))(intervals), empty); | ||
}; | ||
@@ -60,3 +60,3 @@ /** @internal */ | ||
if (interval.endMillis < that.head.startMillis) { | ||
acc = (0, _Function.pipe)(acc, List.prepend(interval)); | ||
acc = List.prepend(interval)(acc); | ||
interval = that.head; | ||
@@ -72,3 +72,3 @@ that = that.tail; | ||
if (interval.endMillis < self.head.startMillis) { | ||
acc = (0, _Function.pipe)(acc, List.prepend(interval)); | ||
acc = List.prepend(interval)(acc); | ||
interval = self.head; | ||
@@ -85,3 +85,3 @@ that = List.nil(); | ||
if (interval.endMillis < self.head.startMillis) { | ||
acc = (0, _Function.pipe)(acc, List.prepend(interval)); | ||
acc = List.prepend(interval)(acc); | ||
interval = self.head; | ||
@@ -94,3 +94,3 @@ self = self.tail; | ||
} else if (interval.endMillis < that.head.startMillis) { | ||
acc = (0, _Function.pipe)(acc, List.prepend(interval)); | ||
acc = List.prepend(interval)(acc); | ||
interval = that.head; | ||
@@ -106,3 +106,3 @@ that = that.tail; | ||
} | ||
return make((0, _Function.pipe)(acc, List.prepend(interval), List.reverse)); | ||
return make(List.reverse(List.prepend(interval)(acc))); | ||
}; | ||
@@ -120,5 +120,5 @@ /** @internal */ | ||
while (List.isCons(left) && List.isCons(right)) { | ||
const interval = (0, _Function.pipe)(left.head, Interval.intersect(right.head)); | ||
const intervals = Interval.isEmpty(interval) ? acc : (0, _Function.pipe)(acc, List.prepend(interval)); | ||
if ((0, _Function.pipe)(left.head, Interval.lessThan(right.head))) { | ||
const interval = Interval.intersect(right.head)(left.head); | ||
const intervals = Interval.isEmpty(interval) ? acc : List.prepend(interval)(acc); | ||
if (Interval.lessThan(right.head)(left.head)) { | ||
left = left.tail; | ||
@@ -134,3 +134,3 @@ } else { | ||
const start = self => { | ||
return (0, _Function.pipe)(self.intervals, List.head, Option.getOrElse(() => Interval.empty)).startMillis; | ||
return Option.getOrElse(() => Interval.empty)(List.head(self.intervals)).startMillis; | ||
}; | ||
@@ -140,3 +140,3 @@ /** @internal */ | ||
const end = self => { | ||
return (0, _Function.pipe)(self.intervals, List.head, Option.getOrElse(() => Interval.empty)).endMillis; | ||
return Option.getOrElse(() => Interval.empty)(List.head(self.intervals)).endMillis; | ||
}; | ||
@@ -143,0 +143,0 @@ /** @internal */ |
@@ -21,8 +21,8 @@ "use strict"; | ||
const toRun = MutableRef.get(this.tasks); | ||
(0, _Function.pipe)(this.tasks, MutableRef.set(MutableList.make())); | ||
(0, _Function.pipe)(toRun, MutableList.forEach(task => { | ||
MutableRef.set(MutableList.make())(this.tasks); | ||
MutableList.forEach(task => { | ||
task(); | ||
})); | ||
})(toRun); | ||
if (MutableList.isEmpty(MutableRef.get(this.tasks))) { | ||
(0, _Function.pipe)(this.running, MutableRef.set(false)); | ||
MutableRef.set(false)(this.running); | ||
} else { | ||
@@ -40,5 +40,5 @@ this.starve(depth); | ||
scheduleTask(task) { | ||
(0, _Function.pipe)(MutableRef.get(this.tasks), MutableList.append(task)); | ||
MutableList.append(task)(MutableRef.get(this.tasks)); | ||
if (!MutableRef.get(this.running)) { | ||
(0, _Function.pipe)(this.running, MutableRef.set(true)); | ||
MutableRef.set(true)(this.running); | ||
this.starve(); | ||
@@ -62,3 +62,3 @@ } | ||
} else { | ||
(0, _Function.pipe)(this.tasks, MutableList.append(task)); | ||
MutableList.append(task)(this.tasks); | ||
} | ||
@@ -70,3 +70,3 @@ } | ||
} | ||
(0, _Function.pipe)(this.deferred, MutableRef.set(true)); | ||
MutableRef.set(true)(this.deferred); | ||
} | ||
@@ -73,0 +73,0 @@ } |
@@ -29,3 +29,3 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(synchronized.get(self.ref), core.flatMap(tuple => tuple[0].close(core.exitUnit()))).traced(trace); | ||
return core.flatMap(tuple => tuple[0].close(core.exitUnit()))(synchronized.get(self.ref)).traced(trace); | ||
}; | ||
@@ -35,3 +35,3 @@ /** @internal */ | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return core.uninterruptibleMask(restore => (0, _Function.pipe)(fiberRuntime.scopeMake(), core.flatMap(newScope => (0, _Function.pipe)(restore((0, _Function.pipe)(acquire, core.provideSomeEnvironment(Context.add(fiberRuntime.scopeTag)(newScope)))), core.onError(cause => newScope.close(core.exitFail(cause))), core.flatMap(value => (0, _Function.pipe)(circular.makeSynchronized([newScope, value]), core.flatMap(ref => { | ||
return core.uninterruptibleMask(restore => core.flatMap(newScope => core.flatMap(value => core.flatMap(ref => { | ||
const scopedRef = { | ||
@@ -41,4 +41,4 @@ [ScopedRefTypeId]: scopedRefVariance, | ||
}; | ||
return (0, _Function.pipe)(fiberRuntime.addFinalizer(() => close(scopedRef)), core.as(scopedRef)); | ||
}))))))).traced(trace); | ||
return core.as(scopedRef)(fiberRuntime.addFinalizer(() => close(scopedRef))); | ||
})(circular.makeSynchronized([newScope, value])))(core.onError(cause => newScope.close(core.exitFail(cause)))(restore(core.provideSomeEnvironment(Context.add(fiberRuntime.scopeTag)(newScope))(acquire)))))(fiberRuntime.scopeMake())).traced(trace); | ||
}; | ||
@@ -48,3 +48,3 @@ /** @internal */ | ||
const get = self => { | ||
return (0, _Function.pipe)(synchronized.get(self.ref), core.map(tuple => tuple[1])); | ||
return core.map(tuple => tuple[1])(synchronized.get(self.ref)); | ||
}; | ||
@@ -62,3 +62,3 @@ /** @internal */ | ||
return self => { | ||
return (0, _Function.pipe)(self.ref, synchronized.modifyEffect(([oldScope, value]) => core.uninterruptibleMask(restore => (0, _Function.pipe)(fiberRuntime.scopeMake(), core.flatMap(newScope => (0, _Function.pipe)(restore((0, _Function.pipe)(acquire, core.provideSomeEnvironment(Context.add(fiberRuntime.scopeTag)(newScope)))), core.exit, core.flatMap(core.exitMatch(cause => (0, _Function.pipe)(newScope.close(core.exitUnit()), effect.ignore, core.as([core.failCause(cause), [oldScope, value]])), value => (0, _Function.pipe)(oldScope.close(core.exitUnit()), effect.ignore, core.as([core.unit(), [newScope, value]]))))))))), core.flatten).traced(trace); | ||
return core.flatten(synchronized.modifyEffect(([oldScope, value]) => core.uninterruptibleMask(restore => core.flatMap(newScope => core.flatMap(core.exitMatch(cause => core.as([core.failCause(cause), [oldScope, value]])(effect.ignore(newScope.close(core.exitUnit()))), value => core.as([core.unit(), [newScope, value]])(effect.ignore(oldScope.close(core.exitUnit())))))(core.exit(restore(core.provideSomeEnvironment(Context.add(fiberRuntime.scopeTag)(newScope))(acquire)))))(fiberRuntime.scopeMake())))(self.ref)).traced(trace); | ||
}; | ||
@@ -65,0 +65,0 @@ }; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const make = permits => { | ||
return (0, _Function.pipe)(Ref.make(() => permits), STM.map(permits => new circular.SemaphoreImpl(permits))); | ||
return STM.map(permits => new circular.SemaphoreImpl(permits))(Ref.make(() => permits)); | ||
}; | ||
@@ -24,7 +24,7 @@ exports.make = make; | ||
const acquire = self => { | ||
return (0, _Function.pipe)(self, circular.acquireN(1)); | ||
return circular.acquireN(1)(self); | ||
}; | ||
exports.acquire = acquire; | ||
const release = self => { | ||
return (0, _Function.pipe)(self, circular.releaseN(1)); | ||
return circular.releaseN(1)(self); | ||
}; | ||
@@ -34,3 +34,3 @@ exports.release = release; | ||
return self => { | ||
return (0, _Function.pipe)(self, circular.withPermits(1)(semaphore)); | ||
return circular.withPermits(1)(semaphore)(self); | ||
}; | ||
@@ -40,5 +40,5 @@ }; | ||
const withPermitScoped = self => { | ||
return (0, _Function.pipe)(self, circular.withPermitsScoped(1)); | ||
return circular.withPermitsScoped(1)(self); | ||
}; | ||
exports.withPermitScoped = withPermitScoped; | ||
//# sourceMappingURL=semaphore.js.map |
@@ -194,3 +194,3 @@ "use strict"; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => sync(() => f(a)))); | ||
return flatMap(a => sync(() => f(a)))(self); | ||
}; | ||
@@ -201,3 +201,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, map(Either.right), catchAll(e => (0, _Function.pipe)(onFailure(e), map(Either.left))), flatMap(either => { | ||
return flatMap(either => { | ||
switch (either._tag) { | ||
@@ -213,3 +213,3 @@ case "Left": | ||
} | ||
})); | ||
})(catchAll(e => map(Either.left)(onFailure(e)))(map(Either.right)(self))); | ||
}; | ||
@@ -219,3 +219,3 @@ }; | ||
const ensuring = finalizer => { | ||
return self => (0, _Function.pipe)(self, foldSTM(e => (0, _Function.pipe)(finalizer, zipRight(fail(e))), a => (0, _Function.pipe)(finalizer, zipRight(succeed(a))))); | ||
return self => foldSTM(e => zipRight(fail(e))(finalizer), a => zipRight(succeed(a))(finalizer))(self); | ||
}; | ||
@@ -225,3 +225,3 @@ exports.ensuring = ensuring; | ||
return self => { | ||
return (0, _Function.pipe)(self, zipWith(that, (a, a1) => [a, a1])); | ||
return zipWith(that, (a, a1) => [a, a1])(self); | ||
}; | ||
@@ -232,3 +232,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, map(() => a)))); | ||
return flatMap(a => map(() => a)(that))(self); | ||
}; | ||
@@ -239,3 +239,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(() => that)); | ||
return flatMap(() => that)(self); | ||
}; | ||
@@ -246,3 +246,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, flatMap(a => (0, _Function.pipe)(that, map(b => f(a, b))))); | ||
return flatMap(a => map(b => f(a, b))(that))(self); | ||
}; | ||
@@ -267,10 +267,10 @@ }; | ||
const io = core.async(tryCommitAsync(commitResult.journal, fiberId, self, txnId, state, env, scheduler)); | ||
return core.uninterruptibleMask(restore => (0, _Function.pipe)(restore(io), core.catchAllCause(cause => { | ||
return core.uninterruptibleMask(restore => core.catchAllCause(cause => { | ||
let currentState = MutableRef.get(state); | ||
if (Equal.equals(currentState, STMState.running)) { | ||
(0, _Function.pipe)(state, MutableRef.set(STMState.interrupted)); | ||
MutableRef.set(STMState.interrupted)(state); | ||
} | ||
currentState = MutableRef.get(state); | ||
return currentState.op === STMState.OP_DONE ? core.done(currentState.exit) : core.failCause(cause); | ||
}))); | ||
})(restore(io))); | ||
} | ||
@@ -385,5 +385,5 @@ } | ||
this.envStack = new _stack.Stack(current.provide(this.envStack.value), this.envStack); | ||
curr = (0, _Function.pipe)(current.stm, ensuring(sync(() => { | ||
curr = ensuring(sync(() => { | ||
this.envStack = this.envStack.previous; | ||
}))); | ||
}))(current.stm); | ||
break; | ||
@@ -436,3 +436,3 @@ } | ||
if (analysis === Journal.JournalAnalysisReadWrite) { | ||
(0, _Function.pipe)(state, MutableRef.set(STMState.fromTExit(tExit))); | ||
MutableRef.set(STMState.fromTExit(tExit))(state); | ||
Journal.commitJournal(journal); | ||
@@ -439,0 +439,0 @@ } else if (analysis === Journal.JournalAnalysisInvalid) { |
@@ -72,3 +72,3 @@ "use strict"; | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(TExitSymbolKey), Equal.hashCombine(Equal.hash(OP_FAIL)), Equal.hashCombine(Equal.hash(error))); | ||
return Equal.hashCombine(Equal.hash(error))(Equal.hashCombine(Equal.hash(OP_FAIL))(Equal.hash(TExitSymbolKey))); | ||
}, | ||
@@ -86,3 +86,3 @@ [Equal.symbolEqual](that) { | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(TExitSymbolKey), Equal.hashCombine(Equal.hash(OP_DIE)), Equal.hashCombine(Equal.hash(defect))); | ||
return Equal.hashCombine(Equal.hash(defect))(Equal.hashCombine(Equal.hash(OP_DIE))(Equal.hash(TExitSymbolKey))); | ||
}, | ||
@@ -100,3 +100,3 @@ [Equal.symbolEqual](that) { | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(TExitSymbolKey), Equal.hashCombine(Equal.hash(OP_INTERRUPT)), Equal.hashCombine(Equal.hash(fiberId))); | ||
return Equal.hashCombine(Equal.hash(fiberId))(Equal.hashCombine(Equal.hash(OP_INTERRUPT))(Equal.hash(TExitSymbolKey))); | ||
}, | ||
@@ -114,3 +114,3 @@ [Equal.symbolEqual](that) { | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(TExitSymbolKey), Equal.hashCombine(Equal.hash(OP_SUCCEED)), Equal.hashCombine(Equal.hash(value))); | ||
return Equal.hashCombine(Equal.hash(value))(Equal.hashCombine(Equal.hash(OP_SUCCEED))(Equal.hash(TExitSymbolKey))); | ||
}, | ||
@@ -131,3 +131,3 @@ [Equal.symbolEqual](that) { | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(TExitSymbolKey), Equal.hashCombine(Equal.hash(OP_RETRY)), Equal.hashCombine(Equal.hash(retryHash))); | ||
return Equal.hashCombine(Equal.hash(retryHash))(Equal.hashCombine(Equal.hash(OP_RETRY))(Equal.hash(TExitSymbolKey))); | ||
}, | ||
@@ -134,0 +134,0 @@ [Equal.symbolEqual](that) { |
@@ -54,3 +54,3 @@ "use strict"; | ||
exports.getAndUpdate = getAndUpdate; | ||
const getAndUpdateSome = f => self => self.modify(a => (0, _Function.pipe)(f(a), Option.match(() => [a, a], b => [a, b]))); | ||
const getAndUpdateSome = f => self => self.modify(a => Option.match(() => [a, a], b => [a, b])(f(a))); | ||
exports.getAndUpdateSome = getAndUpdateSome; | ||
@@ -61,3 +61,3 @@ const setAndGet = value => self => self.modify(() => [value, value]); | ||
exports.modify = modify; | ||
const modifySome = (fallback, f) => self => self.modify(a => (0, _Function.pipe)(f(a), Option.match(() => [fallback, a], b => b))); | ||
const modifySome = (fallback, f) => self => self.modify(a => Option.match(() => [fallback, a], b => b)(f(a))); | ||
exports.modifySome = modifySome; | ||
@@ -71,5 +71,5 @@ const update = f => self => self.modify(a => [void 0, f(a)]); | ||
exports.updateAndGet = updateAndGet; | ||
const updateSome = f => self => self.modify(a => [void 0, (0, _Function.pipe)(f(a), Option.match(() => a, b => b))]); | ||
const updateSome = f => self => self.modify(a => [void 0, Option.match(() => a, b => b)(f(a))]); | ||
exports.updateSome = updateSome; | ||
const updateSomeAndGet = f => self => self.modify(a => (0, _Function.pipe)(f(a), Option.match(() => [a, a], b => [b, b]))); | ||
const updateSomeAndGet = f => self => self.modify(a => Option.match(() => [a, a], b => [b, b])(f(a))); | ||
exports.updateSomeAndGet = updateSomeAndGet; | ||
@@ -76,0 +76,0 @@ const getOrMakeEntry = (self, journal) => { |
@@ -44,3 +44,3 @@ "use strict"; | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(STMStateSymbolKey), Equal.hashCombine(Equal.hash(OP_DONE)), Equal.hashCombine(Equal.hash(exit))); | ||
return Equal.hashCombine(Equal.hash(exit))(Equal.hashCombine(Equal.hash(OP_DONE))(Equal.hash(STMStateSymbolKey))); | ||
}, | ||
@@ -62,3 +62,3 @@ [Equal.symbolEqual](that) { | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(STMStateSymbolKey), Equal.hashCombine(Equal.hash(OP_INTERRUPTED)), Equal.hashCombine(Equal.hash(interruptedHash))); | ||
return Equal.hashCombine(Equal.hash(interruptedHash))(Equal.hashCombine(Equal.hash(OP_INTERRUPTED))(Equal.hash(STMStateSymbolKey))); | ||
}, | ||
@@ -79,3 +79,3 @@ [Equal.symbolEqual](that) { | ||
[Equal.symbolHash]() { | ||
return (0, _Function.pipe)(Equal.hash(STMStateSymbolKey), Equal.hashCombine(Equal.hash(OP_RUNNING)), Equal.hashCombine(Equal.hash(runningHash))); | ||
return Equal.hashCombine(Equal.hash(runningHash))(Equal.hashCombine(Equal.hash(OP_RUNNING))(Equal.hash(STMStateSymbolKey))); | ||
}, | ||
@@ -82,0 +82,0 @@ [Equal.symbolEqual](that) { |
@@ -16,3 +16,3 @@ "use strict"; | ||
const newId = MutableRef.get(txnCounter) + 1; | ||
(0, _Function.pipe)(txnCounter, MutableRef.set(newId)); | ||
MutableRef.set(newId)(txnCounter); | ||
return newId; | ||
@@ -19,0 +19,0 @@ }; |
@@ -52,3 +52,3 @@ "use strict"; | ||
map(f) { | ||
return new ProxySupervisor(this, () => (0, _Function.pipe)(this.value(), core.map(f))); | ||
return new ProxySupervisor(this, () => core.map(f)(this.value())); | ||
} | ||
@@ -70,3 +70,3 @@ zip(right) { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.left.value(), core.zip(this.right.value())).traced(trace); | ||
return core.zip(this.right.value())(this.left.value()).traced(trace); | ||
} | ||
@@ -94,3 +94,3 @@ onStart(context, effect, parent, fiber) { | ||
map(f) { | ||
return new ProxySupervisor(this, () => (0, _Function.pipe)(this.value(), core.map(f))); | ||
return new ProxySupervisor(this, () => core.map(f)(this.value())); | ||
} | ||
@@ -127,3 +127,3 @@ zip(right) { | ||
map(f) { | ||
return new ProxySupervisor(this, () => (0, _Function.pipe)(this.value(), core.map(f))); | ||
return new ProxySupervisor(this, () => core.map(f)(this.value())); | ||
} | ||
@@ -161,3 +161,3 @@ zip(right) { | ||
map(f) { | ||
return new ProxySupervisor(this, () => (0, _Function.pipe)(this.value(), core.map(f))); | ||
return new ProxySupervisor(this, () => core.map(f)(this.value())); | ||
} | ||
@@ -180,6 +180,6 @@ zip(right) { | ||
onStart(_context, _effect, _parent, fiber) { | ||
(0, _Function.pipe)(this.ref, MutableRef.set((0, _Function.pipe)(MutableRef.get(this.ref), SortedSet.add(fiber)))); | ||
MutableRef.set(SortedSet.add(fiber)(MutableRef.get(this.ref)))(this.ref); | ||
} | ||
onEnd(_value, fiber) { | ||
(0, _Function.pipe)(this.ref, MutableRef.set((0, _Function.pipe)(MutableRef.get(this.ref), SortedSet.remove(fiber)))); | ||
MutableRef.set(SortedSet.remove(fiber)(MutableRef.get(this.ref)))(this.ref); | ||
} | ||
@@ -196,3 +196,3 @@ onEffect(_fiber, _effect) { | ||
map(f) { | ||
return new ProxySupervisor(this, () => (0, _Function.pipe)(this.value(), core.map(f))); | ||
return new ProxySupervisor(this, () => core.map(f)(this.value())); | ||
} | ||
@@ -199,0 +199,0 @@ zip(right) { |
@@ -110,3 +110,3 @@ "use strict"; | ||
if (self instanceof _supervisor2.Zip) { | ||
return (0, _Function.pipe)(toSet(self.left), HashSet.union(toSet(self.right))); | ||
return HashSet.union(toSet(self.right))(toSet(self.left)); | ||
} else { | ||
@@ -124,10 +124,10 @@ return HashSet.make(self); | ||
const newSupervisors = toSet(newValue); | ||
const added = (0, _Function.pipe)(newSupervisors, HashSet.difference(oldSupervisors), HashSet.reduce(empty, (patch, supervisor) => combine(patch, { | ||
const added = HashSet.reduce(empty, (patch, supervisor) => combine(patch, { | ||
op: OP_ADD_SUPERVISOR, | ||
supervisor | ||
}))); | ||
const removed = (0, _Function.pipe)(oldSupervisors, HashSet.difference(newSupervisors), HashSet.reduce(empty, (patch, supervisor) => combine(patch, { | ||
}))(HashSet.difference(oldSupervisors)(newSupervisors)); | ||
const removed = HashSet.reduce(empty, (patch, supervisor) => combine(patch, { | ||
op: OP_REMOVE_SUPERVISOR, | ||
supervisor | ||
}))); | ||
}))(HashSet.difference(newSupervisors)(oldSupervisors)); | ||
return combine(added, removed); | ||
@@ -134,0 +134,0 @@ }; |
@@ -30,3 +30,3 @@ "use strict"; | ||
return self => { | ||
return self.modifyEffect(value => (0, _Function.pipe)(f(value), core.map(result => [value, result]))).traced(trace); | ||
return self.modifyEffect(value => core.map(result => [value, result])(f(value))).traced(trace); | ||
}; | ||
@@ -51,3 +51,3 @@ }; | ||
{ | ||
return (0, _Function.pipe)(result.value, core.map(newValue => [value, newValue])); | ||
return core.map(newValue => [value, newValue])(result.value); | ||
} | ||
@@ -80,3 +80,3 @@ } | ||
return self => { | ||
return self.modifyEffect(value => (0, _Function.pipe)(pf(value), Option.getOrElse(() => core.succeed([fallback, value])))).traced(trace); | ||
return self.modifyEffect(value => Option.getOrElse(() => core.succeed([fallback, value]))(pf(value))).traced(trace); | ||
}; | ||
@@ -92,3 +92,3 @@ }; | ||
return self => { | ||
return self.modifyEffect(value => (0, _Function.pipe)(f(value), core.map(result => [undefined, result]))).traced(trace); | ||
return self.modifyEffect(value => core.map(result => [undefined, result])(f(value))).traced(trace); | ||
}; | ||
@@ -101,3 +101,3 @@ }; | ||
return self => { | ||
return self.modifyEffect(value => (0, _Function.pipe)(f(value), core.map(result => [result, result]))).traced(trace); | ||
return self.modifyEffect(value => core.map(result => [result, result])(f(value))).traced(trace); | ||
}; | ||
@@ -122,3 +122,3 @@ }; | ||
{ | ||
return (0, _Function.pipe)(result.value, core.map(a => [undefined, a])); | ||
return core.map(a => [undefined, a])(result.value); | ||
} | ||
@@ -125,0 +125,0 @@ } |
@@ -33,11 +33,11 @@ "use strict"; | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.getFiberRef(this.fiberRef), core.map(TestAnnotationMap.get(key))).traced(trace); | ||
return core.map(TestAnnotationMap.get(key))(core.fiberRefGet(this.fiberRef)).traced(trace); | ||
} | ||
annotate(key, value) { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.fiberRef, core.updateFiberRef(TestAnnotationMap.annotate(key, value))).traced(trace); | ||
return core.fiberRefUpdate(TestAnnotationMap.annotate(key, value))(this.fiberRef).traced(trace); | ||
} | ||
supervisedFibers() { | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return effect.descriptorWith(descriptor => (0, _Function.pipe)(core.getFiberRef(this.fiberRef), core.map(TestAnnotationMap.get(TestAnnotation.fibers)), core.flatMap(either => { | ||
return effect.descriptorWith(descriptor => core.flatMap(either => { | ||
switch (either._tag) { | ||
@@ -50,6 +50,6 @@ case "Left": | ||
{ | ||
return (0, _Function.pipe)(either.right, core.forEach(ref => core.sync(() => MutableRef.get(ref))), core.map(Chunk.reduce(SortedSet.empty(fiber.Order), (a, b) => (0, _Function.pipe)(a, SortedSet.union(b)))), core.map(SortedSet.filter(fiber => !Equal.equals(fiber.id(), descriptor.id)))); | ||
return core.map(SortedSet.filter(fiber => !Equal.equals(fiber.id(), descriptor.id)))(core.map(Chunk.reduce(SortedSet.empty(fiber.Order), (a, b) => SortedSet.union(b)(a)))(core.forEach(ref => core.sync(() => MutableRef.get(ref)))(either.right))); | ||
} | ||
} | ||
}))).traced(trace); | ||
})(core.map(TestAnnotationMap.get(TestAnnotation.fibers))(core.fiberRefGet(this.fiberRef)))).traced(trace); | ||
} | ||
@@ -103,4 +103,4 @@ } | ||
exports.supervisedFibers = supervisedFibers; | ||
const live = /*#__PURE__*/layer.scoped(Tag)( /*#__PURE__*/(0, _Function.pipe)( /*#__PURE__*/fiberRuntime.makeFiberRef(TestAnnotationMap.empty), /*#__PURE__*/core.map(fiberRef => new AnnotationsImpl(fiberRef)))); | ||
const live = /*#__PURE__*/layer.scoped(Tag)( /*#__PURE__*/core.map(fiberRef => new AnnotationsImpl(fiberRef))( /*#__PURE__*/fiberRuntime.fiberRefMake(TestAnnotationMap.empty))); | ||
exports.live = live; | ||
//# sourceMappingURL=annotations.js.map |
@@ -25,3 +25,3 @@ "use strict"; | ||
const defaultLive = /*#__PURE__*/layer.fromEffect(Tag)( /*#__PURE__*/effect.environmentWith(env => ({ | ||
provide: effect => (0, _Function.pipe)(effect, (0, _Function.pipe)(defaultServices.currentServices, core.locallyWithFiberRef(Context.merge(env)))) | ||
provide: effect => core.fiberRefLocallyWith(Context.merge(env))(defaultServices.currentServices)(effect) | ||
}))); | ||
@@ -48,3 +48,3 @@ /** | ||
return effect => { | ||
return (0, _Function.pipe)(defaultServices.currentServices, core.getWithFiberRef(services => live(f((0, _Function.pipe)(effect, (0, _Function.pipe)(defaultServices.currentServices, core.locallyFiberRef(services))))))).traced(trace); | ||
return core.fiberRefGetWith(services => live(f(core.fiberRefLocally(services)(defaultServices.currentServices)(effect))))(defaultServices.currentServices).traced(trace); | ||
}; | ||
@@ -51,0 +51,0 @@ }; |
@@ -28,3 +28,3 @@ "use strict"; | ||
[(_a = TestAnnotationTypeId, Equal.symbolHash)]() { | ||
return (0, _Function.pipe)(Equal.hash(TestAnnotationSymbolKey), Equal.hashCombine(Equal.hash(this.identifier)), Equal.hashCombine(Equal.hash(this.tag))); | ||
return Equal.hashCombine(Equal.hash(this.tag))(Equal.hashCombine(Equal.hash(this.identifier))(Equal.hash(TestAnnotationSymbolKey))); | ||
} | ||
@@ -48,3 +48,3 @@ [Equal.symbolEqual](that) { | ||
if (Either.isRight(left) && Either.isRight(right)) { | ||
return Either.right((0, _Function.pipe)(left.right, Chunk.concat(right.right))); | ||
return Either.right(Chunk.concat(right.right)(left.right)); | ||
} | ||
@@ -80,4 +80,4 @@ if (Either.isRight(left) && Either.isLeft(right)) { | ||
exports.retried = retried; | ||
const tagged = /*#__PURE__*/make("tagged", /*#__PURE__*/Context.Tag(), /*#__PURE__*/HashSet.empty(), (a, b) => (0, _Function.pipe)(a, HashSet.union(b))); | ||
const tagged = /*#__PURE__*/make("tagged", /*#__PURE__*/Context.Tag(), /*#__PURE__*/HashSet.empty(), (a, b) => HashSet.union(b)(a)); | ||
exports.tagged = tagged; | ||
//# sourceMappingURL=testAnnotation.js.map |
@@ -43,3 +43,3 @@ "use strict"; | ||
} | ||
return (0, _Function.pipe)(self, overwrite(key, f(value))); | ||
return overwrite(key, f(value))(self); | ||
}; | ||
@@ -67,3 +67,3 @@ }; | ||
return self => { | ||
return (0, _Function.pipe)(self, update(key, _ => key.combine(_, value))); | ||
return update(key, _ => key.combine(_, value))(self); | ||
}; | ||
@@ -74,3 +74,3 @@ }; | ||
return self => { | ||
const map = (0, _Function.pipe)(Chunk.fromIterable(self.map), Chunk.concat(Chunk.fromIterable(that.map)), Chunk.reduce(new Map(), (acc, [key, oldValue]) => { | ||
const map = Chunk.reduce(new Map(), (acc, [key, oldValue]) => { | ||
let newValue = acc.get(key); | ||
@@ -82,3 +82,3 @@ if (newValue === undefined) { | ||
return acc.set(key, newValue); | ||
})); | ||
})(Chunk.concat(Chunk.fromIterable(that.map))(Chunk.fromIterable(self.map))); | ||
return make(map); | ||
@@ -85,0 +85,0 @@ }; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var _Debug = /*#__PURE__*/require("@effect/io/Debug"); | ||
var FiberStatus = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Fiber/Status")); | ||
var clock = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/clock")); | ||
@@ -64,3 +65,3 @@ var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core")); | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(ref.get(this.clockState), core.map(data => data.instant)).traced(trace); | ||
return core.map(data => data.instant)(ref.get(this.clockState)).traced(trace); | ||
} | ||
@@ -75,3 +76,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(ref.get(this.clockState), core.map(data => (0, _Function.pipe)(this.clockState, ref.set(data)))).traced(trace); | ||
return core.map(data => ref.set(data)(this.clockState))(ref.get(this.clockState)).traced(trace); | ||
} | ||
@@ -86,3 +87,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.warningDone(), core.zipRight(this.run(() => instant))).traced(trace); | ||
return core.zipRight(this.run(() => instant))(this.warningDone()).traced(trace); | ||
} | ||
@@ -98,9 +99,9 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(core.makeDeferred(), core.flatMap(deferred => (0, _Function.pipe)(this.clockState, ref.modify(data => { | ||
return core.flatMap(deferred => core.flatMap(shouldAwait => shouldAwait ? core.zipRight(core.deferredAwait(deferred))(this.warningStart()) : core.asUnit(core.deferredSucceed(void 0)(deferred)))(ref.modify(data => { | ||
const end = data.instant + duration.millis; | ||
if (end > data.instant) { | ||
return [true, Data.make(data.instant, (0, _Function.pipe)(data.sleeps, List.prepend([end, deferred])))]; | ||
return [true, Data.make(data.instant, List.prepend([end, deferred])(data.sleeps))]; | ||
} | ||
return [false, data]; | ||
}), core.flatMap(shouldAwait => shouldAwait ? (0, _Function.pipe)(this.warningStart(), core.zipRight(core.awaitDeferred(deferred))) : (0, _Function.pipe)(deferred, core.succeedDeferred(void 0), core.asUnit))))).traced(trace); | ||
})(this.clockState)))(core.deferredMake()).traced(trace); | ||
} | ||
@@ -115,3 +116,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(ref.get(this.clockState), core.map(data => (0, _Function.pipe)(data.sleeps, List.map(_ => _[0])))).traced(trace); | ||
return core.map(data => List.map(_ => _[0])(data.sleeps))(ref.get(this.clockState)).traced(trace); | ||
} | ||
@@ -127,3 +128,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.warningDone(), core.zipRight(this.run(n => n + duration.millis))).traced(trace); | ||
return core.zipRight(this.run(n => n + duration.millis))(this.warningDone()).traced(trace); | ||
} | ||
@@ -140,3 +141,3 @@ /** | ||
return effect => { | ||
return (0, _Function.pipe)(effect, circular.zipParLeft(this.adjust(duration))).traced(trace); | ||
return circular.zipParLeft(this.adjust(duration))(effect).traced(trace); | ||
}; | ||
@@ -164,18 +165,11 @@ } | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.supervisedFibers(), core.flatMap(fibers => (0, _Function.pipe)(fibers, effect.reduce(HashMap.empty(), (map, fiber) => (0, _Function.pipe)(fiber.status(), core.flatMap(status => { | ||
switch (status._tag) { | ||
case "Done": | ||
{ | ||
return core.succeed((0, _Function.pipe)(map, HashMap.set(fiber.id(), status))); | ||
} | ||
case "Suspended": | ||
{ | ||
return core.succeed((0, _Function.pipe)(map, HashMap.set(fiber.id(), status))); | ||
} | ||
default: | ||
{ | ||
return core.fail(void 0); | ||
} | ||
return core.flatMap(fibers => effect.reduce(HashMap.empty(), (map, fiber) => core.flatMap(status => { | ||
if (FiberStatus.isDone(status)) { | ||
return core.succeed(HashMap.set(fiber.id(), status)(map)); | ||
} | ||
})))))).traced(trace); | ||
if (FiberStatus.isSuspended(status)) { | ||
return core.succeed(HashMap.set(fiber.id(), status)(map)); | ||
} | ||
return core.fail(void 0); | ||
})(fiber.status()))(fibers))(this.supervisedFibers()).traced(trace); | ||
} | ||
@@ -190,3 +184,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.warningState, synchronized.updateSomeEffect(data => WarningData.isStart(data) ? Option.some((0, _Function.pipe)(this.live.provide((0, _Function.pipe)(effect.logWarning(warning), effect.delay(Duration.seconds(5)))), core.interruptible, fiberRuntime.fork, core.map(fiber => WarningData.pending(fiber)))) : Option.none)).traced(trace); | ||
return synchronized.updateSomeEffect(data => WarningData.isStart(data) ? Option.some(core.map(fiber => WarningData.pending(fiber))(fiberRuntime.fork(core.interruptible(this.live.provide(effect.delay(Duration.seconds(5))(effect.logWarning(warning))))))) : Option.none)(this.warningState).traced(trace); | ||
} | ||
@@ -201,3 +195,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.warningState, synchronized.updateSomeEffect(warningData => { | ||
return synchronized.updateSomeEffect(warningData => { | ||
if (WarningData.isStart(warningData)) { | ||
@@ -207,6 +201,6 @@ return Option.some(core.succeed(WarningData.done)); | ||
if (WarningData.isPending(warningData)) { | ||
return Option.some((0, _Function.pipe)(core.interruptFiber(warningData.fiber), core.as(WarningData.done))); | ||
return Option.some(core.as(WarningData.done)(core.interruptFiber(warningData.fiber))); | ||
} | ||
return Option.none; | ||
})).traced(trace); | ||
})(this.warningState).traced(trace); | ||
} | ||
@@ -220,3 +214,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.freeze(), core.zip(this.live.provide((0, _Function.pipe)(effect.sleep(Duration.millis(5)), core.zipRight(this.freeze())))), core.flatMap(([first, last]) => Equal.equals(first, last) ? core.succeed(first) : core.fail(void 0))).traced(trace); | ||
return core.flatMap(([first, last]) => Equal.equals(first, last) ? core.succeed(first) : core.fail(void 0))(core.zip(this.live.provide(core.zipRight(this.freeze())(effect.sleep(Duration.millis(5)))))(this.freeze())).traced(trace); | ||
} | ||
@@ -230,3 +224,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.suspendedWarningStart(), core.zipRight((0, _Function.pipe)(this.suspended(), core.zipWith((0, _Function.pipe)(this.live.provide(effect.sleep(Duration.millis(10))), core.zipRight(this.suspended())), Equal.equals), effect.filterOrFail(_Function.identity, _Function.constVoid), effect.eventually)), core.zipRight(this.suspendedWarningDone())).traced(trace); | ||
return core.zipRight(this.suspendedWarningDone())(core.zipRight(effect.eventually(effect.filterOrFail(_Function.identity, _Function.constVoid)(core.zipWith(core.zipRight(this.suspended())(this.live.provide(effect.sleep(Duration.millis(10)))), Equal.equals)(this.suspended()))))(this.suspendedWarningStart())).traced(trace); | ||
} | ||
@@ -241,8 +235,8 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.suspendedWarningState, synchronized.updateSomeEffect(suspendedWarningData => { | ||
return synchronized.updateSomeEffect(suspendedWarningData => { | ||
if (SuspendedWarningData.isStart(suspendedWarningData)) { | ||
return Option.some((0, _Function.pipe)(this.live.provide((0, _Function.pipe)(effect.logWarning(suspendedWarning), core.zipRight((0, _Function.pipe)(this.suspendedWarningState, synchronized.set(SuspendedWarningData.done))), effect.delay(Duration.seconds(5)))), core.interruptible, fiberRuntime.fork, core.map(fiber => SuspendedWarningData.pending(fiber)))); | ||
return Option.some(core.map(fiber => SuspendedWarningData.pending(fiber))(fiberRuntime.fork(core.interruptible(this.live.provide(effect.delay(Duration.seconds(5))(core.zipRight(synchronized.set(SuspendedWarningData.done)(this.suspendedWarningState))(effect.logWarning(suspendedWarning)))))))); | ||
} | ||
return Option.none; | ||
})).traced(trace); | ||
})(this.suspendedWarningState).traced(trace); | ||
} | ||
@@ -257,8 +251,8 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.suspendedWarningState, synchronized.updateSomeEffect(suspendedWarningData => { | ||
return synchronized.updateSomeEffect(suspendedWarningData => { | ||
if (SuspendedWarningData.isPending(suspendedWarningData)) { | ||
return Option.some((0, _Function.pipe)(core.interruptFiber(suspendedWarningData.fiber), core.as(SuspendedWarningData.start))); | ||
return Option.some(core.as(SuspendedWarningData.start)(core.interruptFiber(suspendedWarningData.fiber))); | ||
} | ||
return Option.none; | ||
})).traced(trace); | ||
})(this.suspendedWarningState).traced(trace); | ||
} | ||
@@ -273,13 +267,3 @@ /** | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(this.awaitSuspended(), core.zipRight((0, _Function.pipe)(this.clockState, ref.modify(data => { | ||
const end = f(data.instant); | ||
const sorted = (0, _Function.pipe)(data.sleeps, List.sort((0, _Function.pipe)(number.Order, Order.contramap(_ => _[0])))); | ||
if (List.isCons(sorted)) { | ||
const [instant, deferred] = sorted.head; | ||
if (instant <= end) { | ||
return [Option.some([end, deferred]), Data.make(instant, sorted.tail)]; | ||
} | ||
} | ||
return [Option.none, Data.make(end, data.sleeps)]; | ||
}), core.flatMap(option => { | ||
return core.zipRight(core.flatMap(option => { | ||
switch (option._tag) { | ||
@@ -293,6 +277,16 @@ case "None": | ||
const [end, deferred] = option.value; | ||
return (0, _Function.pipe)(deferred, core.succeedDeferred(void 0), core.zipRight(core.yieldNow()), core.zipRight(this.run(() => end))); | ||
return core.zipRight(this.run(() => end))(core.zipRight(core.yieldNow())(core.deferredSucceed(void 0)(deferred))); | ||
} | ||
} | ||
})))).traced(trace); | ||
})(ref.modify(data => { | ||
const end = f(data.instant); | ||
const sorted = List.sort(Order.contramap(_ => _[0])(number.Order))(data.sleeps); | ||
if (List.isCons(sorted)) { | ||
const [instant, deferred] = sorted.head; | ||
if (instant <= end) { | ||
return [Option.some([end, deferred]), Data.make(instant, sorted.tail)]; | ||
} | ||
} | ||
return [Option.none, Data.make(end, data.sleeps)]; | ||
})(this.clockState)))(this.awaitSuspended()).traced(trace); | ||
} | ||
@@ -311,3 +305,3 @@ } | ||
yield* fiberRuntime.withClockScoped(testClock); | ||
yield* fiberRuntime.addFinalizer(() => (0, _Function.pipe)(testClock.warningDone(), core.zipRight(testClock.suspendedWarningDone()))); | ||
yield* fiberRuntime.addFinalizer(() => core.zipRight(testClock.suspendedWarningDone())(testClock.warningDone())); | ||
return testClock; | ||
@@ -417,5 +411,5 @@ })); | ||
const trace = (0, _Debug.getCallTrace)(); | ||
return (0, _Function.pipe)(defaultServices.currentServices, core.getWithFiberRef(services => f((0, _Function.pipe)(services, Context.get(clock.clockTag))))).traced(trace); | ||
return core.fiberRefGetWith(services => f(Context.get(clock.clockTag)(services)))(defaultServices.currentServices).traced(trace); | ||
}; | ||
exports.testClockWith = testClockWith; | ||
//# sourceMappingURL=testClock.js.map |
@@ -16,6 +16,6 @@ "use strict"; | ||
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; } | ||
const live = /*#__PURE__*/(0, _Function.pipe)(Annotations.live, /*#__PURE__*/layer.merge(Live.defaultLive), /*#__PURE__*/layer.merge( /*#__PURE__*/(0, _Function.pipe)(Live.defaultLive, /*#__PURE__*/layer.merge(Annotations.live), /*#__PURE__*/layer.provideToAndMerge(TestClock.defaultTestClock))), /*#__PURE__*/layer.merge(TestConfig.defaultTestConfig)); | ||
const live = /*#__PURE__*/layer.merge(TestConfig.defaultTestConfig)( /*#__PURE__*/layer.merge(layer.provideToAndMerge(TestClock.defaultTestClock)(layer.merge(Annotations.live)(Live.defaultLive)))( /*#__PURE__*/layer.merge(Live.defaultLive)(Annotations.live))); | ||
exports.live = live; | ||
const TestEnvironment = /*#__PURE__*/(0, _Function.pipe)( /*#__PURE__*/layer.syncEnvironment(() => defaultServices.liveServices), /*#__PURE__*/layer.provideToAndMerge(live)); | ||
const TestEnvironment = /*#__PURE__*/layer.provideToAndMerge(live)( /*#__PURE__*/layer.syncEnvironment(() => defaultServices.liveServices)); | ||
exports.TestEnvironment = TestEnvironment; | ||
//# sourceMappingURL=testEnvironment.js.map |
@@ -108,3 +108,3 @@ "use strict"; | ||
exports.None = None; | ||
const locally = self => core.locallyFiberRef(self)(core.currentLogLevel); | ||
const locally = self => core.fiberRefLocally(self)(core.currentLogLevel); | ||
/** | ||
@@ -115,3 +115,3 @@ * @since 1.0.0 | ||
exports.locally = locally; | ||
const Order = /*#__PURE__*/(0, _Function.pipe)(number.Order, /*#__PURE__*/order.contramap(level => level.ordinal)); | ||
const Order = /*#__PURE__*/order.contramap(level => level.ordinal)(number.Order); | ||
/** | ||
@@ -118,0 +118,0 @@ * @since 1.0.0 |
{ | ||
"name": "@effect/io", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -66,2 +66,3 @@ /** | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -75,2 +76,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -84,2 +86,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @category destructors | ||
@@ -95,2 +98,3 @@ * @since 1.0.0 | ||
* | ||
* @macro traced | ||
* @category mutations | ||
@@ -104,3 +108,4 @@ * @since 1.0.0 | ||
* | ||
* @category forking | ||
* @macro traced | ||
* @category mutations | ||
* @since 1.0.0 | ||
@@ -115,2 +120,3 @@ */ | ||
* | ||
* @macro traced | ||
* @category destructors | ||
@@ -125,2 +131,3 @@ * @since 1.0.0 | ||
* | ||
* @macro traced | ||
* @category constructors | ||
@@ -127,0 +134,0 @@ * @since 1.0.0 |
13
Scope.js
@@ -13,6 +13,2 @@ "use strict"; | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* @since 1.0.0 | ||
* @category symbols | ||
@@ -37,2 +33,3 @@ */ | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -47,2 +44,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @since 1.0.0 | ||
@@ -57,2 +55,3 @@ * @category mutations | ||
* | ||
* @macro traced | ||
* @category destructors | ||
@@ -69,2 +68,3 @@ * @since 1.0.0 | ||
* | ||
* @macro traced | ||
* @category mutations | ||
@@ -79,3 +79,4 @@ * @since 1.0.0 | ||
* | ||
* @category forking | ||
* @macro traced | ||
* @category mutations | ||
* @since 1.0.0 | ||
@@ -91,2 +92,3 @@ */ | ||
* | ||
* @macro traced | ||
* @category destructors | ||
@@ -102,2 +104,3 @@ * @since 1.0.0 | ||
* | ||
* @macro traced | ||
* @category constructors | ||
@@ -104,0 +107,0 @@ * @since 1.0.0 |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import type { Effect } from "@effect/io/Effect"; | ||
import type { Option } from "@fp-ts/data/Option"; | ||
/** | ||
* @category symbols | ||
* @since 1.0.0 | ||
* @category symbols | ||
*/ | ||
export declare const SpanTypeId: unique symbol; | ||
export declare const TracerTypeId: unique symbol; | ||
/** | ||
* @category symbols | ||
* @since 1.0.0 | ||
* @category symbols | ||
*/ | ||
export type SpanTypeId = typeof SpanTypeId; | ||
export type TracerTypeId = typeof TracerTypeId; | ||
/** | ||
* The Tracer service is used to provide tracing facilities to Effect. | ||
* | ||
* This service is meant to be implemented by exporters such as opentelemetry. | ||
* | ||
* @category models | ||
* @since 1.0.0 | ||
* @category models | ||
*/ | ||
export interface Span { | ||
readonly [SpanTypeId]: SpanTypeId; | ||
readonly parent: Option<Span>; | ||
readonly name: string; | ||
readonly trace?: string; | ||
export interface Tracer { | ||
readonly _id: TracerTypeId; | ||
readonly withSpan: (spanName: string, trace?: string) => <R, E, A>(self: Effect<R, E, A>) => Effect<R, E, A>; | ||
} | ||
/** | ||
* Returns `true` if the specified value is a `Span`, `false` otherwise. | ||
* | ||
* @category constructors | ||
* @since 1.0.0 | ||
* @category refinements | ||
*/ | ||
export declare const isSpan: (u: unknown) => u is Span; | ||
export declare const make: (withSpan: (spanName: string, trace?: string) => <R, E, A>(self: Effect<R, E, A>) => Effect<R, E, A>) => Tracer; | ||
/** | ||
* @category fiberRefs | ||
* @since 1.0.0 | ||
*/ | ||
export declare const currentTracer: import("./FiberRef").FiberRef<Option<Tracer>>; | ||
//# sourceMappingURL=Tracer.d.ts.map |
@@ -6,19 +6,28 @@ "use strict"; | ||
}); | ||
exports.isSpan = exports.SpanTypeId = void 0; | ||
exports.make = exports.currentTracer = exports.TracerTypeId = void 0; | ||
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal/core")); | ||
var _Option = /*#__PURE__*/require("@fp-ts/data/Option"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
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; } | ||
/** | ||
* @category symbols | ||
* @since 1.0.0 | ||
* @category symbols | ||
*/ | ||
const SpanTypeId = /*#__PURE__*/Symbol.for("@effect/io/Tracer/Span"); | ||
const TracerTypeId = /*#__PURE__*/Symbol.for("@effect/io/Tracer"); | ||
/** | ||
* Returns `true` if the specified value is a `Span`, `false` otherwise. | ||
* | ||
* @category constructors | ||
* @since 1.0.0 | ||
* @category refinements | ||
*/ | ||
exports.SpanTypeId = SpanTypeId; | ||
const isSpan = u => { | ||
return typeof u === "object" && u != null && SpanTypeId in u; | ||
}; | ||
exports.isSpan = isSpan; | ||
exports.TracerTypeId = TracerTypeId; | ||
const make = withSpan => ({ | ||
_id: TracerTypeId, | ||
withSpan | ||
}); | ||
/** | ||
* @category fiberRefs | ||
* @since 1.0.0 | ||
*/ | ||
exports.make = make; | ||
const currentTracer = /*#__PURE__*/core.fiberRefUnsafeMake(_Option.none); | ||
exports.currentTracer = currentTracer; | ||
//# sourceMappingURL=Tracer.js.map |
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
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
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
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
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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 too big to display
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 too big to display
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
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
65415
3770581