variable / @typed/fx

RefResult.flatMap

FlatMap the success value of a RefResult.

Package version
2.0.0-beta.7
Category
Derived queries
Since
1.18.0
Member of
RefResult

Import

import { RefResult } from "@typed/fx";

Access RefResult.flatMap through the imported RefResult export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare const flatMap: {
    <A, B, ResultE2>(f: (a: A) => Result.Result<B, ResultE2>): <ResultE, Err, R>(ref: RefResult<A, ResultE, Err, R>) => RefSubject.Computed<Result.Result<B, ResultE | ResultE2>, Err, R>;
    <A, ResultE, Err, R, B, ResultE2>(ref: RefResult<A, ResultE, Err, R>, f: (a: A) => Result.Result<B, ResultE2>): RefSubject.Computed<Result.Result<B, ResultE | ResultE2>, Err, R>;
};

Why

Projects only successful values with Result.flatMap while preserving failures; current reads and future pushes use the same read-only derivation.

Ownership and lifetime

The flat map view retains no independent state. An Effect read samples the source once; Fx observation follows later pushes and its observing Scope owns subscription cleanup.

Other public imports

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

Source