# flip

Exchanges a sink's typed success and failure channels.

## Signatures

```ts
export declare const flip: <A, E, R>(sink: Sink<A, E, R>) => Sink<E, A, R>;
```

## Why

Error-oriented consumers can be reused as value consumers, and vice versa, without changing the
producer-side protocol.

## Ownership and lifetime

A successful input becomes `Cause.fail` downstream. For an incoming Cause, the first typed `Fail`
reason becomes a success and every remaining reason is discarded, including later failures,
defects, or interruption reasons. A Cause with no typed failure passes through intact. The adapter
is synchronous, ordered, and resource-free; use `exit` when the whole Cause must remain observable.

## Examples

```ts
import { Effect } from "effect"
import * as Sink from "@typed/fx/Sink"
const errorsAsValues = Sink.flip(Sink.make(Effect.logError, (value: number) => Effect.log(value)))
```
