type-alias / @typed/fx/Fx

FlatMapEffectLike

Describes a dual flattening operator whose callback returns an Effect.

Package version
2.0.0-beta.7
Category
Type contracts
Since
1.0.0

Import

import { FlatMapEffectLike } from "@typed/fx/Fx";

Signatures

export type FlatMapEffectLike<Args extends ReadonlyArray<any> = [
]> = {
    <A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>, ...args: Args): <E, R>(self: Fx<A, E, R>) => Fx<B, E | E2, R | R2 | Scope.Scope>;
    <A, E, R, B, E2, R2>(self: Fx<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>, ...args: Args): Fx<B, E | E2, R | R2 | Scope.Scope>;
};

Why

The shared type gives Effect-producing merge, concat, switch, and exhaust operators the same data-first and data-last surface while retaining callback errors and services in the returned Fx.

Ownership and lifetime

The type acquires no resources. Implementations adapt each Effect to a one-value Fx whose execution is owned by the returned Fx’s required Scope.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source