effect-io-ai

Package: effect
Module: Sink

Sink.findEffect

Creates a sink containing the first value matched by an effectful predicate.

When to use

Use when you need to run effects, fail, or use services while searching for the first matching input.

Details

Returns Option.some with the first input whose predicate result is true, or Option.none if the upstream stream ends first. If the predicate effect fails, the sink fails with the same error.

See

Signature

declare const findEffect: <In, E, R>(predicate: (input: In) => Effect.Effect<boolean, E, R>) => Sink<Option.Option<In>, In, In, E, R>

Source

Since v2.0.0