| name | effect-facet-sink-reducing |
| description | Guidance for facet `effect/Sink#reducing` focused on APIs like map, fail, and make. Load after `effect-skill-router` when this facet is the primary owner. |
Effect Facet Sink#reducing
Owned scope
- Owns only
effect/Sink#reducing.
- Parent module:
effect/Sink.
What it is for
- reduce/fold aggregation behavior. Module-specific APIs and usage patterns for Effect programs.
API quick reference
map
fail
make
mapEnd
flatMap
succeed
failSync
mapError
mapInput
failCause
fromQueue
mapEffect
fromEffect
fromPubSub
fromChannel
mapLeftover
mapEffectEnd
failCauseSync
- Full API list:
references/api-reference.md
How to use it
- Keep work focused on the
reducing concern for effect/Sink.
- Start with constructor-style APIs to build values/services before composing operations.
- Prefer pipe-based composition to keep transformations explicit and testable.
- Treat stateful APIs as synchronization boundaries and keep updates atomic.
- Keep runtime/execute APIs at edges; compose pure transformations before execution.
Starter example
import { Effect } from "effect";
import * as Sink from "effect/Sink";
import * as Stream from "effect/Stream";
const sink: Sink.Sink<number> = Sink.succeed(42);
const stream = Stream.make(1, 2, 3);
const program = Stream.run(stream, sink);
Effect.runPromise(program).then(console.log);
Common pitfalls
- Prefer explicit, typed combinators over ad-hoc casting or unchecked assumptions.
Not covered here
- Sibling facets under the same parent are out of scope:
effect-facet-sink-core (effect/Sink#core)
effect-facet-sink-transforms (effect/Sink#transforms)
- Parent module ownership belongs to
effect-module-sink.
Escalate to
effect-module-sink for parent module-wide workflows.
effect-skill-router for cross-module routing and ownership checks.
Reference anchors
- Parent tests:
packages/effect/test/Sink.test.ts
- Parent tests:
packages/effect/test/unstable/process/ChildProcess.test.ts
- API details:
references/api-reference.md
- Usage notes:
references/usage-reference.md
- Ownership mapping:
references/owner.md