/** * This file contains a collection of utilities and * algebraic structure implementations for ReadonlyArray * in JavaScript. * * @module Array * @since 2.0.0 */ import "./_dnt.polyfills.js"; import type { $, AnySub, Intersect, Kind, Out } from "./kind.js"; import type { Applicable } from "./applicable.js"; import type { Combinable } from "./combinable.js"; import type { Comparable } from "./comparable.js"; import type { Either } from "./either.js"; import type { Filterable } from "./filterable.js"; import type { Flatmappable } from "./flatmappable.js"; import type { Initializable } from "./initializable.js"; import type { Mappable } from "./mappable.js"; import type { Option } from "./option.js"; import type { Pair } from "./pair.js"; import type { Foldable } from "./foldable.js"; import type { Showable } from "./showable.js"; import type { Sortable } from "./sortable.js"; import type { Traversable } from "./traversable.js"; import type { Wrappable } from "./wrappable.js"; /** * This type can be used as a placeholder for an array of any type. * * @since 2.0.0 */ export type AnyArray = ReadonlyArray; /** * This type alias unwraps the inner type of a ReadonlyArray. * * @since 2.0.0 */ export type TypeOf = T extends ReadonlyArray ? A : never; /** * This type alias represents a ReadonlyArray conuaining * at least one value at the head. * * @since 2.0.0 */ export type NonEmptyArray = readonly [A, ...A[]]; /** * This type can be used as a placeholder for a non-init array of any type. * * @since 2.0.0 */ export type AnyNonEmptyArray = NonEmptyArray; /** * Specifies ReadonlyArray as a Higher Kinded Type, with covariant * parameter A corresponding to the 0th index of any substitutions. * * @since 2.0.0 */ export interface KindArray extends Kind { readonly kind: ReadonlyArray>; } /** * *UNSAFE* This operation creates a new array from ua with the value a inserted * at the given index. The insertion index must be tested as in bounds before * calling this function. This function is intended for internal use only and * thus has no api guaruntees. * * @since 2.0.0 */ export declare function _unsafeInsertAt(index: number, a: A, ua: ReadonlyArray): ReadonlyArray; /** * *UNSAFE* This operation creates a new array from ua with the value a changed * at the given index. The insertion index must be tested as in bounds before * calling this function. This function is intended for internal use only and * thus has no api guaruntees. * * @since 2.0.0 */ export declare function _unsafeUpdateAt(index: number, a: A, ua: ReadonlyArray): ReadonlyArray; /** * *UNSAFE* This operation creates a new array from ua with the value deleted * at the given index. The deletiong index must be tested as in bounds before * calling this function. This function is intended for internal use only and * thus has no api guaruntees. * * @since 2.0.0 */ export declare function _unsafeDeleteAt(index: number, ua: ReadonlyArray): ReadonlyArray; /** * *UNSAFE* This operation mutates a standard Array by pushing onto it. * This function is intended for internal use only and thus has no api * guaruntees. * * @since 2.0.0 */ export declare function _unsafeAppend(last: A): (ua: Array) => Array; /** * *UNSAFE* This operation mutates a standard Array by pushing onto it. * This function is intended for internal use only and thus has no api * guaruntees. * * @since 2.0.0 */ export declare function _unsafePush(ua: Array, a: A): Array; /** * *UNSAFE* This operation muuates a standard Array by unshifting onto it. * This function is intended for internal use only and thus has no api * guaruntees. * * @since 2.0.0 */ export declare function _unsafePrepend(head: A): (ua: Array) => Array; /** * *UNSAFE* This operation mutates a standard Array by adding all elements * from a second array to it. This function is intended for internal use only * and thus has no api guaruntees. * * @since 2.0.0 */ export declare function _unsafeJoin(into: Array, from: ReadonlyArray): Array; /** * Given an index and a ReadonlyArray, return true if the index is valid * for the given array. This tests whether index is between 0 and arr.length * inclusive. * * @example * ```ts * import * as A from "./array.ts"; * * const arr = A.wrap(1); * * const result1 = A.isOutOfBounds(0, arr); // false * const result2 = A.isOutOfBounds(-1, arr); // true * const result3 = A.isOutOfBounds(10, arr); // true * ``` * * @since 2.0.0 */ export declare function isOutOfBounds(index: number, ua: ReadonlyArray): boolean; /** * This predicate over ReadonlyArray returns true when called with an * default array, otherwise it returns false. * * @example * ```ts * import * as A from "./array.ts"; * * const arr1 = A.init(); * const arr2 = A.wrap(1); * * const result1 = A.isEmpty(arr1); // true * const result2 = A.isEmpty(arr2); // false * ``` * * @since 2.0.0 */ export declare function isEmpty(ua: ReadonlyArray): boolean; /** * A Refinement, NonEmptyArray>, returning true if * called with an array that has at least one item. * * @example * ```ts * import * as A from "./array.ts"; * * const arr1 = [1] * const arr2 = A.init(); * * const result1 = A.isNonEmpty(arr1); * // true and arr1 has type NonEmptyArray * const result2 = A.isNonEmpty(arr2); * // false * ``` * * @since 2.0.0 */ export declare function isNonEmpty(a: ReadonlyArray): a is NonEmptyArray; /** * Create a NonEmptyArray from a variadic number of arguments. * * @example * ```ts * import * as A from "./array.ts"; * * const result = A.array(1, 2, 3, 4); // [1, 2, 3, 4] * ``` * * @since 2.0.0 */ export declare function array(...a: NonEmptyArray): NonEmptyArray; /** * Create a range of numbers with count values, starting at start (default 0) * and stepping by step (default 1). * * @example * ```ts * import * as A from "./array.ts"; * * const result1 = A.range(3); // [0, 1, 2] * const result2 = A.range(3, 1); // [1, 2, 3] * const result3 = A.range(3, -1, 0.1); // [-1, -0.9, -0.8] * const result4 = A.range(2.5); // [0, 1] * const result5 = A.range(-1); // [] * ``` * * @since 2.0.0 */ export declare function range(count: number, start?: number, step?: number): ReadonlyArray; /** * Create an init array of type A (defaulting to never). * * @example * ```ts * import * as A from "./array.ts"; * * const result = A.init(); // ReadonlyArray * ``` * * @since 2.0.0 */ export declare function init(): ReadonlyArray; /** * Create a NonEmptyArray conuaining the value A. * * @example * ```ts * import * as A from "./array.ts"; * * const result = A.wrap(1); // [1] of type NonEmptyArray * ``` * * @since 2.0.0 */ export declare function wrap(a: A): NonEmptyArray; /** * Given two arrays first and second, if first is default the return second, * otherwise return first. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result1 = pipe( * A.init(), * A.alt(A.wrap(1)), * ); // [1] * const result2 = pipe( * A.array(1, 2, 3), * A.alt(A.array(3, 2, 1)), * ); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function alt(second: ReadonlyArray): (first: ReadonlyArray) => ReadonlyArray; /** * Applicable the function fai: (A, index) => I to every element in the array ua. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.array("Hello", "World"), * A.map(s => s.length), * ); // [5, 5] * ``` * * @since 2.0.0 */ export declare function map(fai: (a: A, i: number) => I): (ua: ReadonlyArray) => ReadonlyArray; /** * Reduce an array from left to right, accumulating into a type O via the * function foao: (O, A, index) => O and an initial value O. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.range(5, 1), * A.fold((sum, value, index) => sum + value + index, 0), * ); * // 0 + 0 + 0 = 0 * // 0 + 1 + 1 = 2 * // 2 + 2 + 2 = 6 * // 6 + 3 + 3 = 12 * // 12 + 4 + 4 = 20 * // 20 * ``` * * @since 2.0.0 */ export declare function fold(foao: (o: O, a: A, i: number) => O, o: O): (ua: ReadonlyArray) => O; /** * Given two arrays first and second, join them into a new array effectively * doing [...first, ...second]. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.range(3, 1), * A.combine(A.range(3, 3, -1)) * ); // [1, 2, 3, 3, 2, 1] * ``` * * @since 2.0.0 */ export declare function combine(second: ReadonlyArray): (first: ReadonlyArray) => ReadonlyArray; /** * Given an array of arrays, flatten all inner arrays into a single * external array. * * @example * ```ts * import * as A from "./array.ts"; * * const result = A.join(A.array( * A.range(3), * A.range(2), * A.range(1), * )); // [0, 1, 2, 0, 1, 0] * ``` * * @since 2.0.0 */ export declare function join(uaa: ReadonlyArray>): ReadonlyArray; /** * Given a function A -> ReadonlyArray and a ReadonlyArray apply the * function to every value in the array and combine all results, returning a * ReadonlyArray. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.range(3, 1, 3), // [1, 4, 7] * A.flatmap(n => [n, n + 1, n + 2]), // ie. 1 -> [1, 2, 3] * ); // [1, 2, 3, 4, 5, 6, 7, 8, 9] * ``` * * @since 2.0.0 */ export declare function flatmap(fati: (a: A, index: number) => ReadonlyArray): (ua: ReadonlyArray) => ReadonlyArray; /** * Given an array of functions ReadonlyArray I> and a ReadonlyArray * apply every function in the function array to every value in the * ReadonlyArray. This implementation loops first over the functions, and then * over the values, so the order of results will be [fn1(val1), fn2(val1), * fn3(val1), ..., fn1(val2), fn2(val2), ... fn1(valN), ... fnN(valN)]. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.wrap((n: number) => n + 1), * A.apply(A.array(1, 2, 3)), * ); // [2, 3, 4] * ``` * * @since 2.0.0 */ export declare function apply(ua: ReadonlyArray): (ufai: ReadonlyArray<(a: A, index: number) => I>) => ReadonlyArray; /** * Given a Predicate or Refinement, apply the predicate or refinement to * every value in an array, removing (and refining) the elements that * the predicate or refinement return false for. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.array(1, 2, 3, 4, 5, 6), * A.filter(n => n % 2 === 0), * ); // [2, 4, 6] * ``` * * @since 2.0.0 */ export declare function filter(refinement: (a: A, index: number) => a is B): (ua: ReadonlyArray) => ReadonlyArray; export declare function filter(predicate: (a: A, index: number) => boolean): (ua: ReadonlyArray) => ReadonlyArray; /** * Filter and map over an ReadonlyArray in the same step. This function * applies the predicate to each value in an array. If the predicate * returns Some, then the inner I is added to the output array. * * @example * ```ts * import * as A from "./array.ts"; * import * as O from "./option.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.array("Hello", "Big", "World"), * A.filterMap(s => s.includes("o") ? O.some(s.toUpperCase()) : O.none), * ); // ["HELLO", "WORLD"] * ``` * * @since 2.0.0 */ export declare function filterMap(predicate: (a: A, index: number) => Option): (ua: ReadonlyArray) => ReadonlyArray; /** * Partition a ReadonlyArray into two ReadonlyArrays using a predicate or * refinement to do the sorting. If the predicate or refinement returns true for * a value, the value is pushed into the first array in a Pair, otherwise it is * pushed into the second array in a pair. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.range(10, 1), // [1, 2, 3, ..., 10] * A.partition(n => n % 2 === 0), * ); // Pair<[2, 4, 6, 8, 10], [1, 3, 5, 7, 9]> * ``` * * @since 2.0.0 */ export declare function partition(refinement: (a: A, index: number) => a is B): (ua: ReadonlyArray) => Pair, ReadonlyArray>; export declare function partition(predicate: (a: A, index: number) => boolean): (ua: ReadonlyArray) => Pair, ReadonlyArray>; /** * Partition and map over a ReadonlyArray in the same loop. Given a predicate * A => Either, this function passes each element in an array into the * predicate. If the predicate returns Right then the inner I is pushed into * the first array in a pair. If the predicate returns Left then the inner J * is pushed into the second array in a pair. * * @example * ```ts * import * as A from "./array.ts"; * import * as E from "./either.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * A.range(10, 1), // [1, 2, 3, ..., 10] * A.partitionMap(n => n % 2 === 0 ? E.right(n * 100) : E.left(n / 10)), * ); // Pair<[200, 400, 600, 800, 1000], [0.1, 0.3, 0.5, 0.7, 0.9]> * ``` * * @since 2.0.0 */ export declare function partitionMap(predicate: (a: A, index: number) => Either): (ua: ReadonlyArray) => Pair, ReadonlyArray>; /** * Traverse a ReadonlyArray using an Applicable over V and a mapping * function A => V. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe, identity } from "./fn.ts"; * * const traverse = A.traverse(A.ApplicableArray); * * const result = pipe( * [[1, 2], [3, 4]], * traverse(identity), * ); // [[1, 3], [1, 4], [2, 3], [2, 4]] * ``` * * @since 2.0.0 */ export declare function traverse(A: Applicable): (favi: (a: A, i: number) => $) => (ua: ReadonlyArray) => $, J, K], [L], [M]>; type ANY_ARR = any[]; /** * The Sequence inverts a tuple of substitutions over V into V containing a * tuple of inferred values of the substitution. * * ie. * [Option, Option] * becomes * Option<[number, string]> * * or * * [Either Either] * becomes * Either */ type Sequence[]> = $ ? A : never; }, { [K in keyof R]: R[K] extends $ ? B : never; }[number], { [K in keyof R]: R[K] extends $ ? C : never; }[number] ], [ Intersect<{ [K in keyof R]: R[K] extends $ ? D : never; }[number]> ], [ Intersect<{ [K in keyof R]: R[K] extends $ ? E : never; }[number]> ]>; /** * Sequence over an array of type V, inverting the relationship between V and * ReadonlyArray. This function also keeps the indexed types of in each V at * covariant position 0. In other words sequence over [Option, * Option] becomes Option<[number, string]>. * * @example * ```ts * import * as A from "./array.ts"; * import * as O from "./option.ts"; * * const sequence = A.sequence(O.ApplicableOption); * * const result1 = sequence(O.some(1), O.some("Hello")); // Some([1, "Hello"]) * const result2 = sequence(O.none, O.some("Uh Oh")); // None * ``` * * @since 2.0.0 */ export declare function sequence(A: Applicable): []>(...ua: VS) => Sequence; /** * Create a new array by appending an item to the end of an existing array. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * [1, 2, 3], * A.append(4), * ); // [1, 2, 3, 4] * ``` * * @since 2.0.0 */ export declare function append(last: A): (ua: ReadonlyArray) => ReadonlyArray; /** * Create a new array by prepending an item to the head of an existing array. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe( * [1, 2, 3], * A.prepend(4), * ); // [4, 1, 2, 3] * ``` * * @since 2.0.0 */ export declare function prepend(head: A): (ua: ReadonlyArray) => ReadonlyArray; /** * Create a new array by inserting a value into an array at an index. If the * index is out of range of the existing array then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const insert = A.insert(100); // Insert the value 100 * const arr = [1, 2, 3]; * * const result1 = pipe(arr, insert(0)); // [100, 1, 2, 3] * const result2 = pipe(arr, insert(1)); // [1, 100, 2, 3] * const result3 = pipe(arr, insert(4)); // [1, 2, 3, 100] * const result4 = pipe(arr, insert(4)); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function insert(value: A): (index: number) => (arr: ReadonlyArray) => ReadonlyArray; /** * Create a new array by inserting a value into an array at an index. If the * index is out of range of the existing array then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const insertAt = A.insertAt(0); // Insert at index 0 * const arr = [1, 2, 3]; * * const result1 = pipe(arr, insertAt(0)); // [0, 1, 2, 3] * const result2 = pipe(arr, insertAt(1)); // [1, 1, 2, 3] * const result3 = pipe( * arr, * A.insertAt(100)(100), * ); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function insertAt(index: number): (value: A) => (arr: readonly A[]) => readonly A[]; /** * Create a new array by replacing a value of an array at an index. If the * index is out of range of the existing array then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const update = A.update(100); // Update the value 100 * const arr = [1, 2, 3]; * * const result1 = pipe(arr, update(0)); // [100, 2, 3] * const result2 = pipe(arr, update(1)); // [1, 100, 3] * const result3 = pipe(arr, update(4)); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function update(value: A): (index: number) => (arr: ReadonlyArray) => ReadonlyArray; /** * Create a new array by replacing a value of an array at an index. If the * index is out of range of the existing array then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const updateAt = A.updateAt(0); // Update at index 0 * const arr = [1, 2, 3]; * * const result1 = pipe(arr, updateAt(100)); // [100, 2, 3] * const result2 = pipe(arr, updateAt(200)); // [200, 2, 3] * const result3 = pipe(arr, A.updateAt(100)(100)); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function updateAt(index: number): (value: A) => (arr: readonly A[]) => readonly A[]; /** * Create a new array by modifying a value of an array at an index. If the * index is out of range of the existing array then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const modify = A.modify((n: number) => n + 1); // Increment the value * const arr = [1, 2, 3]; * * const result1 = pipe(arr, modify(0)); // [2, 2, 3] * const result2 = pipe(arr, modify(1)); // [1, 3, 3] * const result3 = pipe(arr, modify(4)); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function modify(modifyFn: (a: A) => A): (index: number) => (arr: ReadonlyArray) => ReadonlyArray; /** * Create a new array by modifying a value of an array at an index. If the * index is out of range of the existing array then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const inc = (n: number) => n + 1 * const modifyAt = A.modifyAt(0); // Modify value at * const arr = [1, 2, 3]; * * const result1 = pipe(arr, modifyAt(inc)); // [2, 2, 3] * const result2 = pipe(arr, A.modifyAt(100)(inc)); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function modifyAt(index: number): (modifyFn: (a: A) => A) => (arr: readonly A[]) => readonly A[]; /** * Lookup the value in an array at the given index. If the index is out of * bounds this function returns none. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result1 = pipe( * [1, 2, 3], * A.lookup(0), * ); // Some(1) * const result2 = pipe( * [1, 2, 3], * A.lookup(100), * ); // None * ``` * * @since 2.0.0 */ export declare function lookup(index: number): (as: readonly A[]) => Option; /** * Delete the value in an array at the given index. If the index is out of * bounds then no change is made. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const result1 = pipe([1, 2, 3], A.deleteAt(0)); // [2, 3] * const result2 = pipe([1, 2, 3], A.deleteAt(100)); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function deleteAt(index: number): (arr: readonly A[]) => readonly A[]; /** * Returns a new array conuaining elements of `as` sorted in ascending order * according to the sort order defined by `O`. * * @example * import { ordNumber } from "./sortable.ts"; * import { sort } from './array.ts' * * sort(ordNumber)([3, 1, 2]) * // [1, 2, 3] * * @since 2.0.0 */ export declare function sort(O: Sortable): (as: ReadonlyArray) => ReadonlyArray; /** * Given an Sortable over A, create a binary search function for a sorted * ReadonlyArray that returns the array index that the new value should * be inserted at in order to maintain a sorted array. * * @example * ```ts * import * as A from "./array.ts"; * import { SortableNumber } from "./number.ts"; * import { pipe } from "./fn.ts"; * * const search = A.binarySearch(SortableNumber); * const arr = A.range(100, 1); // [1, 2, ..., 100] * * const index1 = search(30.5, arr); // Index 29 * const index2 = search(10000, arr); // Index 100 * ``` * * @since 2.0.0 */ export declare function binarySearch({ sort }: Sortable): (value: A, sorted: ReadonlyArray) => number; /** * Given an Sortable construct a curried insert function that inserts values into * a new array in a sorted fashion. Internally this uses binarySearch to find * the insertion index of any inserted items. Since the returned function will * always insert this function will always return a new array. * * @example * ```ts * import * as A from "./array.ts"; * import * as O from "./sortable.ts"; * import { SortableNumber } from "./number.ts"; * import { pipe } from "./fn.ts"; * * type Person = { name: string, age: number }; * function person(name: string, age: number) { * return { name, age }; * } * * const SortablePerson = pipe( * SortableNumber, * O.premap((p: Person) => p.age), * ); * const insert = A.orderedInsert(SortablePerson); * * const result = pipe( * A.init(), * insert(person("Brandon", 37)), * insert(person("Emily", 32)), * insert( * person("Rufus", 0.7), * person("Clementine", 0.5) * ), * ); * // [ * // { name: "Clementine", age: 0.5 }, * // { name: "Rufus", age: 0.7 }, * // { name: "Emily", age: 32 }, * // { name: "Brandon", age: 37 }, * // ] * ``` * * @since 2.0.0 */ export declare function orderedInsert(ord: Sortable): (...values: NonEmptyArray) => (arr: ReadonlyArray) => ReadonlyArray; /** * Collect the values of many arrays into an array of tuples. Each tuple * contains an element from each of the input arrays at a shared index. The number of * tuples in the returned array will match the minimum length of the input * arrays. ie. If any input array is default, then the output array will be default. * * @example * ```ts * import * as A from "./array.ts"; * * const result1 = A.zip([1, 2, 3], ["a", "b", "c"]); * // [[1, "a"], [2, "b"], [3, "c"]] * const result2 = A.zip([], A.range(100)); // [] * ``` * * @since 2.0.0 */ export declare function zip>(...arrays: A): ReadonlyArray<{ [K in keyof A]: TypeOf; }>; /** * @since 2.0.0 */ export declare function getCombinableArray(): Combinable>; /** * Given an instance Comparable create a Comparable>. * * @example * ```ts * import * as A from "./array.ts"; * import { ComparableNumber } from "./number.ts"; * import { pipe } from "./fn.ts"; * * const { compare } = A.getComparableArray(ComparableNumber); * * const result1 = pipe([1, 2, 3], compare([1, 2, 3])); // true * const result2 = pipe(A.init(), compare([1, 2, 3])); // false * const result3 = pipe([1, 2], compare([2, 1])); // false * ``` * * @since 2.0.0 */ export declare function getComparableArray({ compare }: Comparable): Comparable>; /** * Given an instance Sortable create a Sortable>. * * @example * ```ts * import * as A from "./array.ts"; * import { SortableNumber } from "./number.ts"; * * const { sort } = A.getSortableArray(SortableNumber); * * const result1 = sort([1, 2], [1, 2]); // 0 * const result2 = sort([1, 2], [1]); // 1 * const result3 = sort([1, 2, 4], [1, 2, 3]); // -1 * ``` * * @since 2.0.0 */ export declare function getSortableArray(O: Sortable): Sortable>; /** * Create an instance of Showable for ReadonlyArray given an instance of Showable for * A. * * @example * ```ts * import * as A from "./array.ts"; * import { ShowableNumber } from "./number.ts"; * * const { show } = A.getShowableArray(ShowableNumber); * * const result = show([1, 2, 3]); // "ReadonlyArray[1, 2, 3]" * ``` * * @since 2.0.0 */ export declare function getShowableArray({ show }: Showable): Showable>; /** * Create an instance of Initializable> given a type A. This instance * uses array compose and default as the instance methods for the Initializable. * * @example * ```ts * import * as A from "./array.ts"; * import { pipe } from "./fn.ts"; * * const { init, combine } = A.getInitializableArray(); * * const result = pipe( * init(), // [] * combine([1, 2, 3]), * ); // [1, 2, 3] * ``` * * @since 2.0.0 */ export declare function getInitializableArray(): Initializable>; /** * @since 2.0.0 */ export declare const ApplicableArray: Applicable; /** * @since 2.0.0 */ export declare const FilterableArray: Filterable; /** * @since 2.0.0 */ export declare const FlatmappableArray: Flatmappable; /** * @since 2.0.0 */ export declare const MappableArray: Mappable; /** * @since 2.0.0 */ export declare const FoldableArray: Foldable; /** * @since 2.0.0 */ export declare const TraversableArray: Traversable; /** * @since 2.0.0 */ export declare const WrappableArray: Wrappable; /** * @since 2.0.0 */ export declare const tap: (fn: (value: A) => void) => (ua: readonly A[]) => readonly A[]; /** * @since 2.0.0 */ export declare const bind: (name: Exclude, faui: (a: A) => readonly I[]) => (ua: readonly A[]) => readonly { readonly [K_1 in N | keyof A]: K_1 extends keyof A ? A[K_1] : I; }[]; /** * @since 2.0.0 */ export declare const bindTo: (name: N) => (ua: readonly A[]) => readonly { readonly [K in N]: A; }[]; export {};