Package: effect
Module: Chunk
Returns the first element of this non empty chunk.
Example (Getting the first element of a non-empty chunk)
import { Chunk } from "effect"
const nonEmptyChunk = Chunk.make(1, 2, 3, 4)
console.log(Chunk.headNonEmpty(nonEmptyChunk)) // 1
const singleElement = Chunk.make("hello")
console.log(Chunk.headNonEmpty(singleElement)) // "hello"
// Type safety: this function only accepts NonEmptyChunk
// Chunk.headNonEmpty(Chunk.empty()) // TypeScript error
Signature
declare const headNonEmpty: <A>(self: NonEmptyChunk<A>) => A
Since v2.0.0