ChannelUnify<A>Type-level unification support for Channel values.
Details
This preserves all Channel type parameters when Unify normalizes unions
or generic return types that include channels. Users normally do not need to
reference this interface directly.
export interface interface ChannelUnify<A extends { [Unify.typeSymbol]?: any; }>Type-level unification support for Channel values.
Details
This preserves all Channel type parameters when Unify normalizes unions
or generic return types that include channels. Users normally do not need to
reference this interface directly.
ChannelUnify<function (type parameter) A in ChannelUnify<A extends { [Unify.typeSymbol]?: any; }>A extends { [import UnifyUnify.const typeSymbol: typeof Unify.typeSymbolDefines the unique symbol used to identify the type information for unification.
When to use
Use when you need a type-level protocol key that exposes the source type
read by Unify from a protocol-enabled data type.
Details
This symbol is a type-level protocol key. It stores the source type that
unification reads when widening protocol-enabled values.
The type of the typeSymbol.
When to use
Use to reference the type information property key in type-level protocol
definitions.
Details
This type represents the unique symbol used for storing type information
in types that support unification. It's used in type-level operations
to access and manipulate type information.
typeSymbol]?: any }> extends import EffectEffect.interface EffectUnify<A extends { [Unify.typeSymbol]?: any; }>Type-level unification support for Effect values.
EffectUnify<function (type parameter) A in ChannelUnify<A extends { [Unify.typeSymbol]?: any; }>A> {
ChannelUnify<A extends { [Unify.typeSymbol]?: any; }>.Channel?: () => A[Unify.typeSymbol] extends Channel<infer OutElem, infer OutErr, infer OutDone, infer InElem, infer InErr, infer InDone, infer Env> | infer _ ? Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env> : neverChannel?: () => function (type parameter) A in ChannelUnify<A extends { [Unify.typeSymbol]?: any; }>A[import UnifyUnify.type typeSymbol = typeof Unify.typeSymbolDefines the unique symbol used to identify the type information for unification.
When to use
Use when you need a type-level protocol key that exposes the source type
read by Unify from a protocol-enabled data type.
Details
This symbol is a type-level protocol key. It stores the source type that
unification reads when widening protocol-enabled values.
The type of the typeSymbol.
When to use
Use to reference the type information property key in type-level protocol
definitions.
Details
This type represents the unique symbol used for storing type information
in types that support unification. It's used in type-level operations
to access and manipulate type information.
typeSymbol] extends
| interface Channel<out OutElem, out OutErr = never, out OutDone = void, in InElem = unknown, in InErr = unknown, in InDone = unknown, out Env = never>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.
Details
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:
- Piping: One channel can be piped to another channel, assuming the
input type of the second is the same as the output type of the first.
- Sequencing: The terminal value of one channel can be used to create
another channel, and both the first channel and the function that makes
the second channel can be composed into a channel.
- Concatenating: The output of one channel can be used to create other
channels, which are all concatenated together. The first channel and the
function that makes the other channels can be composed into a channel.
Example (Typing channels)
import type { Channel } from "effect"
// A channel that outputs numbers and requires no environment
type NumberChannel = Channel.Channel<number>
// A channel that outputs strings, can fail with Error, completes with boolean
type StringChannel = Channel.Channel<string, Error, boolean>
// A channel with all type parameters specified
type FullChannel = Channel.Channel<
string, // OutElem - output elements
Error, // OutErr - output errors
number, // OutDone - completion value
number, // InElem - input elements
string, // InErr - input errors
boolean, // InDone - input completion
{ db: string } // Env - required environment
>
Channel<infer function (type parameter) OutElemOutElem, infer function (type parameter) OutErrOutErr, infer function (type parameter) OutDoneOutDone, infer function (type parameter) InElemInElem, infer function (type parameter) InErrInErr, infer function (type parameter) InDoneInDone, infer function (type parameter) EnvEnv>
| infer function (type parameter) __ ? interface Channel<out OutElem, out OutErr = never, out OutDone = void, in InElem = unknown, in InErr = unknown, in InDone = unknown, out Env = never>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.
Details
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:
- Piping: One channel can be piped to another channel, assuming the
input type of the second is the same as the output type of the first.
- Sequencing: The terminal value of one channel can be used to create
another channel, and both the first channel and the function that makes
the second channel can be composed into a channel.
- Concatenating: The output of one channel can be used to create other
channels, which are all concatenated together. The first channel and the
function that makes the other channels can be composed into a channel.
Example (Typing channels)
import type { Channel } from "effect"
// A channel that outputs numbers and requires no environment
type NumberChannel = Channel.Channel<number>
// A channel that outputs strings, can fail with Error, completes with boolean
type StringChannel = Channel.Channel<string, Error, boolean>
// A channel with all type parameters specified
type FullChannel = Channel.Channel<
string, // OutElem - output elements
Error, // OutErr - output errors
number, // OutDone - completion value
number, // InElem - input elements
string, // InErr - input errors
boolean, // InDone - input completion
{ db: string } // Env - required environment
>
Channel<function (type parameter) OutElemOutElem, function (type parameter) OutErrOutErr, function (type parameter) OutDoneOutDone, function (type parameter) InElemInElem, function (type parameter) InErrInErr, function (type parameter) InDoneInDone, function (type parameter) EnvEnv>
: never
}