import * as E from "../Either/index.js";
import type { FiberID } from "../Fiber/id.js";
import type { Trace } from "../Fiber/index.js";
import * as S from "../IO/index.js";
import * as O from "../Option/index.js";
import type { Cause } from "./cause.js";
export { combinePar, Cause, die, empty, fail, interrupt, combineSeq, traced, isEmpty } from "./cause.js";
/**
* Applicative's ap
*/
export declare function ap(fa: Cause): (fab: Cause<(a: A) => B>) => Cause;
/**
* Substitute the E in the cause
*/
export declare function as(e: E1): (cause: Cause) => Cause;
/**
* Builds a Cause depending on the result of another
*/
export declare function chain_(cause: Cause, f: (_: E) => Cause): Cause;
/**
* Builds a Cause depending on the result of another
*/
export declare function chain(f: (_: E) => Cause): (cause: Cause) => Cause;
/**
* Builds a Cause depending on the result of another
*/
export declare function chainSafe_(cause: Cause, f: (_: E) => Cause): S.IO>;
/**
* Equivalent to chain((a) => Fail(f(a)))
*/
export declare function map_(cause: Cause, f: (e: E) => E1): Cause;
/**
* Equivalent to chain((a) => Fail(f(a)))
*/
export declare function map(f: (e: E) => E1): (cause: Cause) => Cause;
/**
* Determines if this cause contains or is equal to the specified cause.
*/
export declare function contains(that: Cause): (cause: Cause) => boolean;
/**
* Determines if this cause contains or is equal to the specified cause.
*/
export declare function containsSafe(that: Cause): (cause: Cause) => S.IO;
/**
* Extracts a list of non-recoverable errors from the `Cause`.
*/
export declare function defects(cause: Cause): readonly unknown[];
/**
* Returns the `Error` associated with the first `Die` in this `Cause` if
* one exists.
*/
export declare function dieOption(cause: Cause): O.Option;
/**
* Returns if a cause contains a defect
*/
export declare function died(cause: Cause): boolean;
/**
* Returns the `E` associated with the first `Fail` in this `Cause` if one
* exists.
*/
export declare function failureOption(cause: Cause): O.Option;
/**
* Returns if the cause has a failure in it
*/
export declare function failed(cause: Cause): boolean;
/**
* Retrieve the first checked error on the `Left` if available,
* if there are no checked errors return the rest of the `Cause`
* that is known to contain only `Die` or `Interrupt` causes.
* */
export declare function failureOrCause(cause: Cause): E.Either>;
/**
* Produces a list of all recoverable errors `E` in the `Cause`.
*/
export declare function failures(cause: Cause): readonly E[];
/**
* Remove all `Die` causes that the specified partial function is defined at,
* returning `Some` with the remaining causes or `None` if there are no
* remaining causes.
*/
export declare function stripSomeDefects(f: (_: unknown) => O.Option): (cause: Cause) => O.Option>;
/**
* Remove all `Die` causes that the specified partial function is defined at,
* returning `Some` with the remaining causes or `None` if there are no
* remaining causes.
*/
export declare function stripSomeDefects_(cause: Cause, f: (_: unknown) => O.Option): O.Option>;
/**
* Filter out all `Die` causes according to the specified function,
* returning `Some` with the remaining causes or `None` if there are no
* remaining causes.
*/
export declare function stripSomeDefectsSafe(cause: Cause, f: (_: unknown) => O.Option): S.IO>>;
/**
* Finds the first result matching f
*/
export declare function find(f: (cause: Cause) => O.Option): (cause: Cause) => O.Option;
/**
* Finds the first result matching f
*/
export declare function findSafe(f: (cause: Cause) => O.Option): (cause: Cause) => S.IO>;
/**
* Equivalent to chain(identity)
*/
export declare const flatten: (cause: Cause>) => Cause;
/**
* Folds over a cause
*/
export declare function fold(empty: () => Z, failCase: (_: E) => Z, dieCase: (_: unknown) => Z, interruptCase: (_: FiberID) => Z, thenCase: (_: Z, __: Z) => Z, bothCase: (_: Z, __: Z) => Z, tracedCase: (_: Z, __: Trace) => Z): (cause: Cause) => Z;
/**
* Folds over a cause
*/
export declare function foldSafe(empty: () => Z, failCase: (_: E) => Z, dieCase: (_: unknown) => Z, interruptCase: (_: FiberID) => Z, thenCase: (_: Z, __: Z) => Z, bothCase: (_: Z, __: Z) => Z, tracedCase: (_: Z, __: Trace) => Z): (cause: Cause) => S.IO;
/**
* Accumulates a state over a Cause
*/
export declare function reduceLeft(z: Z): (f: (z: Z, cause: Cause) => O.Option) => (cause: Cause) => Z;
/**
* Returns if the cause contains an interruption in it
*/
export declare function interrupted(cause: Cause): boolean;
/**
* Returns the `FiberID` associated with the first `Interrupt` in this `Cause` if one
* exists.
*/
export declare function interruptOption(cause: Cause): O.Option;
/**
* Determines if the `Cause` contains only interruptions and not any `Die` or
* `Fail` causes.
*/
export declare function interruptedOnly(cause: Cause): boolean;
/**
* Returns a set of interruptors, fibers that interrupted the fiber described
* by this `Cause`.
*/
export declare function interruptors(cause: Cause): readonly FiberID[];
/**
* Remove all `Fail` and `Interrupt` nodes from this `Cause`,
* return only `Die` cause/finalizer defects.
*/
export declare function keepDefectsSafe(cause: Cause): S.IO>>;
/**
* Remove all `Fail` and `Interrupt` nodes from this `Cause`,
* return only `Die` cause/finalizer defects.
*/
export declare function keepDefects(cause: Cause): O.Option>;
/**
* Converts the specified `Cause>` to an `Either, A>`.
*/
export declare function sequenceCauseEither(c: Cause>): E.Either, A>;
/**
* Converts the specified `Cause>` to an `Either, A>`.
*/
export declare function sequenceCauseEitherSafe(c: Cause>): S.IO, A>>;
/**
* Converts the specified `Cause