(sep: string): (self: Chunk<string>) => string
(self: Chunk<string>, sep: string): stringJoins the elements together with "sep" in the middle.
Example (Joining chunks into a string)
import { Chunk } from "effect"
const chunk = Chunk.make("apple", "banana", "cherry")
const result = Chunk.join(chunk, ", ")
console.log(result) // "apple, banana, cherry"
// With different separator
const withPipe = Chunk.join(chunk, " | ")
console.log(withPipe) // "apple | banana | cherry"
// Empty chunk
const empty = Chunk.empty<string>()
console.log(Chunk.join(empty, ", ")) // ""
// Single element
const single = Chunk.make("hello")
console.log(Chunk.join(single, ", ")) // "hello"folding
Source effect/Chunk.ts:28304 lines
export const const join: {
(sep: string): (self: Chunk<string>) => string
(self: Chunk<string>, sep: string): string
}
Joins the elements together with "sep" in the middle.
Example (Joining chunks into a string)
import { Chunk } from "effect"
const chunk = Chunk.make("apple", "banana", "cherry")
const result = Chunk.join(chunk, ", ")
console.log(result) // "apple, banana, cherry"
// With different separator
const withPipe = Chunk.join(chunk, " | ")
console.log(withPipe) // "apple | banana | cherry"
// Empty chunk
const empty = Chunk.empty<string>()
console.log(Chunk.join(empty, ", ")) // ""
// Single element
const single = Chunk.make("hello")
console.log(Chunk.join(single, ", ")) // "hello"
join: {
(sep: stringsep: string): (self: Chunk<string>(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<string>) => string
(self: Chunk<string>(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<string>, sep: stringsep: string): string
} = import RARA.join