<A>(self: Chunk<A>): self is NonEmptyChunk<A>Determines if the chunk is not empty.
Example (Checking for non-empty chunks)
import { Chunk } from "effect"
console.log(Chunk.isNonEmpty(Chunk.empty())) // false
console.log(Chunk.isNonEmpty(Chunk.make(1, 2, 3))) // trueelements
Source effect/Chunk.ts:13891 lines
export const const isNonEmpty: <A>(
self: Chunk<A>
) => self is NonEmptyChunk<A>
Determines if the chunk is not empty.
Example (Checking for non-empty chunks)
import { Chunk } from "effect"
console.log(Chunk.isNonEmpty(Chunk.empty())) // false
console.log(Chunk.isNonEmpty(Chunk.make(1, 2, 3))) // true
isNonEmpty = <function (type parameter) A in <A>(self: Chunk<A>): self is NonEmptyChunk<A>A>(self: Chunk<A>(parameter) self: {
length: number;
right: Chunk<A>;
left: Chunk<A>;
backing: Backing<A>;
depth: number;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: interface Chunk<out A>A Chunk is an immutable, ordered collection optimized for efficient concatenation and access patterns.
Example (Inspecting chunk values)
import { Chunk } from "effect"
const chunk: Chunk.Chunk<number> = Chunk.make(1, 2, 3)
console.log(chunk.length) // 3
console.log(Chunk.toArray(chunk)) // [1, 2, 3]
A namespace containing utility types for Chunk operations.
Example (Working with Chunk utility types)
import type { Chunk } from "effect"
// Extract the element type from a Chunk
declare const chunk: Chunk.Chunk<string>
type ElementType = Chunk.Chunk.Infer<typeof chunk> // string
// Create a preserving non-emptiness
declare const nonEmptyChunk: Chunk.NonEmptyChunk<number>
type WithString = Chunk.Chunk.With<typeof nonEmptyChunk, string> // Chunk.NonEmptyChunk<string>
Chunk<function (type parameter) A in <A>(self: Chunk<A>): self is NonEmptyChunk<A>A>): self: Chunk<A>self is interface NonEmptyChunk<out A>A non-empty Chunk guaranteed to contain at least one element.
Example (Working with non-empty chunks)
import { Chunk } from "effect"
const nonEmptyChunk: Chunk.NonEmptyChunk<number> = Chunk.make(1, 2, 3)
console.log(Chunk.headNonEmpty(nonEmptyChunk)) // 1
console.log(Chunk.lastNonEmpty(nonEmptyChunk)) // 3
NonEmptyChunk<function (type parameter) A in <A>(self: Chunk<A>): self is NonEmptyChunk<A>A> => self: Chunk<A>(parameter) self: {
length: number;
right: Chunk<A>;
left: Chunk<A>;
backing: Backing<A>;
depth: number;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self.Chunk<out A>.length: numberlength > 0Referenced by 2 symbols