Package: effect
Module: Cause
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
empty returns the other cause unchanged.self, self is returned
(referential shortcut).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
fromReasons — build a cause from an array of reasonsempty for the identity cause used when combiningSignature
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>; }
Since v4.0.0