effect-io-ai

Package: effect
Module: Array

Array.setNonEmptyHead

Change the head, creating a new NonEmptyReadonlyArray.

Example

import { Array } from "effect"

const result = Array.setNonEmptyHead([1, 2, 3], 10)
console.log(result) // [10, 2, 3]

Signature

declare const setNonEmptyHead: { <B>(b: B): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<A | B>; <A, B>(self: NonEmptyReadonlyArray<A>, b: B): NonEmptyArray<A | B>; }

Source

Since v2.0.0