Package: effect
Module: Effect
Swaps an effect’s success and failure channels.
When to use
Use to swap an Effect’s success and failure channels.
Details
For an Effect<A, E, R>, the returned effect has type Effect<E, A, R>.
Example (Swapping success and failure channels)
import { Effect } from "effect"
// ┌─── Effect<number, string, never>
// ▼
const program = Effect.fail("Oh uh!").pipe(Effect.as(2))
// ┌─── Effect<string, number, never>
// ▼
const flipped = Effect.flip(program)
Signature
declare const flip: <A, E, R>(self: Effect<A, E, R>) => Effect<E, A, R>
Since v2.0.0