/**
* @since 1.0.0
*/
import type { Either } from "@fp-ts/core/Either";
import type { TypeLambda } from "@fp-ts/core/HKT";
import type { Option } from "@fp-ts/core/Option";
import type { Predicate, Refinement } from "@fp-ts/core/Predicate";
import type { Order } from "@fp-ts/core/typeclass/Order";
import * as Equal from "@fp-ts/data/Equal";
import type { NonEmptyIterable } from "@fp-ts/data/NonEmpty";
declare const TypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
/**
* @category model
* @since 1.0.0
*/
export interface NonEmptyChunk extends Chunk, NonEmptyIterable {
}
/**
* @since 1.0.0
* @category models
*/
export interface Chunk extends Iterable, Equal.Equal {
readonly _id: TypeId;
readonly length: number;
get array(): ReadonlyArray;
/**
* @since 1.0.0
*/
toReadonlyArray(this: Chunk): ReadonlyArray;
/**
* @since 1.0.0
*/
isNonEmpty(this: Chunk): this is NonEmptyChunk;
/**
* @since 1.0.0
*/
isEmpty(this: Chunk): boolean;
/**
* @since 1.0.0
*/
map(this: Chunk, f: (a: A) => B): Chunk;
/**
* @since 1.0.0
*/
flatMap(this: Chunk, f: (a: A) => Chunk): Chunk;
/**
* @since 1.0.0
*/
forEach(this: Chunk, f: (a: A) => void): void;
/**
* @since 1.0.0
*/
append(this: Chunk, b: B): Chunk;
/**
* @since 1.0.0
*/
prepend(this: Chunk, b: B): Chunk;
/**
* @since 1.0.0
*/
concat(this: Chunk, that: Chunk): Chunk;
/**
* @since 1.0.0
*/
get(this: Chunk, index: number): Option;
/**
* @since 1.0.0
*/
unsafeGet(this: Chunk, index: number): A;
}
/**
* @since 1.0.0
* @category type lambdas
*/
export interface ChunkTypeLambda extends TypeLambda {
readonly type: Chunk;
}
/**
* Checks if `u` is a `Chunk`
*
* @since 1.0.0
* @category constructors
*/
export declare const isChunk: {
(u: Iterable): u is Chunk;
(u: unknown): u is Chunk;
};
/**
* @since 1.0.0
* @category constructors
*/
export declare const empty: () => Chunk;
/**
* Converts from an `Iterable`
*
* @since 1.0.0
* @category conversions
*/
export declare const fromIterable: (self: Iterable) => Chunk;
/**
* Converts to a `ReadonlyArray`
*
* @since 1.0.0
* @category conversions
*/
export declare const toReadonlyArray: (self: Chunk) => readonly A[];
/**
* This function provides a safe way to read a value at a particular index from a `Chunk`.
*
* @since 1.0.0
* @category elements
*/
export declare const get: ((self: Chunk, index: number) => Option) & ((index: number) => (self: Chunk) => Option);
/**
* Wraps an array into a chunk without copying, unsafe on mutable arrays
*
* @since 1.0.0
* @category unsafe
*/
export declare const unsafeFromArray: (self: readonly A[]) => Chunk;
/**
* Gets an element unsafely, will throw on out of bounds
*
* @since 1.0.0
* @category unsafe
*/
export declare const unsafeGet: ((self: Chunk, index: number) => A) & ((index: number) => (self: Chunk) => A_1);
/**
* Appends the value to the chunk
*
* @since 1.0.0
* @category mutations
*/
export declare const append: ((self: Chunk, a: A2) => Chunk) & ((a: A2_1) => (self: Chunk) => Chunk);
/**
* Prepends the value to the chunk
*
* @since 1.0.0
* @category mutations
*/
export declare const prepend: ((self: Chunk, elem: B) => Chunk) & ((elem: B_1) => (self: Chunk) => Chunk);
/**
* Takes the first up to `n` elements from the chunk
*
* @since 1.0.0
* @category mutations
*/
export declare const take: ((self: Chunk, n: number) => Chunk) & ((n: number) => (self: Chunk) => Chunk);
/**
* Drops the first up to `n` elements from the chunk
*
* @since 1.0.0
* @category mutations
*/
export declare const drop: ((self: Chunk, n: number) => Chunk) & ((n: number) => (self: Chunk) => Chunk);
/**
* Drops the last `n` elements.
*
* @since 1.0.0
* @category mutations
*/
export declare const dropRight: ((self: Chunk, n: number) => Chunk) & ((n: number) => (self: Chunk) => Chunk);
/**
* Drops all elements so long as the predicate returns true.
*
* @since 1.0.0
* @category mutations
*/
export declare const dropWhile: ((self: Chunk, f: (a: A) => boolean) => Chunk) & ((f: (a: A_1) => boolean) => (self: Chunk) => Chunk);
/**
* @category mutations
* @since 1.0.0
*/
export declare const prependAllNonEmpty: {
(self: Chunk, that: NonEmptyChunk): NonEmptyChunk;
(self: NonEmptyChunk, that: Chunk): NonEmptyChunk;
} & {
(that: NonEmptyChunk): (self: Chunk) => NonEmptyChunk;
(that: Chunk): (self: NonEmptyChunk) => NonEmptyChunk;
};
/**
* Concatenates the two chunks
*
* @since 1.0.0
* @category mutations
*/
export declare const concat: ((self: Chunk, that: Chunk) => Chunk) & ((that: Chunk) => (self: Chunk) => Chunk);
/**
* Compares the two chunks of equal length using the specified function
*
* @since 1.0.0
* @category elements
*/
export declare const correspondsTo: ((self: Chunk, that: Chunk, f: (a: A, b: B) => boolean) => boolean) & ((that: Chunk, f: (a: A_1, b: B_1) => boolean) => (self: Chunk) => boolean);
/**
* Returns a filtered and mapped subset of the elements.
*
* @since 1.0.0
* @category filtering
*/
export declare const filterMap: ((self: Iterable, f: (a: A) => Option) => Chunk) & ((f: (a: A_1) => Option) => (self: Iterable) => Chunk);
/**
* Returns a filtered and mapped subset of the elements.
*
* @since 1.0.0
* @category filtering
*/
export declare const filter: {
(self: Chunk, refinement: Refinement): Chunk;
(self: Chunk, predicate: Predicate): Chunk;
} & {
(refinement: Refinement): (self: Chunk) => Chunk;
(predicate: Predicate): (self: Chunk) => Chunk;
};
/**
* Returns a filtered and mapped subset of the elements.
*
* @since 1.0.0
* @category filtering
*/
export declare const filterMapWithIndex: ((self: Iterable, f: (a: A, i: number) => Option) => Chunk) & ((f: (a: A_1, i: number) => Option) => (self: Iterable) => Chunk);
/**
* Transforms all elements of the chunk for as long as the specified function returns some value
*
* @since 1.0.0
* @category filtering
*/
export declare const filterMapWhile: ((self: Iterable, f: (a: A) => Option) => Chunk) & ((f: (a: A_1) => Option) => (self: Iterable) => Chunk);
/**
* Tests whether a value is a member of a `Chunk`.
*
* @since 1.0.0
* @category elements
*/
export declare const elem: ((self: Chunk, b: B) => boolean) & ((b: B_1) => (self: Chunk) => boolean);
/**
* Filter out optional values
*
* @since 1.0.0
* @category filtering
*/
export declare const compact: (self: Iterable