variable / @typed/fx

Versioned.mapEffect

Transform a Versioned’s output value as both an Fx and Effect using an Effect.

Package version
2.0.0-beta.7
Category
Channel transformations
Since
1.18.0
Member of
Versioned

Import

import { Versioned } from "@typed/fx";

Access Versioned.mapEffect through the imported Versioned export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare const mapEffect: {
    <A, C, E3, R3, B, D, E4, R4>(options: {
        onFx: (a: A) => Effect.Effect<C, E3, R3>;
        onEffect: (b: B) => Effect.Effect<D, E4, R4>;
    }): <R0, E0, R, E, R2, E2>(versioned: Versioned<R0, E0, A, E, R, B, E2, R2>) => Versioned<never, never, C, E | E3, R | R3, D, E0 | E2 | E4, R0 | R2 | R4>;
    <R0, E0, A, E, R, B, E2, R2, C, E3, R3, D, E4, R4>(versioned: Versioned<R0, E0, A, E, R, B, E2, R2>, options: {
        onFx: (a: A) => Effect.Effect<C, E3, R3>;
        onEffect: (b: B) => Effect.Effect<D, E4, R4>;
    }): Versioned<never, never, C, E | E3, R | R3, D, E0 | E2 | E4, R0 | R2 | R4>;
};

Why

Allows pushed and sampled projections to require services or fail, and exposes those additions in the corresponding output channels.

Ownership and lifetime

No subscription starts during transformation. Callback effects run when their push or read channel is consumed and are interrupted with that consumer.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source