MCPcopy Create free account
hub / github.com/Effect-TS/effect / findSink

Function findSink

packages/effect/test/Sink/racing.test.ts:13–24  ·  view source on GitHub ↗
(a: A)

Source from the content-addressed store, hash-verified

11import { unfoldEffect } from "../utils/unfoldEffect.js"
12
13const findSink = <A>(a: A): Sink.Sink<A, A, A, void> =>
14 pipe(
15 Sink.fold<Option.Option<A>, A>(
16 Option.none(),
17 Option.isNone,
18 (_, v) => (a === v ? Option.some(a) : Option.none())
19 ),
20 Sink.mapEffect(Option.match({
21 onNone: () => Effect.failSync(constVoid),
22 onSome: Effect.succeed
23 }))
24 )
25
26const sinkRaceLaw = <E, A, L>(
27 stream: Stream.Stream<A>,

Callers 1

racing.test.tsFile · 0.70

Calls 1

pipeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…