import type { Cause } from "../../Cause/index.js"; import * as C from "../../Cause/index.js"; import type { HasClock } from "../../Clock/index.js"; import * as Chunk from "../../Collections/Immutable/Chunk/index.js"; import * as NA from "../../Collections/Immutable/NonEmptyArray/index.js"; import * as SS from "../../Collections/Immutable/SortedSet/index.js"; import * as Tp from "../../Collections/Immutable/Tuple/index.js"; import type { Effect } from "../../Effect/index.js"; import * as T from "../../Effect/index.js"; import * as E from "../../Either/index.js"; import * as Ex from "../../Exit/index.js"; import type { FiberID } from "../../Fiber/index.js"; import * as F from "../../Fiber/index.js"; import { NoSuchElementException } from "../../GlobalExceptions/index.js"; import type { Has, Tag } from "../../Has/index.js"; import * as L from "../../Layer/index.js"; import type { Option } from "../../Option/index.js"; import * as O from "../../Option/index.js"; import type { Schedule } from "../../Schedule/index.js"; import type { UnionToIntersection } from "../../Utils/index.js"; import type { IO, Managed, RIO, UIO } from "../managed.js"; import type * as RM from "../ReleaseMap/index.js"; /** * Attempts to convert defects into a failure, throwing away all information * about the cause of the failure. * * @ets_data_first absorb_ */ export declare function absorb(f: (e: E) => unknown, __trace?: string): (self: Managed) => Managed; /** * Attempts to convert defects into a failure, throwing away all information * about the cause of the failure. */ export declare function absorb_(self: Managed, f: (e: E) => unknown, __trace?: string): Managed; /** * Unwraps the optional success of this effect, but can fail with None value. */ export declare function get(self: Managed>, __trace?: string): Managed, A>; /** * Returns an effect whose failure is mapped by the specified `f` function. */ export declare function mapError_(self: Managed, f: (e: E) => E2, __trace?: string): Managed; /** * Returns an effect whose failure is mapped by the specified `f` function. * * @ets_data_first mapError_ */ export declare function mapError(f: (e: E) => E2, __trace?: string): (self: Managed) => Managed; /** * Returns an effect whose full failure is mapped by the specified `f` function. */ export declare function mapErrorCause_(self: Managed, f: (e: C.Cause) => C.Cause, __trace?: string): Managed; /** * Returns an effect whose full failure is mapped by the specified `f` function. * * @ets_data_first mapErrorCause_ */ export declare function mapErrorCause(f: (e: C.Cause) => C.Cause, __trace?: string): (self: Managed) => Managed; /** * Returns a memoized version of the specified managed. */ export declare function memoize(self: Managed, __trace?: string): UIO>; /** * Returns a new effect where the error channel has been merged into the * success channel to their common combined type. */ export declare function merge(self: Managed, __trace?: string): Managed; /** * Returns the managed resulting from mapping the success of this managed to unit. */ export declare const unit: Managed; /** * Requires the option produced by this value to be `None`. */ export declare function none(self: Managed>, __trace?: string): Managed, void>; /** * Folds over the failure value or the success value to yield an effect that * does not fail, but succeeds with the value returned by the left or right * function passed to `fold`. */ export declare function fold_(self: Managed, onFail: (e: E) => B, onSuccess: (a: A) => C, __trace?: string): Managed; /** * Folds over the failure value or the success value to yield an effect that * does not fail, but succeeds with the value returned by the left or right * function passed to `fold`. * * @ets_data_first fold_ */ export declare function fold(onFail: (e: E) => B, onSuccess: (a: A) => C, __trace?: string): (self: Managed) => Managed; /** * Executes this effect, skipping the error but returning optionally the success. */ export declare function option(self: Managed, __trace?: string): Managed>; /** * Converts an option on errors into an option on values. */ export declare function optional(self: Managed, A>, __trace?: string): Managed>; /** * Keeps none of the errors, and terminates the fiber with them, using * the specified function to convert the `E` into a `Throwable`. * * @ets_data_first orDieWith_ */ export declare function orDieWith(f: (e: E) => unknown, __trace?: string): (self: Managed) => Managed; /** * Keeps none of the errors, and terminates the fiber with them, using * the specified function to convert the `E` into a `Throwable`. */ export declare function orDieWith_(self: Managed, f: (e: E) => unknown, __trace?: string): Managed; /** * Translates effect failure into death of the fiber, making all failures unchecked and * not a part of the type of the effect. */ export declare function orDie(self: Managed, __trace?: string): Managed; /** * Executes this effect and returns its value, if it succeeds, but * otherwise executes the specified effect. * * @ets_data_first orElse_ */ export declare function orElse(that: () => Managed, __trace?: string): (self: Managed) => Managed; /** * Executes this effect and returns its value, if it succeeds, but * otherwise executes the specified effect. */ export declare function orElse_(self: Managed, that: () => Managed, __trace?: string): Managed; /** * Executes this effect and returns its value, if it succeeds, but * otherwise fails with the specified error. * * @ets_data_first orElseFail_ */ export declare function orElseFail(e: E2, __trace?: string): (self: Managed) => Managed; /** * Executes this effect and returns its value, if it succeeds, but * otherwise fails with the specified error. */ export declare function orElseFail_(self: Managed, e: E2, __trace?: string): Managed; /** * Executes this effect and returns its value, if it succeeds, but * otherwise executes the specified effect. * * @ets_data_first orElseEither_ */ export declare function orElseEither(that: () => Managed, __trace?: string): (self: Managed) => Managed>; /** * Executes this effect and returns its value, if it succeeds, but * otherwise executes the specified effect. */ export declare function orElseEither_(self: Managed, that: () => Managed, __trace?: string): Managed>; /** * Returns an effect that will produce the value of this effect, unless it * fails with the `None` value, in which case it will produce the value of * the specified effect. */ export declare function orElseOptional_(self: Managed, A>, that: () => Managed, A2>, __trace?: string): Managed, A | A2>; /** * Returns an effect that will produce the value of this effect, unless it * fails with the `None` value, in which case it will produce the value of * the specified effect. * * @ets_data_first orElseOptional_ */ export declare function orElseOptional(that: () => Managed, A2>, __trace?: string): (self: Managed, A>) => Managed, A2 | A>; /** * Executes this effect and returns its value, if it succeeds, but * otherwise succeeds with the specified value. */ export declare function orElseSucceed_(self: Managed, A>, that: () => A2, __trace?: string): Managed, A | A2>; /** * Executes this effect and returns its value, if it succeeds, but * otherwise succeeds with the specified value. * * @ets_data_first orElseSucceed_ */ export declare function orElseSucceed(that: () => A2, __trace?: string): (self: Managed, A>) => Managed, A | A2>; /** * Recovers from all errors. */ export declare function catchAll_(self: Managed, f: (e: E) => Managed, __trace?: string): Managed; /** * Recovers from all errors. * * @ets_data_first catchAll_ */ export declare function catchAll(f: (e: E) => Managed, __trace?: string): (self: Managed) => Managed; /** * Recovers from all errors with provided Cause. */ export declare function catchAllCause_(self: Managed, f: (e: C.Cause) => Managed, __trace?: string): Managed; /** * Recovers from all errors with provided Cause. * * @ets_data_first catchAllCause_ */ export declare function catchAllCause(f: (e: C.Cause) => Managed, __trace?: string): (self: Managed) => Managed; /** * Recovers from some or all of the error cases. */ export declare function catchSome_(self: Managed, pf: (e: E) => O.Option>, __trace?: string): Managed; /** * Recovers from some or all of the error cases. * * @ets_data_first catchSome_ */ export declare function catchSome(pf: (e: E) => O.Option>, __trace?: string): (self: Managed) => Managed; /** * Recovers from some or all of the error cases. */ export declare function catchSomeCause_(self: Managed, pf: (e: C.Cause) => O.Option>, __trace?: string): Managed; /** * Recovers from some or all of the error cases. * * @ets_data_first catchSomeCause_ */ export declare function catchSomeCause(pf: (e: C.Cause) => O.Option>, __trace?: string): (self: Managed) => Managed; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * continue with the returned value. */ export declare function continueOrFailM_(self: Managed, e: () => E1, pf: (a: A) => O.Option>, __trace?: string): Managed; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * continue with the returned value. * * @ets_data_first continueOrFailM_ */ export declare function continueOrFailM(e: () => E1, pf: (a: A) => O.Option>, __trace?: string): (self: Managed) => Managed; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. */ export declare function continueOrFail_(self: Managed, e: () => E1, pf: (a: A) => O.Option, __trace?: string): Managed; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. * * @ets_data_first continueOrFail_ */ export declare function continueOrFail(e: () => E1, pf: (a: A) => O.Option, __trace?: string): (self: Managed) => Managed; /** * Provides some of the environment required to run this effect, * leaving the remainder `R0` and combining it automatically using spread. */ export declare function provide(r: R, __trace?: string): (next: Managed) => Managed; /** * Executes the second effect and then provides its output as an environment to this effect * * @ets_data_first compose_ */ export declare function compose(that: Managed, __trace?: string): (self: Managed) => Managed; /** * Executes the second effect and then provides its output as an environment to this effect */ export declare function compose_(self: Managed, that: Managed, __trace?: string): Managed; /** * Returns an effect whose failure and success have been lifted into an * `Either`. The resulting effect cannot fail */ export declare function either(self: Managed, __trace?: string): Managed>; /** * Returns a Managed that ignores errors raised by the acquire effect and * runs it repeatedly until it eventually succeeds. */ export declare function eventually(self: Managed, __trace?: string): Managed; /** * Zips this effect with its environment */ export declare function first(self: Managed, __trace?: string): Managed; /** * Effectfully map the error channel */ export declare function chainError_(self: Managed, f: (e: E) => RIO, __trace?: string): Managed; /** * Effectfully map the error channel * * @ets_data_first chainError_ */ export declare function chainError(f: (e: E) => RIO, __trace?: string): (self: Managed) => Managed; /** * Flip the error and result */ export declare function flip(self: Managed, __trace?: string): Managed; /** * Flip the error and result, then apply an effectful function to the effect */ export declare function flipWith_(self: Managed, f: (_: Managed) => Managed, __trace?: string): Managed; /** * Flip the error and result, then apply an effectful function to the effect * * @ets_data_first flipWith_ */ export declare function flipWith(f: (_: Managed) => Managed, __trace?: string): (self: Managed) => Managed; /** * Returns an effect that performs the outer effect first, followed by the * inner effect, yielding the value of the inner effect. * * This method can be used to "flatten" nested effects. */ export declare function flatten(self: Managed>, __trace?: string): Managed; /** * Returns an effect that performs the outer effect first, followed by the * inner effect, yielding the value of the inner effect. * * This method can be used to "flatten" nested effects. */ export declare function flattenM(self: Managed>, __trace?: string): Managed; /** * A more powerful version of `fold` that allows recovering from any kind of failure except interruptions. */ export declare function foldCause_(self: Managed, f: (e: C.Cause) => B, g: (a: A) => C, __trace?: string): Managed; /** * A more powerful version of `fold` that allows recovering from any kind of failure except interruptions. * * @ets_data_first foldCause_ */ export declare function foldCause(f: (e: C.Cause) => B, g: (a: A) => C, __trace?: string): (self: Managed) => Managed; /** * Returns a new effect that ignores the success or failure of this effect. */ export declare function ignore(self: Managed, __trace?: string): Managed; /** * Returns whether this managed effect is a failure. */ export declare function isFailure(self: Managed, __trace?: string): Managed; /** * Returns whether this managed effect is a success. */ export declare function isSuccess(self: Managed, __trace?: string): Managed; /** * Depending on the environment execute this or the other effect * * @ets_data_first join_ */ export declare function join(that: Managed, __trace?: string): (self: Managed) => Managed, E1 | E, A1 | A>; /** * Depending on the environment execute this or the other effect */ export declare function join_(self: Managed, that: Managed, __trace?: string): Managed, E | E1, A | A1>; /** * Depending on provided environment returns either this one or the other effect. * * @ets_data_first joinEither_ */ export declare function joinEither(that: Managed, __trace?: string): (self: Managed) => Managed, E2 | E, E.Either>; /** * Depending on provided environment returns either this one or the other effect. */ export declare function joinEither_(self: Managed, that: Managed, __trace?: string): Managed, E | E2, E.Either>; /** * Join self selectively with C */ export declare function identityLeft(__trace?: string): (self: Managed) => Managed, E, E.Either>; /** * Lifts a synchronous side-effect into a `Managed[R, E, A]`, * translating any thrown exceptions into typed failed effects using onThrow. */ export declare function tryCatch(f: () => A, onThrow: (u: unknown) => E, __trace?: string): Managed; /** * Returns an effect whose success is mapped by the specified side effecting * `f` function, translating any thrown exceptions into typed failed effects. * * @ets_data_first mapTryCatch_ */ export declare function mapTryCatch(onThrow: (u: unknown) => E2, f: (a: A) => B, __trace?: string): (self: Managed) => Managed; /** * Returns an effect whose success is mapped by the specified side effecting * `f` function, translating any thrown exceptions into typed failed effects. */ export declare function mapTryCatch_(self: Managed, onThrow: (u: unknown) => E2, f: (a: A) => B, __trace?: string): Managed; /** * Returns an effect whose success is mapped by the specified side effecting * `f` function, translating any thrown exceptions into typed failed effects. */ export declare function mapEffect_(self: Managed, f: (a: A) => B, __trace?: string): Managed; /** * Returns an effect whose success is mapped by the specified side effecting * `f` function, translating any thrown exceptions into typed failed effects. * * @ets_data_first mapEffect_ */ export declare function mapEffect(f: (a: A) => B, __trace?: string): (self: Managed) => Managed; /** * Preallocates the managed resource, resulting in a Managed that reserves * and acquires immediately and cannot fail. You should take care that you * are not interrupted between running preallocate and actually acquiring * the resource as you might leak otherwise. */ export declare function preallocate(self: Managed, __trace?: string): T.Effect>; /** * Preallocates the managed resource inside an outer managed, resulting in a * Managed that reserves and acquires immediately and cannot fail. */ export declare function preallocateManaged(self: Managed, __trace?: string): Managed>; /** * Provides a layer to the `Managed`, which translates it to another level. * * @ets_data_first provideLayer_ */ export declare function provideLayer(layer: L.Layer, __trace?: string): (self: Managed) => Managed; /** * Provides a layer to the `Managed`, which translates it to another level. */ export declare function provideLayer_(self: Managed, layer: L.Layer, __trace?: string): Managed; /** * Splits the environment into two parts, providing one part using the * specified layer and leaving the remainder `R0`. */ export declare function provideSomeLayer(layer: L.Layer, __trace?: string): (self: Managed) => Managed; /** * Keeps some of the errors, and terminates the fiber with the rest, using * the specified function to convert the `E` into a `Throwable`. * * @ets_data_first refineOrDieWith_ */ export declare function refineOrDieWith(pf: (e: E) => O.Option, f: (e: E) => unknown, __trace?: string): (self: Managed) => Managed; /** * Keeps some of the errors, and terminates the fiber with the rest, using * the specified function to convert the `E` into a `Throwable`. */ export declare function refineOrDieWith_(self: Managed, pf: (e: E) => O.Option, f: (e: E) => unknown, __trace?: string): Managed; /** * Keeps some of the errors, and terminates the fiber with the rest * * @ets_data_first refineOrDie_ */ export declare function refineOrDie(pf: (e: E) => O.Option, __trace?: string): (self: Managed) => Managed; /** * Keeps some of the errors, and terminates the fiber with the rest */ export declare function refineOrDie_(self: Managed, pf: (e: E) => O.Option, __trace?: string): Managed; /** * Returns a managed that dies with the specified `unknown`. This method * can be used for terminating a fiber because a defect has been * detected in the code. */ export declare function die(e: unknown, __trace?: string): Managed; /** * Returns a managed that dies with the specified `unknown`. This method * can be used for terminating a fiber because a defect has been * detected in the code. */ export declare function dieWith(e: () => unknown, __trace?: string): Managed; /** * Returns an effect that dies with a [[java.lang.RuntimeException]] having the * specified text message. This method can be used for terminating a fiber * because a defect has been detected in the code. */ export declare function dieMessage(message: string, __trace?: string): Managed; /** * Continue with the returned computation if the `PartialFunction` matches, * translating the successful match into a failure, otherwise continue with * our held value. * * @ets_data_first rejectM_ */ export declare function rejectM(pf: (a: A) => O.Option>, __trace?: string): (self: Managed) => Managed; /** * Continue with the returned computation if the `PartialFunction` matches, * translating the successful match into a failure, otherwise continue with * our held value. */ export declare function rejectM_(self: Managed, pf: (a: A) => O.Option>, __trace?: string): Managed; /** * Fail with the returned value if the `PartialFunction` matches, otherwise * continue with our held value. * * @ets_data_first reject_ */ export declare function reject(pf: (a: A) => O.Option, __trace?: string): (self: Managed) => Managed; /** * Fail with the returned value if the `PartialFunction` matches, otherwise * continue with our held value. */ export declare function reject_(self: Managed, pf: (a: A) => O.Option, __trace?: string): Managed; /** * Runs all the finalizers associated with this scope. This is useful to * conceptually "close" a scope when composing multiple managed effects. * Note that this is only safe if the result of this managed effect is valid * outside its scope. */ export declare function release(self: Managed, __trace?: string): Managed; /** * Returns an effect that retries this effect with the specified schedule when it fails, until * the schedule is done, then both the value produced by the schedule together with the last * error are passed to the specified recovery function. */ export declare function retryOrElseEither_(self: Managed, policy: Schedule, orElse: (e: E, o: O) => Managed, __trace?: string): Managed>; /** * Returns an effect that retries this effect with the specified schedule when it fails, until * the schedule is done, then both the value produced by the schedule together with the last * error are passed to the specified recovery function. * * @ets_data_first retryOrElseEither_ */ export declare function retryOrElseEither(policy: Schedule, orElse: (e: E, o: O) => Managed, __trace?: string): (self: Managed) => Managed>; /** * Retries with the specified schedule, until it fails, and then both the * value produced by the schedule together with the last error are passed to * the recovery function. */ export declare function retryOrElse_(self: Managed, policy: Schedule, orElse: (e: E, o: O) => Managed, __trace?: string): Managed; /** * Retries with the specified schedule, until it fails, and then both the * value produced by the schedule together with the last error are passed to * the recovery function. * * @ets_data_first retryOrElse_ */ export declare function retryOrElse(policy: Schedule, orElse: (e: E, o: O) => Managed, __trace?: string): (self: Managed) => Managed; /** * Retries with the specified retry policy. * Retries are done following the failure of the original `io` (up to a fixed maximum with * `once` or `recurs` for example), so that that `io.retry(Schedule.once)` means * "execute `io` and in case of failure, try again once". */ export declare function retry_(self: Managed, policy: Schedule, __trace?: string): Managed; /** * Retries with the specified retry policy. * Retries are done following the failure of the original `io` (up to a fixed maximum with * `once` or `recurs` for example), so that that `io.retry(Schedule.once)` means * "execute `io` and in case of failure, try again once". * * @ets_data_first retry_ */ export declare function retry(policy: Schedule, __trace?: string): (self: Managed) => Managed; /** * Returns an effect that semantically runs the effect on a fiber, * producing an `Exit` for the completion value of the fiber. */ export declare function result(self: Managed, __trace?: string): Managed>; /** * Exposes the full cause of failure of this effect. */ export declare function sandbox(self: Managed, __trace?: string): Managed, A>; /** * The inverse operation to `sandbox`. Submerges the full cause of failure. */ export declare function unsandbox(self: Managed, A>): Managed; /** * Companion helper to `sandbox`. Allows recovery, and partial recovery, from * errors and defects alike. * * @ets_data_first sandboxWith_ */ export declare function sandboxWith(f: (_: Managed, A>) => Managed, B>): (self: Managed) => Managed; /** * Companion helper to `sandbox`. Allows recovery, and partial recovery, from * errors and defects alike. */ export declare function sandboxWith_(self: Managed, f: (_: Managed, A>) => Managed, B>): Managed; /** * Zips this effect with its environment */ export declare function second(self: Managed): Managed; /** * Converts an option on values into an option on errors. */ export declare function some(self: Managed>): Managed, A>; /** * Extracts the optional value, or returns the given 'orElse'. * * @ets_data_first someOrElse_ */ export declare function someOrElse(orElse: () => B): (self: Managed>) => Managed; /** * Extracts the optional value, or returns the given 'orElse'. */ export declare function someOrElse_(self: Managed>, orElse: () => B): Managed; /** * Extracts the optional value, or executes the effect 'orElse'. * * @ets_data_first someOrElseM_ */ export declare function someOrElseM(orElse: Managed): (self: Managed>) => Managed; /** * Extracts the optional value, or executes the effect 'orElse'. */ export declare function someOrElseM_(self: Managed>, orElse: Managed): Managed; /** * Extracts the optional value, or fails with the given error 'e'. * * @ets_data_first someOrFail_ */ export declare function someOrFail(e: () => E1): (self: Managed>) => Managed; /** * Extracts the optional value, or fails with the given error 'e'. */ export declare function someOrFail_(self: Managed>, e: () => E1): Managed; /** * Extracts the optional value, or fails with a `NoSuchElementException` */ export declare function someOrFailException(self: Managed>): Managed; /** * Returns an effect that effectfully peeks at the failure or success of the acquired resource. */ export declare function tapBoth_(self: Managed, f: (e: E) => Managed, g: (a: A) => Managed): Managed; /** * Returns an effect that effectfully peeks at the failure or success of the acquired resource. * * @ets_data_first tapBoth_ */ export declare function tapBoth(f: (e: E) => Managed, g: (a: A) => Managed): (self: Managed) => Managed; /** * Returns an effect that effectually peeks at the cause of the failure of * the acquired resource. */ export declare function tapCause_(self: Managed, f: (c: Cause) => Managed): Managed; /** * Returns an effect that effectually peeks at the cause of the failure of * the acquired resource. * * @ets_data_first tapCause_ */ export declare function tapCause(f: (c: Cause) => Managed): (self: Managed) => Managed; /** * Returns an effect that effectfully peeks at the failure of the acquired resource. */ export declare function tapError_(self: Managed, f: (e: E) => Managed): Managed; /** * Returns an effect that effectfully peeks at the failure of the acquired resource. * * @ets_data_first tapError_ */ export declare function tapError(f: (e: E) => Managed): (self: Managed) => Managed; /** * Like `tap`, but uses a function that returns a Effect value rather than a * Managed value. * * @ets_data_first tapM_ */ export declare function tapM(f: (a: A) => Effect): (self: Managed) => Managed; /** * Like `tap`, but uses a function that returns a Effect value rather than a * Managed value. */ export declare function tapM_(self: Managed, f: (a: A) => Effect): Managed; /** * Returns a new effect that executes this one and times the acquisition of the resource. */ export declare function timed(self: Managed): Managed>; /** * Returns an effect that will timeout this resource, returning `None` if the * timeout elapses before the resource was reserved and acquired. * If the reservation completes successfully (even after the timeout) the release action will be run on a new fiber. * `Some` will be returned if acquisition and reservation complete in time */ export declare function timeout_(self: Managed, d: number): Managed>; /** * Returns an effect that will timeout this resource, returning `None` if the * timeout elapses before the resource was reserved and acquired. * If the reservation completes successfully (even after the timeout) the release action will be run on a new fiber. * `Some` will be returned if acquisition and reservation complete in time * * @ets_data_first timeout_ */ export declare function timeout(d: number): (self: Managed) => Managed>; /** * Constructs a layer from this managed resource. * * @ets_data_first toLayer_ */ export declare function toLayer(tag: Tag): (self: Managed) => L.Layer>; /** * Constructs a layer from this managed resource. */ export declare function toLayer_(self: Managed, tag: Tag): L.Layer>; /** * Constructs a layer from this managed resource, which must return one or * more services. */ export declare function toLayerMany[]>(...tags: Tags): (self: Managed] ? Has : never; }[number]>>) => L.Layer] ? Has : never; }[number]>>; /** * Return unit while running the effect */ export declare function asUnit(self: Managed): Managed; /** * The moral equivalent of `if (!p) exp` when `p` has side-effects * * @ets_data_first unlessM_ */ export declare function unlessM(b: Managed): (self: Managed) => Managed; /** * The moral equivalent of `if (!p) exp` when `p` has side-effects */ export declare function unlessM_(self: Managed, b: Managed): Managed; /** * The moral equivalent of `if (!p) exp` * * @ets_data_first unless_ */ export declare function unless(b: () => boolean): (self: Managed) => Managed; /** * The moral equivalent of `if (!p) exp` */ export declare function unless_(self: Managed, b: () => boolean): Managed; /** * Maps this effect to the specified constant while preserving the * effects of this effect. */ export declare function as_(self: Managed, b: B): Managed; /** * Maps this effect to the specified constant while preserving the * effects of this effect. * * @ets_data_first as_ */ export declare function as(b: B): (self: Managed) => Managed; /** * Maps the success value of this effect to an optional value. */ export declare function asSome(self: Managed): Managed>; /** * Maps the error value of this effect to an optional value. */ export declare function asSomeError(self: Managed): Managed, A>; /** * Maps the success value of this effect to a service. * * @ets_data_first asService_ */ export declare function asService(tag: Tag): (self: Managed) => Managed>; /** * Maps the success value of this effect to a service. */ export declare function asService_(self: Managed, tag: Tag): Managed>; /** * Executes the this effect and then provides its output as an environment to the second effect */ export declare function andThen_(self: Managed, that: Managed): Managed; /** * Executes the this effect and then provides its output as an environment to the second effect * * @ets_data_first andThen_ */ export declare function andThen(that: Managed): (self: Managed) => Managed; /** * Returns an effect whose failure and success channels have been mapped by * the specified pair of functions, `f` and `g`. * * @ets_data_first bimap_ */ export declare function bimap(f: (e: E) => E1, g: (a: A) => A1): (self: Managed) => Managed; /** * Returns an effect whose failure and success channels have been mapped by * the specified pair of functions, `f` and `g`. */ export declare function bimap_(self: Managed, f: (e: E) => E1, g: (a: A) => A1): Managed; /** * Joins with environment passing self selectively on the right side */ export declare function right(): (self: Managed) => Managed, E, E.Either>; /** * Joins with environment passing self selectively on the left side */ export declare function left(): (self: Managed) => Managed, E, E.Either>; /** * Effectfully accesses the environment of the effect. */ export declare function access(f: (_: R0) => A, __trace?: string): RIO; /** * Effectfully accesses the environment of the effect. */ export declare function accessManaged(f: (_: R0) => Managed): Managed; /** * Effectfully accesses the environment of the effect. */ export declare function accessM(f: (_: R0) => Effect): Managed; /** * Access a record of services with the required Service Entries */ export declare function accessServicesM>>(s: SS): (f: (a: { [k in keyof SS]: [SS[k]] extends [Tag] ? T : unknown; }) => Managed) => Managed] ? Has : unknown; }[keyof SS]>, E, B>; /** * Access a tuple of services with the required Service Entries monadically */ export declare function accessServicesTM[]>(...s: SS): (f: (...a: { [k in keyof SS]: [SS[k]] extends [Tag] ? T : unknown; }) => Managed) => Managed] ? Has : never; }[keyof SS & number]>, E, B>; /** * Access a tuple of services with the required Service Entries */ export declare function accessServicesT[]>(...s: SS): (f: (...a: { [k in keyof SS]: [SS[k]] extends [Tag] ? T : unknown; }) => B) => RIO] ? Has : never; }[keyof SS & number]>, B>; /** * Access a record of services with the required Service Entries */ export declare function accessServices>>(s: SS): (f: (a: { [k in keyof SS]: [SS[k]] extends [Tag] ? T : unknown; }) => B) => RIO] ? Has : unknown; }[keyof SS]>, B>; /** * Access a service with the required Service Entry */ export declare function accessServiceM(s: Tag): (f: (a: T) => Managed) => Managed, E, B>; /** * Access a service with the required Service Entry */ export declare function accessService(s: Tag): (f: (a: T) => B) => Managed, never, B>; /** * Accesses the specified service in the environment of the effect. */ export declare function service(s: Tag): Managed, never, T>; /** * Accesses the specified services in the environment of the effect. */ export declare function services[]>(...s: Ts): RIO] ? Has : never; }[number]>, Readonly<{ [k_1 in keyof Ts]: [Ts[k_1]] extends [Tag] ? T_1 : never; }>>; /** * Provides the service with the required Service Entry */ export declare function provideServiceM(_: Tag): (f: Managed) => (ma: Managed, E1, A1>) => Managed; /** * Provides the service with the required Service Entry */ export declare function provideService(_: Tag): (f: T) => (ma: Managed, E1, A1>) => Managed; /** * Replaces the service with the required Service Entry * * @ets_data_first replaceServiceM_ */ export declare function replaceServiceM(_: Tag, f: (_: T) => Managed): (ma: Managed, E1, A1>) => Managed, E | E1, A1>; /** * Replaces the service with the required Service Entry */ export declare function replaceServiceM_(ma: Managed, E1, A1>, _: Tag, f: (_: T) => Managed): Managed, E | E1, A1>; /** * Replaces the service with the required Service Entry * * @ets_data_first replaceService_ */ export declare function replaceService(_: Tag, f: (_: T) => T): (ma: Managed, E1, A1>) => Managed, E1, A1>; /** * Replaces the service with the required Service Entry */ export declare function replaceService_(ma: Managed, E1, A1>, _: Tag, f: (_: T) => T): Managed, E1, A1>; /** * The moral equivalent of `if (p) exp` when `p` has side-effects */ export declare function whenM(b: Managed): (self: Managed) => Managed; /** * The moral equivalent of `if (p) exp` */ export declare function when(b: () => boolean): (self: Managed) => Managed; /** * A more powerful version of `withEarlyRelease` that allows specifying an * exit value in the event of early release. */ export declare function withEarlyReleaseExit_(self: Managed, exit: Ex.Exit): Managed, A]>>; /** * A more powerful version of `withEarlyRelease` that allows specifying an * exit value in the event of early release. * * @ets_data_first withEarlyReleaseExit_ */ export declare function withEarlyReleaseExit(exit: Ex.Exit): (self: Managed) => Managed, A]>>; /** * Returns an effect that succeeds with the `Fiber.Id` of the caller. */ export declare const fiberId: Managed; /** * Modifies this `Managed` to provide a canceler that can be used to eagerly * execute the finalizer of this `Managed`. The canceler will run * uninterruptibly with an exit value indicating that the effect was * interrupted, and if completed will cause the regular finalizer to not run. */ export declare function withEarlyRelease(self: Managed): Managed, A]>>; /** * Sequentially zips this effect with the specified effect * returning the left side */ export declare function zipLeft_(a: Managed, b: Managed): Managed; /** * Sequentially zips this effect with the specified effect * returning the left side * * @ets_data_first zipLeft_ */ export declare function zipLeft(b: Managed): (a: Managed) => Managed; /** * Parallelly zips this effect with the specified effect * returning the left side */ export declare function zipLeftPar_(a: Managed, b: Managed): Managed; /** * Parallelly zips this effect with the specified effect * returning the left side * * @ets_data_first zipLeftPar_ */ export declare function zipLeftPar(b: Managed): (a: Managed) => Managed; /** * Sequentially zips this effect with the specified effect * returning the right side */ export declare function zipRight_(a: Managed, b: Managed): Managed; /** * Sequentially zips this effect with the specified effect * returning the right side * * @ets_data_first zipRight_ */ export declare function zipRight(b: Managed): (a: Managed) => Managed; /** * Parallelly zips this effect with the specified effect * returning the right side */ export declare function zipRightPar_(a: Managed, b: Managed): Managed; /** * Parallelly zips this effect with the specified effect * returning the right side * * @ets_data_first zipRightPar_ */ export declare function zipRightPar(b: Managed): (a: Managed) => Managed; /** * Parallely zips this effects */ export declare function zipPar_(a: Managed, b: Managed): Managed; /** * Parallely zips this effects * * @ets_data_first zipPar_ */ export declare function zipPar(b: Managed): (a: Managed) => Managed; /** * Creates new `Managed` from a `Effect` value that uses a `ReleaseMap` and returns * a resource and a finalizer. * * The correct usage of this constructor consists of: * - Properly registering a finalizer in the ReleaseMap as part of the `Effect` value; * - Managing interruption safety - take care to use `uninterruptible` or * `uninterruptibleMask` to verify that the finalizer is registered in the * `ReleaseMap` after acquiring the value; * - Returning the finalizer returned from `ReleaseMap#add`. This is important * to prevent double-finalization. */ export declare function create(effect: T.Effect, E, Tp.Tuple<[RM.Finalizer, A]>>): Managed; /** * Evaluate the predicate, * return the given A as success if predicate returns true, and the given E as error otherwise */ export declare function cond_(pred: boolean, result: () => A, error: () => E): IO; /** * Evaluate the predicate, * return the given A as success if predicate returns true, and the given E as error otherwise * * @ets_data_first cond_ */ export declare function cond(result: () => A, error: () => E): (pred: boolean) => IO; /** * Applies the function `f` to each element of the `Iterable[A]` and runs * produced effects in parallel, discarding the results. * * For a sequential version of this method, see `forEachUnit_`. */ export declare function forEachUnitPar_(as: Iterable, f: (a: A) => Managed, __trace?: string): Managed; /** * Applies the function `f` to each element of the `Iterable[A]` and runs * produced effects in parallel, discarding the results. * * For a sequential version of this method, see `forEachUnit_`. * * @ets_data_first forEachUnitPar_ */ export declare function forEachUnitPar(f: (a: A) => Managed, __trace?: string): (as: Iterable) => Managed; /** * Applies the function `f` to each element of the `Iterable[A]` and runs * produced effects in parallel, discarding the results. * * For a sequential version of this method, see `forEachUnit_`. */ export declare function forEachUnitParN_(as: Iterable, n: number, f: (a: A) => Managed, __trace?: string): Managed; /** * Applies the function `f` to each element of the `Iterable[A]` and runs * produced effects in parallel, discarding the results. * * For a sequential version of this method, see `forEachUnit_`. * * @ets_data_first forEachUnitParN_ */ export declare function forEachUnitParN(n: number, f: (a: A) => Managed): (as: Iterable) => Managed; /** * Evaluate each effect in the structure from left to right, collecting the * the successful values and discarding the empty cases. For a parallel version, see `collectPar`. * * @ets_data_first collect_ */ export declare function collect(f: (a: A) => Managed, B>): (self: Iterable) => Managed>; /** * Evaluate each effect in the structure from left to right, collecting the * the successful values and discarding the empty cases. For a parallel version, see `collectPar`. */ export declare function collect_(self: Iterable, f: (a: A) => Managed, B>): Managed>; /** * Evaluate each effect in the structure in parallel, collecting the * the successful values and discarding the empty cases. * * @ets_data_first collectPar_ */ export declare function collectPar(f: (a: A) => Managed, B>): (self: Iterable) => Managed>; /** * Evaluate each effect in the structure in parallel, collecting the * the successful values and discarding the empty cases. */ export declare function collectPar_(self: Iterable, f: (a: A) => Managed, B>): Managed>; /** * Evaluate each effect in the structure in parallel, collecting the * the successful values and discarding the empty cases. * * Unlike `collectPar`, this method will use at most up to `n` fibers. */ export declare function collectParN_(self: Iterable, n: number, f: (a: A) => Managed, B>): Managed>; /** * Evaluate each effect in the structure in parallel, collecting the * the successful values and discarding the empty cases. * * Unlike `collectPar`, this method will use at most up to `n` fibers. * * @ets_data_first collectParN_ */ export declare function collectParN(n: number, f: (a: A) => Managed, B>): (self: Iterable) => Managed>; /** * Evaluate each effect in the structure from left to right, and collect the * results. For a parallel version, see `collectAllPar`. */ export declare function collectAll(as: Iterable>, __trace?: string): Managed>; /** * Evaluate each effect in the structure in parallel, and collect the * results. For a sequential version, see `collectAll`. */ export declare function collectAllPar(as: Iterable>, __trace?: string): Managed>; /** * Evaluate each effect in the structure in parallel, and collect the * results. For a sequential version, see `collectAll`. * * Unlike `collectAllPar`, this method will use at most `n` fibers. * * @ets_data_first collectAllParN_ */ export declare function collectAllParN(n: number, __trace?: string): (as: Iterable>) => Managed>; /** * Evaluate each effect in the structure in parallel, and collect the * results. For a sequential version, see `collectAll`. * * Unlike `collectAllPar`, this method will use at most `n` fibers. */ export declare function collectAllParN_(as: Iterable>, n: number, __trace?: string): Managed>; /** * Evaluate each effect in the structure from left to right, and discard the * results. For a parallel version, see `collectAllUnitPar`. */ export declare function collectAllUnit(as: Iterable>, __trace?: string): Managed; /** * Evaluate each effect in the structure in parallel, and discard the * results. For a sequential version, see `collectAllUnit`. */ export declare function collectAllUnitPar(as: Iterable>, __trace?: string): Managed; /** * Evaluate each effect in the structure in parallel, and discard the * results. For a sequential version, see `collectAllUnit`. * * Unlike `collectAllUnitPar`, this method will use at most `n` fibers. * * @ets_data_first collectAllUnitParN_ */ export declare function collectAllUnitParN(n: number, __trace?: string): (as: Iterable>) => Managed; /** * Evaluate each effect in the structure in parallel, and discard the * results. For a sequential version, see `collectAllUnit`. * * Unlike `collectAllUnitPar`, this method will use at most `n` fibers. */ export declare function collectAllUnitParN_(as: Iterable>, n: number, __trace?: string): Managed; /** * Evaluate each effect in the structure with `collectAll`, and collect * the results with given partial function. */ export declare function collectAllWith_(as: Iterable>, pf: (a: A) => O.Option, __trace?: string): Managed>; /** * Evaluate each effect in the structure with `collectAll`, and collect * the results with given partial function. * * @ets_data_first collectAllWith_ */ export declare function collectAllWith(pf: (a: A) => O.Option, __trace?: string): (as: Iterable>) => Managed>; /** * Evaluate each effect in the structure with `collectAll`, and collect * the results with given partial function. */ export declare function collectAllWithPar_(as: Iterable>, pf: (a: A) => O.Option, __trace?: string): Managed>; /** * Evaluate each effect in the structure with `collectAll`, and collect * the results with given partial function. * * @ets_data_first collectAllWithPar_ */ export declare function collectAllWithPar(pf: (a: A) => O.Option, __trace?: string): (as: Iterable>) => Managed>; /** * Evaluate each effect in the structure with `collectAllPar`, and collect * the results with given partial function. * * Unlike `collectAllWithPar`, this method will use at most up to `n` fibers. */ export declare function collectAllWithParN_(as: Iterable>, n: number, pf: (a: A) => O.Option, __trace?: string): Managed>; /** * Evaluate each effect in the structure with `collectAllPar`, and collect * the results with given partial function. * * Unlike `collectAllWithPar`, this method will use at most up to `n` fibers. * * @ets_data_first collectAllWithParN_ */ export declare function collectAllWithParN(n: number, pf: (a: A) => O.Option, __trace?: string): (as: Iterable>) => Managed>; /** * Evaluate and run each effect in the structure and collect discarding failed ones. */ export declare function collectAllSuccesses(as: Iterable>, __trace?: string): Managed>; /** * Evaluate and run each effect in the structure in parallel, and collect discarding failed ones. */ export declare function collectAllSuccessesPar(as: Iterable>, __trace?: string): Managed>; /** * Evaluate and run each effect in the structure in parallel, and collect discarding failed ones. * * Unlike `collectAllSuccessesPar`, this method will use at most up to `n` fibers. * * @ets_data_first collectAllSuccessesParN_ */ export declare function collectAllSuccessesParN(n: number, __trace?: string): (as: Iterable>) => Managed>; /** * Evaluate and run each effect in the structure in parallel, and collect discarding failed ones. * * Unlike `collectAllSuccessesPar`, this method will use at most up to `n` fibers. */ export declare function collectAllSuccessesParN_(as: Iterable>, n: number, __trace?: string): Managed>; /** * Creates an effect that only executes the provided function as its * release action. */ export declare function finalizerExit(f: (exit: Ex.Exit) => T.RIO, __trace?: string): RIO; /** * Creates an effect that only executes the provided finalizer as its * release action. */ export declare function finalizer(f: T.RIO, __trace?: string): RIO; /** * Folds an Iterable[A] using an effectual function f, working sequentially from left to right. */ export declare function reduce_(i: Iterable, zero: Z, f: (z: Z, a: A) => Managed, __trace?: string): Managed; /** * Folds an Iterable[A] using an effectual function f, working sequentially from left to right. * * @ets_data_first reduce_ */ export declare function reduce(zero: Z, f: (z: Z, a: A) => Managed, __trace?: string): (i: Iterable) => Managed; /** * Folds an Iterable[A] using an effectual function f, working sequentially from left to right. */ export declare function reduceRight_(i: Iterable, zero: Z, f: (a: A, z: Z) => Managed, __trace?: string): Managed; /** * Folds an Iterable[A] using an effectual function f, working sequentially from left to right. * * @ets_data_first reduceRight_ */ export declare function reduceRight(zero: Z, f: (a: A, z: Z) => Managed): (i: Iterable) => Managed; /** * Reduces an `Iterable[IO]` to a single `IO`, working sequentially. */ export declare function reduceAll_(as: NA.NonEmptyArray>, f: (acc: A, a: A) => A): Managed; /** * Reduces an `Iterable[IO]` to a single `IO`, working sequentially. * * @ets_data_first reduceAll_ */ export declare function reduceAll(f: (acc: A, a: A) => A): (as: NA.NonEmptyArray>) => Managed; /** * Reduces an `Iterable[IO]` to a single `IO`, working in parallel. */ export declare function reduceAllPar_(as: NA.NonEmptyArray>, f: (acc: A, a: A) => A): Managed; /** * Reduces an `Iterable[IO]` to a single `IO`, working in parallel. * * @ets_data_first reduceAllPar_ */ export declare function reduceAllPar(f: (acc: A, a: A) => A): (as: NA.NonEmptyArray>) => Managed; /** * Reduces an `Iterable[IO]` to a single `IO`, working in up to `n` fibers in parallel. */ export declare function reduceAllParN_(as: NA.NonEmptyArray>, n: number, f: (acc: A, a: A) => A): Managed; /** * Reduces an `Iterable[IO]` to a single `IO`, working in up to `n` fibers in parallel. * * @ets_data_first reduceAllParN_ */ export declare function reduceAllParN(n: number, f: (acc: A, a: A) => A): (as: NA.NonEmptyArray>) => Managed; /** * Merges an `Iterable[IO]` to a single IO, working sequentially. * * @ets_data_first mergeAll_ */ export declare function mergeAll(zero: B, f: (b: B, a: A) => B): (as: Iterable>) => Managed; /** * Merges an `Iterable[IO]` to a single IO, working sequentially. */ export declare function mergeAll_(as: Iterable>, zero: B, f: (b: B, a: A) => B): Managed; /** * Merges an `Iterable[IO]` to a single IO, working in parallel. * * Due to the parallel nature of this combinator, `f` must be both: * - commutative: `f(a, b) == f(b, a)` * - associative: `f(a, f(b, c)) == f(f(a, b), c)` * * It's unsafe to execute side effects inside `f`, as `f` may be executed * more than once for some of `in` elements during effect execution. * * @ets_data_first mergeAllPar_ */ export declare function mergeAllPar(zero: B, f: (b: B, a: A) => B): (as: Iterable>) => Managed; /** * Merges an `Iterable[IO]` to a single IO, working in parallel. * * Due to the parallel nature of this combinator, `f` must be both: * - commutative: `f(a, b) == f(b, a)` * - associative: `f(a, f(b, c)) == f(f(a, b), c)` * * It's unsafe to execute side effects inside `f`, as `f` may be executed * more than once for some of `in` elements during effect execution. */ export declare function mergeAllPar_(as: Iterable>, zero: B, f: (b: B, a: A) => B): Managed; /** * Merges an `Iterable[IO]` to a single IO, working in with up to `n` fibers in parallel. * * Due to the parallel nature of this combinator, `f` must be both: * - commutative: `f(a, b) == f(b, a)` * - associative: `f(a, f(b, c)) == f(f(a, b), c)` * * It's unsafe to execute side effects inside `f`, as `f` may be executed * more than once for some of `in` elements during effect execution. * * @ets_data_first mergeAllParN_ */ export declare function mergeAllParN(n: number, zero: B, f: (b: B, a: A) => B): (as: Iterable>) => Managed; /** * Merges an `Iterable[IO]` to a single IO, working in with up to `n` fibers in parallel. * * Due to the parallel nature of this combinator, `f` must be both: * - commutative: `f(a, b) == f(b, a)` * - associative: `f(a, f(b, c)) == f(f(a, b), c)` * * It's unsafe to execute side effects inside `f`, as `f` may be executed * more than once for some of `in` elements during effect execution. */ export declare function mergeAllParN_(as: Iterable>, n: number, zero: B, f: (b: B, a: A) => B): Managed; /** * A scope in which Managed values can be safely allocated. Passing a managed * resource to the `apply` method will return an effect that allocates the resource * and returns it with an early-release handle. */ export interface Scope { (ma: Managed): T.Effect>; } /** * Creates a scope in which resources can be safely allocated into together with a release action. */ export declare const scope: Managed; /** * Locally installs a supervisor and an effect that succeeds with all the * children that have been forked in the returned effect. */ export declare function withChildren(get: (io: T.Effect>>) => Managed): Managed; /** * Unwraps a `Managed` that is inside an `Effect`. */ export declare function unwrap(fa: T.Effect>): Managed; /** * Creates a `Managed` from an `AutoCloseable` resource. The resource's `close` * method will be used as the release action. */ export declare function fromAutoClosable void; }>(fa: T.Effect): Managed; /** * Creates a `Managed` from an `AutoCloseable` resource. The resource's `close` * method will be used as the release action. */ export declare function fromAutoClosableM; }>(fa: T.Effect): Managed; /** * Returns an effect that is interrupted as if by the fiber calling this * method. */ export declare const interrupt: Managed; /** * Returns an effect that is interrupted as if by the specified fiber. */ export declare function interruptAs(id: FiberID): Managed; /** * Low level expose internal trace pusher */ export declare function exposeTracer(f: (tracer: (trace?: string) => void) => Managed): Managed; //# sourceMappingURL=api.d.ts.map