<A>(a: LazyArg<A>): Sink<A>A sink that immediately ends with the specified lazily evaluated value.
export const const sync: <A>(a: LazyArg<A>) => Sink<A>A sink that immediately ends with the specified lazily evaluated value.
sync = <function (type parameter) A in <A>(a: LazyArg<A>): Sink<A>A>(a: LazyArg<A>a: import LazyArgLazyArg<function (type parameter) A in <A>(a: LazyArg<A>): Sink<A>A>): interface Sink<out A, in In = unknown, out L = never, out E = never, out R = never>A Sink<A, In, L, E, R> is used to consume elements produced by a Stream.
You can think of a sink as a function that will consume a variable amount of
In elements (could be 0, 1, or many), might fail with an error of type E,
and will eventually yield a value of type A together with a remainder of
type L (i.e. any leftovers).
Example (Running a sink with a stream)
import { Effect, Sink, Stream } from "effect"
// Create a simple sink that always succeeds with a value
const sink: Sink.Sink<number> = Sink.succeed(42)
// Use the sink to consume a stream
const stream = Stream.make(1, 2, 3)
const program = Stream.run(stream, sink)
Effect.runPromise(program).then(console.log)
// Output: 42
Namespace containing types and interfaces for Sink variance and type relationships.
Sink<function (type parameter) A in <A>(a: LazyArg<A>): Sink<A>A> => const fromEffect: <A, E, R>(
effect: Effect.Effect<A, E, R>
) => Sink<A, unknown, never, E, R>
Creates a sink that ignores upstream input and completes with the success
value of the provided effect.
Details
If the effect fails, the sink fails with the same error.
fromEffect(import EffectEffect.sync(a: LazyArg<A>a))