Import
import { RefSubject } from "@typed/fx";Access RefSubject.updateEffect through the imported RefSubject 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 updateEffect: {
<A, E2, R2>(f: (value: A) => Effect.Effect<A, E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E | E2, R | R2>;
<A, E, R, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<A, E2, R2>): Effect.Effect<A, E | E2, R | R2>;
};Why
Updates a RefSubject using an Effectful function. The transition is serialized at the
RefSubject rather than coordinated by callers or UI components.
Ownership and lifetime
Running update effect performs one serialized subject transition and resolves with its committed value. It acquires no resource; failures and services remain those of the source ref.
Examples
import { Effect } from "effect"
import * as RefSubject from "@typed/fx/RefSubject"
const program = Effect.gen(function* () {
const count = yield* RefSubject.make(5)
// Update with an async operation
yield* RefSubject.updateEffect(count, (value) =>
Effect.succeed(value * 2)
)
const result = yield* count
console.log(result) // 10
})Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.