<A>(a: A): (self: Chunk<A>) => boolean
<A>(self: Chunk<A>, a: A): booleanReturns a function that checks if a Chunk contains a given value using the default Equivalence.
Example (Checking membership)
import { Chunk } from "effect"
const chunk = Chunk.make(1, 2, 3, 4, 5)
console.log(Chunk.contains(chunk, 3)) // true
console.log(Chunk.contains(chunk, 6)) // false
// Works with strings
const words = Chunk.make("apple", "banana", "cherry")
console.log(Chunk.contains(words, "banana")) // true
console.log(Chunk.contains(words, "grape")) // false
// Empty chunk
const empty = Chunk.empty<number>()
console.log(Chunk.contains(empty, 1)) // falseelements
Source effect/Chunk.ts:25584 lines
export const const contains: {
<A>(a: A): (self: Chunk<A>) => boolean
<A>(self: Chunk<A>, a: A): boolean
}
Returns a function that checks if a Chunk contains a given value using the default Equivalence.
Example (Checking membership)
import { Chunk } from "effect"
const chunk = Chunk.make(1, 2, 3, 4, 5)
console.log(Chunk.contains(chunk, 3)) // true
console.log(Chunk.contains(chunk, 6)) // false
// Works with strings
const words = Chunk.make("apple", "banana", "cherry")
console.log(Chunk.contains(words, "banana")) // true
console.log(Chunk.contains(words, "grape")) // false
// Empty chunk
const empty = Chunk.empty<number>()
console.log(Chunk.contains(empty, 1)) // false
contains: {
<function (type parameter) A in <A>(a: A): (self: Chunk<A>) => booleanA>(a: Aa: function (type parameter) A in <A>(a: A): (self: Chunk<A>) => booleanA): (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>(a: A): (self: Chunk<A>) => booleanA>) => boolean
<function (type parameter) A in <A>(self: Chunk<A>, a: A): booleanA>(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>, a: A): booleanA>, a: Aa: function (type parameter) A in <A>(self: Chunk<A>, a: A): booleanA): boolean
} = import RARA.contains