Package: effect
Module: Cause
Creates a Cause from an array of Reason values.
When to use
Use when you already have individual reasons (e.g. from filtering or
transforming another cause’s reasons array) and need to wrap them back
into a Cause.
Details
Cause.empty.Gotchas
The reasons array is stored as provided. Treat the array as immutable
after passing it to this function.
Example (Building a cause from reasons)
import { Cause } from "effect"
const reasons = [
Cause.makeFailReason("err1"),
Cause.makeFailReason("err2")
]
const cause = Cause.fromReasons(reasons)
console.log(cause.reasons.length) // 2
See
combine — merge two existing causesSignature
declare const fromReasons: <E>(reasons: ReadonlyArray<Reason<E>>) => Cause<E>
Since v4.0.0