effect-io-ai

Package: effect
Module: Cause

Cause.combine

Merges two causes into a single cause whose reasons array is the union of both inputs (de-duplicated by value equality).

When to use

Use to merge independent causes into one structured failure value.

Details

Example (Combining two causes)

import { Cause } from "effect"

const cause1 = Cause.fail("error1")
const cause2 = Cause.fail("error2")
const combined = Cause.combine(cause1, cause2)
console.log(combined.reasons.length) // 2

See

Signature

declare const combine: { <E2>(that: Cause<E2>): <E>(self: Cause<E>) => Cause<E | E2>; <E, E2>(self: Cause<E>, that: Cause<E2>): Cause<E | E2>; }

Source

Since v4.0.0