Hyperlinkv0.8.0-beta.28

Channel

Channel.syncconsteffect/Channel.ts:865
<A>(evaluate: LazyArg<A>): Channel<A>

Creates a Channel that emits a single value computed by a lazy evaluation.

Example (Computing values lazily)

import { Channel } from "effect"

let requests = 0

const channel = Channel.sync(() => {
  requests += 1
  return `request-${requests}`
})
// Emits "request-1" when the channel runs for the first time
constructors
Source effect/Channel.ts:8651 lines
export const sync = <A>(evaluate: LazyArg<A>): Channel<A> => fromEffect(Effect.sync(evaluate))
Referenced by 1 symbols