effect-io-ai

Package: effect
Module: Cause

Cause.flatMap

Transforms errors in a Cause into new causes.

Details

This function applies a function f to each Fail error, converting it into a new Cause. This is especially powerful for merging or restructuring error types while preserving or combining cause information.

See

Signature

declare const flatMap: { <E, E2>(f: (e: E) => Cause<E2>): (self: Cause<E>) => Cause<E2>; <E, E2>(self: Cause<E>, f: (e: E) => Cause<E2>): Cause<E2>; }

Source

Since v2.0.0