Package: effect
Module: Stream
Runs the stream and returns the first element as an Option.
Example (Getting the first stream value)
import { Console, Effect, Option, Stream } from "effect"
const program = Effect.gen(function*() {
const head = yield* Stream.runHead(Stream.make(1, 2, 3))
yield* Console.log(Option.getOrThrow(head))
})
Effect.runPromise(program)
// 1
Signature
declare const runHead: <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>
Since v2.0.0