Import
import { RefArray } from "@typed/fx";Access RefArray.head through the imported RefArray export. Its declaration below describes the member.
This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.
Signatures
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
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
})Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.