effect-io-ai

Package: effect
Module: Channel

Channel.Channel

A Channel is a nexus of I/O operations, which supports both reading and writing. A channel may read values of type InElem and write values of type OutElem. When the channel finishes, it yields a value of type OutDone. A channel may fail with a value of type OutErr.

Channels are the foundation of Streams: both streams and sinks are built on channels. Most users shouldn’t have to use channels directly, as streams and sinks are much more convenient and cover all common use cases. However, when adding new stream and sink operators, or doing something highly specialized, it may be useful to use channels directly.

Channels compose in a variety of ways:

Signature

export interface Channel<
  out OutElem,
  in InElem = unknown,
  out OutErr = never,
  in InErr = unknown,
  out OutDone = void,
  in InDone = unknown,
  out Env = never
> extends
  Channel.Variance<
    OutElem,
    InElem,
    OutErr,
    InErr,
    OutDone,
    InDone,
    Env
  >,
  Pipeable
{
  [Unify.typeSymbol]?: unknown
  [Unify.unifySymbol]?: ChannelUnify<this>
  [Unify.ignoreSymbol]?: ChannelUnifyIgnore
}

Source

Since v2.0.0