Package: effect
Module: Stream
Runs a stream that requires Scope in a managed scope, ensuring its
finalizers are run when the stream completes.
Example (Scoping a stream)
import { Console, Effect, Stream } from "effect"
const stream = Stream.scoped(
Stream.fromEffect(
Effect.acquireRelease(
Console.log("acquire").pipe(Effect.as("resource")),
() => Console.log("release")
)
)
)
Effect.runPromise(Stream.runCollect(stream)).then(console.log)
// acquire
// release
// [ "resource" ]
Signature
declare const scoped: <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, Exclude<R, Scope.Scope>>
Since v2.0.0