Collecting values
collectfunction
Collects all values into an array. Pass a
Ref<ReadonlyArray<A>>(e.g.Ref.make([])); after running, read the result withRef.get(ref).headfunction
Keeps only the first value. Pass a
Ref<Option.Option<A>>(e.g.Ref.make(Option.none())); after running, read the result withRef.get(ref).lastfunction
Keeps only the last value. Pass a
Ref<Option.Option<A>>(e.g.Ref.make(Option.none())); after running, read the result withRef.get(ref).reducefunction
Reduces 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).reduceEffectfunction
Reduces 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).
Consumer contracts
Sinkinterface
Consumes pushed successes and failures through effectful callbacks.
Failure handling
exitvariable
Materializes both sink channels as successful Effect
Exitvalues.flipvariable
Exchanges a sink’s typed success and failure channels.
mapErrorfunction
Maps the error channel of a sink using the provided function. Failures are mapped via
Cause.map; defects and interrupts are preserved.skipInterruptvariable
Suppresses failure causes made entirely of interruption reasons.
Operator options
Boundsinterface
Zero-based skip count and maximum take count used by
slice.
Selecting inputs
compactfunction
Forwards
Somevalues and discardsNonevalues.filterfunction
Filters values before they reach the sink using a predicate function.
filterEffectvariable
Runs an effectful predicate and forwards inputs for which it succeeds with
true.filterMapfunction
Filters and transforms values before they reach the sink using a function that returns an
Option.filterMapEffectvariable
Runs an Effect for each input and forwards its optional successful value.
Sink construction
makefunction
Creates a Sink from success and failure callbacks.
Sink services
Servicefunction
Defines a class-shaped Effect Context service for a Sink.
Sink.Classinterface
Constructor-shaped Context service returned by
Sink.Service.Sink.Serviceinterface
Describes a Sink available through an Effect Context service.
Stateful delivery
Sink.WithStateinterface
An early-exit sink with a mutable Effect
Reffor consumer-local state.Sink.WithStateSemaphoreinterface
An early-exit sink with serialized effectful access to consumer-local state.
filterMapLoopvariable
Threads pure state through successes and optionally forwards a derived value.
filterMapLoopEffectvariable
Threads state through an effectful success transition and optionally forwards its value.
loopvariable
Threads pure state through successful inputs and forwards one derived value per input.
loopEffectvariable
Threads state through an effectful success transformation and forwards one value on success.
withStatefunction
Runs a callback with an early-exit sink and a private Effect
Refinitialized tostate.withStateSemaphorefunction
Runs a callback with private state whose effectful reads and writes are serialized.
Stateful failure handling
filterMapLoopCausevariable
Threads pure state through failures and optionally forwards a transformed cause.
filterMapLoopCauseEffectfunction
Threads state through an effectful failure transition and optionally forwards a cause.
loopCausevariable
Threads pure state through failure causes and forwards one transformed cause per failure.
loopCauseEffectvariable
Threads state through an effectful failure transformation.
Stopping delivery
Sink.WithEarlyExitinterface
A sink that can ask its producer callback to stop early.
dropAftervariable
Runs a producer callback until the first matching value has been forwarded.
slicevariable
Runs a producer callback through a bounded view of a sink.
withEarlyExitfunction
Runs a producer-style callback with a sink that can complete the surrounding Effect early.
Transforming inputs
mapfunction
Transforms values before they reach the sink using a pure function.
mapEffectvariable
Runs an Effect for each input and forwards its successful value to the sink.
mapInputvariable
Alias for
map, named for the input-side direction of the transformation.mapInputEffectvariable
Alias for
mapEffect, named for the input-side direction of the effectful transformation.tapEffectvariable
Runs an effectful observation before forwarding each successful input unchanged.
Type contracts
Errortype-alias
Alias of
Sink.Errorfor direct imports.Servicestype-alias
Alias of
Sink.Servicesfor direct imports.Sink.Anytype-alias
Matches any
Sinkwhen its channels do not need to be preserved.Sink.Errortype-alias
Extracts the typed error carried by causes consumed by a
Sink.Sink.Servicestype-alias
Extracts the Effect services required by a
Sink’s callbacks.Sink.Successtype-alias
Extracts the successful input type consumed by a
Sink.Successtype-alias
Alias of
Sink.Successfor direct imports.