Hyperlinkv0.8.0-beta.28

Stream

Stream.unwrapconsteffect/Stream.ts:1823
<A, E2, R2, E, R>(effect: Effect.Effect<Stream<A, E2, R2>, E, R>): Stream<
  A,
  E | E2,
  R2 | Exclude<R, Scope.Scope>
>

Creates a stream produced from an Effect.

Example (Unwrapping a stream effect)

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

const effect = Effect.succeed(Stream.make(1, 2, 3))

const stream = Stream.unwrap(effect)

const program = Effect.gen(function*() {
  const chunk = yield* Stream.runCollect(stream)
  yield* Console.log(chunk)
})
// [1, 2, 3]
constructors
Source effect/Stream.ts:18233 lines
export const unwrap = <A, E2, R2, E, R>(
  effect: Effect.Effect<Stream<A, E2, R2>, E, R>
): Stream<A, E | E2, R2 | Exclude<R, Scope.Scope>> => fromChannel(Channel.unwrap(Effect.map(effect, toChannel)))
Referenced by 7 symbols