# RefArray.head

Gets the first element of a `RefArray` as a `Filtered`.

## Signatures

```ts
export declare const head: <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>;
```

## Why

Models the possibly absent result of head as Filtered state, so absence stays explicit while
later source versions can make a value available.

## Ownership and lifetime

The head view retains no independent value. Its Effect read fails with NoSuchElement
while absent; the observing Scope owns and finalizes its Fx subscription.

## Examples

```ts
import { Effect } from "effect"
import * as RefArray from "@typed/fx/RefArray"

const program = Effect.gen(function* () {
  const items = yield* RefArray.make([1, 2, 3, 4, 5])

  const head = RefArray.head(items)
  const value = yield* head
  console.log(value) // 1

  // If array becomes empty, Filtered will fail
  yield* RefArray.set(items, [])
  // yield* head would fail with NoSuchElementError
})
```
