variable / @typed/fx/RefOption

flatMap

FlatMap the value inside the Option of a RefOption.

Package version
2.0.0-beta.13
Category
Derived queries
Since
1.18.0

Import

import { flatMap } from "@typed/fx/RefOption";

Signatures

export declare const flatMap: {
    <A, B>(f: (a: A) => Option.Option<B>): <E, R>(ref: RefOption<A, E, R>) => RefSubject.Computed<Option.Option<B>, E, R>;
    <A, E, R, B>(ref: RefOption<A, E, R>, f: (a: A) => Option.Option<B>): RefSubject.Computed<Option.Option<B>, E, R>;
};

Why

Projects the optional value with Option.flatMap for both a current read and later source pushes; it never changes the RefOption itself.

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