/**
* Data structure which represents non-empty arrays
*/
import "../../../Operator/index.js";
import type { Predicate, Refinement } from "../../../Function/index.js";
import type { Option } from "../../../Option/index.js";
import * as A from "../Array/index.js";
import type * as Tp from "../Tuple/index.js";
export declare type NonEmptyArray = A.Array & {
readonly 0: A;
};
/**
* Append an element to the front of an array, creating a new non empty array
*
* @example
* assert.deepStrictEqual(cons(1, [2, 3, 4]), [1, 2, 3, 4])
*/
export declare const prepend_: (tail: A.Array, head: A) => NonEmptyArray;
/**
* Append an element to the front of an array, creating a new non empty array
*
* @ets_data_first prepend_
*/
export declare const prepend: (head: A) => (tail: A.Array) => NonEmptyArray;
/**
* Append an element to the end of an array, creating a new non empty array
*
* @example
* assert.deepStrictEqual(snoc([1, 2, 3], 4), [1, 2, 3, 4])
*/
export declare const append_: (init: A.Array, end: A) => NonEmptyArray;
/**
* Append an element to the end of an array, creating a new non empty array
*
* @ets_data_first append_
*/
export declare const append: (end: A) => (init: A.Array) => NonEmptyArray;
/**
* Builds a `ReadonlyNonEmptyArray` from an array returning `none` if `as` is an empty array
*/
export declare function fromArray(as: A.Array): Option>;
/**
* Takes the first element
*/
export declare function head(nea: NonEmptyArray): A;
/**
* Takes the last element
*/
export declare function tail(nea: NonEmptyArray): A.Array;
/**
* Reverse the array
*/
export declare const reverse: (nea: NonEmptyArray) => NonEmptyArray;
/**
* Takes the last element
*/
export declare function last(nea: NonEmptyArray): A;
/**
* Get all but the last element of a non empty array, creating a new array.
*
* @example
* assert.deepStrictEqual(init([1, 2, 3]), [1, 2])
* assert.deepStrictEqual(init([1]), [])
*/
export declare function init(nea: NonEmptyArray): A.Array;
/**
* Insert an element at the specified index, creating a new array,
* or returning None if the index is out of bounds
*
* @ets_data_first insertAt_
*/
export declare function insertAt(i: number, a: A): (nea: NonEmptyArray) => Option>;
/**
* Insert an element at the specified index, creating a new array,
* or returning None if the index is out of bounds
*/
export declare function insertAt_(nea: NonEmptyArray, i: number, a: A): Option>;
/**
* Change the element at the specified index,
* creating a new array, or returning None if the index is out of bounds
*
* @ets_data_first updateAt_
*/
export declare function updateAt(i: number, a: A): (nea: NonEmptyArray) => Option>;
/**
* Change the element at the specified index,
* creating a new array, or returning None if the index is out of bounds
*/
export declare function updateAt_(nea: NonEmptyArray, i: number, a: A): Option>;
/**
* Apply a function to the element at the specified index,
* creating a new array, or returning None if the index is out of bounds
*
* @ets_data_first modifyAt_
*/
export declare function modifyAt(i: number, f: (a: A) => A): (nea: NonEmptyArray) => Option>;
/**
* Apply a function to the element at the specified index,
* creating a new array, or returning None if the index is out of bounds
*/
export declare function modifyAt_(nea: NonEmptyArray, i: number, f: (a: A) => A): Option>;
/**
* Filters the array
*
* @ets_data_first filter_
*/
export declare function filter(refinement: Refinement): (nea: NonEmptyArray) => Option>;
export declare function filter(predicate: Predicate): (nea: NonEmptyArray) => Option>;
/**
* Filters the array
*/
export declare function filter_(nea: NonEmptyArray, refinement: Refinement): Option>;
export declare function filter_(nea: NonEmptyArray, predicate: Predicate): Option>;
/**
* Filters the array also passing element index
*
* @ets_data_first filterWithIndex_
*/
export declare function filterWithIndex(predicate: (i: number, a: A) => boolean): (nea: NonEmptyArray) => Option>;
/**
* Filters the array also passing element index
*/
export declare function filterWithIndex_(nea: NonEmptyArray, predicate: (i: number, a: A) => boolean): Option>;
/**
* Construct an array with a single element
*/
export declare const single: (a: A) => NonEmptyArray;
/**
* Concatenate arrays
*/
export declare function concat_(fx: A.Array, fy: NonEmptyArray): NonEmptyArray;
export declare function concat_(fx: NonEmptyArray, fy: A.Array): NonEmptyArray;
/**
* Concatenate arrays
*
* @ets_data_first concat_
*/
export declare function concat(fy: NonEmptyArray): (fx: A.Array) => NonEmptyArray;
export declare function concat(fy: A.Array): (fx: A.Array) => NonEmptyArray;
/**
* Apply a function to pairs of elements at the same index in two arrays,
* collecting the results in a new array. If one input array is short, excess
* elements of the longer array are discarded.
*/
export declare const zipWith_: (fa: NonEmptyArray, fb: NonEmptyArray, f: (a: A, b: B) => C) => NonEmptyArray;
/**
* Apply a function to pairs of elements at the same index in two arrays,
* collecting the results in a new array. If one input array is short, excess
* elements of the longer array are discarded.
*
* @ets_data_first zipWith_
*/
export declare const zipWith: (fb: NonEmptyArray, f: (a: A, b: B) => C) => (fa: NonEmptyArray) => NonEmptyArray;
/**
* Takes two arrays and returns an array of corresponding pairs.
* If one input array is short, excess elements of the longer array are discarded
*/
export declare const zip_: (fa: NonEmptyArray, fb: NonEmptyArray) => NonEmptyArray>;
/**
* Takes two arrays and returns an array of corresponding pairs.
* If one input array is short, excess elements of the longer array are discarded
*
* @ets_data_first zip_
*/
export declare const zip: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray>;
/**
* The function is reverse of zip. Takes an array of pairs
* and return two corresponding arrays
*/
export declare const unzip: (as: NonEmptyArray>) => Tp.Tuple<[NonEmptyArray, NonEmptyArray]>;
/**
* Classic Applicative's ap
*
* @ets_data_first ap_
*/
export declare const ap: (fa: NonEmptyArray) => (fab: NonEmptyArray<(a: A) => B>) => NonEmptyArray;
/**
* Classic Applicative's ap
*/
export declare const ap_: (fab: NonEmptyArray<(a: A) => B>, fa: NonEmptyArray) => NonEmptyArray;
/**
* Composes computations in sequence, using the return value
* of one computation to determine the next computation.
*
* @ets_data_first chain_
*/
export declare const chain: (f: (a: A) => NonEmptyArray) => (ma: NonEmptyArray) => NonEmptyArray;
/**
* Composes computations in sequence, using the return value
* of one computation to determine the next computation.
*/
export declare const chain_: (ma: NonEmptyArray, f: (a: A) => NonEmptyArray) => NonEmptyArray;
/**
* Array[A] => Array[Array[A]]
*/
export declare const duplicate: (ma: NonEmptyArray) => NonEmptyArray>;
/**
* Extends calls f with all the progressive slices up to the current
* element's index, and uses the return value to construct the result array
*
* i.e: like map that also consumes all the elements up to `i`
*
* @ets_data_first extend_
*/
export declare const extend: (f: (fa: NonEmptyArray) => B) => (ma: NonEmptyArray) => NonEmptyArray;
/**
* Extends calls f with all the progressive slices up to the current
* element's index, and uses the return value to construct the result array
*
* i.e: like map that also consumes all the elements up to `i`
*/
export declare const extend_: (ma: NonEmptyArray, f: (fa: NonEmptyArray) => B) => NonEmptyArray;
/**
* Removes one level of nesting
*/
export declare const flatten: (mma: NonEmptyArray>) => NonEmptyArray;
/**
* Apply f to every element of Array returning Array
*
* @ets_data_first map_
*/
export declare const map: (f: (a: A) => B) => (fa: NonEmptyArray) => NonEmptyArray;
/**
* Apply f to every element of Array returning Array
*/
export declare const map_: (fa: NonEmptyArray, f: (a: A) => B) => NonEmptyArray;
/**
* Like map but also passes the index to f
*
* @ets_data_first mapWithIndex_
*/
export declare const mapWithIndex: (f: (i: number, a: A) => B) => (fa: NonEmptyArray) => NonEmptyArray;
/**
* Like map but also passes the index to f
*/
export declare const mapWithIndex_: (fa: NonEmptyArray, f: (i: number, a: A) => B) => NonEmptyArray;
/**
* Construct B by compacting with f over the array from left to right
*
* @ets_data_first reduce_
*/
export declare const reduce: (b: B, f: (b: B, a: A) => B) => (fa: NonEmptyArray) => B;
/**
* Construct B by compacting with f over the array from left to right
*/
export declare const reduce_: (fa: NonEmptyArray, b: B, f: (b: B, a: A) => B) => B;
/**
* Construct B by compacting with f over the array from right to left
*
* @ets_data_first reduceRight_
*/
export declare const reduceRight: (b: B, f: (a: A, b: B) => B) => (fa: NonEmptyArray) => B;
/**
* Construct B by compacting with f over the array from right to left
*/
export declare const reduceRight_: (fa: NonEmptyArray, b: B, f: (a: A, b: B) => B) => B;
/**
* Construct B by compacting with f over the array from right to left
*
* @ets_data_first reduceRightWithIndex_
*/
export declare const reduceRightWithIndex: (b: B, f: (i: number, a: A, b: B) => B) => (fa: NonEmptyArray) => B;
/**
* Construct B by compacting with f over the array from right to left
*/
export declare const reduceRightWithIndex_: (fa: NonEmptyArray, b: B, f: (i: number, a: A, b: B) => B) => B;
/**
* Construct B by compacting with f over the array from left to right
*
* @ets_data_first reduceWithIndex_
*/
export declare const reduceWithIndex: (b: B, f: (i: number, b: B, a: A) => B) => (fa: NonEmptyArray) => B;
/**
* Construct B by compacting with f over the array from left to right
*/
export declare const reduceWithIndex_: (fa: NonEmptyArray, b: B, f: (i: number, b: B, a: A) => B) => B;
/**
* Constructs a NonEmptyArray
*/
export declare function make]>(arr: T): NonEmptyArray;
//# sourceMappingURL=index.d.ts.map