/** * @since 2.0.0 */ import * as RA from "./Array.js"; import type { NonEmptyReadonlyArray } from "./Array.js"; import type { Either } from "./Either.js"; import * as Equal from "./Equal.js"; import * as Equivalence from "./Equivalence.js"; import type { TypeLambda } from "./HKT.js"; import { type Inspectable } from "./Inspectable.js"; import type { NonEmptyIterable } from "./NonEmptyIterable.js"; import type { Option } from "./Option.js"; import * as Order from "./Order.js"; import type { Pipeable } from "./Pipeable.js"; import { type Predicate, type Refinement } from "./Predicate.js"; import type { Covariant, NoInfer } from "./Types.js"; declare const TypeId: unique symbol; /** * @category symbol * @since 2.0.0 */ export type TypeId = typeof TypeId; /** * @category models * @since 2.0.0 */ export interface Chunk extends Iterable, Equal.Equal, Pipeable, Inspectable { readonly [TypeId]: { readonly _A: Covariant; }; readonly length: number; } /** * @category model * @since 2.0.0 */ export interface NonEmptyChunk extends Chunk, NonEmptyIterable { } /** * @category type lambdas * @since 2.0.0 */ export interface ChunkTypeLambda extends TypeLambda { readonly type: Chunk; } /** * Compares the two chunks of equal length using the specified function * * @category equivalence * @since 2.0.0 */ export declare const getEquivalence: (isEquivalent: Equivalence.Equivalence) => Equivalence.Equivalence>; /** * Checks if `u` is a `Chunk` * * @category constructors * @since 2.0.0 */ export declare const isChunk: { /** * Checks if `u` is a `Chunk` * * @category constructors * @since 2.0.0 */ (u: Iterable): u is Chunk; /** * Checks if `u` is a `Chunk` * * @category constructors * @since 2.0.0 */ (u: unknown): u is Chunk; }; /** * @category constructors * @since 2.0.0 */ export declare const empty: () => Chunk; /** * Builds a `NonEmptyChunk` from an non-empty collection of elements. * * @category constructors * @since 2.0.0 */ export declare const make: ]>(...as: As) => NonEmptyChunk; /** * Builds a `NonEmptyChunk` from a single element. * * @category constructors * @since 2.0.0 */ export declare const of: (a: A) => NonEmptyChunk; /** * Creates a new `Chunk` from an iterable collection of values. * * @category constructors * @since 2.0.0 */ export declare const fromIterable: (self: Iterable) => Chunk; /** * Converts a `Chunk` into an `Array`. If the provided `Chunk` is non-empty * (`NonEmptyChunk`), the function will return a `NonEmptyArray`, ensuring the * non-empty property is preserved. * * @category conversions * @since 2.0.0 */ export declare const toArray: >(self: S) => S extends NonEmptyChunk ? RA.NonEmptyArray> : Array>; /** * Converts a `Chunk` into a `ReadonlyArray`. If the provided `Chunk` is * non-empty (`NonEmptyChunk`), the function will return a * `NonEmptyReadonlyArray`, ensuring the non-empty property is preserved. * * @category conversions * @since 2.0.0 */ export declare const toReadonlyArray: >(self: S) => S extends NonEmptyChunk ? RA.NonEmptyReadonlyArray> : ReadonlyArray>; /** * Reverses the order of elements in a `Chunk`. * Importantly, if the input chunk is a `NonEmptyChunk`, the reversed chunk will also be a `NonEmptyChunk`. * * **Example** * * ```ts * import { Chunk } from "effect" * * const chunk = Chunk.make(1, 2, 3) * const result = Chunk.reverse(chunk) * * console.log(result) * // { _id: 'Chunk', values: [ 3, 2, 1 ] } * ``` * * @since 2.0.0 * @category elements */ export declare const reverse: >(self: S) => Chunk.With>; /** * This function provides a safe way to read a value at a particular index from a `Chunk`. * * @category elements * @since 2.0.0 */ export declare const get: { /** * This function provides a safe way to read a value at a particular index from a `Chunk`. * * @category elements * @since 2.0.0 */ (index: number): (self: Chunk) => Option; /** * This function provides a safe way to read a value at a particular index from a `Chunk`. * * @category elements * @since 2.0.0 */ (self: Chunk, index: number): Option; }; /** * Wraps an array into a chunk without copying, unsafe on mutable arrays * * @since 2.0.0 * @category unsafe */ export declare const unsafeFromArray: (self: ReadonlyArray) => Chunk; /** * Wraps an array into a chunk without copying, unsafe on mutable arrays * * @since 2.0.0 * @category unsafe */ export declare const unsafeFromNonEmptyArray: (self: NonEmptyReadonlyArray) => NonEmptyChunk; /** * Gets an element unsafely, will throw on out of bounds * * @since 2.0.0 * @category unsafe */ export declare const unsafeGet: { /** * Gets an element unsafely, will throw on out of bounds * * @since 2.0.0 * @category unsafe */ (index: number): (self: Chunk) => A; /** * Gets an element unsafely, will throw on out of bounds * * @since 2.0.0 * @category unsafe */ (self: Chunk, index: number): A; }; /** * Appends the specified element to the end of the `Chunk`. * * @category concatenating * @since 2.0.0 */ export declare const append: { /** * Appends the specified element to the end of the `Chunk`. * * @category concatenating * @since 2.0.0 */ (a: A2): (self: Chunk) => NonEmptyChunk; /** * Appends the specified element to the end of the `Chunk`. * * @category concatenating * @since 2.0.0 */ (self: Chunk, a: A2): NonEmptyChunk; }; /** * Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`. * * @category concatenating * @since 2.0.0 */ export declare const prepend: { /** * Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`. * * @category concatenating * @since 2.0.0 */ (elem: B): (self: Chunk) => NonEmptyChunk; /** * Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`. * * @category concatenating * @since 2.0.0 */ (self: Chunk, elem: B): NonEmptyChunk; }; /** * Takes the first up to `n` elements from the chunk * * @since 2.0.0 */ export declare const take: { /** * Takes the first up to `n` elements from the chunk * * @since 2.0.0 */ (n: number): (self: Chunk) => Chunk; /** * Takes the first up to `n` elements from the chunk * * @since 2.0.0 */ (self: Chunk, n: number): Chunk; }; /** * Drops the first up to `n` elements from the chunk * * @since 2.0.0 */ export declare const drop: { /** * Drops the first up to `n` elements from the chunk * * @since 2.0.0 */ (n: number): (self: Chunk) => Chunk; /** * Drops the first up to `n` elements from the chunk * * @since 2.0.0 */ (self: Chunk, n: number): Chunk; }; /** * Drops the last `n` elements. * * @since 2.0.0 */ export declare const dropRight: { /** * Drops the last `n` elements. * * @since 2.0.0 */ (n: number): (self: Chunk) => Chunk; /** * Drops the last `n` elements. * * @since 2.0.0 */ (self: Chunk, n: number): Chunk; }; /** * Drops all elements so long as the predicate returns true. * * @since 2.0.0 */ export declare const dropWhile: { /** * Drops all elements so long as the predicate returns true. * * @since 2.0.0 */ (predicate: Predicate>): (self: Chunk) => Chunk; /** * Drops all elements so long as the predicate returns true. * * @since 2.0.0 */ (self: Chunk, predicate: Predicate): Chunk; }; /** * Prepends the specified prefix chunk to the beginning of the specified chunk. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.prependAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ "a", "b", 1, 2 ] * ``` * * @category concatenating * @since 2.0.0 */ export declare const prependAll: { /** * Prepends the specified prefix chunk to the beginning of the specified chunk. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.prependAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ "a", "b", 1, 2 ] * ``` * * @category concatenating * @since 2.0.0 */ , T extends Chunk>(that: T): (self: S) => Chunk.OrNonEmpty | Chunk.Infer>; /** * Prepends the specified prefix chunk to the beginning of the specified chunk. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.prependAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ "a", "b", 1, 2 ] * ``` * * @category concatenating * @since 2.0.0 */ (self: Chunk, that: NonEmptyChunk): NonEmptyChunk; /** * Prepends the specified prefix chunk to the beginning of the specified chunk. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.prependAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ "a", "b", 1, 2 ] * ``` * * @category concatenating * @since 2.0.0 */ (self: NonEmptyChunk, that: Chunk): NonEmptyChunk; /** * Prepends the specified prefix chunk to the beginning of the specified chunk. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.prependAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ "a", "b", 1, 2 ] * ``` * * @category concatenating * @since 2.0.0 */ (self: Chunk, that: Chunk): Chunk; }; /** * Concatenates two chunks, combining their elements. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ 1, 2, "a", "b" ] * ``` * * @category concatenating * @since 2.0.0 */ export declare const appendAll: { /** * Concatenates two chunks, combining their elements. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ 1, 2, "a", "b" ] * ``` * * @category concatenating * @since 2.0.0 */ , T extends Chunk>(that: T): (self: S) => Chunk.OrNonEmpty | Chunk.Infer>; /** * Concatenates two chunks, combining their elements. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ 1, 2, "a", "b" ] * ``` * * @category concatenating * @since 2.0.0 */ (self: Chunk, that: NonEmptyChunk): NonEmptyChunk; /** * Concatenates two chunks, combining their elements. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ 1, 2, "a", "b" ] * ``` * * @category concatenating * @since 2.0.0 */ (self: NonEmptyChunk, that: Chunk): NonEmptyChunk; /** * Concatenates two chunks, combining their elements. * If either chunk is non-empty, the result is also a non-empty chunk. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.make(1, 2).pipe(Chunk.appendAll(Chunk.make("a", "b")), Chunk.toArray) * * console.log(result) * // [ 1, 2, "a", "b" ] * ``` * * @category concatenating * @since 2.0.0 */ (self: Chunk, that: Chunk): Chunk; }; /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ export declare const filterMap: { /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ (f: (a: A, i: number) => Option): (self: Chunk) => Chunk; /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ (self: Chunk, f: (a: A, i: number) => Option): Chunk; }; /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ export declare const filter: { /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ (refinement: Refinement, B>): (self: Chunk) => Chunk; /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ (predicate: Predicate>): (self: Chunk) => Chunk; /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ (self: Chunk, refinement: Refinement): Chunk; /** * Returns a filtered and mapped subset of the elements. * * @since 2.0.0 * @category filtering */ (self: Chunk, predicate: Predicate): Chunk; }; /** * Transforms all elements of the chunk for as long as the specified function returns some value * * @since 2.0.0 * @category filtering */ export declare const filterMapWhile: { /** * Transforms all elements of the chunk for as long as the specified function returns some value * * @since 2.0.0 * @category filtering */ (f: (a: A) => Option): (self: Chunk) => Chunk; /** * Transforms all elements of the chunk for as long as the specified function returns some value * * @since 2.0.0 * @category filtering */ (self: Chunk, f: (a: A) => Option): Chunk; }; /** * Filter out optional values * * @since 2.0.0 * @category filtering */ export declare const compact: (self: Chunk>) => Chunk; /** * Applies a function to each element in a chunk and returns a new chunk containing the concatenated mapped elements. * * @since 2.0.0 * @category sequencing */ export declare const flatMap: { /** * Applies a function to each element in a chunk and returns a new chunk containing the concatenated mapped elements. * * @since 2.0.0 * @category sequencing */ , T extends Chunk>(f: (a: Chunk.Infer, i: number) => T): (self: S) => Chunk.AndNonEmpty>; /** * Applies a function to each element in a chunk and returns a new chunk containing the concatenated mapped elements. * * @since 2.0.0 * @category sequencing */ (self: NonEmptyChunk, f: (a: A, i: number) => NonEmptyChunk): NonEmptyChunk; /** * Applies a function to each element in a chunk and returns a new chunk containing the concatenated mapped elements. * * @since 2.0.0 * @category sequencing */ (self: Chunk, f: (a: A, i: number) => Chunk): Chunk; }; /** * Iterates over each element of a `Chunk` and applies a function to it. * * **Details** * * This function processes every element of the given `Chunk`, calling the * provided function `f` on each element. It does not return a new value; * instead, it is primarily used for side effects, such as logging or * accumulating data in an external variable. * * @since 2.0.0 * @category combinators */ export declare const forEach: { /** * Iterates over each element of a `Chunk` and applies a function to it. * * **Details** * * This function processes every element of the given `Chunk`, calling the * provided function `f` on each element. It does not return a new value; * instead, it is primarily used for side effects, such as logging or * accumulating data in an external variable. * * @since 2.0.0 * @category combinators */ (f: (a: A, index: number) => B): (self: Chunk) => void; /** * Iterates over each element of a `Chunk` and applies a function to it. * * **Details** * * This function processes every element of the given `Chunk`, calling the * provided function `f` on each element. It does not return a new value; * instead, it is primarily used for side effects, such as logging or * accumulating data in an external variable. * * @since 2.0.0 * @category combinators */ (self: Chunk, f: (a: A, index: number) => B): void; }; /** * Flattens a chunk of chunks into a single chunk by concatenating all chunks. * * @since 2.0.0 * @category sequencing */ export declare const flatten: >>(self: S) => Chunk.Flatten; /** * Groups elements in chunks of up to `n` elements. * * @since 2.0.0 * @category elements */ export declare const chunksOf: { /** * Groups elements in chunks of up to `n` elements. * * @since 2.0.0 * @category elements */ (n: number): (self: Chunk) => Chunk>; /** * Groups elements in chunks of up to `n` elements. * * @since 2.0.0 * @category elements */ (self: Chunk, n: number): Chunk>; }; /** * Creates a Chunk of unique values that are included in all given Chunks. * * The order and references of result values are determined by the Chunk. * * @since 2.0.0 * @category elements */ export declare const intersection: { /** * Creates a Chunk of unique values that are included in all given Chunks. * * The order and references of result values are determined by the Chunk. * * @since 2.0.0 * @category elements */ (that: Chunk): (self: Chunk) => Chunk; /** * Creates a Chunk of unique values that are included in all given Chunks. * * The order and references of result values are determined by the Chunk. * * @since 2.0.0 * @category elements */ (self: Chunk, that: Chunk): Chunk; }; /** * Determines if the chunk is empty. * * @since 2.0.0 * @category elements */ export declare const isEmpty: (self: Chunk) => boolean; /** * Determines if the chunk is not empty. * * @since 2.0.0 * @category elements */ export declare const isNonEmpty: (self: Chunk) => self is NonEmptyChunk; /** * Returns the first element of this chunk if it exists. * * @since 2.0.0 * @category elements */ export declare const head: (self: Chunk) => Option; /** * Returns the first element of this chunk. * * It will throw an error if the chunk is empty. * * @since 2.0.0 * @category unsafe */ export declare const unsafeHead: (self: Chunk) => A; /** * Returns the first element of this non empty chunk. * * @since 2.0.0 * @category elements */ export declare const headNonEmpty: (self: NonEmptyChunk) => A; /** * Returns the last element of this chunk if it exists. * * @since 2.0.0 * @category elements */ export declare const last: (self: Chunk) => Option; /** * Returns the last element of this chunk. * * It will throw an error if the chunk is empty. * * @since 2.0.0 * @category unsafe */ export declare const unsafeLast: (self: Chunk) => A; /** * Returns the last element of this non empty chunk. * * @since 3.4.0 * @category elements */ export declare const lastNonEmpty: (self: NonEmptyChunk) => A; /** * @since 2.0.0 */ export declare namespace Chunk { /** * @since 2.0.0 */ type Infer> = S extends Chunk ? A : never; /** * @since 2.0.0 */ type With, A> = S extends NonEmptyChunk ? NonEmptyChunk : Chunk; /** * @since 2.0.0 */ type OrNonEmpty, T extends Chunk, A> = S extends NonEmptyChunk ? NonEmptyChunk : T extends NonEmptyChunk ? NonEmptyChunk : Chunk; /** * @since 2.0.0 */ type AndNonEmpty, T extends Chunk, A> = S extends NonEmptyChunk ? T extends NonEmptyChunk ? NonEmptyChunk : Chunk : Chunk; /** * @since 2.0.0 */ type Flatten>> = T extends NonEmptyChunk> ? NonEmptyChunk : T extends Chunk> ? Chunk : never; } /** * Transforms the elements of a chunk using the specified mapping function. * If the input chunk is non-empty, the resulting chunk will also be non-empty. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.map(Chunk.make(1, 2), (n) => n + 1) * * console.log(result) * // { _id: 'Chunk', values: [ 2, 3 ] } * ``` * * @since 2.0.0 * @category mapping */ export declare const map: { /** * Transforms the elements of a chunk using the specified mapping function. * If the input chunk is non-empty, the resulting chunk will also be non-empty. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.map(Chunk.make(1, 2), (n) => n + 1) * * console.log(result) * // { _id: 'Chunk', values: [ 2, 3 ] } * ``` * * @since 2.0.0 * @category mapping */ , B>(f: (a: Chunk.Infer, i: number) => B): (self: S) => Chunk.With; /** * Transforms the elements of a chunk using the specified mapping function. * If the input chunk is non-empty, the resulting chunk will also be non-empty. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.map(Chunk.make(1, 2), (n) => n + 1) * * console.log(result) * // { _id: 'Chunk', values: [ 2, 3 ] } * ``` * * @since 2.0.0 * @category mapping */ (self: NonEmptyChunk, f: (a: A, i: number) => B): NonEmptyChunk; /** * Transforms the elements of a chunk using the specified mapping function. * If the input chunk is non-empty, the resulting chunk will also be non-empty. * * **Example** * * ```ts * import { Chunk } from "effect" * * const result = Chunk.map(Chunk.make(1, 2), (n) => n + 1) * * console.log(result) * // { _id: 'Chunk', values: [ 2, 3 ] } * ``` * * @since 2.0.0 * @category mapping */ (self: Chunk, f: (a: A, i: number) => B): Chunk; }; /** * Statefully maps over the chunk, producing new elements of type `B`. * * @since 2.0.0 * @category folding */ export declare const mapAccum: { /** * Statefully maps over the chunk, producing new elements of type `B`. * * @since 2.0.0 * @category folding */ (s: S, f: (s: S, a: A) => readonly [S, B]): (self: Chunk) => [S, Chunk]; /** * Statefully maps over the chunk, producing new elements of type `B`. * * @since 2.0.0 * @category folding */ (self: Chunk, s: S, f: (s: S, a: A) => readonly [S, B]): [S, Chunk]; }; /** * Separate elements based on a predicate that also exposes the index of the element. * * @category filtering * @since 2.0.0 */ export declare const partition: { /** * Separate elements based on a predicate that also exposes the index of the element. * * @category filtering * @since 2.0.0 */ (refinement: (a: NoInfer, i: number) => a is B): (self: Chunk) => [excluded: Chunk>, satisfying: Chunk]; /** * Separate elements based on a predicate that also exposes the index of the element. * * @category filtering * @since 2.0.0 */ (predicate: (a: NoInfer, i: number) => boolean): (self: Chunk) => [excluded: Chunk, satisfying: Chunk]; /** * Separate elements based on a predicate that also exposes the index of the element. * * @category filtering * @since 2.0.0 */ (self: Chunk, refinement: (a: A, i: number) => a is B): [excluded: Chunk>, satisfying: Chunk]; /** * Separate elements based on a predicate that also exposes the index of the element. * * @category filtering * @since 2.0.0 */ (self: Chunk, predicate: (a: A, i: number) => boolean): [excluded: Chunk, satisfying: Chunk]; }; /** * Partitions the elements of this chunk into two chunks using f. * * @category filtering * @since 2.0.0 */ export declare const partitionMap: { /** * Partitions the elements of this chunk into two chunks using f. * * @category filtering * @since 2.0.0 */ (f: (a: A) => Either): (self: Chunk) => [left: Chunk, right: Chunk]; /** * Partitions the elements of this chunk into two chunks using f. * * @category filtering * @since 2.0.0 */ (self: Chunk, f: (a: A) => Either): [left: Chunk, right: Chunk]; }; /** * Partitions the elements of this chunk into two chunks. * * @category filtering * @since 2.0.0 */ export declare const separate: (self: Chunk>) => [Chunk, Chunk]; /** * Retireves the size of the chunk * * @since 2.0.0 * @category elements */ export declare const size: (self: Chunk) => number; /** * Sort the elements of a Chunk in increasing order, creating a new Chunk. * * @since 2.0.0 * @category sorting */ export declare const sort: { /** * Sort the elements of a Chunk in increasing order, creating a new Chunk. * * @since 2.0.0 * @category sorting */ (O: Order.Order): (self: Chunk) => Chunk; /** * Sort the elements of a Chunk in increasing order, creating a new Chunk. * * @since 2.0.0 * @category sorting */ (self: Chunk, O: Order.Order): Chunk; }; /** * @since 2.0.0 * @category sorting */ export declare const sortWith: { /** * @since 2.0.0 * @category sorting */ (f: (a: A) => B, order: Order.Order): (self: Chunk) => Chunk; /** * @since 2.0.0 * @category sorting */ (self: Chunk, f: (a: A) => B, order: Order.Order): Chunk; }; /** * Returns two splits of this chunk at the specified index. * * @since 2.0.0 * @category splitting */ export declare const splitAt: { /** * Returns two splits of this chunk at the specified index. * * @since 2.0.0 * @category splitting */ (n: number): (self: Chunk) => [beforeIndex: Chunk, fromIndex: Chunk]; /** * Returns two splits of this chunk at the specified index. * * @since 2.0.0 * @category splitting */ (self: Chunk, n: number): [beforeIndex: Chunk, fromIndex: Chunk]; }; /** * Splits a `NonEmptyChunk` into two segments, with the first segment containing a maximum of `n` elements. * The value of `n` must be `>= 1`. * * @category splitting * @since 2.0.0 */ export declare const splitNonEmptyAt: { /** * Splits a `NonEmptyChunk` into two segments, with the first segment containing a maximum of `n` elements. * The value of `n` must be `>= 1`. * * @category splitting * @since 2.0.0 */ (n: number): (self: NonEmptyChunk) => [beforeIndex: NonEmptyChunk, fromIndex: Chunk]; /** * Splits a `NonEmptyChunk` into two segments, with the first segment containing a maximum of `n` elements. * The value of `n` must be `>= 1`. * * @category splitting * @since 2.0.0 */ (self: NonEmptyChunk, n: number): [beforeIndex: NonEmptyChunk, fromIndex: Chunk]; }; /** * Splits this chunk into `n` equally sized chunks. * * @since 2.0.0 * @category splitting */ export declare const split: { /** * Splits this chunk into `n` equally sized chunks. * * @since 2.0.0 * @category splitting */ (n: number): (self: Chunk) => Chunk>; /** * Splits this chunk into `n` equally sized chunks. * * @since 2.0.0 * @category splitting */ (self: Chunk, n: number): Chunk>; }; /** * Splits this chunk on the first element that matches this predicate. * Returns a tuple containing two chunks: the first one is before the match, and the second one is from the match onward. * * @category splitting * @since 2.0.0 */ export declare const splitWhere: { /** * Splits this chunk on the first element that matches this predicate. * Returns a tuple containing two chunks: the first one is before the match, and the second one is from the match onward. * * @category splitting * @since 2.0.0 */ (predicate: Predicate>): (self: Chunk) => [beforeMatch: Chunk, fromMatch: Chunk]; /** * Splits this chunk on the first element that matches this predicate. * Returns a tuple containing two chunks: the first one is before the match, and the second one is from the match onward. * * @category splitting * @since 2.0.0 */ (self: Chunk, predicate: Predicate): [beforeMatch: Chunk, fromMatch: Chunk]; }; /** * Returns every elements after the first. * * @since 2.0.0 * @category elements */ export declare const tail: (self: Chunk) => Option>; /** * Returns every elements after the first. * * @since 2.0.0 * @category elements */ export declare const tailNonEmpty: (self: NonEmptyChunk) => Chunk; /** * Takes the last `n` elements. * * @since 2.0.0 * @category elements */ export declare const takeRight: { /** * Takes the last `n` elements. * * @since 2.0.0 * @category elements */ (n: number): (self: Chunk) => Chunk; /** * Takes the last `n` elements. * * @since 2.0.0 * @category elements */ (self: Chunk, n: number): Chunk; }; /** * Takes all elements so long as the predicate returns true. * * @since 2.0.0 * @category elements */ export declare const takeWhile: { /** * Takes all elements so long as the predicate returns true. * * @since 2.0.0 * @category elements */ (refinement: Refinement, B>): (self: Chunk) => Chunk; /** * Takes all elements so long as the predicate returns true. * * @since 2.0.0 * @category elements */ (predicate: Predicate>): (self: Chunk) => Chunk; /** * Takes all elements so long as the predicate returns true. * * @since 2.0.0 * @category elements */ (self: Chunk, refinement: Refinement): Chunk; /** * Takes all elements so long as the predicate returns true. * * @since 2.0.0 * @category elements */ (self: Chunk, predicate: Predicate): Chunk; }; /** * Creates a Chunks of unique values, in order, from all given Chunks. * * @since 2.0.0 * @category elements */ export declare const union: { /** * Creates a Chunks of unique values, in order, from all given Chunks. * * @since 2.0.0 * @category elements */ (that: Chunk): (self: Chunk) => Chunk; /** * Creates a Chunks of unique values, in order, from all given Chunks. * * @since 2.0.0 * @category elements */ (self: Chunk, that: Chunk): Chunk; }; /** * Remove duplicates from an array, keeping the first occurrence of an element. * * @since 2.0.0 * @category elements */ export declare const dedupe: (self: Chunk) => Chunk; /** * Deduplicates adjacent elements that are identical. * * @since 2.0.0 * @category filtering */ export declare const dedupeAdjacent: (self: Chunk) => Chunk; /** * Takes a `Chunk` of pairs and return two corresponding `Chunk`s. * * Note: The function is reverse of `zip`. * * @since 2.0.0 * @category elements */ export declare const unzip: (self: Chunk) => [Chunk, Chunk]; /** * Zips this chunk pointwise with the specified chunk using the specified combiner. * * @since 2.0.0 * @category zipping */ export declare const zipWith: { /** * Zips this chunk pointwise with the specified chunk using the specified combiner. * * @since 2.0.0 * @category zipping */ (that: Chunk, f: (a: A, b: B) => C): (self: Chunk) => Chunk; /** * Zips this chunk pointwise with the specified chunk using the specified combiner. * * @since 2.0.0 * @category zipping */ (self: Chunk, that: Chunk, f: (a: A, b: B) => C): Chunk; }; /** * Zips this chunk pointwise with the specified chunk. * * @since 2.0.0 * @category zipping */ export declare const zip: { /** * Zips this chunk pointwise with the specified chunk. * * @since 2.0.0 * @category zipping */ (that: Chunk): (self: Chunk) => Chunk<[A, B]>; /** * Zips this chunk pointwise with the specified chunk. * * @since 2.0.0 * @category zipping */ (self: Chunk, that: Chunk): Chunk<[A, B]>; }; /** * Delete the element at the specified index, creating a new `Chunk`. * * @since 2.0.0 */ export declare const remove: { /** * Delete the element at the specified index, creating a new `Chunk`. * * @since 2.0.0 */ (i: number): (self: Chunk) => Chunk; /** * Delete the element at the specified index, creating a new `Chunk`. * * @since 2.0.0 */ (self: Chunk, i: number): Chunk; }; /** * @since 3.16.0 */ export declare const removeOption: { /** * @since 3.16.0 */ (i: number): (self: Chunk) => Option>; /** * @since 3.16.0 */ (self: Chunk, i: number): Option>; }; /** * @since 2.0.0 */ export declare const modifyOption: { /** * @since 2.0.0 */ (i: number, f: (a: A) => B): (self: Chunk) => Option>; /** * @since 2.0.0 */ (self: Chunk, i: number, f: (a: A) => B): Option>; }; /** * Apply a function to the element at the specified index, creating a new `Chunk`, * or returning the input if the index is out of bounds. * * @since 2.0.0 */ export declare const modify: { /** * Apply a function to the element at the specified index, creating a new `Chunk`, * or returning the input if the index is out of bounds. * * @since 2.0.0 */ (i: number, f: (a: A) => B): (self: Chunk) => Chunk; /** * Apply a function to the element at the specified index, creating a new `Chunk`, * or returning the input if the index is out of bounds. * * @since 2.0.0 */ (self: Chunk, i: number, f: (a: A) => B): Chunk; }; /** * Change the element at the specified index, creating a new `Chunk`, * or returning the input if the index is out of bounds. * * @since 2.0.0 */ export declare const replace: { /** * Change the element at the specified index, creating a new `Chunk`, * or returning the input if the index is out of bounds. * * @since 2.0.0 */ (i: number, b: B): (self: Chunk) => Chunk; /** * Change the element at the specified index, creating a new `Chunk`, * or returning the input if the index is out of bounds. * * @since 2.0.0 */ (self: Chunk, i: number, b: B): Chunk; }; /** * @since 2.0.0 */ export declare const replaceOption: { /** * @since 2.0.0 */ (i: number, b: B): (self: Chunk) => Option>; /** * @since 2.0.0 */ (self: Chunk, i: number, b: B): Option>; }; /** * Return a Chunk of length n with element i initialized with f(i). * * **Note**. `n` is normalized to an integer >= 1. * * @category constructors * @since 2.0.0 */ export declare const makeBy: { /** * Return a Chunk of length n with element i initialized with f(i). * * **Note**. `n` is normalized to an integer >= 1. * * @category constructors * @since 2.0.0 */ (f: (i: number) => A): (n: number) => NonEmptyChunk; /** * Return a Chunk of length n with element i initialized with f(i). * * **Note**. `n` is normalized to an integer >= 1. * * @category constructors * @since 2.0.0 */ (n: number, f: (i: number) => A): NonEmptyChunk; }; /** * Create a non empty `Chunk` containing a range of integers, including both endpoints. * * @category constructors * @since 2.0.0 */ export declare const range: (start: number, end: number) => NonEmptyChunk; /** * Returns a function that checks if a `Chunk` contains a given value using the default `Equivalence`. * * @category elements * @since 2.0.0 */ export declare const contains: { /** * Returns a function that checks if a `Chunk` contains a given value using the default `Equivalence`. * * @category elements * @since 2.0.0 */ (a: A): (self: Chunk) => boolean; /** * Returns a function that checks if a `Chunk` contains a given value using the default `Equivalence`. * * @category elements * @since 2.0.0 */ (self: Chunk, a: A): boolean; }; /** * Returns a function that checks if a `Chunk` contains a given value using a provided `isEquivalent` function. * * @category elements * @since 2.0.0 */ export declare const containsWith: (isEquivalent: (self: A, that: A) => boolean) => { (a: A): (self: Chunk) => boolean; (self: Chunk, a: A): boolean; }; /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * * @category elements * @since 2.0.0 */ export declare const findFirst: { /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * * @category elements * @since 2.0.0 */ (refinement: Refinement, B>): (self: Chunk) => Option; /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * * @category elements * @since 2.0.0 */ (predicate: Predicate>): (self: Chunk) => Option; /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * * @category elements * @since 2.0.0 */ (self: Chunk, refinement: Refinement): Option; /** * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * * @category elements * @since 2.0.0 */ (self: Chunk, predicate: Predicate): Option; }; /** * Return the first index for which a predicate holds. * * @category elements * @since 2.0.0 */ export declare const findFirstIndex: { /** * Return the first index for which a predicate holds. * * @category elements * @since 2.0.0 */ (predicate: Predicate): (self: Chunk) => Option; /** * Return the first index for which a predicate holds. * * @category elements * @since 2.0.0 */ (self: Chunk, predicate: Predicate): Option; }; /** * Find the last element for which a predicate holds. * * @category elements * @since 2.0.0 */ export declare const findLast: { /** * Find the last element for which a predicate holds. * * @category elements * @since 2.0.0 */ (refinement: Refinement, B>): (self: Chunk) => Option; /** * Find the last element for which a predicate holds. * * @category elements * @since 2.0.0 */ (predicate: Predicate>): (self: Chunk) => Option; /** * Find the last element for which a predicate holds. * * @category elements * @since 2.0.0 */ (self: Chunk, refinement: Refinement): Option; /** * Find the last element for which a predicate holds. * * @category elements * @since 2.0.0 */ (self: Chunk, predicate: Predicate): Option; }; /** * Return the last index for which a predicate holds. * * @category elements * @since 2.0.0 */ export declare const findLastIndex: { /** * Return the last index for which a predicate holds. * * @category elements * @since 2.0.0 */ (predicate: Predicate): (self: Chunk) => Option; /** * Return the last index for which a predicate holds. * * @category elements * @since 2.0.0 */ (self: Chunk, predicate: Predicate): Option; }; /** * Check if a predicate holds true for every `Chunk` element. * * @category elements * @since 2.0.0 */ export declare const every: { /** * Check if a predicate holds true for every `Chunk` element. * * @category elements * @since 2.0.0 */ (refinement: Refinement, B>): (self: Chunk) => self is Chunk; /** * Check if a predicate holds true for every `Chunk` element. * * @category elements * @since 2.0.0 */ (predicate: Predicate): (self: Chunk) => boolean; /** * Check if a predicate holds true for every `Chunk` element. * * @category elements * @since 2.0.0 */ (self: Chunk, refinement: Refinement): self is Chunk; /** * Check if a predicate holds true for every `Chunk` element. * * @category elements * @since 2.0.0 */ (self: Chunk, predicate: Predicate): boolean; }; /** * Check if a predicate holds true for some `Chunk` element. * * @category elements * @since 2.0.0 */ export declare const some: { /** * Check if a predicate holds true for some `Chunk` element. * * @category elements * @since 2.0.0 */ (predicate: Predicate>): (self: Chunk) => self is NonEmptyChunk; /** * Check if a predicate holds true for some `Chunk` element. * * @category elements * @since 2.0.0 */ (self: Chunk, predicate: Predicate): self is NonEmptyChunk; }; /** * Joins the elements together with "sep" in the middle. * * @category folding * @since 2.0.0 */ export declare const join: { /** * Joins the elements together with "sep" in the middle. * * @category folding * @since 2.0.0 */ (sep: string): (self: Chunk) => string; /** * Joins the elements together with "sep" in the middle. * * @category folding * @since 2.0.0 */ (self: Chunk, sep: string): string; }; /** * @category folding * @since 2.0.0 */ export declare const reduce: { /** * @category folding * @since 2.0.0 */ (b: B, f: (b: B, a: A, i: number) => B): (self: Chunk) => B; /** * @category folding * @since 2.0.0 */ (self: Chunk, b: B, f: (b: B, a: A, i: number) => B): B; }; /** * @category folding * @since 2.0.0 */ export declare const reduceRight: { /** * @category folding * @since 2.0.0 */ (b: B, f: (b: B, a: A, i: number) => B): (self: Chunk) => B; /** * @category folding * @since 2.0.0 */ (self: Chunk, b: B, f: (b: B, a: A, i: number) => B): B; }; /** * Creates a `Chunk` of values not included in the other given `Chunk` using the provided `isEquivalent` function. * The order and references of result values are determined by the first `Chunk`. * * @since 3.2.0 */ export declare const differenceWith: (isEquivalent: (self: A, that: A) => boolean) => { (that: Chunk): (self: Chunk) => Chunk; (self: Chunk, that: Chunk): Chunk; }; /** * Creates a `Chunk` of values not included in the other given `Chunk`. * The order and references of result values are determined by the first `Chunk`. * * @since 3.2.0 */ export declare const difference: { /** * Creates a `Chunk` of values not included in the other given `Chunk`. * The order and references of result values are determined by the first `Chunk`. * * @since 3.2.0 */ (that: Chunk): (self: Chunk) => Chunk; /** * Creates a `Chunk` of values not included in the other given `Chunk`. * The order and references of result values are determined by the first `Chunk`. * * @since 3.2.0 */ (self: Chunk, that: Chunk): Chunk; }; export {}; //# sourceMappingURL=Chunk.d.ts.map