<I extends Iterable<Exit<any, any>>>(exits: I): Exit<
void,
I extends Iterable<Exit<infer _A, infer _E>> ? _E : never
>Combines multiple Exit values into a single Exit<void, E>.
When to use
Use to validate that all exits in a collection succeeded
Details
If all exits are successful, this returns a void success. If any exit is a failure, this returns a single failure with all error causes combined.
Iterates over the entire collection. Collects all failure causes, not just the first.
Example (Combining exits)
import { Exit } from "effect"
const exits = [Exit.succeed(1), Exit.succeed(2), Exit.succeed(3)]
console.log(Exit.isSuccess(Exit.asVoidAll(exits))) // true
const mixed = [Exit.succeed(1), Exit.fail("err"), Exit.succeed(3)]
console.log(Exit.isFailure(Exit.asVoidAll(mixed))) // trueexport const const asVoidAll: <
I extends Iterable<Exit<any, any>>
>(
exits: I
) => Exit<
void,
I extends Iterable<Exit<infer _A, infer _E>>
? _E
: never
>
Combines multiple Exit values into a single Exit<void, E>.
When to use
Use to validate that all exits in a collection succeeded
Details
If all exits are successful, this returns a void success. If any exit is a
failure, this returns a single failure with all error causes combined.
Iterates over the entire collection. Collects all failure causes, not just
the first.
Example (Combining exits)
import { Exit } from "effect"
const exits = [Exit.succeed(1), Exit.succeed(2), Exit.succeed(3)]
console.log(Exit.isSuccess(Exit.asVoidAll(exits))) // true
const mixed = [Exit.succeed(1), Exit.fail("err"), Exit.succeed(3)]
console.log(Exit.isFailure(Exit.asVoidAll(mixed))) // true
asVoidAll: <function (type parameter) I in <I extends Iterable<Exit<any, any>>>(exits: I): Exit<void, I extends Iterable<Exit<infer _A, infer _E>> ? _E : never>I extends interface Iterable<T, TReturn = any, TNext = any>Iterable<type Exit<A, E = never> = Success<A, E> | Failure<A, E>Represents the result of an Effect computation.
When to use
Use when you need to synchronously inspect whether an Effect computation
succeeded or failed.
Details
An Exit<A, E> is either Success<A, E> containing a value of type A, or
Failure<A, E> containing a Cause<E> describing why the computation
failed.
Since Exit is also an Effect, you can yield it inside Effect.gen.
Example (Pattern matching on an Exit)
import { Exit } from "effect"
const success: Exit.Exit<number> = Exit.succeed(42)
const failure: Exit.Exit<number, string> = Exit.fail("error")
const result = Exit.match(success, {
onSuccess: (value) => `Got value: ${value}`,
onFailure: (cause) => `Got error: ${cause}`
})
Namespace containing helper types shared by Exit values.
When to use
Use to reference helper types that describe the shared structure of Exit
values.
Exit<any, any>>>(
exits: I extends Iterable<Exit<any, any>>exits: function (type parameter) I in <I extends Iterable<Exit<any, any>>>(exits: I): Exit<void, I extends Iterable<Exit<infer _A, infer _E>> ? _E : never>I
) => type Exit<A, E = never> = Success<A, E> | Failure<A, E>Represents the result of an Effect computation.
When to use
Use when you need to synchronously inspect whether an Effect computation
succeeded or failed.
Details
An Exit<A, E> is either Success<A, E> containing a value of type A, or
Failure<A, E> containing a Cause<E> describing why the computation
failed.
Since Exit is also an Effect, you can yield it inside Effect.gen.
Example (Pattern matching on an Exit)
import { Exit } from "effect"
const success: Exit.Exit<number> = Exit.succeed(42)
const failure: Exit.Exit<number, string> = Exit.fail("error")
const result = Exit.match(success, {
onSuccess: (value) => `Got value: ${value}`,
onFailure: (cause) => `Got error: ${cause}`
})
Namespace containing helper types shared by Exit values.
When to use
Use to reference helper types that describe the shared structure of Exit
values.
Exit<void, function (type parameter) I in <I extends Iterable<Exit<any, any>>>(exits: I): Exit<void, I extends Iterable<Exit<infer _A, infer _E>> ? _E : never>I extends interface Iterable<T, TReturn = any, TNext = any>Iterable<type Exit<A, E = never> = Success<A, E> | Failure<A, E>Represents the result of an Effect computation.
When to use
Use when you need to synchronously inspect whether an Effect computation
succeeded or failed.
Details
An Exit<A, E> is either Success<A, E> containing a value of type A, or
Failure<A, E> containing a Cause<E> describing why the computation
failed.
Since Exit is also an Effect, you can yield it inside Effect.gen.
Example (Pattern matching on an Exit)
import { Exit } from "effect"
const success: Exit.Exit<number> = Exit.succeed(42)
const failure: Exit.Exit<number, string> = Exit.fail("error")
const result = Exit.match(success, {
onSuccess: (value) => `Got value: ${value}`,
onFailure: (cause) => `Got error: ${cause}`
})
Namespace containing helper types shared by Exit values.
When to use
Use to reference helper types that describe the shared structure of Exit
values.
Exit<infer function (type parameter) _A_A, infer function (type parameter) _E_E>> ? function (type parameter) _E_E : never> = import effecteffect.const exitAsVoidAll: <
I extends Iterable<Exit.Exit<any, any>>
>(
exits: I
) => Exit.Exit<
void,
I extends Iterable<
Exit.Exit<infer _A, infer _E>
>
? _E
: never
>
exitAsVoidAll