MCPcopy Create free account
hub / github.com/effect-app/libs / unfold

Function unfold

repos/effect/packages/effect/src/Stream.ts:1638–1649  ·  view source on GitHub ↗
(
  s: S,
  f: (s: S) => Effect.Effect<readonly [A, S] | undefined, E, R>
)

Source from the content-addressed store, hash-verified

1636 * await Effect.runPromise(program)
1637 * ```
1638 *
1639 * @category constructors
1640 * @since 2.0.0
1641 */
1642export const unwrap = <A, E2, R2, E, R>(
1643 effect: Effect.Effect<Stream<A, E2, R2>, E, R>
1644): Stream<A, E | E2, R2 | Exclude<R, Scope.Scope>> => fromChannel(Channel.unwrap(Effect.map(effect, toChannel)))
1645
1646/**
1647 * Runs a stream that requires `Scope` in a managed scope, ensuring its
1648 * finalizers are run when the stream completes.
1649 *
1650 * **Example** (Scoping a stream)
1651 *
1652 * ```ts import.meta.vitest

Callers 1

iterateFunction · 0.70

Calls 6

syncMethod · 0.80
doneMethod · 0.80
fromPullFunction · 0.70
ofMethod · 0.65
fFunction · 0.50
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…