variable / @typed/fx/Sink

mapInputEffect

Alias for mapEffect, named for the input-side direction of the effectful transformation.

Package version
2.0.0-beta.7
Category
Transforming inputs
Since
1.0.0

Import

import { mapInputEffect } from "@typed/fx/Sink";

Signatures

export declare const mapInputEffect: {
    <B, A, E2, R2>(f: (b: B) => Effect.Effect<A, E2, R2>): <E, R>(sink: Sink<A, E | E2, R>) => Sink<B, E | E2, R | R2>;
    <A, E, R, B, E2, R2>(sink: Sink<A, E | E2, R>, f: (b: B) => Effect.Effect<A, E2, R2>): Sink<B, E | E2, R | R2>;
};

Why

The name highlights that Sink composition is contravariant in successful input.

Ownership and lifetime

It is exactly mapEffect: one Effect per input, with the same failures, services, ordering, and interruption behavior.

Examples

import { Effect } from "effect"
import * as Sink from "@typed/fx/Sink"
const sink = Sink.mapInputEffect(Sink.make(Effect.logError, Effect.log), (n: number) => Effect.succeed(String(n)))

Other public imports

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

Source