Partial<{
readonly [K in A["_tag"]]: (
event: Extract<A, { readonly _tag: K }>
) => Effect.Effect<void, E, R>
}>A partial set of per-_tag handlers over a tagged-event union — the handler-map form of
Hyperlink.runForEachTag. Each handler receives the narrowed event for its tag.
export type type TagHandlers<
A extends TaggedEvent,
E,
R
> = {
[P in keyof {
readonly [K in A["_tag"]]: (
event: Extract<
A,
{
readonly _tag: K
}
>
) => Effect.Effect<void, E, R>
}]?:
| {
readonly [K in A["_tag"]]: (
event: Extract<
A,
{
readonly _tag: K
}
>
) => Effect.Effect<void, E, R>
}[P]
| undefined
}
A partial set of per-_tag handlers over a tagged-event union — the handler-map form of
Hyperlink.runForEachTag
. Each handler receives the narrowed event for its tag.
TagHandlers<function (type parameter) A in type TagHandlers<A extends TaggedEvent, E, R>A extends type TaggedEvent = {
readonly _tag: string
}
Anything with a string discriminant _tag — the element of an event stream.
TaggedEvent, function (type parameter) E in type TagHandlers<A extends TaggedEvent, E, R>E, function (type parameter) R in type TagHandlers<A extends TaggedEvent, E, R>R> = type Partial<T> = {
[P in keyof T]?: T[P] | undefined
}
Make all properties in T optional
Partial<{
readonly [function (type parameter) KK in function (type parameter) A in type TagHandlers<A extends TaggedEvent, E, R>A["_tag"]]: (
event: Extract<
A,
{
readonly _tag: K
}
>
event: type Extract<T, U> = T extends U
? T
: never
Extract from T those types that are assignable to U
Extract<function (type parameter) A in type TagHandlers<A extends TaggedEvent, E, R>A, { readonly _tag: K extends A["_tag"]_tag: function (type parameter) KK }>,
) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<void, function (type parameter) E in type TagHandlers<A extends TaggedEvent, E, R>E, function (type parameter) R in type TagHandlers<A extends TaggedEvent, E, R>R>;
}>;