/**
* @since 1.0.0
*/
import type { Either } from "@effect/data/Either";
import * as Equal from "@effect/data/Equal";
import * as Equivalence from "@effect/data/Equivalence";
import type { TypeLambda } from "@effect/data/HKT";
import { type Inspectable } from "@effect/data/Inspectable";
import type { NonEmptyIterable } from "@effect/data/NonEmptyIterable";
import type { Option } from "@effect/data/Option";
import * as Order from "@effect/data/Order";
import type { Pipeable } from "@effect/data/Pipeable";
import type { Predicate, Refinement } from "@effect/data/Predicate";
declare const TypeId: unique symbol;
/**
* @category symbol
* @since 1.0.0
*/
export type TypeId = typeof TypeId;
/**
* @category models
* @since 1.0.0
*/
export interface Chunk extends Iterable, Equal.Equal, Pipeable, Inspectable {
readonly [TypeId]: {
readonly _A: (_: never) => A;
};
readonly length: number;
}
/**
* @category model
* @since 1.0.0
*/
export interface NonEmptyChunk extends Chunk, NonEmptyIterable {
}
/**
* @category type lambdas
* @since 1.0.0
*/
export interface ChunkTypeLambda extends TypeLambda {
readonly type: Chunk;
}
/**
* Compares the two chunks of equal length using the specified function
*
* @category equivalence
* @since 1.0.0
*/
export declare const getEquivalence: (isEquivalent: Equivalence.Equivalence) => Equivalence.Equivalence>;
/**
* Checks if `u` is a `Chunk`
*
* @category constructors
* @since 1.0.0
*/
export declare const isChunk: {
(u: Iterable): u is Chunk;
(u: unknown): u is Chunk;
};
/**
* @category constructors
* @since 1.0.0
*/
export declare const empty: () => Chunk;
/**
* Builds a `NonEmptyChunk` from an non-empty collection of elements.
*
* @category constructors
* @since 1.0.0
*/
export declare const make: (...as: As) => NonEmptyChunk;
/**
* Builds a `NonEmptyChunk` from a single element.
*
* @category constructors
* @since 1.0.0
*/
export declare const of: (a: A) => NonEmptyChunk;
/**
* Converts from an `Iterable`
*
* @category conversions
* @since 1.0.0
*/
export declare const fromIterable: (self: Iterable) => Chunk;
/**
* Converts the specified `Chunk` to a `ReadonlyArray`.
*
* @category conversions
* @since 1.0.0
*/
export declare const toReadonlyArray: (self: Chunk) => readonly A[];
/**
* @since 1.0.0
* @category elements
*/
export declare const reverse: (self: Chunk) => Chunk;
/**
* This function provides a safe way to read a value at a particular index from a `Chunk`.
*
* @category elements
* @since 1.0.0
*/
export declare const get: {
(index: number): (self: Chunk) => Option;
(self: Chunk, index: number): 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;
/**
* Wraps an array into a chunk without copying, unsafe on mutable arrays
*
* @since 1.0.0
* @category unsafe
*/
export declare const unsafeFromNonEmptyArray: (self: readonly [A, ...A[]]) => NonEmptyChunk;
/**
* Gets an element unsafely, will throw on out of bounds
*
* @since 1.0.0
* @category unsafe
*/
export declare const unsafeGet: {
(index: number): (self: Chunk) => A;
(self: Chunk, index: number): A;
};
/**
* Appends the specified element to the end of the `Chunk`.
*
* @category concatenating
* @since 1.0.0
*/
export declare const append: {
(a: A2): (self: Chunk) => NonEmptyChunk;
(self: Chunk, a: A2): NonEmptyChunk;
};
/**
* Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`.
*
* @category concatenating
* @since 1.0.0
*/
export declare const prepend: {
(elem: B): (self: Chunk) => NonEmptyChunk;
(self: Chunk, elem: B): NonEmptyChunk;
};
/**
* Takes the first up to `n` elements from the chunk
*
* @since 1.0.0
*/
export declare const take: {
(n: number): (self: Chunk) => Chunk;
(self: Chunk, n: number): Chunk;
};
/**
* Drops the first up to `n` elements from the chunk
*
* @since 1.0.0
*/
export declare const drop: {
(n: number): (self: Chunk) => Chunk;
(self: Chunk, n: number): Chunk;
};
/**
* Drops the last `n` elements.
*
* @since 1.0.0
*/
export declare const dropRight: {
(n: number): (self: Chunk) => Chunk;
(self: Chunk, n: number): Chunk;
};
/**
* Drops all elements so long as the predicate returns true.
*
* @since 1.0.0
*/
export declare const dropWhile: {
(f: (a: A) => boolean): (self: Chunk) => Chunk;
(self: Chunk, f: (a: A) => boolean): Chunk;
};
/**
* @category concatenating
* @since 1.0.0
*/
export declare const prependAll: {
(that: Chunk): (self: Chunk) => Chunk;
(self: Chunk, that: Chunk): Chunk;
};
/**
* @category concatenating
* @since 1.0.0
*/
export declare const prependAllNonEmpty: {
(that: NonEmptyChunk): (self: Chunk) => NonEmptyChunk;
(that: Chunk): (self: NonEmptyChunk) => NonEmptyChunk;
(self: Chunk, that: NonEmptyChunk): NonEmptyChunk;
(self: NonEmptyChunk, that: Chunk): NonEmptyChunk;
};
/**
* Concatenates the two chunks
*
* @category concatenating
* @since 1.0.0
*/
export declare const appendAll: {
(that: Chunk): (self: Chunk) => Chunk;
(self: Chunk, that: Chunk): Chunk;
};
/**
* @category concatenating
* @since 1.0.0
*/
export declare const appendAllNonEmpty: {
(that: NonEmptyChunk): (self: Chunk) => NonEmptyChunk;
(that: Chunk): (self: NonEmptyChunk) => NonEmptyChunk;
(self: Chunk, that: NonEmptyChunk): NonEmptyChunk;
(self: NonEmptyChunk, that: Chunk): NonEmptyChunk;
};
/**
* Returns a filtered and mapped subset of the elements.
*
* @since 1.0.0
* @category filtering
*/
export declare const filterMap: {
(f: (a: A, i: number) => Option): (self: Chunk) => Chunk;
(self: Chunk, f: (a: A, i: number) => Option): Chunk;
};
/**
* Returns a filtered and mapped subset of the elements.
*
* @since 1.0.0
* @category filtering
*/
export declare const filter: {
(refinement: Refinement): (self: Chunk) => Chunk;
(predicate: Predicate): (self: Chunk) => Chunk;
(self: Chunk, refinement: Refinement): Chunk;
(self: Chunk, predicate: Predicate): 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: {
(f: (a: A) => Option): (self: Chunk) => Chunk;
(self: Chunk, f: (a: A) => Option): Chunk;
};
/**
* Filter out optional values
*
* @since 1.0.0
* @category filtering
*/
export declare const compact: (self: Chunk