effect-io-ai

Package: effect
Module: Array

Array.headNonEmpty

Returns the first element of a NonEmptyReadonlyArray directly (no Option wrapper).

When to use

Use to get the first element without Option wrapping when the array is known to be non-empty.

Example (Getting the head of a non-empty array)

import { Array } from "effect"

console.log(Array.headNonEmpty([1, 2, 3, 4])) // 1

See

Signature

declare const headNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => A

Source

Since v2.0.0