Import
import { Sink } from "@typed/fx";This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.
Signatures
export * as Sink from "./Sink.js";Members
Sink.BoundsZero-based skip count and maximum take count used by
slice.Sink.ErrorAlias of
Sink.Errorfor direct imports.Sink.ServiceDefines a class-shaped Effect Context service for a Sink.
Sink.ServicesAlias of
Sink.Servicesfor direct imports.Sink.SinkConsumes pushed successes and failures through effectful callbacks.
Sink.SuccessAlias of
Sink.Successfor direct imports.Sink.collectCollects all values into an array. Pass a
Ref<ReadonlyArray<A>>(e.g.Ref.make([])); after running, read the result withRef.get(ref).Sink.compactForwards
Somevalues and discardsNonevalues.Sink.dropAfterRuns a producer callback until the first matching value has been forwarded.
Sink.exitMaterializes both sink channels as successful Effect
Exitvalues.Sink.filterFilters values before they reach the sink using a predicate function.
Sink.filterEffectRuns an effectful predicate and forwards inputs for which it succeeds with
true.Sink.filterMapFilters and transforms values before they reach the sink using a function that returns an
Option.Sink.filterMapEffectRuns an Effect for each input and forwards its optional successful value.
Sink.filterMapLoopThreads pure state through successes and optionally forwards a derived value.
Sink.filterMapLoopCauseThreads pure state through failures and optionally forwards a transformed cause.
Sink.filterMapLoopCauseEffectThreads state through an effectful failure transition and optionally forwards a cause.
Sink.filterMapLoopEffectThreads state through an effectful success transition and optionally forwards its value.
Sink.flipExchanges a sink’s typed success and failure channels.
Sink.headKeeps only the first value. Pass a
Ref<Option.Option<A>>(e.g.Ref.make(Option.none())); after running, read the result withRef.get(ref).Sink.lastKeeps only the last value. Pass a
Ref<Option.Option<A>>(e.g.Ref.make(Option.none())); after running, read the result withRef.get(ref).Sink.loopThreads pure state through successful inputs and forwards one derived value per input.
Sink.loopCauseThreads pure state through failure causes and forwards one transformed cause per failure.
Sink.loopCauseEffectThreads state through an effectful failure transformation.
Sink.loopEffectThreads state through an effectful success transformation and forwards one value on success.
Sink.makeCreates a Sink from success and failure callbacks.
Sink.mapTransforms values before they reach the sink using a pure function.
Sink.mapEffectRuns an Effect for each input and forwards its successful value to the sink.
Sink.mapErrorMaps the error channel of a sink using the provided function. Failures are mapped via
Cause.map; defects and interrupts are preserved.Sink.mapInputAlias for
map, named for the input-side direction of the transformation.Sink.mapInputEffectAlias for
mapEffect, named for the input-side direction of the effectful transformation.Sink.reduceReduces values into a single result using a pure function. Pass a
Ref<B>(e.g. fromRef.make(initial)); after running, read the result withRef.get(ref).Sink.reduceEffectReduces values into a single result using an effectful function. Pass a
Ref<B>; after running, read the result withRef.get(ref). If the reducer effect fails, the ref is left unchanged (Sink onSuccess is typed as never failing).Sink.skipInterruptSuppresses failure causes made entirely of interruption reasons.
Sink.sliceRuns a producer callback through a bounded view of a sink.
Sink.tapEffectRuns an effectful observation before forwarding each successful input unchanged.
Sink.withEarlyExitRuns a producer-style callback with a sink that can complete the surrounding Effect early.
Sink.withStateRuns a callback with an early-exit sink and a private Effect
Refinitialized tostate.Sink.withStateSemaphoreRuns a callback with private state whose effectful reads and writes are serialized.