# last

Keeps only the last 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 last<A, E>(ref: Ref.Ref<Option.Option<A>>): Sink<A, E, never>;
```

## Why

The latest observed value can be retained independently of producer completion.

## Ownership and lifetime

The caller owns the Ref. Each success returns a lazy atomic `Ref.set`. With serialized callback
Effects the last callback wins; with concurrent execution the last set to execute wins, which may
differ from invocation order. Failures are ignored and the sink acquires no resources.

## Examples

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