effect-io-ai

Package: effect
Module: Stream

Stream.fromEffect

Either emits the success value of this effect or terminates the stream with the failure value of this effect.

Example

import { Effect, Random, Stream } from "effect"

const stream = Stream.fromEffect(Random.nextInt)

Effect.runPromise(Stream.runCollect(stream)).then(console.log)
// Example Output: { _id: 'Chunk', values: [ 922694024 ] }

Signature

declare const fromEffect: <A, E, R>(effect: Effect.Effect<A, E, R>) => Stream<A, E, R>

Source

Since v2.0.0