type-alias / @typed/fx/Fx

FlatMapLike

Describes a dual flattening operator whose callback returns an Fx.

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

Import

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

Signatures

export type FlatMapLike<Args extends ReadonlyArray<any> = [
]> = {
    <A, B, E2, R2>(f: (a: A) => Fx<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) => Fx<B, E2, R2>, ...args: Args): Fx<B, E | E2, R | R2 | Scope.Scope>;
};

Why

The shared type keeps data-first and data-last call styles consistent across merge, concat, switch, and exhaust policies while preserving the callback’s success, error, and service channels.

Ownership and lifetime

The type acquires no resources. Implementations return an Fx requiring Scope; that Scope owns any admitted inner subscriptions and their cleanup.

Other public imports

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

Source