# head

Keeps only the first value. Pass a `Ref<Option.Option<A>>` (e.g. `Ref.make(Option.none())`);
after running, read the result with `Ref.get(ref)`.

## Signatures

```ts
export declare function head<A, E>(ref: Ref.Ref<Option.Option<A>>): Sink<A, E, never>;
```

## Why

The first observed value can be retained in a caller-owned location without stopping the producer.

## Ownership and lifetime

The caller owns the Ref. Each success returns a lazy atomic update. The first update Effect to
execute while the Ref is `None` stores its value; that is the first callback only when the producer
executes callback Effects serially. Later updates leave `Some` unchanged. Failures are ignored.

## Examples

```ts
import { Effect, Option, Ref } from "effect"
import * as Sink from "@typed/fx/Sink"
const program = Effect.gen(function* () {
  const first = yield* Ref.make<Option.Option<number>>(Option.none())
  return Sink.head(first)
})
```
